Docker compose almost working

This commit is contained in:
Laurent
2024-10-23 23:01:11 +02:00
parent a66035d1f5
commit e6a6bf274b
57 changed files with 906 additions and 169 deletions

25
back/Dockerfile Normal file
View File

@@ -0,0 +1,25 @@
# temp container to build using gradle
FROM gradle:8.10.2-jdk21 AS TEMP_BUILD_IMAGE
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY build.gradle settings.gradle $APP_HOME
COPY gradle $APP_HOME/gradle
COPY --chown=gradle:gradle . /home/gradle/src
USER root
RUN chown -R gradle /home/gradle/src
RUN gradle build || return 0
COPY . .
RUN gradle clean build
# actual container
FROM eclipse-temurin:21-jdk
ENV ARTIFACT_NAME=unluckiest-1.0.0.jar
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY --from=TEMP_BUILD_IMAGE $APP_HOME/build/libs/$ARTIFACT_NAME .
EXPOSE 8000
ENTRYPOINT exec java -jar ${ARTIFACT_NAME}

View File

@@ -5,7 +5,7 @@ plugins {
}
springBoot {
mainClass = 'be.naaturel.homestorage.HomeStorageApplication'
mainClass = 'be.naaturel.unluckiest.UnluckiestApplication'
}
group = 'be.naaturel'

View File

@@ -50,7 +50,6 @@ public class Security {
config.setAllowedOrigins(Arrays.asList(conf.authorizedHosts));
config.setAllowedMethods(Arrays.asList(conf.authorizedMethods));
config.setAllowedHeaders(Arrays.asList(conf.authorizedHeaders));
config.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);

View File

@@ -12,7 +12,7 @@ public interface ScoreRepo
extends JpaRepository<ScoreEntity, String> {
@Query(
value = "SELECT * FROM Score s HAVING 10;",
value = "SELECT * FROM score s HAVING 10;",
nativeQuery = true)
List<ScoreEntity> findLeaderboard();

View File

@@ -1,15 +1,18 @@
#=============MAIN=============
spring.application.name=unluckiest
#=============SERVER=============
server.port=5000
#=============SECURITY=============
sec.cors.authorizedHots=http://localhost:5173
sec.cors.authorizedHots=*
sec.cors.authorizedMethods=GET,POST,PUT,DELETE,OPTION
sec.cors.authorizedHeader=Authorization,Content-type
#=============DATABASE=============
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/unluckiest_db
spring.datasource.username=root
spring.datasource.password=
spring.datasource.url=jdbc:${DB_URL}
spring.datasource.username=${DB_USER}
spring.datasource.password=${DB_PASSWORD}
spring.jpa.database-platform=org.hibernate.dialect.MariaDBDialect
spring.jpa.show-sql=true

View File

@@ -6,8 +6,4 @@ import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class UnluckiestApplicationTests {
@Test
void contextLoads() {
}
}

View File

@@ -1,35 +1,69 @@
volumes:
unluckiest_database:
networks:
unluckiest_network:
driver: bridge
services:
database:
image: mariadb:latest
container_name: database
build:
context : ./database
dockerfile : Dockerfile
environment:
- MARIADB_ROOT_PASSWORD=root
- DB_NAME=unluckiest_db
- DB_USER=unluckiest_user
- DB_PASSWORD=_nlckst_prod!
volumes:
- unluckiest_database:/var/lib/mysql
networks:
- unluckiest_network
ports:
- "9000:3306"
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 15s
interval: 10s
timeout: 5s
retries: 3
api:
container_name: api
build:
context: ./back
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
DB_URL: mysql://mariadb_test:3306/unluckiest_database
DB_USER: user
DB_PASSWORD: _unlckst_prod!
DB_URL: mysql://database:3306/unluckiest_db
DB_USER: unluckiest_user
DB_PASSWORD: _nlckst_prod!
networks:
- storage_network
- unluckiest_network
depends_on:
- database
database:
condition: service_healthy
networks:
unluckiest_network:
webapp:
container_name : webapp
build:
context: ./front
dockerfile: Dockerfile
networks:
- unluckiest_network
depends_on:
- api
reverse_proxy:
container_name : reverse_proxy
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- "80:80"
- "443:443"
volumes:
- ./certs:/etc/ssl/certs
- ./certs:/etc/ssl/private
networks:
- unluckiest_network
depends_on:
- webapp

6
database/Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM mariadb:latest
COPY ./init.sh /docker-entrypoint-initdb.d/
RUN chmod -R 755 /docker-entrypoint-initdb.d/ && \
chmod +x /docker-entrypoint-initdb.d/init.sh

390
database/healthcheck.sh Normal file
View File

@@ -0,0 +1,390 @@
#!/bin/bash
#
# Healthcheck script for MariaDB
#
# Runs various tests on the MariaDB server to check its health. Pass the tests
# to run as arguments. If all tests succeed, the server is considered healthy,
# otherwise it's not.
#
# Arguments are processed in strict order. Set replication_* options before
# the --replication option. This allows a different set of replication checks
# on different connections.
#
# --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the
# first option.
#
# Some tests require SQL privileges.
#
# TEST MINIMUM GRANTS REQUIRED
# connect none*
# innodb_initialized USAGE
# innodb_buffer_pool_loaded USAGE
# galera_online USAGE
# galera_ready USAGE
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
# mariadbupgrade none, however unix user permissions on datadir
#
# The SQL user used is the default for the mariadb client. This can be the unix user
# if no user(or password) is set in the [mariadb-client] section of a configuration
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
# different from elsewhere.
#
# Note * though denied error message will result in error log without
# any permissions. USAGE recommend to avoid this.
set -eo pipefail
_process_sql()
{
mariadb ${nodefaults:+--no-defaults} \
${def['file']:+--defaults-file=${def['file']}} \
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
--skip-ssl --skip-ssl-verify-server-cert \
--protocol socket \
-B "$@"
}
# TESTS
# CONNECT
#
# Tests that a connection can be made over TCP, the final state
# of the entrypoint and is listening. The authentication used
# isn't tested.
connect()
{
local s
# short cut mechanism, to work with --require-secure-transport
s=$(_process_sql --skip-column-names -e 'select @@skip_networking')
case "$s" in
0|1)
connect_s=$s
return "$s";
;;
esac
# falling back to tcp if there wasn't a connection answer.
s=$(mariadb ${nodefaults:+--no-defaults} \
${def['file']:+--defaults-file=${def['file']}} \
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
--skip-ssl --skip-ssl-verify-server-cert \
-h localhost --protocol tcp \
--skip-column-names --batch --skip-print-query-on-error \
-e 'select @@skip_networking' 2>&1)
case "$s" in
1) # skip-networking=1 (no network)
;&
ERROR\ 2002\ \(HY000\):*)
# cannot connect
connect_s=1
;;
0) # skip-networking=0
;&
ERROR\ 1820\ \(HY000\)*) # password expire
;&
ERROR\ 4151\ \(HY000\):*) # account locked
;&
ERROR\ 1226\ \(42000\)*) # resource limit exceeded
;&
ERROR\ 1[0-9][0-9][0-9]\ \(28000\):*)
# grep access denied and other 28000 client errors - we did connect
connect_s=0
;;
*)
>&2 echo "Unknown error $s"
connect_s=1
;;
esac
return $connect_s
}
# INNODB_INITIALIZED
#
# This tests that the crash recovery of InnoDB has completed
# along with all the other things required to make it to a healthy
# operational state. Note this may return true in the early
# states of initialization. Use with a connect test to avoid
# these false positives.
innodb_initialized()
{
local s
s=$(_process_sql --skip-column-names -e "select 1 from information_schema.ENGINES WHERE engine='innodb' AND support in ('YES', 'DEFAULT', 'ENABLED')")
[ "$s" == 1 ]
}
# INNODB_BUFFER_POOL_LOADED
#
# Tests the load of the innodb buffer pool as been complete
# implies innodb_buffer_pool_load_at_startup=1 (default), or if
# manually SET innodb_buffer_pool_load_now=1
innodb_buffer_pool_loaded()
{
local s
s=$(_process_sql --skip-column-names -e "select VARIABLE_VALUE from information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_buffer_pool_load_status'")
if [[ $s =~ 'load completed' ]]; then
return 0
fi
return 1
}
# GALERA_ONLINE
#
# Tests that the galera node is in the SYNCed state
galera_online()
{
local s
s=$(_process_sql --skip-column-names -e "select VARIABLE_VALUE from information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME='WSREP_LOCAL_STATE'")
# 4 from https://galeracluster.com/library/documentation/node-states.html#node-state-changes
# not https://xkcd.com/221/
if [[ $s -eq 4 ]]; then
return 0
fi
return 1
}
# GALERA_READY
#
# Tests that the Galera provider is ready.
galera_ready()
{
local s
s=$(_process_sql --skip-column-names -e "select VARIABLE_VALUE from information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME='WSREP_READY'")
if [ "$s" = "ON" ]; then
return 0
fi
return 1
}
# REPLICATION
#
# Tests the replication has the required set of functions:
# --replication_all -> Checks all replication sources
# --replication_name=n -> sets the multisource connection name tested
# --replication_io -> IO thread is running
# --replication_sql -> SQL thread is running
# --replication_seconds_behind_master=n -> less than or equal this seconds of delay
# --replication_sql_remaining_delay=n -> less than or equal this seconds of remaining delay
# (ref: https://mariadb.com/kb/en/delayed-replication/)
replication()
{
# SHOW REPLICA available 10.5+
# https://github.com/koalaman/shellcheck/issues/2383
# shellcheck disable=SC2016,SC2026
_process_sql -e "SHOW ${repl['all']:+all} REPLICA${repl['all']:+S} ${repl['name']:+'${repl['name']}'} STATUS\G" | \
{
# required for trim of leading space.
shopt -s extglob
# Row header
read -t 5 -r
# read timeout
[ $? -gt 128 ] && return 1
while IFS=":" read -t 1 -r n v; do
# Trim leading space
n=${n##+([[:space:]])}
# Leading space on all values by the \G format needs to be trimmed.
v=${v:1}
case "$n" in
Slave_IO_Running)
if [ -n "${repl['io']}" ] && [ "$v" = 'No' ]; then
return 1
fi
;;
Slave_SQL_Running)
if [ -n "${repl['sql']}" ] && [ "$v" = 'No' ]; then
return 1
fi
;;
Seconds_Behind_Master)
# A NULL value is the IO thread not running:
if [ -n "${repl['seconds_behind_master']}" ] &&
{ [ "$v" = NULL ] ||
(( "${repl['seconds_behind_master']}" < "$v" )); }; then
return 1
fi
;;
SQL_Remaining_Delay)
# Unlike Seconds_Behind_Master, sql_remaining_delay will hit NULL
# once replication is caught up - https://mariadb.com/kb/en/delayed-replication/
if [ -n "${repl['sql_remaining_delay']}" ] &&
[ "$v" != NULL ] &&
(( "${repl['sql_remaining_delay']}" < "$v" )); then
return 1
fi
;;
esac
done
# read timeout
[ $? -gt 128 ] && return 1
return 0
}
# reachable in command not found(?)
# shellcheck disable=SC2317
return $?
}
# mariadbupgrade
#
# Test the lock on the file $datadir/mariadb_upgrade_info
# https://jira.mariadb.org/browse/MDEV-27068
mariadbupgrade()
{
local f="$datadir/mariadb_upgrade_info"
if [ -r "$f" ]; then
flock --exclusive --nonblock -n 9 9<"$f"
return $?
fi
return 0
}
# MAIN
if [ $# -eq 0 ]; then
echo "At least one argument required" >&2
exit 1
fi
#ENDOFSUBSTITUTIONS
# Marks the end of mysql -> mariadb name changes in 10.6+
# Global variables used by tests
declare -A repl
declare -A def
nodefaults=
connect_s=
datadir=/var/lib/mysql
if [ -f $datadir/.my-healthcheck.cnf ]; then
def['extra_file']=$datadir/.my-healthcheck.cnf
fi
_repl_param_check()
{
case "$1" in
seconds_behind_master) ;&
sql_remaining_delay)
if [ -z "${repl['io']}" ]; then
repl['io']=1
echo "Forcing --replication_io=1, $1 requires IO thread to be running" >&2
fi
;;
all)
if [ -n "${repl['name']}" ]; then
unset 'repl[name]'
echo "Option --replication_all incompatible with specified source --replication_name, clearing replication_name" >&2
fi
;;
name)
if [ -n "${repl['all']}" ]; then
unset 'repl[all]'
echo "Option --replication_name incompatible with --replication_all, clearing replication_all" >&2
fi
;;
esac
}
_test_exists() {
declare -F "$1" > /dev/null
return $?
}
while [ $# -gt 0 ]; do
case "$1" in
--su=*)
u="${1#*=}"
shift
exec gosu "${u}" "${BASH_SOURCE[0]}" "$@"
;;
--su)
shift
u=$1
shift
exec gosu "$u" "${BASH_SOURCE[0]}" "$@"
;;
--su-mysql)
shift
exec gosu mysql "${BASH_SOURCE[0]}" "$@"
;;
--replication_*=*)
# Change the n to what is between _ and = and make lower case
n=${1#*_}
n=${n%%=*}
n=${n,,*}
# v is after the =
v=${1#*=}
repl[$n]=$v
_repl_param_check "$n"
;;
--replication_*)
# Without =, look for a non --option next as the value,
# otherwise treat it as an "enable", just equate to 1.
# Clearing option is possible with "--replication_X="
n=${1#*_}
n=${n,,*}
if [ "${2:0:2}" == '--' ]; then
repl[$n]=1
else
repl[$n]=$2
shift
fi
_repl_param_check "$n"
;;
--datadir=*)
datadir=${1#*=}
;;
--datadir)
shift
datadir=${1}
;;
--no-defaults)
def=()
nodefaults=1
;;
--defaults-file=*|--defaults-extra-file=*|--defaults-group-suffix=*)
n=${1:11} # length --defaults-
n=${n%%=*}
n=${n//-/_}
# v is after the =
v=${1#*=}
def[$n]=$v
nodefaults=
;;
--defaults-file|--defaults-extra-file|--defaults-group-suffix)
n=${1:11} # length --defaults-
n=${n//-/_}
if [ "${2:0:2}" == '--' ]; then
def[$n]=""
else
def[$n]=$2
shift
fi
nodefaults=
;;
--*)
test=${1#--}
;;
*)
echo "Unknown healthcheck option $1" >&2
exit 1
esac
if [ -n "$test" ]; then
if ! _test_exists "$test" ; then
echo "healthcheck unknown option or test '$test'" >&2
exit 1
elif ! "$test"; then
echo "healthcheck $test failed" >&2
exit 1
fi
test=
fi
shift
done
if [ "$connect_s" != "0" ]; then
# we didn't pass a connnect test, so the current success status is suspicious
# return what connect thinks.
connect
exit $?
fi

22
database/init.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Check if required environment variables are set
: "${DB_NAME:?Environment variable DB_NAME is required}"
: "${DB_USER:?Environment variable DB_USER is required}"
: "${DB_PASSWORD:?Environment variable DB_PASSWORD is required}"
# Generate the SQL file using environment variables
echo "Initializing the database with the following details:"
echo "Database Name: $DB_NAME"
echo "User: $DB_USER"
echo "Password: $DB_PASSWORD"
cat << EOF > /tmp/init-db.sql
CREATE DATABASE IF NOT EXISTS \`$DB_NAME\`;
CREATE USER IF NOT EXISTS '$DB_USER'@'%' IDENTIFIED BY '$DB_PASSWORD';
GRANT ALL PRIVILEGES ON \`$DB_NAME\`.* TO '$DB_USER'@'%';
FLUSH PRIVILEGES;
EOF
mariadb -uroot -p$MARIADB_ROOT_PASSWORD < /tmp/init-db.sql

1
front/.env.development Normal file
View File

@@ -0,0 +1 @@
VITE_API_URL=http://127.0.0.1/api

5
front/.gitignore vendored
View File

@@ -73,7 +73,7 @@ web_modules/
.yarn-integrity
# dotenv environment variable files
.env
.env.production
.env.development.local
.env.test.local
.env.production.local
@@ -128,3 +128,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
/build/
/.svelte-kit/
/.svelte-kit/

View File

@@ -26,6 +26,7 @@
* ```
*/
declare module '$env/static/private' {
export const VITE_API_URL: string;
export const ALLUSERSPROFILE: string;
export const APPDATA: string;
export const CLion: string;
@@ -132,6 +133,7 @@ declare module '$env/static/public' {
*/
declare module '$env/dynamic/private' {
export const env: {
VITE_API_URL: string;
ALLUSERSPROFILE: string;
APPDATA: string;
CLion: string;

View File

@@ -21,7 +21,7 @@ export const options = {
app: ({ head, body, assets, nonce, env }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>Unluckiest</title>\n\n\t\t<link rel=\"stylesheet\"\n\t\t\t href=\"https://fonts.googleapis.com/css?family=Afacad+Flux\">\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tfont-family: 'Afacad Flux', serif;\n\t\t\t\tfont-size: 48px;\n\t\t\t}\n\t\t</style>\n\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\n\t\t<link rel=\"stylesheet\" href=\"" + assets + "/style/app.css\" />\n\t\t<link rel=\"stylesheet\" href=\"" + assets + "/style/menu.css\" />\n\n\t\t<link rel=\"icon\" href=\"" + assets + "/favicon.png\" />\n\n\t\t" + head + "\n\t</head>\n\t<body data-sveltekit-preload-data=\"hover\">\n\t\t<div style=\"display: contents\">" + body + "</div>\n\t</body>\n</html>\n",
error: ({ status, message }) => "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\t--bg: white;\n\t\t\t\t--fg: #222;\n\t\t\t\t--divider: #ccc;\n\t\t\t\tbackground: var(--bg);\n\t\t\t\tcolor: var(--fg);\n\t\t\t\tfont-family:\n\t\t\t\t\tsystem-ui,\n\t\t\t\t\t-apple-system,\n\t\t\t\t\tBlinkMacSystemFont,\n\t\t\t\t\t'Segoe UI',\n\t\t\t\t\tRoboto,\n\t\t\t\t\tOxygen,\n\t\t\t\t\tUbuntu,\n\t\t\t\t\tCantarell,\n\t\t\t\t\t'Open Sans',\n\t\t\t\t\t'Helvetica Neue',\n\t\t\t\t\tsans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid var(--divider);\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\n\t\t\t@media (prefers-color-scheme: dark) {\n\t\t\t\tbody {\n\t\t\t\t\t--bg: #222;\n\t\t\t\t\t--fg: #ddd;\n\t\t\t\t\t--divider: #666;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n"
},
version_hash: "jr2x5n"
version_hash: "t8yzem"
};
export async function get_hooks() {

View File

@@ -1,13 +1,13 @@
{
".svelte-kit/generated/client-optimized/app.js": {
"file": "_app/immutable/entry/app.BB-guR1A.js",
"file": "_app/immutable/entry/app.CZjkDWD3.js",
"name": "entry/app",
"src": ".svelte-kit/generated/client-optimized/app.js",
"isEntry": true,
"imports": [
"_preload-helper.C1FmrZbK.js",
"_scheduler.t-3xYmlC.js",
"_index.Dz99_Qdh.js"
"_scheduler.PSnnHpgA.js",
"_index.0641B4xi.js"
],
"dynamicImports": [
".svelte-kit/generated/client-optimized/nodes/0.js",
@@ -18,97 +18,97 @@
]
},
".svelte-kit/generated/client-optimized/nodes/0.js": {
"file": "_app/immutable/nodes/0.BLjvgh0X.js",
"file": "_app/immutable/nodes/0.AnXNanYA.js",
"name": "nodes/0",
"src": ".svelte-kit/generated/client-optimized/nodes/0.js",
"isEntry": true,
"isDynamicEntry": true,
"imports": [
"_preload-helper.C1FmrZbK.js",
"_scheduler.t-3xYmlC.js",
"_index.Dz99_Qdh.js"
"_scheduler.PSnnHpgA.js",
"_index.0641B4xi.js"
],
"dynamicImports": [
"_jquery.DayQ7gTg.js"
]
},
".svelte-kit/generated/client-optimized/nodes/1.js": {
"file": "_app/immutable/nodes/1.DltsNqkt.js",
"file": "_app/immutable/nodes/1.BUIZ54fc.js",
"name": "nodes/1",
"src": ".svelte-kit/generated/client-optimized/nodes/1.js",
"isEntry": true,
"isDynamicEntry": true,
"imports": [
"_scheduler.t-3xYmlC.js",
"_index.Dz99_Qdh.js",
"_entry.CWTQmo3s.js"
"_scheduler.PSnnHpgA.js",
"_index.0641B4xi.js",
"_entry.Dac4waFl.js"
]
},
".svelte-kit/generated/client-optimized/nodes/2.js": {
"file": "_app/immutable/nodes/2.B0UqQsDX.js",
"file": "_app/immutable/nodes/2.CnoF6cHq.js",
"name": "nodes/2",
"src": ".svelte-kit/generated/client-optimized/nodes/2.js",
"isEntry": true,
"isDynamicEntry": true,
"imports": [
"_scheduler.t-3xYmlC.js",
"_index.Dz99_Qdh.js",
"_scoreStore.BJlEo5Dk.js"
"_scheduler.PSnnHpgA.js",
"_index.0641B4xi.js",
"_scoreStore.d37k1Evl.js"
],
"css": [
"_app/immutable/assets/2.DxlxdAfj.css"
]
},
".svelte-kit/generated/client-optimized/nodes/3.js": {
"file": "_app/immutable/nodes/3.vi6sie8m.js",
"file": "_app/immutable/nodes/3.Cz998YEo.js",
"name": "nodes/3",
"src": ".svelte-kit/generated/client-optimized/nodes/3.js",
"isEntry": true,
"isDynamicEntry": true,
"imports": [
"_scheduler.t-3xYmlC.js",
"_index.Dz99_Qdh.js"
"_scheduler.PSnnHpgA.js",
"_index.0641B4xi.js"
]
},
".svelte-kit/generated/client-optimized/nodes/4.js": {
"file": "_app/immutable/nodes/4.69oG6wwC.js",
"file": "_app/immutable/nodes/4.DdPoLKDr.js",
"name": "nodes/4",
"src": ".svelte-kit/generated/client-optimized/nodes/4.js",
"isEntry": true,
"isDynamicEntry": true,
"imports": [
"_preload-helper.C1FmrZbK.js",
"_scheduler.t-3xYmlC.js",
"_index.Dz99_Qdh.js",
"_scoreStore.BJlEo5Dk.js"
"_scheduler.PSnnHpgA.js",
"_index.0641B4xi.js",
"_scoreStore.d37k1Evl.js"
],
"dynamicImports": [
"_jquery.DayQ7gTg.js"
],
"css": [
"_app/immutable/assets/4.T_78NcA1.css"
"_app/immutable/assets/4.DKtufWnM.css"
]
},
"_entry.CWTQmo3s.js": {
"file": "_app/immutable/chunks/entry.CWTQmo3s.js",
"_entry.Dac4waFl.js": {
"file": "_app/immutable/chunks/entry.Dac4waFl.js",
"name": "entry",
"imports": [
"_scheduler.t-3xYmlC.js",
"_index.BEtjop6e.js"
"_scheduler.PSnnHpgA.js",
"_index.DXEl5lQ6.js"
]
},
"_index.BEtjop6e.js": {
"file": "_app/immutable/chunks/index.BEtjop6e.js",
"_index.0641B4xi.js": {
"file": "_app/immutable/chunks/index.0641B4xi.js",
"name": "index",
"imports": [
"_scheduler.t-3xYmlC.js"
"_scheduler.PSnnHpgA.js"
]
},
"_index.Dz99_Qdh.js": {
"file": "_app/immutable/chunks/index.Dz99_Qdh.js",
"_index.DXEl5lQ6.js": {
"file": "_app/immutable/chunks/index.DXEl5lQ6.js",
"name": "index",
"imports": [
"_scheduler.t-3xYmlC.js"
"_scheduler.PSnnHpgA.js"
]
},
"_jquery.DayQ7gTg.js": {
@@ -120,24 +120,24 @@
"file": "_app/immutable/chunks/preload-helper.C1FmrZbK.js",
"name": "preload-helper"
},
"_scheduler.t-3xYmlC.js": {
"file": "_app/immutable/chunks/scheduler.t-3xYmlC.js",
"_scheduler.PSnnHpgA.js": {
"file": "_app/immutable/chunks/scheduler.PSnnHpgA.js",
"name": "scheduler"
},
"_scoreStore.BJlEo5Dk.js": {
"file": "_app/immutable/chunks/scoreStore.BJlEo5Dk.js",
"_scoreStore.d37k1Evl.js": {
"file": "_app/immutable/chunks/scoreStore.d37k1Evl.js",
"name": "scoreStore",
"imports": [
"_index.BEtjop6e.js"
"_index.DXEl5lQ6.js"
]
},
"node_modules/@sveltejs/kit/src/runtime/client/entry.js": {
"file": "_app/immutable/entry/start.Dk8EHlvX.js",
"file": "_app/immutable/entry/start.M9x8rur4.js",
"name": "entry/start",
"src": "node_modules/@sveltejs/kit/src/runtime/client/entry.js",
"isEntry": true,
"imports": [
"_entry.CWTQmo3s.js"
"_entry.Dac4waFl.js"
]
}
}

View File

@@ -1 +0,0 @@
.container.svelte-31d80g,.player.svelte-31d80g{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.disabled.svelte-31d80g{display:none}.player.svelte-31d80g{gap:2vh}.name.svelte-31d80g{width:17vw;height:6vh;border:2px solid #A1674A;border-radius:10px;box-shadow:0 0 10px #343232}.circular-loader.svelte-31d80g{stroke-dasharray:100,125;stroke-dashoffset:-5;animation:svelte-31d80g-rotate 2s ease-in-out infinite;stroke-linecap:round}.loader-path.svelte-31d80g{width:25vw;height:25vh}button.svelte-31d80g{color:#000;width:18vw;height:15vh;border-radius:10px;background-color:#f1ecec;border:2px solid #A1674A;background-size:1800% 1800%;box-shadow:0 0 10px #343232}.name.svelte-31d80g:hover,button.svelte-31d80g:hover{transform:scale(1.1)}@keyframes svelte-31d80g-rotate{to{transform:rotate(360deg)}}

View File

@@ -1 +0,0 @@
.container.svelte-31d80g,.player.svelte-31d80g{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.disabled.svelte-31d80g{display:none}.player.svelte-31d80g{gap:2vh}.name.svelte-31d80g{width:17vw;height:6vh;border:2px solid #A1674A;border-radius:10px;box-shadow:0 0 10px #343232}.circular-loader.svelte-31d80g{stroke-dasharray:100,125;stroke-dashoffset:-5;animation:svelte-31d80g-rotate 2s ease-in-out infinite;stroke-linecap:round}.loader-path.svelte-31d80g{width:25vw;height:25vh}button.svelte-31d80g{color:#000;width:18vw;height:15vh;border-radius:10px;background-color:#f1ecec;border:2px solid #A1674A;background-size:1800% 1800%;box-shadow:0 0 10px #343232}.name.svelte-31d80g:hover,button.svelte-31d80g:hover{transform:scale(1.1)}@keyframes svelte-31d80g-rotate{to{transform:rotate(360deg)}}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
import{n as f,s as l}from"./scheduler.t-3xYmlC.js";const e=[];function h(n,b=f){let i;const o=new Set;function r(t){if(l(n,t)&&(n=t,i)){const c=!e.length;for(const s of o)s[1](),e.push(s,n);if(c){for(let s=0;s<e.length;s+=2)e[s][0](e[s+1]);e.length=0}}}function u(t){r(t(n))}function p(t,c=f){const s=[t,c];return o.add(s),o.size===1&&(i=b(r,u)||f),t(n),()=>{o.delete(s),o.size===0&&i&&(i(),i=null)}}return{set:r,update:u,subscribe:p}}export{h as w};

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
function x(){}function w(t,n){for(const e in n)t[e]=n[e];return t}function j(t){return t()}function F(){return Object.create(null)}function E(t){t.forEach(j)}function P(t){return typeof t=="function"}function S(t,n){return t!=t?n==n:t!==n||t&&typeof t=="object"||typeof t=="function"}let i;function U(t,n){return t===n?!0:(i||(i=document.createElement("a")),i.href=n,t===i.href)}function A(t){return Object.keys(t).length===0}function q(t,...n){if(t==null){for(const r of n)r(void 0);return x}const e=t.subscribe(...n);return e.unsubscribe?()=>e.unsubscribe():e}function B(t,n,e){t.$$.on_destroy.push(q(n,e))}function C(t,n,e,r){if(t){const o=m(t,n,e,r);return t[0](o)}}function m(t,n,e,r){return t[1]&&r?w(e.ctx.slice(),t[1](r(n))):e.ctx}function D(t,n,e,r){if(t[2]&&r){const o=t[2](r(e));if(n.dirty===void 0)return o;if(typeof o=="object"){const l=[],_=Math.max(n.dirty.length,o.length);for(let s=0;s<_;s+=1)l[s]=n.dirty[s]|o[s];return l}return n.dirty|o}return n.dirty}function G(t,n,e,r,o,l){if(o){const _=m(n,e,r,l);t.p(_,o)}}function H(t){if(t.ctx.length>32){const n=[],e=t.ctx.length/32;for(let r=0;r<e;r++)n[r]=-1;return n}return-1}let f;function h(t){f=t}function y(){if(!f)throw new Error("Function called outside component initialization");return f}function I(t){y().$$.on_mount.push(t)}function J(t){y().$$.after_update.push(t)}const a=[],g=[];let u=[];const p=[],k=Promise.resolve();let b=!1;function v(){b||(b=!0,k.then(M))}function K(){return v(),k}function O(t){u.push(t)}function L(t){p.push(t)}const d=new Set;let c=0;function M(){if(c!==0)return;const t=f;do{try{for(;c<a.length;){const n=a[c];c++,h(n),z(n.$$)}}catch(n){throw a.length=0,c=0,n}for(h(null),a.length=0,c=0;g.length;)g.pop()();for(let n=0;n<u.length;n+=1){const e=u[n];d.has(e)||(d.add(e),e())}u.length=0}while(a.length);for(;p.length;)p.pop()();b=!1,d.clear(),h(t)}function z(t){if(t.fragment!==null){t.update(),E(t.before_update);const n=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,n),t.after_update.forEach(O)}}function N(t){const n=[],e=[];u.forEach(r=>t.indexOf(r)===-1?n.push(r):e.push(r)),e.forEach(r=>r()),u=n}export{J as a,g as b,B as c,C as d,D as e,U as f,H as g,L as h,F as i,M as j,P as k,A as l,O as m,x as n,I as o,N as p,f as q,E as r,S as s,K as t,G as u,h as v,j as w,a as x,v as y};

View File

@@ -1 +0,0 @@
var S=Object.defineProperty;var p=(t,e,r)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var a=(t,e,r)=>p(t,typeof e!="symbol"?e+"":e,r);import{w}from"./index.BEtjop6e.js";class g{constructor({playerName:e="",value:r=0}){a(this,"playerName");a(this,"value");this.playerName=e,this.value=r}}let n="scores";function c(){return typeof window<"u"&&typeof window.localStorage<"u"}function m(){const t=c()?localStorage.getItem(n):null,{set:e,update:r,subscribe:l}=w(t?JSON.parse(t):[]);return c()&&l(o=>localStorage.setItem(n,JSON.stringify(o))),{update:r,subscribe:l,set:o=>e(o||[]),reset:()=>e([]),add:(o,i)=>{r(u=>{let s=[...u,new g({playerName:o,value:i})];return s.length>=2&&s.sort((d,f)=>d.value-f.value),s})}}}const b=m();export{b as s};

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
import{a as t}from"../chunks/entry.CWTQmo3s.js";export{t as start};

View File

@@ -1 +0,0 @@
import{_ as $}from"../chunks/preload-helper.C1FmrZbK.js";import{s as b,d as y,u as x,g as F,e as L,o as M}from"../chunks/scheduler.t-3xYmlC.js";import{S as T,i as j,e as _,s as v,c as p,g as C,h as w,b as k,d as c,n as g,a as d,v as E,r as H}from"../chunks/index.Dz99_Qdh.js";const D="data:image/svg+xml,%3csvg%20width='98'%20height='96'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M48.854%200C21.839%200%200%2022%200%2049.217c0%2021.756%2013.993%2040.172%2033.405%2046.69%202.427.49%203.316-1.059%203.316-2.362%200-1.141-.08-5.052-.08-9.127-13.59%202.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015%204.934.326%207.523%205.052%207.523%205.052%204.367%207.496%2011.404%205.378%2014.235%204.074.404-3.178%201.699-5.378%203.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283%200-5.378%201.94-9.778%205.014-13.2-.485-1.222-2.184-6.275.486-13.038%200%200%204.125-1.304%2013.426%205.052a46.97%2046.97%200%200%201%2012.214-1.63c4.125%200%208.33.571%2012.213%201.63%209.302-6.356%2013.427-5.052%2013.427-5.052%202.67%206.763.97%2011.816.485%2013.038%203.155%203.422%205.015%207.822%205.015%2013.2%200%2018.905-11.404%2023.06-22.324%2024.283%201.78%201.548%203.316%204.481%203.316%209.126%200%206.6-.08%2011.897-.08%2013.526%200%201.304.89%202.853%203.316%202.364%2019.412-6.52%2033.405-24.935%2033.405-46.691C97.707%2022%2075.788%200%2048.854%200z'%20fill='%23fff'/%3e%3c/svg%3e",I="data:image/svg+xml,%3csvg%20fill='%23FFFFFF'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2050%2050'%20width='50px'%20height='50px'%3e%3cpath%20d='M%2050.0625%2010.4375%20C%2048.214844%2011.257813%2046.234375%2011.808594%2044.152344%2012.058594%20C%2046.277344%2010.785156%2047.910156%208.769531%2048.675781%206.371094%20C%2046.691406%207.546875%2044.484375%208.402344%2042.144531%208.863281%20C%2040.269531%206.863281%2037.597656%205.617188%2034.640625%205.617188%20C%2028.960938%205.617188%2024.355469%2010.21875%2024.355469%2015.898438%20C%2024.355469%2016.703125%2024.449219%2017.488281%2024.625%2018.242188%20C%2016.078125%2017.8125%208.503906%2013.71875%203.429688%207.496094%20C%202.542969%209.019531%202.039063%2010.785156%202.039063%2012.667969%20C%202.039063%2016.234375%203.851563%2019.382813%206.613281%2021.230469%20C%204.925781%2021.175781%203.339844%2020.710938%201.953125%2019.941406%20C%201.953125%2019.984375%201.953125%2020.027344%201.953125%2020.070313%20C%201.953125%2025.054688%205.5%2029.207031%2010.199219%2030.15625%20C%209.339844%2030.390625%208.429688%2030.515625%207.492188%2030.515625%20C%206.828125%2030.515625%206.183594%2030.453125%205.554688%2030.328125%20C%206.867188%2034.410156%2010.664063%2037.390625%2015.160156%2037.472656%20C%2011.644531%2040.230469%207.210938%2041.871094%202.390625%2041.871094%20C%201.558594%2041.871094%200.742188%2041.824219%20-0.0585938%2041.726563%20C%204.488281%2044.648438%209.894531%2046.347656%2015.703125%2046.347656%20C%2034.617188%2046.347656%2044.960938%2030.679688%2044.960938%2017.09375%20C%2044.960938%2016.648438%2044.949219%2016.199219%2044.933594%2015.761719%20C%2046.941406%2014.3125%2048.683594%2012.5%2050.0625%2010.4375%20Z'/%3e%3c/svg%3e";function O(r){let a,f='<div class="burger"></div> <nav><a href="/">Leaderboard</a> <a href="/play">Play</a> <a href="/about">About</a></nav>',o,i,n,l,h=`<a href="https://github.com/naaturel"><img src="${D}" height="30" width="30" alt="Github mark"/></a> <a href="https://twitter.com/naaturel_"><img src="${I}" height="30" width="30" alt="Twitter mark"/></a>`,u;const m=r[1].default,e=y(m,r,r[0],null);return{c(){a=_("div"),a.innerHTML=f,o=v(),i=_("div"),e&&e.c(),n=v(),l=_("footer"),l.innerHTML=h,this.h()},l(t){a=p(t,"DIV",{class:!0,"data-svelte-h":!0}),C(a)!=="svelte-1e7h1m1"&&(a.innerHTML=f),o=w(t),i=p(t,"DIV",{class:!0});var s=k(i);e&&e.l(s),s.forEach(c),n=w(t),l=p(t,"FOOTER",{"data-svelte-h":!0}),C(l)!=="svelte-1urjbwz"&&(l.innerHTML=h),this.h()},h(){g(a,"class","menu-collapsed"),g(i,"class","container")},m(t,s){d(t,a,s),d(t,o,s),d(t,i,s),e&&e.m(i,null),d(t,n,s),d(t,l,s),u=!0},p(t,[s]){e&&e.p&&(!u||s&1)&&x(e,m,t,t[0],u?L(m,t[0],s,null):F(t[0]),null)},i(t){u||(E(e,t),u=!0)},o(t){H(e,t),u=!1},d(t){t&&(c(a),c(o),c(i),c(n),c(l)),e&&e.d(t)}}}function P(r,a,f){let{$$slots:o={},$$scope:i}=a;return M(async()=>{const l=(await $(()=>import("../chunks/jquery.DayQ7gTg.js").then(h=>h.j),[],import.meta.url)).default;window.$=l,window.jQuery=l,window.$(".menu-collapsed").click(function(){window.$(this).toggleClass("menu-expanded")})}),r.$$set=n=>{"$$scope"in n&&f(0,i=n.$$scope)},[i,o]}class A extends T{constructor(a){super(),j(this,a,P,O,b,{})}}export{A as component};

View File

@@ -1 +0,0 @@
import{s as S,n as _,c as x}from"../chunks/scheduler.t-3xYmlC.js";import{S as j,i as k,e as f,t as d,s as q,c as g,b as h,f as v,d as u,h as y,a as m,j as $,k as E}from"../chunks/index.Dz99_Qdh.js";import{s as C}from"../chunks/entry.CWTQmo3s.js";const H=()=>{const s=C;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},P={subscribe(s){return H().page.subscribe(s)}};function w(s){var b;let t,r=s[0].status+"",o,n,i,c=((b=s[0].error)==null?void 0:b.message)+"",l;return{c(){t=f("h1"),o=d(r),n=q(),i=f("p"),l=d(c)},l(e){t=g(e,"H1",{});var a=h(t);o=v(a,r),a.forEach(u),n=y(e),i=g(e,"P",{});var p=h(i);l=v(p,c),p.forEach(u)},m(e,a){m(e,t,a),$(t,o),m(e,n,a),m(e,i,a),$(i,l)},p(e,[a]){var p;a&1&&r!==(r=e[0].status+"")&&E(o,r),a&1&&c!==(c=((p=e[0].error)==null?void 0:p.message)+"")&&E(l,c)},i:_,o:_,d(e){e&&(u(t),u(n),u(i))}}}function z(s,t,r){let o;return x(s,P,n=>r(0,o=n)),[o]}let F=class extends j{constructor(t){super(),k(this,t,z,w,S,{})}};export{F as component};

View File

@@ -1 +0,0 @@
import{s as j,n as q,f as M,b as P,h as U,c as y}from"../chunks/scheduler.t-3xYmlC.js";import{S as w,i as z,e as g,c as v,b as $,d as m,n as h,a as G,D as F,s as I,t as S,h as D,f as L,j as i,k as A,E as H,z as J,A as K,B as O,v as Q,r as R,C as T}from"../chunks/index.Dz99_Qdh.js";import{s as B}from"../chunks/scoreStore.BJlEo5Dk.js";function C(l){return(l==null?void 0:l.length)!==void 0?l:Array.from(l)}function N(l,t,a){const e=l.slice();return e[1]=t[a],e[3]=a,e}function V(l){let t,a,e,n,r,s=l[1].playerName+"",c,f,d,p=l[1].value+"",b,x,E;return{c(){t=g("li"),a=g("div"),e=g("img"),r=I(),c=S(s),f=I(),d=g("div"),b=S(p),x=S(" pts."),E=I(),this.h()},l(u){t=v(u,"LI",{class:!0});var o=$(t);a=v(o,"DIV",{class:!0});var _=$(a);e=v(_,"IMG",{src:!0,alt:!0}),r=D(_),c=L(_,s),f=D(_),_.forEach(m),d=v(o,"DIV",{class:!0});var k=$(d);b=L(k,p),x=L(k," pts."),k.forEach(m),E=D(o),o.forEach(m),this.h()},h(){M(e.src,n="")||h(e,"src",n),h(e,"alt",""),h(a,"class","name svelte-13k6dxr"),h(d,"class","score svelte-13k6dxr"),h(t,"class","item svelte-13k6dxr")},m(u,o){G(u,t,o),i(t,a),i(a,e),i(a,r),i(a,c),i(a,f),i(t,d),i(d,b),i(d,x),i(t,E)},p(u,o){o&1&&s!==(s=u[1].playerName+"")&&A(c,s),o&1&&p!==(p=u[1].value+"")&&A(b,p)},d(u){u&&m(t)}}}function W(l){let t,a=C(l[0]),e=[];for(let n=0;n<a.length;n+=1)e[n]=V(N(l,a,n));return{c(){t=g("ul");for(let n=0;n<e.length;n+=1)e[n].c();this.h()},l(n){t=v(n,"UL",{class:!0});var r=$(t);for(let s=0;s<e.length;s+=1)e[s].l(r);r.forEach(m),this.h()},h(){h(t,"class","leaderboard svelte-13k6dxr")},m(n,r){G(n,t,r);for(let s=0;s<e.length;s+=1)e[s]&&e[s].m(t,null)},p(n,[r]){if(r&1){a=C(n[0]);let s;for(s=0;s<a.length;s+=1){const c=N(n,a,s);e[s]?e[s].p(c,r):(e[s]=V(c),e[s].c(),e[s].m(t,null))}for(;s<e.length;s+=1)e[s].d(1);e.length=a.length}},i:q,o:q,d(n){n&&m(t),F(e,n)}}}function X(l,t,a){let{scores:e=[]}=t;return l.$$set=n=>{"scores"in n&&a(0,e=n.scores)},[e]}class Y extends w{constructor(t){super(),z(this,t,X,W,j,{scores:0})}}function Z(l){let t,a,e;function n(s){l[1](s)}let r={};return l[0]!==void 0&&(r.scores=l[0]),t=new Y({props:r}),P.push(()=>H(t,"scores",n)),{c(){J(t.$$.fragment)},l(s){K(t.$$.fragment,s)},m(s,c){O(t,s,c),e=!0},p(s,[c]){const f={};!a&&c&1&&(a=!0,f.scores=s[0],U(()=>a=!1)),t.$set(f)},i(s){e||(Q(t.$$.fragment,s),e=!0)},o(s){R(t.$$.fragment,s),e=!1},d(s){T(t,s)}}}function ee(l,t,a){let e;y(l,B,r=>a(0,e=r));function n(r){e=r,B.set(e)}return[e,n]}class ae extends w{constructor(t){super(),z(this,t,ee,Z,j,{})}}export{ae as component};

View File

@@ -1 +0,0 @@
import{s as r,n as a}from"../chunks/scheduler.t-3xYmlC.js";import{S as i,i as l,e as m,c,g as p,a as d,d as f}from"../chunks/index.Dz99_Qdh.js";function u(s){let e,n="It was revealed to me in a dream";return{c(){e=m("p"),e.textContent=n},l(t){e=c(t,"P",{"data-svelte-h":!0}),p(e)!=="svelte-nwzi5w"&&(e.textContent=n)},m(t,o){d(t,e,o)},p:a,i:a,o:a,d(t){t&&f(e)}}}class v extends i{constructor(e){super(),l(this,e,null,u,r,{})}}export{v as component};

View File

@@ -1 +0,0 @@
import{_ as A}from"../chunks/preload-helper.C1FmrZbK.js";import{s as Y,n as N,r as z,o as F}from"../chunks/scheduler.t-3xYmlC.js";import{S as G,i as H,e as m,l as Q,s as I,t as T,c as f,b as p,m as S,d as v,h as C,f as R,g as J,n as e,a as K,j as s,o as O,p as U}from"../chunks/index.Dz99_Qdh.js";import{s as W}from"../chunks/scoreStore.BJlEo5Dk.js";function X(w){let a,r,l,t,y,o,h,_,$,V,n,i,j,d,B="Let's roll !",k,b,P,L;return{c(){a=m("div"),r=m("div"),l=Q("svg"),t=Q("circle"),y=I(),o=m("div"),h=T("Rolling a random numbers within range 0-"),_=T(D),$=T("..."),V=I(),n=m("div"),i=m("input"),j=I(),d=m("button"),d.textContent=B,k=I(),b=m("div"),this.h()},l(c){a=f(c,"DIV",{class:!0});var u=p(a);r=f(u,"DIV",{class:!0});var x=p(r);l=S(x,"svg",{class:!0,viewBox:!0});var M=p(l);t=S(M,"circle",{class:!0,cx:!0,cy:!0,r:!0,fill:!0,stroke:!0,"stroke-width":!0}),p(t).forEach(v),M.forEach(v),y=C(x),o=f(x,"DIV",{class:!0});var E=p(o);h=R(E,"Rolling a random numbers within range 0-"),_=R(E,D),$=R(E,"..."),E.forEach(v),x.forEach(v),V=C(u),n=f(u,"DIV",{class:!0});var g=p(n);i=f(g,"INPUT",{class:!0,placeholder:!0}),j=C(g),d=f(g,"BUTTON",{class:!0,"data-svelte-h":!0}),J(d)!=="svelte-bef7me"&&(d.textContent=B),k=C(g),b=f(g,"DIV",{class:!0}),p(b).forEach(v),g.forEach(v),u.forEach(v),this.h()},h(){e(t,"class","loader-path svelte-31d80g"),e(t,"cx","15"),e(t,"cy","15"),e(t,"r","5"),e(t,"fill","none"),e(t,"stroke","#f1ecec"),e(t,"stroke-width","0.7"),e(l,"class","circular-loader svelte-31d80g"),e(l,"viewBox","0 0 30 30"),e(o,"class","info"),e(r,"class","loader disabled svelte-31d80g"),e(i,"class","name svelte-31d80g"),e(i,"placeholder","Your name"),e(d,"class","svelte-31d80g"),e(b,"class","result"),e(n,"class","player svelte-31d80g"),e(a,"class","container svelte-31d80g")},m(c,u){K(c,a,u),s(a,r),s(r,l),s(l,t),s(r,y),s(r,o),s(o,h),s(o,_),s(o,$),s(a,V),s(a,n),s(n,i),O(i,w[0]),s(n,j),s(n,d),s(n,k),s(n,b),P||(L=[U(i,"input",w[2]),U(d,"click",w[1])],P=!0)},p(c,[u]){u&1&&i.value!==c[0]&&O(i,c[0])},i:N,o:N,d(c){c&&v(a),P=!1,z(L)}}}let D=100;function q(){window.$(".loader").toggleClass("disabled"),window.$(".player").toggleClass("disabled")}function Z(w,a,r){let l,t=0;F(async()=>{const _=(await A(()=>import("../chunks/jquery.DayQ7gTg.js").then($=>$.j),[],import.meta.url)).default;window.$=_,window.jQuery=_});async function y(){q(),t=Math.floor(Math.random()*(D+1)),await new Promise(h=>setTimeout(h,3e3)),q(),window.$(".result").text(`Result : ${t}/${D}`),W.add(l,t)}function o(){l=this.value,r(0,l)}return[l,y,o]}class le extends G{constructor(a){super(),H(this,a,Z,X,Y,{})}}export{le as component};

View File

@@ -1 +1 @@
{"version":"1728922282538"}
{"version":"1729708008371"}

View File

@@ -99,7 +99,7 @@
"_scoreStore.js"
],
"css": [
"_app/immutable/assets/_page.T_78NcA1.css"
"_app/immutable/assets/_page.DKtufWnM.css"
]
}
}

View File

@@ -1 +0,0 @@
.container.svelte-31d80g,.player.svelte-31d80g{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.disabled.svelte-31d80g{display:none}.player.svelte-31d80g{gap:2vh}.name.svelte-31d80g{width:17vw;height:6vh;border:2px solid #A1674A;border-radius:10px;box-shadow:0 0 10px #343232}.circular-loader.svelte-31d80g{stroke-dasharray:100,125;stroke-dashoffset:-5;animation:svelte-31d80g-rotate 2s ease-in-out infinite;stroke-linecap:round}.loader-path.svelte-31d80g{width:25vw;height:25vh}button.svelte-31d80g{color:#000;width:18vw;height:15vh;border-radius:10px;background-color:#f1ecec;border:2px solid #A1674A;background-size:1800% 1800%;box-shadow:0 0 10px #343232}.name.svelte-31d80g:hover,button.svelte-31d80g:hover{transform:scale(1.1)}@keyframes svelte-31d80g-rotate{to{transform:rotate(360deg)}}

View File

@@ -1,4 +1,4 @@
import { n as noop, f as safe_not_equal } from "./ssr.js";
import { n as noop, d as safe_not_equal } from "./ssr.js";
const subscriber_queue = [];
function readable(value, start) {
return {

View File

@@ -204,7 +204,7 @@ const options = {
<div class="error">
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
},
version_hash: "vmq992"
version_hash: "1xthrp6"
};
async function get_hooks() {
return {};

View File

@@ -7,29 +7,43 @@ class Score {
this.value = value;
}
}
let localStorageKey = "scores";
function isBrowser() {
return typeof window !== "undefined" && typeof window.localStorage !== "undefined";
const api_url = "http://naaturel.be:5000/api";
async function getLeaderboard() {
return await handleRequest(
`${api_url}/api/leaderboard/`,
{ method: "GET" }
);
}
function createStore() {
const storedValue = isBrowser() ? localStorage.getItem(localStorageKey) : null;
const { set, update, subscribe } = writable(!storedValue ? [] : JSON.parse(storedValue));
if (isBrowser()) subscribe((value) => localStorage.setItem(localStorageKey, JSON.stringify(value)));
async function handleRequest(url, init) {
return await fetch(url, init).then((response) => {
if (response.status === 500) throw new Error(`${response.text()}`);
if (!response.ok) throw new Error(`${response.status} : ${response.body}`);
return response;
}).then((response) => {
return response.json();
}).catch((error) => {
return `Exception: ${error.message}`;
});
}
function createStore(scores) {
const { set, update, subscribe } = writable(scores);
return {
update,
subscribe,
set: (value) => set(!value ? [] : value),
reset: () => set([]),
add: (playerName, value) => {
update((scores) => {
let s = [...scores, new Score({ playerName, value })];
update((scores2) => {
let s = [...scores2, new Score({ playerName, value })];
if (s.length >= 2) s.sort((s1, s2) => s1.value - s2.value);
return s;
});
}
};
}
const scoreStore = createStore();
export {
scoreStore as s
};
async function createStoreFromAPI() {
console.log("http://naaturel.be:5000/api");
let scores = await getLeaderboard();
return createStore(scores);
}
createStoreFromAPI();

View File

@@ -37,9 +37,6 @@ function setContext(key, context) {
function getContext(key) {
return get_current_component().$$.context.get(key);
}
function ensure_array_like(array_like_or_iterator) {
return array_like_or_iterator?.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
}
const ATTR_REGEX = /[&"<]/g;
const CONTENT_REGEX = /[&<]/g;
function escape(value, is_attr = false) {
@@ -56,14 +53,6 @@ function escape(value, is_attr = false) {
}
return escaped + str.substring(last);
}
function each(items, fn) {
items = ensure_array_like(items);
let str = "";
for (let i = 0; i < items.length; i += 1) {
str += fn(items[i], i);
}
return str;
}
const missing_component = {
$$render: () => ""
};
@@ -122,9 +111,8 @@ export {
add_attribute as a,
subscribe as b,
create_ssr_component as c,
each as d,
safe_not_equal as d,
escape as e,
safe_not_equal as f,
getContext as g,
missing_component as m,
noop as n,

View File

@@ -1,39 +1,14 @@
import { c as create_ssr_component, d as each, e as escape, b as subscribe, v as validate_component } from "../../chunks/ssr.js";
import { s as scoreStore } from "../../chunks/scoreStore.js";
const css = {
code: ".leaderboard.svelte-13k6dxr{display:flex;flex-direction:column;width:60vw;height:65vh;padding:0 2vw 2vw 2vw;overflow:scroll;overflow-x:hidden}.leaderboard.svelte-13k6dxr::-webkit-scrollbar{display:none}li.svelte-13k6dxr{display:flex;justify-content:space-around;padding:1.25vh;margin:1.5vh;border:2px solid #A1674A;border-radius:10px;background-color:#f1ecec;box-shadow:0 0 10px #343232}li.svelte-13k6dxr:hover{transform:scale(1.075);background-color:#F5F5F5}.name.svelte-13k6dxr,.score.svelte-13k6dxr{color:black;margin-left:3vh}.name.svelte-13k6dxr{flex-grow:100;border-right:1px solid #A1674A}.score.svelte-13k6dxr{flex-grow:20;text-align:center}",
map: '{"version":3,"file":"LeaderBoard.svelte","sources":["LeaderBoard.svelte"],"sourcesContent":["<script>\\r\\n\\r\\n export let scores = []\\r\\n\\r\\n<\/script>\\r\\n\\r\\n<ul class=\\"leaderboard\\">\\r\\n\\r\\n {#each scores as score, i}\\r\\n <li class=\\"item\\">\\r\\n <div class=\\"name\\"><img src=\\"\\" alt=\\"\\"/> {score.playerName} </div><div class=\\"score\\"> {score.value} pts.</div>\\r\\n </li>\\r\\n {/each}\\r\\n\\r\\n</ul>\\r\\n\\r\\n<style>\\r\\n\\r\\n .leaderboard\\r\\n {\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n\\r\\n width: 60vw;\\r\\n height: 65vh;\\r\\n\\r\\n padding: 0 2vw 2vw 2vw;\\r\\n overflow: scroll;\\r\\n overflow-x: hidden;\\r\\n }\\r\\n\\r\\n .leaderboard::-webkit-scrollbar {\\r\\n display: none;\\r\\n }\\r\\n\\r\\n li\\r\\n {\\r\\n display: flex;\\r\\n justify-content: space-around;\\r\\n padding: 1.25vh;\\r\\n margin: 1.5vh;\\r\\n border: 2px solid #A1674A;\\r\\n border-radius: 10px;\\r\\n background-color: #f1ecec;\\r\\n box-shadow: 0 0 10px #343232;\\r\\n }\\r\\n\\r\\n li:hover\\r\\n {\\r\\n transform: scale(1.075);\\r\\n background-color: #F5F5F5;\\r\\n }\\r\\n\\r\\n .name, .score\\r\\n {\\r\\n color: black;\\r\\n margin-left: 3vh;\\r\\n }\\r\\n\\r\\n .name\\r\\n {\\r\\n flex-grow: 100;\\r\\n border-right: 1px solid #A1674A;\\r\\n }\\r\\n\\r\\n .score\\r\\n {\\r\\n flex-grow: 20;\\r\\n text-align: center;\\r\\n }\\r\\n\\r\\n</style>"],"names":[],"mappings":"AAkBI,2BACA,CACI,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,MAAM,CAEtB,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CAEZ,OAAO,CAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CACtB,QAAQ,CAAE,MAAM,CAChB,UAAU,CAAE,MAChB,CAEA,2BAAY,mBAAoB,CAC5B,OAAO,CAAE,IACb,CAEA,iBACA,CACI,OAAO,CAAE,IAAI,CACb,eAAe,CAAE,YAAY,CAC7B,OAAO,CAAE,MAAM,CACf,MAAM,CAAE,KAAK,CACb,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CACzB,aAAa,CAAE,IAAI,CACnB,gBAAgB,CAAE,OAAO,CACzB,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OACzB,CAEA,iBAAE,MACF,CACI,SAAS,CAAE,MAAM,KAAK,CAAC,CACvB,gBAAgB,CAAE,OACtB,CAEA,oBAAK,CAAE,qBACP,CACI,KAAK,CAAE,KAAK,CACZ,WAAW,CAAE,GACjB,CAEA,oBACA,CACI,SAAS,CAAE,GAAG,CACd,YAAY,CAAE,GAAG,CAAC,KAAK,CAAC,OAC5B,CAEA,qBACA,CACI,SAAS,CAAE,EAAE,CACb,UAAU,CAAE,MAChB"}'
};
const LeaderBoard = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let { scores = [] } = $$props;
if ($$props.scores === void 0 && $$bindings.scores && scores !== void 0) $$bindings.scores(scores);
$$result.css.add(css);
return `<ul class="leaderboard svelte-13k6dxr">${each(scores, (score, i) => {
return `<li class="item svelte-13k6dxr"><div class="name svelte-13k6dxr"><img src="" alt=""> ${escape(score.playerName)} </div><div class="score svelte-13k6dxr">${escape(score.value)} pts.</div> </li>`;
})} </ul>`;
});
import { c as create_ssr_component } from "../../chunks/ssr.js";
import "../../chunks/scoreStore.js";
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $scoreStore, $$unsubscribe_scoreStore;
$$unsubscribe_scoreStore = subscribe(scoreStore, (value) => $scoreStore = value);
let $$settled;
let $$rendered;
let previous_head = $$result.head;
do {
$$settled = true;
$$result.head = previous_head;
$$rendered = `${validate_component(LeaderBoard, "LeaderBoard").$$render(
$$result,
{ scores: $scoreStore },
{
scores: ($$value) => {
$scoreStore = $$value;
$$settled = false;
}
},
{}
)}`;
$$rendered = `${`<p data-svelte-h="svelte-17x5wrh">Loading leaderboard...</p>`}`;
} while (!$$settled);
$$unsubscribe_scoreStore();
return $$rendered;
});
export {

View File

@@ -1,14 +1,14 @@
import { c as create_ssr_component, e as escape, a as add_attribute } from "../../../chunks/ssr.js";
import "../../../chunks/scoreStore.js";
const css = {
code: ".container.svelte-31d80g,.player.svelte-31d80g{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.disabled.svelte-31d80g{display:none}.player.svelte-31d80g{gap:2vh}.name.svelte-31d80g{width:17vw;height:6vh;border:2px solid #A1674A;border-radius:10px;box-shadow:0 0 10px #343232}.circular-loader.svelte-31d80g{stroke-dasharray:100, 125;stroke-dashoffset:-5;animation:svelte-31d80g-rotate 2s ease-in-out infinite;stroke-linecap:round}.loader-path.svelte-31d80g{width:25vw;height:25vh}button.svelte-31d80g{color:black;width:18vw;height:15vh;border-radius:10px;background-color:#f1ecec;border:2px solid #A1674A;background-size:1800% 1800%;box-shadow:0 0 10px #343232}.name.svelte-31d80g:hover,button.svelte-31d80g:hover{transform:scale(1.1)}@keyframes svelte-31d80g-rotate{to{transform:rotate(360deg)}}",
map: '{"version":3,"file":"+page.svelte","sources":["+page.svelte"],"sourcesContent":["<script>\\r\\n\\r\\n import {onMount} from \\"svelte\\";\\r\\n import {scoreStore} from \\"$lib/stores/scoreStore.ts\\";\\r\\n\\r\\n let playerName = undefined;\\r\\n let range = 100;\\r\\n let result = 0;\\r\\n\\r\\n onMount(async () => {\\r\\n const jQuery = await import(\'jquery\');\\r\\n const $ = jQuery.default;\\r\\n\\r\\n window.$ = $;\\r\\n window.jQuery = $;\\r\\n });\\r\\n\\r\\n async function roll() {\\r\\n\\r\\n toggleLoading();\\r\\n\\r\\n result = Math.floor(Math.random() * (range + 1));\\r\\n\\r\\n await new Promise(r => setTimeout(r, 3000));\\r\\n\\r\\n toggleLoading();\\r\\n window.$(\\".result\\").text(`Result : ${result}/${range}`)\\r\\n\\r\\n scoreStore.add(playerName, result)\\r\\n }\\r\\n\\r\\n function toggleLoading(){\\r\\n window.$(\\".loader\\").toggleClass(\\"disabled\\");\\r\\n window.$(\\".player\\").toggleClass(\\"disabled\\");\\r\\n }\\r\\n\\r\\n<\/script>\\r\\n\\r\\n<div class=\\"container\\">\\r\\n <div class=\\"loader disabled\\">\\r\\n <svg class=\\"circular-loader\\" viewBox=\\"0 0 30 30\\">\\r\\n <circle class=\\"loader-path\\" cx=\\"15\\" cy=\\"15\\" r=\\"5\\" fill=\\"none\\" stroke=\\"#f1ecec\\" stroke-width=\\"0.7\\" />\\r\\n </svg>\\r\\n <div class=\\"info\\">Rolling a random numbers within range 0-{range}...</div>\\r\\n </div>\\r\\n\\r\\n <div class=\\"player\\">\\r\\n <input class=\\"name\\" placeholder=\\"Your name\\" bind:value={playerName}/>\\r\\n <button on:click={roll}>Let\'s roll !</button>\\r\\n <div class=\\"result\\"></div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<style>\\r\\n\\r\\n .container, .player\\r\\n {\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n justify-content: center;\\r\\n align-items: center;\\r\\n text-align: center;\\r\\n }\\r\\n\\r\\n .disabled\\r\\n {\\r\\n display: none;\\r\\n }\\r\\n\\r\\n .player\\r\\n {\\r\\n gap: 2vh;\\r\\n }\\r\\n\\r\\n .name\\r\\n {\\r\\n width: 17vw;\\r\\n height: 6vh;\\r\\n border: 2px solid #A1674A;\\r\\n border-radius: 10px;\\r\\n box-shadow: 0 0 10px #343232;\\r\\n }\\r\\n\\r\\n .circular-loader\\r\\n {\\r\\n stroke-dasharray: 100, 125;\\r\\n stroke-dashoffset: -5;\\r\\n animation: rotate 2s ease-in-out infinite;\\r\\n stroke-linecap: round;\\r\\n }\\r\\n\\r\\n .loader-path {\\r\\n width: 25vw;\\r\\n height: 25vh;\\r\\n }\\r\\n\\r\\n button\\r\\n {\\r\\n color: black;\\r\\n width: 18vw;\\r\\n height: 15vh;\\r\\n border-radius: 10px;\\r\\n background-color: #f1ecec;\\r\\n border: 2px solid #A1674A;\\r\\n background-size: 1800% 1800%;\\r\\n box-shadow: 0 0 10px #343232;\\r\\n }\\r\\n\\r\\n .name:hover, button:hover{\\r\\n transform: scale(1.1);\\r\\n }\\r\\n\\r\\n @keyframes rotate {\\r\\n to{transform: rotate(360deg)}\\r\\n }\\r\\n\\r\\n</style>"],"names":[],"mappings":"AAuDI,wBAAU,CAAE,qBACZ,CACI,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,MAAM,CACtB,eAAe,CAAE,MAAM,CACvB,WAAW,CAAE,MAAM,CACnB,UAAU,CAAE,MAChB,CAEA,uBACA,CACI,OAAO,CAAE,IACb,CAEA,qBACA,CACI,GAAG,CAAE,GACT,CAEA,mBACA,CACI,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,GAAG,CACX,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CACzB,aAAa,CAAE,IAAI,CACnB,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OACzB,CAEA,8BACA,CACI,gBAAgB,CAAE,GAAG,CAAC,CAAC,GAAG,CAC1B,iBAAiB,CAAE,EAAE,CACrB,SAAS,CAAE,oBAAM,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CACzC,cAAc,CAAE,KACpB,CAEA,0BAAa,CACT,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IACZ,CAEA,oBACA,CACI,KAAK,CAAE,KAAK,CACZ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,IAAI,CACnB,gBAAgB,CAAE,OAAO,CACzB,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CACzB,eAAe,CAAE,KAAK,CAAC,KAAK,CAC5B,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OACzB,CAEA,mBAAK,MAAM,CAAE,oBAAM,MAAM,CACrB,SAAS,CAAE,MAAM,GAAG,CACxB,CAEA,WAAW,oBAAO,CACd,EAAE,CAAC,SAAS,CAAE,OAAO,MAAM,CAAC,CAChC"}'
code: ".container.svelte-12gf247,.player.svelte-12gf247{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.disabled.svelte-12gf247{display:none}.player.svelte-12gf247{gap:2vh}.name.svelte-12gf247{width:17vw;height:6vh;border:2px solid #A1674A;border-radius:10px;box-shadow:0 0 10px #343232}.circular-loader.svelte-12gf247{stroke-dasharray:100, 125;stroke-dashoffset:-5;animation:svelte-12gf247-rotate 2s ease-in-out infinite;stroke-linecap:round}.loader-path.svelte-12gf247{width:25vw;height:25vh}button.svelte-12gf247{color:black;width:18vw;height:15vh;border-radius:10px;background-color:#f1ecec;border:2px solid #A1674A;box-shadow:0 0 10px #343232}.name.svelte-12gf247:hover,button.svelte-12gf247:hover{transform:scale(1.1)}@keyframes svelte-12gf247-rotate{to{transform:rotate(360deg)}}",
map: '{"version":3,"file":"+page.svelte","sources":["+page.svelte"],"sourcesContent":["<script>\\r\\n\\r\\n import {onMount} from \\"svelte\\";\\r\\n import {scoreStore} from \\"$lib/stores/scoreStore.ts\\";\\r\\n\\r\\n let playerName = undefined;\\r\\n let range = 100;\\r\\n let result = 0;\\r\\n\\r\\n onMount(async () => {\\r\\n const jQuery = await import(\'jquery\');\\r\\n const $ = jQuery.default;\\r\\n\\r\\n window.$ = $;\\r\\n window.jQuery = $;\\r\\n });\\r\\n\\r\\n async function roll() {\\r\\n\\r\\n toggleLoading();\\r\\n\\r\\n result = Math.floor(Math.random() * (range + 1));\\r\\n\\r\\n await new Promise(r => setTimeout(r, 3000));\\r\\n\\r\\n toggleLoading();\\r\\n window.$(\\".result\\").text(`Result : ${result}/${range}`)\\r\\n\\r\\n scoreStore.add(playerName, result)\\r\\n }\\r\\n\\r\\n function toggleLoading(){\\r\\n window.$(\\".loader\\").toggleClass(\\"disabled\\");\\r\\n window.$(\\".player\\").toggleClass(\\"disabled\\");\\r\\n }\\r\\n\\r\\n<\/script>\\r\\n\\r\\n<div class=\\"container\\">\\r\\n <div class=\\"loader disabled\\">\\r\\n <svg class=\\"circular-loader\\" viewBox=\\"0 0 30 30\\">\\r\\n <circle class=\\"loader-path\\" cx=\\"15\\" cy=\\"15\\" r=\\"5\\" fill=\\"none\\" stroke=\\"#f1ecec\\" stroke-width=\\"0.7\\" />\\r\\n </svg>\\r\\n <div class=\\"info\\">Rolling a random numbers within range 0-{range}...</div>\\r\\n </div>\\r\\n\\r\\n <div class=\\"player\\">\\r\\n <input class=\\"name\\" placeholder=\\"Your name\\" bind:value={playerName}/>\\r\\n <button on:click={roll}>Let\'s roll !</button>\\r\\n <div class=\\"result\\"></div>\\r\\n </div>\\r\\n</div>\\r\\n\\r\\n<style>\\r\\n\\r\\n .container, .player\\r\\n {\\r\\n display: flex;\\r\\n flex-direction: column;\\r\\n justify-content: center;\\r\\n align-items: center;\\r\\n text-align: center;\\r\\n }\\r\\n\\r\\n .disabled\\r\\n {\\r\\n display: none;\\r\\n }\\r\\n\\r\\n .player\\r\\n {\\r\\n gap: 2vh;\\r\\n }\\r\\n\\r\\n .name\\r\\n {\\r\\n width: 17vw;\\r\\n height: 6vh;\\r\\n border: 2px solid #A1674A;\\r\\n border-radius: 10px;\\r\\n box-shadow: 0 0 10px #343232;\\r\\n }\\r\\n\\r\\n .circular-loader\\r\\n {\\r\\n stroke-dasharray: 100, 125;\\r\\n stroke-dashoffset: -5;\\r\\n animation: rotate 2s ease-in-out infinite;\\r\\n stroke-linecap: round;\\r\\n }\\r\\n\\r\\n .loader-path {\\r\\n width: 25vw;\\r\\n height: 25vh;\\r\\n }\\r\\n\\r\\n button\\r\\n {\\r\\n color: black;\\r\\n width: 18vw;\\r\\n height: 15vh;\\r\\n border-radius: 10px;\\r\\n background-color: #f1ecec;\\r\\n border: 2px solid #A1674A;\\r\\n box-shadow: 0 0 10px #343232;\\r\\n }\\r\\n\\r\\n .name:hover, button:hover{\\r\\n transform: scale(1.1);\\r\\n }\\r\\n\\r\\n @keyframes rotate {\\r\\n to{transform: rotate(360deg)}\\r\\n }\\r\\n\\r\\n</style>"],"names":[],"mappings":"AAuDI,yBAAU,CAAE,sBACZ,CACI,OAAO,CAAE,IAAI,CACb,cAAc,CAAE,MAAM,CACtB,eAAe,CAAE,MAAM,CACvB,WAAW,CAAE,MAAM,CACnB,UAAU,CAAE,MAChB,CAEA,wBACA,CACI,OAAO,CAAE,IACb,CAEA,sBACA,CACI,GAAG,CAAE,GACT,CAEA,oBACA,CACI,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,GAAG,CACX,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CACzB,aAAa,CAAE,IAAI,CACnB,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OACzB,CAEA,+BACA,CACI,gBAAgB,CAAE,GAAG,CAAC,CAAC,GAAG,CAC1B,iBAAiB,CAAE,EAAE,CACrB,SAAS,CAAE,qBAAM,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CACzC,cAAc,CAAE,KACpB,CAEA,2BAAa,CACT,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IACZ,CAEA,qBACA,CACI,KAAK,CAAE,KAAK,CACZ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,aAAa,CAAE,IAAI,CACnB,gBAAgB,CAAE,OAAO,CACzB,MAAM,CAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CACzB,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OACzB,CAEA,oBAAK,MAAM,CAAE,qBAAM,MAAM,CACrB,SAAS,CAAE,MAAM,GAAG,CACxB,CAEA,WAAW,qBAAO,CACd,EAAE,CAAC,SAAS,CAAE,OAAO,MAAM,CAAC,CAChC"}'
};
let range = 100;
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let playerName = void 0;
$$result.css.add(css);
return `<div class="container svelte-31d80g"><div class="loader disabled svelte-31d80g"><svg class="circular-loader svelte-31d80g" viewBox="0 0 30 30"><circle class="loader-path svelte-31d80g" cx="15" cy="15" r="5" fill="none" stroke="#f1ecec" stroke-width="0.7"></circle></svg> <div class="info">Rolling a random numbers within range 0-${escape(range)}...</div></div> <div class="player svelte-31d80g"><input class="name svelte-31d80g" placeholder="Your name"${add_attribute("value", playerName, 0)}> <button class="svelte-31d80g" data-svelte-h="svelte-bef7me">Let&#39;s roll !</button> <div class="result"></div></div> </div>`;
return `<div class="container svelte-12gf247"><div class="loader disabled svelte-12gf247"><svg class="circular-loader svelte-12gf247" viewBox="0 0 30 30"><circle class="loader-path svelte-12gf247" cx="15" cy="15" r="5" fill="none" stroke="#f1ecec" stroke-width="0.7"></circle></svg> <div class="info">Rolling a random numbers within range 0-${escape(range)}...</div></div> <div class="player svelte-12gf247"><input class="name svelte-12gf247" placeholder="Your name"${add_attribute("value", playerName, 0)}> <button class="svelte-12gf247" data-svelte-h="svelte-bef7me">Let&#39;s roll !</button> <div class="result"></div></div> </div>`;
});
export {
Page as default

View File

@@ -2542,7 +2542,7 @@ async function respond(request, options2, manifest, state) {
fetch: null,
getClientAddress: state.getClientAddress || (() => {
throw new Error(
`${"@sveltejs/adapter-auto"} does not specify getClientAddress. Please raise an issue`
`${"@sveltejs/adapter-node"} does not specify getClientAddress. Please raise an issue`
);
}),
locals: {},

View File

@@ -10,7 +10,7 @@ return {
assets: new Set(["style/app.css","style/menu.css"]),
mimeTypes: {".css":"text/css"},
_: {
client: {"start":"_app/immutable/entry/start.Dk8EHlvX.js","app":"_app/immutable/entry/app.BB-guR1A.js","imports":["_app/immutable/entry/start.Dk8EHlvX.js","_app/immutable/chunks/entry.CWTQmo3s.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.BEtjop6e.js","_app/immutable/entry/app.BB-guR1A.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js"],"stylesheets":[],"fonts":[],"uses_env_dynamic_public":false},
client: {"start":"_app/immutable/entry/start.M9x8rur4.js","app":"_app/immutable/entry/app.CZjkDWD3.js","imports":["_app/immutable/entry/start.M9x8rur4.js","_app/immutable/chunks/entry.Dac4waFl.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.DXEl5lQ6.js","_app/immutable/entry/app.CZjkDWD3.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js"],"stylesheets":[],"fonts":[],"uses_env_dynamic_public":false},
nodes: [
__memo(() => import('./nodes/0.js')),
__memo(() => import('./nodes/1.js')),

View File

@@ -10,7 +10,7 @@ return {
assets: new Set(["style/app.css","style/menu.css"]),
mimeTypes: {".css":"text/css"},
_: {
client: {"start":"_app/immutable/entry/start.Dk8EHlvX.js","app":"_app/immutable/entry/app.BB-guR1A.js","imports":["_app/immutable/entry/start.Dk8EHlvX.js","_app/immutable/chunks/entry.CWTQmo3s.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.BEtjop6e.js","_app/immutable/entry/app.BB-guR1A.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js"],"stylesheets":[],"fonts":[],"uses_env_dynamic_public":false},
client: {"start":"_app/immutable/entry/start.M9x8rur4.js","app":"_app/immutable/entry/app.CZjkDWD3.js","imports":["_app/immutable/entry/start.M9x8rur4.js","_app/immutable/chunks/entry.Dac4waFl.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.DXEl5lQ6.js","_app/immutable/entry/app.CZjkDWD3.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js"],"stylesheets":[],"fonts":[],"uses_env_dynamic_public":false},
nodes: [
__memo(() => import('./nodes/0.js')),
__memo(() => import('./nodes/1.js')),

View File

@@ -3,6 +3,6 @@
export const index = 0;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/_layout.svelte.js')).default;
export const imports = ["_app/immutable/nodes/0.BLjvgh0X.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js"];
export const imports = ["_app/immutable/nodes/0.AnXNanYA.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js"];
export const stylesheets = [];
export const fonts = [];

View File

@@ -3,6 +3,6 @@
export const index = 1;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
export const imports = ["_app/immutable/nodes/1.DltsNqkt.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js","_app/immutable/chunks/entry.CWTQmo3s.js","_app/immutable/chunks/index.BEtjop6e.js"];
export const imports = ["_app/immutable/nodes/1.BUIZ54fc.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js","_app/immutable/chunks/entry.Dac4waFl.js","_app/immutable/chunks/index.DXEl5lQ6.js"];
export const stylesheets = [];
export const fonts = [];

View File

@@ -3,6 +3,6 @@
export const index = 2;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/2.B0UqQsDX.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js","_app/immutable/chunks/scoreStore.BJlEo5Dk.js","_app/immutable/chunks/index.BEtjop6e.js"];
export const imports = ["_app/immutable/nodes/2.CnoF6cHq.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js","_app/immutable/chunks/scoreStore.d37k1Evl.js","_app/immutable/chunks/index.DXEl5lQ6.js"];
export const stylesheets = ["_app/immutable/assets/2.DxlxdAfj.css"];
export const fonts = [];

View File

@@ -3,6 +3,6 @@
export const index = 3;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/about/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/3.vi6sie8m.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js"];
export const imports = ["_app/immutable/nodes/3.Cz998YEo.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js"];
export const stylesheets = [];
export const fonts = [];

View File

@@ -3,6 +3,6 @@
export const index = 4;
let component_cache;
export const component = async () => component_cache ??= (await import('../entries/pages/play/_page.svelte.js')).default;
export const imports = ["_app/immutable/nodes/4.69oG6wwC.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.t-3xYmlC.js","_app/immutable/chunks/index.Dz99_Qdh.js","_app/immutable/chunks/scoreStore.BJlEo5Dk.js","_app/immutable/chunks/index.BEtjop6e.js"];
export const stylesheets = ["_app/immutable/assets/4.T_78NcA1.css"];
export const imports = ["_app/immutable/nodes/4.DdPoLKDr.js","_app/immutable/chunks/preload-helper.C1FmrZbK.js","_app/immutable/chunks/scheduler.PSnnHpgA.js","_app/immutable/chunks/index.0641B4xi.js","_app/immutable/chunks/scoreStore.d37k1Evl.js","_app/immutable/chunks/index.DXEl5lQ6.js"];
export const stylesheets = ["_app/immutable/assets/4.DKtufWnM.css"];
export const fonts = [];

13
front/Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM node:latest
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
CMD ["npm", "run", "preview"]

184
front/package-lock.json generated
View File

@@ -8,11 +8,14 @@
"name": "unluckiest",
"version": "0.0.1",
"dependencies": {
"dotenv": "^16.4.5",
"express": "^4.21.1",
"jquery": "^3.7.1"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-node": "^5.2.6",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^9.6.0",
@@ -764,6 +767,126 @@
"dev": true,
"license": "MIT"
},
"node_modules/@rollup/plugin-commonjs": {
"version": "28.0.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.1.tgz",
"integrity": "sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/pluginutils": "^5.0.1",
"commondir": "^1.0.1",
"estree-walker": "^2.0.2",
"fdir": "^6.2.0",
"is-reference": "1.2.1",
"magic-string": "^0.30.3",
"picomatch": "^4.0.2"
},
"engines": {
"node": ">=16.0.0 || 14 >= 14.17"
},
"peerDependencies": {
"rollup": "^2.68.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/plugin-commonjs/node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true,
"license": "MIT"
},
"node_modules/@rollup/plugin-commonjs/node_modules/is-reference": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
"integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "*"
}
},
"node_modules/@rollup/plugin-json": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz",
"integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/pluginutils": "^5.1.0"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/plugin-node-resolve": {
"version": "15.3.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.0.tgz",
"integrity": "sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/pluginutils": "^5.0.1",
"@types/resolve": "1.20.2",
"deepmerge": "^4.2.2",
"is-module": "^1.0.0",
"resolve": "^1.22.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^2.78.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.3.tgz",
"integrity": "sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "^1.0.0",
"estree-walker": "^2.0.2",
"picomatch": "^4.0.2"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils/node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true,
"license": "MIT"
},
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.24.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz",
@@ -1001,6 +1124,32 @@
"@sveltejs/kit": "^2.0.0"
}
},
"node_modules/@sveltejs/adapter-node": {
"version": "5.2.8",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-5.2.8.tgz",
"integrity": "sha512-wll164mO8pX/0Ak6/64h0OzO4Id24PBmTla3zRlGEdbdQGkGb2WZPZOuvcWi6IEpwekA4RVFe58fjbkIV0Bslw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"rollup": "^4.9.5"
},
"peerDependencies": {
"@sveltejs/kit": "^2.4.0"
}
},
"node_modules/@sveltejs/adapter-static": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.5.tgz",
"integrity": "sha512-kFJR7RxeB6FBvrKZWAEzIALatgy11ISaaZbcPup8JdWUdrmmfUHHTJ738YHJTEfnCiiXi6aX8Q6ePY7tnSMD6Q==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"@sveltejs/kit": "^2.0.0"
}
},
"node_modules/@sveltejs/kit": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.6.4.tgz",
@@ -1107,6 +1256,13 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/resolve": {
"version": "1.20.2",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
"dev": true,
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.8.1.tgz",
@@ -1953,6 +2109,13 @@
"node": ">= 6"
}
},
"node_modules/commondir": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
"integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
"dev": true,
"license": "MIT"
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -2141,6 +2304,18 @@
"dev": true,
"license": "MIT"
},
"node_modules/dotenv": {
"version": "16.4.5",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/eastasianwidth": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
@@ -3159,6 +3334,13 @@
"node": ">=0.10.0"
}
},
"node_modules/is-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz",
"integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==",
"dev": true,
"license": "MIT"
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
@@ -3806,8 +3988,6 @@
"integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"engines": {
"node": ">=12"
},

View File

@@ -12,8 +12,17 @@
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"dependencies": {
"dotenv": "^16.4.5",
"express": "^4.21.1",
"jquery": "^3.7.1"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-node": "^5.2.6",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^9.6.0",
@@ -33,9 +42,7 @@
"vite": "^5.0.3",
"vitest": "^2.0.0"
},
"type": "module",
"dependencies": {
"express": "^4.21.1",
"jquery": "^3.7.1"
}
"type": "module"
}

View File

@@ -6,6 +6,10 @@
<ul class="leaderboard">
{#if scores.length === 0}
No scores for now...
{/if}
{#each scores as score, i}
<li class="item">
<div class="name"><img src="" alt=""/> {score.owner} </div><div class="score"> {score.value} pts.</div>

View File

@@ -1,8 +1,10 @@
import {scoreStore} from "./scoreStore";
import {Score} from "../models/score";
const api_url = import.meta.env.VITE_API_URL
export async function submitScore(owner: string, value : number){
return await handleRequest("http://localhost:8080/api/submit/",
return await handleRequest(`${api_url}/submit/`,
{
method:"POST",
body : JSON.stringify({owner:owner, value:value}),
@@ -11,7 +13,7 @@ export async function submitScore(owner: string, value : number){
}
export async function getLeaderboard(){
return await handleRequest("http://localhost:8080/api/leaderboard",
return await handleRequest(`${api_url}/leaderboard/`,
{ method:"GET" });
}

View File

@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
@@ -8,10 +8,9 @@ const config = {
preprocess: vitePreprocess(),
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
adapter : adapter({
outDir : "./build"
})
}
};

View File

@@ -2,6 +2,14 @@ import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
export default defineConfig({
server: {
host: '0.0.0.0',
port: 3000,
},
preview: {
host: '0.0.0.0',
port: 3000, // Change this to your desired port
},
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']

5
nginx/Dockerfile Normal file
View File

@@ -0,0 +1,5 @@
FROM nginx:alpine
COPY unluckiest_443 /etc/nginx/conf.d/default.conf
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -0,0 +1,16 @@
server {
listen 80;
server_name unluckiest.naaturel.be www.unluckiest.naaturel.be;
location / {
proxy_pass http://webapp:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}

37
nginx/unluckiest_443 Normal file
View File

@@ -0,0 +1,37 @@
server {
listen 80;
server_name unluckiest.naaturel.be www.unluckiest.naaturel.be;
# Redirect all HTTP requests to HTTPS
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name unluckiest.naaturel.be www.unluckiest.naaturel.be;
ssl_certificate /etc/ssl/certs/fullchain.pem;
ssl_certificate_key /etc/ssl/certs/privkey.pem;
location / {
proxy_pass http://webapp:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api/ {
if ($request_uri ~ ^(.+)/$) {
return 301 $1;
}
proxy_pass http://api:5000/api/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

26
nginx/unluckiest_80 Normal file
View File

@@ -0,0 +1,26 @@
server {
listen 80;
server_name unluckiest.naaturel.be www.unluckiest.naaturel.be;
location / {
proxy_pass http://webapp:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api/ {
if ($request_uri ~ ^(.+)/$) {
return 301 $1;
}
proxy_pass http://api:5000/api/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}