mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-29 08:07:48 +09:00
Closes https://github.com/webstudio-is/webstudio/issues/3991 Adds HTTP Basic Authentication support for published pages and project-level `.wsauth` rules. This introduces a new `@webstudio-is/wsauth` package that owns the generic authentication format logic: parsing, validation, serialization, route matching, resource generation, and request authentication. The current supported method is `basic`, with the package structured so additional auth methods can be added later. Builder changes include: - Page Settings now has an `Authentication` section for per-page Basic Auth credentials. - Project Settings now has an `Authentication` section for editing `.wsauth` route rules. - Page Settings was split into section-specific files with focused tests. - Auth UI shows Pro badges/info tooltips but remains editable. - Publishing to custom domains is blocked on plans without `allowAuth` when either page auth or project auth is configured. - ProBadge now renders as a real pricing link and uses improved text alignment. Build/publish changes include: - CLI prebuild generates and merges `.wsauth` entries. - Published app templates enforce auth for HTML/XML routes. - Generated auth resources are shared between build output and runtime.
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
declare module "__CONSTANTS__" {
|
|
import type { ImageLoader, VideoLoader } from "@webstudio-is/image";
|
|
export const assetBaseUrl: string;
|
|
export const imageLoader: ImageLoader;
|
|
export const videoLoader: undefined | VideoLoader;
|
|
}
|
|
|
|
declare module "__CLIENT__" {
|
|
import type { ResourceRequest, System } from "@webstudio-is/sdk";
|
|
|
|
export const projectId: string;
|
|
|
|
export const projectDomain: string | undefined;
|
|
|
|
export const lastPublished: string;
|
|
|
|
export const siteName: string;
|
|
|
|
export const favIconAsset: string | undefined;
|
|
|
|
export const breakpoints: {
|
|
id: string;
|
|
minWidth?: number;
|
|
maxWidth?: number;
|
|
}[];
|
|
|
|
// Font assets on current page (can be preloaded)
|
|
export const pageFontAssets: string[];
|
|
|
|
export const pageBackgroundImageAssets: string[];
|
|
|
|
export const CustomCode: () => ReactNode;
|
|
|
|
export const Page: (props: { system: System }) => ReactNode;
|
|
}
|
|
|
|
declare module "__SERVER__" {
|
|
import type { PageMeta, System, ResourceRequest } from "@webstudio-is/sdk";
|
|
|
|
export const getResources: (props: { system: System }) => {
|
|
data: Map<string, ResourceRequest>;
|
|
action: Map<string, ResourceRequest>;
|
|
};
|
|
|
|
export const getPageMeta: (props: {
|
|
system: System;
|
|
resources: Record<string, any>;
|
|
}) => PageMeta;
|
|
|
|
type Params = Record<string, string | undefined>;
|
|
export const getRemixParams: ({ ...params }: Params) => Params;
|
|
|
|
export const contactEmail: undefined | string;
|
|
}
|
|
|
|
declare module "__AUTH__" {
|
|
import type { WsAuthRoute } from "@webstudio-is/wsauth";
|
|
export const authRoutes: WsAuthRoute[];
|
|
}
|
|
|
|
declare module "__SITEMAP__" {
|
|
export const sitemap: Array<{
|
|
path: string;
|
|
lastModified: string;
|
|
}>;
|
|
}
|
|
|
|
declare module "__ASSETS__" {
|
|
import type { RuntimeAsset } from "@webstudio-is/sdk";
|
|
export const assets: Record<string, RuntimeAsset>;
|
|
}
|
|
|
|
declare module "__REDIRECT__" {
|
|
export const url: string;
|
|
export const status: number;
|
|
}
|