Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just some fixes and features #625

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions scripts/inject/injector.mts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const inject = async (
argEntryPoint ??
(prod ? join(CONFIG_PATH, "replugged.asar") : join(dirname, "..", "..", "dist/main.js"));
const entryPointDir = path.dirname(entryPoint);
console.log(entryPointDir);

if (appDir.includes("flatpak")) {
const discordName = platform === "canary" ? "DiscordCanary" : "Discord";
Expand All @@ -124,6 +125,14 @@ export const inject = async (
`${AnsiEscapes.YELLOW}Flatpak detected, allowing Discord access to Replugged files (${entryPointDir})${AnsiEscapes.RESET}`,
);
execSync(overrideCommand);
if(!prod) {
execSync(`${
appDir.startsWith("/var") ? "sudo flatpak override" : "flatpak override --user"
} com.discordapp.${discordName} --filesystem=${join(dirname, "..", "..")}`);
console.log(
`${AnsiEscapes.YELLOW}Flatpak Development detected, allowing Discord access to Replugged files (${join(dirname, "..", "..")})${AnsiEscapes.RESET}`,
);
}
console.log("Done!");
}

Expand Down
4 changes: 4 additions & 0 deletions src/renderer/coremods/settings/pages/Updater.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
padding: 15px;
border-radius: 5px;
}

.replugged-updater-check {
margin-right: 10px;
}
21 changes: 10 additions & 11 deletions src/renderer/coremods/settings/pages/Updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,15 @@
</Text.Normal>
) : null}
</Flex>
{!hasAnyUpdates ? (
<Button
className="replugged-updater-check"
onClick={checkForUpdates}
disabled={isAnyUpdating || isAnyComplete}
color={checking ? Button.Colors.PRIMARY : Button.Colors.BRAND}
submitting={checking}>
{Messages.REPLUGGED_UPDATES_CHECK}
</Button>
) : isAllComplete && didInstallAll ? (
<Button
className="replugged-updater-check"
onClick={checkForUpdates}
disabled={isAnyUpdating || isAnyComplete}
color={checking ? Button.Colors.PRIMARY : Button.Colors.BRAND}
submitting={checking}>
{Messages.REPLUGGED_UPDATES_CHECK}
</Button>
{hasAnyUpdates ? isAllComplete && didInstallAll ? (

Check failure on line 177 in src/renderer/coremods/settings/pages/Updater.tsx

View workflow job for this annotation

GitHub Actions / Run TypeScript

Type 'Element | (() => void)' is not assignable to type 'ReactNode'.
<Button onClick={reload} color={Button.Colors.RED}>
{Messages.REPLUGGED_UPDATES_AWAITING_RELOAD_TITLE}
</Button>
Expand All @@ -187,7 +186,7 @@
submitting={isAnyUpdating}>
{Messages.REPLUGGED_UPDATES_UPDATE_ALL}
</Button>
)}
) : ()=>{}}
</Flex>
<Flex className="replugged-updater-items" direction={Flex.Direction.VERTICAL}>
{updatesAvailable.map((update) => {
Expand Down
22 changes: 17 additions & 5 deletions src/renderer/managers/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import notices from "../apis/notices";
import * as common from "@common";
import { waitForProps } from "../modules/webpack";
import semver from "semver";

const logger = Logger.coremod("Updater");

Expand Down Expand Up @@ -228,15 +229,26 @@
updaterSettings.set("lastChecked", Date.now());
}

function compareVersions(newver, curver) {

Check failure on line 232 in src/renderer/managers/updater.ts

View workflow job for this annotation

GitHub Actions / Run TypeScript

Parameter 'newver' implicitly has an 'any' type.

Check failure on line 232 in src/renderer/managers/updater.ts

View workflow job for this annotation

GitHub Actions / Run TypeScript

Parameter 'curver' implicitly has an 'any' type.

Check failure on line 232 in src/renderer/managers/updater.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Missing return type on function
if (semver.valid(newver) && semver.valid(curver)) {
return semver.gt(newver, curver);
} else {
return newver != curver;

Check failure on line 236 in src/renderer/managers/updater.ts

View workflow job for this annotation

GitHub Actions / Run ESLint

Expected '!==' and instead saw '!='
}
}
export function getAvailableUpdates(): Array<UpdateSettings & { id: string }> {
return Object.entries(updaterState.all())
.map(([id, state]) => ({ ...state, id }))
.filter(
(state) =>
(state.available || completedUpdates.has(state.id)) &&
((state.id === REPLUGGED_ID && window.RepluggedNative.getVersion() !== "dev") ||
pluginManager.plugins.has(state.id) ||
themeManager.themes.has(state.id)),
(state) => {
return (state.available || completedUpdates.has(state.id)) &&
((state.id === REPLUGGED_ID && window.RepluggedNative.getVersion() !== "dev") ||
(
(pluginManager.plugins.has(state.id) && compareVersions(state.version, replugged.plugins.plugins.get(state.id).manifest.version)) ||

Check failure on line 247 in src/renderer/managers/updater.ts

View workflow job for this annotation

GitHub Actions / Run TypeScript

Cannot find name 'replugged'. Did you mean 'REPLUGGED_ID'?
(themeManager.themes.has(state.id) && compareVersions(state.version, replugged.themes.themes.get(state.id).manifest.version))

Check failure on line 248 in src/renderer/managers/updater.ts

View workflow job for this annotation

GitHub Actions / Run TypeScript

Cannot find name 'replugged'. Did you mean 'REPLUGGED_ID'?
)
)
},
);
}

Expand Down
Loading