commit
bf31b8c8a5
@ -31,8 +31,9 @@
|
||||
);
|
||||
}
|
||||
}(window.location))
|
||||
</script>
|
||||
</script>
|
||||
<!-- End Single Page Apps for GitHub Pages -->
|
||||
<script defer data-domain="pk-webs-beta.spectralitree.com" src="https://plausible.pluralkit.me/js/plausible.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -20,6 +20,8 @@
|
||||
"vite": "^2.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/browser": "^6.19.5",
|
||||
"@sentry/tracing": "^6.19.5",
|
||||
"@types/twemoji": "^12.1.2",
|
||||
"axios": "^0.24.0",
|
||||
"discord-markdown": "^2.5.1",
|
||||
|
@ -11,6 +11,7 @@
|
||||
import Member from './pages/Member.svelte';
|
||||
import Group from './pages/Group.svelte';
|
||||
import { Alert } from 'sveltestrap';
|
||||
import DiscordLogin from "./pages/DiscordLogin.svelte";
|
||||
|
||||
// theme cdns (I might make some myself too)
|
||||
let light = "https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css";
|
||||
@ -51,6 +52,7 @@
|
||||
<Router>
|
||||
<Navigation bind:style={style}/>
|
||||
<Route path="/"><Home /></Route>
|
||||
<Route path="/login/discord"><DiscordLogin /></Route>
|
||||
<Route path="dash"><Dash /></Route>
|
||||
<Route path="dash/m/:id"><Member isPublic={falseBool}/></Route>
|
||||
<Route path = "dash/g/:id"><Group isPublic={falseBool}/></Route>
|
||||
|
@ -1,10 +1,25 @@
|
||||
import axios from 'axios';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
|
||||
const baseUrl = () => localStorage.isBeta ? "https://api.beta.pluralkit.me" : "https://api.pluralkit.me";
|
||||
const baseUrl = () => window.location.origin.includes("localhost") ? "http://localhost:5000" : localStorage.isBeta ? "https://api.beta.pluralkit.me" : "https://api.pluralkit.me";
|
||||
|
||||
const methods = ['get', 'post', 'delete', 'patch', 'put'];
|
||||
const noop = () => {};
|
||||
|
||||
const scheduled = [];
|
||||
const runAPI = () => {
|
||||
if (scheduled.length == 0) return;
|
||||
const {axiosData, res, rej} = scheduled.shift();
|
||||
axios(axiosData)
|
||||
.then((resp) => res(parseData(resp.status, resp.data)))
|
||||
.catch((err) => {
|
||||
Sentry.captureException("Fetch error", err);
|
||||
rej(err);
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(runAPI, 500);
|
||||
|
||||
export default function() {
|
||||
const route = [];
|
||||
const handler = {
|
||||
@ -12,7 +27,7 @@ export default function() {
|
||||
if (route.length == 0 && name != "private")
|
||||
route.push("v2");
|
||||
if (methods.includes(name)) {
|
||||
return ({ data = undefined, auth = true, token = null, query = null } = {}) => new Promise((res, rej) => axios({
|
||||
return ({ data = undefined, auth = true, token = null, query = null } = {}) => new Promise((res, rej) => scheduled.push({ res, rej, axiosData: {
|
||||
url: baseUrl() + "/" + route.join("/") + (query ? `?${Object.keys(query).map(x => `${x}=${query[x]}`).join("&")}` : ""),
|
||||
method: name,
|
||||
headers: {
|
||||
@ -21,7 +36,7 @@ export default function() {
|
||||
},
|
||||
data: !!data ? JSON.stringify(data) : undefined,
|
||||
validateStatus: () => true,
|
||||
}).then((resp) => res(parseData(resp.status, resp.data))).catch(rej));
|
||||
}}));
|
||||
}
|
||||
route.push(name);
|
||||
return new Proxy(noop, handler);
|
||||
|
16
src/main.ts
16
src/main.ts
@ -1,3 +1,19 @@
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { Integrations } from "@sentry/tracing";
|
||||
|
||||
Sentry.init({
|
||||
dsn: "https://58109fec589f4c2bbfa190329acf679a@sentry.pluralkit.me/4",
|
||||
integrations: [new Integrations.BrowserTracing()],
|
||||
|
||||
enabled: !window.location.origin.includes("localhost"),
|
||||
debug: false,
|
||||
release: "dev",
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
});
|
||||
|
||||
import App from './App.svelte'
|
||||
|
||||
const app = new App({
|
||||
|
33
src/pages/DiscordLogin.svelte
Normal file
33
src/pages/DiscordLogin.svelte
Normal file
@ -0,0 +1,33 @@
|
||||
<script lang="ts">
|
||||
import { Container, Row, Col } from 'sveltestrap';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import api from '../api';
|
||||
|
||||
let text = "Loading...";
|
||||
|
||||
onMount(async () =>
|
||||
{
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const paramkeys = [...params.keys()];
|
||||
if (paramkeys.includes("code"))
|
||||
{
|
||||
const res = await api().private.discord.callback.post({ data: { code: params.get("code"), redirect_domain: window.location.origin } });
|
||||
localStorage.setItem("pk-token", res.token);
|
||||
localStorage.setItem("pk-user", JSON.stringify(res.system));
|
||||
window.location.href = window.location.origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "Error: " + params.get("error_description");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Row>
|
||||
<Col class="mx-auto" xs={12} lg={11} xl={10}>
|
||||
{text}
|
||||
</Col>
|
||||
</Row>
|
||||
</Container>
|
@ -108,6 +108,18 @@
|
||||
<Button style="width: 100%" color="primary" on:click={() => login(token)}>Submit</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
<br>
|
||||
<Row>
|
||||
<Col xs={1} md={0}><span>Or,</span></Col>
|
||||
<Col md={4}>
|
||||
<Button style="width: 90%" color="dark" on:click={() => window.location.href = `https://discord.com/api/oauth2/authorize?client_id=${localStorage.isBeta ? "912009351160541225" : "466378653216014359"}&redirect_uri=${encodeURIComponent(window.location.origin + "/login/discord")}&response_type=code&scope=guilds%20identify`}>
|
||||
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19.54 0c1.356 0 2.46 1.104 2.46 2.472v21.528l-2.58-2.28-1.452-1.344-1.536-1.428.636 2.22h-13.608c-1.356 0-2.46-1.104-2.46-2.472v-16.224c0-1.368 1.104-2.472 2.46-2.472h16.08zm-4.632 15.672c2.652-.084 3.672-1.824 3.672-1.824 0-3.864-1.728-6.996-1.728-6.996-1.728-1.296-3.372-1.26-3.372-1.26l-.168.192c2.04.624 2.988 1.524 2.988 1.524-1.248-.684-2.472-1.02-3.612-1.152-.864-.096-1.692-.072-2.424.024l-.204.024c-.42.036-1.44.192-2.724.756-.444.204-.708.348-.708.348s.996-.948 3.156-1.572l-.12-.144s-1.644-.036-3.372 1.26c0 0-1.728 3.132-1.728 6.996 0 0 1.008 1.74 3.66 1.824 0 0 .444-.54.804-.996-1.524-.456-2.1-1.416-2.1-1.416l.336.204.048.036.047.027.014.006.047.027c.3.168.6.3.876.408.492.192 1.08.384 1.764.516.9.168 1.956.228 3.108.012.564-.096 1.14-.264 1.74-.516.42-.156.888-.384 1.38-.708 0 0-.6.984-2.172 1.428.36.456.792.972.792.972zm-5.58-5.604c-.684 0-1.224.6-1.224 1.332 0 .732.552 1.332 1.224 1.332.684 0 1.224-.6 1.224-1.332.012-.732-.54-1.332-1.224-1.332zm4.38 0c-.684 0-1.224.6-1.224 1.332 0 .732.552 1.332 1.224 1.332.684 0 1.224-.6 1.224-1.332 0-.732-.54-1.332-1.224-1.332z"/>
|
||||
</svg>
|
||||
Login with Discord
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
{/if}
|
||||
</CardBody>
|
||||
</Card>
|
||||
|
@ -36,9 +36,6 @@
|
||||
shard.last_heartbeat = new Date(Number(shard.last_heartbeat) * 1000).toUTCString().match(/([0-9][0-9]:[0-9][0-9]:[0-9][0-9])/)?.shift()
|
||||
return shard;
|
||||
});
|
||||
console.log(data[0].cluster_id);
|
||||
|
||||
pingAverage = Math.trunc(pings / shards.length).toString();
|
||||
|
||||
currentCommitMsg = `Current Git commit: <a href="https://github.com/xSke/PluralKit/commit/${pkdata.version}">${pkdata.version.slice(0,7)}</a>`;
|
||||
|
||||
@ -49,10 +46,11 @@
|
||||
clusterData[shard.cluster_id].push(shard);
|
||||
});
|
||||
clusters = clusterData;
|
||||
} else {
|
||||
shards = data;
|
||||
}
|
||||
|
||||
shards = data;
|
||||
pingAverage = Math.trunc(pings / shards.length).toString();
|
||||
|
||||
message = "";
|
||||
};
|
||||
|
||||
@ -142,7 +140,7 @@
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
{#if shards.length > 0}
|
||||
{#if Object.keys(clusters).length == 0 && shards.length > 0}
|
||||
<Row>
|
||||
<Col class="mx-auto" xs={12} lg={11} xl={10}>
|
||||
<Card class="mb-4">
|
||||
|
68
yarn.lock
68
yarn.lock
@ -36,6 +36,69 @@
|
||||
estree-walker "^2.0.1"
|
||||
picomatch "^2.2.2"
|
||||
|
||||
"@sentry/browser@^6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.19.5.tgz#77d4c860ab86f89a41d4b15a8eafb42417c47888"
|
||||
integrity sha512-dmk15tTm9J+6v/N8nSoc7dUnpS/EJdwfOd3YSRk2iaJLJkWvJ7ELRe5SnH4MnK89Qpw7FKC5OjB977TeK11QAA==
|
||||
dependencies:
|
||||
"@sentry/core" "6.19.5"
|
||||
"@sentry/types" "6.19.5"
|
||||
"@sentry/utils" "6.19.5"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/core@6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.5.tgz#b8e0d54a22f588f8cbe2740913b8d06ec76fb1bb"
|
||||
integrity sha512-PSrJYdhti5IWBo+1hLn4olRPQXJxsnkrB5X7Wk2peEYKGk6Vx98B9h7lQ4Tgsg9sUUOH4HsmNwU2kZKtMRVB5Q==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.19.5"
|
||||
"@sentry/minimal" "6.19.5"
|
||||
"@sentry/types" "6.19.5"
|
||||
"@sentry/utils" "6.19.5"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/hub@6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.5.tgz#978849b003ff130225540355fddfdc3feb4fc7a8"
|
||||
integrity sha512-aMpsQFOcsdkfjbruIretxetmU+XbQNrheaFHJSOt1hB4LZr1fU4M29wKkK5Hj5ELiaNcC23u+0G7y5Nizwzsnw==
|
||||
dependencies:
|
||||
"@sentry/types" "6.19.5"
|
||||
"@sentry/utils" "6.19.5"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/minimal@6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.5.tgz#a1b08eadde9e77e063346d5f3170a58aa1da0916"
|
||||
integrity sha512-zcYGEuqPbLo1gHeYHalna7rNPZIA6+U9dPCDgQpM2GgIGhAxJxvyx57ducatxRQgdPtljn5/VPDxdACiwoc+Jg==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.19.5"
|
||||
"@sentry/types" "6.19.5"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/tracing@^6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.19.5.tgz#dfce99842768ff7bde73d1368a848b72e83a734b"
|
||||
integrity sha512-8jozVkPMj3I7emgmKWCRr0DvblZHwJ2SS5qCAA5gmKo6uNTVwwe6Sh1ovETJ/rrZ72YGfpeC/yYBcNpst8I+iQ==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.19.5"
|
||||
"@sentry/minimal" "6.19.5"
|
||||
"@sentry/types" "6.19.5"
|
||||
"@sentry/utils" "6.19.5"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/types@6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.5.tgz#628e76351209a5e4fcaa94bcbe56fe788d65ea15"
|
||||
integrity sha512-G5bGj0ZXRPDrEAxuNO6Jyeq/OG6v9msoE9C/xy1r6JMvVTxX000TmLGKjK1NqqrBbVWdcyFbT3jhJgae0uyBVA==
|
||||
|
||||
"@sentry/utils@6.19.5":
|
||||
version "6.19.5"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.5.tgz#507312fff2f7332debc8e54240e3b5c6d94db768"
|
||||
integrity sha512-VuNraZZzEu/qVI11CMiRcSa+JVNwOuUe4HfZrDmnJbfrTpbQgjAdScnekEHLaGILGm8lQ8M2qeOxqfNF6kRn9w==
|
||||
dependencies:
|
||||
"@sentry/types" "6.19.5"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sveltejs/vite-plugin-svelte@^1.0.0-next.30":
|
||||
version "1.0.0-next.31"
|
||||
resolved "https://registry.yarnpkg.com/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.31.tgz#5d0d5445ed85a1af613224eacff78c69f14c7fad"
|
||||
@ -1072,6 +1135,11 @@ trim-repeated@^1.0.0:
|
||||
dependencies:
|
||||
escape-string-regexp "^1.0.2"
|
||||
|
||||
tslib@^1.9.3:
|
||||
version "1.14.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
||||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
||||
|
||||
tslib@^2.0.3, tslib@^2.3.1:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
|
||||
|
Loading…
Reference in New Issue
Block a user