[bugfix] use static config for bs-version writing/reading for linux

This commit is contained in:
silentrald
2025-01-16 23:42:10 +08:00
parent dc3ae1971d
commit 0c3a5b9e75
5 changed files with 2 additions and 30 deletions
-4
View File
@@ -1,6 +1,2 @@
# Add write permissions to anybody so that this can be sync with the
# github's bs-versions.json when starting bsmanager
/usr/bin/chmod +002 /opt/BSManager/resources/assets/jsons/bs-versions.json
# https://github.com/electron/electron/issues/42510
/usr/bin/chmod 4755 /opt/BSManager/chrome-sandbox
-1
View File
@@ -49,7 +49,6 @@ Guidance on fixing errors during setup or version updates
- __🐧Linux__:
- [Missing Icons in Game]([Linux]-Missing-Icons-in-Game)
- [Permission Denied on "bs-versions.json"]([Linux]-Permission-Denied-on-bs-version.json)
- [[Deb] The SUID Sandbox Helper Binary Was Found]([Linux]-[deb]-The-SUID-Sandbox-Helper-Binary-Was-Found)
- [[Flatpak] Steam Beat Saber Version Not Showing / Proton Not Detected]([Linux]-[Flatpak]-Steam-Beat-Saber-Version-Not-Showing-Proton-Not-Detected)
- [[Flatpak] Changing Installation Folder]([Linux]-[Flatpak]-Changing-Installation-Folder)
@@ -1,13 +0,0 @@
<pre>
Unhandled Exception UnhandledRejection Error: EACCES: permission denied, open '/opt/BSManager/resources/assets/jsons/bs-versions.json'
</pre>
To fix this issue, the current user must have write permissions to the "bs-versions.json". To correct the permissions do command below:
```bash
chmod +002 /opt/BSManager/resources/assets/jsons/bs-versions.json
# or
chown $(whoami) /opt/BSManager/resources/assets/jsons/bs-versions.json
```
-1
View File
@@ -71,7 +71,6 @@
<summary>🐧 Linux</summary>
<ul>
<li><a href="%5BLinux%5D-Missing-Icons-in-Game">Missing Icons in Game</a></li>
<li><a href="%5BLinux%5D-Permission-Denied-on-bs-version.json">Permission Denied on "bs-versions.json"</a></li>
<li><a href="%5BLinux%5D-%5Bdeb%5D-The-SUID-Sandbox-Helper-Binary-Was-Found">[Deb] The SUID Sandbox Helper Binary Was Found</a></li>
<li><a href="%5BLinux%5D-%5BFlatpak%5D-Steam-Beat-Saber-Version-Not-Showing-Proton-Not-Detected">[Flatpak] Steam Beat Saber Version Not Showing / Proton Not Detected</a></li>
<li><a href="%5BLinux%5D-%5BFlatpak%5D-Changing-Installation-Folder">[Flatpak] Changing Installation Folder</a></li>
+2 -11
View File
@@ -5,8 +5,6 @@ import { BSVersion } from "shared/bs-version.interface";
import { RequestService } from "./request.service";
import { readJSON } from "fs-extra";
import { allSettled } from "../../shared/helpers/promise.helpers";
import { LinuxService } from "./linux.service";
import { IS_FLATPAK } from "main/constants";
import { StaticConfigurationService } from "./static-configuration.service";
export class BSVersionLibService {
@@ -15,7 +13,6 @@ export class BSVersionLibService {
private static instance: BSVersionLibService;
private readonly linuxService: LinuxService;
private readonly utilsService: UtilsService;
private readonly requestService: RequestService;
private readonly configService: StaticConfigurationService;
@@ -23,7 +20,6 @@ export class BSVersionLibService {
private bsVersions: BSVersion[];
private constructor() {
this.linuxService = LinuxService.getInstance();
this.utilsService = UtilsService.getInstance();
this.requestService = RequestService.getInstance();
this.configService = StaticConfigurationService.getInstance();
@@ -40,15 +36,10 @@ export class BSVersionLibService {
return this.requestService.getJSON<BSVersion[]>(this.REMOTE_BS_VERSIONS_URL).then(res => res.data);
}
private async shouldLoadFromConfig(): Promise<boolean> {
// Some special cases of readonly memory installations
return process.platform === "linux" && (IS_FLATPAK || this.linuxService.isNixOS());
}
private async getLocalVersions(): Promise<BSVersion[]> {
const localVersionsPath = path.join(this.utilsService.getAssestsJsonsPath(), this.VERSIONS_FILE);
if (!(await this.shouldLoadFromConfig())) {
if (process.platform !== "linux") {
return readJSON(localVersionsPath);
}
@@ -60,7 +51,7 @@ export class BSVersionLibService {
}
private async updateLocalVersions(versions: BSVersion[]): Promise<void> {
if (await this.shouldLoadFromConfig()) {
if (process.platform === "linux") {
this.configService.set("versions", versions);
return;
}