feat(panel): 锁屏一次性解锁端点 POST /api/system/pin-unlock-once(写 /tmp/meow_pin_unlock_once,launcher 锁屏页消费放行一次)+ 设置页 PIN 卡「一次性解锁设备」按钮
This commit is contained in:
1 parent
54d2791f48
commit
85e1d03157
2 files changed
+23
-1
No files matched your search
@@ -3493,6 +3493,17 @@ static int api_system(int sock)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ---------------- 锁屏一次性解锁(写 /tmp/meow_pin_unlock_once,launcher 锁屏页消费) ---------------- */
|
||||
static int api_pin_unlock_once(int sock)
|
||||
{
|
||||
const char *path = "/tmp/meow_pin_unlock_once";
|
||||
FILE *f = fopen(path, "w");
|
||||
if (!f) return send_err(sock, 500, "INTERNAL", "无法写入一次性解锁标志");
|
||||
fputs("1\n", f);
|
||||
fclose(f);
|
||||
return send_json(sock, 200, "{\"unlock_once\":true}");
|
||||
}
|
||||
|
||||
/* ---------------- 系统动作(经 meow_svc_power IPC) ---------------- */
|
||||
static int api_system_action(int sock, const char *which, const req_t *r)
|
||||
{
|
||||
@@ -5397,6 +5408,7 @@ static int handle(int sock, req_t *r)
|
||||
if (!strcmp(p, "/api/system/reboot")) return api_system_action(sock, "reboot", r);
|
||||
if (!strcmp(p, "/api/system/shutdown")) return api_system_action(sock, "shutdown", r);
|
||||
if (!strcmp(p, "/api/system/ota")) return api_system_action(sock, "ota", r);
|
||||
if (!strcmp(p, "/api/system/pin-unlock-once")) return api_pin_unlock_once(sock);
|
||||
if (!strcmp(p, "/api/settings")) return api_settings_batch(sock, r);
|
||||
if (!strcmp(p, "/api/settings/restore")) return api_settings_restore(sock);
|
||||
if (!strcmp(p, "/api/theme")) return api_theme_put(sock, r);
|
||||
|
||||
Reference in new issue
Block a user