diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-21 12:28:32 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-21 13:13:49 +0200 |
commit | dc0091326156aaeda566151b65fe8d49097750b9 (patch) | |
tree | 7e2b30d3db3a4c2f7ba65c84c607815396f018bf | |
parent | c731ee4efdbc3c6e867b024110fc12aac326f543 (diff) | |
download | PeerTube-dc0091326156aaeda566151b65fe8d49097750b9.tar.gz PeerTube-dc0091326156aaeda566151b65fe8d49097750b9.tar.zst PeerTube-dc0091326156aaeda566151b65fe8d49097750b9.zip |
Client: avoid "quit friends" to appear during the pending request
-rw-r--r-- | client/src/app/admin/friends/friend-list/friend-list.component.html | 2 | ||||
-rw-r--r-- | server.js | 8 | ||||
-rw-r--r-- | server/initializers/constants.js | 5 |
3 files changed, 10 insertions, 5 deletions
diff --git a/client/src/app/admin/friends/friend-list/friend-list.component.html b/client/src/app/admin/friends/friend-list/friend-list.component.html index d786a7846..20b4d12db 100644 --- a/client/src/app/admin/friends/friend-list/friend-list.component.html +++ b/client/src/app/admin/friends/friend-list/friend-list.component.html | |||
@@ -20,7 +20,7 @@ | |||
20 | </tbody> | 20 | </tbody> |
21 | </table> | 21 | </table> |
22 | 22 | ||
23 | <a *ngIf="friends?.length !== 0" class="add-user btn btn-danger pull-left" (click)="quitFriends()"> | 23 | <a *ngIf="friends && friends.length !== 0" class="add-user btn btn-danger pull-left" (click)="quitFriends()"> |
24 | Quit friends | 24 | Quit friends |
25 | </a> | 25 | </a> |
26 | 26 | ||
@@ -68,22 +68,22 @@ const apiRoute = '/api/' + constants.API_VERSION | |||
68 | app.use(apiRoute, routes.api) | 68 | app.use(apiRoute, routes.api) |
69 | 69 | ||
70 | // Static files | 70 | // Static files |
71 | app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: 0 })) | 71 | app.use('/client', express.static(path.join(__dirname, '/client/dist'), { maxAge: constants.STATIC_MAX_AGE })) |
72 | // 404 for static files not found | 72 | // 404 for static files not found |
73 | app.use('/client/*', function (req, res, next) { | 73 | app.use('/client/*', function (req, res, next) { |
74 | res.sendStatus(404) | 74 | res.sendStatus(404) |
75 | }) | 75 | }) |
76 | 76 | ||
77 | const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents')) | 77 | const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents')) |
78 | app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: '7d' })) | 78 | app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) |
79 | 79 | ||
80 | // Videos path for webseeding | 80 | // Videos path for webseeding |
81 | const videosPhysicalPath = path.join(__dirname, config.get('storage.videos')) | 81 | const videosPhysicalPath = path.join(__dirname, config.get('storage.videos')) |
82 | app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: '7d' })) | 82 | app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) |
83 | 83 | ||
84 | // Thumbnails path for express | 84 | // Thumbnails path for express |
85 | const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails')) | 85 | const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails')) |
86 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: '7d' })) | 86 | app.use(constants.STATIC_PATHS.THUMBNAILS, express.static(thumbnailsPhysicalPath, { maxAge: constants.STATIC_MAX_AGE })) |
87 | 87 | ||
88 | // Client application | 88 | // Client application |
89 | app.use('/*', function (req, res, next) { | 89 | app.use('/*', function (req, res, next) { |
diff --git a/server/initializers/constants.js b/server/initializers/constants.js index f77c4948f..8a8d5c1ce 100644 --- a/server/initializers/constants.js +++ b/server/initializers/constants.js | |||
@@ -128,6 +128,9 @@ const STATIC_PATHS = { | |||
128 | WEBSEED: '/static/webseed/' | 128 | WEBSEED: '/static/webseed/' |
129 | } | 129 | } |
130 | 130 | ||
131 | // Cache control | ||
132 | let STATIC_MAX_AGE = '30d' | ||
133 | |||
131 | // Videos thumbnail size | 134 | // Videos thumbnail size |
132 | const THUMBNAILS_SIZE = '200x110' | 135 | const THUMBNAILS_SIZE = '200x110' |
133 | 136 | ||
@@ -143,6 +146,7 @@ if (isTestInstance() === true) { | |||
143 | CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14 | 146 | CONSTRAINTS_FIELDS.VIDEOS.DURATION.max = 14 |
144 | FRIEND_SCORE.BASE = 20 | 147 | FRIEND_SCORE.BASE = 20 |
145 | REQUESTS_INTERVAL = 10000 | 148 | REQUESTS_INTERVAL = 10000 |
149 | STATIC_MAX_AGE = 0 | ||
146 | } | 150 | } |
147 | 151 | ||
148 | // --------------------------------------------------------------------------- | 152 | // --------------------------------------------------------------------------- |
@@ -164,6 +168,7 @@ module.exports = { | |||
164 | RETRY_REQUESTS, | 168 | RETRY_REQUESTS, |
165 | SEARCHABLE_COLUMNS, | 169 | SEARCHABLE_COLUMNS, |
166 | SORTABLE_COLUMNS, | 170 | SORTABLE_COLUMNS, |
171 | STATIC_MAX_AGE, | ||
167 | STATIC_PATHS, | 172 | STATIC_PATHS, |
168 | THUMBNAILS_SIZE, | 173 | THUMBNAILS_SIZE, |
169 | USER_ROLES | 174 | USER_ROLES |