Merge pull request #646 from Zagrios/revert/changelogs-modal

[revert] revert changelogs modal feature
This commit is contained in:
MathieuG-P
2024-11-06 15:40:33 +01:00
committed by GitHub
17 changed files with 6 additions and 247 deletions
-14
View File
@@ -1,14 +0,0 @@
{
"1.5.0-alpha.1":{
"htmlBody" :"<strong>BSManager continues to get better, thanks to your continued support and contributions!</strong><center>🎈🎉🎈</center><p>Note: This is an alpha release, encountering bugs is expected. Please file new issues for any bugs you find.</p><h2>Features</h2><ul><li>Added playlist support</li><li>Added Linux support (Thanks to @Insprill)</li><li>Added reset button to reset values when editing a Beat Saber version (Thanks to @Liborsaf)</li><li>Added a changelog modal</li></ul><h2>Fixes</h2><ul><li>Fixed an issue where switching between Beat Saber versions too quickly displayed mods for the wrong version</li><li>Fixed an issue where the launch window from a shortcut would never close</li><li>Advanced launch arguments are used even when the input field is closed</li><li>Fixed an issue where having many maps caused some maps to not have their information loaded</li></ul><h2>Other changes</h2><ul><li>.NET Framework is no longer required</li><li>Clear English translations for the Steam credentials popup (Thanks to @Aeywoo)</li><li>NSFW models are now blurred when browsing for models</li><li>When no mods are available for a Beat Saber version, the version number is now shown</li><li>Mods load faster</li><li>After a first full maps loading, maps load almost instantly</li><li>Improved performance in lists with lot of contents</li></ul>",
"title" : "What's new ?",
"timestamp" : 1721048400,
"version" : "1.5.0-alpha.1"
},
"1.5.0-alpha.2":{
"htmlBody" :"<strong>BSManager continues to get better, thanks to your continued support and contributions!</strong><center>🎈🎉🎈</center><p>Note: This is an alpha release, encountering bugs is expected. Please file new issues for any bugs you find.</p><h4>Alpha changes</h4><ul><li>Fixed an issue where BSIPA could not be installed if the BS version&#39;s path contained spaces #523</li><li>Fixed a crash when changing audio volume #518</li><li>Fixed an issue where playlist maps with a malformed hash were not loaded #517</li><li>Improved reliability of reading maps from a playlist file #517</li><li>Playlists in sub-folders are now loaded #514</li><li>Fixed a crash when loading an invalid playlist file #513</li></ul><h2>Features</h2><ul> <li>Added playlist support</li> <li>Added Linux support (Thanks to @Insprill)</li> <li>Added reset button to reset values when editing a Beat Saber version (Thanks to @Liborsaf)</li> <li>Added a changelog modal</li></ul><h3>Fixes</h3><ul><li>Fixed an issue where switching between Beat Saber versions too quickly displayed mods for the wrong version #472</li><li>Fixed an issue where the launch window from a shortcut would never close #485</li><li>Advanced launch arguments are used even when the input field is closed #496</li><li>Fixed an issue where having many maps caused some maps to not have their information loaded #503</li><li>Fixed an issue where downloading maps sometimes resulted in a timeout error #524</li><li>Fixed an issue where the duration of maps could be wrong in some cases #522</li></ul><h2>Other changes</h2><ul> <li>.NET Framework is no longer required</li> <li>Clear English translations for the Steam credentials popup (Thanks to @Aeywoo)</li> <li>NSFW models are now blurred when browsing for models</li> <li>When no mods are available for a Beat Saber version, the version number is now shown</li> <li>Mods load faster</li> <li>After a first full maps loading, maps load almost instantly</li> <li>Improved performance in lists with lot of contents</li></ul>",
"title" : "What's new ?",
"timestamp" : 1721665382,
"version" : "1.5.0-alpha.2"
}
}
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "Protokolle öffnen"
}
},
"changelogs": {
"open" : "🚀 Neues im Changelog entdecken!",
"not-founds": "😕 Hoppla, kein Changelog zu sehen!"
},
"advanced": {
"title": "Erweiterte",
"description": "Erweiterte Einstellungen für BSManager.",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "Open logs"
}
},
"changelogs": {
"open": "🚀 Check Out the Changelog!",
"not-founds": "😕 Oops, No Changelog Here!"
},
"advanced": {
"title": "Advanced",
"description": "Advanced settings for BSManager.",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "Abrir los registros"
}
},
"changelogs": {
"open": "🚀 ¡Descubre lo nuevo en el Changelog!",
"not-founds": "😕 Uy, ¡Changelog no encontrado!"
},
"advanced": {
"title": "Avanzados",
"description": "Configuraciones avanzadas para BSManager.",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "Ouvrir les logs"
}
},
"changelogs": {
"open" : "🚀 Jetez un œil au Changelog !",
"not-founds": "😕 Oups, Changelog introuvable !"
},
"advanced": {
"title": "Avancés",
"description": "Paramètres avancés pour BSManager.",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "ログを表示"
}
},
"changelogs": {
"open" : "🚀 チェンジログを覗いてみて!",
"not-founds": "😕 あれ、チェンジログが見当たらない!"
},
"advanced": {
"title": "高度な設定",
"description": "BSManagerの高度な設定。",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "로그 보기"
}
},
"changelogs": {
"open": "🚀 변경 로그를 확인해보세요!",
"not-founds": "😕 변경 로그가 보이지 않습니다!"
},
"advanced": {
"title": "고급 설정",
"description": "BSManager의 고급 설정입니다.",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "Открыть логи"
}
},
"changelogs": {
"open" : "🚀 Изучаем Changelog!",
"not-founds": "😕 Ой, Changelog нигде не видно!"
},
"advanced": {
"title": "Дополнительные",
"description": "Дополнительные настройки для BSManager.",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "打開日誌"
}
},
"changelogs": {
"open" : "🚀 探索更新日誌!",
"not-founds": "😕 噢,找不到更新日誌!"
},
"advanced": {
"title": "高级设置",
"description": "BSManager的高级设置。",
-4
View File
@@ -228,10 +228,6 @@
"open-logs": "打开日志"
}
},
"changelogs": {
"open" : "🚀 探索更新日志!",
"not-founds": "😕 哎呀,找不到更新日志!"
},
"advanced": {
"title": "高级设置",
"description": "BSManager的高级设置。",
-22
View File
@@ -20,7 +20,6 @@
"color": "^4.2.3",
"crypto-js": "^4.2.0",
"dateformat": "^5.0.3",
"dompurify": "^3.0.9",
"dot-prop": "^8.0.2",
"electron-debug": "^3.2.0",
"electron-log": "^4.4.8",
@@ -76,7 +75,6 @@
"@types/color": "^3.0.3",
"@types/crypto-js": "^4.2.1",
"@types/dateformat": "^5.0.0",
"@types/dompurify": "^3.0.5",
"@types/got": "^9.6.12",
"@types/jest": "^29.5.11",
"@types/node": "22.8.6",
@@ -6106,15 +6104,6 @@
"@types/ms": "*"
}
},
"node_modules/@types/dompurify": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz",
"integrity": "sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==",
"dev": true,
"dependencies": {
"@types/trusted-types": "*"
}
},
"node_modules/@types/eslint": {
"version": "8.4.10",
"dev": true,
@@ -6540,12 +6529,6 @@
"integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
"dev": true
},
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"dev": true
},
"node_modules/@types/use-double-click": {
"version": "1.0.4",
"dev": true,
@@ -10616,11 +10599,6 @@
"url": "https://github.com/fb55/domhandler?sponsor=1"
}
},
"node_modules/dompurify": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.9.tgz",
"integrity": "sha512-uyb4NDIvQ3hRn6NiC+SIFaP4mJ/MdXlvtunaqK9Bn6dD3RuB/1S/gasEjDHD8eiaqdSael2vBv+hOs7Y+jhYOQ=="
},
"node_modules/domutils": {
"version": "2.8.0",
"dev": true,
-2
View File
@@ -156,7 +156,6 @@
"@types/color": "^3.0.3",
"@types/crypto-js": "^4.2.1",
"@types/dateformat": "^5.0.0",
"@types/dompurify": "^3.0.5",
"@types/got": "^9.6.12",
"@types/jest": "^29.5.11",
"@types/node": "22.8.6",
@@ -241,7 +240,6 @@
"color": "^4.2.3",
"crypto-js": "^4.2.0",
"dateformat": "^5.0.3",
"dompurify": "^3.0.9",
"dot-prop": "^8.0.2",
"electron-debug": "^3.2.0",
"electron-log": "^4.4.8",
@@ -1,3 +0,0 @@
.content * {
all: revert;
}
@@ -1,50 +0,0 @@
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { ChangelogVersion } from "renderer/services/auto-updater.service";
import { LinkOpenerService } from "renderer/services/link-opener.service";
import { useService } from "renderer/hooks/use-service.hook";
import { ModalComponent } from "renderer/services/modale.service";
import DOMPurify from 'dompurify';
import './changelog-modal.component.css';
import Tippy from "@tippyjs/react";
export const ChangelogModal: ModalComponent<void, ChangelogVersion> = ({ options: {data: changelog} }) => {
const linkOpener = useService(LinkOpenerService);
const openGithub = () => linkOpener.open("https://github.com/Zagrios/bs-manager");
const openTwitter = () => linkOpener.open("https://twitter.com/BSManager_");
const openSupportPage = () => linkOpener.open("https://www.patreon.com/bsmanager");
const openDiscord = () => linkOpener.open("https://discord.gg/uSqbHVpKdV");
const openWebSite = () => linkOpener.open("https://bsmanager.io/");
const date = changelog?.timestamp ? new Date(changelog.timestamp * 1000).toLocaleDateString() : '';
return (
<form className="w-[350px] text-gray-800 dark:text-gray-200 h-[70vh] flex flex-col justify-between">
<h1 className=" p-4 pt-1 text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200 font-bold">{changelog?.title}</h1>
<div className=" overflow-y-scroll h-full content grow scrollbar-default" dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(changelog?.htmlBody) }}/>
<span className="block w-[100%] mx-auto mt-0 mb-4 h-1 rounded-full bg-main-color-1" />
<div className="flex flex-row justify-between">
<div className="my-auto flex flex-col text-sm">
<span>{date}</span>
<span>v{changelog?.version}</span>
</div>
<div className="flex flex-row gap-2 my-auto">
<Tippy content="Twitter" placement="top" className="font-bold !bg-neutral-900" duration={[200, 0]} arrow={false}>
<div><BsmButton onClick={openTwitter} className="rounded-md p-1 w-7 h-7" icon="twitter" withBar={false} iconColor="#fff" color="#000"/></div>
</Tippy>
<Tippy content="Github" placement="top" className="font-bold !bg-neutral-900" duration={[200, 0]} arrow={false}>
<div><BsmButton onClick={openGithub} className="rounded-md p-1 w-7 h-7" icon="github" withBar={false} iconColor="#fff" color="#000"/></div>
</Tippy>
<Tippy content="Discord" placement="top" className="font-bold !bg-neutral-900" duration={[200, 0]} arrow={false}>
<div><BsmButton onClick={openDiscord} className="rounded-md p-1 w-7 h-7" icon="discord" withBar={false} iconColor="#fff" color="#000"/></div>
</Tippy>
<Tippy content="Patreon" placement="top" className="font-bold !bg-neutral-900" duration={[200, 0]} arrow={false}>
<div><BsmButton onClick={openSupportPage} className="rounded-md p-1 w-7 h-7 " icon="patreon" withBar={false} iconColor="#fff" color="#000"/></div>
</Tippy>
<Tippy content="Web Site" placement="top" className="font-bold !bg-neutral-900" duration={[200, 0]} arrow={false}>
<div><BsmButton onClick={openWebSite} className="rounded-md p-1 w-7 h-7 " icon="web-site" withBar={false} iconColor="#fff" color="#000"/></div>
</Tippy>
</div>
</div>
</form>
)
}
+4 -32
View File
@@ -39,15 +39,13 @@ import { BsStore } from "shared/models/bs-store.enum";
import { SteamIcon } from "renderer/components/svgs/icons/steam-icon.component";
import { OculusIcon } from "renderer/components/svgs/icons/oculus-icon.component";
import { BsDownloaderService } from "renderer/services/bs-version-download/bs-downloader.service";
import { AutoUpdaterService } from "renderer/services/auto-updater.service";
import BeatWaitingImg from "../../../assets/images/apngs/beat-waiting.png";
import BeatConflict from "../../../assets/images/apngs/beat-conflict.png";
import { logRenderError } from "renderer";
import { SettingToogleSwitchGrid } from "renderer/components/settings/setting-toogle-switch-grid.component";
import { BasicModal } from "renderer/components/modal/basic-modal.component";
import { StaticConfigurationService } from "renderer/services/static-configuration.service";
import { tryit } from "shared/helpers/error.helpers";
import { InstallationLocationService } from "renderer/services/installation-location.service";
import { AutoUpdaterService } from "renderer/services/auto-updater.service";
export function SettingsPage() {
@@ -65,9 +63,9 @@ export function SettingsPage() {
const playlistsManager = useService(PlaylistsManagerService);
const modelsManager = useService(ModelsManagerService);
const versionLinker = useService(VersionFolderLinkerService);
const autoUpdater = useService(AutoUpdaterService);
const staticConfig = useService(StaticConfigurationService);
const installationLocationService = useService(InstallationLocationService);
const autoUpdater = useService(AutoUpdaterService);
const { firstColor, secondColor } = useThemeColor();
@@ -100,10 +98,7 @@ export function SettingsPage() {
const [hasDownloaderSession, setHasDownloaderSession] = useState(false);
const [hardwareAccelerationEnabled, setHardwareAccelerationEnabled] = useState(true);
const [useSymlink, setUseSymlink] = useState(false);
const appVersion = useObservable(() => ipcService.sendV2("current-version"));
const [isChangelogAvailable, setIsChangelogAvailable] = useState(true);
const [changlogsLoading, setChanglogsLoading] = useState(false);
const appVersion = useObservable(() => autoUpdater.getAppVersion());
useEffect(() => {
loadInstallationFolder();
@@ -161,24 +156,6 @@ export function SettingsPage() {
i18nService.setLanguage(item.value);
};
const handleVersionClick = async () => {
let isChangelogResolved = false;
const timeoutId = setTimeout(() => setChanglogsLoading(() => !isChangelogResolved), 100);
await autoUpdater.showChangelog(await lastValueFrom(autoUpdater.getAppVersion()))
.then(() => {
setIsChangelogAvailable(() => true);
})
.catch(err => {
logRenderError(err);
setIsChangelogAvailable(() => false);
})
.finally(() => { isChangelogResolved = true; });
setChanglogsLoading(() => false);
clearTimeout(timeoutId);
};
const setDefaultProtonFolder = async () => {
if (!progressBarService.require()) {
return;
@@ -605,12 +582,7 @@ export function SettingsPage() {
]}/>
</SettingContainer>
<Tippy content={isChangelogAvailable ? t("pages.settings.changelogs.open") : t("pages.settings.changelogs.not-founds")} placement="left" className="font-bold bg-main-color-3">
<div className="!bg-light-main-color-1 dark:!bg-main-color-1 rounded-md py-1 px-2 font-bold float-right mb-5 hover:brightness-125 h-auto w-auto">
<BsmButton onClick={handleVersionClick} text={`v${appVersion}`} withBar={false} typeColor="none"/>
</div>
</Tippy>
<BsmImage className={`h-7 my-auto spin-loading float-right ${changlogsLoading ? "" : "hidden"}`} image={BeatWaitingImg} loading="eager" />
<span className="bg-light-main-color-1 dark:bg-main-color-1 rounded-md py-1 px-2 font-bold float-right mb-5">v{appVersion}</span>
</div>
<SupportersView isVisible={showSupporters} setVisible={setShowSupporters} />
</div>
@@ -1,8 +1,5 @@
import { IpcService } from "./ipc.service";
import { ProgressBarService } from "./progress-bar.service";
import { ModalService } from "renderer/services/modale.service";
import { ChangelogModal } from "renderer/components/modal/modal-types/chabgelog-modal/changelog-modal.component";
import { ConfigurationService } from "./configuration.service";
import { Observable, lastValueFrom } from "rxjs";
import { Progression } from "main/helpers/fs.helpers";
@@ -22,12 +19,6 @@ export class AutoUpdaterService {
private progressService: ProgressBarService;
private ipcService: IpcService;
private modal: ModalService;
private configurationService: ConfigurationService;
private cacheChangelog: Changelog;
public static getInstance(): AutoUpdaterService {
if (!AutoUpdaterService.instance) {
AutoUpdaterService.instance = new AutoUpdaterService();
@@ -38,8 +29,6 @@ export class AutoUpdaterService {
private constructor() {
this.progressService = ProgressBarService.getInstance();
this.ipcService = IpcService.getInstance();
this.modal = ModalService.getInstance();
this.configurationService = ConfigurationService.getInstance();
}
public isUpdateAvailable(): Promise<boolean> {
@@ -64,56 +53,8 @@ export class AutoUpdaterService {
return lastValueFrom(this.ipcService.sendV2("install-update"));
}
public getLastAppVersion(): string {
return this.configurationService.get("last-app-version");
}
public setLastAppVersion(value : string){
this.configurationService.set("last-app-version", value);
}
private async getChangelog(): Promise<Changelog> {
if (this.cacheChangelog) {
return this.cacheChangelog;
}
const path = `https://raw.githubusercontent.com/Zagrios/bs-manager/master/assets/jsons/changelogs.json`
const response = await fetch(path);
if (!response.ok) {
throw new Error(`Failed to fetch changelogs (${response.status})`);
}
const data = await response.json();
if (!data) {
throw new Error(`Failed to parse changelogs`);
}
this.cacheChangelog = data;
return data;
}
private async getChangelogVersion(version:string): Promise<ChangelogVersion> {
const changelogs = await this.getChangelog();
const changelogVersion = changelogs[version];
if (!changelogVersion) {
throw new Error(`No changelog found for this version (${version})`);
}
return changelogVersion;
}
public getAppVersion() : Observable<string> {
return this.ipcService.sendV2("current-version");
}
public async showChangelog(version:string): Promise<void>{
if (version.toLowerCase().includes("alpha")) {
throw new Error("Alpha version, skipping changelog");
}
const changelog = await this.getChangelogVersion(version);
this.modal.openModal(ChangelogModal, {data: changelog});
}
}
+2 -29
View File
@@ -18,16 +18,14 @@ import { MapsManagerService } from "renderer/services/maps-manager.service";
import { PlaylistsManagerService } from "renderer/services/playlists-manager.service";
import { ModelsManagerService } from "renderer/services/models-management/models-manager.service";
import { NotificationService } from "renderer/services/notification.service";
import { lastValueFrom, timer } from "rxjs";
import { timer } from "rxjs";
import { ConfigurationService } from "renderer/services/configuration.service";
import { OsDiagnosticService } from "renderer/services/os-diagnostic.service";
import { useService } from "renderer/hooks/use-service.hook";
import { AutoUpdaterService } from "renderer/services/auto-updater.service";
import { SetupService } from "renderer/services/setup.service";
import { gt, parse } from "semver"
import { logRenderError } from "renderer";
export default function App() {
useService(OsDiagnosticService);
const pageState = useService(PageStateService);
const maps = useService(MapsManagerService);
@@ -35,43 +33,18 @@ export default function App() {
const models = useService(ModelsManagerService);
const notification = useService(NotificationService);
const config = useService(ConfigurationService);
const autoUpdater = useService(AutoUpdaterService);
const setup = useService(SetupService);
const location = useLocation();
const navigate = useNavigate();
useEffect(() => {
checkIsUpdated();
setup.check()
.then(() => {
checkOneClicks();
})
}, []);
const checkIsUpdated = async () => {
const appVersion = await lastValueFrom(autoUpdater.getAppVersion());
const lastAppVersion = autoUpdater.getLastAppVersion();
if(!lastAppVersion) {
return;
}
if (lastAppVersion.toLowerCase().includes("alpha")) {
autoUpdater.setLastAppVersion("0"); // Reset last app version if it's an alpha version for users with alpha versions in the var stored.
}
if (appVersion.toLowerCase().includes("alpha")) {
return;
}
autoUpdater.setLastAppVersion(appVersion);
if (parse(lastAppVersion) && gt(appVersion, lastAppVersion)) {
await autoUpdater.showChangelog(appVersion).catch(logRenderError);
}
};
const checkOneClicks = async () => {
if (config.get("not-remind-oneclick") === true) {