From 71b429b8cfc46d7ea64400f55bd95100733ab68f Mon Sep 17 00:00:00 2001 From: "hortonr6@coventry.ac.uk" Date: Mon, 25 Nov 2019 17:27:48 +0000 Subject: [PATCH] Updated documentation --- docs/jsdoc/global.html | 2 +- docs/jsdoc/index.html | 2 +- docs/jsdoc/index.js.html | 8 ++++---- docs/jsdoc/module-download.download.html | 2 +- docs/jsdoc/module-download.html | 6 +++--- docs/jsdoc/module-remove.html | 2 +- docs/jsdoc/module-remove.remove.html | 2 +- docs/jsdoc/module-upload.html | 2 +- docs/jsdoc/module-upload.upload.html | 2 +- docs/jsdoc/module-user.html | 2 +- docs/jsdoc/module-user.user.html | 2 +- docs/jsdoc/modules_download.js.html | 5 ++--- docs/jsdoc/modules_remove.js.html | 2 +- docs/jsdoc/modules_upload.js.html | 2 +- docs/jsdoc/modules_user.js.html | 2 +- index.js | 6 +++--- modules/download.js | 3 +-- 17 files changed, 25 insertions(+), 27 deletions(-) diff --git a/docs/jsdoc/global.html b/docs/jsdoc/global.html index 911736a..5c30ffb 100644 --- a/docs/jsdoc/global.html +++ b/docs/jsdoc/global.html @@ -802,7 +802,7 @@
diff --git a/docs/jsdoc/index.html b/docs/jsdoc/index.html index 39b9e22..c0ad530 100644 --- a/docs/jsdoc/index.html +++ b/docs/jsdoc/index.html @@ -56,7 +56,7 @@
diff --git a/docs/jsdoc/index.js.html b/docs/jsdoc/index.js.html index 636b383..28bf93c 100644 --- a/docs/jsdoc/index.js.html +++ b/docs/jsdoc/index.js.html @@ -61,7 +61,7 @@ const defaultPort = 8080 const port = process.env.PORT || defaultPort const dbName = 'website.db' const domainName = 'http://localhost:8080' -const expiryCheckInterval = 300000 // Three minutes +const expiryCheckInterval = 200000 // Two Minutes /** * The secure home page. @@ -181,7 +181,7 @@ router.post('/upload', koaBody, async ctx => { const uploadResult = await upload.uploadFile(path, name, ctx.session.username, targetUser) // Throws error if not successful ctx.redirect(`/shareFile?h=${uploadResult}`) // Successful upload } catch (err) { - await ctx.render('error', { message: err.message }) + await ctx.redirect('/upload', { message: err.message }) } }) @@ -244,7 +244,7 @@ router.get('/file', async ctx => { ctx.body = fs.createReadStream(filePath) ctx.set('Content-disposition', `attachment; filename=${fileName}`) // Lets the user download the file const remover = await new Remove(dbName) - const timer = 500000 // Sets timer amount + const timer = 60000 // Sets timer amount (1 Minute) setTimeout(() => { remover.removeFile(sourceUser, hash) }, timer) // Delete the file after approx. 5 minutes to allow user time to download it @@ -285,7 +285,7 @@ module.exports = app.listen(port, async() => console.log(`listening on port ${po
diff --git a/docs/jsdoc/module-download.download.html b/docs/jsdoc/module-download.download.html index e5be27b..3358de4 100644 --- a/docs/jsdoc/module-download.download.html +++ b/docs/jsdoc/module-download.download.html @@ -162,7 +162,7 @@
diff --git a/docs/jsdoc/module-download.html b/docs/jsdoc/module-download.html index 4006ac0..a586166 100644 --- a/docs/jsdoc/module-download.html +++ b/docs/jsdoc/module-download.html @@ -1050,7 +1050,7 @@
- Generates an array of objects which contain information about each available file File info objects contain the following fields: fileName, uploader, fileType, fileSize, fileCat, timeTillDelete, dateUploaded, url + Retrieves the name of the chosen file
@@ -1166,7 +1166,7 @@
Source:
@@ -2054,7 +2054,7 @@
diff --git a/docs/jsdoc/module-remove.html b/docs/jsdoc/module-remove.html index 0d80bcd..117d4cf 100644 --- a/docs/jsdoc/module-remove.html +++ b/docs/jsdoc/module-remove.html @@ -1467,7 +1467,7 @@
diff --git a/docs/jsdoc/module-remove.remove.html b/docs/jsdoc/module-remove.remove.html index 66eb250..fd4f50c 100644 --- a/docs/jsdoc/module-remove.remove.html +++ b/docs/jsdoc/module-remove.remove.html @@ -162,7 +162,7 @@
diff --git a/docs/jsdoc/module-upload.html b/docs/jsdoc/module-upload.html index 1c964ae..8e342bc 100644 --- a/docs/jsdoc/module-upload.html +++ b/docs/jsdoc/module-upload.html @@ -1686,7 +1686,7 @@
diff --git a/docs/jsdoc/module-upload.upload.html b/docs/jsdoc/module-upload.upload.html index cdcffd7..59c60c5 100644 --- a/docs/jsdoc/module-upload.upload.html +++ b/docs/jsdoc/module-upload.upload.html @@ -162,7 +162,7 @@
diff --git a/docs/jsdoc/module-user.html b/docs/jsdoc/module-user.html index 766c1db..ac02dad 100644 --- a/docs/jsdoc/module-user.html +++ b/docs/jsdoc/module-user.html @@ -823,7 +823,7 @@
diff --git a/docs/jsdoc/module-user.user.html b/docs/jsdoc/module-user.user.html index 91adf76..d37913f 100644 --- a/docs/jsdoc/module-user.user.html +++ b/docs/jsdoc/module-user.user.html @@ -162,7 +162,7 @@
diff --git a/docs/jsdoc/modules_download.js.html b/docs/jsdoc/modules_download.js.html index 5410300..c90db91 100644 --- a/docs/jsdoc/modules_download.js.html +++ b/docs/jsdoc/modules_download.js.html @@ -282,8 +282,7 @@ module.exports = class Download { } /** - * Generates an array of objects which contain information about each available file - * File info objects contain the following fields: fileName, uploader, fileType, fileSize, fileCat, timeTillDelete, dateUploaded, url + * Retrieves the name of the chosen file * @async * @memberof module:download * @param {string} source - Username of the user who uploaded the file. @@ -319,7 +318,7 @@ module.exports = class Download {
diff --git a/docs/jsdoc/modules_remove.js.html b/docs/jsdoc/modules_remove.js.html index d952a9c..19d493a 100644 --- a/docs/jsdoc/modules_remove.js.html +++ b/docs/jsdoc/modules_remove.js.html @@ -231,7 +231,7 @@ module.exports = class Remove {
diff --git a/docs/jsdoc/modules_upload.js.html b/docs/jsdoc/modules_upload.js.html index 25135bc..d4885f9 100644 --- a/docs/jsdoc/modules_upload.js.html +++ b/docs/jsdoc/modules_upload.js.html @@ -274,7 +274,7 @@ module.exports = class Upload {
diff --git a/docs/jsdoc/modules_user.js.html b/docs/jsdoc/modules_user.js.html index b2690e7..03f8722 100644 --- a/docs/jsdoc/modules_user.js.html +++ b/docs/jsdoc/modules_user.js.html @@ -142,7 +142,7 @@ module.exports = class User {
diff --git a/index.js b/index.js index 004e1c2..6dec6eb 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ const defaultPort = 8080 const port = process.env.PORT || defaultPort const dbName = 'website.db' const domainName = 'http://localhost:8080' -const expiryCheckInterval = 300000 // Three minutes +const expiryCheckInterval = 200000 // Two Minutes /** * The secure home page. @@ -153,7 +153,7 @@ router.post('/upload', koaBody, async ctx => { const uploadResult = await upload.uploadFile(path, name, ctx.session.username, targetUser) // Throws error if not successful ctx.redirect(`/shareFile?h=${uploadResult}`) // Successful upload } catch (err) { - await ctx.render('error', { message: err.message }) + await ctx.redirect(`/upload?message=${err.message}`) } }) @@ -216,7 +216,7 @@ router.get('/file', async ctx => { ctx.body = fs.createReadStream(filePath) ctx.set('Content-disposition', `attachment; filename=${fileName}`) // Lets the user download the file const remover = await new Remove(dbName) - const timer = 500000 // Sets timer amount + const timer = 60000 // Sets timer amount (1 Minute) setTimeout(() => { remover.removeFile(sourceUser, hash) }, timer) // Delete the file after approx. 5 minutes to allow user time to download it diff --git a/modules/download.js b/modules/download.js index 8d50e00..afe628b 100644 --- a/modules/download.js +++ b/modules/download.js @@ -254,8 +254,7 @@ module.exports = class Download { } /** - * Generates an array of objects which contain information about each available file - * File info objects contain the following fields: fileName, uploader, fileType, fileSize, fileCat, timeTillDelete, dateUploaded, url + * Retrieves the name of the chosen file * @async * @memberof module:download * @param {string} source - Username of the user who uploaded the file.