tiny-essentials 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +4 -0
- package/.github/workflows/node.js.yml +31 -0
- package/LICENSE +674 -0
- package/README.md +67 -0
- package/dist/TinyEssentials.min.js +1 -0
- package/dist/_virtual/_commonjsHelpers.cjs +7 -0
- package/dist/_virtual/common.cjs +5 -0
- package/dist/_virtual/index.cjs +9 -0
- package/dist/_virtual/index2.cjs +5 -0
- package/dist/_virtual/trace.cjs +5 -0
- package/dist/legacy/crypto/decrypt.cjs +57 -0
- package/dist/legacy/crypto/decrypt.d.mts +18 -0
- package/dist/legacy/crypto/decrypt.mjs +47 -0
- package/dist/legacy/crypto/default.cjs +23 -0
- package/dist/legacy/crypto/default.d.mts +35 -0
- package/dist/legacy/crypto/default.mjs +19 -0
- package/dist/legacy/crypto/encrypt.cjs +54 -0
- package/dist/legacy/crypto/encrypt.d.mts +19 -0
- package/dist/legacy/crypto/encrypt.mjs +46 -0
- package/dist/legacy/crypto/index.cjs +11 -0
- package/dist/legacy/crypto/index.d.mts +4 -0
- package/dist/legacy/crypto/index.mjs +6 -0
- package/dist/legacy/firebase/cookieSession.cjs +121 -0
- package/dist/legacy/firebase/cookieSession.d.mts +56 -0
- package/dist/legacy/firebase/cookieSession.mjs +114 -0
- package/dist/legacy/firebase/database/index.cjs +11 -0
- package/dist/legacy/firebase/database/index.d.mts +7 -0
- package/dist/legacy/firebase/database/index.mjs +7 -0
- package/dist/legacy/firebase/database/presence.cjs +131 -0
- package/dist/legacy/firebase/database/presence.d.mts +9 -0
- package/dist/legacy/firebase/database/presence.mjs +111 -0
- package/dist/legacy/firebase/database/saveAsync.cjs +147 -0
- package/dist/legacy/firebase/database/saveAsync.d.mts +54 -0
- package/dist/legacy/firebase/database/saveAsync.mjs +147 -0
- package/dist/legacy/firebase/databaseEscape.cjs +42 -0
- package/dist/legacy/firebase/databaseEscape.d.mts +11 -0
- package/dist/legacy/firebase/databaseEscape.mjs +37 -0
- package/dist/legacy/firebase/databaseLogger.cjs +258 -0
- package/dist/legacy/firebase/databaseLogger.d.mts +7 -0
- package/dist/legacy/firebase/databaseLogger.mjs +234 -0
- package/dist/legacy/firebase/discord/api/addGuildMember.cjs +71 -0
- package/dist/legacy/firebase/discord/api/addGuildMember.d.mts +38 -0
- package/dist/legacy/firebase/discord/api/addGuildMember.mjs +64 -0
- package/dist/legacy/firebase/discord/api/getGuildWidget.cjs +47 -0
- package/dist/legacy/firebase/discord/api/getGuildWidget.d.mts +17 -0
- package/dist/legacy/firebase/discord/api/getGuildWidget.mjs +43 -0
- package/dist/legacy/firebase/discord/api/getToken.cjs +67 -0
- package/dist/legacy/firebase/discord/api/getToken.d.mts +35 -0
- package/dist/legacy/firebase/discord/api/getToken.mjs +63 -0
- package/dist/legacy/firebase/discord/api/getUser.cjs +58 -0
- package/dist/legacy/firebase/discord/api/getUser.d.mts +27 -0
- package/dist/legacy/firebase/discord/api/getUser.mjs +54 -0
- package/dist/legacy/firebase/discord/api/getUserConnections.cjs +57 -0
- package/dist/legacy/firebase/discord/api/getUserConnections.d.mts +26 -0
- package/dist/legacy/firebase/discord/api/getUserConnections.mjs +53 -0
- package/dist/legacy/firebase/discord/api/getUserGuilds.cjs +56 -0
- package/dist/legacy/firebase/discord/api/getUserGuilds.d.mts +25 -0
- package/dist/legacy/firebase/discord/api/getUserGuilds.mjs +52 -0
- package/dist/legacy/firebase/discord/api/index.cjs +24 -0
- package/dist/legacy/firebase/discord/api/index.d.mts +19 -0
- package/dist/legacy/firebase/discord/api/index.mjs +20 -0
- package/dist/legacy/firebase/discord/api/refreshToken.cjs +77 -0
- package/dist/legacy/firebase/discord/api/refreshToken.d.mts +45 -0
- package/dist/legacy/firebase/discord/api/refreshToken.mjs +73 -0
- package/dist/legacy/firebase/discord/api/revokeToken.cjs +61 -0
- package/dist/legacy/firebase/discord/api/revokeToken.d.mts +29 -0
- package/dist/legacy/firebase/discord/api/revokeToken.mjs +58 -0
- package/dist/legacy/firebase/discord/config.cjs +21 -0
- package/dist/legacy/firebase/discord/config.d.mts +27 -0
- package/dist/legacy/firebase/discord/config.mjs +17 -0
- package/dist/legacy/firebase/discord/firebase_redirect/index.cjs +11 -0
- package/dist/legacy/firebase/discord/firebase_redirect/index.d.mts +7 -0
- package/dist/legacy/firebase/discord/firebase_redirect/index.mjs +7 -0
- package/dist/legacy/firebase/discord/firebase_redirect/login.cjs +110 -0
- package/dist/legacy/firebase/discord/firebase_redirect/login.d.mts +4 -0
- package/dist/legacy/firebase/discord/firebase_redirect/login.mjs +107 -0
- package/dist/legacy/firebase/discord/firebase_redirect/logout.cjs +100 -0
- package/dist/legacy/firebase/discord/firebase_redirect/logout.d.mts +4 -0
- package/dist/legacy/firebase/discord/firebase_redirect/logout.mjs +97 -0
- package/dist/legacy/firebase/discord/get/authURLGenerator.cjs +76 -0
- package/dist/legacy/firebase/discord/get/authURLGenerator.d.mts +23 -0
- package/dist/legacy/firebase/discord/get/authURLGenerator.mjs +67 -0
- package/dist/legacy/firebase/discord/get/cookie-session.cjs +32 -0
- package/dist/legacy/firebase/discord/get/cookie-session.d.mts +20 -0
- package/dist/legacy/firebase/discord/get/cookie-session.mjs +28 -0
- package/dist/legacy/firebase/discord/get/credentials.cjs +24 -0
- package/dist/legacy/firebase/discord/get/credentials.d.mts +19 -0
- package/dist/legacy/firebase/discord/get/credentials.mjs +20 -0
- package/dist/legacy/firebase/discord/get/errorValidator.cjs +60 -0
- package/dist/legacy/firebase/discord/get/errorValidator.d.mts +28 -0
- package/dist/legacy/firebase/discord/get/errorValidator.mjs +55 -0
- package/dist/legacy/firebase/discord/get/index.cjs +17 -0
- package/dist/legacy/firebase/discord/get/index.d.mts +13 -0
- package/dist/legacy/firebase/discord/get/index.mjs +13 -0
- package/dist/legacy/firebase/discord/get/randomAvatar.cjs +37 -0
- package/dist/legacy/firebase/discord/get/randomAvatar.d.mts +22 -0
- package/dist/legacy/firebase/discord/get/randomAvatar.mjs +30 -0
- package/dist/legacy/firebase/discord/http/index.cjs +15 -0
- package/dist/legacy/firebase/discord/http/index.d.mts +11 -0
- package/dist/legacy/firebase/discord/http/index.mjs +11 -0
- package/dist/legacy/firebase/discord/http/login.cjs +127 -0
- package/dist/legacy/firebase/discord/http/login.d.mts +21 -0
- package/dist/legacy/firebase/discord/http/login.mjs +123 -0
- package/dist/legacy/firebase/discord/http/logout.cjs +155 -0
- package/dist/legacy/firebase/discord/http/logout.d.mts +22 -0
- package/dist/legacy/firebase/discord/http/logout.mjs +143 -0
- package/dist/legacy/firebase/discord/http/redirect.cjs +188 -0
- package/dist/legacy/firebase/discord/http/redirect.d.mts +24 -0
- package/dist/legacy/firebase/discord/http/redirect.mjs +178 -0
- package/dist/legacy/firebase/discord/http/refreshToken.cjs +133 -0
- package/dist/legacy/firebase/discord/http/refreshToken.d.mts +24 -0
- package/dist/legacy/firebase/discord/http/refreshToken.mjs +121 -0
- package/dist/legacy/firebase/discord/index.cjs +19 -0
- package/dist/legacy/firebase/discord/index.d.mts +15 -0
- package/dist/legacy/firebase/discord/index.mjs +15 -0
- package/dist/legacy/firebase/discord/template/cookie-session.cjs +1430 -0
- package/dist/legacy/firebase/discord/template/cookie-session.d.mts +22 -0
- package/dist/legacy/firebase/discord/template/cookie-session.mjs +1159 -0
- package/dist/legacy/firebase/domainRedirect.cjs +35 -0
- package/dist/legacy/firebase/domainRedirect.d.mts +12 -0
- package/dist/legacy/firebase/domainRedirect.mjs +27 -0
- package/dist/legacy/firebase/escape.cjs +75 -0
- package/dist/legacy/firebase/escape.d.mts +17 -0
- package/dist/legacy/firebase/escape.mjs +58 -0
- package/dist/legacy/firebase/getDBAsync.cjs +33 -0
- package/dist/legacy/firebase/getDBAsync.d.mts +10 -0
- package/dist/legacy/firebase/getDBAsync.mjs +26 -0
- package/dist/legacy/firebase/getDBData.cjs +21 -0
- package/dist/legacy/firebase/getDBData.d.mts +1 -0
- package/dist/legacy/firebase/getDBData.mjs +17 -0
- package/dist/legacy/firebase/getDBValue.cjs +17 -0
- package/dist/legacy/firebase/getDBValue.d.mts +9 -0
- package/dist/legacy/firebase/getDBValue.mjs +14 -0
- package/dist/legacy/firebase/index.cjs +261 -0
- package/dist/legacy/firebase/index.d.mts +51 -0
- package/dist/legacy/firebase/index.mjs +234 -0
- package/dist/legacy/firebase/isEmulator.cjs +14 -0
- package/dist/legacy/firebase/isEmulator.d.mts +8 -0
- package/dist/legacy/firebase/isEmulator.mjs +10 -0
- package/dist/legacy/firebase/logger.cjs +137 -0
- package/dist/legacy/firebase/logger.d.mts +7 -0
- package/dist/legacy/firebase/logger.mjs +125 -0
- package/dist/legacy/firebase/mySQL.cjs +26 -0
- package/dist/legacy/firebase/mySQL.d.mts +10 -0
- package/dist/legacy/firebase/mySQL.mjs +22 -0
- package/dist/legacy/firebase/mysqlConnector/create.cjs +119 -0
- package/dist/legacy/firebase/mysqlConnector/create.d.mts +36 -0
- package/dist/legacy/firebase/mysqlConnector/create.mjs +109 -0
- package/dist/legacy/firebase/mysqlConnector/index.cjs +23 -0
- package/dist/legacy/firebase/mysqlConnector/index.d.mts +11 -0
- package/dist/legacy/firebase/mysqlConnector/index.mjs +16 -0
- package/dist/legacy/firebase/mysqlConnector/nextPrev.cjs +75 -0
- package/dist/legacy/firebase/mysqlConnector/nextPrev.d.mts +31 -0
- package/dist/legacy/firebase/mysqlConnector/nextPrev.mjs +63 -0
- package/dist/legacy/firebase/mysqlConnector/pagination.cjs +91 -0
- package/dist/legacy/firebase/mysqlConnector/pagination.d.mts +33 -0
- package/dist/legacy/firebase/mysqlConnector/pagination.mjs +87 -0
- package/dist/legacy/firebase/mysqlConnector/sameUser.cjs +28 -0
- package/dist/legacy/firebase/mysqlConnector/sameUser.d.mts +12 -0
- package/dist/legacy/firebase/mysqlConnector/sameUser.mjs +23 -0
- package/dist/legacy/firebase/transactionDBAsync.cjs +33 -0
- package/dist/legacy/firebase/transactionDBAsync.d.mts +11 -0
- package/dist/legacy/firebase/transactionDBAsync.mjs +27 -0
- package/dist/legacy/get/countObj.cjs +24 -0
- package/dist/legacy/get/countObj.d.mts +11 -0
- package/dist/legacy/get/countObj.mjs +21 -0
- package/dist/legacy/get/decimalColor.cjs +60 -0
- package/dist/legacy/get/decimalColor.d.mts +12 -0
- package/dist/legacy/get/decimalColor.mjs +54 -0
- package/dist/legacy/get/objType.cjs +43 -0
- package/dist/legacy/get/objType.d.mts +19 -0
- package/dist/legacy/get/objType.mjs +40 -0
- package/dist/legacy/get/pagination.cjs +100 -0
- package/dist/legacy/get/pagination.d.mts +25 -0
- package/dist/legacy/get/pagination.mjs +91 -0
- package/dist/legacy/get/queryUrlByName.cjs +31 -0
- package/dist/legacy/get/queryUrlByName.d.mts +20 -0
- package/dist/legacy/get/queryUrlByName.mjs +28 -0
- package/dist/legacy/get/queryUrlJSON.cjs +54 -0
- package/dist/legacy/get/queryUrlJSON.d.mts +23 -0
- package/dist/legacy/get/queryUrlJSON.mjs +57 -0
- package/dist/legacy/get/super_string_filter.cjs +97 -0
- package/dist/legacy/get/super_string_filter.d.mts +25 -0
- package/dist/legacy/get/super_string_filter.mjs +83 -0
- package/dist/legacy/get/versionCheck.cjs +49 -0
- package/dist/legacy/get/versionCheck.d.mts +17 -0
- package/dist/legacy/get/versionCheck.mjs +38 -0
- package/dist/legacy/http/HTTP-1.0.cjs +151 -0
- package/dist/legacy/http/HTTP-1.0.d.mts +8 -0
- package/dist/legacy/http/HTTP-1.0.mjs +136 -0
- package/dist/legacy/http/auth.cjs +70 -0
- package/dist/legacy/http/auth.d.mts +41 -0
- package/dist/legacy/http/auth.mjs +63 -0
- package/dist/legacy/http/check_domain.cjs +84 -0
- package/dist/legacy/http/check_domain.d.mts +10 -0
- package/dist/legacy/http/check_domain.mjs +82 -0
- package/dist/legacy/http/csrfTokenAnalyze.cjs +46 -0
- package/dist/legacy/http/csrfTokenAnalyze.d.mts +21 -0
- package/dist/legacy/http/csrfTokenAnalyze.mjs +40 -0
- package/dist/legacy/http/domainValidator.cjs +98 -0
- package/dist/legacy/http/domainValidator.d.mts +30 -0
- package/dist/legacy/http/domainValidator.mjs +82 -0
- package/dist/legacy/http/errorsCallback.cjs +55 -0
- package/dist/legacy/http/errorsCallback.d.mts +29 -0
- package/dist/legacy/http/errorsCallback.mjs +48 -0
- package/dist/legacy/http/fetch/json.cjs +48 -0
- package/dist/legacy/http/fetch/json.d.mts +22 -0
- package/dist/legacy/http/fetch/json.mjs +41 -0
- package/dist/legacy/http/fetch/text.cjs +47 -0
- package/dist/legacy/http/fetch/text.d.mts +21 -0
- package/dist/legacy/http/fetch/text.mjs +40 -0
- package/dist/legacy/http/fileCache.cjs +79 -0
- package/dist/legacy/http/fileCache.d.mts +35 -0
- package/dist/legacy/http/fileCache.mjs +70 -0
- package/dist/legacy/http/getDomainURL.cjs +59 -0
- package/dist/legacy/http/getDomainURL.d.mts +18 -0
- package/dist/legacy/http/getDomainURL.mjs +54 -0
- package/dist/legacy/http/userIP.cjs +59 -0
- package/dist/legacy/http/userIP.d.mts +21 -0
- package/dist/legacy/http/userIP.mjs +48 -0
- package/dist/legacy/index.cjs +122 -0
- package/dist/legacy/index.d.mts +89 -0
- package/dist/legacy/index.mjs +92 -0
- package/dist/legacy/libs/arraySortPositions.cjs +30 -0
- package/dist/legacy/libs/arraySortPositions.d.mts +16 -0
- package/dist/legacy/libs/arraySortPositions.mjs +27 -0
- package/dist/legacy/libs/capitalize.cjs +21 -0
- package/dist/legacy/libs/capitalize.d.mts +13 -0
- package/dist/legacy/libs/capitalize.mjs +17 -0
- package/dist/legacy/libs/convertBytes.cjs +64 -0
- package/dist/legacy/libs/convertBytes.d.mts +17 -0
- package/dist/legacy/libs/convertBytes.mjs +55 -0
- package/dist/legacy/libs/custom_module_loader.cjs +82 -0
- package/dist/legacy/libs/custom_module_loader.d.mts +5 -0
- package/dist/legacy/libs/custom_module_loader.mjs +79 -0
- package/dist/legacy/libs/dice.cjs +35 -0
- package/dist/legacy/libs/dice.d.mts +5 -0
- package/dist/legacy/libs/dice.mjs +31 -0
- package/dist/legacy/libs/markdown.cjs +85 -0
- package/dist/legacy/libs/markdown.d.mts +75 -0
- package/dist/legacy/libs/markdown.mjs +78 -0
- package/dist/legacy/libs/percentage.cjs +22 -0
- package/dist/legacy/libs/percentage.d.mts +4 -0
- package/dist/legacy/libs/percentage.mjs +19 -0
- package/dist/legacy/libs/regex/getLetter.cjs +22 -0
- package/dist/legacy/libs/regex/getLetter.d.mts +12 -0
- package/dist/legacy/libs/regex/getLetter.mjs +19 -0
- package/dist/legacy/libs/replaceAsync.cjs +32 -0
- package/dist/legacy/libs/replaceAsync.d.mts +15 -0
- package/dist/legacy/libs/replaceAsync.mjs +25 -0
- package/dist/legacy/libs/rule3.cjs +58 -0
- package/dist/legacy/libs/rule3.d.mts +5 -0
- package/dist/legacy/libs/rule3.mjs +54 -0
- package/dist/legacy/libs/userLevel.cjs +134 -0
- package/dist/legacy/libs/userLevel.d.mts +69 -0
- package/dist/legacy/libs/userLevel.mjs +123 -0
- package/dist/legacy/momentjs/getAge.cjs +28 -0
- package/dist/legacy/momentjs/getAge.d.mts +8 -0
- package/dist/legacy/momentjs/getAge.mjs +22 -0
- package/dist/legacy/momentjs/index.cjs +9 -0
- package/dist/legacy/momentjs/index.d.mts +3 -0
- package/dist/legacy/momentjs/index.mjs +3 -0
- package/dist/legacy/momentjs/timeDuration.cjs +29 -0
- package/dist/legacy/momentjs/timeDuration.d.mts +9 -0
- package/dist/legacy/momentjs/timeDuration.mjs +23 -0
- package/dist/legacy/socket.io/antiFlood/index.cjs +9 -0
- package/dist/legacy/socket.io/antiFlood/index.d.mts +3 -0
- package/dist/legacy/socket.io/antiFlood/index.mjs +3 -0
- package/dist/legacy/socket.io/antiFlood/install.cjs +32 -0
- package/dist/legacy/socket.io/antiFlood/install.d.mts +14 -0
- package/dist/legacy/socket.io/antiFlood/install.mjs +27 -0
- package/dist/legacy/socket.io/antiFlood/verify.cjs +87 -0
- package/dist/legacy/socket.io/antiFlood/verify.d.mts +15 -0
- package/dist/legacy/socket.io/antiFlood/verify.mjs +73 -0
- package/dist/legacy/socket.io/cookie-session.cjs +25 -0
- package/dist/legacy/socket.io/cookie-session.d.mts +9 -0
- package/dist/legacy/socket.io/cookie-session.mjs +20 -0
- package/dist/legacy/socket.io/discord.cjs +61 -0
- package/dist/legacy/socket.io/discord.d.mts +10 -0
- package/dist/legacy/socket.io/discord.mjs +52 -0
- package/dist/legacy/socket.io/index.cjs +13 -0
- package/dist/legacy/socket.io/index.d.mts +9 -0
- package/dist/legacy/socket.io/index.mjs +9 -0
- package/dist/v1/basics/array.cjs +31 -0
- package/dist/v1/basics/array.d.mts +10 -0
- package/dist/v1/basics/array.mjs +22 -0
- package/dist/v1/basics/clock.cjs +187 -0
- package/dist/v1/basics/clock.d.mts +37 -0
- package/dist/v1/basics/clock.mjs +152 -0
- package/dist/v1/basics/objFilter.cjs +55 -0
- package/dist/v1/basics/objFilter.d.mts +27 -0
- package/dist/v1/basics/objFilter.mjs +52 -0
- package/dist/v1/basics/simpleMath.cjs +88 -0
- package/dist/v1/basics/simpleMath.d.mts +54 -0
- package/dist/v1/basics/simpleMath.mjs +75 -0
- package/dist/v1/basics/text.cjs +34 -0
- package/dist/v1/basics/text.d.mts +20 -0
- package/dist/v1/basics/text.mjs +25 -0
- package/dist/v1/index.cjs +26 -0
- package/dist/v1/index.d.mts +15 -0
- package/dist/v1/index.mjs +8 -0
- package/package.json +72 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _ = require('lodash');
|
|
4
|
+
var moment = require('moment-timezone');
|
|
5
|
+
var md5 = require('md5');
|
|
6
|
+
var byteLength = require('byte-length');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @function fileCache
|
|
10
|
+
*
|
|
11
|
+
* Sends a stringified file as a response with caching, security headers, and optional metadata.
|
|
12
|
+
* If `data.file` is not a string, the request is passed to the next middleware.
|
|
13
|
+
*
|
|
14
|
+
* @param {object} res - Express response object.
|
|
15
|
+
* @param {Function} next - Express next middleware function.
|
|
16
|
+
* @param {object} data - Configuration object for the file response.
|
|
17
|
+
* @param {string} [data.file] - The content of the file to send (must be a string).
|
|
18
|
+
* @param {number} [data.fileMaxAge] - Max age in seconds for cache expiration.
|
|
19
|
+
* @param {string} [data.date] - A date string used for the `Last-Modified` header.
|
|
20
|
+
* @param {string} [data.timezone="Universal"] - Timezone for `moment.tz()`.
|
|
21
|
+
* @param {string} [data.contentType="application/javascript"] - MIME type for the response.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import fileCache from './fileCache.mjs';
|
|
25
|
+
*
|
|
26
|
+
* app.get('/my-script.js', (req, res, next) => {
|
|
27
|
+
* const content = fs.readFileSync('./public/my-script.js', 'utf8');
|
|
28
|
+
* fileCache(res, next, {
|
|
29
|
+
* file: content,
|
|
30
|
+
* fileMaxAge: 3600,
|
|
31
|
+
* date: fs.statSync('./public/my-script.js').mtime,
|
|
32
|
+
* contentType: 'application/javascript'
|
|
33
|
+
* });
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
function fileCache(res, next, data) {
|
|
37
|
+
// Prepare Config
|
|
38
|
+
const tinyCfg = _.defaultsDeep({}, data, {
|
|
39
|
+
timezone: 'Universal',
|
|
40
|
+
contentType: 'application/javascript',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Is String
|
|
44
|
+
if (typeof tinyCfg.file === 'string') {
|
|
45
|
+
// File Type
|
|
46
|
+
res.setHeader('Content-Type', tinyCfg.contentType);
|
|
47
|
+
res.setHeader('Accept-Ranges', 'bytes');
|
|
48
|
+
res.setHeader('Access-Control-Allow-Origin', 'same-origin');
|
|
49
|
+
res.setHeader('Cross-Origin-Resource-Policy', 'same-origin');
|
|
50
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
51
|
+
res.setHeader('X-Frame-Options', 'SAMEORIGIN');
|
|
52
|
+
res.setHeader('Timing-Allow-Origin', 'same-origin');
|
|
53
|
+
res.removeHeader('Connection');
|
|
54
|
+
res.removeHeader('X-Powered-By');
|
|
55
|
+
|
|
56
|
+
// MD5
|
|
57
|
+
if (md5) res.setHeader('Content-MD5', Buffer.from(md5(tinyCfg.file)).toString('base64'));
|
|
58
|
+
|
|
59
|
+
// Time
|
|
60
|
+
if (tinyCfg.date && moment)
|
|
61
|
+
res.setHeader('Last-Modified', moment.tz(tinyCfg.date, tinyCfg.timezone).toString());
|
|
62
|
+
|
|
63
|
+
// Cache Control
|
|
64
|
+
if (typeof tinyCfg.fileMaxAge === 'number')
|
|
65
|
+
res.setHeader('Expires', moment.tz('UTC').add(tinyCfg.fileMaxAge, 'seconds').toString());
|
|
66
|
+
res.set('Cache-Control', `public, max-age=${tinyCfg.fileMaxAge}`);
|
|
67
|
+
|
|
68
|
+
// File Size
|
|
69
|
+
if (byteLength) res.setHeader('Content-Length', byteLength.byteLength(tinyCfg.file));
|
|
70
|
+
|
|
71
|
+
// Send FIle
|
|
72
|
+
res.send(tinyCfg.file);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Nope
|
|
76
|
+
else next();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = fileCache;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @function fileCache
|
|
3
|
+
*
|
|
4
|
+
* Sends a stringified file as a response with caching, security headers, and optional metadata.
|
|
5
|
+
* If `data.file` is not a string, the request is passed to the next middleware.
|
|
6
|
+
*
|
|
7
|
+
* @param {object} res - Express response object.
|
|
8
|
+
* @param {Function} next - Express next middleware function.
|
|
9
|
+
* @param {object} data - Configuration object for the file response.
|
|
10
|
+
* @param {string} [data.file] - The content of the file to send (must be a string).
|
|
11
|
+
* @param {number} [data.fileMaxAge] - Max age in seconds for cache expiration.
|
|
12
|
+
* @param {string} [data.date] - A date string used for the `Last-Modified` header.
|
|
13
|
+
* @param {string} [data.timezone="Universal"] - Timezone for `moment.tz()`.
|
|
14
|
+
* @param {string} [data.contentType="application/javascript"] - MIME type for the response.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import fileCache from './fileCache.mjs';
|
|
18
|
+
*
|
|
19
|
+
* app.get('/my-script.js', (req, res, next) => {
|
|
20
|
+
* const content = fs.readFileSync('./public/my-script.js', 'utf8');
|
|
21
|
+
* fileCache(res, next, {
|
|
22
|
+
* file: content,
|
|
23
|
+
* fileMaxAge: 3600,
|
|
24
|
+
* date: fs.statSync('./public/my-script.js').mtime,
|
|
25
|
+
* contentType: 'application/javascript'
|
|
26
|
+
* });
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
export default function fileCache(res: object, next: Function, data: {
|
|
30
|
+
file?: string | undefined;
|
|
31
|
+
fileMaxAge?: number | undefined;
|
|
32
|
+
date?: string | undefined;
|
|
33
|
+
timezone?: string | undefined;
|
|
34
|
+
contentType?: string | undefined;
|
|
35
|
+
}): void;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import moment from 'moment-timezone';
|
|
3
|
+
import md5 from 'md5';
|
|
4
|
+
import byteLength from 'byte-length';
|
|
5
|
+
/**
|
|
6
|
+
* @function fileCache
|
|
7
|
+
*
|
|
8
|
+
* Sends a stringified file as a response with caching, security headers, and optional metadata.
|
|
9
|
+
* If `data.file` is not a string, the request is passed to the next middleware.
|
|
10
|
+
*
|
|
11
|
+
* @param {object} res - Express response object.
|
|
12
|
+
* @param {Function} next - Express next middleware function.
|
|
13
|
+
* @param {object} data - Configuration object for the file response.
|
|
14
|
+
* @param {string} [data.file] - The content of the file to send (must be a string).
|
|
15
|
+
* @param {number} [data.fileMaxAge] - Max age in seconds for cache expiration.
|
|
16
|
+
* @param {string} [data.date] - A date string used for the `Last-Modified` header.
|
|
17
|
+
* @param {string} [data.timezone="Universal"] - Timezone for `moment.tz()`.
|
|
18
|
+
* @param {string} [data.contentType="application/javascript"] - MIME type for the response.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* import fileCache from './fileCache.mjs';
|
|
22
|
+
*
|
|
23
|
+
* app.get('/my-script.js', (req, res, next) => {
|
|
24
|
+
* const content = fs.readFileSync('./public/my-script.js', 'utf8');
|
|
25
|
+
* fileCache(res, next, {
|
|
26
|
+
* file: content,
|
|
27
|
+
* fileMaxAge: 3600,
|
|
28
|
+
* date: fs.statSync('./public/my-script.js').mtime,
|
|
29
|
+
* contentType: 'application/javascript'
|
|
30
|
+
* });
|
|
31
|
+
* });
|
|
32
|
+
*/
|
|
33
|
+
export default function fileCache(res, next, data) {
|
|
34
|
+
// Prepare Config
|
|
35
|
+
const tinyCfg = _.defaultsDeep({}, data, {
|
|
36
|
+
timezone: 'Universal',
|
|
37
|
+
contentType: 'application/javascript',
|
|
38
|
+
});
|
|
39
|
+
// Is String
|
|
40
|
+
if (typeof tinyCfg.file === 'string') {
|
|
41
|
+
// File Type
|
|
42
|
+
res.setHeader('Content-Type', tinyCfg.contentType);
|
|
43
|
+
res.setHeader('Accept-Ranges', 'bytes');
|
|
44
|
+
res.setHeader('Access-Control-Allow-Origin', 'same-origin');
|
|
45
|
+
res.setHeader('Cross-Origin-Resource-Policy', 'same-origin');
|
|
46
|
+
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
47
|
+
res.setHeader('X-Frame-Options', 'SAMEORIGIN');
|
|
48
|
+
res.setHeader('Timing-Allow-Origin', 'same-origin');
|
|
49
|
+
res.removeHeader('Connection');
|
|
50
|
+
res.removeHeader('X-Powered-By');
|
|
51
|
+
// MD5
|
|
52
|
+
if (md5)
|
|
53
|
+
res.setHeader('Content-MD5', Buffer.from(md5(tinyCfg.file)).toString('base64'));
|
|
54
|
+
// Time
|
|
55
|
+
if (tinyCfg.date && moment)
|
|
56
|
+
res.setHeader('Last-Modified', moment.tz(tinyCfg.date, tinyCfg.timezone).toString());
|
|
57
|
+
// Cache Control
|
|
58
|
+
if (typeof tinyCfg.fileMaxAge === 'number')
|
|
59
|
+
res.setHeader('Expires', moment.tz('UTC').add(tinyCfg.fileMaxAge, 'seconds').toString());
|
|
60
|
+
res.set('Cache-Control', `public, max-age=${tinyCfg.fileMaxAge}`);
|
|
61
|
+
// File Size
|
|
62
|
+
if (byteLength)
|
|
63
|
+
res.setHeader('Content-Length', byteLength.byteLength(tinyCfg.file));
|
|
64
|
+
// Send FIle
|
|
65
|
+
res.send(tinyCfg.file);
|
|
66
|
+
}
|
|
67
|
+
// Nope
|
|
68
|
+
else
|
|
69
|
+
next();
|
|
70
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var check_domain = require('./check_domain.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @function getDomainURL
|
|
7
|
+
*
|
|
8
|
+
* Constructs a full URL string from a domain and optional port, determining the proper protocol.
|
|
9
|
+
* It also supports extracting the domain from an Express `req` object via `checkDomain.get(req)`.
|
|
10
|
+
*
|
|
11
|
+
* @param {string|object} domain - A domain string (e.g. "example.com") or Express `req` object.
|
|
12
|
+
* @param {number} [port] - Optional port to include in the URL (not added for ports 80 or 443).
|
|
13
|
+
* @param {string} [httpResult='https'] - The protocol to use (usually "http" or "https").
|
|
14
|
+
*
|
|
15
|
+
* @returns {string} A fully constructed URL string. Returns an empty string if the domain is invalid.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* getDomainURL('example.com', 443); // "https://example.com"
|
|
19
|
+
* getDomainURL('localhost', 3000); // "http://localhost:3000"
|
|
20
|
+
* getDomainURL(req, 8080); // Uses domain from request object
|
|
21
|
+
*/
|
|
22
|
+
function getDomainURL(domain, port, httpResult = 'https') {
|
|
23
|
+
// Domain Selected
|
|
24
|
+
let domainSelected = null;
|
|
25
|
+
|
|
26
|
+
// String
|
|
27
|
+
if (typeof domain === 'string') domainSelected = domain;
|
|
28
|
+
// Nope
|
|
29
|
+
else domainSelected = check_domain.get(domain);
|
|
30
|
+
|
|
31
|
+
// Domain
|
|
32
|
+
if (typeof domainSelected === 'string') {
|
|
33
|
+
// Port
|
|
34
|
+
let finalPort = port;
|
|
35
|
+
let finalURL = '';
|
|
36
|
+
if (typeof finalPort === 'number' && finalPort !== 80 && finalPort !== 443) {
|
|
37
|
+
finalPort = ':' + finalPort;
|
|
38
|
+
} else {
|
|
39
|
+
finalPort = '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Normal Domain
|
|
43
|
+
if (!domainSelected.startsWith('localhost:') && !domainSelected === 'localhost')
|
|
44
|
+
finalURL = `${httpResult}://${domainSelected}`;
|
|
45
|
+
// Localhost
|
|
46
|
+
else finalURL = `http://${domainSelected}`;
|
|
47
|
+
|
|
48
|
+
// Exist Port
|
|
49
|
+
if (finalPort && typeof finalURL.split(':')[2] !== 'string') finalURL += finalPort;
|
|
50
|
+
|
|
51
|
+
// Complete
|
|
52
|
+
return finalURL;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Nope
|
|
56
|
+
else return '';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = getDomainURL;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @function getDomainURL
|
|
3
|
+
*
|
|
4
|
+
* Constructs a full URL string from a domain and optional port, determining the proper protocol.
|
|
5
|
+
* It also supports extracting the domain from an Express `req` object via `checkDomain.get(req)`.
|
|
6
|
+
*
|
|
7
|
+
* @param {string|object} domain - A domain string (e.g. "example.com") or Express `req` object.
|
|
8
|
+
* @param {number} [port] - Optional port to include in the URL (not added for ports 80 or 443).
|
|
9
|
+
* @param {string} [httpResult='https'] - The protocol to use (usually "http" or "https").
|
|
10
|
+
*
|
|
11
|
+
* @returns {string} A fully constructed URL string. Returns an empty string if the domain is invalid.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* getDomainURL('example.com', 443); // "https://example.com"
|
|
15
|
+
* getDomainURL('localhost', 3000); // "http://localhost:3000"
|
|
16
|
+
* getDomainURL(req, 8080); // Uses domain from request object
|
|
17
|
+
*/
|
|
18
|
+
export default function getDomainURL(domain: string | object, port?: number, httpResult?: string): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import checkDomain from './check_domain.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* @function getDomainURL
|
|
4
|
+
*
|
|
5
|
+
* Constructs a full URL string from a domain and optional port, determining the proper protocol.
|
|
6
|
+
* It also supports extracting the domain from an Express `req` object via `checkDomain.get(req)`.
|
|
7
|
+
*
|
|
8
|
+
* @param {string|object} domain - A domain string (e.g. "example.com") or Express `req` object.
|
|
9
|
+
* @param {number} [port] - Optional port to include in the URL (not added for ports 80 or 443).
|
|
10
|
+
* @param {string} [httpResult='https'] - The protocol to use (usually "http" or "https").
|
|
11
|
+
*
|
|
12
|
+
* @returns {string} A fully constructed URL string. Returns an empty string if the domain is invalid.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* getDomainURL('example.com', 443); // "https://example.com"
|
|
16
|
+
* getDomainURL('localhost', 3000); // "http://localhost:3000"
|
|
17
|
+
* getDomainURL(req, 8080); // Uses domain from request object
|
|
18
|
+
*/
|
|
19
|
+
export default function getDomainURL(domain, port, httpResult = 'https') {
|
|
20
|
+
// Domain Selected
|
|
21
|
+
let domainSelected = null;
|
|
22
|
+
// String
|
|
23
|
+
if (typeof domain === 'string')
|
|
24
|
+
domainSelected = domain;
|
|
25
|
+
// Nope
|
|
26
|
+
else
|
|
27
|
+
domainSelected = checkDomain.get(domain);
|
|
28
|
+
// Domain
|
|
29
|
+
if (typeof domainSelected === 'string') {
|
|
30
|
+
// Port
|
|
31
|
+
let finalPort = port;
|
|
32
|
+
let finalURL = '';
|
|
33
|
+
if (typeof finalPort === 'number' && finalPort !== 80 && finalPort !== 443) {
|
|
34
|
+
finalPort = ':' + finalPort;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
finalPort = '';
|
|
38
|
+
}
|
|
39
|
+
// Normal Domain
|
|
40
|
+
if (!domainSelected.startsWith('localhost:') && !domainSelected === 'localhost')
|
|
41
|
+
finalURL = `${httpResult}://${domainSelected}`;
|
|
42
|
+
// Localhost
|
|
43
|
+
else
|
|
44
|
+
finalURL = `http://${domainSelected}`;
|
|
45
|
+
// Exist Port
|
|
46
|
+
if (finalPort && typeof finalURL.split(':')[2] !== 'string')
|
|
47
|
+
finalURL += finalPort;
|
|
48
|
+
// Complete
|
|
49
|
+
return finalURL;
|
|
50
|
+
}
|
|
51
|
+
// Nope
|
|
52
|
+
else
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _ = require('lodash');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves the client's IP address from the Express request object,
|
|
7
|
+
* supporting detection for Firebase/Cloud Functions, proxies, and direct connections.
|
|
8
|
+
*
|
|
9
|
+
* @param {import('express').Request} req - The Express request object.
|
|
10
|
+
* @param {Object} [options] - Optional configuration.
|
|
11
|
+
* @param {boolean} [options.isFirebase=false] - Enable detection for Firebase environments (e.g., Fastly).
|
|
12
|
+
*
|
|
13
|
+
* @returns {{ value: string[] | null, type: string | null }} An object containing the list of IP addresses and the detection source type.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const ipInfo = userIp(req);
|
|
17
|
+
* console.log(ipInfo.value); // ['192.168.0.1']
|
|
18
|
+
* console.log(ipInfo.type); // 'x-forwarded-for'
|
|
19
|
+
*/
|
|
20
|
+
function userIp(req, options) {
|
|
21
|
+
let ip = { value: null, type: null };
|
|
22
|
+
|
|
23
|
+
const tinyCfg = _.defaultsDeep({}, options, {
|
|
24
|
+
isFirebase: false,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (req.headers) {
|
|
28
|
+
// Firebase / Fastly
|
|
29
|
+
if (tinyCfg.isFirebase && req.headers['fastly-client-ip']) {
|
|
30
|
+
ip.value = req.headers['fastly-client-ip'];
|
|
31
|
+
ip.type = 'fastly-client-ip';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Proxies
|
|
35
|
+
if (typeof ip.value !== 'string' && req.headers['x-forwarded-for']) {
|
|
36
|
+
ip.value = req.headers['x-forwarded-for'];
|
|
37
|
+
ip.type = 'x-forwarded-for';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Connection IP
|
|
42
|
+
if (typeof ip.value !== 'string' && req.connection && req.connection.remoteAddress) {
|
|
43
|
+
ip.value = req.connection.remoteAddress;
|
|
44
|
+
ip.type = 'connection.remoteAddress';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Fallback: req.ip (Express built-in)
|
|
48
|
+
if (typeof ip.value !== 'string' && req.ip) {
|
|
49
|
+
ip.value = req.ip;
|
|
50
|
+
ip.type = 'req.ip';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Normalize as array
|
|
54
|
+
if (typeof ip.value === 'string') ip.value = ip.value.split(',').map((i) => i.trim());
|
|
55
|
+
|
|
56
|
+
return ip;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = userIp;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the client's IP address from the Express request object,
|
|
3
|
+
* supporting detection for Firebase/Cloud Functions, proxies, and direct connections.
|
|
4
|
+
*
|
|
5
|
+
* @param {import('express').Request} req - The Express request object.
|
|
6
|
+
* @param {Object} [options] - Optional configuration.
|
|
7
|
+
* @param {boolean} [options.isFirebase=false] - Enable detection for Firebase environments (e.g., Fastly).
|
|
8
|
+
*
|
|
9
|
+
* @returns {{ value: string[] | null, type: string | null }} An object containing the list of IP addresses and the detection source type.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const ipInfo = userIp(req);
|
|
13
|
+
* console.log(ipInfo.value); // ['192.168.0.1']
|
|
14
|
+
* console.log(ipInfo.type); // 'x-forwarded-for'
|
|
15
|
+
*/
|
|
16
|
+
export default function userIp(req: import("express").Request, options?: {
|
|
17
|
+
isFirebase?: boolean | undefined;
|
|
18
|
+
}): {
|
|
19
|
+
value: string[] | null;
|
|
20
|
+
type: string | null;
|
|
21
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves the client's IP address from the Express request object,
|
|
4
|
+
* supporting detection for Firebase/Cloud Functions, proxies, and direct connections.
|
|
5
|
+
*
|
|
6
|
+
* @param {import('express').Request} req - The Express request object.
|
|
7
|
+
* @param {Object} [options] - Optional configuration.
|
|
8
|
+
* @param {boolean} [options.isFirebase=false] - Enable detection for Firebase environments (e.g., Fastly).
|
|
9
|
+
*
|
|
10
|
+
* @returns {{ value: string[] | null, type: string | null }} An object containing the list of IP addresses and the detection source type.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const ipInfo = userIp(req);
|
|
14
|
+
* console.log(ipInfo.value); // ['192.168.0.1']
|
|
15
|
+
* console.log(ipInfo.type); // 'x-forwarded-for'
|
|
16
|
+
*/
|
|
17
|
+
export default function userIp(req, options) {
|
|
18
|
+
let ip = { value: null, type: null };
|
|
19
|
+
const tinyCfg = _.defaultsDeep({}, options, {
|
|
20
|
+
isFirebase: false,
|
|
21
|
+
});
|
|
22
|
+
if (req.headers) {
|
|
23
|
+
// Firebase / Fastly
|
|
24
|
+
if (tinyCfg.isFirebase && req.headers['fastly-client-ip']) {
|
|
25
|
+
ip.value = req.headers['fastly-client-ip'];
|
|
26
|
+
ip.type = 'fastly-client-ip';
|
|
27
|
+
}
|
|
28
|
+
// Proxies
|
|
29
|
+
if (typeof ip.value !== 'string' && req.headers['x-forwarded-for']) {
|
|
30
|
+
ip.value = req.headers['x-forwarded-for'];
|
|
31
|
+
ip.type = 'x-forwarded-for';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Connection IP
|
|
35
|
+
if (typeof ip.value !== 'string' && req.connection && req.connection.remoteAddress) {
|
|
36
|
+
ip.value = req.connection.remoteAddress;
|
|
37
|
+
ip.type = 'connection.remoteAddress';
|
|
38
|
+
}
|
|
39
|
+
// Fallback: req.ip (Express built-in)
|
|
40
|
+
if (typeof ip.value !== 'string' && req.ip) {
|
|
41
|
+
ip.value = req.ip;
|
|
42
|
+
ip.type = 'req.ip';
|
|
43
|
+
}
|
|
44
|
+
// Normalize as array
|
|
45
|
+
if (typeof ip.value === 'string')
|
|
46
|
+
ip.value = ip.value.split(',').map((i) => i.trim());
|
|
47
|
+
return ip;
|
|
48
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var countObj = require('./get/countObj.cjs');
|
|
4
|
+
var objType = require('./get/objType.cjs');
|
|
5
|
+
var super_string_filter = require('./get/super_string_filter.cjs');
|
|
6
|
+
var auth = require('./http/auth.cjs');
|
|
7
|
+
var check_domain = require('./http/check_domain.cjs');
|
|
8
|
+
var domainValidator = require('./http/domainValidator.cjs');
|
|
9
|
+
var errorsCallback = require('./http/errorsCallback.cjs');
|
|
10
|
+
var HTTP1_0 = require('./http/HTTP-1.0.cjs');
|
|
11
|
+
var userIP = require('./http/userIP.cjs');
|
|
12
|
+
var convertBytes = require('./libs/convertBytes.cjs');
|
|
13
|
+
var custom_module_loader = require('./libs/custom_module_loader.cjs');
|
|
14
|
+
var replaceAsync = require('./libs/replaceAsync.cjs');
|
|
15
|
+
var index$2 = require('./momentjs/index.cjs');
|
|
16
|
+
var index$1 = require('./crypto/index.cjs');
|
|
17
|
+
var pagination = require('./get/pagination.cjs');
|
|
18
|
+
var getDomainURL = require('./http/getDomainURL.cjs');
|
|
19
|
+
var dice = require('./libs/dice.cjs');
|
|
20
|
+
var userLevel = require('./libs/userLevel.cjs');
|
|
21
|
+
var queryUrlByName = require('./get/queryUrlByName.cjs');
|
|
22
|
+
var queryUrlJSON = require('./get/queryUrlJSON.cjs');
|
|
23
|
+
var decimalColor = require('./get/decimalColor.cjs');
|
|
24
|
+
var percentage = require('./libs/percentage.cjs');
|
|
25
|
+
var rule3 = require('./libs/rule3.cjs');
|
|
26
|
+
var versionCheck = require('./get/versionCheck.cjs');
|
|
27
|
+
var index = require('./socket.io/index.cjs');
|
|
28
|
+
var arraySortPositions = require('./libs/arraySortPositions.cjs');
|
|
29
|
+
var capitalize = require('./libs/capitalize.cjs');
|
|
30
|
+
var json = require('./http/fetch/json.cjs');
|
|
31
|
+
var text = require('./http/fetch/text.cjs');
|
|
32
|
+
var csrfTokenAnalyze = require('./http/csrfTokenAnalyze.cjs');
|
|
33
|
+
|
|
34
|
+
const legacyModules = {
|
|
35
|
+
// Convert Bytes
|
|
36
|
+
convertBytes,
|
|
37
|
+
|
|
38
|
+
// HTTP/1.0 Render
|
|
39
|
+
'HTTP/1.0': HTTP1_0,
|
|
40
|
+
|
|
41
|
+
// Moment JS
|
|
42
|
+
momentjs: index$2,
|
|
43
|
+
|
|
44
|
+
// Check Domain
|
|
45
|
+
checkDomain: check_domain,
|
|
46
|
+
|
|
47
|
+
// Get Obj Type
|
|
48
|
+
getObjType: objType,
|
|
49
|
+
|
|
50
|
+
// Count Obj
|
|
51
|
+
countObj: countObj,
|
|
52
|
+
|
|
53
|
+
// HTTP Auth Generator
|
|
54
|
+
httpAuth: auth,
|
|
55
|
+
|
|
56
|
+
// Replace Async
|
|
57
|
+
replaceAsync,
|
|
58
|
+
|
|
59
|
+
// User IP
|
|
60
|
+
getUserIP: userIP,
|
|
61
|
+
|
|
62
|
+
// Super string Filter
|
|
63
|
+
superStringFilter: super_string_filter,
|
|
64
|
+
|
|
65
|
+
// Custom Module Loader
|
|
66
|
+
customModuleManager: custom_module_loader,
|
|
67
|
+
|
|
68
|
+
// Errors Callback
|
|
69
|
+
errorsCallback,
|
|
70
|
+
|
|
71
|
+
// Domain Validator
|
|
72
|
+
domainValidator,
|
|
73
|
+
|
|
74
|
+
// Crypto
|
|
75
|
+
crypto: index$1,
|
|
76
|
+
|
|
77
|
+
// Pagination
|
|
78
|
+
pagination,
|
|
79
|
+
|
|
80
|
+
// Get Domain URL
|
|
81
|
+
getDomainURL,
|
|
82
|
+
|
|
83
|
+
// Dice
|
|
84
|
+
dice: dice,
|
|
85
|
+
|
|
86
|
+
// User Level
|
|
87
|
+
LevelUp: userLevel,
|
|
88
|
+
|
|
89
|
+
// Get URL Parameter
|
|
90
|
+
getQueryUrlByName: queryUrlByName,
|
|
91
|
+
getQueryUrlJSON: queryUrlJSON,
|
|
92
|
+
|
|
93
|
+
// Get Decimal Color
|
|
94
|
+
getDecimalColor: decimalColor,
|
|
95
|
+
|
|
96
|
+
// Percentage
|
|
97
|
+
percentage: percentage,
|
|
98
|
+
|
|
99
|
+
// Rule 3
|
|
100
|
+
rule3,
|
|
101
|
+
|
|
102
|
+
// Version Check
|
|
103
|
+
versionCheck,
|
|
104
|
+
|
|
105
|
+
// Socket IO
|
|
106
|
+
socketIO: index,
|
|
107
|
+
|
|
108
|
+
// Array Sort Positions
|
|
109
|
+
arraySortPositions,
|
|
110
|
+
|
|
111
|
+
// Capitalize
|
|
112
|
+
capitalize,
|
|
113
|
+
|
|
114
|
+
// Fetch
|
|
115
|
+
fetchJSON: json,
|
|
116
|
+
fetchText: text,
|
|
117
|
+
|
|
118
|
+
// csrfToken Analyze
|
|
119
|
+
csrfTokenAnalyze,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
module.exports = legacyModules;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export default legacyModules;
|
|
2
|
+
declare const legacyModules: {
|
|
3
|
+
convertBytes: {
|
|
4
|
+
list: any;
|
|
5
|
+
sequence: import("./libs/convertBytes.mjs").SizeUnit[];
|
|
6
|
+
get: (bytes: number, selected: SizeUnit) => number;
|
|
7
|
+
convert: (bytes: number, selected: SizeUnit) => number;
|
|
8
|
+
};
|
|
9
|
+
'HTTP/1.0': {
|
|
10
|
+
readonly list: {
|
|
11
|
+
[x: number]: string;
|
|
12
|
+
};
|
|
13
|
+
send: (res: import("express").Response, http_code: number, callback?: (arg0: number) => void) => any;
|
|
14
|
+
sendAsync: (res: import("express").Response, http_code: number, callback?: (arg0: number) => Promise<any>) => Promise<any>;
|
|
15
|
+
};
|
|
16
|
+
momentjs: typeof momentjs;
|
|
17
|
+
checkDomain: {
|
|
18
|
+
validators: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
callback: (arg0: req) => Object;
|
|
21
|
+
the_domain?: string;
|
|
22
|
+
}>;
|
|
23
|
+
validator: (req: Object, the_domain: string) => boolean;
|
|
24
|
+
get: (req: Object) => string | null;
|
|
25
|
+
};
|
|
26
|
+
getObjType: typeof objType;
|
|
27
|
+
countObj: typeof countObj;
|
|
28
|
+
httpAuth: typeof auth;
|
|
29
|
+
replaceAsync: typeof replaceAsync;
|
|
30
|
+
getUserIP: typeof userIp;
|
|
31
|
+
superStringFilter: typeof super_string_filter;
|
|
32
|
+
customModuleManager: {
|
|
33
|
+
validator: (custom_modules: Object, type: string) => boolean;
|
|
34
|
+
run: (custom_modules: Object | Function[], db_prepare: any, hookType: string, options?: Object) => Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
errorsCallback: typeof errorsCallback;
|
|
37
|
+
domainValidator: typeof domainValidator;
|
|
38
|
+
crypto: typeof crypto;
|
|
39
|
+
pagination: typeof pagination;
|
|
40
|
+
getDomainURL: typeof getDomainURL;
|
|
41
|
+
dice: {
|
|
42
|
+
vanilla: (obj: number) => number;
|
|
43
|
+
getClientVanilla: (obj: number) => string;
|
|
44
|
+
};
|
|
45
|
+
LevelUp: typeof LevelUp;
|
|
46
|
+
getQueryUrlByName: typeof queryUrlByName;
|
|
47
|
+
getQueryUrlJSON: typeof queryUrlJSON;
|
|
48
|
+
getDecimalColor: typeof decimalColor;
|
|
49
|
+
percentage: {
|
|
50
|
+
run: (preco: number, porcentagem: number) => number;
|
|
51
|
+
};
|
|
52
|
+
rule3: {
|
|
53
|
+
getClient: () => string;
|
|
54
|
+
execute: (val1: number, val2: number, val3: number, inverse: boolean) => number;
|
|
55
|
+
};
|
|
56
|
+
versionCheck: typeof versionCheck;
|
|
57
|
+
socketIO: {
|
|
58
|
+
antiFlood: typeof import("./socket.io/antiFlood/index.mjs");
|
|
59
|
+
'cookie-session': typeof import("./socket.io/cookie-session.mjs").default;
|
|
60
|
+
discord: typeof import("./socket.io/discord.mjs").default;
|
|
61
|
+
};
|
|
62
|
+
arraySortPositions: typeof arraySortPositions;
|
|
63
|
+
capitalize: typeof capitalize;
|
|
64
|
+
fetchJSON: typeof getJsonFetch;
|
|
65
|
+
fetchText: typeof getTextFetch;
|
|
66
|
+
csrfTokenAnalyze: typeof csrfTokenAnalyze;
|
|
67
|
+
};
|
|
68
|
+
import * as momentjs from './momentjs/index.mjs';
|
|
69
|
+
import objType from './get/objType.mjs';
|
|
70
|
+
import countObj from './get/countObj.mjs';
|
|
71
|
+
import auth from './http/auth.mjs';
|
|
72
|
+
import replaceAsync from './libs/replaceAsync.mjs';
|
|
73
|
+
import userIp from './http/userIP.mjs';
|
|
74
|
+
import super_string_filter from './get/super_string_filter.mjs';
|
|
75
|
+
import errorsCallback from './http/errorsCallback.mjs';
|
|
76
|
+
import domainValidator from './http/domainValidator.mjs';
|
|
77
|
+
import * as crypto from './crypto/index.mjs';
|
|
78
|
+
import pagination from './get/pagination.mjs';
|
|
79
|
+
import getDomainURL from './http/getDomainURL.mjs';
|
|
80
|
+
import LevelUp from './libs/userLevel.mjs';
|
|
81
|
+
import queryUrlByName from './get/queryUrlByName.mjs';
|
|
82
|
+
import queryUrlJSON from './get/queryUrlJSON.mjs';
|
|
83
|
+
import decimalColor from './get/decimalColor.mjs';
|
|
84
|
+
import versionCheck from './get/versionCheck.mjs';
|
|
85
|
+
import arraySortPositions from './libs/arraySortPositions.mjs';
|
|
86
|
+
import capitalize from './libs/capitalize.mjs';
|
|
87
|
+
import getJsonFetch from './http/fetch/json.mjs';
|
|
88
|
+
import getTextFetch from './http/fetch/text.mjs';
|
|
89
|
+
import csrfTokenAnalyze from './http/csrfTokenAnalyze.mjs';
|