Skip to content

Commit 09e14bb

Browse files
gideonsenkuclaude
andcommitted
feat(boxjs): add Egern icon using appstore icon; sync chavy.boxjs.js
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c6f370e commit 09e14bb

6 files changed

Lines changed: 80 additions & 35 deletions

File tree

Env.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function Env(name, opts) {
6666
}
6767

6868
getEnv() {
69+
if ('undefined' !== typeof Egern) return 'Egern'
6970
if ('undefined' !== typeof $environment && $environment['surge-version'])
7071
return 'Surge'
7172
if ('undefined' !== typeof $environment && $environment['stash-version'])
@@ -100,6 +101,10 @@ function Env(name, opts) {
100101
return 'Stash' === this.getEnv()
101102
}
102103

104+
isEgern() {
105+
return 'Egern' === this.getEnv()
106+
}
107+
103108
toObj(str, defaultValue = null) {
104109
try {
105110
return JSON.parse(str)
@@ -294,6 +299,7 @@ function Env(name, opts) {
294299
case 'Loon':
295300
case 'Stash':
296301
case 'Shadowrocket':
302+
case 'Egern':
297303
return $persistentStore.read(key)
298304
case 'Quantumult X':
299305
return $prefs.valueForKey(key)
@@ -311,6 +317,7 @@ function Env(name, opts) {
311317
case 'Loon':
312318
case 'Stash':
313319
case 'Shadowrocket':
320+
case 'Egern':
314321
return $persistentStore.write(val, key)
315322
case 'Quantumult X':
316323
return $prefs.setValueForKey(val, key)
@@ -371,6 +378,7 @@ function Env(name, opts) {
371378
case 'Loon':
372379
case 'Stash':
373380
case 'Shadowrocket':
381+
case 'Egern':
374382
default:
375383
if (this.isSurge() && this.isNeedRewrite) {
376384
request.headers = request.headers || {}
@@ -493,6 +501,7 @@ function Env(name, opts) {
493501
case 'Loon':
494502
case 'Stash':
495503
case 'Shadowrocket':
504+
case 'Egern':
496505
default:
497506
if (this.isSurge() && this.isNeedRewrite) {
498507
request.headers = request.headers || {}
@@ -643,6 +652,7 @@ function Env(name, opts) {
643652
switch (this.getEnv()) {
644653
case 'Surge':
645654
case 'Stash':
655+
case 'Egern':
646656
default:
647657
return { url: rawopts }
648658
case 'Loon':
@@ -658,6 +668,7 @@ function Env(name, opts) {
658668
case 'Surge':
659669
case 'Stash':
660670
case 'Shadowrocket':
671+
case 'Egern':
661672
default: {
662673
const options = {}
663674

@@ -677,7 +688,8 @@ function Env(name, opts) {
677688
}
678689

679690
// 图片通知
680-
let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] || $media
691+
let mediaUrl =
692+
rawopts.mediaUrl || rawopts['media-url'] || $media
681693
if (mediaUrl) {
682694
let media = undefined
683695
let mime = undefined
@@ -736,7 +748,8 @@ function Env(name, opts) {
736748
rawopts.openUrl || rawopts.url || rawopts['open-url'] || $open
737749
if (openUrl) Object.assign(options, { openUrl })
738750

739-
let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] || $media
751+
let mediaUrl =
752+
rawopts.mediaUrl || rawopts['media-url'] || $media
740753
if (mediaUrl) Object.assign(options, { mediaUrl })
741754

742755
console.log(JSON.stringify(options))
@@ -749,7 +762,8 @@ function Env(name, opts) {
749762
rawopts['open-url'] || rawopts.url || rawopts.openUrl || $open
750763
if (openUrl) Object.assign(options, { 'open-url': openUrl })
751764

752-
let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] || $media
765+
let mediaUrl =
766+
rawopts.mediaUrl || rawopts['media-url'] || $media
753767
if (mediaUrl) Object.assign(options, { 'media-url': mediaUrl })
754768

755769
let copy =
@@ -774,6 +788,7 @@ function Env(name, opts) {
774788
case 'Loon':
775789
case 'Stash':
776790
case 'Shadowrocket':
791+
case 'Egern':
777792
default:
778793
$notification.post(title, subt, desc, toEnvOpts(opts))
779794
break
@@ -851,6 +866,7 @@ function Env(name, opts) {
851866
case 'Loon':
852867
case 'Stash':
853868
case 'Shadowrocket':
869+
case 'Egern':
854870
case 'Quantumult X':
855871
default:
856872
this.log('', `❗️${this.name}, 错误!`, msg, err)
@@ -881,6 +897,7 @@ function Env(name, opts) {
881897
case 'Loon':
882898
case 'Stash':
883899
case 'Shadowrocket':
900+
case 'Egern':
884901
case 'Quantumult X':
885902
default:
886903
$done(val)

Env.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

box/chavy.boxjs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,15 +362,16 @@ function getBoxData() {
362362
function getSystemCfgs() {
363363
// prettier-ignore
364364
return {
365-
env: $.isStash() ? 'Stash' : $.isShadowrocket() ? 'Shadowrocket' : $.isLoon() ? 'Loon' : $.isQuanX() ? 'QuanX' : $.isSurge() ? 'Surge' : 'Node',
365+
env: $.isStash() ? 'Stash' : $.isShadowrocket() ? 'Shadowrocket' : $.isLoon() ? 'Loon' : $.isQuanX() ? 'QuanX' : $.isEgern() ? 'Egern' : $.isSurge() ? 'Surge' : 'Node',
366366
version: $.version,
367367
versionType: $.versionType,
368368
envs: [
369369
{ id: 'Surge', icons: ['https://raw.githubusercontent.com/Orz-3/mini/none/surge.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/surge.png'] },
370370
{ id: 'QuanX', icons: ['https://raw.githubusercontent.com/Orz-3/mini/none/quanX.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/quantumultx.png'] },
371371
{ id: 'Loon', icons: ['https://raw.githubusercontent.com/Orz-3/mini/none/loon.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/loon.png'] },
372372
{ id: 'Shadowrocket', icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/Alpha/shadowrocket.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/shadowrocket.png'] },
373-
{ id: 'Stash', icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/Alpha/stash.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/stash.png'] }
373+
{ id: 'Stash', icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/Alpha/stash.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/stash.png'] },
374+
{ id: 'Egern', icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/Alpha/appstore.png', 'https://raw.githubusercontent.com/Orz-3/mini/master/Color/appstore.png'] }
374375
],
375376
chavy: { id: 'ChavyLeung', icon: 'https://avatars3.githubusercontent.com/u/29748519', repo: 'https://github.com/chavyleung/scripts' },
376377
senku: { id: 'GideonSenku', icon: 'https://avatars1.githubusercontent.com/u/39037656', repo: 'https://github.com/GideonSenku' },

box/release/box.release.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.19.27",
5+
"tags": ["beta"],
6+
"author": "@GideonSenku",
7+
"msg": "feat(boxjs): 适配 Egern 代理工具",
8+
"notes": [
9+
{
10+
"name": "功能",
11+
"descs": ["Env.js 新增 Egern 代理工具适配,支持持久化存储、HTTP 请求、系统通知等完整功能"]
12+
}
13+
]
14+
},
315
{
416
"version": "0.19.26",
517
"tags": ["beta"],

box/release/box.release.tf.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.19.27",
5+
"tags": ["beta"],
6+
"author": "@GideonSenku",
7+
"msg": "feat(boxjs): 适配 Egern 代理工具",
8+
"notes": [
9+
{
10+
"name": "功能",
11+
"descs": ["Env.js 新增 Egern 代理工具适配,支持持久化存储、HTTP 请求、系统通知等完整功能"]
12+
}
13+
]
14+
},
315
{
416
"version": "0.19.26",
517
"tags": ["beta"],

0 commit comments

Comments
 (0)