吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 856|回复: 16
上一主题 下一主题
收起左侧

[其他原创] 秘密文档 - 端到端加密的阅后即焚文档

  [复制链接]
跳转到指定楼层
楼主
风之暇想 发表于 2026-3-16 12:38 回帖奖励

Cloudflare Worker Secret doc

极简、开源端到端加密的阅后即焚文档。

功能特点

  • 🔒 安全加密:使用 AES -GCM 加密保护文档内容
  • 自动销毁:支持设置查看次数和有效期
  • 📝 Markdown:支持 Markdown 格式的文档
  • 🎨 夜间模式:夜间护眼不可少
  • 🔄 实时倒计时:显示剩余查看次数、剩余时间
  • 📋 一键复制:自动复制分享链接到剪贴板
  • 💥 手动销毁:支持手动立即销毁文档
  • 🌐 边缘计算:基于 Cloudflare Worker,全球极速访问
  • 🛡️ 校验链接:防止机器自动扫描
  • 📌 自定义分享链接:支持自定义分享链接路径和类型

使用方法

  1. 访问并创建 Cloudflare 账号,Compute - Workers和Pages - 创建 - 创建应用程序,从 Hello World! 开始,名称保持默认或者随意设置,点击部署,然后编辑代码,把原来的代码删除,然后把仓库里 Cloudflare Worker Secret doc.js 的内容复制并粘贴到代码处,点击部署;
  2. 如果想自定义分享路径、分享ID类型等,见代码头部的注释;
  3. 返回Cloudflare首页,存储和数据库 - Workers KV,新建一个KV,名称随意,进入刚才创建的workers,点击设置 - 绑定 - 添加 - KV命名空间,变量名称填 Worker_Secret_doc 找到刚新建的KV,KV命名空间选择刚才创建的KV,点击保存即可使用Cloudflare提供的默认域名访问;
  4. 自定义域名:添加域名到Cloudflare后,Workers和Pages - 找到秘密文档的 workers - 设置 - 域和路由 - 添加 - 自定义域,添加自己域名即可;例如:你的域名是 doc.com 那么可以添加 mimi.doc.com ;
  5. 阻止恶意访问需要在Cloudflare防火墙设置规则;
  6. 如果想删数据,进入KV按文档ID删除,或者删除整个KV。

部分代码

const getHomePageContent = () => `
    <div class="header-section" style="text-align: center; margin-bottom: 8px; flex-shrink: 0;">
      <p style="margin: 0; font-size: 16px; color: var(--text-color); opacity: 0.8;">让你的秘密在☁️飞一会 ✈️</p>
    </div>

    <div class="form-section" style="flex: 1; display: flex; flex-direction: column; min-height: 0;">
      <div class="form-group" style="margin-bottom: 8px; flex: 1; display: flex; flex-direction: column; min-height: 0;">
        <div class="editor-wrapper" style="position: relative; flex: 1; min-height: 300px;">
          <textarea id="markdownText" class="editor-box" placeholder="请输入你的秘密📄,支持 MarkDown 格式。" maxlength="100000" oninput="updateCharCount()"></textarea>
          <div style="position: absolute; bottom: 5px; right: 5px; font-size: 12px; color: var(--text-color); opacity: 0.7; z-index: 5;">
            <span id="charCount">0</span>/100000
          </div>
          <button type="button" id="previewToggle" onclick="togglePreview()" style="background-color: #1E90FF; position: absolute; top: 5px; right: 5px; padding: 4px 8px; font-size: 12px; width: auto; z-index: 10; margin: 0;">预览</button>
          <div id="previewContainer" class="editor-box" style="display: none; background-color: var(--bg-color); border: 1px solid var(--border-color); padding: 10px;">
            <article class="markdown-body" id="previewContent" style="height: 100%; overflow-y: auto;"></article>
          </div>
        </div>
      </div>

      <div class="options-grid" style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 0; flex-shrink: 0;">
        <div class="form-group" style="display: flex; align-items: center; gap: 6px; height: 38px; margin-bottom: 0;">
          <label for="views" style="margin: 0; flex-shrink: 0; font-size: 14px; color: var(--text-color); line-height: 38px;">⌛ 查看次数:</label>
          <div style="flex: 1; position: relative; display: flex; align-items: center;">
            <input type="number" id="views" value="1" min="1" max="10000" step="1" oninput="this.value = this.value.replace(/[^0-9]/g, '')" style="width: 100%; height: 32px; margin: 0;">
          </div>
        </div>

        <div class="form-group" style="display: flex; align-items: center; gap: 6px; height: 38px; margin-bottom: 0;">
          <label for="expiration" style="margin: 0; flex-shrink: 0; font-size: 14px; color: var(--text-color); line-height: 38px;">⏲️ 有效期:</label>
          <div style="flex: 1; position: relative; display: flex; align-items: center;">
            <input type="number" id="expiration" value="1440" min="1" step="1" oninput="this.value = this.value.replace(/[^0-9]/g, '')" style="width: 100%; height: 32px; margin: 0;">
          </div>
          <small style="flex-shrink: 0; font-size: 12px; color: var(--text-color); opacity: 0.7; line-height: 38px; margin: 0;">分钟</small>
        </div>
      </div>

      <div class="password-section" style="margin-top: 8px; margin-bottom: 0; height: 38px; flex-shrink: 0;">
        <div style="display: flex; align-items: center; gap: 6px; height: 100%;">
          <label for="password" style="margin: 0; flex-shrink: 0; font-size: 14px; color: var(--text-color); line-height: 38px;">🔒 密码:</label>
          <div style="flex: 1; position: relative; display: flex; align-items: center;">
            <input type="password" id="password" placeholder="可选,设置密码加密" style="width: 100%; height: 32px; margin: 0;">
            <div style="position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: flex; gap: 5px;">
              <button type="button" onclick="generateRandomPassword('password')" style="background-color: #1E90FF; padding: 2px 6px; font-size: 12px; width: auto; height: auto; margin: 0;">随机密码</button>
              <button type="button" onclick="togglePasswordVisibility('password')" style="background-color: #1E90FF; padding: 2px 6px; font-size: 12px; width: auto; height: auto; margin: 0;">显示</button>
            </div>
          </div>
        </div>
      </div>

      <div style="margin-top: 8px; height: 38px; flex-shrink: 0;">
        <button onclick="createDocument()" style="background-color: #1E90FF; width: 100%; height: 100%; font-size: 16px; font-weight: bold; margin: 0;">生成端到端加密链接 🔗</button>
      </div>

      <style>
        .editor-box {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          margin: 0;
          border-radius: 4px;
          box-sizing: border-box;
          overflow-y: auto;
        }
        #markdownText {
          background-color: var(--bg-color);
          color: var(--text-color);
          border: 1px solid var(--border-color);
          padding: 10px;
          resize: none;
        }
        @media (max-width: 768px) {
          .options-grid { grid-template-columns: 1fr; }
          .form-section > .form-group:first-child { flex: none; height: 40vh; min-height: 200px; max-height: 400px; }
          .editor-wrapper { min-height: auto; }
        }
      </style>

    </div>

    <div class="link-section" style="margin-top: 8px; flex-shrink: 0;">
      <div id="linkContainer" style="background-color: var(--code-bg-color); border: 1px solid var(--border-color); border-radius: 4px; padding: 8px; display: none; align-items: flex-start; gap: 6px; flex-wrap: wrap; min-height: 38px; box-sizing: border-box;">
        <h3 style="margin: 0; font-size: 14px; color: var(--text-color); flex-shrink: 0; line-height: 22px;">分享链接:</h3>
        <p id="link" onclick="copyLink()" style="margin: 0; word-wrap: break-word; color: var(--link-color); cursor: pointer; flex: 1; min-width: 0; line-height: 22px; font-size: 14px;"></p>
      </div>
    </div>

    <div class="notification" id="notification">✅ 链接已复制到剪贴板</div>

    <div style="margin-top: auto; text-align: center; font-size: 14px; color: var(--text-color); opacity: 0.8; padding-top: 10px; border-top: 1px solid var(--border-color);">
      <p style="margin: 0;">秘密文档 - 极简、<a href="https://github.com/fzxx/Cloudflare-Worker-Secret-doc" target="_blank" rel="noopener noreferrer" style="color: var(--link-color); text-decoration: none;">开源</a>端到端加密的阅后即焚文档。 | © 风之暇想 | v1.5</p>
    </div>
  `;

疑问

带预览链接功能的即时通讯软件、邮件,会导致链接被机器访问而失效,如何解决?
  • 限制次数设置为2次或更多
  • 用Cloudflare防火墙把它们拦截下来(根据UA、地区等)
限制文本大小是?
  • 由于免费的KV空间只有1G,因此限制每个文档的大小是100KB
KV空间满了,如何清理?
  • 进入KV命名空间删除整个KV,重新创建并再次绑定;不设置自动清理是因为Api计次的,自动清理会耗尽次数。

更新日志、下载地址

Cloudflare-Worker-Secret-doc

免费评分

参与人数 7吾爱币 +6 热心值 +6 收起 理由
yjn866y + 1 + 1 热心回复!
fnthinklevi + 1 我很赞同!
realz + 1 + 1 热心回复!
Lcp1027 + 1 + 1 我很赞同!
pptx + 1 谢谢@Thanks!
cjcmxc + 1 + 1 我很赞同!
RRZFS + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
289 发表于 2026-3-16 13:43
PHP就可以写一个单页的 没有这么复杂的

点评

php需要服务器,我用cloudflare  详情 回复 发表于 2026-3-16 13:47
推荐
pxhzai 发表于 2026-3-16 13:30
本帖最后由 pxhzai 于 2026-3-16 13:31 编辑

我记得论坛有人发布过这个
还是你自己发布的
https://www.52pojie.cn/thread-1995340-1-1.html

点评

版本更新了  详情 回复 发表于 2026-3-16 13:46
沙发
0xForg3x 发表于 2026-3-16 13:29
4#
Lcp1027 发表于 2026-3-16 13:36
特别适合企业内部机密传递
5#
13319937326 发表于 2026-3-16 13:42
特别适合企业内部机(坑)密(爹)(内容)传递(举例安排你加班,阅后即焚。通知你事情有出入,阅后即焚,事后调查无内容)
7#
 楼主| 风之暇想 发表于 2026-3-16 13:46 |楼主
pxhzai 发表于 2026-3-16 13:30
我记得论坛有人发布过这个
还是你自己发布的
https://www.52pojie.cn/thread-1995340-1-1.html

版本更新了
8#
 楼主| 风之暇想 发表于 2026-3-16 13:47 |楼主
289 发表于 2026-3-16 13:43
PHP就可以写一个单页的 没有这么复杂的

php需要服务器,我用cloudflare
9#
realz 发表于 2026-3-16 13:50
这个好,值得学习一下,很多场景都能用的到。
10#
QCFang 发表于 2026-3-16 14:05
可以可以,很有启发性
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-3-17 09:23

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表