(feat): prepare for new ident flow
Some checks failed
/ build-web (push) Failing after 3m21s
/ build-desktop (linux) (push) Failing after 3m37s
/ build-mobile (push) Failing after 11m20s
/ release (push) Has been skipped

(fix): some bugs
This commit is contained in:
Alois 2026-07-02 23:56:49 +02:00
commit 8e831fd993
8 changed files with 177 additions and 232 deletions

View file

@ -238,19 +238,9 @@ function RootShell() {
<LoginWrapper>
<LegalWrapper>
<Crypto>
<MTPProvider>
<Session>
<UserContext>
<CallInit />
<CallPopout />
<TAuthWrapper>
<DesktopMediaProvider>
<Outlet />
</DesktopMediaProvider>
</TAuthWrapper>
</UserContext>
</Session>
</MTPProvider>
<DesktopMediaProvider>
<Outlet />
</DesktopMediaProvider>
</Crypto>
</LegalWrapper>
</LoginWrapper>
@ -264,13 +254,23 @@ function RootShell() {
function AppShell() {
return (
<AppLayout>
<ChatContext>
<NotificationsProvider>
<Outlet />
</NotificationsProvider>
</ChatContext>
</AppLayout>
<MTPProvider>
<Session>
<UserContext>
<CallInit />
<CallPopout />
<TAuthWrapper>
<AppLayout>
<ChatContext>
<NotificationsProvider>
<Outlet />
</NotificationsProvider>
</ChatContext>
</AppLayout>
</TAuthWrapper>
</UserContext>
</Session>
</MTPProvider>
);
}

View file

@ -3,7 +3,7 @@ import type { IncomingMessage, ServerResponse } from "node:http";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig, type Plugin } from "vite";
import { defineConfig, normalizePath, type Plugin } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { mtp } from "mtp/vite";
@ -51,6 +51,38 @@ function deepFilterAssetHeaders(rootDir: string): Plugin {
};
}
function restartOnMtpSourceChange(srcDir: string): Plugin {
const watchedDir = normalizePath(realpathSync(srcDir));
return {
name: "restart-on-mtp-source-change",
apply: "serve",
configureServer(server) {
server.watcher.add(watchedDir);
let restartTimer: ReturnType<typeof setTimeout> | null = null;
const restart = (file: string) => {
if (!normalizePath(file).startsWith(`${watchedDir}/`)) {
return;
}
if (restartTimer) {
clearTimeout(restartTimer);
}
restartTimer = setTimeout(() => {
restartTimer = null;
void server.restart();
}, 50);
};
server.watcher.on("add", restart);
server.watcher.on("change", restart);
server.watcher.on("unlink", restart);
},
};
}
export default defineConfig({
base: "./",
clearScreen: false,
@ -105,7 +137,6 @@ export default defineConfig({
},
envPrefix: ["VITE_", "TAURI_ENV_*"],
optimizeDeps: {
// Annoying Vite 8 stuff
include: [
"react-redux",
"use-sync-external-store/shim/with-selector",
@ -114,7 +145,28 @@ export default defineConfig({
"eventemitter3",
"react-is",
],
exclude: ["mtp", "mtp/raw", "mtp/type-map", "@tensamin/shared"],
exclude: [
"mtp",
"mtp/raw",
"mtp/type-map",
"@tensamin/call",
"@tensamin/call/utils",
"@tensamin/chat",
"@tensamin/crypto",
"@tensamin/crypto/context",
"@tensamin/crypto/worker",
"@tensamin/markdown",
"@tensamin/mtp",
"@tensamin/notifications",
"@tensamin/shared",
"@tensamin/shared/data",
"@tensamin/shared/log",
"@tensamin/storage",
"@tensamin/storage/context",
"@tensamin/tauri",
"@tensamin/tauth",
"@tensamin/user",
],
},
build: {
minify: !process.env.TAURI_ENV_DEBUG ? "esbuild" : false,
@ -122,6 +174,7 @@ export default defineConfig({
},
plugins: [
deepFilterAssetHeaders(resolve(appDir, "public")),
restartOnMtpSourceChange(resolve(appDir, "../../packages/mtp/src")),
mtp({ typeMaps: resolve(appDir, "../../type-maps.yaml") }),
react(),
tailwindcss(),