s0urcelab / serverless-cloud-notepad Goto Github PK
View Code? Open in Web Editor NEW☁ Yet Another Cloud Notepad.
Home Page: https://note.src.moe
License: MIT License
☁ Yet Another Cloud Notepad.
Home Page: https://note.src.moe
License: MIT License
[WARNING] Processing wrangler.toml configuration:
- Unexpected fields found in top-level field: "SCN_SALT"
Attempting to login via OAuth...
F:\js\serverless-cloud-notepad\node_modules\wrangler\wrangler-dist\cli.js:16259
throw ex;
^
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at JSON.parse (<anonymous>)
at Response.json (F:\js\serverless-cloud-notepad\node_modules\wrangler\wrangler-dist\cli.js:72475:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async exchangeAuthCodeForAccessToken (F:\js\serverless-cloud-notepad\node_modules\wrangler\wrangler-dist\cli.js:105671:23)
at async Server.<anonymous> (F:\js\serverless-cloud-notepad\node_modules\wrangler\wrangler-dist\cli.js:105807:30)
Node.js v20.10.0
这是个什么问题,我搞不懂。
按文档报错
pwsh npm run publish
> [email protected] publish
> wrangler publish
Proxy environment variables detected. We'll use your proxy for fetch requests.
⛅️ wrangler 3.60.3
-------------------
▲ [WARNING] `wrangler publish` is deprecated and will be removed in the next major version.
Please use `wrangler deploy` instead, which accepts exactly the same arguments.
Total Upload: 39.15 KiB / gzip: 11.42 KiB
Your worker has access to the following bindings:
- KV Namespaces:
- NOTES: 82faa7b7043c4a04b0db7cae1fea637b
- SHARE: da3d6dc4a5874f5a8229327d9aa9d11d
✘ [ERROR] A request to the Cloudflare API (/accounts/5af061ede7b10b1738bd475c1bc74a97/workers/scripts/cloud-notepad) failed.
Uncaught ReferenceError: SCN_SALT is not defined
at null.<anonymous> (file:///E:/gh/serverless-cloud-notepad/src/constant.js:5:21)
at null.<anonymous> (worker.js:921:3)
[code: 10021]
If you think this is a bug, please open an issue at:
https://github.com/cloudflare/workers-sdk/issues/new/choose
请问可以用 Github Actions 部署吗
clone 代码到本地再部署不方便更新
例如默认是abc.com/s/md5是带ui的文本,
abc.com/m/md5是markdown,
abc.com/t/md5是纯文本,方便别的调用?
项目使用感觉很好,但是请问如果有人恶意设置密码或者修改密码怎么解决,如果重新部署数据都消失了.
我的想法是增加一个pwd的环境变量,使用这个pwd作为root密码,无论什么密码 认证时输入pwd就直接通过
代码比较粗糙,效果属于可用
修改 src/index.js文件在11-15行片段之后添加以下代码:
// 处理 /list 路由
router.get('/list', async () => {
const keys = await NOTES.list() // 获取所有笔记的键
// 生成表格行,每行显示每个键的所有字段信息
const rows = keys.keys.map(key => `
<tr>
<td><a href="/${key.name}">${key.name}</a></td>
<td>${key.metadata ? (() => {
const date = new Date(key.metadata.updateAt * 1000);
const pad = num => num.toString().padStart(2, '0');
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
})() : 'N/A'}
</td>
</tr>
`).join('<br>')
// 生成包含表格的HTML
const html = `
<!DOCTYPE html>
<html>
<head>
<title>Note List</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border: 1px solid #ddd; text-align: left; }
th { background-color: #f4f4f4; }
</style>
</head>
<body>
<h1>Note List</h1>
<table>
<thead>
<tr>
<th>Note Link</th>
<th>Modify Time</th>
</tr>
</thead>
<tbody>
${rows}
</tbody>
</table>
</body>
</html>`
return new Response(html, {
headers: { 'Content-Type': 'text/html' },
})
})
然后wrangler publish
即可重新部署
since 2.0.0, mobile layout is broken.
大佬,新版的 preview_id这个我删掉有影响吗
kv_namespaces = [
{ binding = "NOTES", id = "b3afc649c15247c9962346b3de4730cc", preview_id = "01083e57f68046079a62015c3ea4a145" },
{ binding = "SHARE", id = "c075feeec9b6414296e6a3df7404e6a8", preview_id = "f89caa54860940709800dc6ed3ff920a" }
]
我填写的是
kv_namespaces = [
{ binding = "NOTES", id = "我的ID" },
{ binding = "SHARE", id = "我的ID2" }
]
preview_id这个没说明我就没有填写了
目前编辑后对方显示有延迟(刷新好几遍后才能显示),看能不能实现多人共同匿名编辑,实时显示的功能?
因为本人是初级小白,如果能更新更详细的部署教程就再好不过了。
希望可以更新一下部署方式哦
感谢!!!!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.