mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-09-20 21:50:11 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfe8c87fea | ||
|
|
4c44ecf9b1 | ||
|
|
ae19c309df | ||
|
|
405a402432 |
+12
-32
@@ -1,34 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 显示进度条并执行命令(支持 garma / zenity)
|
||||
# 显示进度条并执行命令(使用 zenity)
|
||||
run_with_progress() {
|
||||
local title="$1"
|
||||
local text="$2"
|
||||
local cmd="$3"
|
||||
|
||||
# 检测可用的对话框工具
|
||||
local tool=""
|
||||
if command -v garma &> /dev/null; then
|
||||
tool="garma"
|
||||
elif command -v zenity &> /dev/null; then
|
||||
tool="zenity"
|
||||
else
|
||||
echo "警告:未找到 garma 或 zenity,无法显示进度条。直接执行命令..." >&2
|
||||
if ! command -v zenity &> /dev/null; then
|
||||
echo "警告:未找到 zenity,无法显示进度条。直接执行命令..." >&2
|
||||
eval "$cmd"
|
||||
return $?
|
||||
fi
|
||||
|
||||
# 根据工具启动进度条
|
||||
# 启动 zenity 进度条
|
||||
local progress_pid
|
||||
if [[ "$tool" == "garma" ]]; then
|
||||
# garma 的进度条用法(假设 --progress --pulsate 可用)
|
||||
garma --progress --pulsate --title="$title" --text="$text" --no-cancel 2>/dev/null &
|
||||
progress_pid=$!
|
||||
else
|
||||
# zenity 进度条 pulsate 模式
|
||||
zenity --progress --pulsate --title="$title" --text="$text" --no-cancel 2>/dev/null &
|
||||
progress_pid=$!
|
||||
fi
|
||||
zenity --progress --pulsate --title="$title" --text="$text" --no-cancel 2>/dev/null &
|
||||
progress_pid=$!
|
||||
|
||||
# 执行实际命令
|
||||
eval "$cmd"
|
||||
@@ -120,17 +108,13 @@ case "$command_type" in
|
||||
title="确认卸载"
|
||||
text="正在准备卸载: $packages\n\n若这是您下达的卸载指令,请选择确认继续卸载"
|
||||
|
||||
# 优先尝试 garma,其次 zenity
|
||||
if command -v garma &> /dev/null; then
|
||||
garma --question --title="$title" --text="$text" \
|
||||
--ok-label="确认卸载" --cancel-label="取消" --width=400
|
||||
confirmed=$?
|
||||
elif command -v zenity &> /dev/null; then
|
||||
# 使用 zenity 确认
|
||||
if command -v zenity &> /dev/null; then
|
||||
zenity --question --title="$title" --text="$text" \
|
||||
--ok-label="确认卸载" --cancel-label="取消" --width=400
|
||||
confirmed=$?
|
||||
else
|
||||
echo "错误:未找到 garma 或 zenity,无法显示确认对话框。卸载操作已拒绝。"
|
||||
echo "错误:未找到 zenity,无法显示确认对话框。卸载操作已拒绝。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -148,17 +132,13 @@ case "$command_type" in
|
||||
title="确认安装"
|
||||
text="正在准备安装: $packages\n\n若这是您下达的安装指令,请选择确认继续安装"
|
||||
|
||||
# 优先尝试 garma,其次 zenity
|
||||
if command -v garma &> /dev/null; then
|
||||
garma --question --title="$title" --text="$text" \
|
||||
--ok-label="确认安装" --cancel-label="取消" --width=400
|
||||
confirmed=$?
|
||||
elif command -v zenity &> /dev/null; then
|
||||
# 使用 zenity 确认
|
||||
if command -v zenity &> /dev/null; then
|
||||
zenity --question --title="$title" --text="$text" \
|
||||
--ok-label="确认安装" --cancel-label="取消" --width=400
|
||||
confirmed=$?
|
||||
else
|
||||
echo "错误:未找到 garma 或 zenity,无法显示确认对话框。安装操作已拒绝。"
|
||||
echo "错误:未找到 zenity,无法显示确认对话框。安装操作已拒绝。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
alt="星火应用商店"
|
||||
/>
|
||||
<span class="truncate text-base font-semibold">星火应用商店</span>
|
||||
<span
|
||||
class="rounded-full border border-orange-400 bg-orange-50 px-2 py-0.5 text-[10px] font-semibold text-orange-600 dark:border-amber-400/70 dark:bg-amber-400/10 dark:text-amber-300 dark:shadow-[0_0_8px_rgba(251,191,36,0.4)]"
|
||||
>社区版</span
|
||||
<button
|
||||
type="button"
|
||||
class="cursor-pointer rounded-full border border-orange-400 bg-orange-50 px-2 py-0.5 text-[10px] font-semibold text-orange-600 transition hover:bg-orange-100 dark:border-amber-400/70 dark:bg-amber-400/10 dark:text-amber-300 dark:shadow-[0_0_8px_rgba(251,191,36,0.4)] dark:hover:bg-amber-400/20"
|
||||
title="了解星火专业版"
|
||||
@click="openCommercial"
|
||||
>社区版</button
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -75,7 +78,7 @@
|
||||
<div class="mx-1 h-6 w-px bg-slate-300/70 dark:bg-slate-700/70"></div>
|
||||
<button
|
||||
type="button"
|
||||
class="fas fa-window-minimize rounded-md px-3 py-1.5 text-base transition hover:bg-slate-200/80 dark:hover:bg-slate-800"
|
||||
class="fas fa-window-minimize rounded-md px-3 py-1.5 text-base transition text-slate-500 hover:bg-slate-200/80 dark:hover:bg-slate-800"
|
||||
aria-label="最小化"
|
||||
title="最小化"
|
||||
@click="minimize"
|
||||
@@ -83,7 +86,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="fas rounded-md px-3 py-1.5 text-base transition hover:bg-slate-200/80 dark:hover:bg-slate-800"
|
||||
class="fas rounded-md px-3 py-1.5 text-base transition text-slate-500 hover:bg-slate-200/80 dark:hover:bg-slate-800"
|
||||
:class="isMaximized ? 'fa-window-restore' : 'fa-window-maximize'"
|
||||
aria-label="最大化或还原"
|
||||
title="最大化或还原"
|
||||
@@ -92,7 +95,7 @@
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="fas fa-times rounded-md px-3 py-1.5 text-base transition hover:bg-red-500 hover:text-white"
|
||||
class="fas fa-times rounded-md px-3 py-1.5 text-base transition text-slate-500 hover:bg-red-500 hover:text-white"
|
||||
aria-label="关闭"
|
||||
title="关闭"
|
||||
@click="close"
|
||||
@@ -149,6 +152,10 @@ const clearSearch = () => {
|
||||
emit("update:searchQuery", "");
|
||||
};
|
||||
|
||||
const openCommercial = () => {
|
||||
window.open("https://www.spark-app.store/commercial/", "_blank");
|
||||
};
|
||||
|
||||
const minimize = () => {
|
||||
window.windowControls.minimize();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user