@laraveladmin/dsh-stay-awake 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.en.md +13 -0
- package/README.md +16 -0
- package/client.js +635 -113
- package/docs/REQUIREMENTS.md +16 -0
- package/docs/VERIFICATION.md +26 -0
- package/i18n/ar.json +7 -2
- package/i18n/de.json +7 -2
- package/i18n/en.json +7 -2
- package/i18n/es.json +7 -2
- package/i18n/fr.json +7 -2
- package/i18n/hi.json +7 -2
- package/i18n/id.json +7 -2
- package/i18n/it.json +7 -2
- package/i18n/ja.json +7 -2
- package/i18n/ko.json +7 -2
- package/i18n/language-names.json +401 -0
- package/i18n/nl.json +7 -2
- package/i18n/pl.json +7 -2
- package/i18n/pt.json +7 -2
- package/i18n/ru.json +7 -2
- package/i18n/th.json +70 -0
- package/i18n/tr.json +7 -2
- package/i18n/vi.json +7 -2
- package/i18n/zh-Hant.json +10 -2
- package/i18n/zh.json +10 -2
- package/index.js +1 -0
- package/lib/config.js +8 -0
- package/lib/server.js +14 -3
- package/lib/state.js +3 -0
- package/locale/th.json +6 -0
- package/market/index.json +2 -2
- package/package.json +1 -1
package/i18n/ru.json
CHANGED
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"panel.staleHost": "На хосте старая сборка: отключите и снова включите Stay awake в «Плагинах» или перезапустите DSH",
|
|
61
61
|
"panel.advanced": "Задержка, предел удержания и другие параметры — в cordis.patch.yml профиля",
|
|
62
62
|
"panel.repo": "Открыть репозиторий",
|
|
63
|
-
"panel.npm": "Посмотреть эту версию на npm"
|
|
64
|
-
|
|
63
|
+
"panel.npm": "Посмотреть эту версию на npm",
|
|
64
|
+
"panel.language": "Язык интерфейса",
|
|
65
|
+
"panel.languageFollow": "Как в DSH"
|
|
66
|
+
},
|
|
67
|
+
"aliases": [
|
|
68
|
+
"ru"
|
|
69
|
+
]
|
|
65
70
|
}
|
package/i18n/th.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"locale": "th",
|
|
3
|
+
"label": "ไทย",
|
|
4
|
+
"fallback": "en",
|
|
5
|
+
"meta": {
|
|
6
|
+
"title": "กันหลับ",
|
|
7
|
+
"description": "คงเครื่องให้ตื่นเฉพาะเมื่อมีงานที่ไม่มีคนเฝ้าอยู่ — รอบของเอเจนต์ งานเบื้องหลัง และการบีบอัดด้วยมือ — แล้วปลดอัตโนมัติเมื่อเสร็จ หากเครือข่ายขาดจะลองรอบที่ล้มเหลวอีกครั้ง และมีเสียงแยกเมื่อต้องให้คุณตอบหรืออนุมัติ"
|
|
8
|
+
},
|
|
9
|
+
"aliases": [
|
|
10
|
+
"th"
|
|
11
|
+
],
|
|
12
|
+
"strings": {
|
|
13
|
+
"brand": "กันหลับ",
|
|
14
|
+
"state.connecting": "กำลังเชื่อมต่อ",
|
|
15
|
+
"state.idle": "ไม่ได้คงไว้",
|
|
16
|
+
"state.releasing": "กำลังปลด",
|
|
17
|
+
"state.holding": "กำลังคงไว้",
|
|
18
|
+
"state.failed": "ผิดพลาด",
|
|
19
|
+
"state.disabled": "ปิด",
|
|
20
|
+
"state.unknown": "ไม่ทราบ",
|
|
21
|
+
"detail.backend": "แบ็กเอนด์",
|
|
22
|
+
"detail.scope": "ขอบเขต",
|
|
23
|
+
"detail.sources": "แหล่งที่ใช้งาน",
|
|
24
|
+
"detail.since": "คงไว้เป็นเวลา",
|
|
25
|
+
"detail.error": "สาเหตุ",
|
|
26
|
+
"sources.agents": "เซสชัน",
|
|
27
|
+
"sources.maintenance": "การบำรุงรักษา",
|
|
28
|
+
"sources.jobs": "งานเบื้องหลัง",
|
|
29
|
+
"scope.system": "ระบบเท่านั้น",
|
|
30
|
+
"scope.display": "รวมหน้าจอ",
|
|
31
|
+
"unit.none": "ไม่มี",
|
|
32
|
+
"hint.unreachable": "เชื่อมต่อบริการสถานะของโฮสต์ไม่ได้ DSH อาจกำลังรีสตาร์ท",
|
|
33
|
+
"error.exited": "การยืนยันพลังงานหยุดอย่างไม่คาดคิด กำลังลองใหม่",
|
|
34
|
+
"error.backend": "เริ่มแบ็กเอนด์การยืนยันพลังงานไม่ได้",
|
|
35
|
+
"error.unsupported": "ไม่มีแบ็กเอนด์พลังงานที่ใช้ได้บนแพลตฟอร์มนี้",
|
|
36
|
+
"error.unknown": "การยืนยันพลังงานรายงานข้อผิดพลาดที่ไม่รู้จัก",
|
|
37
|
+
"backend.caffeinate": "ตัวล็อกการหลับของ macOS (caffeinate)",
|
|
38
|
+
"backend.setthreadexecutionstate": "ตัวล็อกสถานะการทำงานของ Windows",
|
|
39
|
+
"panel.enabled": "เปิดใช้งาน",
|
|
40
|
+
"panel.allowDisplaySleep": "อนุญาตให้หน้าจอหลับ",
|
|
41
|
+
"panel.allowDisplaySleepHint": "บล็อกเฉพาะการหลับของระบบ หน้าจอเป็นไปตามการตั้งค่า OS",
|
|
42
|
+
"panel.hold": "คงไว้",
|
|
43
|
+
"panel.hold30": "30 นาที",
|
|
44
|
+
"panel.hold120": "2 ชั่วโมง",
|
|
45
|
+
"panel.holdCancel": "ยกเลิก",
|
|
46
|
+
"panel.sound": "เสียง",
|
|
47
|
+
"panel.testSound": "ทดลอง",
|
|
48
|
+
"panel.testSuccess": "เสร็จสิ้น",
|
|
49
|
+
"panel.testError": "ผิดพลาด",
|
|
50
|
+
"panel.testQuestion": "แจ้งเตือน",
|
|
51
|
+
"panel.testPlayed": "เล่นเสียงทดลองแล้ว",
|
|
52
|
+
"panel.testUnavailable": "ทดลองไม่สำเร็จ: ไม่พบเครื่องเล่น",
|
|
53
|
+
"panel.autoResume": "ลองใหม่หลังเชื่อมต่อกลับ",
|
|
54
|
+
"panel.autoResumeHint": "ลองรอบที่ล้มเหลวขณะออฟไลน์อีกครั้งเมื่อเครือข่ายกลับมา",
|
|
55
|
+
"panel.resumeWaiting": "กำลังรอเครือข่าย…",
|
|
56
|
+
"panel.resumeRetrying": "กำลังลองใหม่โดยอัตโนมัติ…",
|
|
57
|
+
"panel.resumeFailed": "ลองใหม่อัตโนมัติไม่สำเร็จ",
|
|
58
|
+
"panel.resumeRetried": "ลองใหม่แล้วหลังเครือข่ายกลับมา",
|
|
59
|
+
"panel.holdDisabled": "เปิดปลั๊กอินก่อนเพื่อคงไว้",
|
|
60
|
+
"panel.holdLeft": "เหลือ",
|
|
61
|
+
"panel.saved": "บันทึกแล้ว",
|
|
62
|
+
"panel.saveFailed": "บันทึกไม่ได้ โปรดลองใหม่",
|
|
63
|
+
"panel.staleHost": "ฝั่งโฮสต์เป็นบิลด์เก่า: ปิดแล้วเปิด Stay awake ใหม่ในหน้าปลั๊กอิน หรือรีสตาร์ท DSH",
|
|
64
|
+
"panel.advanced": "ค่า debounce ขีดจำกัดการคงไว้ และตัวเลือกอื่นอยู่ใน cordis.patch.yml ของโปรไฟล์",
|
|
65
|
+
"panel.repo": "เปิดที่เก็บซอร์ส",
|
|
66
|
+
"panel.npm": "ดูเวอร์ชันนี้บน npm",
|
|
67
|
+
"panel.language": "ภาษาของอินเทอร์เฟซ",
|
|
68
|
+
"panel.languageFollow": "ตาม DSH"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/i18n/tr.json
CHANGED
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"panel.staleHost": "Ana makine tarafı eski bir sürümde: Eklentiler'de Stay awake'i kapatıp açın veya DSH'yi yeniden başlatın",
|
|
61
61
|
"panel.advanced": "Titreşim önleme, tutma sınırı ve diğer seçenekler profil cordis.patch.yml dosyasında",
|
|
62
62
|
"panel.repo": "Kaynak deposunu aç",
|
|
63
|
-
"panel.npm": "Bu sürümü npm'de görüntüle"
|
|
64
|
-
|
|
63
|
+
"panel.npm": "Bu sürümü npm'de görüntüle",
|
|
64
|
+
"panel.language": "Arayüz dili",
|
|
65
|
+
"panel.languageFollow": "DSH'yi izle"
|
|
66
|
+
},
|
|
67
|
+
"aliases": [
|
|
68
|
+
"tr"
|
|
69
|
+
]
|
|
65
70
|
}
|
package/i18n/vi.json
CHANGED
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"panel.staleHost": "Phần máy chủ dùng bản dựng cũ: tắt rồi bật lại Stay awake trong Plugin, hoặc khởi động lại DSH",
|
|
61
61
|
"panel.advanced": "Độ trễ, giới hạn giữ và các tùy chọn khác nằm trong cordis.patch.yml của profile",
|
|
62
62
|
"panel.repo": "Mở kho mã nguồn",
|
|
63
|
-
"panel.npm": "Xem phiên bản này trên npm"
|
|
64
|
-
|
|
63
|
+
"panel.npm": "Xem phiên bản này trên npm",
|
|
64
|
+
"panel.language": "Ngôn ngữ giao diện",
|
|
65
|
+
"panel.languageFollow": "Theo DSH"
|
|
66
|
+
},
|
|
67
|
+
"aliases": [
|
|
68
|
+
"vi"
|
|
69
|
+
]
|
|
65
70
|
}
|
package/i18n/zh-Hant.json
CHANGED
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
"panel.staleHost": "宿主端未載入最新版本:請在外掛頁面停用再啟用「守夜」,或重新啟動 DSH",
|
|
61
61
|
"panel.advanced": "防抖、兜底時長等進階參數在 profile 的 cordis.patch.yml 中設定",
|
|
62
62
|
"panel.repo": "開啟程式碼倉庫",
|
|
63
|
-
"panel.npm": "在 npm 查看此版本"
|
|
64
|
-
|
|
63
|
+
"panel.npm": "在 npm 查看此版本",
|
|
64
|
+
"panel.language": "介面語言",
|
|
65
|
+
"panel.languageFollow": "跟隨 DSH"
|
|
66
|
+
},
|
|
67
|
+
"aliases": [
|
|
68
|
+
"zh-hant",
|
|
69
|
+
"zh-tw",
|
|
70
|
+
"zh-hk",
|
|
71
|
+
"zh-mo"
|
|
72
|
+
]
|
|
65
73
|
}
|
package/i18n/zh.json
CHANGED
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
"panel.staleHost": "宿主端未加载最新版本:请在插件页禁用再启用「守夜」,或重启 DSH",
|
|
61
61
|
"panel.advanced": "防抖、兜底时长等高级参数在 profile 的 cordis.patch.yml 中配置",
|
|
62
62
|
"panel.repo": "打开代码仓库",
|
|
63
|
-
"panel.npm": "在 npm 查看该版本"
|
|
64
|
-
|
|
63
|
+
"panel.npm": "在 npm 查看该版本",
|
|
64
|
+
"panel.language": "界面语言",
|
|
65
|
+
"panel.languageFollow": "跟随 DSH"
|
|
66
|
+
},
|
|
67
|
+
"aliases": [
|
|
68
|
+
"zh",
|
|
69
|
+
"zh-cn",
|
|
70
|
+
"zh-hans",
|
|
71
|
+
"zh-sg"
|
|
72
|
+
]
|
|
65
73
|
}
|
package/index.js
CHANGED
|
@@ -73,6 +73,7 @@ export function start(ctx, rawConfig, deps = {}) {
|
|
|
73
73
|
scope: config.scope,
|
|
74
74
|
sound: config.sound,
|
|
75
75
|
autoResume: config.autoResume,
|
|
76
|
+
language: config.language ?? null,
|
|
76
77
|
})
|
|
77
78
|
if (!result.ok) log.warn(`stay-awake: could not persist settings: ${result.error}`)
|
|
78
79
|
}
|
package/lib/config.js
CHANGED
|
@@ -33,6 +33,9 @@ export const DEFAULTS = Object.freeze({
|
|
|
33
33
|
// How often the host asks its own session state whether a human answer is
|
|
34
34
|
// pending. Cheap, local, and it sees approvals the waterfall bridge answers.
|
|
35
35
|
questionPollMs: 1500,
|
|
36
|
+
// Interface language of the popover: null = follow the DSH locale, any
|
|
37
|
+
// supported tag = a plugin-only override (state.json wins over this default).
|
|
38
|
+
language: null,
|
|
36
39
|
soundVolume: 1,
|
|
37
40
|
// "Retry the turn that died with the network": on by default, but it only
|
|
38
41
|
// fires for a lost connection, never for a user abort or an approval wait.
|
|
@@ -46,6 +49,8 @@ export const DEFAULTS = Object.freeze({
|
|
|
46
49
|
})
|
|
47
50
|
|
|
48
51
|
const SCOPES = new Set(['system', 'display'])
|
|
52
|
+
/** BCP 47-style tag the client's dictionary table knows; null means "follow DSH". */
|
|
53
|
+
const LOCALE_TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u
|
|
49
54
|
|
|
50
55
|
/**
|
|
51
56
|
* Overlay persisted UI state on top of the patch-layer config.
|
|
@@ -59,6 +64,8 @@ export function applyState(config, state) {
|
|
|
59
64
|
if (SCOPES.has(state?.scope)) next.scope = state.scope
|
|
60
65
|
if (typeof state?.sound === 'boolean') next.sound = state.sound
|
|
61
66
|
if (typeof state?.autoResume === 'boolean') next.autoResume = state.autoResume
|
|
67
|
+
if (typeof state?.language === 'string' && LOCALE_TAG.test(state.language)) next.language = state.language
|
|
68
|
+
else if (state !== null && typeof state === 'object' && 'language' in state && state.language === null) next.language = null
|
|
62
69
|
return next
|
|
63
70
|
}
|
|
64
71
|
|
|
@@ -118,6 +125,7 @@ export function normalizeConfig(raw) {
|
|
|
118
125
|
questionRepeatSeconds: asNumber(input.questionRepeatSeconds, DEFAULTS.questionRepeatSeconds, { min: 0, max: 60 * 30 }),
|
|
119
126
|
questionRepeatMaxMinutes: asNumber(input.questionRepeatMaxMinutes, DEFAULTS.questionRepeatMaxMinutes, { min: 0, max: 24 * 60 }),
|
|
120
127
|
questionPollMs: asNumber(input.questionPollMs, DEFAULTS.questionPollMs, { min: 200, max: 10_000 }),
|
|
128
|
+
language: typeof input.language === 'string' && LOCALE_TAG.test(input.language) ? input.language : null,
|
|
121
129
|
soundVolume: asNumber(input.soundVolume, DEFAULTS.soundVolume, { min: 0, max: 3 }),
|
|
122
130
|
autoResume: asBoolean(input.autoResume, DEFAULTS.autoResume),
|
|
123
131
|
autoResumeCodes: asCodes(input.autoResumeCodes, DEFAULTS.autoResumeCodes),
|
package/lib/server.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const MAX_BODY_BYTES = 4096
|
|
4
4
|
const SCOPES = new Set(['system', 'display'])
|
|
5
5
|
const SOUND_KINDS = new Set(['success', 'error', 'question'])
|
|
6
|
+
const LOCALE_TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u
|
|
6
7
|
|
|
7
8
|
export function createStatusHandler({ controller, activity, sound, config, platform, version, backend, verify, autoResume, onChange }) {
|
|
8
9
|
return async function handle(request) {
|
|
@@ -58,6 +59,14 @@ export function createStatusHandler({ controller, activity, sound, config, platf
|
|
|
58
59
|
autoResume?.setEnabled?.(body.enabled)
|
|
59
60
|
notify(onChange)
|
|
60
61
|
break
|
|
62
|
+
case 'set-language': {
|
|
63
|
+
const language = body.language
|
|
64
|
+
if (language !== null && typeof language !== 'string') return json({ error: 'invalid-body' }, 400)
|
|
65
|
+
if (typeof language === 'string' && !LOCALE_TAG.test(language)) return json({ error: 'invalid-body' }, 400)
|
|
66
|
+
config.language = language === null ? null : language
|
|
67
|
+
notify(onChange)
|
|
68
|
+
break
|
|
69
|
+
}
|
|
61
70
|
case 'test-sound': {
|
|
62
71
|
// The click is a request to hear the sound, so bypass the throttle and
|
|
63
72
|
// tell the caller whether a player was actually spawned: the button
|
|
@@ -93,9 +102,10 @@ function notify(onChange) {
|
|
|
93
102
|
function payload({ controller, activity, config, platform, version, backend, verify, autoResume }) {
|
|
94
103
|
return {
|
|
95
104
|
ok: true,
|
|
96
|
-
//
|
|
97
|
-
// host half is an older build and says so instead of sending dead
|
|
98
|
-
|
|
105
|
+
// 4 adds the interface-language override; a client that sees an older number
|
|
106
|
+
// knows the host half is an older build and says so instead of sending dead
|
|
107
|
+
// actions.
|
|
108
|
+
protocol: 4,
|
|
99
109
|
version,
|
|
100
110
|
platform,
|
|
101
111
|
backend,
|
|
@@ -106,6 +116,7 @@ function payload({ controller, activity, config, platform, version, backend, ver
|
|
|
106
116
|
sound: config.sound,
|
|
107
117
|
soundMinSeconds: config.soundMinSeconds,
|
|
108
118
|
autoResume: config.autoResume === true,
|
|
119
|
+
language: typeof config.language === 'string' ? config.language : null,
|
|
109
120
|
resume: autoResume?.view?.() ?? null,
|
|
110
121
|
counts: activity.counts(config),
|
|
111
122
|
...controller.status(),
|
package/lib/state.js
CHANGED
|
@@ -28,6 +28,9 @@ export function sanitizeState(raw) {
|
|
|
28
28
|
if (SCOPES.has(raw.scope)) result.scope = raw.scope
|
|
29
29
|
if (typeof raw.sound === 'boolean') result.sound = raw.sound
|
|
30
30
|
if (typeof raw.autoResume === 'boolean') result.autoResume = raw.autoResume
|
|
31
|
+
if (typeof raw.language === 'string' && /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/u.test(raw.language)) {
|
|
32
|
+
result.language = raw.language
|
|
33
|
+
}
|
|
31
34
|
return result
|
|
32
35
|
}
|
|
33
36
|
|
package/locale/th.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "กันหลับ",
|
|
4
|
+
"description": "คงเครื่องให้ตื่นเฉพาะเมื่อมีงานที่ไม่มีคนเฝ้าอยู่ — รอบของเอเจนต์ งานเบื้องหลัง และการบีบอัดด้วยมือ — แล้วปลดอัตโนมัติเมื่อเสร็จ หากเครือข่ายขาดจะลองรอบที่ล้มเหลวอีกครั้ง และมีเสียงแยกเมื่อต้องให้คุณตอบหรืออนุมัติ"
|
|
5
|
+
}
|
|
6
|
+
}
|
package/market/index.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laraveladmin/dsh-stay-awake",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "DeepSeek Harness plugin that keeps the machine awake only while unattended work runs, and retries the turn that died with the network once it is back.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh-plugin",
|