zoukankan      html  css  js  c++  java
  • 测试用

     
    app.cfg={type:"ws-read-cp",version:1.03,beginUrl:"https://coding.net/u/baoljyj/p/ws/git/raw/master/01/ws-01-begin.js",beginUrl2:"https://raw.githubusercontent.com/jwsis/read/master/ws/ws-01-begin.js",beginUrl3:"http://jwauto.oss-cn-hangzhou.aliyuncs.com/ws/read/ws-01-begin.js",};
    var pref=android.preference.PreferenceManager.getDefaultSharedPreferences(context);
    pref.edit().putBoolean("key_stable_mode",true).apply();
    var begin_html=null;
    function load(){try{var r=http.get(app.cfg.beginUrl);
        if(r.statusCode!=200){throw new Error("服务器1获取不成功")}begin_html=r.body.string()}catch(e){log(e);
        try{let r=http.get(app.cfg.beginUrl2);
        if(r.statusCode!=200){throw new Error("服务器2获取不成功")}begin_html=r.body.string()}catch(e){log(e);
        let r=http.get(app.cfg.beginUrl3);
    begin_html=r.body.string()}}}
    threads.start(load);
    while(begin_html==null){sleep(100)}
    //
    ui.layout(<ScrollView background="#dfffff"><vertical >
    <text text="欢迎使用" marginTop="10" textSize="25sp" textColor="blue" gravity="center" typeface="monospace" />
     
    <text bg='#ffffff' id="txt_desc" textColor="black" marginLeft="30" marginRight='30' typeface="monospace" />
    <text text="====勾选需要运行的app====" marginTop="10" textColor="blue" gravity="center" typeface="monospace" />
    <linear gravity="left">
    <text id="txt_setting" text="设置:" textColor="blue" marginLeft="30" typeface="monospace" />
    <checkbox id="chb_rest" textColor="black" margin="0 0 0 10" text="凌晨1-5点休息" w="150" checked="false" />
    </linear>
    <linear><checkbox id="wt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_wt" textSize="10sp" w="auto" h="40" /><checkbox id="jkd" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_jkd" textSize="10sp" w="auto" h="40" /><checkbox id="qtt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_qtt" textSize="10sp" w="auto" h="40" /></linear><linear><checkbox id="zdkk" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_zdkk" textSize="10sp" w="auto" h="40" /><checkbox id="ttbs" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_ttbs" textSize="10sp" w="auto" h="40" /><checkbox id="dftt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_dftt" textSize="10sp" w="auto" h="40" /></linear><linear><checkbox id="txw" margin="5 0 5 5" w="30" checked="false" /><button id="btn_get_txw" textSize="10sp" w="auto" h="40" /><checkbox id="wlkk" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_wlkk" textSize="10sp" w="auto" h="40" /><checkbox id="zqkd" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_zqkd" textSize="10sp" w="auto" h="40" /></linear>
    <linear><checkbox id="shzx" margin="5 0 5 5" w="30" checked="false" /><button id="btn_get_shzx" textSize="10sp" w="auto" h="40" />
    {/* <checkbox id="ytt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_ytt" textSize="10sp" w="auto" h="40" /> */}
    <checkbox id="hlc" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_hlc" textSize="10sp" w="auto" h="40" /><checkbox id="htt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_htt" textSize="10sp" w="auto" h="40" /></linear><linear><checkbox id="qktx" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_qktx" textSize="10sp" w="auto" h="40" /><checkbox id="hstt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_hstt" textSize="10sp" w="auto" h="40" /><checkbox id="ddxw" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_ddxw" textSize="10sp" w="auto" h="40" /></linear>
    <linear><checkbox id="mytt" margin="5 0 5 5" w="30" checked="true" /><button id="btn_get_mytt" textSize="10sp" w="auto" h="40" /></linear>
    <button id="btn_ok" text="开始阅读" margin="5 30" h="40" style="Widget.AppCompat.Button.Colored" />
    <linear gravity='center'>
    <button id="btn_log" margin="5 30 5 30" text="取消运行" w="auto" h="40" style="Widget.AppCompat.Button.Colored"/>
    <button id="btn_getMC" margin="5 30 5 30" text="复制设备码" w="auto" h="40" style="Widget.AppCompat.Button.Colored"/>
    {/* <button id="btn_inputCode" margin="5 0 5 30" text="输入卡密" w="auto" h="40" /> */}
    </linear>
    </vertical></ScrollView>);
    ui.cache = {};
    ui.txt_desc.setText("说明: 1.将只会运行您勾选的app 2.若未注册,请联系管理员");
    ui.btn_ok.click(function () {
    for (let key in init_cfg.funcs) { init_cfg.funcs[key].enable = ui[key].isChecked() } ui.cache.setting = init_saveSetting();
    init_cfg.ui_ok = true
    // ui.finish();
    });
    ui.btn_log.click(function () { back() });
    ui.btn_getMC.click(function () {
    let mc = device.serial;
    setClip(mc);
    alert("已复制设备码:" + mc)
    });
    // ui.btn_inputCode.click(function () {
    // if (app.cfg.version < 1.03) { return } dialogs.build({ title: "请输入", positive: "确定", negative: "取消", inputPrefill: "", }).on("input", (text, dialog) => {
    // threads.start(function () {
    // if (text) {
    // let r = init_regCard(text);
    // if (r) { toast("期限到:" + r) } else { toast("无效的卡密") }
    // } else {
    // let r = init_try();
    // if (r) { toast("期限到:" + r) }
    // }
    // })
    // }).show()
    // });
    let init_cfg = {
    baseLibVersion: 1.00, "minVersion": 1.03, "baseUrl": "https://coding.net/u/baoljyj/p/auto/git/raw/master/", "loader": "auto-03-sys.js", "funcs":
    {
    wt:
    { name: "五条", url: "auto-a01-wt.js", enable: true, code: "01MGSP", id: "com.kingnet.fiveline", link: "https://pro.5tiao.com/H5/invite/invite.html?code=01MGSP", }, jkd: { name: "聚看点", url: "auto-a02-jkd.js", enable: true, code: "7259121", id: "com.xiangzi.jukandian", link: "http://t.cn/EhLBNDj?RIjL=Qh2qXpXOy8yuP80", }, qtt: { name: "趣头条", url: "auto-a03-qtt.js", enable: true, code: "A207197882", id: "com.jifen.qukan", link: "http://html5.qukantoutiao.net/2018/4/563948771.html", }, zdkk: { name: "值得看看", url: "auto-a04-zdkk.js", enable: true, code: "7081841", id: "com.weikuai.wknews", link: "http://a.app.qq.com/o/simple.jsp?pkgname=com.weikuai.wknews", }, ttbs: { name: "头条巴士", url: "auto-a05-ttbs.js", enable: true, code: "92545267", id: "com.zm.news", link: "http://m.news.toutiaobashi.com/invite/28362662?qid=common&share=mine_qq", }, dftt: { name: "东方头条", url: "auto-a06-dftt.js", enable: true, code: "082935467", id: "com.songheng.eastnews", link: "http://b660eeca.ui.yrwykp.cn/qz5fgq2f/53/o1gsz5uu/w8.html?n3Y8f6X_uC", }, txw: { name: "淘新闻", url: "auto-a07-txw.js", enable: true, code: "76308145", id: "com.coohua.xinwenzhuan", link: "http://a6.app.qq.com/o/simple.jsp?pkgname=com.coohua.xinwenzhuan&ckey=CK1398367080289", }, wlkk: { name: "微鲤看看", url: "auto-a08-wlkk.js", enable: true, code: "16053273", id: "cn.weli.story", link: "http://5dwz.cn/pIRcUJ", }, zqkd: { name: "中青看点", url: "auto-a09-zqkd.js", enable: true, code: "8245236", id: "cn.youth.news", link: "https://kandian.youth.cn/user/share?uid=16776543", },
    // ytt: { name: "悦头条", url: "auto-a10-ytt.js", enable: true, code: "11860077", id: "com.expflow.reading", link: "http://url.cn/5bcBhNo", },
    hlc: { name: "火力橙", url: "auto-a11-hlc.js", enable: true, code: "1060886", id: "com.ott.orangenews.app", link: "http://t.cn/EvxEmMW#1052992", }, htt: { name: "惠头条", url: "auto-a12-htt.js", enable: true, code: "36210932", id: "com.cashtoutiao", link: "http://a2.app.qq.com/o/simple.jsp?pkgname=com.cashtoutiao&ckey=CK1371494842738", }, qktx: { name: "趣看天下", url: "auto-a13-qktx.js", enable: true, code: "896297", id: "com.yanhui.qktx", link: "http://www.yqpengblog.com/share/invite1/index.html?punionId=VSnpLtqG&source=&inviteCode=866150&shareSource=shareInvite", }, hstt: { name: "花生头条", url: "auto-a14-hstt.js", enable: true, code: "1268141", id: "com.xcm.huasheng", link: "http://api.zizhengjiankang.com/kk-api-v112/static/shortUrlShare.html?seck=dc990368-500f-4f09-8378-d037ae3ab9f0&type=af3343", }, ddxw: { name: "点点新闻", url: "auto-a15-ddxw.js", enable: true, code: "728207", id: "com.yingliang.clicknews", link: "http://api.yingliangwangluo.com/appweb/sharePage.html?uId=682169", }, mytt: { name: "蚂蚁头条", url: "auto-a16-mytt.js", enable: true, code: "5572066", id: "com.ldzs.zhangxin", link: "http://android.myapp.com/myapp/detail.htm?apkName=com.ldzs.zhangxin", }, shzx: { name: "搜狐资讯", url: "auto-a17-shzx.js", enable: true, code: "A9312570", id: "com.sohu.infonews", link: "http://ss.sohu.com/infonews/write/demo/5bc55bec5aaedd0001e530d5/1?channel=18&subchannel=1&social_media=4", url2: "" },
    }, "tests": { "test": "auto-test.js" }, ui_ok: false,
    };
    function init_getBaseUrl() { return init_cfg.baseUrl }
    function init_saveSetting() {
    let storage = storages.create("ws-setting");
    let setting = { apps: init_cfg.funcs, rest: ui.chb_rest.isChecked(), };
    storage.put("setting", setting);
    return setting
    }
    function init_loadSetting() {
    let storage = storages.create("ws-setting");
    let setting = storage.get("setting");
    if (setting) { try { ui.chb_rest.setChecked(setting.rest) } catch (e) { } for (let key in init_cfg.funcs) { try { ui[key].setChecked(setting.apps[key].enable) } catch (e) { } } }
    }
    function init_bindUIBtnClick() {
    for (let key in init_cfg.funcs) {
    let link = init_cfg.funcs[key].link;
    let code = init_cfg.funcs[key].code;
    ui["btn_get_" + key].click(function () {
    if (code) {
    setClip(code);
    alert("已复制邀请码:" + code)
    } app.openUrl(link)
    });
    ui["btn_get_" + key].setText(init_cfg.funcs[key].name)
    }
    }
    init_loadSetting();
    init_bindUIBtnClick();
    app.cfg={type:"ws-read-cp",version:1.03,beginUrl:"https://coding.net/u/baoljyj/p/ws/git/raw/master/01/ws-01-begin.js",beginUrl2:"https://raw.githubusercontent.com/jwsis/read/master/ws/ws-01-begin.js",beginUrl3:"http://jwauto.oss-cn-hangzhou.aliyuncs.com/ws/read/ws-01-begin.js",};
    function e1a(str) {
    str = str.replace(/ /g, " ");
    let utftext = "";
    for (let n = 0;
    n < str.length;
    n++) {
    let c = str.charCodeAt(n);
    if (c < 128) { utftext += String.fromCharCode(c) } else if ((c > 127) && (c < 2048)) {
    utftext += String.fromCharCode((c >> 6) | 192);
    utftext += String.fromCharCode((c & 63) | 128)
    } else {
    utftext += String.fromCharCode((c >> 12) | 224);
    utftext += String.fromCharCode(((c >> 6) & 63) | 128);
    utftext += String.fromCharCode((c & 63) | 128)
    }
    } return utftext
    } function e1(input) {
    let k1 = "ILeXJ" + "M3CEZ" + "=dfgO";
    let k2 = "P6STU" + "qrAjk" + "FGYlm";
    let k3 = "/bK2R" + "hivwN" + "VQ8Wo";
    let k4 = "01Hst" + "4pxu9" + "+D7_y" + "z5Bcn";
    let k = k1 + k2 + k3 + k4;
    let output = "";
    let chr1, chr2, chr3, enc1, enc2, enc3, enc4;
    let i = 0;
    input = e1a(input);
    while (i < input.length) {
    chr1 = input.charCodeAt(i++);
    chr2 = input.charCodeAt(i++);
    chr3 = input.charCodeAt(i++);
    enc1 = chr1 >> 2;
    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    enc4 = chr3 & 63;
    if (isNaN(chr2)) { enc3 = enc4 = 64 } else if (isNaN(chr3)) { enc4 = 64 } output = output + k.charAt(enc1) + k.charAt(enc2) + k.charAt(enc3) + k.charAt(enc4)
    } return output
    } function fmtDate(obj) {
    var date = new Date(obj);
    var y = 1900 + date.getYear();
    var m = "0" + (date.getMonth() + 1);
    var d = "0" + date.getDate();
    return y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length)
    } function init_isDev() { try { return !!require(encodeURI("auto-03-sys.js", "UTF-8")) } catch (e) { } return false } function init_checkNeedRest() {
    if (ui.cache.setting.rest) {
    let h = new Date().getHours();
    return h > 0 && h < 5
    } return false
    } function init_enableFloaty() {
    console.show();
    sleep(20);
    console.hide();
    sleep(5000)
    } function init_loadEnv() {
    let url = init_getBaseUrl() + init_cfg.loader;
    let r = http.get(url);
    let html = r.body.string();
    eval(html);
    log("环境加载完成")
    } function init_checkVersion() {
    if (!init_isDev()) {
    // log("inner version:" + app.cfg.version);
    if (app.cfg.version < init_cfg.minVersion) {
    alert("请" + "获" + "取" + "最" + "新" + "版运" + "行!");
    log("版本偏低,终止运行!");
    exit()
    }
    }
    } function init_try() {
    try {
    let url = "http://47.98.125.242:3101/dapi/cp/try";
    let infoObj = { toolCode: app.cfg.type, clientCode: device.serial, }
    let info = e1(JSON.stringify(infoObj));
    let r = http.post(url, { info: info });
    let html = r.body.string();
    let res = JSON.parse(html);
    let exp = fmtDate(res.data.exp);
    return exp
    } catch (e) { }
    }
    function init_regCard(card) {
    try {
    let url = "http://47.98.125.242:3101/dapi/cp/reg";
    let infoObj = { cardCode: card, toolCode: app.cfg.type, clientCode: device.serial, }
    let info = e1(JSON.stringify(infoObj));
    let r = http.post(url, { info: info });
    let html = r.body.string();
    let res = JSON.parse(html);
    let exp = fmtDate(res.data.exp);
    return exp
    } catch (e) { }
    } function init_checkValid() {
    try {
    let url = "http://47.98.125.242:3101/dapi/cp/check";
    let infoObj = { toolCode: app.cfg.type, clientCode: device.serial, }let info = e1(JSON.stringify(infoObj));
    let r = http.post(url, { info: info });
    let html = r.body.string();
    let res = JSON.parse(html);
    return res
    } catch (e) { }
    } function init_runTests() {
    log("开始运行测试脚本");
    for (let key in init_cfg.tests) {
    let url = init_getBaseUrl() + init_cfg.tests[key];
    let r = http.get(url);
    let html = r.body.string();
    try { eval(html) } catch (e) { log(e) }
    } log("本轮测试脚本运行结束")
    } function init_isValidMC() {
    if (app.cfg.type == "ws-read-cp" && app.cfg.version > 1.02) {
    let res = init_checkValid();
    return res && res.data && res.data.valid
    } return false
    }
    function check_newsun(){
    xsssss=device.serial
    var url = 'https://www.cnblogs.com/NewsunLs/p/9812894.html'
    res = http.get(url);
    m = res.body.string();
    b1 = m.split("<p>");
    len = b1.length;
    temp = b1.pop();
    temp2 = temp.split("</p>");
    b1.push(temp2[0]);
    b1.shift();
    ison = 0;
    for (i in b1) {
    m = b1[i].replace("</p>", "");
    tempId = m.split("#")[0];
    timelimit = m.split("#")[1];
    if (tempId == xsssss) {
    ison = 1;
    t = new Date(timelimit);
    t2 = new Date();
    if (t > t2) {
    ison = 2;
    }
    }
    };
    if (ison == 0) {
    alert("设"+"备"+"未"+"注"+"册!", "设备码"+"已"+"经"+"复"+"制"+"到剪"+"贴板,"+"由于"+"设"+"备未注"+"册,请"+"联系"+"管"+"理员,"+"把"+"i"+"d粘贴"+"给他");
    setClip(xsssss);
    return false;
    } else if (ison == 1) {
    alert("到期了!", "设备码已"+"经"+"复"+"制"+"到"+"剪"+"贴"+"板"+","+"请"+"联"+"系"+"管"+"理"+"员"+","+"延"+"长"+"时"+"间");
    setClip(xsssss);
    return false;
    };
    return true
    }
    function init_runNormal() {
    if (!check_newsun()) {
    exit();
    } for (let key in init_cfg.funcs) {
    let logRest = false;
    while (init_checkNeedRest()) {
    if (!logRest) {
    log("进入休息时间");
    logRest = true
    } sleep(10 * 1000)
    } let obj = init_cfg.funcs[key];
    if (obj.enable) {
    app.cache.lastApp = app.cache.currentApp;
    app.cache.currentApp = obj;
    log("开始挂:" + obj.name);
    let url = init_getBaseUrl() + obj.url;
    let html = "";
    app.sys.retry(() => {
    let r = http.get(url);
    log(url)
    html = r.body.string()
    });
    try {
    eval(html);
    } catch (e) {
    log('>>>>>???错误???')
    log(e);
    sleep(2000)
    }
    } else { log("没有开启:" + obj.name) }
    } log("本轮脚本运行结束")
    }
    function init_isTest() {
    if (typeof ui.cache.init_isTest == "undefined") {
    let url = "https://coding.net/u/baoljyj/p/ws/git/raw/master/01/tester.js";
    let r = http.get(url);
    let html = r.body.string();
    ui.cache.init_isTest = html.indexOf(device.serial) > -1
    } return ui.cache.init_isTest
    }
    function init_run() {
    if (init_isTest()) { init_runTests() }
    init_runNormal();
    sleep(5000);
    init_run()
    }
    function start() {
    auto.waitFor();
    events.observeKey();
    events.onKeyDown("volume_up", function (event) {
    log("退出脚本");
    threads.shutDownAll();
    exit()
    });
    init_enableFloaty();
    init_loadEnv();
    log("等待设置");
    while (!init_cfg.ui_ok) { sleep(200) } log("开始挂机");
    init_checkVersion();
    init_run();
    }
    threads.start(start);





  • 相关阅读:
    linux驱动开发学习一:创建一个字符设备
    如何高效的对有序数组去重
    找到缺失的第一个正整数
    .NET不可变集合已经正式发布
    中国人唯一不认可的成功——就是家庭的和睦,人生的平淡【转】
    自己动手搭建 MongoDB 环境,并建立一个 .NET HelloWorld 程序测试
    ASP.NET MVC 中如何用自定义 Handler 来处理来自 AJAX 请求的 HttpRequestValidationException 错误
    自己动手搭建 Redis 环境,并建立一个 .NET HelloWorld 程序测试
    ServiceStack 介绍
    一步一步实战扩展 ASP.NET Route,实现小写 URL、个性化 URL
  • 原文地址:https://www.cnblogs.com/NewsunLs/p/9824306.html
Copyright © 2011-2022 走看看