Open Settings on Updates from the update prompt; gate Windows-only tools

- Sidebar and topbar update prompts jump straight to Settings → Updates.
- The Settings tab follows an initialTab request, so a later plain Settings
  click still lands on General.
- Hide System maintenance on macOS and keep only the startup tab in
  Permissions, because repairs, privacy traces, optimisation switches,
  context menus and the popup blocker are Windows surfaces.
main
mula.liu 2026-11-25 17:42:16 +08:00
parent 51f9fdb085
commit 90faa9f8bb
6 changed files with 95 additions and 24 deletions

View File

@ -19,6 +19,8 @@ Squid 的重要变更记录在这里。版本号使用语义化版本,日期
- 重复文件支持“本组一份不剩”,删除仍走回收站并可撤销。
- 保留并接入安全扫描、隔离区与白名单机制;安全入口位于“安全”分组。
- 概览页采用新的三列指标布局,所有页面一级标题下不再重复二级描述。
- 主界面的更新提示现在直接打开“设置 → 更新”分区。
- macOS 隐藏仅依赖 Windows 服务的“系统维护”,权限管理只保留开机启动项页签。
## [0.1.11] - 2026-11-22

View File

@ -7,5 +7,7 @@ Squid 0.1.13
- 右键菜单扩展按软件分组,重复文件支持“本组一份不剩”,删除均走回收站。
- 保留安全扫描、隔离区与白名单机制,可在“安全扫描”页和设置的安全分区管理。
- 所有页面一级标题下不再显示二级描述,标题末尾不再带句号。
- 点击主界面的更新提示会直接打开“设置 → 更新”分区。
- macOS 版隐藏仅支持 Windows 的系统维护模块;权限管理保留开机启动项。
macOS 与 Windows 安装包均为未签名构建。macOS 首次打开请在访达中右键选择“打开”;Windows SmartScreen 提示时选择“更多信息” > “仍要运行”。

View File

@ -39,7 +39,7 @@ import { MaintenanceHubPage, type MaintTab } from "./pages/MaintenanceHubPage";
import { OverviewPage } from "./pages/OverviewPage";
import { PermissionsPage } from "./pages/PermissionsPage";
import { SecurityPage } from "./pages/SecurityPage";
import { SettingsPage } from "./pages/SettingsPage";
import { SettingsPage, type SettingsTab } from "./pages/SettingsPage";
import { SpaceHubPage, type SpaceTab } from "./pages/SpaceHubPage";
import { SystemPage } from "./pages/SystemPage";
import { WidgetPage } from "./pages/WidgetPage";
@ -52,6 +52,7 @@ const NAV_GROUPS: {
labelEn: string;
labelZh: string;
icon: typeof LayoutDashboard;
windowsOnly?: boolean;
}[];
}[] = [
{
@ -81,6 +82,7 @@ const NAV_GROUPS: {
labelEn: "System maintenance",
labelZh: "系统维护",
icon: Wrench,
windowsOnly: true,
},
],
},
@ -221,6 +223,7 @@ export default function App() {
// tab; the selection resets on every navigate so a later click re-arms it.
const [spaceTab, setSpaceTab] = useState<SpaceTab>("junk");
const [maintTab, setMaintTab] = useState<MaintTab>("repair");
const [settingsTab, setSettingsTab] = useState<SettingsTab>("general");
const [autostart, setAutostart] = useState(false);
// A process row can ask "where did this come from"; the monitor opens the
// process tab already filtered to that path.
@ -332,7 +335,7 @@ export default function App() {
}, [security]);
useEffect(() => {
const order: PageId[] = [
const order: PageId[] = ([
"overview",
"space",
"applications",
@ -342,12 +345,15 @@ export default function App() {
"system",
"widget",
"history",
];
] as PageId[]).filter(
(id) => id !== "maintenance" || bootstrap?.platform === "windows",
);
// Ctrl/Cmd+1..9 follow the sidebar; 0 opens settings.
const onKey = (event: KeyboardEvent) => {
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) return;
if (event.key === "0") {
event.preventDefault();
setSettingsTab("general");
setPage("settings");
return;
}
@ -358,7 +364,7 @@ export default function App() {
};
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, []);
}, [bootstrap?.platform]);
const changeLanguage = useCallback(
async (nextLanguage: Language) => {
@ -396,6 +402,11 @@ export default function App() {
}
}, [push]);
const openSettings = useCallback((tab: SettingsTab = "general") => {
setSettingsTab(tab);
setPage("settings");
}, []);
if (bootError) return <BootstrapError message={bootError} />;
if (!bootstrap || !settings) return <LoadingScreen />;
@ -411,6 +422,7 @@ export default function App() {
bootstrap={bootstrap}
page={page}
setPage={setPage}
onOpenSettings={openSettings}
updateVersion={activeUpdate?.availableVersion ?? null}
security={security.status}
>
@ -440,12 +452,19 @@ export default function App() {
{page === "applications" ? (
<ApplicationsPage workspace={apps} onHistory={() => setPage("history")} />
) : null}
{page === "permissions" ? <PermissionsPage workspace={permissions} /> : null}
{page === "permissions" ? (
<PermissionsPage workspace={permissions} platform={bootstrap.platform} />
) : null}
{page === "security" ? (
<SecurityPage security={security} onOpenStartup={() => setPage("permissions")} />
) : null}
{page === "widget" ? <WidgetPage /> : null}
{page === "maintenance" ? <MaintenanceHubPage initialTab={maintTab} /> : null}
{page === "maintenance" ? (
<MaintenanceHubPage
initialTab={maintTab}
platform={bootstrap.platform}
/>
) : null}
{page === "system" ? (
<SystemPage
snapshot={system.snapshot}
@ -465,6 +484,7 @@ export default function App() {
flow={update}
autoCheck={autoCheck}
security={security}
initialTab={settingsTab}
onSettingsChange={setSettings}
onLanguageChange={changeLanguage}
onAutoCheckChange={changeAutoCheck}
@ -498,6 +518,7 @@ function AppChrome({
bootstrap,
page,
setPage,
onOpenSettings,
updateVersion,
security,
children,
@ -505,6 +526,7 @@ function AppChrome({
bootstrap: Bootstrap;
page: PageId;
setPage: (page: PageId) => void;
onOpenSettings: (tab?: SettingsTab) => void;
updateVersion: string | null;
security: SecurityStatus | null;
children: ReactNode;
@ -530,7 +552,11 @@ function AppChrome({
<span className="nav-group-label">
{lang === "zh" ? group.labelZh : group.labelEn}
</span>
{group.items.map((item) => {
{group.items
.filter(
(item) => !item.windowsOnly || bootstrap.platform === "windows",
)
.map((item) => {
const Icon = item.icon;
return (
<button
@ -549,7 +575,7 @@ function AppChrome({
) : null}
</button>
);
})}
})}
</div>
))}
</nav>
@ -558,9 +584,7 @@ function AppChrome({
{updateVersion ? (
<button
className="sidebar-update"
onClick={() => {
setPage("settings");
}}
onClick={() => onOpenSettings("updates")}
>
<span>
<Sparkles size={15} />
@ -581,7 +605,7 @@ function AppChrome({
</button>
<button
className={`nav-item ${page === "settings" ? "is-active" : ""}`}
onClick={() => setPage("settings")}
onClick={() => onOpenSettings("general")}
>
<Settings size={18} />
<span>{t("Settings", "设置")}</span>
@ -607,7 +631,10 @@ function AppChrome({
{t("Local & private", "本地与私密")}
</span>
{updateVersion ? (
<button className="topbar-update" onClick={() => setPage("settings")}>
<button
className="topbar-update"
onClick={() => onOpenSettings("updates")}
>
<Sparkles size={13} />
{t("Update", "更新")} {updateVersion}
</button>

View File

@ -1,7 +1,7 @@
import { EyeOff, SlidersHorizontal, Wrench } from "lucide-react";
import { useEffect, useState } from "react";
import { useI18n } from "../i18n";
import { PageHeader } from "../components/ui";
import { EmptyState, PageHeader } from "../components/ui";
import { MaintenancePage } from "./MaintenancePage";
import { PrivacyPage } from "./PrivacyPage";
import { OptimizationPage } from "./OptimizationPage";
@ -18,7 +18,13 @@ const TABS: { id: MaintTab; icon: typeof Wrench; en: string; zh: string }[] = [
{ id: "optimize", icon: SlidersHorizontal, en: "System optimisation", zh: "系统优化" },
];
export function MaintenanceHubPage({ initialTab = "repair" }: { initialTab?: MaintTab }) {
export function MaintenanceHubPage({
initialTab = "repair",
platform,
}: {
initialTab?: MaintTab;
platform?: string;
}) {
const { t } = useI18n();
const [tab, setTab] = useState<MaintTab>(initialTab);
useEffect(() => setTab(initialTab), [initialTab]);
@ -26,6 +32,25 @@ export function MaintenanceHubPage({ initialTab = "repair" }: { initialTab?: Mai
const report = (id: MaintTab) => (value: string | null) =>
setBadges((current) => (current[id] === value ? current : { ...current, [id]: value }));
// Repairs, privacy traces and optimisation switches are all Windows
// registry / command surfaces. Say so instead of offering buttons that
// can only answer "not available on this platform".
if (platform !== "windows") {
return (
<div className="page hub-page">
<PageHeader title={t("System maintenance", "系统维护")} />
<EmptyState
icon={<Wrench size={30} />}
title={t("Windows only", "目前仅支持 Windows")}
description={t(
"Repairs, privacy traces and optimisation switches rely on Windows services and the registry. macOS keeps the security scan, startup items and cleanup tools.",
"一键修复、隐私清理与系统优化依赖 Windows 服务与注册表。macOS 版保留安全扫描、启动项与清理工具。",
)}
/>
</div>
);
}
return (
<div className="page hub-page">
<PageHeader

View File

@ -103,7 +103,13 @@ function GroupIcon({
);
}
export function PermissionsPage({ workspace }: { workspace: PermissionsWorkspace }) {
export function PermissionsPage({
workspace,
platform,
}: {
workspace: PermissionsWorkspace;
platform?: string;
}) {
const { t } = useI18n();
const [query, setQuery] = useState("");
const [openGroups, setOpenGroups] = useState<Set<string>>(new Set());
@ -114,9 +120,8 @@ export function PermissionsPage({ workspace }: { workspace: PermissionsWorkspace
const [removingIds, setRemovingIds] = useState<string[] | null>(null);
const view = workspace.view;
const tabs = useMemo(
() =>
[
const tabs = useMemo(() => {
const all = [
{
id: "startup" as const,
label: t("Startup items", "开机启动项"),
@ -141,9 +146,11 @@ export function PermissionsPage({ workspace }: { workspace: PermissionsWorkspace
count: view?.rules.length ?? 0,
fresh: false,
},
],
[t, view, workspace.advanced],
);
];
// Context menus, advanced autostart hooks and the popup blocker are
// Windows shell surfaces; macOS only has login/background startup items.
return platform === "windows" ? all : all.filter((item) => item.id === "startup");
}, [platform, t, view, workspace.advanced]);
if (!view && workspace.scanning) {
return (

View File

@ -41,7 +41,7 @@ import {
useToast,
} from "../components/ui";
type SettingsTab = "general" | "cleanup" | "security" | "updates" | "about";
export type SettingsTab = "general" | "cleanup" | "security" | "updates" | "about";
const SETTINGS_TABS: {
id: SettingsTab;
@ -62,6 +62,7 @@ export function SettingsPage({
flow,
autoCheck,
security,
initialTab = "general",
onSettingsChange,
onLanguageChange,
onAutoCheckChange,
@ -71,13 +72,14 @@ export function SettingsPage({
flow: UpdateFlow;
autoCheck: boolean;
security: SecurityWorkspace;
initialTab?: SettingsTab;
onSettingsChange: (settings: SettingsView) => void;
onLanguageChange: (language: Language) => Promise<void>;
onAutoCheckChange: (enabled: boolean) => void;
}) {
const { t, lang, bin } = useI18n();
const { push } = useToast();
const [tab, setTab] = useState<SettingsTab>("general");
const [tab, setTab] = useState<SettingsTab>(initialTab);
const [whitelistInput, setWhitelistInput] = useState("");
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
@ -90,6 +92,12 @@ export function SettingsPage({
const [audit, setAudit] = useState<Map<string, boolean> | null>(null);
const [auditing, setAuditing] = useState(false);
// The sidebar/topbar update prompt opens Settings on its Updates section;
// a later plain Settings click asks for General and lands there.
useEffect(() => {
setTab(initialTab);
}, [initialTab]);
const runAudit = useCallback(async () => {
setAuditing(true);
try {