* feat: move mock exercise template to api * feat: add template migration file * chore: - remove exercise templates form api - rework api to pull exercise templates from db - add exercise template seed to seed file - declutter seed file * chore: - refactor template fetch to be dependent on the selected tag - add tag to schema, remote db and template's seed file - clear remote db's template table and replace data and their respective tags * chore: add number of questions and center loading screen on the frontend * chore: pr fixes * chore: type fixes * chore: - move seed functionality to /seed folder - add typing for individual seed functions - pr fixes * chore: pr fixes v2 * update output css * refactor: update seeding script and schema definitions - Renamed `seedTypes` to `seedQuestionTypes` for clarity in the seeding process. - Enhanced the seeding script to include a command-line interface for better usability, allowing specific seed functions to be executed based on flags. - Removed redundant unique constraints in the schema definitions for `courseNewsfeedComment` and `exerciseTemplate` to streamline database structure. * feat: add email verification error handling page and update session management - Introduced a new page for handling email verification errors, providing user-friendly messages based on error types. - Updated session management logic to improve handling of public routes and session states. - Enhanced security policies in the Svelte configuration to include additional sources for styles and scripts. - Removed the old email verification error page to streamline the codebase. * move the exercise template to cloudflare cdn --------- Co-authored-by: Rotimi Best <[email protected]>
146 lines
5.1 KiB
JavaScript
146 lines
5.1 KiB
JavaScript
import 'dotenv/config';
|
|
|
|
import adapterNode from '@sveltejs/adapter-node';
|
|
import adapterVercel from '@sveltejs/adapter-vercel';
|
|
import path from 'path';
|
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
|
|
|
const useNodeAdapter = process.env.PUBLIC_IS_SELFHOSTED === 'true';
|
|
|
|
/** @type {import('@sveltejs/kit').Config} */
|
|
const config = {
|
|
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
|
// for more information about preprocessors
|
|
preprocess: [vitePreprocess({})],
|
|
kit: {
|
|
adapter: useNodeAdapter ? adapterNode() : adapterVercel(),
|
|
alias: {
|
|
$lib: path.resolve('./src/lib'),
|
|
$features: path.resolve('./src/lib/features'),
|
|
$mail: path.resolve('./src/mail'),
|
|
'$src/tools': path.resolve('./node_modules/@cio/ui/src/tools/index.ts'),
|
|
'$src/base/*': path.resolve('./node_modules/@cio/ui/src/base/*'),
|
|
'@cio/ui': path.resolve('./node_modules/@cio/ui/src'),
|
|
'@cio/ui/*': path.resolve('./node_modules/@cio/ui/src/*'),
|
|
'@cio/api': path.resolve('./node_modules/@cio/api/dist'),
|
|
'@cio/api/*': path.resolve('./node_modules/@cio/api/dist/*'),
|
|
'@cio/utils': path.resolve('./node_modules/@cio/utils/dist'),
|
|
'@cio/utils/*': path.resolve('./node_modules/@cio/utils/dist/*'),
|
|
'@cio/db/types': path.resolve('./node_modules/@cio/db/src/types.ts')
|
|
},
|
|
csp: {
|
|
directives: {
|
|
'default-src': ['self'],
|
|
'script-src': [
|
|
'self',
|
|
'https://assets.cdn.clsrio.com',
|
|
'https://cdnjs.cloudflare.com',
|
|
'https://*.i.posthog.com',
|
|
'https://*.senja.io',
|
|
'https://www.youtube.com',
|
|
'https://youtube.com',
|
|
'unsafe-hashes'
|
|
],
|
|
'style-src': [
|
|
'self',
|
|
'unsafe-inline',
|
|
'https://cdn.plyr.io',
|
|
'https://unpkg.com/[email protected]/dist/katex.min.css',
|
|
'https://assets.cdn.clsrio.com/eqneditor_1.css',
|
|
'https://fonts.googleapis.com'
|
|
],
|
|
'style-src-elem': [
|
|
'self',
|
|
'unsafe-inline',
|
|
'https://cdn.plyr.io',
|
|
'https://unpkg.com/[email protected]/dist/katex.min.css',
|
|
'https://assets.cdn.clsrio.com/eqneditor_1.css',
|
|
'https://fonts.googleapis.com'
|
|
],
|
|
'font-src': ['self', 'https://fonts.gstatic.com', 'https://cdn.plyr.io'],
|
|
'img-src': ['self', 'data:', 'https:'],
|
|
'media-src': ['self', 'https:', 'data:'],
|
|
'frame-src': ['self', 'https://www.youtube.com', 'https://youtube.com'],
|
|
'connect-src': [
|
|
'self',
|
|
'https://*.supabase.co',
|
|
'https://*.classroomio.com',
|
|
'https://assets.cdn.clsrio.com',
|
|
'https://cdn.plyr.io',
|
|
'https://*.i.posthog.com',
|
|
'https://umami.hz.oncws.com',
|
|
'https://*.r2.cloudflarestorage.com',
|
|
'http://localhost:3002',
|
|
'http://localhost:54321',
|
|
'ws://localhost:54321',
|
|
'wss://*.classroomio.com',
|
|
'wss://*.supabase.co',
|
|
'https://*.senja.io'
|
|
],
|
|
'worker-src': ['self', 'blob:'],
|
|
'object-src': ['none'],
|
|
'base-uri': ['self'],
|
|
'form-action': ['self'],
|
|
'frame-ancestors': ['none'],
|
|
'upgrade-insecure-requests': true
|
|
},
|
|
reportOnly: {
|
|
'default-src': ['self'],
|
|
'script-src': [
|
|
'self',
|
|
'https://assets.cdn.clsrio.com',
|
|
'https://cdnjs.cloudflare.com',
|
|
'https://*.i.posthog.com',
|
|
'https://*.senja.io',
|
|
'https://www.youtube.com',
|
|
'https://youtube.com',
|
|
'unsafe-hashes'
|
|
],
|
|
'style-src': [
|
|
'self',
|
|
'unsafe-inline',
|
|
'https://cdn.plyr.io',
|
|
'https://unpkg.com/[email protected]/dist/katex.min.css',
|
|
'https://assets.cdn.clsrio.com/eqneditor_1.css'
|
|
],
|
|
'style-src-elem': [
|
|
'self',
|
|
'unsafe-inline',
|
|
'https://cdn.plyr.io',
|
|
'https://unpkg.com/[email protected]/dist/katex.min.css',
|
|
'https://assets.cdn.clsrio.com/eqneditor_1.css'
|
|
],
|
|
'font-src': ['self', 'https://fonts.gstatic.com', 'https://cdn.plyr.io'],
|
|
'img-src': ['self', 'data:', 'https:'],
|
|
'media-src': ['self', 'https:', 'data:'],
|
|
'frame-src': ['self', 'https://www.youtube.com', 'https://youtube.com'],
|
|
'connect-src': [
|
|
'self',
|
|
'https://*.supabase.co',
|
|
'https://pgrest.classroomio.com',
|
|
'https://api.classroomio.com',
|
|
'https://assets.cdn.clsrio.com',
|
|
'https://cdn.plyr.io',
|
|
'https://*.i.posthog.com',
|
|
'https://umami.hz.oncws.com',
|
|
'https://*.r2.cloudflarestorage.com',
|
|
'http://localhost:3002',
|
|
'http://localhost:54321',
|
|
'ws://localhost:54321',
|
|
'wss://*.classroomio.com',
|
|
'wss://*.supabase.co',
|
|
'https://*.senja.io'
|
|
],
|
|
'worker-src': ['self', 'blob:'],
|
|
'object-src': ['none'],
|
|
'base-uri': ['self'],
|
|
'form-action': ['self'],
|
|
'frame-ancestors': ['none'],
|
|
'report-uri': ['/csp-report']
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default config;
|