mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
更换安装指令为 aptss
This commit is contained in:
@@ -62,7 +62,7 @@ apm-app-store/
|
||||
## 🎯 Core Concepts
|
||||
|
||||
### 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:**
|
||||
- `apm install -y <pkgname>` - Install package
|
||||
|
||||
@@ -23,7 +23,7 @@ type InstallTask = {
|
||||
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>();
|
||||
|
||||
@@ -170,7 +170,7 @@ ipcMain.on("queue-install", async (event, download_json) => {
|
||||
const superUserCmd = await checkSuperUserCommand();
|
||||
let execCommand = "";
|
||||
const execParams = [];
|
||||
const downloadDir = `/tmp/apm-store/download/${pkgname}`;
|
||||
const downloadDir = `/tmp/spark-store/download/${pkgname}`;
|
||||
|
||||
if (superUserCmd.length > 0) {
|
||||
execCommand = superUserCmd;
|
||||
@@ -180,9 +180,9 @@ ipcMain.on("queue-install", async (event, download_json) => {
|
||||
}
|
||||
|
||||
if (metalinkUrl && filename) {
|
||||
execParams.push("apm", "ssaudit", `${downloadDir}/${filename}`);
|
||||
execParams.push("aptss", "ssaudit", `${downloadDir}/${filename}`);
|
||||
} else {
|
||||
execParams.push("apm", "install", "-y", pkgname);
|
||||
execParams.push("aptss", "install", "-y", pkgname);
|
||||
}
|
||||
|
||||
const task: InstallTask = {
|
||||
@@ -401,7 +401,7 @@ ipcMain.handle("check-installed", async (_event, pkgname: string) => {
|
||||
|
||||
const child = spawn(
|
||||
SHELL_CALLER_PATH,
|
||||
["apm", "list", "--installed", pkgname],
|
||||
["aptss", "list", "--installed", pkgname],
|
||||
{
|
||||
shell: true,
|
||||
env: process.env,
|
||||
@@ -447,7 +447,7 @@ ipcMain.on("remove-installed", async (_event, pkgname: string) => {
|
||||
}
|
||||
const child = spawn(
|
||||
execCommand,
|
||||
[...execParams, "apm", "remove", "-y", pkgname],
|
||||
[...execParams, "aptss", "remove", "-y", pkgname],
|
||||
{
|
||||
shell: true,
|
||||
env: process.env,
|
||||
@@ -488,7 +488,7 @@ ipcMain.on("remove-installed", async (_event, pkgname: string) => {
|
||||
|
||||
ipcMain.handle("list-upgradable", async () => {
|
||||
const { code, stdout, stderr } = await runCommandCapture(SHELL_CALLER_PATH, [
|
||||
"apm",
|
||||
"aptss",
|
||||
"list",
|
||||
"--upgradable",
|
||||
]);
|
||||
@@ -511,8 +511,8 @@ ipcMain.handle("list-installed", async () => {
|
||||
superUserCmd.length > 0 ? superUserCmd : SHELL_CALLER_PATH;
|
||||
const execParams =
|
||||
superUserCmd.length > 0
|
||||
? [SHELL_CALLER_PATH, "apm", "list", "--installed"]
|
||||
: ["apm", "list", "--installed"];
|
||||
? [SHELL_CALLER_PATH, "aptss", "list", "--installed"]
|
||||
: ["aptss", "list", "--installed"];
|
||||
|
||||
const { code, stdout, stderr } = await runCommandCapture(
|
||||
execCommand,
|
||||
@@ -542,8 +542,8 @@ ipcMain.handle("uninstall-installed", async (_event, pkgname: string) => {
|
||||
superUserCmd.length > 0 ? superUserCmd : SHELL_CALLER_PATH;
|
||||
const execParams =
|
||||
superUserCmd.length > 0
|
||||
? [SHELL_CALLER_PATH, "apm", "remove", "-y", pkgname]
|
||||
: ["apm", "remove", "-y", pkgname];
|
||||
? [SHELL_CALLER_PATH, "aptss", "remove", "-y", pkgname]
|
||||
: ["aptss", "remove", "-y", pkgname];
|
||||
|
||||
const { code, stdout, stderr } = await runCommandCapture(
|
||||
execCommand,
|
||||
@@ -570,8 +570,8 @@ ipcMain.handle("launch-app", async (_event, pkgname: string) => {
|
||||
logger.warn("No pkgname provided for launch-app");
|
||||
}
|
||||
|
||||
const execCommand = "/opt/apm-store/extras/host-spawn";
|
||||
const execParams = ["/opt/apm-store/extras/apm-launcher", "launch", pkgname];
|
||||
const execCommand = "/opt/spark-store/extras/host-spawn";
|
||||
const execParams = ["/opt/spark-store/extras/apm-launcher", "launch", pkgname];
|
||||
|
||||
logger.info(
|
||||
`Launching app: ${pkgname} with command: ${execCommand} ${execParams.join(" ")}`,
|
||||
|
||||
@@ -69,14 +69,14 @@ const getUserAgent = (): string => {
|
||||
app && app.isPackaged
|
||||
? app.getVersion()
|
||||
: process.env.npm_package_version || "dev";
|
||||
return `APM-Store/${version}`;
|
||||
return `Spark-Store/${version}`;
|
||||
};
|
||||
|
||||
logger.info("User Agent: " + getUserAgent());
|
||||
|
||||
async function createWindow() {
|
||||
win = new BrowserWindow({
|
||||
title: "APM AppStore",
|
||||
title: "星火应用商店",
|
||||
width: 1366,
|
||||
height: 768,
|
||||
autoHideMenuBar: true,
|
||||
@@ -175,7 +175,7 @@ app.on("activate", () => {
|
||||
app.on("will-quit", () => {
|
||||
// Clean 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");
|
||||
});
|
||||
|
||||
@@ -223,7 +223,7 @@ app.whenReady().then(() => {
|
||||
},
|
||||
},
|
||||
]);
|
||||
tray.setToolTip("APM 应用商店");
|
||||
tray.setToolTip("星火应用商店");
|
||||
tray.setContextMenu(contextMenu);
|
||||
// 双击触发
|
||||
tray.on("click", () => {
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
# 检查是否提供了至少一个参数
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "错误:未提供命令参数。用法: $0 apm <子命令> [参数...]"
|
||||
echo "错误:未提供命令参数。用法: $0 aptss <子命令> [参数...]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 严格验证第一个参数必须是 "apm"
|
||||
if [[ "$1" != "apm" ]]; then
|
||||
echo "拒绝执行:仅允许执行 'apm' 命令。收到的第一个参数: '$1'"
|
||||
# 严格验证第一个参数必须是 "aptss"
|
||||
if [[ "$1" != "aptss" ]]; then
|
||||
echo "拒绝执行:仅允许执行 'aptss' 命令。收到的第一个参数: '$1'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 执行 apm 命令(跳过第一个参数 "apm")
|
||||
/usr/bin/apm "${@:2}" 2>&1
|
||||
# 执行 aptss 命令(跳过第一个参数 "aptss")
|
||||
/usr/bin/aptss "${@:2}" 2>&1
|
||||
exit_code=$?
|
||||
|
||||
exit $exit_code
|
||||
@@ -12,7 +12,7 @@
|
||||
<allow_inactive>yes</allow_inactive>
|
||||
<allow_active>yes</allow_active>
|
||||
</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>
|
||||
</action>
|
||||
</policyconfig>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/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
|
||||
xdg-mime default apm-store.desktop x-scheme-handler/apmstore
|
||||
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 spark-store.desktop x-scheme-handler/spk
|
||||
update-mime-database /usr/share/mime || true
|
||||
Reference in New Issue
Block a user