Skip to content

Commit

Permalink
add the domainconfig feature
Browse files Browse the repository at this point in the history
  • Loading branch information
louiesun committed May 12, 2024
1 parent a1e4020 commit a3a0aef
Show file tree
Hide file tree
Showing 6 changed files with 571 additions and 2,146 deletions.
2 changes: 1 addition & 1 deletion default.aproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<project ver="10" name="Unofficial_Z_Access" libEmbed="true" icon="lib\icon.ico" ui="win" output="Unofficial_Z_Access.exe" CompanyName="MLM" FileDescription="Unofficial_Z_Access" LegalCopyright="Copyleft (C) People 2024" ProductName="Unofficial_Z_Access" InternalName="Unofficial_Z_Access" FileVersion="1.0.0.2" ProductVersion="1.0.0.2" publishDir="/dist/" dstrip="false" local="false" ignored="false">
<project ver="10" name="Unofficial_Z_Access" libEmbed="true" icon="lib\icon.ico" ui="win" output="Unofficial_Z_Access.exe" CompanyName="MLM" FileDescription="Unofficial_Z_Access" LegalCopyright="Copyleft (C) People 2024" ProductName="Unofficial_Z_Access" InternalName="Unofficial_Z_Access" FileVersion="2.0.0.8" ProductVersion="2.0.0.8" publishDir="/dist/" dstrip="false" local="false" ignored="false">
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
<folder name="资源文件" path="res" embed="true" local="false" ignored="false"/>
<folder name="web" path="web" comment="web" local="true" embed="true" ignored="false"/>
Expand Down
47 changes: 34 additions & 13 deletions main.aardio
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ var QUICline='zh.z-library.se:443,bu2021.xyz:443';
import wsock.tcp.simpleHttpServer;
var url="/web/index.html";

if(_ARGV["h"])
{
win.msgbox('By Msedge Webview2 with Cmd & aardio. \r\n -h: help \r\n -------- \r\n -c use the config file config.txt under the same folder; The first line --host-resolver-rules while the second -origin-to-force-quic-on \r\n -------- \r\n -g go to the website');
return;
}
if(_ARGV["c"])
{
import fsys.file;
var cfg=fsys.file("./config.txt");
var cfg=fsys.file("./CMDconfig.txt");
if(!fsys.file.is(cfg))
{
win.msgboxErr("No Config File! ","ERROR!");
Expand All @@ -31,18 +26,44 @@ if(_ARGV["c"])
QUICline=cfg.read();
cfg.close();
}
if(_ARGV["d"])
{
hostline="";
QUICline="";
import fsys.file;
var cfg=fsys.file("./DOMAINconfig.txt");
if(!fsys.file.is(cfg))
{
win.msgboxErr("No Config File! ","ERROR!");
return;
}
var CFIP=cfg.read();
var d=CFIP;

while(1)
{
d=cfg.read();
if(!d) break;

hostline=hostline+"MAP "+d+" "+CFIP+":443,";
QUICline=QUICline+d+":443,";
}
hostline=string.slice(hostline,1,-2,true);
QUICline=string.slice(QUICline,1,-2,true);

cfg.close();
}
if(_ARGV["g"]) url=_ARGV["g"];
if(_ARGV["h"])
{
url="/help.html";
}


import web.view;
var view=web.view(mainForm.custom,0,'--host-resolver-rules="'+hostline+'" -origin-to-force-quic-on='+QUICline);
/*
view.onNewWindow = function(Url){
win.msgbox(Url,"!");
view.go(Url);
return true;
}
*/
view.go("/web/index.html");


mainForm.show();
view.go(url);
Expand Down
32 changes: 32 additions & 0 deletions web/help.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1 id="命令行参数帮助">命令行参数帮助</h1>
<p>鉴于本应用名字较长,我强烈建议您把他的名字改短一点,比如 <code>zlib.exe</code></p>
<p>默认接下来您已经进行了重命名。</p>
<h2 id=""><code>-h</code></h2>
<p>打开帮助,也就是显示此文件。</p>
<h2 id="-"><code>-g url</code></h2>
<p>打开后跳转到 url,而不是默认开始页。<br />
注意:<code>url</code> 必须带协议头,如:<code>https://1919810.com</code></p>
<h2 id="--"><code>-c</code></h2>
<p>使用命令行配置文件。</p>
<p>程序会尝试读取同一目录下的 <code>CMDconfig.txt</code></p>
<p>该文件应当有两行。</p>
<ol>
<li><code>--host-resolver-rules</code></li>
<li><code>-origin-to-force-quic-on</code></li>
</ol>
<p>下面是一个可行的配置,用于访问'zh.z-library.se'于 <code>bu2021.xyz</code></p>
<pre><code class="language-text">MAP zh.z-library.se [2606:4700:3033::ac43:aa46]:443,MAP bu2021.xyz [2606:4700:3033::6815:3e2]:443
zh.z-library.se:443,bu2021.xyz:443
</code></pre>
<h2 id="---"><code>-d</code></h2>
<p>根据域名进行配置,只支持挂靠 <code>CloudFlare CDN</code> 的网站且使用 CF 默认配置(<strong>必须支持 QUIC</strong>)。</p>
<p>程序会尝试读取同一目录下的 <code>DOMAINconfig.txt</code></p>
<p>该文件的第一行是您当地可以访问的 CloudFlareIP。</p>
<p>接下来任意多行是需要启用工具的域名,尽量不要太多,多了我不知道会出什么鬼问题。</p>
<p>以下是一个可行的配置:</p>
<pre><code class="language-plaintext">[2606:4700:3033::ac43:aa46]
zh.z-library.se
bu2021.xyz
annas-archive.se
</code></pre>
<h2 id="返回首页">返回<a href="./index.html">首页</a></h2>
53 changes: 53 additions & 0 deletions web/help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 命令行参数帮助

鉴于本应用名字较长,我强烈建议您把他的名字改短一点,比如`zlib.exe`

默认接下来您已经进行了重命名。

## `-h`

打开帮助,也就是显示此文件。

## `-g url`

打开后跳转到url,而不是默认开始页。
注意:`url`必须带协议头,如:`https://1919810.com`

## `-c`

使用命令行配置文件。

程序会尝试读取同一目录下的`CMDconfig.txt`

该文件应当有两行。

1. `--host-resolver-rules`
2. `-origin-to-force-quic-on`

下面是一个可行的配置,用于访问'zh.z-library.se'于`bu2021.xyz`

```text
MAP zh.z-library.se [2606:4700:3033::ac43:aa46]:443,MAP bu2021.xyz [2606:4700:3033::6815:3e2]:443
zh.z-library.se:443,bu2021.xyz:443
```

## `-d`

根据域名进行配置,只支持挂靠`CloudFlare CDN`的网站且使用CF默认配置(**必须支持QUIC**)。

程序会尝试读取同一目录下的`DOMAINconfig.txt`

该文件的第一行是您当地可以访问的CloudFlareIP。

接下来任意多行是需要启用工具的域名,尽量不要太多,多了我不知道会出什么鬼问题。

以下是一个可行的配置:

```plaintext
[2606:4700:3033::ac43:aa46]
zh.z-library.se
bu2021.xyz
annas-archive.se
```

## 返回[首页](./index.html)
Loading

0 comments on commit a3a0aef

Please sign in to comment.