From fdcba863c21ad4c32354e3aeae312c2e9b111af4 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Fri, 4 Aug 2023 15:48:48 +0300 Subject: [PATCH] incomplete --- .editorconfig | 4 ++ .prettierignore | 1 + app/assets/js/app.js | 24 +++++++- public/js/rev2.js | 3 + public/pages/rer2.html | 107 +++++++++++++++++++++-------------- server/.gitignore | 3 + server/README.md | 0 server/shard.lock | 22 +++++++ server/shard.yml | 24 ++++++++ server/src/api.cr | 11 ++++ server/src/layouts/index.ecr | 13 +++++ server/src/modules/_api.cr | 16 ++++++ server/src/modules/rev2.cr | 54 ++++++++++++++++++ 13 files changed, 239 insertions(+), 43 deletions(-) create mode 100644 public/js/rev2.js create mode 100644 server/.gitignore create mode 100644 server/README.md create mode 100644 server/shard.lock create mode 100644 server/shard.yml create mode 100644 server/src/api.cr create mode 100644 server/src/layouts/index.ecr create mode 100644 server/src/modules/_api.cr create mode 100644 server/src/modules/rev2.cr diff --git a/.editorconfig b/.editorconfig index a4d49ba..a76a182 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,6 +20,10 @@ indent_size = 4 indent_style = space indent_size = 2 +[{*.cr,shard.yml}] +indent_style = space +indent_size = 2 + [humans.txt] indent_style = tab indent_size = 2 diff --git a/.prettierignore b/.prettierignore index 2b455a4..0642887 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,3 +3,4 @@ app/assets/css/bootstrap* app/assets/js/bootstrap* package.json package-lock.json +server/ diff --git a/app/assets/js/app.js b/app/assets/js/app.js index c0c8bac..855731f 100644 --- a/app/assets/js/app.js +++ b/app/assets/js/app.js @@ -1,8 +1,12 @@ import { routes } from './routes.js'; -let DEBUG = false; +let DEBUG = true; window.DEBUG = DEBUG; +let SERVER_URL; +if (DEBUG) SERVER_HOST = 'localhost'; +else SERVER_HOST = 'a2s.su'; + /* main */ window.onload = function () { let app = document.documentElement; @@ -69,3 +73,21 @@ const location_handler = async () => { document.querySelector('#autorun').innerHTML = ''; } }; + +function get_from_api(callback, api_method = '', params = {}) { + respone = ''; + + if (api_method == '') { + console.log('wrong method'); + } else { + fetch(`http://${SERVER_HOST}:3000/api/v1.0/${api_method}`) + .then((response) => { + return response.json(); + }) + .then((data) => { + callback(data); + }) + .catch((err) => console.warn('Something went wrong.', err)); + } +} +window.get_from_api = get_from_api; diff --git a/public/js/rev2.js b/public/js/rev2.js new file mode 100644 index 0000000..5c90553 --- /dev/null +++ b/public/js/rev2.js @@ -0,0 +1,3 @@ +export function update_rev2(data) { + let time_remaining = document.getElementById('rev2_time_remaining') +} diff --git a/public/pages/rer2.html b/public/pages/rer2.html index 10408a1..70db8f8 100644 --- a/public/pages/rer2.html +++ b/public/pages/rer2.html @@ -14,26 +14,31 @@ «Вторжение огромных тварей» - -

- Изображение: - - Resident Evil Revelations 2 — Wallpaper by BrendaBirkin - -

+
+ +

+ Изображение: + + Resident Evil Revelations 2 — Wallpaper by BrendaBirkin + +

+
-
+
Invasion of the Huge Creatures No. 101 - Осталось времени: 656:49 +
@@ -56,31 +61,34 @@ /> -

- Aello - [100 00 000 / 999 999 999] -

-
-
21%
-
-

- Ocypete - [100 00 000 / 999 999 999] -

-
-
91%
+ +
+

+ Aello + [? / ?] +

+
+
21%
+
+

+ Ocypete + [? / ?] +

+
+
91%
+