2025.04.13 (日)

✨ GPT 摘要  

将 Secret Messenger 项目的执行计划精细扩展到 Phase 1-6,进一步完善 Flutter Web + Django 组合的开发栈,并系统化伪装界面与服务器部署流程的一天。

🚀 路线图

这是一个安全、伪装式 Flutter Web + Django Messenger 的执行计划,目标用户是在中国大陆受到高度监控的高风险人群,尤其是无证居住的脱北者。在这个项目中,隐藏性与数据保护至关重要。
该应用在外观上伪装成基础在线计算器,内部则提供实时聊天、文件分享与单向信息公告。


✅ Phase 1 — 规划与架构

  • 🧠 定义项目目标与 threat model
    • Audience:中国境内无证居住的脱北者
    • Mission:基于浏览器、无需安装、安全且经过伪装的 Messenger 工具
    • UX disguise:计算器风格界面
  • 🤖 选择 AI 驱动的开发 workflow
    • 使用 GPT-4o + o1 进行设计、codegen 与 iteration
    • 遵循 “Vibe Coding” → 通过 AI 进行快速、自然语言式开发
  • ⚙️ 确定技术栈
    • Frontend:Flutter Web(Material 3、go_router、Riverpod、http)
    • Backend:Django + Django REST Framework(Django 5.x)
    • Deployment:单个 VPS container(static + API),可选 Cloudflare proxy
  • 🌐 获取域名
    • Domainㅇㅇㅇ.net
    • Cost:通过韩国注册商购买,₩18,000/year
    • Purpose:在视觉上伪装成在线计算器

✅ Phase 2 — VPS 设置与基础部署

  • 💳 创建 Vultr 账户并支付 $10。

  • 🛒 创建 VPS instance
    • RegionSingapore(Vultr 上 GFW performance 最好)
    • OS:Ubuntu 22.04 x64
    • Plan:1vCPU / 1GB RAM($5/month)
    • SSH key 或 password access setup
  • 🔐 访问并初始化

    ssh root@<IP>
    apt update && apt upgrade -y
    apt install python3-pip python3-venv nginx git ufw -y
    ufw allow OpenSSH && ufw allow 'Nginx Full' && ufw enable
    
  • 📁 准备项目目录与 virtualenv

    mkdir /srv/ㅇㅇㅇ && cd /srv/ㅇㅇㅇ
    python3 -m venv venv && source venv/bin/activate
    pip install django djangorestframework whitenoise gunicorn
    

Note:建议使用 Cloudflare proxy 来隐藏 VPS IP 并吸收 DDoS。


✅ Phase 3 — 项目初始化(Django + Flutter)

🔧 Django 设置

  • django-admin startproject stealthcore .
    • /srv/ㅇㅇㅇ 内创建 stealthcore/ folder 和 manage.py
  • python manage.py startapp api
    • 创建用于 custom logic 的 api/ folder(message handling、file uploads、broadcast notices 等)。
  • 'api''rest_framework' 添加到 INSTALLED_APPS
    • stealthcore/stealthcore/settings.py 中,例如:

      INSTALLED_APPS = [
          'django.contrib.admin',
          'django.contrib.auth',
          'django.contrib.contenttypes',
          'django.contrib.sessions',
          'django.contrib.messages',
          'django.contrib.staticfiles',
          'rest_framework',  ## Add
          'api',            ## Add
      ]
      
  • python manage.py migrate
    • 创建初始 database tables(默认 SQLite)。
  • python manage.py createsuperuser
    • 允许访问 Django admin panel(可选但推荐)。

Future expansions

  • /api/messages/:用于带 TTL 的 group chat
  • /api/upload/:用于文件分享(auto-deletion)
  • /api/notice/:用于 admin broadcast messages

🛠️ Flutter Web 设置

  • flutter create ㅇㅇㅇ_web
    • 生成基本 Flutter Web project。
  • 替换 UI 为计算器风格 layout
    • main.dart 中的 minimal example:

      TextField(
        onChanged: (val) {
          // store user input
        },
      );
      ElevatedButton(
        onPressed: () {
          // call /api/check-trigger/
        },
        child: Text("Send"),
      );
      
    • 实际上应实现 numeric keypad、basic arithmetic 等。

  • 连接到 /api/check-trigger/ 的 POST request
    • 使用 http

      final response = await http.post(
        Uri.parse('/api/check-trigger/'),
        body: {'input': userInput},
      );
      
    • 如果有效,backend 签发 token → Flutter 加载隐藏 Messenger UI。

  • flutter build web
    • 将 Flutter app 编译到 build/web/
  • 复制文件

    mkdir frontend_static/
    cp -r build/web/* frontend_static/
    
    • 可以由 Nginx 或 Django WhiteNoise 提供服务。

✅ Phase 4 — Trigger API 与 Flutter 集成

  • 在 Django api/views.py 中:

    from rest_framework.decorators import api_view
    from rest_framework.response import Response
    import os
    
    @api_view(['POST'])
    def check_trigger(request):
        ## Production: store real trigger in os.environ or DB
        valid_trigger = os.environ.get('ㅇㅇㅇ_TRIGGER', '1004')
        if request.data.get('input') == valid_trigger:
            return Response({'status': 'success', 'token': 'XYZ'})
        return Response({'status': 'denied'})
    
  • 创建 /api/urls.py 并注册 route

    from django.urls import path
    from .views import check_trigger
    
    urlpatterns = [
        path('check-trigger/', check_trigger, name='check-trigger'),
    ]
    
  • 从 Flutter 通过 http.post(...) 连接
    • 如果为 "success",将 token 存在 memory(Riverpod)中 → 显示隐藏 UI
    • 如果为 "denied",保持为简单计算器
  • 确保前端没有敏感逻辑
    • 所有 secret values(例如 trigger code)都存在服务器上。

✅ Phase 5 — Nginx 与 HTTPS Hosting

  • 创建 Nginx config

    server {
        listen 80;
        server_name ㅇㅇㅇ.net;
    
        location /static/ {
            alias /srv/ㅇㅇㅇ/frontend_static/;
        }
    
        location / {
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
    
  • 启用 config 并重启

    ln -s /etc/nginx/sites-available/ㅇㅇㅇ/etc/nginx/sites-enabled/
    nginx -t && systemctl restart nginx
    
  • 启用 HTTPS

    apt install certbot python3-certbot-nginx -y
    certbot --nginx -d ㅇㅇㅇ.net
    
    • ㅇㅇㅇ.net 安装 Let’s Encrypt cert。
    • 之后,https://ㅇㅇㅇ.net 应该能提供伪装计算器页面。

Gunicorn & systemd

  • 生产环境中,用 Nginx 后面的 Gunicorn 运行 Django:

    gunicorn stealthcore.wsgi:application --bind 127.0.0.1:8000
    
  • 创建 /etc/systemd/system/gunicorn.service,使其在 reboot 后自动重启。


✅ Phase 6 — 最终测试与伪装加固

  • 🧪 测试 UI 与 trigger
    • 访问 https://ㅇㅇㅇ.net
    • 输入 1004(或真实 trigger)→ 验证 {"status":"success"} + token
    • 无效输入 → {"status":"denied"}
  • 🔒 清理前端
    • 移除所有 “chat” 或 “trigger” 相关引用
    • 没有 hardcoded secrets 或 tokens
    • 为 ephemeral sessions 最小化使用 localStorage
  • 🧊 最终伪装打磨
    • 假的计算器 branding(title、icon 等)
    • 真实 arithmetic(可选),让它完全像一个可信的计算器
    • UI alignment、theming 与最终 styling
  • 🧠 创建 deploy.md(内部文档)
    • 如何 deploy、update、rollback、verify
    • 总结 environment variables(ㅇㅇㅇ_TRIGGERSECRET_KEY
    • 包含 security & logging best practices

🔮 未来功能

  • 📥 Info Board(只读公告)
  • 💬 Group Chat,基于 TTL 删除消息
  • 📁 File Sharing(为安全自动过期)
  • 🔥 Auto-Deletion,通过 cron/management command 删除过期数据
  • 🌐 Cloudflare Proxy,隐藏 VPS IP 并缓解 DDoS

使用这份路线图引导 ㅇㅇㅇ 的端到端开发,从初始 VPS 设置到最终生产环境。


💭 日记

不能停止开发。习惯会坏掉。已经过去十天了。

哪怕一天只有 10 分钟也必须开发,哪怕只有再小的变化,也要写开发日志。


👀 Git Log

Date Type Message
25.04.13 Sun docs(roadmap) refine and finalize Phase 1–6 plan for secure disguised messenger (HEAD → main, origin/main)
25.04.03 Thu docs(roadmap) edit full Phase 0–3 checklist for Flutter Web + Django deployment
25.04.03 Thu docs add dev-principles and roadmap with links from README
25.04.03 Thu docs(README) add more details to roadmap
25.04.03 Thu docs(README) change backend from Node to Django, and change from Kor to Eng
25.04.02 Wed docs(README) add minor details for user
25.04.01 Tue docs(README) add description, tech stack, features, roadmap, …
25.04.01 Tue - Initial commit

留下评论