Skip to content

Commit 6a46322

Browse files
committed
webui: quote superkey in all shell call
#1
1 parent 82b5430 commit 6a46322

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

webui/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function updateSuperkey(key) {
4949
exec(`
5050
key="${key}"
5151
if [ -n "$key" ]; then
52-
echo "$key" | base64 -w0 > /data/adb/kp-next/key
52+
echo '${key}' | base64 -w0 > /data/adb/kp-next/key
5353
if [ -f "${modDir}/unresolved" ]; then
5454
rm -f "${modDir}/unresolved"
5555
busybox nohup sh "${modDir}/service.sh" &

webui/page/exclude.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async function renderAppList() {
217217
saveTimeout = setTimeout(() => {
218218
saveExcludedList(excludedApps);
219219
}, 500);
220-
exec(`kpatch ${superkey} exclude_set ${realUid} ${isSelected ? 1 : 0}`, { env: { PATH: `${modDir}/bin` } });
220+
exec(`kpatch '${superkey}' exclude_set ${realUid} ${isSelected ? 1 : 0}`, { env: { PATH: `${modDir}/bin` } });
221221
});
222222

223223
appItemMap.set(appKey, item);

webui/page/kpm.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ async function getKpmList() {
4646
}
4747

4848
const listResult = await exec(
49-
`kpatch ${superkey} kpm list && sh "${modDir}/status.sh" "${superkey}"`,
49+
`kpatch '${superkey}' kpm list && sh "${modDir}/status.sh" '${superkey}'`,
5050
{ env: { PATH: `${modDir}/bin:$PATH` } }
5151
);
5252
const modules = listResult.stdout.trim().split('\n').filter(line => line.trim());
5353

5454
const modulePromises = modules.map(async (moduleName) => {
55-
const infoResult = await exec(`kpatch ${superkey} kpm info "${moduleName}"`, { env: { PATH: `${modDir}/bin` } });
55+
const infoResult = await exec(`kpatch '${superkey}' kpm info "${moduleName}"`, { env: { PATH: `${modDir}/bin` } });
5656
const infoLines = infoResult.stdout.trim().split('\n');
5757

5858
const moduleInfo = {};
@@ -69,7 +69,7 @@ async function getKpmList() {
6969
}
7070

7171
async function controlModule(moduleName, action) {
72-
const result = await exec(`kpatch ${superkey} kpm ctl0 "${moduleName}" ${action}`, { env: { PATH: `${modDir}/bin` } });
72+
const result = await exec(`kpatch '${superkey}' kpm ctl0 "${moduleName}" ${action}`, { env: { PATH: `${modDir}/bin` } });
7373
toast(result.errno === 0 ? result.stdout : result.stderr);
7474
}
7575

@@ -79,12 +79,12 @@ function forgetModule(moduleName) {
7979

8080
async function unloadModule(moduleName) {
8181
forgetModule(moduleName);
82-
const result = await exec(`kpatch ${superkey} kpm unload "${moduleName}"`, { env: { PATH: `${modDir}/bin` } });
82+
const result = await exec(`kpatch '${superkey}' kpm unload "${moduleName}"`, { env: { PATH: `${modDir}/bin` } });
8383
return result.errno === 0;
8484
}
8585

8686
async function loadModule(modulePath) {
87-
const result = await exec(`kpatch ${superkey} kpm load "${modulePath}"`, { env: { PATH: `${modDir}/bin` } });
87+
const result = await exec(`kpatch '${superkey}' kpm load "${modulePath}"`, { env: { PATH: `${modDir}/bin` } });
8888
return result.errno === 0;
8989
}
9090

webui/page/patch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ function parseIni(str) {
3939
async function getInstalledVersion() {
4040
if (superkey === '') return null;
4141
if (import.meta.env.DEV) return uInt2String('c06');
42-
const working = await exec(`kpatch ${superkey} hello`, { env: { PATH: `${modDir}/bin` } });
42+
const working = await exec(`kpatch '${superkey}' hello`, { env: { PATH: `${modDir}/bin` } });
4343
if (working.stdout.trim() === '') return null;
44-
const version = await exec(`kpatch ${superkey} kpver`, { env: { PATH: `${modDir}/bin` } });
44+
const version = await exec(`kpatch '${superkey}' kpver`, { env: { PATH: `${modDir}/bin` } });
4545
return uInt2String(version.stdout.trim());
4646
}
4747

@@ -337,7 +337,7 @@ function patch(type) {
337337
if (type === "patch") {
338338
args.push(
339339
`${modDir}/boot_patch.sh`,
340-
superkeyVal,
340+
`'${superkeyVal}'`,
341341
bootDev,
342342
'true'
343343
);

0 commit comments

Comments
 (0)