Subweb+Subconverter+短链生成 笔记

Subweb

项目地址

使用docker运行前端需要更改文件后自行构建镜像。

# Clone项目到本地
git clone https://github.com/CareyWang/sub-web.git
cd sub-web

# 编辑.env配置文件


# 没有其他需求就只改`API后端`就行。

VUE_APP_PROJECT = "https://github.com/CareyWang/sub-web"

VUE_APP_BOT_LINK = "https://t.me/subconverter_discuss"

VUE_APP_BACKEND_RELEASE = "https://github.com/tindy2013/subconverter/actions"

VUE_APP_SUBCONVERTER_REMOTE_CONFIG = "https://raw.githubusercontent.com/tindy2013/subconverter/master/base/config/example_external_config.ini"

# API 后端,填写自己绑定的域名,或者`ip:port`
VUE_APP_SUBCONVERTER_DEFAULT_BACKEND = "https://sub.songw.top"

# 短链接后端,要带short(可选)
VUE_APP_MYURLS_API = "https://suo.yt/short"

# 文本托管后端
VUE_APP_CONFIG_UPLOAD_API = "https://oss.wcc.best/upload"

# 页面配置
VUE_APP_USE_STORAGE = true
VUE_APP_CACHE_TTL = 86400
编辑subconverter.vue(可选)

cd src/views


backendOptions: [{ value: "http://127.0.0.1:25500/sub?" }],
remoteConfig: [
{
label: "DLC",
options: [
{
label: "ACL4SSR_Online 默认版 分组比较全 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini"
},
{
label: "ACL4SSR_Online_AdblockPlus 更多去广告 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_AdblockPlus.ini"
},
{
label: "ACL4SSR_Online_NoAuto 无自动测速 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoAuto.ini"
},
{
label: "ACL4SSR_Online_NoReject 无广告拦截规则 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoReject.ini"
},
{
label: "ACL4SSR_Online_Mini 精简版 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini.ini"
},
{
label: "ACL4SSR_Online_Mini_AdblockPlus.ini 精简版 更多去广告 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_AdblockPlus.ini"
},
{
label: "ACL4SSR_Online_Mini_NoAuto.ini 精简版 不带自动测速 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_NoAuto.ini"
},
{
label: "ACL4SSR_Online_Mini_Fallback.ini 精简版 带故障转移 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_Fallback.ini"
},
{
label: "ACL4SSR_Online_Mini_MultiMode.ini 精简版 自动测速、故障转移、负载均衡 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_MultiMode.ini"
},
{
label: "ACL4SSR_Online_Full 全分组 重度用户使用 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full.ini"
},
{
label: "ACL4SSR_Online_Full_NoAuto.ini 全分组 无自动测速 重度用户使用 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_NoAuto.ini"
},
{
label: "ACL4SSR_Online_Full_AdblockPlus 全分组 重度用户使用 更多去广告 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_AdblockPlus.ini"
},
{
label: "ACL4SSR_Online_Full_Netflix 全分组 重度用户使用 奈飞全量 (与Github同步)",
value:
"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_Netflix.ini"
},
{
label: "ACL4SSR 本地 默认版 分组比较全",
value: "config/ACL4SSR.ini"
},
{
label: "ACL4SSR_Mini 本地 精简版",
value: "config/ACL4SSR_Mini.ini"
},
{
label: "ACL4SSR_Mini_NoAuto.ini 本地 精简版+无自动测速",
value: "config/ACL4SSR_Mini_NoAuto.ini"
},
{
label: "ACL4SSR_Mini_Fallback.ini 本地 精简版+fallback",
value: "config/ACL4SSR_Mini_Fallback.ini"
},
{
label: "ACL4SSR_BackCN 本地 回国",
value: "config/ACL4SSR_BackCN.ini"
},
{
label: "ACL4SSR_NoApple 本地 无苹果分流",
value: "config/ACL4SSR_NoApple.ini"
},
{
label: "ACL4SSR_NoAuto 本地 无自动测速 ",
value: "config/ACL4SSR_NoAuto.ini"
},
{
label: "ACL4SSR_NoAuto_NoApple 本地 无自动测速&无苹果分流",
value: "config/ACL4SSR_NoAuto_NoApple.ini"
},
{
label: "ACL4SSR_NoMicrosoft 本地 无微软分流",
value: "config/ACL4SSR_NoMicrosoft.ini"
},
{
label: "ACL4SSR_WithGFW 本地 GFW列表",
value: "config/ACL4SSR_WithGFW.ini"
}
]
},

{
label: "universal",
options: [
{
label: "No-Urltest",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/universal/no-urltest.ini"
},
{
label: "Urltest",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/universal/urltest.ini"
}
]
},
{
label: "customized",
options: [
{
label: "Maying",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/maying.ini"
},
{
label: "Ytoo",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/ytoo.ini"
},
{
label: "FlowerCloud",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/flowercloud.ini"
},
{
label: "Nexitally",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/nexitally.ini"
},
{
label: "SoCloud",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/socloud.ini"
},
{
label: "ARK",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/ark.ini"
},
{
label: "ssrCloud",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/customized/ssrcloud.ini"
}
]
},
{
label: "Special",
options: [
{
label: "NeteaseUnblock(仅规则,No-Urltest)",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/special/netease.ini"
},
{
label: "Basic(仅GEOIP CN + Final)",
value:
"https://cdn.jsdelivr.net/gh/SleepyHeeead/subconverter-config@master/remote-config/special/basic.ini"
}
]
}
]

注意最后的”.“ 不要漏掉。

冒号前的sub-web是目前存放前端的文件夹名

构建命令需要在前端文件夹内执行,否则会提醒找不到Dockerfile

#构建镜像 
docker build -t sub-web:latest . 
#查看镜像是否构建成功,有同名镜像即为成功 docker images 
#部署服务 
docker run -d \ 
-p 34325:80 \ 
--restart always \ 
--name subweb \ 
sub-web:latest

Subconverter

项目地址  Docker

后端直接拉取docker


docker run -d \
 --restart=always \
 --name subconverter \
 -p 34324:25500 \
 tindy2013/subconverter:latest

拉取失败:

docker pull hub.songwqs.top/tindy2013/subconverter:latest

重命名:

docker tag hub.songwqs.top/tindy2013/subconverter:latest tindy2013/subconverter:latest

其他项目(二选一):支持添加Hysteria、Hysteria2和vless(reality)>  Docker地址

直接拉取docker


docker run -d \
 --restart=always \
 --name subconverter \
 -p 34325:25500 \
 asdlokj1qpi23/subconverter:latest

拉取失败:

docker pull hub.songwqs.top/asdlokj1qpi23/subconverter:latest

重命名:

docker tag hub.songwqs.top/asdlokj1qpi23/subconverter:latest asdlokj1qpi23/subconverter:latest

MyUrls

项目地址  docerk
1、部署

使用 docker 或 docker-compose⁠ 部署本项目

docker:

docker run -d --restart always --name myurls careywong/myurls:latest -domain example.com -port 8002 -conn 127.0.0.1:6379 -password ''

上面这条是原命令 可能打不开原因是 docker网络层问题 ,它在host层。
例子:
有的默认是有的是bridge,需要追加一个--network host

docker run -d --restart always --name myurls --network host careywong/myurls:latest -domain u.songw.top -port 8002 -conn 127.0.0.1:6379 -password ''

如果不希望在host层(确保宿主机有redis,建议在docker再装个redis再根据容器ip修改 ):

docker run -d --restart always --name -p 8002:8002 myurls careywong/myurls:latest -domain u.songw.top -port 8002 -conn 172.17.0.1:6379 -password ''

docker-compose⁠ :


#clone项目到本地
git clone https://github.com/CareyWang/MyUrls.git MyUrls
cd MyUrls
vi public/index.html
const backend = 'https://songw.top' #修改短链接域名

cd MyUrls
cp .env.example .env #编辑好域名、端口等配置

docker-compose up -d #直接启动

2、跨域问题 nginx配置 (如果是宝塔做了反代 就在反向代理 的配置文件里添加)


server {
server_name example.com;

location / {
##跨域
add_header Access-Control-Allow-Origin '*';
add_header Access-Control-Allow-Methods 'POST,PUT,GET,DELETE';
add_header Access-Control-Allow-Headers 'version, access-token, user-token, Accept, apiAuth, User-Agent, Keep-Alive, Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With';

}
}

3、因get的url长度非常长,需要调整get请求长度限制


#nginx设置:
client_max_body_size 24M;
client_body_buffer_size 128k;
client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;

ShortLinkUrl(可选短链plus版且兼容机场订阅转换)

感觉MyUrls的功能太单一了?想要一个更加高大上的短链转换?
那就选它吧:ShortLinkUrl
有快速网页部署 和 Doker部署
宝塔之类的直接 git到本地部署

git clone https://github.com/songwqs/ShortLinkUrl.git

网页部署需要加下伪静态

完整nginx 伪静态:
 location / {
    try_files $uri $uri/ /index.php?$query_string;
}
 location /shorturl {
    try_files $uri $uri/ /shorturl/index.php?$query_string;
 }

Doker部署:

docker run -d -p 8080:80 songwqs1/short-link-url:latest

API

生成短链接方式1:

提交:curl -s http://u.songw.top/api/link?url=https://github.com/songwqs/ShortLinkUrl
返回:{"msg":"ok","code":200,"data":"http://u.songw.top/s/aFdlm"}

生成短链接方式2(兼容机场订阅):

提交: /short  (https://u.songw.top/short)
       post:longUrl(Base64 编码)
longUrl: aHR0cHM6Ly93d3cubmFpdW4yMzU4NzI5OC5jZmQvIy9yZWdpc3Rlcj9jb2RlPU1qWmhrV3pp
返回:{"Code": 1, "ShortUrl": "https://u.songw.top/s/xxxxx"}

同样因get的url长度非常长,需要调整get请求长度限制

#nginx设置:
client_max_body_size 24M;
client_body_buffer_size 128k;
client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注