文件操作 - index.mjs
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/untun/dist/index.mjs
编辑文件内容
import { existsSync } from 'node:fs'; import consola from 'consola'; async function startTunnel(opts) { const { installCloudflared, startCloudflaredTunnel, cloudflaredBinPath, cloudflaredNotice } = await import('./chunks/index.mjs'); const url = opts.url || `${opts.protocol || "http"}://${opts.hostname ?? "localhost"}:${opts.port ?? 3e3}`; consola.start(`Starting cloudflared tunnel to ${url}`); if (!existsSync(cloudflaredBinPath)) { consola.log(cloudflaredNotice); const canInstall = opts.acceptCloudflareNotice || process.env.UNTUN_ACCEPT_CLOUDFLARE_NOTICE || await consola.prompt( `Do you agree with the above terms and wish to install the binary from GitHub?`, { type: "confirm" } ); if (!canInstall) { consola.fail("Skipping tunnel setup."); return; } await installCloudflared(); } const args = [ ["--url", url], opts.verifyTLS ? void 0 : ["--no-tls-verify", ""] ].filter(Boolean); const tunnel = await startCloudflaredTunnel(Object.fromEntries(args)); const cleanup = async () => { await tunnel.stop(); }; for (const signal of ["SIGINT", "SIGUSR1", "SIGUSR2"]) { process.once(signal, cleanup); } return { getURL: async () => await tunnel.url, close: async () => { await cleanup(); } }; } export { startTunnel };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件