]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix peertube on chrome
authorChocobozzz <me@florianbigard.com>
Thu, 26 Jul 2018 14:45:47 +0000 (16:45 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 26 Jul 2018 14:46:36 +0000 (16:46 +0200)
server.ts
server/lib/activitypub/videos.ts

index 1bfec724bf116d7f66ead98f583fd3b8a08f6998..efbfd3c9747a54162e6830ae6c5730ad8178eaea 100644 (file)
--- a/server.ts
+++ b/server.ts
@@ -53,39 +53,8 @@ app.set('trust proxy', CONFIG.TRUST_PROXY)
 app.use(helmet({
   frameguard: {
     action: 'deny' // we only allow it for /videos/embed, see server/controllers/client.ts
-  },
-  dnsPrefetchControl: {
-    allow: true
-  },
-  contentSecurityPolicy: {
-    directives: {
-      defaultSrc: ['*', 'data:', REMOTE_SCHEME.WS + ':', REMOTE_SCHEME.HTTP + ':'],
-      fontSrc: ["'self'", 'data:'],
-      frameSrc: ["'none'"],
-      mediaSrc: ['*', REMOTE_SCHEME.HTTP + ':'],
-      objectSrc: ["'none'"],
-      scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
-      styleSrc: ["'self'", "'unsafe-inline'"],
-      upgradeInsecureRequests: false
-    },
-    browserSniff: false // assumes a modern browser, but allows CDN in front
-  },
-  referrerPolicy: {
-    policy: 'strict-origin-when-cross-origin'
   }
 }))
-app.use((_, res, next) => {
-  [
-    "vibrate 'none'",
-    "geolocation 'none'",
-    "camera 'none'",
-    "microphone 'none'",
-    "magnetometer 'none'",
-    "payment 'none'",
-    "accelerometer 'none'"
-  ].forEach(e => res.append('Feature-Policy', e + ';'))
-  next()
-})
 
 // ----------- Database -----------
 
index b6f57e0abe884cc6c0945e09021760b624e4f804..b3fbf88d0eae6979e83de85e68cdc04320f0d632 100644 (file)
@@ -287,7 +287,7 @@ async function createRates (actorUrls: string[], video: VideoModel, rate: VideoR
   logger.info('Adding %d %s to video %s.', rateCounts, rate, video.uuid)
 
   // This is "likes" and "dislikes"
-  await video.increment(rate + 's', { by: rateCounts })
+  if (rateCounts !== 0) await video.increment(rate + 's', { by: rateCounts })
 
   return
 }