From e3ce8700cb8e7c12127618e6da82988800372d72 Mon Sep 17 00:00:00 2001 From: Annie K Rarity Sparklight Date: Mon, 15 Aug 2022 20:38:59 +0800 Subject: [PATCH 1/7] fix(*): format code style --- src/main/Background.ts | 6 +++--- src/renderer/App.tsx | 30 +++++++----------------------- src/renderer/Options.tsx | 12 +++++------- 3 files changed, 15 insertions(+), 33 deletions(-) diff --git a/src/main/Background.ts b/src/main/Background.ts index 4b15408d..5eeb53a5 100644 --- a/src/main/Background.ts +++ b/src/main/Background.ts @@ -209,10 +209,10 @@ export function registerBackgroundListeners(): void { setTimeout(() => { if ( loginWindow && - !loginWindow?.isDestroyed() && - !loginWindow?.isVisible() + !loginWindow.isDestroyed() && + !loginWindow.isVisible() ) { - loginWindow?.show(); + loginWindow.show(); } }, 5000); // Easy everyone, don't get panic! await loginWindow.loadURL(LOGIN_START); diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index c8f22228..fa888192 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -19,34 +19,23 @@ import { Refresh, Settings, ShowChart, - ViewModule, + ViewModule } from "@mui/icons-material"; import { Alert, AppBar, - Box, - Button, - Chip, + Box, Chip, ClassNameMap, - Container, - Dialog, - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, - Drawer, + Container, Drawer, Fab, IconButton, List, ListItem, ListItemIcon, ListItemText, - Snackbar, - TextField, - ThemeProvider, - Toolbar, + Snackbar, Toolbar, Tooltip, - Typography, + Typography } from "@mui/material"; import { makeStyles } from "@mui/styles"; import { ipcRenderer } from "electron"; @@ -58,7 +47,7 @@ import { safeGet } from "../modules/commons/Null"; import { getBoolean, getString, - saveConfig, + saveConfig } from "../modules/config/ConfigSupport"; import { saveGDT } from "../modules/container/ContainerUtil"; import { saveVF } from "../modules/container/ValidateRecord"; @@ -76,7 +65,7 @@ import { goBack, jumpTo, setChangePageWarn, - triggerSetPage, + triggerSetPage } from "./GoTo"; import { InstallCore } from "./InstallCore"; import { Instruction, isInstBusy, startInst } from "./Instruction"; @@ -88,11 +77,6 @@ import { YNDialog2 } from "./OperatingHint"; import { OptionsPage } from "./Options"; import { PffFront } from "./PffFront"; import { ReadyToLaunch } from "./ReadyToLaunch"; -import { - ALICORN_DEFAULT_THEME_DARK, - ALICORN_DEFAULT_THEME_LIGHT, - isBgDark, -} from "./Renderer"; import { ServerList } from "./ServerList"; import { saveStatistics, Statistics } from "./Statistics"; import { AlicornTheme } from "./Stylex"; diff --git a/src/renderer/Options.tsx b/src/renderer/Options.tsx index dae984fc..449b8b1e 100644 --- a/src/renderer/Options.tsx +++ b/src/renderer/Options.tsx @@ -24,9 +24,7 @@ import { EmojiEmotions, ExtensionOff, Favorite, - FirstPage, - GraphicEq, - Home, + FirstPage, Home, Inbox, InsertPhoto, Inventory2, @@ -59,7 +57,7 @@ import { ViewInAr, WebAsset, YoutubeSearchedFor, - ZoomOutMap, + ZoomOutMap } from "@mui/icons-material"; import { Box, @@ -75,7 +73,7 @@ import { Tabs, TextField, ThemeProvider, - Typography, + Typography } from "@mui/material"; import { makeStyles } from "@mui/styles"; import { ipcRenderer, webFrame } from "electron"; @@ -89,7 +87,7 @@ import { getNumber, getString, parseNum, - set, + set } from "../modules/config/ConfigSupport"; import { getActualDataPath } from "../modules/config/DataSupport"; import { loadMirror } from "../modules/download/Mirror"; @@ -97,7 +95,7 @@ import { remoteSelectDir } from "./ContainerManager"; import { ALICORN_DEFAULT_THEME_DARK, ALICORN_DEFAULT_THEME_LIGHT, - isBgDark, + isBgDark } from "./Renderer"; import { AlicornTheme, useInputStyles } from "./Stylex"; import { AL_THEMES } from "./ThemeColors"; From b3f062539b926288a661af1cd9461ab3789c307f Mon Sep 17 00:00:00 2001 From: Annie K Rarity Sparklight Date: Mon, 15 Aug 2022 20:51:54 +0800 Subject: [PATCH 2/7] fix(ci): fix release problem --- resources/build/{_install.sh => install.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/build/{_install.sh => install.sh} (100%) diff --git a/resources/build/_install.sh b/resources/build/install.sh similarity index 100% rename from resources/build/_install.sh rename to resources/build/install.sh From eb51d4c41144af1db1f03ce6199154839535b346 Mon Sep 17 00:00:00 2001 From: Annie K Rarity Sparklight Date: Wed, 17 Aug 2022 14:56:08 +0800 Subject: [PATCH 3/7] feat(*): change lang sayings --- resources/shared/defaults/PonyCN.lang | 57 +++++---------------------- 1 file changed, 9 insertions(+), 48 deletions(-) diff --git a/resources/shared/defaults/PonyCN.lang b/resources/shared/defaults/PonyCN.lang index b49c4f0e..ac0746f5 100644 --- a/resources/shared/defaults/PonyCN.lang +++ b/resources/shared/defaults/PonyCN.lang @@ -2385,63 +2385,23 @@ Mojang 版本 # Welcome.Suggest.Part1 -['{Config:interactive.i-have-a-crush-on-al}'=='false']今天是 {Date},欢迎你使用 Alicorn Launcher,{UserName}! +这个世界还值得你留念?那我会陪着你的。 -[new Date().getHours()>=18]好上晚!哦,我刚刚在练习古小马语…… +Alicorn 感谢你的陪伴,至少与你一同见证过斗转星移。 -[(()=>{const hours=new Date().getHours();return hours>=23||hours<=6;})()]好困……这个时候叫我……? +[new Date().getHours()>=18]黑夜令群星更闪耀,暮色使落日更辉煌。 -[(()=>{const hours=new Date().getHours();return hours>=23||hours<=6;})()]哈……好困,不行,我先去休息了,你自己玩吧(不悦) +[(()=>{const hours=new Date().getHours();return hours>=23||hours<=6;})()]时间若能在此静止,结局倒还不算太坏。 -[(()=>{const hours=new Date().getHours();return hours>=23||hours<=6;})()]保证充足睡眠有助于抵御病毒哦! +[(()=>{const hours=new Date().getHours();return hours>=7&&hours<=11;})()]上午好,你依然如此有精神?真意外。 -[(()=>{const hours=new Date().getHours();return hours>=7&&hours<=11;})()]上午好!今天的天气真不错……什么?我猜错了?这不能怪我,要不你来预测天气试试? +[new Date().getHours()==12]正午,是开始的结束,还是结束的开始? -[new Date().getHours()==12]正午到!六分仪已经就绪,出发! - -[(()=>{const hours=new Date().getHours();return hours>=7&&hours<=9;})()]早上好!来一杯牛奶……? - -无论什么时候你需要我,我都在这里的啦…… - -嗯呐……什么事? - -戴口罩,多通风,少聚集,玩玩 MC 就很好~ - -['{Config:interactive.i-have-a-crush-on-al}'=='true']你这是什么眼神……唔?唔唔唔!放开我! - -['{Config:interactive.i-have-a-crush-on-al}'=='true']这两只小马耳朵?很可爱?想摸摸吗? - -['{Config:interactive.i-have-a-crush-on-al}'=='true']我可是会飞的哦~看着!(张开翅膀) - -['{Config:updator.use-update}'=='false']不要担心升级!更新后的我就像暮光公主变成坎特拉女孩一样,虽然样子不同,但我不会忘了你的! +能在这里见到你真是太好了。 拒绝 Mod 平台的广告。使用 Modrinth 而拒绝 Curseforge,就是在为大家贡献力量。 -['{Config:dev.experimental}'=='true']不要一边驾驶飞机,一边测试飞机的引擎…… - -['{Config:theme.background}'=='ACG']看多了 ACG 图片,会不会就不喜欢我了呢…… - -['{Config:updator.url}'!=='']订阅其它源的更新 URL 不一定可信,要小心哦! - -['{Config:readyboom}'=='false']没有 ReadyBoom,你都不知道我的速度有多快! - -['{Config:dev.experimental}'=='true']听说实验室容易爆炸,实验功能也是一样…… - -我相信每个人都有一颗小马般的心~ - -[(()=>{const hours=new Date().getHours();return hours>=18&&hours<=21;})()]虽然我还小,但我觉得在这个浪漫的晚上,似乎也可以小酌一杯苹果酒~ - -['{Config:interactive.i-have-a-crush-on-al}'=='true']嗯……不行,不能抱我…… - -['{Config:interactive.i-have-a-crush-on-al}'=='true']来一起跳支舞……? - -['{Config:interactive.i-have-a-crush-on-al}'=='true']这不是水,这是苹果酒,提神用的……要来一杯吗? - -['{Config:interactive.i-have-a-crush-on-al}'=='true']我可是书虫!不然我怎么对付 Forge 的安装器呢? - -['{Config:interactive.i-have-a-crush-on-al}'=='true']在你玩游戏的时候,我可没有偷懒,我在默默地看着你呢~ - -['{Config:interactive.i-have-a-crush-on-al}'=='false']您还记得我吗?我?我记得每一位用户…… +我?我的存储模块还挺可靠,我不会忘记你。 # Welcome.TipName @@ -3660,6 +3620,7 @@ MCBBS(Minecraft 中文论坛)……这里是热爱 MC 群体的天堂。\nFr 这是 Alicorn 的前世今生的全部时间线。我知道不会有多少人会想了解我,但这不重要,这相当于我的自传吧……\n\n\ 至今 - 你现在看到的 Alicorn。\n\ +2022 年 8 月 17 日 - Alicorn 正式停止主要功能更新,ThatRarityEG 表示将离开 Minecraft 社区。 2022 年 1 月 15 日 - 这对于 Alicorn 来说是一个重要的夜晚,继触觉之后,Alicorn 拥有了听觉。\n\ 2021 年 8 月 20 日 - Alicorn 在 MCBBS 发布,从此走上新的旅程。\n\ 2021 年 8 月 ?? 日 - Alicorn 结束了最后的测试,并发布了第一个核心,从那时至今,几乎每周都会发布一个新版本。\n\ From 6492981aee3f6ad4e14a9cb784eef507e2a8b7ce Mon Sep 17 00:00:00 2001 From: Annie K Rarity Sparklight Date: Wed, 17 Aug 2022 15:13:57 +0800 Subject: [PATCH 4/7] docs(*): update readme --- README.md | 22 ++++++++++++++++------ README_ZH.md | 24 +++++++++++++++++------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9aa5dd78..2f5d95b9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,16 @@ [中文 README](./README_ZH.md) +## IMPORTANT + +As I, the developer, decided not to contribute to the Minecraft communities, this project **won't receive major updates** since Core 50 (that's why I call it Sunset). + +If servere security vulnerbilities are found in the future, patches might still be available. However, generally, this project is now discontinued. + +It doesn't mean you have to switch to another launcher, but if you wish to, we recommand [HMCL](https://github.com/huanghongxun/HMCL), it's a free software (as in freedom) and is still being actively maintained. + +--- + A third party Minecraft launcher, with high performance and freedom. ![.](https://img.shields.io/badge/Alicorn-is%20cute!-df307f) @@ -60,25 +70,25 @@ To build Alicorn, you'll need: - [Git](https://git-scm.com) - Clone the repository: - + ```shell git clone https://github.com/Andy-K-Sparklight/Alicorn.git --depth=1 ``` - Install dependencies: - + ```shell yarn ``` - Run build: - + ```shell yarn make ``` - + This will generate binaries and put them under `out`, including Windows x64, Windows ia32, GNU/Linux x64, GNU/Linux arm64 ~~and macOS x64~~. This will also generate corresponding archives. - + _The support for macOS has ended and no more platform dependent code will be commited. The modules present are still kept, but might not run correctly._ - + You also need `wine` to complete the cross build progress on platforms other than Windows. Follow the instructions given by `electron-packager`. diff --git a/README_ZH.md b/README_ZH.md index a85dd571..03bfdcd2 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -2,6 +2,16 @@ [English README](./README.md) +## 重要信息 + +我们并不想让故事就此结束,但是作为开发者,我对 Minecraft 社区已不再抱有太多的信心。因此,Alicorn 在未来将不会接收**主要更新**,也正是因此,核心版本 50 被叫做**落日**。 + +如果将来发现了严重的安全漏洞,Alicorn 依然会得到安全性更新,但是总体上来说,这个项目将不会继续了。 + +这并不意味着你必须要换一个启动器,在可预见的将来,Alicorn 应当依然能够启动未来的数个版本,但是如果你想要更好,我们推荐 [HMCL](https://github.com/huanghongxun/HMCL),它是自由软件,性能和功能并重,并且现在依然在积极的维护中。 + +--- + 高性能并且自由的第三方 Minecraft 启动器。 ![.](https://img.shields.io/badge/Alicorn-is%20cute!-df307f) @@ -62,27 +72,27 @@ - 一份好用的网络连接 - 首先,克隆本仓库: - + ```shell git clone https://github.com/Andy-K-Sparklight/Alicorn.git --depth=1 ``` - 安装依赖: - + ```shell yarn ``` - + Alicorn Launcher 有相当多的依赖,包含 Electron 及其构建工具,如果您的网络环境不好,请考虑设置一个镜像或者使用代理服务器,并为 Electron 进行额外的设置。 - 运行构建: - + ```shell yarn make ``` - + 该命令构建所有的二进制文件并输出到 `out` 下:Windows x64,Windows ia32,GNU/Linux x64,GNU/Linux arm64 ~~以及 macOS x64~~。该命令同时会生成对应的压缩包。 - + _macOS 的支持已经正式告终,Alicorn 现在不再为 macOS 编写平台相关代码。已有模块仍然保留,但可能无法正常工作。_ - + 请注意非 Windows 操作系统在构建 Windows 应用时需要 wine 的支持,可参考 electron-packager 的输出信息安装。 From 175048aa9cc0f8e4c55110d3b1268c9e927adaf9 Mon Sep 17 00:00:00 2001 From: Annie K Rarity Sparklight Date: Mon, 5 Dec 2022 19:45:08 +0800 Subject: [PATCH 5/7] feat(*): use system menu when choosing native drag --- src/main/Bootstrap.ts | 39 +++++++++++++++++++++++++++++++++++++-- src/renderer/App.tsx | 26 +++++++++++++++++++------- 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/main/Bootstrap.ts b/src/main/Bootstrap.ts index ec02b31e..cfb3b059 100644 --- a/src/main/Bootstrap.ts +++ b/src/main/Bootstrap.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, ipcMain, screen, Session } from "electron"; +import { app, BrowserWindow, ipcMain, screen, Session, Menu } from "electron"; import { btoa } from "js-base64"; import path from "path"; import { DOH_CONFIGURE } from "../modules/commons/Constants"; @@ -9,6 +9,7 @@ import { loadConfigSync, movOldConfigFolderSync, } from "../modules/config/ConfigSupport"; +import os from "os"; import { setBeacon } from "../modules/selfupdate/Beacon"; import { registerBackgroundListeners } from "./Background"; import { getUsingDM, initDisplayManager } from "./DisplayManager"; @@ -89,7 +90,41 @@ async function whenAppReady() { backgroundColor: "#fff", }); mainWindow.setAspectRatio(1.92); - mainWindow.setMenu(null); + if (getString("frame.drag-impl") === "TitleBar") { + const subMenus = [ + "LaunchPad", + "Welcome", + "InstallCore", + "ContainerManager", + "JavaSelector", + "AccountManager", + "Cadance", + "Boticorn", + "UtilitiesIndex", + "Statistics", + "Options", + "DMCenter", + "ServerList", + "Version", + "TheEndingOfTheEnd", + ].map((lb) => { + return { + label: lb, + // eslint-disable-next-line require-await + click: async () => { + mainWindow?.webContents.send("menu-click", lb); + }, + }; + }); + const menu = Menu.buildFromTemplate(subMenus); + if (os.platform() == "darwin") { + Menu.setApplicationMenu(menu); + } else { + mainWindow.setMenu(menu); + } + } else { + mainWindow.setMenu(null); + } mainWindow.webContents.on("did-navigate-in-page", () => { mainWindow?.webContents.setZoomLevel(0); }); diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index fa888192..826664f7 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -19,23 +19,26 @@ import { Refresh, Settings, ShowChart, - ViewModule + ViewModule, } from "@mui/icons-material"; import { Alert, AppBar, - Box, Chip, + Box, + Chip, ClassNameMap, - Container, Drawer, + Container, + Drawer, Fab, IconButton, List, ListItem, ListItemIcon, ListItemText, - Snackbar, Toolbar, + Snackbar, + Toolbar, Tooltip, - Typography + Typography, } from "@mui/material"; import { makeStyles } from "@mui/styles"; import { ipcRenderer } from "electron"; @@ -47,7 +50,7 @@ import { safeGet } from "../modules/commons/Null"; import { getBoolean, getString, - saveConfig + saveConfig, } from "../modules/config/ConfigSupport"; import { saveGDT } from "../modules/container/ContainerUtil"; import { saveVF } from "../modules/container/ValidateRecord"; @@ -65,7 +68,7 @@ import { goBack, jumpTo, setChangePageWarn, - triggerSetPage + triggerSetPage, } from "./GoTo"; import { InstallCore } from "./InstallCore"; import { Instruction, isInstBusy, startInst } from "./Instruction"; @@ -151,6 +154,12 @@ export function App(): JSX.Element { useEffect(gotoMainIfEmpty, [window.location.hash]); useEffect(popupInstruction(page), [page]); useEffect(bindRefreshListener(setRefreshBit), []); + useEffect(() => { + ipcRenderer.addListener("menu-click", (_e, lb) => { + jumpTo("/" + lb); + triggerSetPage(lb); + }); + }, []); useEffect( bindChangePageWarn( setOpenChangePageWarn, @@ -513,6 +522,9 @@ function AppTopBar(props: { setOpenDrawer: (o: boolean) => void; }): JSX.Element { const classes = props.classes; + if (getString("frame.drag-impl") === "TitleBar") { + return <>; + } return ( From 270b7272ddd88fa03e2041afd5d9ddc0dfecab48 Mon Sep 17 00:00:00 2001 From: Annie K Rarity Sparklight Date: Mon, 5 Dec 2022 20:26:01 +0800 Subject: [PATCH 6/7] fix(ui): fix macos menu bar --- src/main/Bootstrap.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/Bootstrap.ts b/src/main/Bootstrap.ts index cfb3b059..39f30bfb 100644 --- a/src/main/Bootstrap.ts +++ b/src/main/Bootstrap.ts @@ -116,10 +116,14 @@ async function whenAppReady() { }, }; }); - const menu = Menu.buildFromTemplate(subMenus); + if (os.platform() == "darwin") { + const menu = Menu.buildFromTemplate([ + { label: "Alicorn", submenu: [{ role: "quit" }, ...subMenus] }, + ]); Menu.setApplicationMenu(menu); } else { + const menu = Menu.buildFromTemplate(subMenus); mainWindow.setMenu(menu); } } else { From 43acbdbc7c45c2636a2c0f8d518e27820c3970f6 Mon Sep 17 00:00:00 2001 From: "Ted \"skjsjhb\" Gao" Date: Thu, 4 Jan 2024 21:54:23 +0800 Subject: [PATCH 7/7] fix(launch): fix natives for 1.19+ --- package.json | 2 +- src/modules/container/MinecraftContainer.ts | 4 ++++ src/modules/launch/ArgsGenerator.ts | 2 +- src/modules/launch/Ensurance.ts | 2 +- src/modules/launch/NativesLint.ts | 8 ++------ 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 99177513..ac202264 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "appVersion": "Sunset", "version": "1.0.0", - "updatorVersion": 50, + "updatorVersion": 51, "scripts": { "lc": "yarn lcd", "df": "yarn dev-full", diff --git a/src/modules/container/MinecraftContainer.ts b/src/modules/container/MinecraftContainer.ts index 22a08cb5..29a6c35e 100644 --- a/src/modules/container/MinecraftContainer.ts +++ b/src/modules/container/MinecraftContainer.ts @@ -20,6 +20,10 @@ export class MinecraftContainer { return path.resolve(this.getModsRoot(), modJar); } + getNativesLocation(id: string): string { + return path.resolve(this.rootDir, "versions", id, "natives"); + } + getVersionBase(): string { return path.resolve(this.versionsBase); } diff --git a/src/modules/launch/ArgsGenerator.ts b/src/modules/launch/ArgsGenerator.ts index e205d468..8957a7f8 100644 --- a/src/modules/launch/ArgsGenerator.ts +++ b/src/modules/launch/ArgsGenerator.ts @@ -90,7 +90,7 @@ export function generateVMArgs( ); }*/ // All natives directories put together - vMap.set("natives_directory", nativesLibs.join(FILE_SEPARATOR)); + vMap.set("natives_directory", container.getNativesLocation(profile.id)); // 1.17 vMap.set("library_directory", container.getLibrariesRoot()); // Attention! Use base version! diff --git a/src/modules/launch/Ensurance.ts b/src/modules/launch/Ensurance.ts index dd29fcb0..fd45f7ff 100644 --- a/src/modules/launch/Ensurance.ts +++ b/src/modules/launch/Ensurance.ts @@ -38,7 +38,7 @@ export async function ensureNatives( for (const s of toEnsureLibraries) { allPromises.push( new Promise((resolve) => { - void checkExtractTrimNativeLocal(container, s).then(() => { + void checkExtractTrimNativeLocal(container, profile.id, s).then(() => { resolve(); }); }) diff --git a/src/modules/launch/NativesLint.ts b/src/modules/launch/NativesLint.ts index 973a09c0..c07ea807 100644 --- a/src/modules/launch/NativesLint.ts +++ b/src/modules/launch/NativesLint.ts @@ -25,16 +25,12 @@ const NATIVES_LOCK_FILE = "natives.lock.ald"; // We should validate hash, but it's unnecessary export async function checkExtractTrimNativeLocal( container: MinecraftContainer, + id: string, nativeArtifact: ArtifactMeta ): Promise { try { const srcFile = container.getLibraryPath(nativeArtifact.path); - const dest = container.getLibraryPath( - path.join( - path.dirname(nativeArtifact.path), - path.basename(nativeArtifact.path, JAR_SUFFIX) - ) - ); + const dest = container.getNativesLocation(id); await fs.ensureDir(dest); if (await checkLockFile(dest)) { return;