更换安装指令为 aptss

This commit is contained in:
2026-02-19 18:01:16 +08:00
parent d16dec09a6
commit 44a55249db
6 changed files with 27 additions and 27 deletions

View File

@@ -62,7 +62,7 @@ apm-app-store/
## 🎯 Core Concepts ## 🎯 Core Concepts
### 1. APM Package Manager Integration ### 1. APM Package Manager Integration
The app acts as a GUI frontend for the APM CLI tool (`/opt/apm-store/extras/shell-caller.sh`). The app acts as a GUI frontend for the APM CLI tool (`/opt/spark-store/extras/shell-caller.sh`).
**Key Operations:** **Key Operations:**
- `apm install -y <pkgname>` - Install package - `apm install -y <pkgname>` - Install package

View File

@@ -23,7 +23,7 @@ type InstallTask = {
filename?: string; filename?: string;
}; };
const SHELL_CALLER_PATH = "/opt/apm-store/extras/shell-caller.sh"; const SHELL_CALLER_PATH = "/opt/spark-store/extras/shell-caller.sh";
export const tasks = new Map<number, InstallTask>(); export const tasks = new Map<number, InstallTask>();
@@ -170,7 +170,7 @@ ipcMain.on("queue-install", async (event, download_json) => {
const superUserCmd = await checkSuperUserCommand(); const superUserCmd = await checkSuperUserCommand();
let execCommand = ""; let execCommand = "";
const execParams = []; const execParams = [];
const downloadDir = `/tmp/apm-store/download/${pkgname}`; const downloadDir = `/tmp/spark-store/download/${pkgname}`;
if (superUserCmd.length > 0) { if (superUserCmd.length > 0) {
execCommand = superUserCmd; execCommand = superUserCmd;
@@ -180,9 +180,9 @@ ipcMain.on("queue-install", async (event, download_json) => {
} }
if (metalinkUrl && filename) { if (metalinkUrl && filename) {
execParams.push("apm", "ssaudit", `${downloadDir}/${filename}`); execParams.push("aptss", "ssaudit", `${downloadDir}/${filename}`);
} else { } else {
execParams.push("apm", "install", "-y", pkgname); execParams.push("aptss", "install", "-y", pkgname);
} }
const task: InstallTask = { const task: InstallTask = {
@@ -401,7 +401,7 @@ ipcMain.handle("check-installed", async (_event, pkgname: string) => {
const child = spawn( const child = spawn(
SHELL_CALLER_PATH, SHELL_CALLER_PATH,
["apm", "list", "--installed", pkgname], ["aptss", "list", "--installed", pkgname],
{ {
shell: true, shell: true,
env: process.env, env: process.env,
@@ -447,7 +447,7 @@ ipcMain.on("remove-installed", async (_event, pkgname: string) => {
} }
const child = spawn( const child = spawn(
execCommand, execCommand,
[...execParams, "apm", "remove", "-y", pkgname], [...execParams, "aptss", "remove", "-y", pkgname],
{ {
shell: true, shell: true,
env: process.env, env: process.env,
@@ -488,7 +488,7 @@ ipcMain.on("remove-installed", async (_event, pkgname: string) => {
ipcMain.handle("list-upgradable", async () => { ipcMain.handle("list-upgradable", async () => {
const { code, stdout, stderr } = await runCommandCapture(SHELL_CALLER_PATH, [ const { code, stdout, stderr } = await runCommandCapture(SHELL_CALLER_PATH, [
"apm", "aptss",
"list", "list",
"--upgradable", "--upgradable",
]); ]);
@@ -511,8 +511,8 @@ ipcMain.handle("list-installed", async () => {
superUserCmd.length > 0 ? superUserCmd : SHELL_CALLER_PATH; superUserCmd.length > 0 ? superUserCmd : SHELL_CALLER_PATH;
const execParams = const execParams =
superUserCmd.length > 0 superUserCmd.length > 0
? [SHELL_CALLER_PATH, "apm", "list", "--installed"] ? [SHELL_CALLER_PATH, "aptss", "list", "--installed"]
: ["apm", "list", "--installed"]; : ["aptss", "list", "--installed"];
const { code, stdout, stderr } = await runCommandCapture( const { code, stdout, stderr } = await runCommandCapture(
execCommand, execCommand,
@@ -542,8 +542,8 @@ ipcMain.handle("uninstall-installed", async (_event, pkgname: string) => {
superUserCmd.length > 0 ? superUserCmd : SHELL_CALLER_PATH; superUserCmd.length > 0 ? superUserCmd : SHELL_CALLER_PATH;
const execParams = const execParams =
superUserCmd.length > 0 superUserCmd.length > 0
? [SHELL_CALLER_PATH, "apm", "remove", "-y", pkgname] ? [SHELL_CALLER_PATH, "aptss", "remove", "-y", pkgname]
: ["apm", "remove", "-y", pkgname]; : ["aptss", "remove", "-y", pkgname];
const { code, stdout, stderr } = await runCommandCapture( const { code, stdout, stderr } = await runCommandCapture(
execCommand, execCommand,
@@ -570,8 +570,8 @@ ipcMain.handle("launch-app", async (_event, pkgname: string) => {
logger.warn("No pkgname provided for launch-app"); logger.warn("No pkgname provided for launch-app");
} }
const execCommand = "/opt/apm-store/extras/host-spawn"; const execCommand = "/opt/spark-store/extras/host-spawn";
const execParams = ["/opt/apm-store/extras/apm-launcher", "launch", pkgname]; const execParams = ["/opt/spark-store/extras/apm-launcher", "launch", pkgname];
logger.info( logger.info(
`Launching app: ${pkgname} with command: ${execCommand} ${execParams.join(" ")}`, `Launching app: ${pkgname} with command: ${execCommand} ${execParams.join(" ")}`,

View File

@@ -69,14 +69,14 @@ const getUserAgent = (): string => {
app && app.isPackaged app && app.isPackaged
? app.getVersion() ? app.getVersion()
: process.env.npm_package_version || "dev"; : process.env.npm_package_version || "dev";
return `APM-Store/${version}`; return `Spark-Store/${version}`;
}; };
logger.info("User Agent: " + getUserAgent()); logger.info("User Agent: " + getUserAgent());
async function createWindow() { async function createWindow() {
win = new BrowserWindow({ win = new BrowserWindow({
title: "APM AppStore", title: "星火应用商店",
width: 1366, width: 1366,
height: 768, height: 768,
autoHideMenuBar: true, autoHideMenuBar: true,
@@ -175,7 +175,7 @@ app.on("activate", () => {
app.on("will-quit", () => { app.on("will-quit", () => {
// Clean up temp dir // Clean up temp dir
logger.info("Cleaning up temp dir"); logger.info("Cleaning up temp dir");
fs.rmSync("/tmp/apm-store/", { recursive: true, force: true }); fs.rmSync("/tmp/spark-store/", { recursive: true, force: true });
logger.info("Done, exiting"); logger.info("Done, exiting");
}); });
@@ -223,7 +223,7 @@ app.whenReady().then(() => {
}, },
}, },
]); ]);
tray.setToolTip("APM 应用商店"); tray.setToolTip("星火应用商店");
tray.setContextMenu(contextMenu); tray.setContextMenu(contextMenu);
// 双击触发 // 双击触发
tray.on("click", () => { tray.on("click", () => {

View File

@@ -2,18 +2,18 @@
# 检查是否提供了至少一个参数 # 检查是否提供了至少一个参数
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
echo "错误:未提供命令参数。用法: $0 apm <子命令> [参数...]" echo "错误:未提供命令参数。用法: $0 aptss <子命令> [参数...]"
exit 1 exit 1
fi fi
# 严格验证第一个参数必须是 "apm" # 严格验证第一个参数必须是 "aptss"
if [[ "$1" != "apm" ]]; then if [[ "$1" != "aptss" ]]; then
echo "拒绝执行:仅允许执行 'apm' 命令。收到的第一个参数: '$1'" echo "拒绝执行:仅允许执行 'aptss' 命令。收到的第一个参数: '$1'"
exit 1 exit 1
fi fi
# 执行 apm 命令(跳过第一个参数 "apm" # 执行 aptss 命令(跳过第一个参数 "aptss"
/usr/bin/apm "${@:2}" 2>&1 /usr/bin/aptss "${@:2}" 2>&1
exit_code=$? exit_code=$?
exit $exit_code exit $exit_code

View File

@@ -12,7 +12,7 @@
<allow_inactive>yes</allow_inactive> <allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active> <allow_active>yes</allow_active>
</defaults> </defaults>
<annotate key="org.freedesktop.policykit.exec.path">/opt/apm-store/extras/shell-caller.sh</annotate> <annotate key="org.freedesktop.policykit.exec.path">/opt/spark-store/extras/shell-caller.sh</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate> <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action> </action>
</policyconfig> </policyconfig>

View File

@@ -1,5 +1,5 @@
#!/usr/bin/bash #!/usr/bin/bash
cp -fv /opt/apm-store/extras/store.spark-app.amber-pm-store.policy /usr/share/polkit-1/actions/store.spark-app.amber-pm-store.policy cp -fv /opt/spark-store/extras/store.spark-app.amber-pm-store.policy /usr/share/polkit-1/actions/store.spark-app.amber-pm-store.policy
xdg-mime default apm-store.desktop x-scheme-handler/apmstore xdg-mime default spark-store.desktop x-scheme-handler/spk
update-mime-database /usr/share/mime || true update-mime-database /usr/share/mime || true