Compare commits
7 commits
2faf50961e
...
96f5157adf
Author | SHA1 | Date | |
---|---|---|---|
![]() |
96f5157adf | ||
![]() |
87e39fb563 | ||
![]() |
8761caafd8 | ||
![]() |
ed858f5022 | ||
![]() |
f00c6f2f4d | ||
![]() |
072bf2c775 | ||
![]() |
499c497bff |
20 changed files with 384 additions and 386 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,3 +24,4 @@ vite.config.ts.timestamp-*
|
||||||
|
|
||||||
# SQLite
|
# SQLite
|
||||||
*.db
|
*.db
|
||||||
|
drizzle
|
||||||
|
|
|
@ -12,7 +12,8 @@ RUN pnpm i
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN pnpm run db:push \
|
RUN pnpm drizzle-kit generate \
|
||||||
|
&& pnpm drizzle-kit push \
|
||||||
&& pnpm build
|
&& pnpm build
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ WORKDIR /app
|
||||||
COPY --from=build /app/build /app/build
|
COPY --from=build /app/build /app/build
|
||||||
COPY --from=build /app/package.json /app/package.json
|
COPY --from=build /app/package.json /app/package.json
|
||||||
COPY --from=build /app/local.db /app/local.db
|
COPY --from=build /app/local.db /app/local.db
|
||||||
|
COPY --from=build /app/drizzle /app/drizzle
|
||||||
|
|
||||||
RUN npm install --omit=dev --legacy-peer-deps
|
RUN npm install --omit=dev --legacy-peer-deps
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
import { defineConfig } from 'drizzle-kit';
|
import { defineConfig } from 'drizzle-kit';
|
||||||
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
schema: './src/lib/server/db/schema.ts',
|
schema: './src/lib/server/db/schema.ts',
|
||||||
|
out: './drizzle',
|
||||||
|
dialect: 'sqlite',
|
||||||
dbCredentials: {
|
dbCredentials: {
|
||||||
url: process.env.DATABASE_URL
|
url: 'local.db'
|
||||||
},
|
}
|
||||||
|
|
||||||
verbose: true,
|
|
||||||
strict: true,
|
|
||||||
dialect: 'sqlite'
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"lint": "prettier --check . && eslint .",
|
"lint": "prettier --check . && eslint .",
|
||||||
"db:push": "drizzle-kit push",
|
"db:push": "drizzle-kit push",
|
||||||
"db:migrate": "drizzle-kit migrate",
|
"db:migrate": "drizzle-kit migrate",
|
||||||
|
"db:generate": "drizzle-kit generate",
|
||||||
"db:studio": "drizzle-kit studio"
|
"db:studio": "drizzle-kit studio"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-svelte": "^3.3.3",
|
"prettier-plugin-svelte": "^3.3.3",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.10",
|
"prettier-plugin-tailwindcss": "^0.6.10",
|
||||||
"svelte": "^5.19.1",
|
"svelte": "5.19.9",
|
||||||
"svelte-check": "^4.1.4",
|
"svelte-check": "^4.1.4",
|
||||||
"svelte-dnd-action": "^0.9.55",
|
"svelte-dnd-action": "^0.9.55",
|
||||||
"svelte-sonner": "^0.3.28",
|
"svelte-sonner": "^0.3.28",
|
||||||
|
|
|
@ -24,10 +24,8 @@
|
||||||
|
|
||||||
<Input type="hidden" bind:value {...props} />
|
<Input type="hidden" bind:value {...props} />
|
||||||
|
|
||||||
<!-- Configure your `challengeurl` and remove the `test` attribute, see docs: https://altcha.org/docs/website-integration/#using-altcha-widget -->
|
|
||||||
<altcha-widget
|
<altcha-widget
|
||||||
strings={JSON.stringify(estonianStrings)}
|
strings={JSON.stringify(estonianStrings)}
|
||||||
debug
|
|
||||||
challengeurl="/api/altcha"
|
challengeurl="/api/altcha"
|
||||||
spamfilter
|
spamfilter
|
||||||
blockspam
|
blockspam
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
||||||
import Database from 'better-sqlite3';
|
import Database from 'better-sqlite3';
|
||||||
import { env } from '$env/dynamic/private';
|
|
||||||
if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
|
const client = new Database('local.db');
|
||||||
const client = new Database(env.DATABASE_URL);
|
|
||||||
export const db = drizzle(client);
|
export const db = drizzle(client);
|
||||||
|
|
|
@ -69,7 +69,7 @@ export async function POST({ locals, request }) {
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
const timeRemaining = Math.floor((reset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((reset - Date.now()) / 1000);
|
||||||
const message = `Võta veits rahulikumalt. API Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Võta veits rahulikumalt. Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
return json({ error: message }, { status: 429 });
|
return json({ error: message }, { status: 429 });
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ export const load: PageServerLoad = async (event) => {
|
||||||
|
|
||||||
if (!seshSuccess) {
|
if (!seshSuccess) {
|
||||||
const timeRemaining = Math.floor((seshReset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((seshReset - Date.now()) / 1000);
|
||||||
const message = `Sesh Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stage: stage,
|
stage: stage,
|
||||||
|
@ -62,7 +62,7 @@ export const load: PageServerLoad = async (event) => {
|
||||||
|
|
||||||
if (!ipSuccess) {
|
if (!ipSuccess) {
|
||||||
const timeRemaining = Math.floor((ipReset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((ipReset - Date.now()) / 1000);
|
||||||
const message = `IP Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stage: stage,
|
stage: stage,
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const actions: Actions = {
|
||||||
|
|
||||||
if (!seshSuccess) {
|
if (!seshSuccess) {
|
||||||
const timeRemaining = Math.floor((seshReset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((seshReset - Date.now()) / 1000);
|
||||||
const message = `Võta veits rahulikumalt. Sesh Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Võta veits rahulikumalt. Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
if (form.errors.answer) {
|
if (form.errors.answer) {
|
||||||
form.errors.answer.push(message);
|
form.errors.answer.push(message);
|
||||||
|
@ -75,7 +75,7 @@ export const actions: Actions = {
|
||||||
|
|
||||||
if (!ipSuccess) {
|
if (!ipSuccess) {
|
||||||
const timeRemaining = Math.floor((ipReset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((ipReset - Date.now()) / 1000);
|
||||||
const message = `Võta veits rahulikumalt. IP Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Võta veits rahulikumalt. Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
if (form.errors.answer) {
|
if (form.errors.answer) {
|
||||||
form.errors.answer.push(message);
|
form.errors.answer.push(message);
|
||||||
|
@ -177,7 +177,7 @@ export const actions: Actions = {
|
||||||
|
|
||||||
if (!seshSuccess) {
|
if (!seshSuccess) {
|
||||||
const timeRemaining = Math.floor((seshReset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((seshReset - Date.now()) / 1000);
|
||||||
const message = `Võta veits rahulikumalt. Sesh Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Võta veits rahulikumalt. Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
if (form.errors.question) {
|
if (form.errors.question) {
|
||||||
form.errors.question.push(message);
|
form.errors.question.push(message);
|
||||||
|
@ -191,7 +191,7 @@ export const actions: Actions = {
|
||||||
|
|
||||||
if (!ipSuccess) {
|
if (!ipSuccess) {
|
||||||
const timeRemaining = Math.floor((ipReset - Date.now()) / 1000);
|
const timeRemaining = Math.floor((ipReset - Date.now()) / 1000);
|
||||||
const message = `Võta veits rahulikumalt. IP Proovi ${timeRemaining}s pärast uuesti.`;
|
const message = `Võta veits rahulikumalt. Proovi ${timeRemaining}s pärast uuesti.`;
|
||||||
|
|
||||||
if (form.errors.question) {
|
if (form.errors.question) {
|
||||||
form.errors.question.push(message);
|
form.errors.question.push(message);
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
>Sul on alles {data.user.balance > 0 ? data.user.balance : data.poolSize > 0 ? 0 : 1} küsimust.</Card.Description
|
>Sul on alles {data.user.balance > 0 ? data.user.balance : data.poolSize > 0 ? 0 : 1} küsimust.</Card.Description
|
||||||
>
|
>
|
||||||
</Card.Header>
|
</Card.Header>
|
||||||
{#if data.user.balance === 0 && (!data.question || data.poolSize > 0)}
|
{#if data.user.balance === 0 && (data.question || data.poolSize > 0)}
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<p class="text-sm leading-6">Enne küsimist pead kõigepealt vastama teistele!</p>
|
<p class="text-sm leading-6">Enne küsimist pead kõigepealt vastama teistele!</p>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
|
0
src/service-worker.js
Normal file
0
src/service-worker.js
Normal file
Loading…
Add table
Reference in a new issue