V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
willin
V2EX  ›  分享创造

一个开源的联邦宇宙(Mastodon、Fediverse)别名服务

  •  1
     
  •   willin ·
    willin · 126 天前 · 2138 次点击
    这是一个创建于 126 天前的主题,其中的信息可能已经有所发展或是发生改变。

    介绍

    比如您在 Mastodon 系统上的用户名为: @[email protected] ,现在您可以申请一下域名后缀的别名:

    示例:[email protected] | [email protected] 都指向到了 @[email protected]

    使用自己的域名进行部署

    如果您拥有自己的域名,但是没有部署 Mastodon 或者其他 Fediverse 的应用程序。可以为自己的域名设置别名。需要用到 Cloudflare Worker ,参考项目: https://github.com/willin/fediverse-alias

    第一步:初始化仓库

    Fork 或者 Clone 该项目:

    git clone https://github.com/willin/fediverse-alias.git
    

    第二步配置

    编辑 wrangler.toml:

    name = "fediverse-alias"
    compatibility_date = "2023-01-01"
    
    # 修改为你自己的路由
    routes = [
      { pattern = "yourdomain.com/.well-known/webfinger*", zone_name = "yourdomain.com" }
      # 如果有多个,继续添加
    ]
    
    [[d1_databases]]
    binding = "DB"
    database_name = "dns"
    # 修改为你刚创建的数据库 ID
    database_id = "xxx"
    
    • 初始化数据

    修改 migrations/0011_seeds.sql:

    -- 这里是一个示例:
    INSERT INTO aliases(`alias`,`account`,`owner`) VALUES('[email protected]','[email protected]','');
    -- 多条记录在此处添加
    

    第三步:部署

    执行:

    npm run deploy
    npm run migration
    

    赞助 Sponsor

    维护者 Owner: Willin Wang

    如果您对本项目感兴趣,可以通过以下方式支持我:

    Donation ways:

    许可证 License

    Apache-2.0

    3 条回复    2024-04-05 11:35:32 +08:00
    justin2018
        1
    justin2018  
       125 天前
    @willin

    楼主 问下 拦截广告插件 用的是哪个服务 😁
    willin
        2
    willin  
    OP
       124 天前
    @justin2018 就几行代码
    SharkIng
        3
    SharkIng  
       22 天前
    有演示么?做好之后是什么效果?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2733 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 10:27 · PVG 18:27 · LAX 03:27 · JFK 06:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.