fix(asset): wideSVG is refusing to exist, use legacy loading mechanism

This commit is contained in:
Paul 2021-10-23 16:42:04 +01:00
parent 6595b7687a
commit 6e3905eb0f
5 changed files with 16 additions and 19 deletions

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -4,6 +4,7 @@ import styles from "./Onboarding.module.scss";
import { Text } from "preact-i18n";
import { useState } from "preact/hooks";
import wideSVG from "../../../../public/assets/wide.svg";
import Button from "../../../components/ui/Button";
import Preloader from "../../../components/ui/Preloader";
@ -40,7 +41,7 @@ export function OnboardingModal({ onClose, callback }: Props) {
<h1>
<Text id="app.special.modals.onboarding.welcome" />
<br />
<img src={"/assets/svg/wide.svg"} loading="eager" />
<img src={wideSVG} loading="eager" />
</h1>
</div>
<div className={styles.form}>

View file

@ -10,6 +10,7 @@ import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
import { dispatch, getState } from "../../redux";
import wideSVG from "../../../../public/assets/wide.svg";
import Emoji from "../../components/common/Emoji";
import Tooltip from "../../components/common/Tooltip";
import Header from "../../components/ui/Header";
@ -66,7 +67,7 @@ export default function Home() {
<h3>
<Text id="app.special.modals.onboarding.welcome" />
<br />
<img src={"/assets/svg/wide.svg"} />
<img src={wideSVG} />
</h3>
<div className={styles.actions}>
<Link to="/invite/Testers">

View file

@ -9,6 +9,7 @@ import { useContext, useState } from "preact/hooks";
import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { takeError } from "../../../context/revoltjs/util";
import wideSVG from "../../../../public/assets/wide.svg";
import Button from "../../../components/ui/Button";
import Overline from "../../../components/ui/Overline";
import Preloader from "../../../components/ui/Preloader";
@ -145,7 +146,7 @@ export function Form({ page, callback }: Props) {
return (
<div className={styles.form}>
<img src={"/assets/svg/wide.svg"} />
<img src={wideSVG} />
{/* Preact / React typing incompatabilities */}
<form
onSubmit={

View file

@ -11,11 +11,11 @@ function getGitRevision() {
const rev = readFileSync(".git/HEAD").toString().trim();
if (rev.indexOf(":") === -1) {
return rev;
} else {
return readFileSync(".git/" + rev.substring(5))
.toString()
.trim();
}
return readFileSync(`.git/${rev.substring(5)}`)
.toString()
.trim();
} catch (err) {
console.error("Failed to get Git revision.");
return "?";
@ -27,9 +27,9 @@ function getGitBranch() {
const rev = readFileSync(".git/HEAD").toString().trim();
if (rev.indexOf(":") === -1) {
return "DETACHED";
} else {
return rev.split("/").pop();
}
return rev.split("/").pop();
} catch (err) {
console.error("Failed to get Git branch.");
return "?";
@ -40,10 +40,6 @@ function getVersion() {
return readFileSync("VERSION").toString();
}
const branch = getGitBranch();
const isNightly = false; //branch !== 'production';
const iconPrefix = isNightly ? "nightly-" : "";
export default defineConfig({
plugins: [
preact(),
@ -52,11 +48,9 @@ export default defineConfig({
filename: "sw.ts",
strategies: "injectManifest",
manifest: {
name: isNightly ? "Revolt Nightly" : "Revolt",
name: "Revolt",
short_name: "Revolt",
description: isNightly
? "Early preview builds of Revolt."
: "User-first, privacy-focused chat platform.",
description: "User-first, privacy-focused chat platform.",
categories: ["messaging"],
start_url: "/",
orientation: "portrait",
@ -65,12 +59,12 @@ export default defineConfig({
theme_color: "#101823",
icons: [
{
src: `/assets/icons/${iconPrefix}android-chrome-192x192.png`,
src: `/assets/icons/android-chrome-192x192.png`,
type: "image/png",
sizes: "192x192",
},
{
src: `/assets/icons/${iconPrefix}android-chrome-512x512.png`,
src: `/assets/icons/android-chrome-512x512.png`,
type: "image/png",
sizes: "512x512",
},