2017-01-13 07:48:18 +00:00
|
|
|
module.exports = {
|
2018-01-23 20:06:30 +00:00
|
|
|
/*
|
|
|
|
If set to true the user will need to specify the auto-generated token
|
2018-03-24 19:47:41 +00:00
|
|
|
on each API call, meaning random strangers won't be able to use the service
|
2018-04-04 16:47:20 +00:00
|
|
|
unless they have the token lolisafe provides you with.
|
2018-01-23 20:06:30 +00:00
|
|
|
If it's set to false, then upload will be public for anyone to use.
|
|
|
|
*/
|
|
|
|
private: true,
|
|
|
|
|
2021-05-22 13:59:00 +00:00
|
|
|
/*
|
|
|
|
If set, only the specified group AND any groups higher than it
|
|
|
|
will be allowed to upload new files.
|
|
|
|
Any other groups, assuming registered, will still be able to manage their previously uploaded files.
|
|
|
|
*/
|
|
|
|
privateUploadGroup: null, // Other group names in controllers/permissionController.js
|
2021-06-08 00:59:25 +00:00
|
|
|
privateUploadCustomResponse: null,
|
2021-05-22 13:59:00 +00:00
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
|
|
|
If true, users will be able to create accounts and access their uploaded files.
|
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
enableUserAccounts: true,
|
|
|
|
|
|
|
|
/*
|
|
|
|
Here you can decide if you want lolisafe to serve the files or if you prefer doing so via nginx.
|
|
|
|
The main difference between the two is the ease of use and the chance of analytics in the future.
|
|
|
|
If you set it to `true`, the uploaded files will be located after the host like:
|
|
|
|
https://lolisafe.moe/yourFile.jpg
|
|
|
|
|
|
|
|
If you set it to `false`, you need to set nginx to directly serve whatever folder it is you are serving your
|
|
|
|
downloads in. This also gives you the ability to serve them, for example, like this:
|
|
|
|
https://files.lolisafe.moe/yourFile.jpg
|
|
|
|
|
|
|
|
Both cases require you to type the domain where the files will be served on the `domain` key below.
|
|
|
|
Which one you use is ultimately up to you.
|
2020-05-26 18:56:24 +00:00
|
|
|
|
2020-07-03 15:55:43 +00:00
|
|
|
NOTE: Set to falsy value if using Docker.
|
2018-01-23 20:06:30 +00:00
|
|
|
*/
|
|
|
|
serveFilesWithNode: false,
|
2020-05-26 19:44:52 +00:00
|
|
|
domain: 'https://lolisafe.moe',
|
2018-01-23 20:06:30 +00:00
|
|
|
|
2020-09-26 21:33:42 +00:00
|
|
|
/*
|
|
|
|
If you serve files with node, you can optionally choose to set Content-Disposition header
|
|
|
|
into their original file names. This allows users to save files into their original file names.
|
2020-10-01 21:58:35 +00:00
|
|
|
|
|
|
|
This will query the DB every time users access uploaded files as there's no caching mechanism.
|
2020-09-26 21:33:42 +00:00
|
|
|
*/
|
|
|
|
setContentDisposition: false,
|
|
|
|
|
2020-11-03 16:53:56 +00:00
|
|
|
/*
|
|
|
|
If you serve files with node, you can optionally choose to
|
|
|
|
override Content-Type header for certain extension names.
|
|
|
|
*/
|
|
|
|
overrideContentTypes: {
|
2020-11-03 16:56:04 +00:00
|
|
|
// 'text/plain': ['html', 'htm', 'shtml', 'xhtml']
|
2020-11-03 16:53:56 +00:00
|
|
|
},
|
|
|
|
|
2018-02-07 06:45:18 +00:00
|
|
|
/*
|
|
|
|
If you are serving your files with a different domain than your lolisafe homepage,
|
2018-12-20 11:53:37 +00:00
|
|
|
then fill this option with your lolisafe homepage, otherwise any falsy value.
|
2018-04-18 21:00:36 +00:00
|
|
|
This will be used when listing album links in the dashboard.
|
2018-02-07 06:45:18 +00:00
|
|
|
*/
|
2018-04-18 21:00:36 +00:00
|
|
|
homeDomain: null,
|
2018-02-07 06:45:18 +00:00
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
2020-07-03 15:55:43 +00:00
|
|
|
Port on which to run the server.
|
|
|
|
NOTE: Change port in .env file if using Docker.
|
2018-05-09 08:41:30 +00:00
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
port: 9999,
|
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
|
|
|
Pages to process for the frontend.
|
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
pages: ['home', 'auth', 'dashboard', 'faq'],
|
|
|
|
|
2020-05-16 20:35:54 +00:00
|
|
|
/*
|
|
|
|
This will load public/libs/cookieconsent/cookieconsent.min.{css,js} on homepage (configured from home.js).
|
|
|
|
You may use this if you have some specific needs, since lolisafe by itself will not use Cookies at all.
|
|
|
|
Instead it will use Local Storage for both authentication and preferences/states in Dashboard.
|
2020-06-26 06:58:23 +00:00
|
|
|
I'm not sure if Cookies Laws apply to Local Storage as well, although I suppose it makes sense if they do.
|
2020-05-16 20:35:54 +00:00
|
|
|
NOTE: Enabling this will automatically push 'cookiepolicy' to pages array above.
|
|
|
|
*/
|
|
|
|
cookiePolicy: false,
|
|
|
|
|
2018-04-25 13:16:34 +00:00
|
|
|
/*
|
2018-12-20 11:53:37 +00:00
|
|
|
This can be either 'blacklist' or 'whitelist', which should be self-explanatory.
|
|
|
|
When this is set to neither, this will fallback to 'blacklist'.
|
2018-04-25 13:16:34 +00:00
|
|
|
*/
|
2018-12-20 11:53:37 +00:00
|
|
|
extensionsFilterMode: 'blacklist',
|
2018-04-25 13:16:34 +00:00
|
|
|
|
|
|
|
extensionsFilter: [
|
2018-12-20 11:53:37 +00:00
|
|
|
'.bash_profile',
|
|
|
|
'.bash',
|
|
|
|
'.bashrc',
|
|
|
|
'.bat',
|
|
|
|
'.bsh',
|
|
|
|
'.cmd',
|
|
|
|
'.com',
|
|
|
|
'.csh',
|
2018-01-23 20:06:30 +00:00
|
|
|
'.exe',
|
2018-09-22 14:04:07 +00:00
|
|
|
'.exec',
|
2018-12-20 11:53:37 +00:00
|
|
|
'.jar',
|
2018-03-15 07:54:14 +00:00
|
|
|
'.msi',
|
2018-06-06 01:51:53 +00:00
|
|
|
'.nt',
|
2018-12-20 11:53:37 +00:00
|
|
|
'.profile',
|
2018-03-15 07:54:14 +00:00
|
|
|
'.ps1',
|
2018-06-06 01:51:53 +00:00
|
|
|
'.psm1',
|
2018-12-20 11:53:37 +00:00
|
|
|
'.scr',
|
|
|
|
'.sh'
|
2018-01-23 20:06:30 +00:00
|
|
|
],
|
|
|
|
|
2018-11-28 17:52:12 +00:00
|
|
|
/*
|
|
|
|
If set to true, files with no extensions will always be rejected.
|
|
|
|
*/
|
|
|
|
filterNoExtension: false,
|
|
|
|
|
2018-12-20 11:53:37 +00:00
|
|
|
/*
|
|
|
|
If set to true, files with zero bytes size will always be rejected.
|
|
|
|
NOTE: Even if the files only contain whitespaces, as long as they aren't
|
|
|
|
zero bytes, they will be accepted.
|
|
|
|
*/
|
|
|
|
filterEmptyFile: true,
|
|
|
|
|
2018-09-20 11:41:17 +00:00
|
|
|
/*
|
|
|
|
Show hash of the current git commit in homepage.
|
|
|
|
*/
|
|
|
|
showGitHash: false,
|
|
|
|
|
|
|
|
/*
|
|
|
|
Path to error pages. Only 404 and 500 will be used.
|
2018-12-20 11:53:37 +00:00
|
|
|
NOTE: rootDir can either be relative or absolute path.
|
2018-09-20 11:41:17 +00:00
|
|
|
*/
|
|
|
|
errorPages: {
|
|
|
|
rootDir: './pages/error',
|
|
|
|
404: '404.html',
|
|
|
|
500: '500.html'
|
|
|
|
},
|
|
|
|
|
2020-02-13 08:03:31 +00:00
|
|
|
/*
|
2022-03-03 19:04:16 +00:00
|
|
|
Helmet security headers.
|
|
|
|
https://github.com/helmetjs/helmet#how-it-works
|
|
|
|
*/
|
|
|
|
helmet: {
|
|
|
|
contentSecurityPolicy: false,
|
|
|
|
/*
|
|
|
|
hsts: {
|
|
|
|
maxAge: 63072000, // 2 years
|
|
|
|
includeSubDomains: true,
|
|
|
|
preload: true
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
hsts: false
|
2020-02-13 08:03:31 +00:00
|
|
|
},
|
|
|
|
|
2018-12-20 11:53:37 +00:00
|
|
|
/*
|
|
|
|
Trust proxy.
|
2020-02-11 10:18:04 +00:00
|
|
|
Enable this if you are using proxy such as Cloudflare or Incapsula,
|
|
|
|
and/or also when you are using reverse proxy such as nginx or Apache.
|
2018-12-20 11:53:37 +00:00
|
|
|
*/
|
|
|
|
trustProxy: true,
|
|
|
|
|
2019-06-03 19:40:24 +00:00
|
|
|
/*
|
|
|
|
Rate limits.
|
|
|
|
Please be aware that these apply to all users, including site owners.
|
|
|
|
https://github.com/nfriedly/express-rate-limit#configuration-options
|
|
|
|
*/
|
|
|
|
rateLimits: [
|
2019-10-12 06:55:38 +00:00
|
|
|
{
|
|
|
|
// 10 requests in 1 second
|
|
|
|
routes: [
|
|
|
|
'/api/'
|
|
|
|
],
|
|
|
|
config: {
|
|
|
|
windowMs: 1000,
|
|
|
|
max: 10,
|
|
|
|
message: {
|
|
|
|
success: false,
|
|
|
|
description: 'Rate limit reached, please try again in a while.'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-06-03 19:40:24 +00:00
|
|
|
{
|
2019-06-03 19:43:54 +00:00
|
|
|
// 2 requests in 5 seconds
|
2019-06-03 19:40:24 +00:00
|
|
|
routes: [
|
2019-09-08 18:27:14 +00:00
|
|
|
'/api/login',
|
2019-06-03 19:40:24 +00:00
|
|
|
'/api/register'
|
|
|
|
],
|
|
|
|
config: {
|
|
|
|
windowMs: 5 * 1000,
|
2019-09-08 18:27:14 +00:00
|
|
|
max: 2,
|
|
|
|
message: {
|
|
|
|
success: false,
|
2019-10-12 06:55:38 +00:00
|
|
|
description: 'Rate limit reached, please try again in 5 seconds.'
|
2019-09-08 18:27:14 +00:00
|
|
|
}
|
2019-06-03 19:40:24 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2020-02-11 10:18:04 +00:00
|
|
|
// 6 requests in 30 seconds
|
2019-06-03 19:40:24 +00:00
|
|
|
routes: [
|
|
|
|
'/api/album/zip'
|
|
|
|
],
|
|
|
|
config: {
|
|
|
|
windowMs: 30 * 1000,
|
2020-02-11 10:18:04 +00:00
|
|
|
max: 6
|
2019-10-12 06:55:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
// 1 request in 60 seconds
|
|
|
|
routes: [
|
|
|
|
'/api/tokens/change'
|
|
|
|
],
|
|
|
|
config: {
|
|
|
|
windowMs: 60 * 1000,
|
|
|
|
max: 1,
|
|
|
|
message: {
|
|
|
|
success: false,
|
|
|
|
description: 'Rate limit reached, please try again in 60 seconds.'
|
|
|
|
}
|
2019-06-03 19:40:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
|
|
|
Uploads config.
|
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
uploads: {
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
2018-12-20 11:53:37 +00:00
|
|
|
Folder where files should be stored.
|
2018-05-09 08:41:30 +00:00
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
folder: 'uploads',
|
|
|
|
|
|
|
|
/*
|
2018-05-09 08:41:30 +00:00
|
|
|
Max file size allowed. Needs to be in MB.
|
2018-12-20 11:53:37 +00:00
|
|
|
NOTE: When maxSize is greater than 1 MiB and using nginx as reverse proxy,
|
2018-12-04 11:58:53 +00:00
|
|
|
you must set client_max_body_size to the same as maxSize.
|
|
|
|
https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
|
2018-01-23 20:06:30 +00:00
|
|
|
*/
|
|
|
|
maxSize: '512MB',
|
|
|
|
|
2020-05-28 19:52:58 +00:00
|
|
|
/*
|
|
|
|
Chunk size for chunked uploads. Needs to be in MB.
|
2020-06-15 16:48:43 +00:00
|
|
|
|
2020-05-28 19:52:58 +00:00
|
|
|
If this is enabled, every files uploaded from the homepage uploader
|
|
|
|
will forcibly be chunked by the size specified in "default".
|
|
|
|
Users can configure the chunk size they want from the homepage uploader,
|
|
|
|
but you can force allowed max size of each chunk with "max".
|
|
|
|
Min size will always be 1MB.
|
2020-06-15 16:48:43 +00:00
|
|
|
|
2020-05-28 19:52:58 +00:00
|
|
|
Users will still be able to upload bigger files with the API
|
|
|
|
as long as they don't surpass the limit specified in the "maxSize" option above.
|
|
|
|
Once all chunks have been uploads, their total size
|
|
|
|
will be tested against the "maxSize" option again.
|
2020-06-15 16:48:43 +00:00
|
|
|
|
|
|
|
With "timeout", you can specify how long a particular chunked upload attempt
|
|
|
|
can remain inactive before their temporary data gets cleared out
|
|
|
|
(partially uploaded files or other internal data).
|
|
|
|
|
2020-05-28 19:52:58 +00:00
|
|
|
This option is mainly useful for hosters that use Cloudflare,
|
|
|
|
since Cloudflare limits upload size to 100MB on their Free plan.
|
|
|
|
https://support.cloudflare.com/hc/en-us/articles/200172516#h_51422705-42d0-450d-8eb1-5321dcadb5bc
|
2020-06-15 16:48:43 +00:00
|
|
|
|
|
|
|
NOTE: Set "default" or the option itself to falsy value to disable chunked uploads.
|
2020-05-28 19:52:58 +00:00
|
|
|
*/
|
|
|
|
chunkSize: {
|
|
|
|
max: '95MB',
|
2020-06-15 16:48:43 +00:00
|
|
|
default: '25MB',
|
|
|
|
timeout: 30 * 60 * 1000 // 30 minutes
|
2020-05-28 19:52:58 +00:00
|
|
|
},
|
|
|
|
|
2020-11-09 18:07:10 +00:00
|
|
|
/*
|
|
|
|
Folder where in-progress chunks should be kept temporarily.
|
|
|
|
NOTE: When set to falsy value, defaults to "chunks" subfolder within uploads folder.
|
|
|
|
*/
|
|
|
|
chunksFolder: null,
|
|
|
|
|
2018-05-11 14:34:13 +00:00
|
|
|
/*
|
|
|
|
Max file size allowed for upload by URLs. Needs to be in MB.
|
2018-12-20 11:53:37 +00:00
|
|
|
NOTE: Set to falsy value to disable upload by URLs.
|
2018-05-11 14:34:13 +00:00
|
|
|
*/
|
|
|
|
urlMaxSize: '32MB',
|
|
|
|
|
2018-12-20 11:53:37 +00:00
|
|
|
/*
|
|
|
|
Proxy URL uploads.
|
|
|
|
NOTE: Set to falsy value to disable.
|
|
|
|
|
|
|
|
Available templates:
|
|
|
|
{url} = full URL (encoded & with protocol)
|
|
|
|
{url-noprot} = URL without protocol (images.weserv.nl prefers this format)
|
|
|
|
|
|
|
|
Example:
|
|
|
|
https://images.weserv.nl/?url={url-noprot}
|
|
|
|
will become:
|
2019-04-11 15:27:45 +00:00
|
|
|
https://images.weserv.nl/?url=example.com%2Fassets%2Fimage.png
|
2018-12-20 11:53:37 +00:00
|
|
|
*/
|
2022-03-03 12:46:25 +00:00
|
|
|
urlProxy: 'https://external-content.duckduckgo.com/iu/?u={url}&f=1&nofb=1',
|
2018-12-20 11:53:37 +00:00
|
|
|
|
|
|
|
/*
|
2021-05-22 13:59:00 +00:00
|
|
|
Disclaimer message that will be printed underneath the URL uploads form.
|
|
|
|
Supports HTML. Be safe though.
|
2018-12-20 11:53:37 +00:00
|
|
|
*/
|
2019-09-19 08:30:00 +00:00
|
|
|
urlDisclaimerMessage: 'URL uploads are being proxied by <a href="https://duckduckgo.com/" target="_blank" rel="noopener">DuckDuckGo</a>.',
|
2018-12-20 11:53:37 +00:00
|
|
|
|
|
|
|
/*
|
2021-05-22 13:59:00 +00:00
|
|
|
Filter mode for URL uploads.
|
|
|
|
Can be 'blacklist', 'whitelist', or 'inherit'.
|
|
|
|
'inherit' => inherit primary extensions filter (extensionsFilter option).
|
|
|
|
The rest are paired with urlExtensionsFilter option below and should be self-explanatory.
|
|
|
|
When this is not set to any of the 3 values, this will fallback to 'inherit'.
|
2018-12-20 11:53:37 +00:00
|
|
|
*/
|
2019-09-19 08:30:00 +00:00
|
|
|
urlExtensionsFilterMode: 'whitelist',
|
2018-12-20 11:53:37 +00:00
|
|
|
|
|
|
|
/*
|
2021-05-22 13:59:00 +00:00
|
|
|
Mainly intended for URL proxies that only support certain extensions.
|
|
|
|
This will parse the extensions from the URLs, so URLs that do not end with
|
|
|
|
the file's extensions will always be rejected.
|
|
|
|
Queries and segments in the URLs will be bypassed.
|
|
|
|
NOTE: Can not be empty when using either 'blacklist' or 'whitelist' mode.
|
2018-12-20 11:53:37 +00:00
|
|
|
*/
|
2019-09-19 08:30:00 +00:00
|
|
|
urlExtensionsFilter: [
|
|
|
|
'.webp',
|
|
|
|
'.jpg',
|
|
|
|
'.jpeg',
|
|
|
|
'.bmp',
|
|
|
|
'.gif',
|
|
|
|
'.png',
|
|
|
|
'.tiff',
|
|
|
|
'.tif',
|
|
|
|
'.svg'
|
|
|
|
],
|
2018-12-20 11:53:37 +00:00
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
/*
|
|
|
|
An array of allowed ages for uploads (in hours).
|
|
|
|
|
|
|
|
Default age will be the value at the very top of the array.
|
|
|
|
If the array is populated but do not have a zero value,
|
|
|
|
permanent uploads will be rejected.
|
|
|
|
This only applies to new files uploaded after enabling the option.
|
|
|
|
|
|
|
|
If the array is empty or is set to falsy value, temporary uploads
|
|
|
|
feature will be disabled, and all uploads will be permanent (original behavior).
|
|
|
|
|
|
|
|
When temporary uploads feature is disabled, any existing temporary uploads
|
|
|
|
will not ever be automatically deleted, since the safe will not start the
|
|
|
|
periodical checkup task.
|
|
|
|
*/
|
|
|
|
temporaryUploadAges: [
|
|
|
|
0, // permanent
|
|
|
|
1 / 60 * 15, // 15 minutes
|
|
|
|
1 / 60 * 30, // 30 minutes
|
|
|
|
1, // 1 hour
|
|
|
|
6, // 6 hours
|
|
|
|
12, // 12 hours
|
|
|
|
24, // 24 hours (1 day)
|
2019-09-08 18:21:01 +00:00
|
|
|
24 * 2, // 48 hours (2 days)
|
|
|
|
24 * 3, // 72 hours (3 days)
|
|
|
|
24 * 4, // 96 hours (4 days)
|
|
|
|
24 * 5, // 120 hours (5 days)
|
|
|
|
24 * 6, // 144 hours (6 days)
|
|
|
|
24 * 7 // 168 hours (7 days)
|
2019-09-08 01:56:29 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
/*
|
|
|
|
Interval of the periodical check up tasks for temporary uploads (in milliseconds).
|
|
|
|
NOTE: Set to falsy value if you prefer to use your own external script.
|
|
|
|
*/
|
|
|
|
temporaryUploadsInterval: 1 * 60000, // 1 minute
|
|
|
|
|
2018-09-01 20:37:26 +00:00
|
|
|
/*
|
2020-11-01 00:38:36 +00:00
|
|
|
Scan uploads for threats with ClamAV.
|
2019-11-05 20:35:04 +00:00
|
|
|
|
|
|
|
groupBypass: Name of the lowest ranked group whose files will not be scanned.
|
2020-06-26 06:58:23 +00:00
|
|
|
Lowest ranked meaning that group AND any groups higher than it are included.
|
2019-11-05 20:35:04 +00:00
|
|
|
Example: 'moderator' = moderators, admins & superadmins.
|
2018-09-01 20:37:26 +00:00
|
|
|
*/
|
2018-09-04 16:11:20 +00:00
|
|
|
scan: {
|
2020-12-26 08:21:49 +00:00
|
|
|
enabled: false,
|
2020-04-04 14:20:01 +00:00
|
|
|
groupBypass: 'admin', // Other group names in controllers/permissionController.js
|
|
|
|
whitelistExtensions: null, /* [
|
|
|
|
'.webp',
|
|
|
|
'.jpg',
|
|
|
|
'.jpeg',
|
|
|
|
'.gif',
|
|
|
|
'.png',
|
|
|
|
'.tiff',
|
|
|
|
'.tif',
|
|
|
|
'.svg',
|
|
|
|
'.webm',
|
|
|
|
'.mp4',
|
|
|
|
'.wmv',
|
|
|
|
'.avi',
|
|
|
|
'.mov',
|
|
|
|
'.mkv'
|
|
|
|
], */
|
2020-10-31 23:35:56 +00:00
|
|
|
// Make sure maxSize is no bigger than the max size you configured for your ClamAV
|
|
|
|
maxSize: null, // Needs to be in MB
|
|
|
|
|
|
|
|
// https://github.com/kylefarris/clamscan/tree/v1.3.3#getting-started
|
|
|
|
// Breaking options (do not use): remove_infected, quarantine_infected
|
|
|
|
// Untested options (may work): scan_log, debug_mode, file_list, scan_recursively
|
|
|
|
// Supported options: clamscan, clamdscan, preference
|
|
|
|
clamOptions: {
|
|
|
|
// clamscan: {},
|
|
|
|
clamdscan: {
|
|
|
|
// When both socket and host+port are specified, it will only use socket
|
|
|
|
socket: '/var/run/clamav/clamd.ctl',
|
|
|
|
host: '127.0.0.1',
|
|
|
|
port: 3310,
|
|
|
|
timeout: 1 * 60 * 1000, // 1 minute
|
|
|
|
multiscan: true,
|
|
|
|
reload_db: false,
|
|
|
|
active: true
|
|
|
|
},
|
|
|
|
preference: 'clamdscan'
|
|
|
|
}
|
2018-09-04 16:11:20 +00:00
|
|
|
},
|
2018-09-01 20:37:26 +00:00
|
|
|
|
2019-06-04 00:57:37 +00:00
|
|
|
/*
|
|
|
|
Store uploader's IPs into the database.
|
|
|
|
NOTE: Dashboard's Manage Uploads will display IP column regardless of whether
|
|
|
|
this is set to true or false.
|
|
|
|
*/
|
|
|
|
storeIP: true,
|
|
|
|
|
2018-03-24 13:52:47 +00:00
|
|
|
/*
|
2018-12-04 11:58:53 +00:00
|
|
|
The length of the randomly generated identifier for uploaded files.
|
2019-09-08 02:28:13 +00:00
|
|
|
If "force" is set to true, files will always use "default".
|
2018-03-24 13:52:47 +00:00
|
|
|
*/
|
2019-09-08 02:28:13 +00:00
|
|
|
fileIdentifierLength: {
|
2018-03-24 13:52:47 +00:00
|
|
|
min: 4,
|
|
|
|
max: 32,
|
2019-09-08 02:28:13 +00:00
|
|
|
default: 8,
|
|
|
|
force: false
|
2018-03-24 13:52:47 +00:00
|
|
|
},
|
2018-01-23 20:06:30 +00:00
|
|
|
|
2018-12-04 11:58:53 +00:00
|
|
|
/*
|
|
|
|
Cache file identifiers.
|
|
|
|
|
2018-12-08 00:38:12 +00:00
|
|
|
They will be used for stricter collision checks, such that a single identifier
|
2019-11-29 13:42:53 +00:00
|
|
|
may not be used by more than a single file (e.g. if "abcd.jpg" already exists, a new PNG
|
2018-12-04 11:58:53 +00:00
|
|
|
file may not be named as "abcd.png").
|
|
|
|
|
2019-09-08 01:56:29 +00:00
|
|
|
If this is enabled, the safe will query files from the database during first launch,
|
|
|
|
parse their names, then cache the identifiers into memory.
|
|
|
|
Its downside is that it will use a bit more memory.
|
2018-12-04 11:58:53 +00:00
|
|
|
|
2018-12-08 00:38:12 +00:00
|
|
|
If this is disabled, collision check will become less strict.
|
2019-11-29 13:42:53 +00:00
|
|
|
As in, the same identifier may be used by multiple different extensions (e.g. if "abcd.jpg"
|
2018-12-08 00:38:12 +00:00
|
|
|
already exists, new files can be possibly be named as "abcd.png", "abcd.mp4", etc).
|
|
|
|
Its downside will be, in the rare chance that multiple image/video files are sharing the same
|
|
|
|
identifier, they will end up with the same thumbnail in dashboard, since thumbnails will
|
2019-11-29 13:42:53 +00:00
|
|
|
only be saved as PNG in storage (e.g. "abcd.jpg" and "abcd.png" will share a single thumbnail
|
2018-12-08 00:38:12 +00:00
|
|
|
named "abcd.png" in thumbs directory, in which case, the file that's uploaded the earliest will
|
|
|
|
be the source for the thumbnail).
|
2018-12-04 11:58:53 +00:00
|
|
|
|
2018-12-08 00:38:12 +00:00
|
|
|
Unless you do not use thumbnails, it is highly recommended to enable this feature.
|
2018-12-04 11:58:53 +00:00
|
|
|
*/
|
2020-09-26 22:24:48 +00:00
|
|
|
cacheFileIdentifiers: false,
|
2018-12-04 11:58:53 +00:00
|
|
|
|
2020-09-26 22:18:42 +00:00
|
|
|
/*
|
|
|
|
An alternative to caching file identifiers.
|
|
|
|
|
|
|
|
Basically the service will instead query the database for stricter collision checks.
|
|
|
|
Right off the bat this has the disadvantage of adding one or more SQL queries on every
|
|
|
|
new uploads, but it has the advantage of not having to pre-cache anything.
|
|
|
|
Essentially this reduces the service's startup time and memory usage, but slows down new uploads.
|
|
|
|
|
|
|
|
As this is an alternative, you need to disable cacheFileIdentifiers to use this.
|
|
|
|
|
|
|
|
You'll have to figure out which method suits your use case best.
|
|
|
|
*/
|
|
|
|
queryDbForFileCollisions: true,
|
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
|
|
|
The length of the randomly generated identifier for albums.
|
|
|
|
*/
|
2018-04-28 17:29:47 +00:00
|
|
|
albumIdentifierLength: 8,
|
|
|
|
|
2018-03-18 13:13:08 +00:00
|
|
|
/*
|
2018-04-28 17:29:47 +00:00
|
|
|
This option will limit how many times it will try to
|
2018-12-20 12:01:30 +00:00
|
|
|
generate a new random name when a collision occurs.
|
2018-12-20 11:53:37 +00:00
|
|
|
Generally, the shorter the length is, the higher the chance for a collision to occur.
|
2018-12-04 11:58:53 +00:00
|
|
|
This applies to both file name and album identifier.
|
2018-04-28 17:29:47 +00:00
|
|
|
*/
|
2018-12-20 11:53:37 +00:00
|
|
|
maxTries: 3,
|
2018-03-18 13:13:08 +00:00
|
|
|
|
2018-01-23 20:06:30 +00:00
|
|
|
/*
|
2018-12-20 11:53:37 +00:00
|
|
|
Thumbnails are only used in the dashboard and album's public pages.
|
2018-12-03 07:20:13 +00:00
|
|
|
You need to install a separate binary called ffmpeg (https://ffmpeg.org/) for video thumbnails.
|
2018-01-23 20:06:30 +00:00
|
|
|
*/
|
2018-05-09 08:41:30 +00:00
|
|
|
generateThumbs: {
|
2018-03-24 13:52:47 +00:00
|
|
|
image: true,
|
2019-08-23 09:49:53 +00:00
|
|
|
video: false,
|
2021-01-31 23:13:37 +00:00
|
|
|
// Placeholder defaults to 'public/images/unavailable.png'.
|
2020-06-01 09:17:23 +00:00
|
|
|
placeholder: null,
|
|
|
|
size: 200
|
2018-03-24 13:52:47 +00:00
|
|
|
},
|
2018-01-23 20:06:30 +00:00
|
|
|
|
2019-11-29 13:42:53 +00:00
|
|
|
/*
|
|
|
|
Strip tags (e.g. EXIF).
|
|
|
|
|
|
|
|
"default" decides whether to strip tags or not by default,
|
|
|
|
as the behavior can be configured by users from home uploader's Config tab.
|
|
|
|
If "force" is set to true, the default behavior will be enforced.
|
|
|
|
|
2019-12-01 18:02:03 +00:00
|
|
|
"video" decides whether to also strip tags of video files
|
2019-11-29 13:42:53 +00:00
|
|
|
(of course only if the default behavior is to strip tags).
|
2019-12-01 18:02:03 +00:00
|
|
|
However, this also requires ffmpeg (https://ffmpeg.org/),
|
|
|
|
and is still experimental (thus use at your own risk!).
|
2019-11-29 13:42:53 +00:00
|
|
|
|
2019-12-01 18:02:03 +00:00
|
|
|
NOTE: Other than setting "default" to false, and "force" to true,
|
|
|
|
you can also set stripTags option itself to any falsy value to completely
|
|
|
|
disable this feature. This will also remove the option from
|
|
|
|
home uploader's Config tab, as the former would only grey out the option.
|
2019-11-29 13:42:53 +00:00
|
|
|
*/
|
|
|
|
stripTags: {
|
|
|
|
default: false,
|
|
|
|
video: false,
|
2021-01-31 23:13:37 +00:00
|
|
|
force: false,
|
|
|
|
// Supporting the extensions below requires using custom globally-installed libvips.
|
|
|
|
// https://sharp.pixelplumbing.com/install#custom-libvips
|
|
|
|
blacklistExtensions: [
|
|
|
|
// GIFs require libvips compiled with ImageMagick/GraphicsMagick support.
|
|
|
|
// https://sharp.pixelplumbing.com/api-output#gif
|
|
|
|
'.gif'
|
|
|
|
]
|
2019-11-29 13:42:53 +00:00
|
|
|
},
|
|
|
|
|
2018-01-23 20:06:30 +00:00
|
|
|
/*
|
2018-12-04 11:58:53 +00:00
|
|
|
Allow users to download a ZIP archive of all files in an album.
|
2018-01-23 20:06:30 +00:00
|
|
|
The file is generated when the user clicks the download button in the view
|
2018-04-27 03:27:34 +00:00
|
|
|
and is re-used if the album has not changed between download requests.
|
2018-01-23 20:06:30 +00:00
|
|
|
*/
|
2019-07-17 23:22:47 +00:00
|
|
|
generateZips: true,
|
|
|
|
|
|
|
|
/*
|
|
|
|
JSZip's options to use when generating album ZIPs.
|
|
|
|
https://stuk.github.io/jszip/documentation/api_jszip/generate_async.html
|
|
|
|
NOTE: Changing this option will not re-generate existing ZIPs.
|
|
|
|
*/
|
|
|
|
jsZipOptions: {
|
|
|
|
streamFiles: true,
|
|
|
|
compression: 'DEFLATE',
|
|
|
|
compressionOptions: {
|
|
|
|
level: 1
|
|
|
|
}
|
|
|
|
}
|
2018-05-09 08:41:30 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/*
|
|
|
|
Cloudflare support.
|
|
|
|
*/
|
|
|
|
cloudflare: {
|
|
|
|
/*
|
|
|
|
No-JS uploader page will not chunk the uploads, so it's recommended to change this
|
|
|
|
into the maximum upload size you have in Cloudflare.
|
|
|
|
This limit will only be applied to the subtitle in the page.
|
2018-12-20 11:53:37 +00:00
|
|
|
NOTE: Set to falsy value to inherit "maxSize" option.
|
2018-05-09 08:41:30 +00:00
|
|
|
*/
|
|
|
|
noJsMaxSize: '100MB',
|
|
|
|
|
|
|
|
/*
|
2018-12-04 11:58:53 +00:00
|
|
|
If you have a Page Rule in Cloudflare to cache everything in the album zip
|
2020-06-26 06:48:15 +00:00
|
|
|
API route (e.g. homeDomain/api/album/zip/*), with this option you can limit the
|
2018-05-09 08:41:30 +00:00
|
|
|
maximum total size of files in an album that can be zipped.
|
2020-06-26 06:48:15 +00:00
|
|
|
It's worth nothing that Cloudflare will not cache files bigger than 512MB.
|
|
|
|
However, it's not recommended to do that in high-bandwidth sites anyway,
|
2020-06-26 06:58:23 +00:00
|
|
|
since long-caching of such huge files are against Cloudflare's Terms of Service.
|
2018-12-20 11:53:37 +00:00
|
|
|
NOTE: Set to falsy value to disable max total size.
|
2018-05-09 08:41:30 +00:00
|
|
|
*/
|
2018-05-09 09:53:27 +00:00
|
|
|
zipMaxTotalSize: '512MB',
|
|
|
|
|
|
|
|
/*
|
2020-06-26 06:48:15 +00:00
|
|
|
If you want the service to automatically use Cloudflare API to purge cache on file deletion,
|
|
|
|
fill your zone ID below. It will only purge cache of the deleted file, and its thumbs if applicable.
|
|
|
|
Afterwards, you will have to choose any of the supported auth methods, which are:
|
|
|
|
API token, user service key, OR API key + email.
|
|
|
|
If more than one are provided, it will use the first one from left to right, but it will NOT
|
|
|
|
attempt to use the next methods even if the selected one fails (meaning there's no fallback mechanism).
|
|
|
|
Consult https://api.cloudflare.com/#getting-started-requests for differences.
|
|
|
|
API token configuration example: https://github.com/BobbyWibowo/lolisafe/pull/216#issue-440389284.
|
|
|
|
After everything is ready, you can then set "purgeCache" to true.
|
2018-05-09 09:53:27 +00:00
|
|
|
*/
|
|
|
|
zoneId: '',
|
2020-06-26 06:48:15 +00:00
|
|
|
purgeCache: false,
|
|
|
|
|
|
|
|
apiToken: '',
|
|
|
|
|
|
|
|
userServiceKey: '',
|
|
|
|
|
|
|
|
apiKey: '',
|
|
|
|
email: ''
|
2018-01-23 20:06:30 +00:00
|
|
|
},
|
|
|
|
|
2019-01-05 21:09:47 +00:00
|
|
|
/*
|
|
|
|
ADVANCED: Use safe.fiery.me-exclusive cache control.
|
|
|
|
This will only work properly with certain settings in nginx reverse proxy and Cloudflare.
|
|
|
|
Do NOT enable unless you know what you are doing.
|
2020-02-11 10:18:04 +00:00
|
|
|
true: With CDN (Cloudflare)
|
|
|
|
2: When NOT using Cloudflare
|
2019-01-05 21:09:47 +00:00
|
|
|
*/
|
|
|
|
cacheControl: false,
|
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
|
|
|
Folder where to store logs.
|
2018-12-04 11:58:53 +00:00
|
|
|
NOTE: This is currently unused.
|
2018-05-09 08:41:30 +00:00
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
logsFolder: 'logs',
|
|
|
|
|
2018-05-09 08:41:30 +00:00
|
|
|
/*
|
|
|
|
The following values shouldn't be touched, unless you know what you are doing.
|
|
|
|
*/
|
2018-01-23 20:06:30 +00:00
|
|
|
database: {
|
|
|
|
client: 'sqlite3',
|
|
|
|
connection: { filename: './database/db' },
|
|
|
|
useNullAsDefault: true
|
|
|
|
}
|
|
|
|
}
|