/
opt
/
canhelp
/
node_modules
/
next
/
dist
/
esm
/
build
/
/opt/canhelp/node_modules/next/dist/esm/build
mkdir
upload
Name
Size
Mode
Actions
adapter/
-
0755
rm
analysis/
-
0755
rm
babel/
-
0755
rm
manifests/
-
0755
rm
next-config-ts/
-
0755
rm
output/
-
0755
rm
polyfills/
-
0755
rm
segment-config/
-
0755
rm
static-paths/
-
0755
rm
swc/
-
0755
rm
templates/
-
0755
rm
turbopack-build/
-
0755
rm
turborepo-access-trace/
-
0755
rm
webpack/
-
0755
rm
webpack-build/
-
0755
rm
webpack-config-rules/
-
0755
rm
after-production-compile.js
1622
0644
edit
dl
rm
after-production-compile.js.map
3139
0644
edit
dl
rm
build-context.js
1353
0644
edit
dl
rm
build-context.js.map
4056
0644
edit
dl
rm
collect-build-traces.js
21598
0644
edit
dl
rm
collect-build-traces.js.map
35392
0644
edit
dl
rm
compiler.js
2884
0644
edit
dl
rm
compiler.js.map
4786
0644
edit
dl
rm
create-compiler-aliases.js
24564
0644
edit
dl
rm
create-compiler-aliases.js.map
39961
0644
edit
dl
rm
define-env.js
14335
0644
edit
dl
rm
define-env.js.map
23166
0644
edit
dl
rm
deployment-id.js
218
0644
edit
dl
rm
deployment-id.js.map
506
0644
edit
dl
rm
duration-to-string.js
544
0644
edit
dl
rm
duration-to-string.js.map
1084
0644
edit
dl
rm
entries.js
36260
0644
edit
dl
rm
entries.js.map
61660
0644
edit
dl
rm
generate-build-id.js
794
0644
edit
dl
rm
generate-build-id.js.map
1198
0644
edit
dl
rm
get-babel-config-file.js
622
0644
edit
dl
rm
get-babel-config-file.js.map
1100
0644
edit
dl
rm
get-babel-loader-config.js
2937
0644
edit
dl
rm
get-babel-loader-config.js.map
4885
0644
edit
dl
rm
handle-entrypoints.js
4571
0644
edit
dl
rm
handle-entrypoints.js.map
7076
0644
edit
dl
rm
handle-externals.js
13623
0644
edit
dl
rm
handle-externals.js.map
21653
0644
edit
dl
rm
index.js
147239
0644
edit
dl
rm
index.js.map
225575
0644
edit
dl
rm
is-writeable.js
262
0644
edit
dl
rm
is-writeable.js.map
635
0644
edit
dl
rm
load-entrypoint.js
1700
0644
edit
dl
rm
load-entrypoint.js.map
3098
0644
edit
dl
rm
load-jsconfig.js
3451
0644
edit
dl
rm
load-jsconfig.js.map
6508
0644
edit
dl
rm
next-dir-paths.js
301
0644
edit
dl
rm
next-dir-paths.js.map
681
0644
edit
dl
rm
normalize-catchall-routes.js
4195
0644
edit
dl
rm
normalize-catchall-routes.js.map
6643
0644
edit
dl
rm
page-extensions-type.js
61
0644
edit
dl
rm
page-extensions-type.js.map
180
0644
edit
dl
rm
preview-key-utils.js
3408
0644
edit
dl
rm
preview-key-utils.js.map
5966
0644
edit
dl
rm
progress.js
2949
0644
edit
dl
rm
progress.js.map
4588
0644
edit
dl
rm
rendering-mode.js
618
0644
edit
dl
rm
rendering-mode.js.map
711
0644
edit
dl
rm
spinner.js
2869
0644
edit
dl
rm
spinner.js.map
4933
0644
edit
dl
rm
type-check.js
5278
0644
edit
dl
rm
type-check.js.map
9251
0644
edit
dl
rm
utils.js
53806
0644
edit
dl
rm
utils.js.map
95393
0644
edit
dl
rm
webpack-config.js
108498
0644
edit
dl
rm
webpack-config.js.map
158206
0644
edit
dl
rm
worker.js
206
0644
edit
dl
rm
worker.js.map
481
0644
edit
dl
rm
write-build-id.js
331
0644
edit
dl
rm
write-build-id.js.map
743
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/next/dist/esm/build/preview-key-utils.js
(3408B)
import path from 'path'; import fs from 'fs'; import crypto from 'crypto'; import { getStorageDirectory } from '../server/cache-dir'; const CONFIG_FILE = '.previewinfo'; const PREVIEW_ID = 'previewModeId'; const PREVIEW_SIGNING_KEY = 'previewModeSigningKey'; const PREVIEW_ENCRYPTION_KEY = 'previewModeEncryptionKey'; const PREVIEW_EXPIRE_AT = 'expireAt'; const EXPIRATION = 1000 * 60 * 60 * 24 * 14 // 14 days ; async function writeCache(distDir, config) { const cacheBaseDir = getStorageDirectory(distDir); if (!cacheBaseDir) return; const configPath = path.join(cacheBaseDir, CONFIG_FILE); if (!fs.existsSync(cacheBaseDir)) { await fs.promises.mkdir(cacheBaseDir, { recursive: true }); } await fs.promises.writeFile(configPath, JSON.stringify({ [PREVIEW_ID]: config.previewModeId, [PREVIEW_SIGNING_KEY]: config.previewModeSigningKey, [PREVIEW_ENCRYPTION_KEY]: config.previewModeEncryptionKey, [PREVIEW_EXPIRE_AT]: Date.now() + EXPIRATION })); } function generateConfig() { return { previewModeId: crypto.randomBytes(16).toString('hex'), previewModeSigningKey: crypto.randomBytes(32).toString('hex'), previewModeEncryptionKey: crypto.randomBytes(32).toString('hex') }; } // This utility is used to get a key for the cache directory. If the // key is not present, it will generate a new one and store it in the // cache directory inside dist. // The key will also expire after a certain amount of time. Once it // expires, a new one will be generated. export async function generatePreviewKeys({ distDir, isBuild }) { const cacheBaseDir = getStorageDirectory(distDir); if (!cacheBaseDir) { // There's no persistent storage available. We generate a new config. // This also covers development time. return generateConfig(); } const configPath = path.join(cacheBaseDir, CONFIG_FILE); async function tryReadCachedConfig() { if (!fs.existsSync(configPath)) return false; try { const config = JSON.parse(await fs.promises.readFile(configPath, 'utf8')); if (!config) return false; if (typeof config[PREVIEW_ID] !== 'string' || typeof config[PREVIEW_ENCRYPTION_KEY] !== 'string' || typeof config[PREVIEW_SIGNING_KEY] !== 'string' || typeof config[PREVIEW_EXPIRE_AT] !== 'number') { return false; } // For build time, we need to rotate the key if it's expired. Otherwise // (next start) we have to keep the key as it is so the runtime key matches // the build time key. if (isBuild && config[PREVIEW_EXPIRE_AT] < Date.now()) { return false; } return { previewModeId: config[PREVIEW_ID], previewModeSigningKey: config[PREVIEW_SIGNING_KEY], previewModeEncryptionKey: config[PREVIEW_ENCRYPTION_KEY] }; } catch (e) { // Broken config file. We should generate a new key and overwrite it. return false; } } const maybeValidConfig = await tryReadCachedConfig(); if (maybeValidConfig !== false) { return maybeValidConfig; } const config = generateConfig(); await writeCache(distDir, config); return config; } //# sourceMappingURL=preview-key-utils.js.map
Save
cmd:
run