Sentry in Backend, Image-Import, Settings-function improvement and reload detection

This commit is contained in:
Mawoka
2022-03-30 18:29:09 +02:00
parent 20e655e18d
commit e413c0191d
17 changed files with 3349 additions and 4272 deletions
+2 -1
View File
@@ -14,12 +14,13 @@ alembic = "*"
email-validator = "*" email-validator = "*"
python-multipart = "*" python-multipart = "*"
pydantic = "*" pydantic = "*"
redis = "==4.2.0rc1" redis = "*"
aiohttp = "*" aiohttp = "*"
gunicorn = { version = "*"} gunicorn = { version = "*"}
qrcode = "*" qrcode = "*"
jinja2 = "*" jinja2 = "*"
argon2-cffi = "*" argon2-cffi = "*"
sentry-sdk = "*"
[dev-packages] [dev-packages]
Generated
+33 -10
View File
@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "d38accc141115721148b8dc756129087b9820d39fb0d2a7f02c2049c3632c08e" "sha256": "0411374cb38f6ed3199ec87e5d1717b598f8af20c46cef66377af0c719c4b988"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@@ -224,6 +224,13 @@
"markers": "python_version >= '3.7'", "markers": "python_version >= '3.7'",
"version": "==0.22.0" "version": "==0.22.0"
}, },
"certifi": {
"hashes": [
"sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872",
"sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"
],
"version": "==2021.10.8"
},
"cffi": { "cffi": {
"hashes": [ "hashes": [
"sha256:00c878c90cb53ccfaae6b8bc18ad05d2036553e6d9d1d9dbcf323bbe83854ca3", "sha256:00c878c90cb53ccfaae6b8bc18ad05d2036553e6d9d1d9dbcf323bbe83854ca3",
@@ -289,11 +296,11 @@
}, },
"click": { "click": {
"hashes": [ "hashes": [
"sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1", "sha256:19a4baa64da924c5e0cd889aba8e947f280309f1a2ce0947a3e3a7bcb7cc72d6",
"sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb" "sha256:977c213473c7665d3aa092b41ff12063227751c41d7b17165013e10069cc5cd2"
], ],
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.7'",
"version": "==8.0.4" "version": "==8.1.0"
}, },
"databases": { "databases": {
"hashes": [ "hashes": [
@@ -316,7 +323,7 @@
"sha256:0f7569a4a6ff151958b64304071d370daa3243d15941a7beedf0c9fe5105603e", "sha256:0f7569a4a6ff151958b64304071d370daa3243d15941a7beedf0c9fe5105603e",
"sha256:a851e51367fb93e9e1361732c1d60dab63eff98712e503ea7d92e6eccb109b4f" "sha256:a851e51367fb93e9e1361732c1d60dab63eff98712e503ea7d92e6eccb109b4f"
], ],
"markers": "python_version >= '3.6' and python_full_version < '4.0.0'", "markers": "python_version >= '3.6' and python_version < '4'",
"version": "==2.2.1" "version": "==2.2.1"
}, },
"ecdsa": { "ecdsa": {
@@ -907,20 +914,28 @@
}, },
"redis": { "redis": {
"hashes": [ "hashes": [
"sha256:95ff6381bc15acbb330d24896601fb8c50468003c0f30c9503afda2907225d08", "sha256:3cbe235cea80b9c9991b397567aa2d65eb4e6fb09787f61d227ae82eb4eb50b4",
"sha256:f5c52d3bb91d1ce94f0abaf7a660de7d95ea02cccd0cd0930912c49285fced6f" "sha256:6758d01dec81af191b98a35cce3402675d115456584c39b500ab485a5e386bbb"
], ],
"index": "pypi", "index": "pypi",
"version": "==4.2.0rc1" "version": "==4.2.0"
}, },
"rsa": { "rsa": {
"hashes": [ "hashes": [
"sha256:5c6bd9dc7a543b7fe4304a631f8a8a3b674e2bbfc49c2ae96200cdbe55df6b17", "sha256:5c6bd9dc7a543b7fe4304a631f8a8a3b674e2bbfc49c2ae96200cdbe55df6b17",
"sha256:95c5d300c4e879ee69708c428ba566c59478fd653cc3a22243eeb8ed846950bb" "sha256:95c5d300c4e879ee69708c428ba566c59478fd653cc3a22243eeb8ed846950bb"
], ],
"markers": "python_version >= '3.6' and python_full_version < '4.0.0'", "markers": "python_version >= '3.6' and python_version < '4'",
"version": "==4.8" "version": "==4.8"
}, },
"sentry-sdk": {
"hashes": [
"sha256:32af1a57954576709242beb8c373b3dbde346ac6bd616921def29d68846fb8c3",
"sha256:38fd16a92b5ef94203db3ece10e03bdaa291481dd7e00e77a148aa0302267d47"
],
"index": "pypi",
"version": "==1.5.8"
},
"setuptools": { "setuptools": {
"hashes": [ "hashes": [
"sha256:8f4813dd6a4d6cc17bde85fb2e635fe19763f96efbb0ddf5575562e5ee0bc47a", "sha256:8f4813dd6a4d6cc17bde85fb2e635fe19763f96efbb0ddf5575562e5ee0bc47a",
@@ -1003,6 +1018,14 @@
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.6'",
"version": "==4.1.1" "version": "==4.1.1"
}, },
"urllib3": {
"hashes": [
"sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14",
"sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
"version": "==1.26.9"
},
"uvicorn": { "uvicorn": {
"extras": [ "extras": [
"standard" "standard"
+24 -1
View File
@@ -1,14 +1,32 @@
from fastapi import FastAPI from fastapi import FastAPI, Request
import sentry_sdk
from socketio import ASGIApp from socketio import ASGIApp
from classquiz.db import database from classquiz.db import database
from classquiz.config import settings
from classquiz.routers import users, quiz, utils, stats from classquiz.routers import users, quiz, utils, stats
from classquiz.socket_server import sio from classquiz.socket_server import sio
from sentry_sdk.integrations.redis import RedisIntegration
settings = settings()
if settings.sentry_dsn:
sentry_sdk.init(dsn=settings.sentry_dsn, integrations=[RedisIntegration()])
app = FastAPI(redoc_url="", docs_url="/api/docs") app = FastAPI(redoc_url="", docs_url="/api/docs")
app.state.database = database app.state.database = database
@app.middleware("http")
async def sentry_exception(request: Request, call_next):
try:
response = await call_next(request)
return response
except Exception as e:
with sentry_sdk.push_scope() as scope:
scope.set_context("request", request)
sentry_sdk.capture_exception(e)
raise e
@app.on_event("startup") @app.on_event("startup")
async def startup() -> None: async def startup() -> None:
database_ = app.state.database database_ = app.state.database
@@ -23,6 +41,11 @@ async def shutdown() -> None:
await database_.disconnect() await database_.disconnect()
@app.get("/")
async def root():
return {"message": sio}
app.include_router(users.router, tags=["users"], prefix="/api/v1/users") app.include_router(users.router, tags=["users"], prefix="/api/v1/users")
app.include_router(quiz.router, tags=["quiz"], prefix="/api/v1/quiz") app.include_router(quiz.router, tags=["quiz"], prefix="/api/v1/quiz")
app.include_router(utils.router, tags=["utils"], prefix="/api/v1/utils") app.include_router(utils.router, tags=["utils"], prefix="/api/v1/utils")
+1
View File
@@ -16,6 +16,7 @@ from passlib.hash import argon2
from classquiz.cache import get_cache from classquiz.cache import get_cache
from classquiz.config import settings from classquiz.config import settings
from classquiz.db.models import * from classquiz.db.models import *
settings = settings()
# pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") # pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
pwd_context = argon2 pwd_context = argon2
+1
View File
@@ -6,6 +6,7 @@ import ormar
from classquiz.config import redis, settings from classquiz.config import redis, settings
from classquiz.db.models import User from classquiz.db.models import User
settings = settings()
async def cache_account(criteria: str, content: str) -> Union[User, None]: async def cache_account(criteria: str, content: str) -> Union[User, None]:
+9 -2
View File
@@ -1,4 +1,5 @@
import redis.asyncio as redis_lib import redis.asyncio as redis_lib
from functools import lru_cache
from pydantic import BaseSettings, RedisDsn, PostgresDsn from pydantic import BaseSettings, RedisDsn, PostgresDsn
@@ -17,13 +18,19 @@ class Settings(BaseSettings):
mail_server: str mail_server: str
mail_port: int mail_port: int
secret_key: str secret_key: str
imgur_client_id: str = "b13fefc8bb1db87"
access_token_expire_minutes: int = 30 access_token_expire_minutes: int = 30
cache_expiry: int = 86400 cache_expiry: int = 86400
sentry_dsn: str | None = "https://4981de1f72f24fd7b5e21b8913b93a02@o661934.ingest.sentry.io/6254641"
class Config: class Config:
env_file = ".env" env_file = ".env"
env_file_encoding = 'utf-8' env_file_encoding = 'utf-8'
settings = Settings() @lru_cache()
redis: redis_lib.client.Redis = redis_lib.Redis().from_url(settings.redis) def settings() -> Settings:
return Settings()
redis: redis_lib.client.Redis = redis_lib.Redis().from_url(settings().redis)
+2
View File
@@ -3,5 +3,7 @@ import sqlalchemy
from classquiz.config import settings from classquiz.config import settings
settings = settings()
database = databases.Database(settings.db_url) database = databases.Database(settings.db_url)
metadata = sqlalchemy.MetaData() metadata = sqlalchemy.MetaData()
+2
View File
@@ -8,6 +8,8 @@ from jinja2 import Environment, PackageLoader, select_autoescape
from classquiz.config import settings from classquiz.config import settings
from classquiz.db.models import User from classquiz.db.models import User
settings = settings()
jinja = Environment( jinja = Environment(
loader=PackageLoader('classquiz.emails', 'templates'), loader=PackageLoader('classquiz.emails', 'templates'),
autoescape=select_autoescape(['html', 'xml']), autoescape=select_autoescape(['html', 'xml']),
+49 -4
View File
@@ -2,10 +2,48 @@ import json
import uuid import uuid
from datetime import datetime from datetime import datetime
from aiohttp import ClientSession from aiohttp import ClientSession, FormData
import pydantic import html
from classquiz.db.models import Quiz, QuizAnswer, QuizQuestion, User from classquiz.db.models import Quiz, QuizAnswer, QuizQuestion, User
from classquiz.kahoot_importer.get import get as get_quiz from classquiz.kahoot_importer.get import get as get_quiz
from classquiz.config import settings
settings = settings()
async def _download_image(url: str) -> bytes:
async with ClientSession() as session:
async with session.get(url) as resp:
return await resp.read()
async def _upload_to_imgur(image: bytes, album_id: str | None) -> str:
"""
Uploads an image to Imgur.
:param image: The image to upload.
:return: The URL of the image on Imgur.
"""
formdata = FormData()
formdata.add_field('image', image, filename='image.png')
if album_id:
formdata.add_field('album', album_id)
async with ClientSession(headers={"Authorization": f"Client-ID {settings.imgur_client_id}"}) as session:
async with session.post("https://api.imgur.com/3/image", data=image) as resp:
data = await resp.json()
return data["data"]["link"]
async def _generate_imgur_album(quiz_id: str) -> str:
"""
Generates an album on Imgur.
:param quiz_id: The ID of the quiz.
:return: The URL of the album on Imgur.
"""
formdata = FormData()
formdata.add_field('title', quiz_id)
async with ClientSession(headers={"Authorization": f"Client-ID {settings.imgur_client_id}"}) as session:
async with session.post("https://api.imgur.com/3/album", data={"title": "Quiz: " + quiz_id}, ) as resp:
data = await resp.json()
return data["data"]["id"]
async def import_quiz(quiz_id: str, user: User) -> Quiz | str: async def import_quiz(quiz_id: str, user: User) -> Quiz | str:
@@ -19,12 +57,19 @@ async def import_quiz(quiz_id: str, user: User) -> Quiz | str:
if quiz is None: if quiz is None:
return "quiz not found" return "quiz not found"
quiz_questions: list[dict] = [] quiz_questions: list[dict] = []
imgur_album_id = await _generate_imgur_album(quiz_id)
for q in quiz.kahoot.questions: for q in quiz.kahoot.questions:
answers: list[QuizAnswer] = [] answers: list[QuizAnswer] = []
image = None
if q.image is not None and q.image != "":
image_bytes = await _download_image(q.image)
image = await _upload_to_imgur(image_bytes, imgur_album_id)
# image = q.image
for a in q.choices: for a in q.choices:
answers.append((QuizAnswer(right=a.correct, answer=a.answer))) answers.append((QuizAnswer(right=a.correct, answer=html.unescape(a.answer))))
quiz_questions.append(QuizQuestion(question=q.question, answers=answers, time=str(q.time / 1000)).dict()) quiz_questions.append(
QuizQuestion(question=q.question, answers=answers, time=str(q.time / 1000), image=image).dict())
quiz_data = Quiz(id=uuid.uuid4(), public=False, title=quiz.kahoot.title, description=quiz.kahoot.description, quiz_data = Quiz(id=uuid.uuid4(), public=False, title=quiz.kahoot.title, description=quiz.kahoot.description,
created_at=datetime.now(), updated_at=datetime.now(), user_id=user.id, created_at=datetime.now(), updated_at=datetime.now(), user_id=user.id,
questions=json.dumps(quiz_questions)) questions=json.dumps(quiz_questions))
+1
View File
@@ -6,6 +6,7 @@ from fastapi import APIRouter
from fastapi.responses import Response from fastapi.responses import Response
from classquiz.config import settings from classquiz.config import settings
settings = settings()
router = APIRouter() router = APIRouter()
+1
View File
@@ -22,6 +22,7 @@
"@sveltejs/adapter-node": "^1.0.0-next.71", "@sveltejs/adapter-node": "^1.0.0-next.71",
"@sveltejs/kit": "next", "@sveltejs/kit": "next",
"@tailwindcss/typography": "^0.5.0-alpha.3", "@tailwindcss/typography": "^0.5.0-alpha.3",
"@types/js-cookie": "^3.0.1",
"@types/luxon": "^2.0.9", "@types/luxon": "^2.0.9",
"@types/yup": "^0.29.13", "@types/yup": "^0.29.13",
"@typescript-eslint/eslint-plugin": "^5.10.1", "@typescript-eslint/eslint-plugin": "^5.10.1",
+3101 -4153
View File
File diff suppressed because it is too large Load Diff
+14 -12
View File
@@ -1,4 +1,4 @@
<script lang="ts"> <script lang='ts'>
import type { Question } from '../../app'; import type { Question } from '../../app';
import { socket } from '$lib/socket'; import { socket } from '$lib/socket';
@@ -42,37 +42,39 @@
}; };
</script> </script>
<div class="flex flex-col justify-center w-screen h-1/6"> <div class='flex flex-col justify-center w-screen h-1/6'>
<h1 class="text-6xl text-center"> <h1 class='text-6xl text-center'>
{question.question} {question.question}
</h1> </h1>
<span class="text-center py-2 text-lg">{timer_res}</span> <span class='text-center py-2 text-lg'>{timer_res}</span>
</div>
<div>
<img src='{question.image}' class="w-full h-full object-cover" alt='Question image'>
</div> </div>
{#if question.image !== null}
<div>
<img src='{question.image}' class='w-full h-full object-cover' alt='Question image'>
</div>
{/if}
{#if timer_res !== '0'} {#if timer_res !== '0'}
<div class="flex flex-wrap"> <div class='flex flex-wrap'>
{#each question.answers as answer} {#each question.answers as answer}
<button <button
class="w-1/2 text-3xl bg-amber-700 my-2 disabled:opacity-60 border border-white" class='w-1/2 text-3xl bg-amber-700 my-2 disabled:opacity-60 border border-white'
disabled={selected_answer !== undefined} disabled={selected_answer !== undefined}
on:click={() => selectAnswer(answer.answer)}>{answer.answer}</button on:click={() => selectAnswer(answer.answer)}>{answer.answer}</button
> >
{/each} {/each}
</div> </div>
{:else} {:else}
<div class="flex flex-wrap"> <div class='flex flex-wrap'>
{#each question.answers as answer} {#each question.answers as answer}
{#if answer.right} {#if answer.right}
<button <button
class="w-1/2 text-3xl bg-green-600 border border-white" class='w-1/2 text-3xl bg-green-600 border border-white'
disabled disabled
class:opacity-30={answer.answer !== selected_answer}>{answer.answer}</button class:opacity-30={answer.answer !== selected_answer}>{answer.answer}</button
> >
{:else} {:else}
<button <button
class="w-1/2 text-3xl bg-red-500 border border-white" class='w-1/2 text-3xl bg-red-500 border border-white'
disabled disabled
class:opacity-30={answer.answer !== selected_answer}>{answer.answer}</button class:opacity-30={answer.answer !== selected_answer}>{answer.answer}</button
> >
+1
View File
@@ -13,6 +13,7 @@
dsn: import.meta.env.VITE_SENTRY, dsn: import.meta.env.VITE_SENTRY,
integrations: [new BrowserTracing()], integrations: [new BrowserTracing()],
// Set tracesSampleRate to 1.0 to capture 100% // Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring. // of transactions for performance monitoring.
// We recommend adjusting this value in production // We recommend adjusting this value in production
+106 -86
View File
@@ -1,4 +1,4 @@
<script context="module" lang="ts"> <script context='module' lang='ts'>
export async function load({ session }) { export async function load({ session }) {
if (session.authenticated) { if (session.authenticated) {
return { return {
@@ -10,9 +10,11 @@
} }
</script> </script>
<script lang="ts"> <script lang='ts'>
import * as Sentry from "@sentry/browser";
import { navbarVisible } from '$lib/stores'; import { navbarVisible } from '$lib/stores';
import { browser } from '$app/env'; import { browser } from '$app/env';
import Cookies from 'js-cookie';
import { getLocalization } from '$lib/i18n'; import { getLocalization } from '$lib/i18n';
import Footer from '$lib/footer.svelte'; import Footer from '$lib/footer.svelte';
@@ -37,10 +39,28 @@
$: passwordEmpty = loginData.password === ''; $: passwordEmpty = loginData.password === '';
$: inputValid = !emailEmpty && !passwordEmpty; $: inputValid = !emailEmpty && !passwordEmpty;
const reloadWindow = () => {
const expireIn60Sec = new Date(new Date().getTime() + 60 * 1000);
if (Cookies.get('reload') === null) {
Cookies.set('reload', '1', { expires: expireIn60Sec });
} else {
const cookie: string = Cookies.get('reload');
if (parseInt(cookie) >= 3) {
if (import.meta.env.VITE_SENTRY !== null) {
Sentry.captureException(new Error('Reload loop'));
}
fetch("/api/v1/users/logout")
Cookies.remove("reload")
}
Cookies.set('reload', String(parseInt(cookie) + 1), { expires: expireIn60Sec });
}
window.location.reload();
};
const checkRememberMe = async () => { const checkRememberMe = async () => {
const res = await fetch('/api/v1/users/token/rememberme'); const res = await fetch('/api/v1/users/token/rememberme');
if (res.status === 200) { if (res.status === 200) {
window.location.reload(); reloadWindow();
} }
}; };
if (browser) { if (browser) {
@@ -74,89 +94,89 @@
<svelte:head> <svelte:head>
<title>ClassQuiz - Login</title> <title>ClassQuiz - Login</title>
</svelte:head> </svelte:head>
<div class="flex items-center justify-center h-full px-4"> <div class='flex items-center justify-center h-full px-4'>
<div> <div>
<span class="p-4" /> <span class='p-4' />
<div <div
class="w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800" class='w-full max-w-sm mx-auto overflow-hidden bg-white rounded-lg shadow-md dark:bg-gray-800'
> >
<div class="px-6 py-4"> <div class='px-6 py-4'>
<h2 class="text-3xl font-bold text-center text-gray-700 dark:text-white"> <h2 class='text-3xl font-bold text-center text-gray-700 dark:text-white'>
ClassQuiz ClassQuiz
</h2> </h2>
<h3 class="mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200"> <h3 class='mt-1 text-xl font-medium text-center text-gray-600 dark:text-gray-200'>
{$t('login_page.welcome_back')} {$t('login_page.welcome_back')}
</h3> </h3>
<p class="mt-1 text-center text-gray-500 dark:text-gray-400"> <p class='mt-1 text-center text-gray-500 dark:text-gray-400'>
{$t('login_page.login_or_create_account')} {$t('login_page.login_or_create_account')}
</p> </p>
<form on:submit|preventDefault={login}> <form on:submit|preventDefault={login}>
<div class="w-full mt-4"> <div class='w-full mt-4'>
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg"> <div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
<div class="relative bg-inherit w-full"> <div class='relative bg-inherit w-full'>
<input <input
id="email" id='email'
bind:value={loginData.email} bind:value={loginData.email}
name="email" name='email'
type="email" type='email'
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600" class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
placeholder={$t('words.email')} placeholder={$t('words.email')}
/> />
<label <label
for="email" for='email'
class="absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all" class='absolute cursor-text left-0 -top-3 text-sm text-gray-700 dark:text-white bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
> >
{$t('words.email')} {$t('words.email')}
</label> </label>
</div> </div>
</div> </div>
<div class="dark:bg-gray-800 bg-white p-4 rounded-lg"> <div class='dark:bg-gray-800 bg-white p-4 rounded-lg'>
<div class="relative bg-inherit w-full"> <div class='relative bg-inherit w-full'>
<input <input
id="password" id='password'
name="password" name='password'
type="password" type='password'
bind:value={loginData.password} bind:value={loginData.password}
class="w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600" class='w-full peer bg-transparent h-10 rounded-lg text-gray-700 dark:text-white placeholder-transparent ring-2 px-2 ring-gray-500 focus:ring-sky-600 focus:outline-none focus:border-rose-600'
placeholder={$t('words.password')} placeholder={$t('words.password')}
/> />
<label <label
for="password" for='password'
class="absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all" class='absolute cursor-text left-0 -top-3 text-sm text-gray-500 bg-inherit mx-1 px-1 peer-placeholder-shown:text-base peer-placeholder-shown:text-gray-500 peer-placeholder-shown:top-2 peer-focus:-top-3 peer-focus:text-sky-600 peer-focus:text-sm transition-all'
> >
{$t('words.password')} {$t('words.password')}
</label> </label>
</div> </div>
</div> </div>
<div class="flex items-center justify-between mt-4"> <div class='flex items-center justify-between mt-4'>
<a <a
href="/account/reset-password" href='/account/reset-password'
class="text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500" class='text-sm text-gray-600 dark:text-gray-200 hover:text-gray-500'
>{$t('register_page.forgot_password?')}</a >{$t('register_page.forgot_password?')}</a
> >
<button <button
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50" class='px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded hover:bg-gray-600 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50'
disabled={!inputValid} disabled={!inputValid}
type="submit" type='submit'
> >
{#if isSubmitting} {#if isSubmitting}
<svg <svg
class="h-4 w-4 animate-spin mx-auto my-20" class='h-4 w-4 animate-spin mx-auto my-20'
viewBox="3 3 18 18" viewBox='3 3 18 18'
> >
<path <path
class="fill-black" class='fill-black'
d="M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z" d='M12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5ZM3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12Z'
/> />
<path <path
class="fill-blue-100" class='fill-blue-100'
d="M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z" d='M16.9497 7.05015C14.2161 4.31648 9.78392 4.31648 7.05025 7.05015C6.65973 7.44067 6.02656 7.44067 5.63604 7.05015C5.24551 6.65962 5.24551 6.02646 5.63604 5.63593C9.15076 2.12121 14.8492 2.12121 18.364 5.63593C18.7545 6.02646 18.7545 6.65962 18.364 7.05015C17.9734 7.44067 17.3403 7.44067 16.9497 7.05015Z'
/> />
</svg> </svg>
{:else} {:else}
@@ -169,16 +189,16 @@
</div> </div>
<div <div
class="flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700" class='flex items-center justify-center py-4 text-center bg-gray-50 dark:bg-gray-700'
> >
<span class="text-sm text-gray-600 dark:text-gray-200" <span class='text-sm text-gray-600 dark:text-gray-200'
>{$t('login_page.already_have_account')} >{$t('login_page.already_have_account')}
</span> </span>
<a <a
href="/account/register" href='/account/register'
class="mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline" class='mx-2 text-sm font-bold text-blue-500 dark:text-blue-400 hover:underline'
>{$t('words.register')}</a >{$t('words.register')}</a
> >
</div> </div>
</div> </div>
@@ -186,14 +206,14 @@
</div> </div>
<Footer /> <Footer />
<div <div
class="fixed z-10 inset-0 overflow-y-auto" class='fixed z-10 inset-0 overflow-y-auto'
aria-labelledby="modal-title" aria-labelledby='modal-title'
role="dialog" role='dialog'
aria-modal="true" aria-modal='true'
class:hidden={!responseData.open} class:hidden={!responseData.open}
> >
<div <div
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" class='flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0'
> >
<!-- <!--
Background overlay, show/hide based on modal state. Background overlay, show/hide based on modal state.
@@ -206,13 +226,13 @@
To: "opacity-0" To: "opacity-0"
--> -->
<div <div
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" class='fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity'
aria-hidden="true" aria-hidden='true'
/> />
<!-- This element is to trick the browser into centering the modal contents. --> <!-- This element is to trick the browser into centering the modal contents. -->
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true" <span class='hidden sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true'
>&#8203;</span >&#8203;</span
> >
<!-- <!--
@@ -226,49 +246,49 @@
To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" To: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
--> -->
<div <div
class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full" class='inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
> >
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> <div class='bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4'>
<div class="sm:flex sm:items-start"> <div class='sm:flex sm:items-start'>
<div <div
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10" class='mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10'
> >
<!-- Heroicon name: outline/exclamation --> <!-- Heroicon name: outline/exclamation -->
{#if responseData.data === '404' || responseData.data === 'error'} {#if responseData.data === '404' || responseData.data === 'error'}
<svg <svg
class="h-6 w-6 text-red-600" class='h-6 w-6 text-red-600'
xmlns="http://www.w3.org/2000/svg" xmlns='http://www.w3.org/2000/svg'
fill="none" fill='none'
viewBox="0 0 24 24" viewBox='0 0 24 24'
stroke="currentColor" stroke='currentColor'
aria-hidden="true" aria-hidden='true'
> >
<path <path
stroke-linecap="round" stroke-linecap='round'
stroke-linejoin="round" stroke-linejoin='round'
stroke-width="2" stroke-width='2'
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'
/> />
</svg> </svg>
{:else} {:else}
<svg <svg
class="w-6 h-6 text-green-600" class='w-6 h-6 text-green-600'
fill="none" fill='none'
stroke="currentColor" stroke='currentColor'
viewBox="0 0 24 24" viewBox='0 0 24 24'
xmlns="http://www.w3.org/2000/svg" xmlns='http://www.w3.org/2000/svg'
> >
<path <path
stroke-linecap="round" stroke-linecap='round'
stroke-linejoin="round" stroke-linejoin='round'
stroke-width="2" stroke-width='2'
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'
/> />
</svg> </svg>
{/if} {/if}
</div> </div>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"> <div class='mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left'>
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title"> <h3 class='text-lg leading-6 font-medium text-gray-900' id='modal-title'>
{#if responseData.data === 'magic'} {#if responseData.data === 'magic'}
{$t('login_page.modal.success.success_check_mail')} {$t('login_page.modal.success.success_check_mail')}
{:else if responseData.data === 'password'} {:else if responseData.data === 'password'}
@@ -281,8 +301,8 @@
You stupid Mawoka! You stupid Mawoka!
{/if} {/if}
</h3> </h3>
<div class="mt-2"> <div class='mt-2'>
<p class="text-sm text-gray-500"> <p class='text-sm text-gray-500'>
{#if responseData.data === 'magic'} {#if responseData.data === 'magic'}
{$t('login_page.modal.success.description.success_check_mail')} {$t('login_page.modal.success.description.success_check_mail')}
{:else if responseData.data === 'password'} {:else if responseData.data === 'password'}
@@ -299,17 +319,17 @@
</div> </div>
</div> </div>
</div> </div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse"> <div class='bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse'>
<button <button
type="button" type='button'
on:click={() => { on:click={() => {
responseData.open = false; responseData.open = false;
if (responseData.data === 'magic' || responseData.data === 'password') { if (responseData.data === 'magic' || responseData.data === 'password') {
window.location.reload(); reloadWindow();
} }
}} }}
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm" class='mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm'
>{$t('words.close')} >{$t('words.close')}
</button> </button>
</div> </div>
</div> </div>
@@ -25,8 +25,7 @@
<h2>Limitations</h2> <h2>Limitations</h2>
<ul> <ul>
<li>Videos don't get imported</li> <li>Videos don't get imported</li>
<li>Pictures don't get imported</li> <li>Metadata doesn't get imported (Stuff like create-date, cover-image, etc.)</li>
<li>Metadata doesn't get imported</li>
<li>Point-multipliers don't get imported</li> <li>Point-multipliers don't get imported</li>
</ul> </ul>
</article> </article>
+1 -1
View File
@@ -124,7 +124,7 @@
> >
{#if is_loading} {#if is_loading}
<svg <svg
class="h-4 w-4 animate-spin mx-auto my-20" class="h-4 w-4 animate-spin mx-auto"
viewBox="3 3 18 18" viewBox="3 3 18 18"
> >
<path <path