diff --git a/package.json b/package.json index c9a6efa..20098ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colorish", - "version": "1.1.0", + "version": "1.2.0", "private": true, "synopsis": "The official manager for Project Colorway-compatible apps.", "description": "The official manager for Project Colorway-compatible apps. Change, create and manage, all from one place.", diff --git a/src/auth.ts b/src/auth.ts deleted file mode 100644 index 74abdaf..0000000 --- a/src/auth.ts +++ /dev/null @@ -1,30 +0,0 @@ -import {SvelteKitAuth} from "@auth/sveltekit" -import Discord from '@auth/core/providers/discord'; - -export const {handle} = SvelteKitAuth({ - trustHost: true, - providers: [ - Discord({ - async profile(profile) { - console.log(profile) - return { - id: profile.id, - name: profile.username, - image: `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.webp` - }; - }, - }) - ], - callbacks: { - jwt({ token, user }) { - if (user) { // User is available during sign-in - token.id = user.id - } - return token - }, - session({ session, token }) { - session.user.id = token.id as string - return session - }, - }, -}); diff --git a/src/electron.cjs b/src/electron.cjs index c98b7be..80eb0fb 100644 --- a/src/electron.cjs +++ b/src/electron.cjs @@ -146,6 +146,7 @@ wsManager.on("connection", function connection(wss) { return; case "complication:manager-role:request": if (!ws.isManager.get()) mainWindow.webContents.send("complication:manager-role:request", data.boundKey); + mainWindow.focus(); return; } } @@ -154,9 +155,9 @@ wsManager.on("connection", function connection(wss) { mainWindow.webContents.send("client-connected"); ws.dispatch("manager-connection-established", { MID }); }); -const serveURL = serve({ directory: "." }); const port = process.env.PORT || 5173; const dev = !app.isPackaged; +const serveURL = serve({ directory: dev ? path.join("..", "build") : "." }); let mainWindow; function createWindow() { let windowState = windowStateManager({ defaultWidth: 800, defaultHeight: 600 }); @@ -184,7 +185,7 @@ function createWindow() { width: windowState.width, height: windowState.height, title: "Colorish", - icon: "../colorish.png" + icon: "../colorish_256x256.png" }); windowState.manage(mainWindow); mainWindow.once("ready-to-show", () => { @@ -209,7 +210,7 @@ function createMainWindow() { mainWindow.once("close", () => { mainWindow = null; }); - if (dev) + if(dev) loadVite(port); else serveURL(mainWindow); @@ -263,4 +264,8 @@ ipcMain.on("complication:manager-role:manager-updated", (_, boundKey) => { ipcMain.on("complication:ui-summon:summon", (_, boundKey) => { const wsClient = wsClients.filter(ws => (typeof ws.boundKey.get() == "string" ? ws.boundKey.get() : JSON.stringify(ws.boundKey.get())) == JSON.stringify(boundKey))[0] wsClient.dispatch("complication:ui-summon:summon"); -}); \ No newline at end of file +}); + +ipcMain.on("getFocus", () => { + mainWindow.focus(); +}) \ No newline at end of file diff --git a/src/hooks.server.ts b/src/hooks.server.ts deleted file mode 100644 index bd2d43c..0000000 --- a/src/hooks.server.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { redirect, type Handle, type RequestEvent } from '@sveltejs/kit'; -import { handle as authenticationHandle } from './auth'; -import { sequence } from '@sveltejs/kit/hooks'; - -async function authorizationHandle({ event, resolve }) { - if (event.url.pathname.startsWith('/protected') || event.url.pathname.startsWith('/creator')) { - const session = await event.locals.auth(); - if (!session) { - throw redirect(303, '/authinternal?redirect=' + event.url.pathname); - } - } - - if (event.url.pathname.startsWith('/authinternal')) { - const session = await event.locals.auth(); - if (session) { - if((event as RequestEvent).url.searchParams.get("redirect")) { - throw redirect(303, (event as RequestEvent).url.searchParams.get("redirect")!); - } else { - throw redirect(303, '/'); - } - } - } - - return resolve(event); -} -export const handle: Handle = sequence(authenticationHandle, authorizationHandle) \ No newline at end of file diff --git a/src/lib/app.scss b/src/lib/app.scss index ffec84e..68ddcf1 100644 --- a/src/lib/app.scss +++ b/src/lib/app.scss @@ -71,14 +71,14 @@ flex-direction: column; gap: 4px; padding: 16px; - & .modal-header { - color: #fff; - margin: 0; - font-weight: normal; - font-size: 1.25em; - margin-bottom: 8px; - // font-family: "NDOT"; - } +} +.modal-header { + color: #fff; + margin: 0; + font-weight: normal; + font-size: 1.25em; + margin-bottom: 8px; + // font-family: "NDOT"; } .sect-header { color: #fff; diff --git a/src/lib/components/ClientManagerRequestModal.svelte b/src/lib/components/ClientManagerRequestModal.svelte index c836b10..a630df0 100644 --- a/src/lib/components/ClientManagerRequestModal.svelte +++ b/src/lib/components/ClientManagerRequestModal.svelte @@ -18,7 +18,8 @@ /> {getClientDisplayName(Object.values(boundKey)[0])} has requested - manager access
@@ -44,4 +61,7 @@ .modal-content { min-width: 400px; } + .modal { + max-width: 500px; + } diff --git a/src/lib/components/SourcePreviewModal.svelte b/src/lib/components/SourcePreviewModal.svelte new file mode 100644 index 0000000..b679877 --- /dev/null +++ b/src/lib/components/SourcePreviewModal.svelte @@ -0,0 +1,142 @@ + + + +{#if open} +