From 6c668aa6e0d3706ef7cd714b1242e743f2b7eb9b Mon Sep 17 00:00:00 2001 From: Zakaria aourzag <29924334+zaourzag@users.noreply.github.com> Date: Thu, 18 Mar 2021 23:36:17 +0100 Subject: [PATCH 01/13] Update server.py --- server.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 2b0ddc6..85a1ec6 100644 --- a/server.py +++ b/server.py @@ -4,10 +4,11 @@ import secrets import traceback from os.path import splitext +from werkzeug.utils import secure_filename import pymongo from PIL import Image -from flask import Flask, request, json, jsonify, render_template, session, redirect +from flask import Flask, request, json, jsonify, render_template, session, redirect, send_from_directory from flask_session import Session from pymongo import MongoClient @@ -86,6 +87,12 @@ def create_new_user(uid: int, name: str): def datefromunix(s): return datetime.datetime.fromtimestamp(int(s) / 1000).strftime("%Y-%m-%d %H:%M") +@app.route('/favicon.ico') +def favicon(): + return send_from_directory(os.path.join(app.root_path, 'static'), + 'favicon.ico', mimetype='image/vnd.microsoft.icon') + + @app.route('/') def index(): @@ -121,7 +128,11 @@ def my_portal(): activity = _db.images.find({"user_uid": session.get("logged_in")}).sort('created', pymongo.DESCENDING).limit(5) activity = [x for x in activity] return render_template("my_portal.html", domains=allowed_domains, total=total, images=activity) - +@app.route('/i/') +def return_pic(filename): + """ Show just the image specified. + """ + return send_from_directory( _config['storage_dir'], secure_filename(filename)) @app.route('/my/files', methods=['GET', 'POST']) def my_files(): From 350e63d620866e1f4643dd1377202de6d37a4001 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag <29924334+zaourzag@users.noreply.github.com> Date: Thu, 18 Mar 2021 23:37:07 +0100 Subject: [PATCH 02/13] Create temp --- static/temp | 1 + 1 file changed, 1 insertion(+) create mode 100644 static/temp diff --git a/static/temp b/static/temp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/static/temp @@ -0,0 +1 @@ + From 71ee08013659befc786ab635295343a4c5a812e0 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag <29924334+zaourzag@users.noreply.github.com> Date: Thu, 18 Mar 2021 23:37:43 +0100 Subject: [PATCH 03/13] add favicon --- static/favicon.ico | Bin 0 -> 102868 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 static/favicon.ico diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..0dec7f18144364d2410cf2e80f3cd790b6d7528d GIT binary patch literal 102868 zcmeHQ30zdw_kSY{%m6Y2vw;6hNHooUh32oHd*D{7C2B5}3Tke-A}%nZg7s6}z|?Rl zcT;gmTYmn`1jQv$RH$F2sii0&ZYcsT$iV#1c{6uBJRD#Y5tuih&v)**Gwrg19iArPln`QiBkehEOtgfX+oStiwVnRY36ieeo;Qxjpgnz8i_IH>bX^t83@}4Y&77Y|?mbkW;wwR#-jA|52YSqxGYLxP$X*_x!j}6R>M*d=J<4O?-Fk z&3SWrQBKtFMfTahciuW(!flPJ#kp+YxI>M(#HLPM(*>sJkl*)lBX1vw@>-vB#OsZ3 zyJxn~&G>a_y(_sMU&MSi(c$@pt0K0voiXJ?(EiyA*yN&3+g6WzPuKL)_PI@V4m~t*P0;4tO9kgH^v&P5^w`wyYd;^+eeJv- z>>kMtGIyDq`oZ=Y+3T8&|6*6*&fFFOtJdapJwHK`8GQQIThHryW##W56VWa6`J1g~ z?w=Lz*rU{>I?UVrWk&0W^zFN1CKtUFvTFaI8(ZA;-It#+CAQI9C)<9I8QZI8JwLvD&t~;KKxwX%EYZNosj3%zgbddOoXktsIbEJQCs3~U#kttA4?y0 zGi>$#iGTg6&3_OPe>Xf<5vV`#X6&+gQx8S@E_3;EUC!a#9x=W16T2-vzbV9T(}jql zgt6hh&wo2=>qp(a?=6Zl%x_a%J1i$q*8Ew1oeWy9u%j27jE|pM=n(68sL`tRIb9b9 zj<_`{=>ETxC${PDv8C!(AoaB+7mNWUA!wuhAWQpAUQY-1kisF{>Ki z`(4rXfxeyZg$p}!Zv1yxi>p3i1DoVsf9=P^cT$~NN@Eva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VtFR^yT&W7XHx=i~} zY!Ax3{{&~hu`}P;S#LbAAb;F%vb5L4_Lq1bOlOu+9@u^o+e>2mNTux|v9rc-ykz@D zwA?}(*3bB}vltKTtSoj$7S>O;m%{c@9<_(U&b(rK4{YB-nBSw~Y;T0;!E{y=JEMu6 z&BV@R!gY9I{%r5#aq?#Turq^Ld&EAK?FZmB>`WlcpY8#$vwxl>Z!-_3b$zy`PuBA} zb|wwxPuB4H^JiGzY~7xv_c$T0YqK?Nww?{?@N3y@9iFXWo7b*I#iB(^5K5@;h5kqB9J9H$u!_>sOK;!QugKopxSSCwF?yO|nwU1`!8`>G z1_Q2B;If1_z`RZY%C+VL>j09+^`(MmX&L&|pf3$PXO(HkNBM&5<>*_1J{9Oofj$)Q zf4S1&?*$usw5>;*dbFiS8+x>NE-MXqK9HlWHQHFCZ8hTwY`}fccDl4Q@LsgJg?rP{ z#+KcSA==QQ-2mFmqOC0aRIDs$CxZLAcrV&o(tFXC675vbb`otS(N+>|B&lsA+Tfw> z9opO#yBBQg&@KvX=+Jf!ZRXHc4(DuW8^>(o&;|=_uS_;qd=h9|h4-Q@71~gt{S@v| zqpcL~6`^euvx!0*9JIYbn;W#XK^q(78EtCNmWJ_!HZy1|gElfk+ZeRHK${D+wLn>+ zZ3XTrqb&&DkG2!I|Bbd1mTV+ozuf`%+HsE^_tueL+)Kwjbkn^%E#1p_#JyJBW5vBy z+*8H9RNOmUnc^NB?yd2AY9K4zL$h}84EI)WPX+f Date: Thu, 18 Mar 2021 23:38:34 +0100 Subject: [PATCH 04/13] Delete temp --- static/temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 static/temp diff --git a/static/temp b/static/temp deleted file mode 100644 index 8b13789..0000000 --- a/static/temp +++ /dev/null @@ -1 +0,0 @@ - From 83c3a34b060b66e7d58325c6fb05a4fe0451c5ae Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Thu, 18 Mar 2021 23:13:22 +0000 Subject: [PATCH 05/13] Fully automate dev setup with Gitpod This commit implements a fully-automated development setup using Gitpod.io, an online IDE for GitLab, GitHub, and Bitbucket that enables Dev-Environments-As-Code. This makes it easy for anyone to get a ready-to-code workspace for any branch, issue or pull request almost instantly with a single click. --- .gitpod.Dockerfile | 13 +++++++++++++ .gitpod.yml | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 .gitpod.Dockerfile create mode 100644 .gitpod.yml diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 0000000..e6abd29 --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,13 @@ +FROM gitpod/workspace-full + +# Install Redis. +RUN sudo apt-get update \ + && sudo apt-get install -y \ + redis-server mongodb \ + && sudo rm -rf /var/lib/apt/lists/* + +# Install custom tools, runtimes, etc. +# For example "bastet", a command-line tetris clone: +# RUN brew install bastet +# +# More information: https://www.gitpod.io/docs/config-docker/ diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..44bd2e7 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,5 @@ +image: + file: .gitpod.Dockerfile + +tasks: + - init: pip install -r ./requirements.txt From 9133a402c63a527d81e3aab60cf1f6f1caa3fcd2 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Thu, 18 Mar 2021 23:18:30 +0000 Subject: [PATCH 06/13] updaye this --- requirements.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 63dc48b..8f02109 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,11 @@ flask +flask-session +redis Pillow pycrypto asn1crypto==0.24.0 certifi==2018.4.16 -cffi==1.11.5 + chardet==3.0.4 ConfigArgParse==0.13.0 configobj==5.0.6 From 4c3c2547ae996a81ace80b9cab3f8ad9dcc55920 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Thu, 18 Mar 2021 23:28:05 +0000 Subject: [PATCH 07/13] again? really? --- .gitpod.Dockerfile | 4 +++- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index e6abd29..012d39c 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,7 +5,9 @@ RUN sudo apt-get update \ && sudo apt-get install -y \ redis-server mongodb \ && sudo rm -rf /var/lib/apt/lists/* - +ports: + - port: 80 + - port: 443 # Install custom tools, runtimes, etc. # For example "bastet", a command-line tetris clone: # RUN brew install bastet diff --git a/requirements.txt b/requirements.txt index 8f02109..c5216da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ Pillow pycrypto asn1crypto==0.24.0 certifi==2018.4.16 - +dnspython chardet==3.0.4 ConfigArgParse==0.13.0 configobj==5.0.6 From 4b24febd60478070a7786986f6f443354ff92067 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Fri, 19 Mar 2021 00:34:07 +0100 Subject: [PATCH 08/13] Update .gitpod.Dockerfile --- .gitpod.Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 012d39c..ced6496 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -8,6 +8,8 @@ RUN sudo apt-get update \ ports: - port: 80 - port: 443 + + # Install custom tools, runtimes, etc. # For example "bastet", a command-line tetris clone: # RUN brew install bastet From 95079a7de765facf049ccd5d92e6a42cd6c1bc51 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Fri, 19 Mar 2021 00:35:30 +0100 Subject: [PATCH 09/13] Update .gitpod.Dockerfile --- .gitpod.Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index ced6496..0a73ce0 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,9 +5,9 @@ RUN sudo apt-get update \ && sudo apt-get install -y \ redis-server mongodb \ && sudo rm -rf /var/lib/apt/lists/* -ports: - - port: 80 - - port: 443 + ports: + - 443:443 + - 80:80 # Install custom tools, runtimes, etc. From f98a896bbcf715a1fb7e85e6771fabe18f92e074 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Fri, 19 Mar 2021 00:37:59 +0100 Subject: [PATCH 10/13] Update .gitpod.Dockerfile --- .gitpod.Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 0a73ce0..5a44b5c 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -5,11 +5,8 @@ RUN sudo apt-get update \ && sudo apt-get install -y \ redis-server mongodb \ && sudo rm -rf /var/lib/apt/lists/* - ports: - - 443:443 - - 80:80 - - + EXPOSE 80 + EXPOSE 443 # Install custom tools, runtimes, etc. # For example "bastet", a command-line tetris clone: # RUN brew install bastet From 18494a30c760b2e2a135d624798da1aea8850306 Mon Sep 17 00:00:00 2001 From: Zakaria aourzag Date: Sat, 20 Mar 2021 20:50:01 +0100 Subject: [PATCH 11/13] fixing get authorization key so that it actullly works now the add-user endpoint didnt work and it had a different get methodd then other so i tested it with the other and it works; pushing to repo now --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index 85a1ec6..89fabe1 100644 --- a/server.py +++ b/server.py @@ -245,7 +245,7 @@ def upload(): @app.route('/add-user', methods=['POST']) def add_user(): - token = request.headers.get("Authorization", "unknown") + token = request.form['Authorization'] if token != secret_key: return "Not authorized", 403 if request.method == 'POST': From dd149c1ecb30807023c2962adfecf9431635d049 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 21 Mar 2021 01:09:58 +0100 Subject: [PATCH 12/13] make a dutch lang implements it just so it works :) --- templates/nl/home.html | 64 +++++++++ templates/nl/login.html | 53 ++++++++ templates/nl/my_config.html | 96 ++++++++++++++ templates/nl/my_files.html | 257 ++++++++++++++++++++++++++++++++++++ templates/nl/my_portal.html | 61 +++++++++ 5 files changed, 531 insertions(+) create mode 100644 templates/nl/home.html create mode 100644 templates/nl/login.html create mode 100644 templates/nl/my_config.html create mode 100644 templates/nl/my_files.html create mode 100644 templates/nl/my_portal.html diff --git a/templates/nl/home.html b/templates/nl/home.html new file mode 100644 index 0000000..84ac8be --- /dev/null +++ b/templates/nl/home.html @@ -0,0 +1,64 @@ + + + + + + ksoft.si :: Foto host + + + + + + + +
+

ksoft.si - Image host

+

Je persoonlijke geen bullshit foto host.

+
+ Mijn account + geef mijn config +
+
+

List van domeinen:

+

+ {% for d in domains %} + {{ d }}
+ {% endfor %} +

+
+ Don't email us about account creation.| . + +

+ english? + +
+
+ +
+ + diff --git a/templates/nl/login.html b/templates/nl/login.html new file mode 100644 index 0000000..2c0c9be --- /dev/null +++ b/templates/nl/login.html @@ -0,0 +1,53 @@ + + + + + + Ksoft.Si :: Login + + + + + + +
+

Login

+ {% if is_error %} +

Wrong username or password.

+ {% endif %} +
+
+ + + +
+
+ Don't email us about account creation. | support@ksoft.si. + + +
+ + diff --git a/templates/nl/my_config.html b/templates/nl/my_config.html new file mode 100644 index 0000000..391b76f --- /dev/null +++ b/templates/nl/my_config.html @@ -0,0 +1,96 @@ + + + + + + Ksoft.Si :: Sharex Config + + + + + + +
+

Jouw config:

+ + +
+
+ Back +
+
+ +
+
+
{
+  "Name": "ksoft-sharex",
+  "DestinationType": "ImageUploader",
+  "RequestURL": "https://i.ksoft.si/upload",
+  "FileFormName": "image",
+  "Headers": {
+    "Authorization": "{{ token }}"
+  },
+  "URL": "https://i.ksoft.si/i/$json:filename$$json:extension$"
+}
+
+ + + + + diff --git a/templates/nl/my_files.html b/templates/nl/my_files.html new file mode 100644 index 0000000..b3d5b8f --- /dev/null +++ b/templates/nl/my_files.html @@ -0,0 +1,257 @@ + + + + + + Ksoft.Si :: Mijn bestanden + + + + + + + + + +
+

Your files:

+
+ +
+ + + +
+
+
+
+
+ +
+
{{ page }}
+
+
+ next page +
+
+
+ + + + + + + + + + {% for i in images %} + + + + + + {% else %} + + + + {% endfor %} + +
naamgecreeerdActies
+ {{ i.name }}{{ i.extension }}{{ i.created | getdate }} +
+ + + +
+
je hebt nog geen bestanden :(.
+
+ + + + + + diff --git a/templates/nl/my_portal.html b/templates/nl/my_portal.html new file mode 100644 index 0000000..ac3195f --- /dev/null +++ b/templates/nl/my_portal.html @@ -0,0 +1,61 @@ + + + + + + Ksoft.Si :: mijn account + + + + + + + +
+

Mijn Account

+

Je persoonlijke geen bullshit foto host.

+
+ Mijn config + Mijn bestanden +
+
+

Activiteit:

+

Totaal aantal bestanden: {{ total }}

+ + {% for f in images %} + + {% else %} + + {% endfor %} +
{{ f.name }}{{ f.extension }}
geen recente activiteit.
+
+ Ksoft.Si team © 2021 | Discord: NANI#0001 + +
+ + From bf3ca6cdbbf2f3bf14373d2e43ce76fd27f27627 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 21 Mar 2021 01:12:25 +0100 Subject: [PATCH 13/13] also for durch lang --- server.py | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index 89fabe1..9dc4143 100644 --- a/server.py +++ b/server.py @@ -1,10 +1,5 @@ -import datetime -import hashlib -import os -import secrets -import traceback -from os.path import splitext -from werkzeug.utils import secure_filename +import datetime import hashlib import os import secrets import traceback from os.path import splitext from +werkzeug.utils import secure_filename import pymongo from PIL import Image @@ -204,6 +199,96 @@ def print_stats(): "files": _db.images.count(), "domains": len(allowed_domains) }) +@app.route('/nl/') +def index-nl(): + return render_template("home.html", domains=allowed_domains) + + +@app.route('/nl/login', methods=['GET', 'POST']) +def login-nl(): + if request.method == "POST": + usr = check_user(request.form.get("username", "unknown"), request.form.get("password", "unknown")) + if usr is None: + return render_template('login.html', is_error=True) + next_url = request.args.get("next", "/") + if session.get("logged_in"): + return redirect(next_url) + session['logged_in'] = usr.uid + return redirect(next_url) + + else: + return render_template('nl/login.html', is_error=False) + + +@app.route('/nl/my/ip', methods=['GET']) +def my_ip-nl(): + return jsonify({"ip": get_client_ip()}) + + +@app.route('/nl/my', methods=['GET']) +def my_portal-nl(): + if session.get("logged_in", None) is None: + return redirect("/login?next=/nl/my") + total = _db.images.find({"user_uid": session.get("logged_in")}).count() + activity = _db.images.find({"user_uid": session.get("logged_in")}).sort('created', pymongo.DESCENDING).limit(5) + activity = [x for x in activity] + return render_template("nl/my_portal.html", domains=allowed_domains, total=total, images=activity) + + +@app.route('/nl/my/files', methods=['GET', 'POST']) +def my_files-nl(): + if session.get("logged_in", None) is None: + return redirect("/nl/login?next=/nl/my/files") + + if request.method == "POST": + action = request.form.get("action") + if action == "delete_all": + total = _db.images.find({"user_uid": session.get("logged_in")}) + for image in total: + fpath = "{}/{}{}".format(storage_folder, image['name'], image['extension']) + if os.path.exists(fpath): + os.remove(fpath) + else: + print("This file does not exist:", fpath) + _db.images.delete_many({"user_uid": session.get("logged_in")}) + elif action == "delete_one": + name = request.form.get("name") + image = _db.images.find_one({"user_uid": session.get("logged_in"), "name": name}) + if image: + fpath = "{}/{}{}".format(storage_folder, image['name'], image['extension']) + if os.path.exists(fpath): + os.remove(fpath) + else: + print("This file does not exist:", fpath) + return jsonify({"success": False}) + _db.images.delete_one({"user_uid": session.get("logged_in"), "name": image['name']}) + return jsonify({"success": True}) + + def get_page(page_size, page_num): + skips = page_size * (page_num - 1) + cursor = _db.images.find({"user_uid": session.get("logged_in")}) \ + .skip(skips) \ + .limit(page_size) \ + .sort('created', pymongo.DESCENDING) + return [x for x in cursor] + + page = int(request.args.get("page", 1)) + images = get_page(50, page) + next_page = bool(get_page(50, page + 1)) + next_page_num = page + 1 + prev_page = page != 1 + prev_page_num = page - 1 + + return render_template("nl/my_files.html", images=images, page=page, next_page=next_page, prev_page=prev_page, + next_page_num=next_page_num, prev_page_num=prev_page_num) + + +@app.route('/nl/my/config', methods=['GET']) +def my_config-nl(): + if session.get("logged_in", None) is None: + return redirect("/nl/login?next=/nl/my/config") + usr = _db.users.find_one({"uid": session.get("logged_in")}) + return render_template("nl/my_config.html", **{"domains": allowed_domains, "token": usr['token']}) @app.route('/upload', methods=['POST'])