Skip to content

Commit

Permalink
feat: automatically apply blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
std-microblock committed Feb 15, 2024
1 parent 3e6a651 commit a154e98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Binary file modified resources/dist.rc
Binary file not shown.
20 changes: 10 additions & 10 deletions src/celemod-ui/src/routes/Manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ const Profile = ({ name, current }: { name: string; current: boolean }) => {
const alphabet =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- _';

let lastApplyReq = -1;

export const Manage = () => {
const noEverest = enforceEverest();
if (noEverest) return noEverest;
Expand Down Expand Up @@ -586,6 +588,13 @@ export const Manage = () => {

setCurrentProfile({ ...currentProfile });
setHasUnsavedChanges(true);

lastApplyReq = Date.now();
setTimeout(() => {
if (lastApplyReq === Date.now()) {
manageCtx.switchProfile(manageCtx.currentProfileName);
}
}, 600);
},
switchMod: (name: string, enabled: boolean, recursive = true) => {
if (currentProfile) {
Expand Down Expand Up @@ -634,6 +643,7 @@ export const Manage = () => {
setHasUnsavedChanges(true);
},
switchProfile: (name: string) => {
if(hasUnsavedChanges) return;
callRemote('apply_blacklist_profile', gamePath, name);
setCurrentProfileName(name);
setHasUnsavedChanges(false);
Expand Down Expand Up @@ -716,16 +726,6 @@ export const Manage = () => {
>
{_i18n.t('启用全部')}
</Button>
&nbsp;&nbsp;
{hasUnsavedChanges && (
<Button
onClick={() => {
manageCtx.switchProfile(currentProfileName);
}}
>
{_i18n.t('应用修改')}
</Button>
)}
</div>
<div className="options">
<label>
Expand Down

0 comments on commit a154e98

Please sign in to comment.