diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-26 16:45:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-26 16:46:36 +0200 |
commit | 3ac046e2a478a88e24d5ce82d4c43cdd64dea1a2 (patch) | |
tree | 9d8717797dbc011d5b08dcff805d2fdce9effe05 | |
parent | a5d379d305d1b5f25db96e896512e15f4f9a0ebb (diff) | |
download | PeerTube-3ac046e2a478a88e24d5ce82d4c43cdd64dea1a2.tar.gz PeerTube-3ac046e2a478a88e24d5ce82d4c43cdd64dea1a2.tar.zst PeerTube-3ac046e2a478a88e24d5ce82d4c43cdd64dea1a2.zip |
Fix peertube on chrome
-rw-r--r-- | server.ts | 31 | ||||
-rw-r--r-- | server/lib/activitypub/videos.ts | 2 |
2 files changed, 1 insertions, 32 deletions
@@ -53,39 +53,8 @@ app.set('trust proxy', CONFIG.TRUST_PROXY) | |||
53 | app.use(helmet({ | 53 | app.use(helmet({ |
54 | frameguard: { | 54 | frameguard: { |
55 | action: 'deny' // we only allow it for /videos/embed, see server/controllers/client.ts | 55 | action: 'deny' // we only allow it for /videos/embed, see server/controllers/client.ts |
56 | }, | ||
57 | dnsPrefetchControl: { | ||
58 | allow: true | ||
59 | }, | ||
60 | contentSecurityPolicy: { | ||
61 | directives: { | ||
62 | defaultSrc: ['*', 'data:', REMOTE_SCHEME.WS + ':', REMOTE_SCHEME.HTTP + ':'], | ||
63 | fontSrc: ["'self'", 'data:'], | ||
64 | frameSrc: ["'none'"], | ||
65 | mediaSrc: ['*', REMOTE_SCHEME.HTTP + ':'], | ||
66 | objectSrc: ["'none'"], | ||
67 | scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'"], | ||
68 | styleSrc: ["'self'", "'unsafe-inline'"], | ||
69 | upgradeInsecureRequests: false | ||
70 | }, | ||
71 | browserSniff: false // assumes a modern browser, but allows CDN in front | ||
72 | }, | ||
73 | referrerPolicy: { | ||
74 | policy: 'strict-origin-when-cross-origin' | ||
75 | } | 56 | } |
76 | })) | 57 | })) |
77 | app.use((_, res, next) => { | ||
78 | [ | ||
79 | "vibrate 'none'", | ||
80 | "geolocation 'none'", | ||
81 | "camera 'none'", | ||
82 | "microphone 'none'", | ||
83 | "magnetometer 'none'", | ||
84 | "payment 'none'", | ||
85 | "accelerometer 'none'" | ||
86 | ].forEach(e => res.append('Feature-Policy', e + ';')) | ||
87 | next() | ||
88 | }) | ||
89 | 58 | ||
90 | // ----------- Database ----------- | 59 | // ----------- Database ----------- |
91 | 60 | ||
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index b6f57e0ab..b3fbf88d0 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -287,7 +287,7 @@ async function createRates (actorUrls: string[], video: VideoModel, rate: VideoR | |||
287 | logger.info('Adding %d %s to video %s.', rateCounts, rate, video.uuid) | 287 | logger.info('Adding %d %s to video %s.', rateCounts, rate, video.uuid) |
288 | 288 | ||
289 | // This is "likes" and "dislikes" | 289 | // This is "likes" and "dislikes" |
290 | await video.increment(rate + 's', { by: rateCounts }) | 290 | if (rateCounts !== 0) await video.increment(rate + 's', { by: rateCounts }) |
291 | 291 | ||
292 | return | 292 | return |
293 | } | 293 | } |