Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0-1 在 openwrt 21.02 下的两个小问题 #446

Open
XGFan opened this issue Jan 27, 2022 · 1 comment
Open

v2.0.0-1 在 openwrt 21.02 下的两个小问题 #446

XGFan opened this issue Jan 27, 2022 · 1 comment

Comments

@XGFan
Copy link

XGFan commented Jan 27, 2022

getSections: function (
type: string,
captionKey: string = "alias"
): Promise<SectionItem[]> {
return uci.load("v2ray").then(function () {
const sections: SectionItem[] = [];
uci.sections("v2ray", type, function (s: uci.SectionObject) {
let caption: string;
if ((caption = s[captionKey])) {
sections.push({
caption: caption,
value: s[".name"],
});
}
});
return sections;
});
},

这一块有个bug,就是当某个配置为未配置的时候,会导致返回空列表,界面会报错:

 null is not an object (evaluating 'Object.keys(this.choices)')

页面观察到更新gfwlist和路由文件的逻辑是:先通过路由后端下载文件,然后再由js将下载内容处理之后通过ubus写到指定文件。

但openwrt常用的uhttpd接受的最大的ubus内容大小,是10kb. 导致了无法正常更新这两个文件。

来源: https://git.openwrt.org/?p=project/uhttpd.git;a=blob;f=ubus.c;h=619135ce3912f3b728c698f4fe4d6018cade6422;hb=refs/heads/master#l37

@WordsWorthLess
Copy link

WordsWorthLess commented Feb 16, 2022

第一个问题,我的处理方法是修改v2ray.js文件,添加一个配置为空的时候,返回一个固定值, 用下来还没遇到bug
\www\luci-static\resources\v2ray.js

getSections:function(r,t){return void 0===t&&(t="alias"),uci.load("v2ray").then((function(){var n=[];return uci.sections("v2ray",r,(function(r){var e;(e=r[t])&&n.push({caption:e,value:r[".name"]})})),n}))}
修改为
getSections:function(r,t){return void 0===t&&(t="alias"),uci.load("v2ray").then((function(){var n=[];return uci.sections("v2ray",r,(function(r){var e;(e=r[t])?n.push({caption:e,value:r[".name"]}):n.push({caption:e,value:"cfgtmp"})})),n}))}

\www\luci-static\resoruces\view\v2ray\outbound.js

{var n=uci.add("v2ray","outbound");if(n){var d=l.add||"0.0.0.0",p=l.port||"0",m=l.tls||"",i=l.net||"",c=l.type||"",u=l.path||"",f=l.ps||"%s:%s".format(d,p);uci.set("v2ray",n,"alias",f),uci.set("v2ray",n,"protocol","vmess"),

再加一条添加outbound tag的语句
{var n=uci.add("v2ray","outbound");if(n){var d=l.add||"0.0.0.0",p=l.port||"0",m=l.tls||"",i=l.net||"",c=l.type||"",u=l.path||"",f=l.ps||"%s:%s".format(d,p),tg=n;uci.set("v2ray",n,"tag",tg),uci.set("v2ray",n,"alias",f),uci.set("v2ray",n,"protocol","vmess"),

第二个问题貌似不是bug,而是是gfwlist解码转换程序转换出来的gfwlist.txt内容不一致
具体问题体现为
用windows 命令行下载回来并解码的gfwlist.txt文件是146572字节

D:\>curl -fsSL https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt --output d:\gfw64.txt && certutil -decode d:\gfw64.txt d:\gfwlist.txt && dir d:\gfwlist.txt
输入长度 = 198486
输出长度 = 146572
CertUtil: -decode 命令成功完成。
 驱动器 D 中的卷是 Workspace
 卷的序列号是 DA4F-E139

 d:\ 的目录

2022/02/16  13:45           146,572 gfwlist.txt
               1 个文件        146,572 字节
               0 个目录 42,719,141,888 可用字节

直接用下载按钮下载回来的gfwlist.txt文件大小是80767, 超过ubus的上限10kb

root@OpenWrt:/etc/v2ray# ls ./gfwlist.txt -l
-rw-r--r--    1 root     root         80767 Feb 16 13:32 ./gfwlist.txt

通过对比发现
2022-02-16 12:56更新的gfwlist,直接在transparent-proxy页面下载的,只有5868条记录
但是用windows命令行下载回来转码的有8276条记录,而且格式也不一样
通过插件下载的gfwlist文件只保留了顶级域名.
test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants