Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed May 28, 2022
1 parent eb3c776 commit 3c9f638
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 17 deletions.
21 changes: 19 additions & 2 deletions Website/src/activitys/ViewModuleActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Video from "@Components/dapi/Video";
import DiscordWidget from "@Components/dapi/DiscordWidget";
import LinkManager from "@Native/LinkManager";
import Log from "@Builders/Log";
import PackageManager from "@Native/PackageManager";

interface Props {
extra?: any;
Expand Down Expand Up @@ -219,8 +220,24 @@ class ViewModuleActivity extends React.Component<Props, States> {
if (minMagisk != (null || undefined)) {
return (
<tr>
<td style={{ width: "100%" }}>Min. Magisk</td>
<td>{minMagisk}</td>
<td
style={{
width: "100%",
}}
>
Min. Magisk
</td>
<td
style={{
color: Constants.isAndroid
? PackageManager.parseMagisk(minMagisk) > PackageManager.getMagiskVersionCode
? "red"
: ""
: "",
}}
>
{minMagisk}
</td>
</tr>
);
} else {
Expand Down
25 changes: 13 additions & 12 deletions Website/src/components/ExploreModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,21 @@ class ExploreModule extends React.Component<Props, States> {
}}
>
{props.name}

{(() => {
if (isVerified) {
return (
<>
{" "}
<VerifiedIcon color="#4a148c" />
</>
);
} else {
return null;
}
})()}
</span>
</item-module-name>
{(() => {
if (isVerified) {
return (
<>
{" "}
<VerifiedIcon color="#4a148c" />
</>
);
} else {
return null;
}
})()}
</item-title>
<div className="content">
<item-version-author
Expand Down
14 changes: 11 additions & 3 deletions Website/src/native/PackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class PackageManager {
}
}

public static get getMagiskVersionCode(): string {
public static get getMagiskVersionCode(): number {
if (Constants.isAndroid) {
return Shell.cmd("su -V").result();
return parseInt(Shell.cmd("su -V").result());
} else {
return "0";
return 0;
}
}
public static get getMagiskVersionName(): string {
Expand All @@ -41,6 +41,14 @@ class PackageManager {
return "0:MAGISKSU";
}
}
public static parseMagisk(version: string): number {
const i = version.indexOf(".");
if (i == -1) {
return parseInt(version);
} else {
return parseInt(version.substring(0, i)) * 1000 + parseInt(version.substring(i + 1)) * 100;
}
}
}

export default PackageManager;

0 comments on commit 3c9f638

Please sign in to comment.