Browse Source

blobs - fix image fallback, add video fallback

Paul Frazee 5 years ago
parent
commit
9cba00215b
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      app/lib/blobs.js

+ 6
- 3
app/lib/blobs.js View File

@@ -8,7 +8,8 @@ var querystring = require('querystring')
8 8
 var fs          = require('fs')
9 9
 
10 10
 module.exports = function (sbot, config) {
11
-  var fallback_img_path = path.join(__dirname, '../../node_modules/ssbplug-phoenix/img/default-prof-pic.png')
11
+  var fallback_img_path = path.join(__dirname, '../../node_modules/ssb-patchwork-ui/img/default-prof-pic.png')
12
+  var fallback_video_path = path.join(__dirname, '../../node_modules/ssb-patchwork-ui/img/spinner.webm')
12 13
   var nowaitOpts = { nowait: true }, id = function(){}
13 14
 
14 15
   return {
@@ -85,8 +86,10 @@ module.exports = function (sbot, config) {
85 86
         sbot.blobs.has(parsed.hash, function(err, has) {
86 87
           if (!has) {
87 88
             sbot.blobs.want(parsed.hash, nowaitOpts, id)
88
-            if (parsed.qs.fallback == 'img') {
89
-              return fs.createReadStream(fallback_img_path)
89
+            if (parsed.qs.fallback) {
90
+              var p = (parsed.qs.fallback == 'video') ? fallback_video_path : fallback_img_path
91
+              console.log('falling back', p)
92
+              return fs.createReadStream(p)
90 93
                 .on('error', function () {
91 94
                   res.writeHead(404)
92 95
                   res.end('File not found')

Loading…
Cancel
Save