mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-08 18:54:22 -04:00
Fix yoshiki providers + add vite proxy
This commit is contained in:
parent
b4f303e0fb
commit
b4144e61d3
@ -1,7 +1,7 @@
|
|||||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||||
import { Slot } from "one";
|
import { Slot } from "one";
|
||||||
import { useServerHeadInsertion } from "one";
|
import { useServerHeadInsertion } from "one";
|
||||||
import { StyleRegistryProvider, createStyleRegistry, useTheme } from "yoshiki/web";
|
import { StyleRegistryProvider, createStyleRegistry } from "yoshiki/web";
|
||||||
import { Providers } from "~/providers";
|
import { Providers } from "~/providers";
|
||||||
|
|
||||||
const GlobalCssTheme = () => {
|
const GlobalCssTheme = () => {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { createMiddleware, setServerData } from "one";
|
import { createMiddleware, setServerData } from "one";
|
||||||
|
|
||||||
export default createMiddleware(({ request, next }) => {
|
export default createMiddleware(({ request, next }) => {
|
||||||
console.log(request);
|
|
||||||
setServerData("cookies", request.headers.get("Cookies") ?? "");
|
setServerData("cookies", request.headers.get("Cookies") ?? "");
|
||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import type { Property } from "csstype";
|
import type { Property } from "csstype";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { Platform, type TextStyle } from "react-native";
|
import { Platform, type TextStyle } from "react-native";
|
||||||
import { type Theme, ThemeProvider, useAutomaticTheme } from "yoshiki";
|
import { type Theme, ThemeProvider as WebThemeProvider, useAutomaticTheme } from "yoshiki";
|
||||||
import "yoshiki";
|
import "yoshiki";
|
||||||
import { useTheme, useYoshiki } from "yoshiki/native";
|
import { ThemeProvider, useTheme, useYoshiki } from "yoshiki/native";
|
||||||
import "yoshiki/native";
|
import "yoshiki/native";
|
||||||
import { catppuccin } from "./catppuccin";
|
import { catppuccin } from "./catppuccin";
|
||||||
|
|
||||||
@ -127,7 +127,11 @@ export const ThemeSelector = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const newTheme = selectMode({ ...catppuccin, font }, theme);
|
const newTheme = selectMode({ ...catppuccin, font }, theme);
|
||||||
|
|
||||||
return <ThemeProvider theme={newTheme}>{children as any}</ThemeProvider>;
|
return (
|
||||||
|
<ThemeProvider theme={newTheme}>
|
||||||
|
<WebThemeProvider theme={newTheme}>{children as any}</WebThemeProvider>
|
||||||
|
</ThemeProvider>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export type YoshikiFunc<T> = (props: ReturnType<typeof useYoshiki>) => T;
|
export type YoshikiFunc<T> = (props: ReturnType<typeof useYoshiki>) => T;
|
||||||
@ -190,4 +194,3 @@ export const ContrastArea = ({
|
|||||||
export const alpha = (color: Property.Color, alpha: number) => {
|
export const alpha = (color: Property.Color, alpha: number) => {
|
||||||
return color + Math.round(alpha * 255).toString(16);
|
return color + Math.round(alpha * 255).toString(16);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import type { FC } from "react";
|
|||||||
import type { KyooError } from "~/models";
|
import type { KyooError } from "~/models";
|
||||||
import { ConnectionError } from "./connection";
|
import { ConnectionError } from "./connection";
|
||||||
import { OfflineView } from "./offline";
|
import { OfflineView } from "./offline";
|
||||||
import { SetupPage } from "./setup";
|
// import { SetupPage } from "./setup";
|
||||||
import { Unauthorized } from "./unauthorized";
|
import { Unauthorized } from "./unauthorized";
|
||||||
|
|
||||||
export * from "./error";
|
export * from "./error";
|
||||||
@ -15,7 +15,7 @@ export type ErrorHandler = {
|
|||||||
|
|
||||||
export const errorHandlers: Record<string, ErrorHandler> = {
|
export const errorHandlers: Record<string, ErrorHandler> = {
|
||||||
unauthorized: { view: Unauthorized, forbid: "app" },
|
unauthorized: { view: Unauthorized, forbid: "app" },
|
||||||
setup: { view: SetupPage, forbid: "setup" },
|
// setup: { view: SetupPage, forbid: "setup" },
|
||||||
connection: { view: ConnectionError },
|
connection: { view: ConnectionError },
|
||||||
offline: { view: OfflineView },
|
offline: { view: OfflineView },
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,16 @@ export default {
|
|||||||
ssr: {
|
ssr: {
|
||||||
noExternal: ["@tanstack/react-query", "@tanstack/react-query-devtools"],
|
noExternal: ["@tanstack/react-query", "@tanstack/react-query-devtools"],
|
||||||
},
|
},
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
"/api": {
|
||||||
|
target: process.env.KYOO_URL ?? "http://back/api",
|
||||||
|
changeOrigin: true,
|
||||||
|
// without this we have two /api at the start
|
||||||
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
one({
|
one({
|
||||||
deps: {
|
deps: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user