From 88df88204c982caf7b011d240ee65b1430a0a9bb Mon Sep 17 00:00:00 2001 From: Arinerron Date: Sun, 29 Jul 2018 17:43:28 -0700 Subject: [PATCH] Add files --- Makefile | 1 + onionr/api.py | 2 +- onionr/static-data/ui/common/footer.html | 4 + onionr/static-data/ui/common/header.html | 30 ++++ .../ui/common/onionr-timeline-post.html | 31 ++++ onionr/static-data/ui/compile.py | 123 +++++++++++++ onionr/static-data/ui/config.json | 4 + onionr/static-data/ui/dist/css/main.css | 74 ++++++++ .../static-data/ui/dist/css/themes/dark.css | 32 ++++ onionr/static-data/ui/dist/img/default.png | Bin 0 -> 6758 bytes onionr/static-data/ui/dist/index.html | 77 ++++++++ onionr/static-data/ui/dist/js/main.js | 170 ++++++++++++++++++ onionr/static-data/ui/dist/js/timeline.js | 20 +++ onionr/static-data/ui/lang.json | 31 ++++ onionr/static-data/ui/src/css/main.css | 74 ++++++++ onionr/static-data/ui/src/css/themes/dark.css | 32 ++++ onionr/static-data/ui/src/img/default.png | Bin 0 -> 6758 bytes onionr/static-data/ui/src/index.html | 43 +++++ onionr/static-data/ui/src/js/main.js | 167 +++++++++++++++++ onionr/static-data/ui/src/js/timeline.js | 20 +++ 20 files changed, 934 insertions(+), 1 deletion(-) create mode 100644 onionr/static-data/ui/common/footer.html create mode 100644 onionr/static-data/ui/common/header.html create mode 100644 onionr/static-data/ui/common/onionr-timeline-post.html create mode 100755 onionr/static-data/ui/compile.py create mode 100644 onionr/static-data/ui/config.json create mode 100644 onionr/static-data/ui/dist/css/main.css create mode 100644 onionr/static-data/ui/dist/css/themes/dark.css create mode 100644 onionr/static-data/ui/dist/img/default.png create mode 100644 onionr/static-data/ui/dist/index.html create mode 100644 onionr/static-data/ui/dist/js/main.js create mode 100644 onionr/static-data/ui/dist/js/timeline.js create mode 100644 onionr/static-data/ui/lang.json create mode 100644 onionr/static-data/ui/src/css/main.css create mode 100644 onionr/static-data/ui/src/css/themes/dark.css create mode 100644 onionr/static-data/ui/src/img/default.png create mode 100644 onionr/static-data/ui/src/index.html create mode 100644 onionr/static-data/ui/src/js/main.js create mode 100644 onionr/static-data/ui/src/js/timeline.js diff --git a/Makefile b/Makefile index 472ffc2d..c51fc72b 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ setup: sudo pip3 install -r requirements.txt + -@cd onionr/static-data/ui/; ./compile.py install: sudo rm -rf /usr/share/onionr/ diff --git a/onionr/api.py b/onionr/api.py index 256f55f9..705a4781 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -129,7 +129,7 @@ class API: if not hmac.compare_digest(timingToken, self.timeBypassToken): if elapsed < self._privateDelayTime: time.sleep(self._privateDelayTime - elapsed) - return send_from_directory('static-data/ui/', path) + return send_from_directory('static-data/ui/dist/', path) @app.route('/client/') def private_handler(): diff --git a/onionr/static-data/ui/common/footer.html b/onionr/static-data/ui/common/footer.html new file mode 100644 index 00000000..6b5cfb06 --- /dev/null +++ b/onionr/static-data/ui/common/footer.html @@ -0,0 +1,4 @@ + + + + diff --git a/onionr/static-data/ui/common/header.html b/onionr/static-data/ui/common/header.html new file mode 100644 index 00000000..2a2b4f56 --- /dev/null +++ b/onionr/static-data/ui/common/header.html @@ -0,0 +1,30 @@ +<$= LANG.ONIONR_TITLE $> + + + + + + + + + + diff --git a/onionr/static-data/ui/common/onionr-timeline-post.html b/onionr/static-data/ui/common/onionr-timeline-post.html new file mode 100644 index 00000000..ceff5c65 --- /dev/null +++ b/onionr/static-data/ui/common/onionr-timeline-post.html @@ -0,0 +1,31 @@ + +
+
+
+
+ +
+
+
+ +
+ +
+
+ +
+ $content +
+ +
+ like + comment +
+
+
+
+
+ diff --git a/onionr/static-data/ui/compile.py b/onionr/static-data/ui/compile.py new file mode 100755 index 00000000..c93e4aa7 --- /dev/null +++ b/onionr/static-data/ui/compile.py @@ -0,0 +1,123 @@ +#!/usr/bin/python3 + +import shutil, os, re, json, traceback + +# get user's config +settings = {} +with open('config.json', 'r') as file: + settings = json.loads(file.read()) + +# "hardcoded" config, not for user to mess with +HEADER_FILE = 'common/header.html' +FOOTER_FILE = 'common/footer.html' +SRC_DIR = 'src/' +DST_DIR = 'dist/' +HEADER_STRING = '
' +FOOTER_STRING = '