Skip to content

Commit 6a4b848

Browse files
committed
Bump
1 parent 4e74278 commit 6a4b848

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vx",
3-
"version": "1.0.48",
3+
"version": "1.0.49",
44
"author": "doggybootsy",
55
"main": "index.js",
66
"dependencies": {

packages/mod/src/dashboard/pages/home/updater.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { updater } from "../../../native";
44
import { compare, SemverCompareState } from "../../../semver";
55
import { Button, Flex, Icons } from "../../../components";
66
import { useInternalStore } from "../../../hooks";
7-
import { whenWebpackInit } from "@webpack";
7+
import { whenWebpackReady } from "@webpack";
88
import { openNotification } from "../../../api/notifications";
99
import { Messages } from "vx:i18n";
1010
import { openExternalWindowModal } from "../../../api/modals";
@@ -18,7 +18,7 @@ export const updaterStore = new class extends InternalStore {
1818
constructor() {
1919
super();
2020

21-
whenWebpackInit().then(() => {
21+
whenWebpackReady().then(() => {
2222
if (!env.IS_DEV && git.exists) this.checkForUpdates();
2323
});
2424
};
@@ -48,15 +48,18 @@ export const updaterStore = new class extends InternalStore {
4848

4949
this.emit();
5050

51-
const release = await updater.getLatestRelease();
51+
const [ ok, release, err ] = await updater.getLatestRelease();
5252

53-
if (!release) {
53+
if (!ok) {
5454
openNotification({
5555
title: "Updater Failed",
5656
id: "vx-updater-error",
5757
icon: Icons.Warn,
5858
type: "error",
59-
description: "Failed to fetch latest version"
59+
description: [
60+
err.message.replace(/\d+\.\d+.\d+.\d+/, "your ip address (||$&||)"),
61+
err.documentation_url
62+
].filter(Boolean)
6063
});
6164

6265
setTimeout(() => {

packages/mod/src/native.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ export const app = {
2828
};
2929

3030
export const updater = {
31-
async getLatestRelease(): Promise<Git.Release | null> {
31+
async getLatestRelease(): Promise<[ boolean, Git.Release, { message: string, documentation_url: string } ]> {
3232
if (!git.exists) throw new Error("No Git Details Exist");
3333

34-
const endpoint = `https://api.github.com/repos/${git.url.split("/").slice(-2).join("/")}/releases/latest`;
34+
const headers = new Headers();
3535

36-
const { json, ok } = await request.json<Git.Release>(endpoint, { cache: "no-cache" });
36+
headers.set("Content-Type", "application/vnd.github.raw+json");
3737

38-
if (!ok) return null;
39-
return json;
38+
const { json, ok } = await request.json<any>(`https://api.github.com/repos/${git.url.split("/").slice(-2).join("/")}/releases/latest`, {
39+
cache: "no-cache",
40+
headers
41+
});
42+
43+
return [ ok, json, json ];
4044
},
4145
update(release: Git.Release) {
4246
if (window.VXExtension) window.VXExtension.update(release);

0 commit comments

Comments
 (0)