mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-06 07:25:53 -05:00
chore: update alerts to use new health service
This commit is contained in:
parent
9d83d7cc1c
commit
0d5ffb4df8
3 changed files with 38 additions and 9 deletions
|
@ -28,7 +28,7 @@ const AppContainer = styled.div`
|
||||||
background-position: center center !important;
|
background-position: center center !important;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StatusBar = styled.div`
|
export const StatusBar = styled.div`
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
import { Twitter, Github, Mastodon } from "@styled-icons/boxicons-logos";
|
import { Twitter, Github, Mastodon } from "@styled-icons/boxicons-logos";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
import { Route, Switch } from "react-router-dom";
|
import { Link, Route, Switch } from "react-router-dom";
|
||||||
|
|
||||||
import styles from "./Login.module.scss";
|
import styles from "./Login.module.scss";
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
import { useApplicationState } from "../../mobx/State";
|
import { useApplicationState } from "../../mobx/State";
|
||||||
|
|
||||||
import LocaleSelector from "../../components/common/LocaleSelector";
|
|
||||||
import wideSVG from "/assets/wide.svg";
|
import wideSVG from "/assets/wide.svg";
|
||||||
|
|
||||||
|
import LocaleSelector from "../../components/common/LocaleSelector";
|
||||||
import { Titlebar } from "../../components/native/Titlebar";
|
import { Titlebar } from "../../components/native/Titlebar";
|
||||||
|
import { useSystemAlert } from "../../updateWorker";
|
||||||
|
import { StatusBar } from "../RevoltApp";
|
||||||
import { FormCreate } from "./forms/FormCreate";
|
import { FormCreate } from "./forms/FormCreate";
|
||||||
import { FormLogin } from "./forms/FormLogin";
|
import { FormLogin } from "./forms/FormLogin";
|
||||||
import { FormReset, FormSendReset } from "./forms/FormReset";
|
import { FormReset, FormSendReset } from "./forms/FormReset";
|
||||||
|
@ -21,11 +23,31 @@ export default observer(() => {
|
||||||
const state = useApplicationState();
|
const state = useApplicationState();
|
||||||
const theme = state.settings.theme;
|
const theme = state.settings.theme;
|
||||||
|
|
||||||
|
const alert = useSystemAlert();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{window.isNative && !window.native.getConfig().frame && (
|
{window.isNative && !window.native.getConfig().frame && (
|
||||||
<Titlebar overlay />
|
<Titlebar overlay />
|
||||||
)}
|
)}
|
||||||
|
{alert && (
|
||||||
|
<StatusBar>
|
||||||
|
<div className="title">{alert.text}</div>
|
||||||
|
<div className="actions">
|
||||||
|
{alert.actions?.map((action) =>
|
||||||
|
action.type === "internal" ? null : action.type ===
|
||||||
|
"external" ? (
|
||||||
|
<a
|
||||||
|
href={action.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
|
<div className="button">{action.text}</div>{" "}
|
||||||
|
</a>
|
||||||
|
) : null,
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</StatusBar>
|
||||||
|
)}
|
||||||
<div className={styles.login}>
|
<div className={styles.login}>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<meta
|
<meta
|
||||||
|
@ -77,17 +99,20 @@ export default observer(() => {
|
||||||
<div className={styles.socials}>
|
<div className={styles.socials}>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/revoltchat"
|
href="https://github.com/revoltchat"
|
||||||
target="_blank" rel="noreferrer">
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
<Github size={24} />
|
<Github size={24} />
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
href="https://twitter.com/revoltchat"
|
href="https://twitter.com/revoltchat"
|
||||||
target="_blank" rel="noreferrer">
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
<Twitter size={24} />
|
<Twitter size={24} />
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
href="https://mastodon.social/@revoltchat"
|
href="https://mastodon.social/@revoltchat"
|
||||||
target="_blank" rel="noreferrer">
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
<Mastodon size={24} />
|
<Mastodon size={24} />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -116,7 +141,8 @@ export default observer(() => {
|
||||||
<a
|
<a
|
||||||
className={styles.attribution}
|
className={styles.attribution}
|
||||||
href="https://unsplash.com/@fakurian"
|
href="https://unsplash.com/@fakurian"
|
||||||
target="_blank" rel="noreferrer">
|
target="_blank"
|
||||||
|
rel="noreferrer">
|
||||||
<Text id="general.image_by" /> ‎@fakurian ‏·
|
<Text id="general.image_by" /> ‎@fakurian ‏·
|
||||||
unsplash.com
|
unsplash.com
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -78,7 +78,7 @@ export function useSystemAlert() {
|
||||||
*/
|
*/
|
||||||
async function checkVersion() {
|
async function checkVersion() {
|
||||||
const { version, poll_rate, alert } = (await fetch(
|
const { version, poll_rate, alert } = (await fetch(
|
||||||
"https://api.revolt.chat/release",
|
"https://health.revolt.chat/api/health",
|
||||||
).then((res) => res.json())) as {
|
).then((res) => res.json())) as {
|
||||||
version: string;
|
version: string;
|
||||||
poll_rate?: number;
|
poll_rate?: number;
|
||||||
|
@ -111,7 +111,10 @@ async function checkVersion() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.env.VITE_API_URL === "https://api.revolt.chat") {
|
if (
|
||||||
|
import.meta.env.VITE_API_URL === "https://api.revolt.chat" ||
|
||||||
|
import.meta.env.VITE_API_URL === "https://app.revolt.chat/api"
|
||||||
|
) {
|
||||||
// Check for critical updates hourly
|
// Check for critical updates hourly
|
||||||
schedule();
|
schedule();
|
||||||
checkVersion();
|
checkVersion();
|
||||||
|
|
Loading…
Reference in a new issue