Skip to content

Commit

Permalink
Release fix pls
Browse files Browse the repository at this point in the history
  • Loading branch information
cyan-2048 committed Dec 23, 2022
1 parent a4a5cc2 commit e3a87df
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#36393f" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="stylesheet" href="/build/bundle.css" />
<script src="/build/bundle.js"></script>
<script src="/build/bundle.js" defer></script>
</head>
<body></body>
</html>
2 changes: 1 addition & 1 deletion src/assets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.0.13",
"version": "2.0.14",
"name": "Sveltecord",
"description": "Discord Client for KaiOS written in svelte.",
"launch_path": "/index.html",
Expand Down
9 changes: 3 additions & 6 deletions src/lib/database.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { navigate } from "svelte-routing";
import { get, writable } from "svelte/store";
import DiscordXHR from "./DiscordXHR";
import { testInternet, delay, wouldMessagePing } from "./helper";
import { testInternet, delay, wouldMessagePing, reload } from "./helper";
import { serverProfiles, settings, userProfiles, queryProfiles } from "./shared";

import EventEmitter from "./EventEmitter.js";
Expand Down Expand Up @@ -43,8 +43,7 @@ export const discordGateway = new _gateway();

export async function ack(channelID) {
const { last_message_id } = await discord.getChannel(channelID);
if (last_message_id !== null)
discord.xhrRequestJSON("post", `channels/${channelID}/messages/${last_message_id}/ack`, {}, { token: "null" });
if (last_message_id !== null) discord.xhrRequestJSON("post", `channels/${channelID}/messages/${last_message_id}/ack`, {}, { token: "null" });
}

//
Expand Down Expand Up @@ -221,9 +220,7 @@ discordGateway.on("t:guild_members_chunk", (event) => {

discordGateway.on("close", () => {
discordGateway.close();
if (PRODUCTION) navigate("/index.html", { replace: true });
// we reload the app entirely if the gateway closes
window.location.reload();
reload();
});

/// functions here
Expand Down
6 changes: 6 additions & 0 deletions src/lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export async function back() {
await tick();
}

export async function reload() {
if (PRODUCTION) {
window.location.replace("/index.html");
} else window.location.reload();
}

export function hashCode(string, seed = 0) {
const str = String(string);
let h1 = 0xdeadbeef ^ seed,
Expand Down
5 changes: 2 additions & 3 deletions src/routes/Login.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { sn } from "../lib/shared";
import { onMount, tick } from "svelte";
import { discord, localStorage } from "../lib/database.js";
import { centerScroll } from "../lib/helper.js";
import { centerScroll, reload } from "../lib/helper.js";
import { navigate } from "svelte-routing";
import Button from "../components/Button.svelte";
Expand Down Expand Up @@ -31,8 +31,7 @@
function done(token) {
_done = true;
localStorage.token = token;
if (PRODUCTION) navigate("/index.html", { replace: true });
window.location.reload();
reload();
}
onMount(() => {
Expand Down

0 comments on commit e3a87df

Please sign in to comment.