BinaryONe
commited on
Commit
·
1f8085b
1
Parent(s):
a37547c
InitialCommit
Browse files- Dockerfile +38 -0
- FlaskWebApp/APIServices/__init__.py +1 -0
- FlaskWebApp/APIServices/config.py +12 -0
- FlaskWebApp/APIServices/controller.py +72 -0
- FlaskWebApp/Abc.txt +164 -0
- FlaskWebApp/App/__init__.py +1 -0
- FlaskWebApp/App/controller.py +18 -0
- FlaskWebApp/Authentication/__init__.py +1 -0
- FlaskWebApp/Authentication/controller.py +31 -0
- FlaskWebApp/Config.py +6 -0
- FlaskWebApp/FileHandler/__init__.py +1 -0
- FlaskWebApp/FileHandler/controller.py +36 -0
- FlaskWebApp/SMSService.py +27 -0
- FlaskWebApp/__init__.py +0 -0
- FlaskWebApp/__main__.py +28 -0
- FlaskWebApp/css.txt +53 -0
- FlaskWebApp/templates/index.html +1 -0
- nginx.conf +55 -0
- resources.tar +3 -0
- start_pyapps_multirun.sh +12 -0
Dockerfile
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM alpine:latest
|
2 |
+
|
3 |
+
RUN addgroup -S nginx_admin && adduser -S app_user -G nginx_admin
|
4 |
+
#RUN adduser -D -g 'app_user' nginx_admin
|
5 |
+
|
6 |
+
WORKDIR /app
|
7 |
+
|
8 |
+
|
9 |
+
# Install necessary packages
|
10 |
+
RUN apk update && \
|
11 |
+
apk upgrade && \
|
12 |
+
apk add --no-cache openrc bash su-exec python3 py3-pip net-tools udev nginx
|
13 |
+
|
14 |
+
# Copy Flask application
|
15 |
+
COPY ./FlaskWebApp /app/FlaskWebApp
|
16 |
+
COPY ./requirements.txt /app/requirements.txt
|
17 |
+
COPY ./start_pyapps_multirun.sh /app/start_pyapps_multirun.sh
|
18 |
+
|
19 |
+
# Copy Angular build files to Nginx web directory
|
20 |
+
ADD ./resources.tar /var/www/portfolio
|
21 |
+
|
22 |
+
# Backup original nginx.conf and copy new one
|
23 |
+
#RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
|
24 |
+
COPY ./nginx.conf /etc/nginx/nginx.conf
|
25 |
+
COPY ./default.conf /etc/nginx/conf.d/default.conf
|
26 |
+
|
27 |
+
# Python virtual environment
|
28 |
+
RUN python3 -m venv /app/PyEnv && \
|
29 |
+
/app/PyEnv/bin/pip install --upgrade pip && \
|
30 |
+
/app/PyEnv/bin/pip install -r /app/requirements.txt && \
|
31 |
+
chmod -R +x /app
|
32 |
+
|
33 |
+
RUN mkdir -p /var/log/nginx /run/nginx && \
|
34 |
+
chown -R app_user:nginx_admin /var/lib/nginx /var/log/nginx /app
|
35 |
+
|
36 |
+
USER app_user
|
37 |
+
|
38 |
+
CMD ["sh","-c","/app/start_pyapps_multirun.sh"]
|
FlaskWebApp/APIServices/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .controller import pwa_api
|
FlaskWebApp/APIServices/config.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
smtp.gmail.com
|
3 |
+
|
4 |
+
Requires SSL: Yes
|
5 |
+
|
6 |
+
Requires TLS: Yes (if available)
|
7 |
+
|
8 |
+
Requires Authentication: Yes
|
9 |
+
|
10 |
+
Port for SSL: 465
|
11 |
+
|
12 |
+
Port for TLS/STARTTLS: 587
|
FlaskWebApp/APIServices/controller.py
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import smtplib
|
2 |
+
|
3 |
+
from string import Template
|
4 |
+
|
5 |
+
from email.mime.multipart import MIMEMultipart
|
6 |
+
from email.mime.text import MIMEText
|
7 |
+
|
8 |
+
|
9 |
+
import requests, urllib
|
10 |
+
import json
|
11 |
+
from flask import Blueprint, request, Response, redirect, url_for, jsonify, render_template
|
12 |
+
|
13 |
+
from werkzeug.security import generate_password_hash
|
14 |
+
|
15 |
+
from FlaskWebApp.SMSService import Send_Sms
|
16 |
+
from FlaskWebApp.Config import EMAIL,EMAIL_PASSWORD
|
17 |
+
|
18 |
+
pwa_api = Blueprint('pwa_api',
|
19 |
+
__name__,
|
20 |
+
static_folder='./static',
|
21 |
+
template_folder='./templates')
|
22 |
+
|
23 |
+
|
24 |
+
@pwa_api.route('/', methods=['GET'])
|
25 |
+
def API_Home():
|
26 |
+
return "Working"
|
27 |
+
|
28 |
+
|
29 |
+
@pwa_api.route('/search', methods=['GET'])
|
30 |
+
def API_login():
|
31 |
+
return "500"
|
32 |
+
|
33 |
+
|
34 |
+
@pwa_api.route('/sendmsg', methods=['POST'])
|
35 |
+
def API_SndMSG():
|
36 |
+
if request.method == 'POST':
|
37 |
+
number = request.form.get('mobile')
|
38 |
+
message = request.form.get('message')
|
39 |
+
server = smtplib.SMTP('smtp.gmail.com', 587)
|
40 |
+
server.ehlo()
|
41 |
+
server.starttls()
|
42 |
+
# Authentication
|
43 |
+
server.login(EMAIL, EMAIL_PASSWORD)
|
44 |
+
print("login Successfully ")
|
45 |
+
|
46 |
+
message_body= f"""
|
47 |
+
<html>
|
48 |
+
<body>
|
49 |
+
<h4>Hey {number}</h4>
|
50 |
+
<p>{message}</p>
|
51 |
+
<br>
|
52 |
+
Thanks & Regards,
|
53 |
+
<br>
|
54 |
+
The BinaryOne
|
55 |
+
</body>
|
56 |
+
</html>
|
57 |
+
"""
|
58 |
+
|
59 |
+
msg = MIMEMultipart() # create a message
|
60 |
+
#message = message_template.substitute(PERSON_NAME=name.title())
|
61 |
+
#print(message)
|
62 |
+
msg['From'] = "[email protected]"
|
63 |
+
msg['To'] = number
|
64 |
+
msg['Subject'] = request.form.get('subject')
|
65 |
+
msg['Sign']="Thanks & Regards , \n Amrit"
|
66 |
+
msg.attach(MIMEText(message_body,'html'))
|
67 |
+
server.send_message(msg)
|
68 |
+
#server.sendmail(msg.as_string())
|
69 |
+
#server.sendmail("[email protected]", number , "message")
|
70 |
+
print("Sent")
|
71 |
+
server.quit()
|
72 |
+
return redirect(url_for('handler.Handler_Main'))
|
FlaskWebApp/Abc.txt
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css"/>
|
2 |
+
|
3 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
4 |
+
|
5 |
+
"""
|
6 |
+
email = request.form.get('email')
|
7 |
+
password = request.form.get('password')
|
8 |
+
if password:
|
9 |
+
return redirect(url_for('Handler.Handler_Main'))
|
10 |
+
else:
|
11 |
+
return "Failed
|
12 |
+
""""
|
13 |
+
|
14 |
+
template_folder='OnlineMain/P_Web_App/FileHandler/templates',
|
15 |
+
static_folder='static'
|
16 |
+
|
17 |
+
"../../static/css/login.css"
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
#resp=json.dumps(data)
|
22 |
+
#data=data.replace("\'", "\"")
|
23 |
+
#data=json.dumps(data)
|
24 |
+
|
25 |
+
|
26 |
+
,
|
27 |
+
{
|
28 |
+
"src": "/icon-256x256.png",
|
29 |
+
"sizes": "256x256",
|
30 |
+
"type": "image/png"
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"src": "/icon-384x384.png",
|
34 |
+
"sizes": "384x384",
|
35 |
+
"type": "image/png"
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"src": "/icon-512x512.png",
|
39 |
+
"sizes": "512x512",
|
40 |
+
"type": "image/png"
|
41 |
+
}
|
42 |
+
|
43 |
+
"css/cover.css"
|
44 |
+
|
45 |
+
self.addEventListener("fetch", (event) => {
|
46 |
+
console.log("Service Worker : fetch!")
|
47 |
+
event.respondWith(
|
48 |
+
// we are sending the request to the server. if network is down, then sending the res
|
49 |
+
// from the cache.
|
50 |
+
fetch(event.request)
|
51 |
+
.catch(() => {
|
52 |
+
caches.match(event.request)
|
53 |
+
})
|
54 |
+
|
55 |
+
)
|
56 |
+
})
|
57 |
+
|
58 |
+
|
59 |
+
self.addEventListener('fetch', (e) => {
|
60 |
+
console.log('[ServiceWorker] Fetch', e.request.url);
|
61 |
+
e.respondWith((async () => {
|
62 |
+
const r = await caches.match(e.request);
|
63 |
+
console.log(`[Service Worker] Fetching resource: ${e.request.url}`);
|
64 |
+
if (r) { return r; }
|
65 |
+
|
66 |
+
try {
|
67 |
+
const response = await fetch(e.request);
|
68 |
+
|
69 |
+
// We could cache this new resource if we wanted to.
|
70 |
+
// const cache = await caches.open(cacheName);
|
71 |
+
// console.log(`[Service Worker] Caching new resource: ${e.request.url}`);
|
72 |
+
// cache.put(e.request, response.clone());
|
73 |
+
return response;
|
74 |
+
} catch(error) {
|
75 |
+
console.log('Fetch failed; returning offline page instead.', error);
|
76 |
+
// In reality you'd have many different
|
77 |
+
// fallbacks, depending on URL & headers.
|
78 |
+
// Eg, a fallback silhouette image for avatars.
|
79 |
+
let url = e.request.url;
|
80 |
+
let extension = url.split('.').pop();
|
81 |
+
console.log('URL: ', url);
|
82 |
+
|
83 |
+
if (extension === 'jpg' || extension === 'png') {
|
84 |
+
const FALLBACK_IMAGE = `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="180" stroke-linejoin="round">
|
85 |
+
<path stroke="#DDD" stroke-width="25" d="M99,18 15,162H183z"/>
|
86 |
+
<path stroke-width="17" fill="#FFF" d="M99,18 15,162H183z" stroke="#eee"/>
|
87 |
+
<path d="M91,70a9,9 0 0,1 18,0l-5,50a4,4 0 0,1-8,0z" fill="#aaa"/>
|
88 |
+
<circle cy="138" r="9" cx="100" fill="#aaa"/>
|
89 |
+
</svg>`;
|
90 |
+
// const FALLBACK_IMAGE = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path class="heroicon-ui" d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2zm16 8.59V6H4v6.59l4.3-4.3a1 1 0 0 1 1.4 0l5.3 5.3 2.3-2.3a1 1 0 0 1 1.4 0l1.3 1.3zm0 2.82l-2-2-2.3 2.3a1 1 0 0 1-1.4 0L9 10.4l-5 5V18h16v-2.59zM15 10a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/></svg>`;
|
91 |
+
return Promise.resolve(new Response(FALLBACK_IMAGE, {
|
92 |
+
headers: {
|
93 |
+
'Content-Type': 'image/svg+xml'
|
94 |
+
}
|
95 |
+
}));
|
96 |
+
}
|
97 |
+
const cache = await caches.open(cacheName);
|
98 |
+
const cachedResponse = await cache.match('offline.html');
|
99 |
+
return cachedResponse;
|
100 |
+
}
|
101 |
+
})());
|
102 |
+
});
|
103 |
+
Footer
|
104 |
+
|
105 |
+
|
106 |
+
'../../static/android-chrome-192x192.png',
|
107 |
+
'../../static/android-chrome-512x512.png',
|
108 |
+
'../../static/apple-touch-icon.png',
|
109 |
+
'../../static/favicon-16x16.png',
|
110 |
+
'../../static/favicon-32x32.png',
|
111 |
+
'../../static/favicon.ico',
|
112 |
+
|
113 |
+
'../../static/css/style.css',
|
114 |
+
'../../static/css/addedStyle.css',
|
115 |
+
|
116 |
+
'../../static/javascript/app.js',
|
117 |
+
'../../static/javascript/services.js',
|
118 |
+
'../../static/javascript/script.js',
|
119 |
+
'../../static/javascript/pass-show-hide.js',
|
120 |
+
|
121 |
+
'../../static/images/img.png',
|
122 |
+
'../../static/images/background-img.jpg',
|
123 |
+
'../../static/images/do-img1.png',
|
124 |
+
'../../static/images/do-img2.png',
|
125 |
+
'../../static/images/do-img3.png',
|
126 |
+
'../../static/images/doc2.png',
|
127 |
+
'../../static/images/doc3.png',
|
128 |
+
'../../static/images/dont-img1.png',
|
129 |
+
'../../static/images/dont-img2.png',
|
130 |
+
'../../static/images/dont-img3.png',
|
131 |
+
'../../static/images/home-bg.jpg',
|
132 |
+
'../../static/images/main-symp-img.png',
|
133 |
+
'../../static/images/main-wash-img.png',
|
134 |
+
'../../static/images/pre-1.png',
|
135 |
+
'../../static/images/pre-2.png',
|
136 |
+
'../../static/images/pre-3.png',
|
137 |
+
'../../static/images/pre-4.png',
|
138 |
+
'../../static/images/pre-5.png',
|
139 |
+
'../../static/images/pre-6.png',
|
140 |
+
'../../static/images/scroll-img.png',
|
141 |
+
'../../static/images/symp-a.png',
|
142 |
+
'../../static/images/symp-b.png',
|
143 |
+
'../../static/images/symp-c.png',
|
144 |
+
'../../static/images/symp-d.png',
|
145 |
+
'../../static/images/symp-e.png',
|
146 |
+
'../../static/images/symp-f.png',
|
147 |
+
'../../static/images/virus.png',
|
148 |
+
'../../static/images/wash-a.png',
|
149 |
+
'../../static/images/wash-b.png',
|
150 |
+
'../../static/images/wash-c.png',
|
151 |
+
'../../static/images/wash-d.png',
|
152 |
+
'../../static/images/wash-e.png',
|
153 |
+
'../../static/images/wash-f.png'
|
154 |
+
|
155 |
+
|
156 |
+
|
157 |
+
self.addEventListener('install', (e) => {
|
158 |
+
console.log('[Service Worker] Install');
|
159 |
+
e.waitUntil((async () => {
|
160 |
+
const cache = await caches.open(cacheName);
|
161 |
+
console.log('[Service Worker] Caching all: app shell and content');
|
162 |
+
await cache.addAll(contentToCache);
|
163 |
+
})());
|
164 |
+
});
|
FlaskWebApp/App/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .controller import app_handler
|
FlaskWebApp/App/controller.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Blueprint, request, Response, jsonify, make_response, send_from_directory, render_template
|
2 |
+
|
3 |
+
|
4 |
+
app_handler = Blueprint('app_handler',__name__, template_folder='./templates',static_folder='./static')
|
5 |
+
|
6 |
+
|
7 |
+
@app_handler.route('/', methods=['GET'])
|
8 |
+
def App_Index():
|
9 |
+
return "Hello from Flask"
|
10 |
+
|
11 |
+
@app_handler.route("/<path:path>", methods=['GET'])
|
12 |
+
def serve_static_files(path):
|
13 |
+
return send_from_directory(app_handler.static_folder, path)
|
14 |
+
|
15 |
+
@app_handler.route('/error/<error>', methods=['GET'])
|
16 |
+
def App_Error(error):
|
17 |
+
error=str(error)
|
18 |
+
return render_template("error.html",data=error)
|
FlaskWebApp/Authentication/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .controller import authentication
|
FlaskWebApp/Authentication/controller.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests,urllib
|
2 |
+
import json
|
3 |
+
from flask import Blueprint, request, Response,redirect,url_for,jsonify,render_template
|
4 |
+
|
5 |
+
from werkzeug.security import generate_password_hash
|
6 |
+
|
7 |
+
authentication = Blueprint('authentication', __name__, static_folder='./static', template_folder='./templates')
|
8 |
+
|
9 |
+
|
10 |
+
@authentication.route('/', methods=['GET'])
|
11 |
+
def Auth_Home():
|
12 |
+
return redirect(url_for('authentication.Auth_login'))
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
@authentication.route('/login', methods=['GET','POST'])
|
17 |
+
def Auth_login():
|
18 |
+
print("Activated")
|
19 |
+
if request.method == 'POST':
|
20 |
+
email = request.form.get('email')
|
21 |
+
password = request.form.get('password')
|
22 |
+
return redirect(url_for('handler.Handler_Main'))
|
23 |
+
return render_template("login.html")
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
@authentication.route('/signup', methods=['GET','POST'])
|
28 |
+
def Auth_signup():
|
29 |
+
return render_template("signup.html")
|
30 |
+
|
31 |
+
|
FlaskWebApp/Config.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from os import environ as env
|
2 |
+
|
3 |
+
|
4 |
+
api_id = env.get('SMS_API', None)
|
5 |
+
EMAIL = env.get('EMAIL', "[email protected]")
|
6 |
+
EMAIL_PASSWORD = env.get('EMAIL_PASSWORD', "knuiirzqpciutgdh")
|
FlaskWebApp/FileHandler/__init__.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
from .controller import handler
|
FlaskWebApp/FileHandler/controller.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Blueprint, request, Response, redirect, url_for, jsonify, render_template, make_response, send_from_directory
|
2 |
+
|
3 |
+
from werkzeug.security import generate_password_hash
|
4 |
+
|
5 |
+
handler = Blueprint('handler',
|
6 |
+
__name__,
|
7 |
+
static_folder='./static',
|
8 |
+
template_folder='./templates')
|
9 |
+
|
10 |
+
|
11 |
+
@handler.route('/', methods=['GET'])
|
12 |
+
def Handler_Main():
|
13 |
+
data = {
|
14 |
+
"Name": "Amritananda Sadhukhan",
|
15 |
+
"Age": "23",
|
16 |
+
"Max_Sugar": "200",
|
17 |
+
"Min_Sugar": "100",
|
18 |
+
"Heart_Rate": "60"
|
19 |
+
}
|
20 |
+
return render_template("index.html", data=data)
|
21 |
+
|
22 |
+
@handler.route('/profile', methods=['GET'])
|
23 |
+
def Handler_Profile():
|
24 |
+
data = {
|
25 |
+
"Name": "Amritananda Sadhukhan",
|
26 |
+
"Age": "23",
|
27 |
+
"Max_Sugar": "200",
|
28 |
+
"Min_Sugar": "100",
|
29 |
+
"Heart_Rate": "60"
|
30 |
+
}
|
31 |
+
return render_template("profile.html", data=data)
|
32 |
+
|
33 |
+
|
34 |
+
@handler.route('/offline.html')
|
35 |
+
def offline():
|
36 |
+
return send_from_directory('templates', 'index.html')
|
FlaskWebApp/SMSService.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
from .Config import api_id
|
4 |
+
|
5 |
+
"""
|
6 |
+
try:
|
7 |
+
requests.get(url = URL)
|
8 |
+
return response.text
|
9 |
+
except:
|
10 |
+
return response.text
|
11 |
+
|
12 |
+
{"authorization":api_id,"variables_values":message,"route":"otp","numbers":str(number)}
|
13 |
+
|
14 |
+
"""
|
15 |
+
def Send_Sms(message, number):
|
16 |
+
import requests
|
17 |
+
url = "https://www.fast2sms.com/dev/bulkV2"
|
18 |
+
querystring = {"authorization":api_id,"message":"This is test message","language":"english","route":"q","numbers":"8617040745"}
|
19 |
+
headers = {
|
20 |
+
'cache-control': "no-cache"
|
21 |
+
}
|
22 |
+
|
23 |
+
response = requests.request("GET", url, headers=headers, params=querystring)
|
24 |
+
|
25 |
+
print(response.text)
|
26 |
+
|
27 |
+
return response.text
|
FlaskWebApp/__init__.py
ADDED
File without changes
|
FlaskWebApp/__main__.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask
|
2 |
+
|
3 |
+
def Flask_Instance():
|
4 |
+
app = Flask(__name__, static_folder='static', template_folder='templates')
|
5 |
+
app.config['SECRET_KEY'] = 'SECRET_KEY'
|
6 |
+
|
7 |
+
from FlaskWebApp.App import app_handler
|
8 |
+
app.register_blueprint(app_handler, url_prefix='/')
|
9 |
+
|
10 |
+
from FlaskWebApp.APIServices import pwa_api
|
11 |
+
app.register_blueprint(pwa_api, url_prefix='/api/')
|
12 |
+
|
13 |
+
from FlaskWebApp.Authentication import authentication
|
14 |
+
app.register_blueprint(authentication, url_prefix='/auth/')
|
15 |
+
|
16 |
+
from FlaskWebApp.FileHandler import handler
|
17 |
+
app.register_blueprint(handler, url_prefix='/app/')
|
18 |
+
|
19 |
+
return app
|
20 |
+
|
21 |
+
|
22 |
+
#This is for UWSGI Server Cofiguration
|
23 |
+
#application=app
|
24 |
+
app = Flask_Instance()
|
25 |
+
|
26 |
+
if __name__ == '__main__':
|
27 |
+
app.config['SECRET_KEY'] = 'I am the scret'
|
28 |
+
app.run(host='0.0.0.0', port=8000, debug=True)
|
FlaskWebApp/css.txt
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.m-0 {
|
2 |
+
|
3 |
+
bottom : 1px;
|
4 |
+
margin-top: auto;
|
5 |
+
color: black;
|
6 |
+
}
|
7 |
+
.bg-primary {
|
8 |
+
background-color: #1abc9c !important;
|
9 |
+
}
|
10 |
+
.text-white {
|
11 |
+
color: #fff !important;
|
12 |
+
}
|
13 |
+
|
14 |
+
.card .card-footer {
|
15 |
+
border-top: 1px solid #e2e5e8;
|
16 |
+
padding: 12px 20px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.card-footer:last-child {
|
20 |
+
border-radius: 0 0 calc(2px - 0px) calc(2px - 0px);
|
21 |
+
}
|
22 |
+
.bg-primary {
|
23 |
+
background-color: #1abc9c !important;
|
24 |
+
}
|
25 |
+
.text-white {
|
26 |
+
color: #fff !important;
|
27 |
+
}
|
28 |
+
.bg-primary {
|
29 |
+
background-color: #1abc9c !important;
|
30 |
+
}
|
31 |
+
.card-footer {
|
32 |
+
padding: 1.25rem 1.25rem;
|
33 |
+
background-color: rgba(0, 0, 0, 0);
|
34 |
+
border-top: 0px solid rgba(0, 0, 0, 0.125);
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
.card {
|
39 |
+
box-shadow: 0 2px 1px rgb(0 0 0 / 5%);
|
40 |
+
margin-bottom: 30px;
|
41 |
+
transition: box-shadow 0.2s ease-in-out;
|
42 |
+
border-top: 3px solid #8CDDCD;
|
43 |
+
}
|
44 |
+
|
45 |
+
.overflow-hidden {
|
46 |
+
overflow: hidden !important;
|
47 |
+
}
|
48 |
+
|
49 |
+
.img{
|
50 |
+
font-size: 30px;
|
51 |
+
height: 45px;
|
52 |
+
width: 45px;
|
53 |
+
}
|
FlaskWebApp/templates/index.html
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
<p>Flask app</p>
|
nginx.conf
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
user app_user;
|
2 |
+
worker_processes auto;
|
3 |
+
#error_log /tmp/error.log;
|
4 |
+
error_log stderr notice;
|
5 |
+
pid /tmp/nginx.nid;
|
6 |
+
# run nginx in foreground
|
7 |
+
#daemon off;
|
8 |
+
|
9 |
+
events {
|
10 |
+
worker_connections 1024;
|
11 |
+
}
|
12 |
+
|
13 |
+
http {
|
14 |
+
client_body_temp_path /tmp/client_body;
|
15 |
+
fastcgi_temp_path /tmp/fastcgi_temp;
|
16 |
+
proxy_temp_path /tmp/proxy_temp;
|
17 |
+
scgi_temp_path /tmp/scgi_temp;
|
18 |
+
uwsgi_temp_path /tmp/uwsgi_temp;
|
19 |
+
#error_log /tmp/error.log;
|
20 |
+
access_log /dev/stdout;
|
21 |
+
|
22 |
+
server_tokens on;
|
23 |
+
include /etc/nginx/mime.types;
|
24 |
+
default_type application/octet-stream;
|
25 |
+
|
26 |
+
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';
|
27 |
+
log_format compact '$remote_addr - $time_local - "$request" - $status - "$http_referer"';
|
28 |
+
|
29 |
+
#access_log off;
|
30 |
+
|
31 |
+
# disable to avoid caching and volume mount issues
|
32 |
+
sendfile on;
|
33 |
+
tcp_nopush on;
|
34 |
+
tcp_nodelay on;
|
35 |
+
|
36 |
+
keepalive_timeout 30;
|
37 |
+
|
38 |
+
server {
|
39 |
+
listen 7860;
|
40 |
+
server_name 0.0.0.0;
|
41 |
+
|
42 |
+
location / {
|
43 |
+
root /var/www/portfolio;
|
44 |
+
index index.html;
|
45 |
+
try_files $uri /index.html;
|
46 |
+
}
|
47 |
+
|
48 |
+
location /api/ {
|
49 |
+
proxy_pass http://127.0.0.1:8000/;
|
50 |
+
proxy_set_header Host $host;
|
51 |
+
proxy_set_header X-Real-IP $remote_addr;
|
52 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
resources.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:662fdaa9eba3959dd7da9fc6c6c387c9d15712baaf14419be757c20591c62dd3
|
3 |
+
size 7536640
|
start_pyapps_multirun.sh
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Start nginx in a separate shell (background)
|
4 |
+
(
|
5 |
+
echo "* Activating virtual environment *PWD $(pwd) *"
|
6 |
+
source /app/PyEnv/bin/activate
|
7 |
+
echo "* Starting application *PWD $(pwd)*"
|
8 |
+
cd /app || { echo "Failed to change directory to /app"; exit 1; }
|
9 |
+
python3 -u -m FlaskWebApp || { echo "Failed to start WebSSH application"; exit 1; }
|
10 |
+
#python3 -u -m FlaskWebApp > /app/flask.log 2>&1
|
11 |
+
) &
|
12 |
+
nginx -g "daemon off;" > /dev/stdout; #> /app/nginx.log 2>&1
|