Skip to content

Commit 6aef200

Browse files
committed
fix: resolve self-update permission issues
1 parent 91db1a5 commit 6aef200

File tree

14 files changed

+171
-168
lines changed

14 files changed

+171
-168
lines changed

build/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ info:
1111
description: "A Minecraft Launcher" # The application description
1212
copyright: "(c) 2025, LeviMC" # Copyright text
1313
comments: "Some Product Comments" # Comments
14-
version: "0.0.7" # The application version
14+
version: "0.0.8" # The application version
1515
beta: true # Whether the application is in beta or not
1616

1717
# Dev mode configuration

build/darwin/Info.dev.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<key>CFBundleIdentifier</key>
1111
<string>org.levimc.launcher</string>
1212
<key>CFBundleVersion</key>
13-
<string>0.0.7</string>
13+
<string>0.0.8</string>
1414
<key>CFBundleGetInfoString</key>
1515
<string>Some Product Comments</string>
1616
<key>CFBundleShortVersionString</key>
17-
<string>0.0.7</string>
17+
<string>0.0.8</string>
1818
<key>CFBundleIconFile</key>
1919
<string>icons</string>
2020
<key>LSMinimumSystemVersion</key>

build/darwin/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<key>CFBundleIdentifier</key>
1111
<string>org.levimc.launcher</string>
1212
<key>CFBundleVersion</key>
13-
<string>0.0.7</string>
13+
<string>0.0.8</string>
1414
<key>CFBundleGetInfoString</key>
1515
<string>Some Product Comments</string>
1616
<key>CFBundleShortVersionString</key>
17-
<string>0.0.7</string>
17+
<string>0.0.8</string>
1818
<key>CFBundleIconFile</key>
1919
<string>icons</string>
2020
<key>LSMinimumSystemVersion</key>

build/linux/nfpm/nfpm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
name: "LeviLauncher"
77
arch: ${GOARCH}
88
platform: "linux"
9-
version: "0.0.7"
9+
version: "0.0.8"
1010
section: "default"
1111
priority: "extra"
1212
maintainer: ${GIT_COMMITTER_NAME} <${GIT_COMMITTER_EMAIL}>

build/windows/info.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"fixed": {
3-
"file_version": "0.0.7"
3+
"file_version": "0.0.8"
44
},
55
"info": {
66
"0000": {
7-
"ProductVersion": "0.0.7",
7+
"ProductVersion": "0.0.8",
88
"CompanyName": "LeviMC",
99
"FileDescription": "A Minecraft Launcher",
1010
"LegalCopyright": "(c) 2025, LeviMC",

build/windows/nsis/wails_tools.nsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
!define INFO_PRODUCTNAME "LeviLauncher"
1515
!endif
1616
!ifndef INFO_PRODUCTVERSION
17-
!define INFO_PRODUCTVERSION "0.0.7"
17+
!define INFO_PRODUCTVERSION "0.0.8"
1818
!endif
1919
!ifndef INFO_COPYRIGHT
2020
!define INFO_COPYRIGHT "(c) 2025, LeviMC"

build/windows/wails.exe.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
22
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
3-
<assemblyIdentity type="win32" name="org.levimc.launcher" version="0.0.7" processorArchitecture="*"/>
3+
<assemblyIdentity type="win32" name="org.levimc.launcher" version="0.0.8" processorArchitecture="*"/>
44
<dependency>
55
<dependentAssembly>
66
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>

frontend/src/App.tsx

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { SettingsPage } from "./pages/SettingsPage";
2828
import { VersionSelectPage } from "./pages/VersionSelectPage";
2929
import VersionSettingsPage from "./pages/VersionSettingsPage";
3030
import ModsPage from "./pages/ModsPage";
31+
import UpdatingPage from "./pages/UpdatingPage";
3132
import FileManagerPage from "./pages/FileManagerPage";
3233
import ContentPage from "./pages/ContentPage";
3334
import WorldsListPage from "./pages/WorldsListPage";
@@ -41,7 +42,6 @@ import ReactMarkdown from "react-markdown";
4142
import remarkGfm from "remark-gfm";
4243

4344
function App() {
44-
// Splash visibility + reveal orchestration for smoother transition
4545
const [splashVisible, setSplashVisible] = useState(true);
4646
const [revealStarted, setRevealStarted] = useState(false);
4747
const [isFirstLoad, setIsFirstLoad] = useState(false);
@@ -57,8 +57,6 @@ function App() {
5757
const [updateBody, setUpdateBody] = useState<string>("");
5858
const [updateLoading, setUpdateLoading] = useState<boolean>(false);
5959

60-
// language selection moved into Settings modal
61-
6260
const refresh = () => {
6361
setCount((prevCount) => {
6462
return prevCount + 1;
@@ -71,11 +69,21 @@ function App() {
7169
});
7270
};
7371

72+
const location = useLocation();
73+
const navigate = useNavigate();
74+
const isUpdatingMode = String(location?.pathname || "") === "/updating";
75+
useEffect(() => {
76+
if (isUpdatingMode) setNavLocked(true);
77+
}, [isUpdatingMode]);
78+
7479
useEffect(() => {
75-
// Let splash show briefly, then fade overlay out.
76-
// Only reveal header after overlay fade completes to avoid visual overlap.
80+
if (isUpdatingMode) {
81+
setSplashVisible(false);
82+
setRevealStarted(true);
83+
return;
84+
}
7785
const splashDurationMs = 1400;
78-
const overlayFadeMs = 600; // matches AnimatePresence exit duration
86+
const overlayFadeMs = 600;
7987

8088
setIsFirstLoad(false);
8189

@@ -88,50 +96,34 @@ function App() {
8896
clearTimeout(tHide);
8997
clearTimeout(tHeader);
9098
};
91-
}, []);
99+
}, [isUpdatingMode]);
92100

93-
// Listen for nav lock changes triggered by InstallPage
94101
useEffect(() => {
95102
try {
96103
setNavLocked(Boolean((window as any).llNavLock));
97104
} catch {}
98105
const handler = (e: any) => {
99106
try {
107+
if (isUpdatingMode) return;
100108
setNavLocked(Boolean(e?.detail?.lock ?? (window as any).llNavLock));
101109
} catch {}
102110
};
103111
window.addEventListener("ll-nav-lock-changed", handler as any);
104112
return () =>
105113
window.removeEventListener("ll-nav-lock-changed", handler as any);
106-
}, []);
114+
}, [isUpdatingMode]);
107115

108-
// First-launch Terms modal gating (after splash & header reveal)
109116
useEffect(() => {
117+
if (!hasBackend) return;
118+
if (!revealStarted) return;
119+
if (isUpdatingMode) return;
110120
try {
111121
const accepted = localStorage.getItem("ll.termsAccepted");
112-
if (!accepted && revealStarted) {
122+
if (!accepted) {
113123
setTermsOpen(true);
114124
setNavLocked(true);
125+
return;
115126
}
116-
} catch {}
117-
}, [revealStarted]);
118-
119-
// Terms modal: start 10s countdown when opened to prevent instant accept
120-
useEffect(() => {
121-
if (!termsOpen) return;
122-
setTermsCountdown(10);
123-
const iv = setInterval(() => {
124-
setTermsCountdown((v) => (v > 0 ? v - 1 : 0));
125-
}, 1000);
126-
return () => clearInterval(iv);
127-
}, [termsOpen]);
128-
129-
// Startup update check (after splash & terms)
130-
useEffect(() => {
131-
if (!hasBackend) return;
132-
if (!revealStarted) return;
133-
if (termsOpen) return;
134-
try {
135127
const ignored = localStorage.getItem("ll.ignoreVersion") || "";
136128
minecraft?.CheckUpdate?.()
137129
.then((res: any) => {
@@ -147,9 +139,19 @@ function App() {
147139
})
148140
.catch(() => {});
149141
} catch {}
150-
}, [hasBackend, revealStarted, termsOpen]);
142+
}, [hasBackend, revealStarted, isUpdatingMode]);
143+
144+
useEffect(() => {
145+
if (!termsOpen) return;
146+
setTermsCountdown(10);
147+
const iv = setInterval(() => {
148+
setTermsCountdown((v) => (v > 0 ? v - 1 : 0));
149+
}, 1000);
150+
return () => clearInterval(iv);
151+
}, [termsOpen]);
152+
153+
151154

152-
// Lock background scroll when update modal is open
153155
useEffect(() => {
154156
try {
155157
if (updateOpen) {
@@ -192,10 +194,8 @@ function App() {
192194
} catch {}
193195
}, [hasBackend]);
194196

195-
const location = useLocation();
196-
const navigate = useNavigate();
197+
197198

198-
// 全局兜底:注册 msixvc 下载事件监听,防止后端提示“无监听器”
199199
useEffect(() => {
200200
if (!hasBackend) return;
201201

@@ -219,7 +219,6 @@ function App() {
219219
};
220220
}, [hasBackend]);
221221

222-
// Global: prevent browser default on file drag/drop anywhere in the app
223222
useEffect(() => {
224223
const isFileDrag = (e: DragEvent) => {
225224
try {
@@ -253,7 +252,6 @@ function App() {
253252

254253
return (
255254
<VersionStatusProvider>
256-
{/* Splash overlay with animated exit */}
257255
<AnimatePresence>
258256
{splashVisible && (
259257
<motion.div
@@ -430,7 +428,6 @@ function App() {
430428
</div>
431429
</motion.div>
432430

433-
{/* spacer to offset fixed top bar height */}
434431
<div className="h-[68px]" />
435432

436433
<motion.div
@@ -461,6 +458,7 @@ function App() {
461458
element={<VersionSettingsPage />}
462459
/>
463460
<Route path="/mods" element={<ModsPage />} />
461+
<Route path="/updating" element={<UpdatingPage />} />
464462
<Route path="/filemanager" element={<FileManagerPage />} />
465463
<Route path="/content" element={<ContentPage />} />
466464
<Route path="/content/worlds" element={<WorldsListPage />} />
@@ -476,7 +474,6 @@ function App() {
476474
))}
477475
</motion.div>
478476

479-
{/* First-launch Terms Modal (priority over other modals) */}
480477
<Modal
481478
size="lg"
482479
isOpen={termsOpen}
@@ -523,7 +520,6 @@ function App() {
523520
</ModalContent>
524521
</Modal>
525522

526-
{/* Update Modal */}
527523
<Modal size="md" isOpen={updateOpen} hideCloseButton>
528524
<ModalContent>
529525
{(onClose) => (

frontend/src/assets/locales/en_US.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121
},
122122
"manage": "Manage Mods"
123123
},
124+
"updating": {
125+
"title": "Updating LeviLauncher",
126+
"body": "Requesting administrator permission and performing update. Do not close this window during update.",
127+
"failed_title": "Update Failed"
128+
},
124129
"downloadpage": {
125130
"type": {
126131
"install": "Install",

frontend/src/assets/locales/zh_CN.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@
114114
"drag_import_unsupported": "拖拽导入暂不支持,请使用“导入 .zip/.dll”或文件管理器。"
115115
}
116116
},
117+
"updating": {
118+
"title": "正在更新 LeviLauncher",
119+
"body": "正在请求管理员权限并执行更新。更新期间请勿关闭窗口。",
120+
"failed_title": "更新失败"
121+
},
117122
"moddedcard": {
118123
"title": "模组",
119124
"content": {

0 commit comments

Comments
 (0)