forked from xuzhenjun130/hostsSwitchHelper
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmain.aardio
More file actions
71 lines (57 loc) · 1.46 KB
/
Copy pathmain.aardio
File metadata and controls
71 lines (57 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//RUNAS//
import iniHosts;
import fsys.hosts;
import chrome.path;
import chrome.app;
import process;
import winex;
var app = chrome.app();
//external对象定义的函数在Chrome中通过aardio.js可以直接调用
app.external = {
//获取hosts
loadSystemHostText = function(){
return fsys.hosts.loadText();
}
//手动刷新dns缓存
clearDnsCache = function(){
fsys.hosts.flushDns();
var prc = process(chrome.path())
var hwnd = winex.waitEnabled(,,,,prc.id)
win.delay(500)
key.combine("CTRL","SHIFT","DELETE")
win.delay(1000)
key.repeat("ENTER",2)
win.delay(1000)
key.combine("ALT","F4")
return true;
}
//新建配置
createSection = function(name){
return iniHosts().createSection(name);
}
//删除配置
delSection = function(name){
return iniHosts().delSection(name);
}
//获取全部配置
getAllSections = function(){
return iniHosts().getAllSections();
}
//更新
updateSection = function(oldName,newName,status,data){
return iniHosts().updateSection(oldName,newName,status,data);
}
}
app.onError = function($hSocket,err){
errput(err,"chrome/rpc error");
}
var url = "/web-ui/index.aardio"
if(_STUDIO_INVOKED ){
import web.rest.client;
if( web.rest.client().api("http://localhost:8080/web-ui/",,"hosts切换助手").get() ){
//如果在前端项目里执行了 npm run dev 下面的调试URL就是可用状态
url = "http://localhost:8080/web-ui/";
}
}
app.start(url);
win.loopMessage();