Top Related Projects
This project is based on the scripting capabilities of several excellent iOS proxy tools (e.g. Surge, Quantumult X)
分流规则、重写写规则及脚本。
Quick Overview
The chavyleung/scripts repository is a collection of JavaScript scripts primarily focused on automation and task scheduling for various platforms and services. It includes scripts for signing in to different websites, collecting rewards, and performing other automated tasks. The project is mainly targeted at Chinese users and services.
Pros
- Wide range of supported platforms and services
- Active community and frequent updates
- Detailed documentation and usage instructions
- Customizable and extensible scripts
Cons
- Primarily focused on Chinese platforms, limiting global usability
- Some scripts may violate terms of service of certain platforms
- Requires technical knowledge to set up and use effectively
- Potential security risks if not used carefully
Code Examples
Here are a few examples of how to use some of the scripts in this repository:
- Signing in to Bilibili:
const $ = new Env('Bilibili')
const cookie = $.getdata('bilibili_cookie')
;(async () => {
await signIn()
$.done()
})()
function signIn() {
return new Promise((resolve) => {
const url = 'https://api.live.bilibili.com/sign/doSign'
const headers = { Cookie: cookie }
$.get({ url, headers }, (error, response, data) => {
if (error) {
$.log(error)
resolve()
} else {
$.log(data)
resolve()
}
})
})
}
- Checking in on JD:
const $ = new Env('JD')
const cookie = $.getdata('jd_cookie')
;(async () => {
await checkIn()
$.done()
})()
function checkIn() {
return new Promise((resolve) => {
const url = 'https://api.m.jd.com/client.action?functionId=signBeanIndex'
const headers = { Cookie: cookie }
$.post({ url, headers }, (error, response, data) => {
if (error) {
$.log(error)
resolve()
} else {
$.log(data)
resolve()
}
})
})
}
Getting Started
To use these scripts:
-
Clone the repository:
git clone https://github.com/chavyleung/scripts.git
-
Install dependencies:
cd scripts npm install
-
Configure your environment variables and cookies as required by each script.
-
Run a script using Node.js:
node path/to/script.js
Note: Make sure to read the documentation for each script carefully before use, as some may require additional setup or have specific usage instructions.
Competitor Comparisons
This project is based on the scripting capabilities of several excellent iOS proxy tools (e.g. Surge, Quantumult X)
Pros of Script
- More focused on iOS and Surge-specific scripts
- Includes a wider variety of scripts for different apps and services
- Generally more up-to-date with recent commits
Cons of Script
- Less organized repository structure
- Fewer contributors and community engagement
- Limited documentation and usage instructions
Code Comparison
Script:
function nobyda() {
const isRequest = typeof $request != "undefined"
const isSurge = typeof $httpClient != "undefined"
const isQuanX = typeof $task != "undefined"
const notify = (title, subtitle, message) => {
if (isQuanX) $notify(title, subtitle, message)
if (isSurge) $notification.post(title, subtitle, message)
}
// ... (additional code)
}
scripts:
const $ = new Env('chavyleung')
const KEY_sessions = 'chavy_boxjs_sessions'
const KEY_globalvar = 'chavy_boxjs_globalvar'
const KEY_app_subCaches = 'chavy_boxjs_app_subCaches'
const KEY_sysCaches = 'chavy_boxjs_sysCaches'
// ... (additional code)
Both repositories provide useful scripts for automation and task management, but they differ in their focus and organization. Script is more tailored for iOS and Surge users, while scripts offers a broader range of applications. The code comparison shows different approaches to environment detection and variable initialization.
分流规则、重写写规则及脚本。
Pros of ios_rule_script
- More comprehensive rule sets for various platforms and applications
- Regularly updated with a larger community contribution
- Includes additional tools and utilities for rule management
Cons of ios_rule_script
- May be more complex to navigate due to its larger scope
- Potentially higher resource usage due to extensive rule sets
- Steeper learning curve for beginners
Code Comparison
scripts:
const $ = new Env('JD_DailyBonus')
const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
ios_rule_script:
import re
from typing import List, Union
from ruamel.yaml import YAML
def load_yaml(file_path: str) -> Union[dict, list]:
with open(file_path, 'r', encoding='utf-8') as f:
return YAML().load(f)
Key Differences
- scripts focuses on specific scripts for various platforms
- ios_rule_script provides a broader range of rules and tools
- scripts uses JavaScript, while ios_rule_script uses Python for some components
- ios_rule_script offers more granular control over rule customization
- scripts may be easier to use for simple task automation
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Chavy Scripts
Telegram讨论ç»:Chavy Scripts Group
ð§°BoxJs
ç®ä»
A SPA Appliction be used for scripts utils
使ç¨æ¹å¼
å®è£ 对åºæ¨¡å/æ件åï¼æµè§å¨è®¿é®: boxjs.com
å®è£ é¾æ¥
- Shadowrocket: boxjs.rewrite.surge.sgmodule
- Loon: boxjs.rewrite.loon.plugin
- Quantumult X: boxjs.rewrite.quanx.conf
- Surge: boxjs.rewrite.surge.sgmodule
- Stash: boxjs.rewrite.stash.stoverride
ð ï¸Env.js
è°ç¨æ¹å¼
- Env.min.jsæ¾ç½®äºåµå
¥å¼èæ¬åºç«¯ï¼ç¶å头é¨è°ç¨åè½
const $ = new Env("ä½ çèæ¬å称");
åè½å表
HttpClient
- æ¯ææ¹æ³: get, post, put, delete, head, options, patch
let option = { url: "http://www.example.com/", // URLï¼å¿ é¡» headers: { // 请æ±å¤´ï¼å¯é "Accept": "*/*", "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Mobile/15E148 Safari/605.1.15", "Content-Type": "application/json; charset=utf-8" "" }, body: `auth_key=1234567&source_lang=EN&target_lang=ZH` // 请æ±ä½ï¼POSTçæ¹æ³å¿ é¡»ï¼å符串æ对象 } let result = $.get(URL<String> or options<Object>, callback(error, response, data)) // ä¸æ¯æå¼æ¥ let result = $.post(URL<String> or options<Object>, callback(error, response, data)) // ä¸æ¯æå¼æ¥ â¦â¦ let result = await $.http.get(URL<String> or options<Object>).then(callback(response)) let result = await $.http.post(URL<String> or options<Object>).then(response => response.body) let result = await $.http.put(URL<String> or options<Object>).then(response => { $.log(JSON.stringify(response.headers)); return response.body }) â¦â¦
æä¹ åæ°æ®
```javascript
$.getdata(âchavyâ) // 读åæä¹
åæ°æ® (stringæ ¼å¼)
$.setdata(string, âchavyâ) // åå
¥æä¹
åæ°æ® (stringæ ¼å¼)
$.getjson(âchavyâ, default_value<String, Object>) // 读åæä¹
åæ°æ® (objectæ ¼å¼),å½è¯»å失败åè¿åé»è®¤å¼
$.setjson(object, âchavyâ) // åå
¥æä¹
åæ°æ® (objectæ ¼å¼)
```
å®è£ é¾æ¥
æ£å¼ç
- ç¨äºéæ:Env.min.js
- 便äºé 读:Env.js
èµå©
ðLICENSE
Copyright © 2019-present chavyleung. This project is GPL licensed.
Top Related Projects
This project is based on the scripting capabilities of several excellent iOS proxy tools (e.g. Surge, Quantumult X)
分流规则、重写写规则及脚本。
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot