mirror of
https://github.com/fergalmoran/emergelope.git
synced 2025-12-22 09:29:43 +00:00
Added some HTML
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -106,3 +106,4 @@ numbers.json
|
|||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
.idea
|
.idea
|
||||||
app.yaml
|
app.yaml
|
||||||
|
google-credentials.json
|
||||||
17
Dockerfile
17
Dockerfile
@@ -1,17 +0,0 @@
|
|||||||
FROM python:3.6-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY requirements.txt requirements.txt
|
|
||||||
RUN python -m venv venv
|
|
||||||
RUN venv/bin/pip install -r requirements.txt
|
|
||||||
RUN venv/bin/pip install gunicorn
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
COPY main.py robots.txt ./
|
|
||||||
RUN chmod +x boot.sh
|
|
||||||
|
|
||||||
ENV FLASK_APP main.py
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
ENTRYPOINT ["./boot.sh"]
|
|
||||||
29
data_store.py
Normal file
29
data_store.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Imports the Google Cloud client library
|
||||||
|
from google.cloud import datastore
|
||||||
|
|
||||||
|
|
||||||
|
def save_number(key, number):
|
||||||
|
# Instantiates a client
|
||||||
|
client = datastore.Client()
|
||||||
|
|
||||||
|
kind = 'Number'
|
||||||
|
name = key
|
||||||
|
task_key = client.key(kind, name)
|
||||||
|
|
||||||
|
task = datastore.Entity(key=task_key)
|
||||||
|
task['number'] = number
|
||||||
|
|
||||||
|
client.put(task)
|
||||||
|
|
||||||
|
print('Saved {}: {}'.format(task.key.name, task['number']))
|
||||||
|
|
||||||
|
|
||||||
|
def list_numbers():
|
||||||
|
client = datastore.Client()
|
||||||
|
query = client.query(kind='Number')
|
||||||
|
|
||||||
|
return list(query.fetch())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(list_numbers())
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
services:
|
|
||||||
|
|
||||||
emergelope:
|
|
||||||
container_name: emergelope
|
|
||||||
image: fergalmoran/emergelope
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
VIRTUAL_HOST: ${DOMAINS}
|
|
||||||
LETSENCRYPT_HOST: ${DOMAINS}
|
|
||||||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL}
|
|
||||||
ACCOUNT_SID: ${ACCOUNT_SID}
|
|
||||||
AUTH_TOKEN: ${AUTH_TOKEN}
|
|
||||||
NUMBER_LIST: ${NUMBER_LIST}
|
|
||||||
FROM_NUMBER: ${FROM_NUMBER}
|
|
||||||
CALL_XML: ${CALL_XML}
|
|
||||||
|
|
||||||
networks:
|
|
||||||
default:
|
|
||||||
external:
|
|
||||||
name: ${NETWORK}
|
|
||||||
9
main.py
9
main.py
@@ -2,9 +2,11 @@ import json
|
|||||||
import os
|
import os
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from flask import Flask, jsonify
|
from flask import Flask, jsonify, render_template
|
||||||
from twilio.rest import Client
|
from twilio.rest import Client
|
||||||
|
|
||||||
|
from data_store import save_number
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
account_sid = os.environ['ACCOUNT_SID']
|
account_sid = os.environ['ACCOUNT_SID']
|
||||||
auth_token = os.environ['AUTH_TOKEN']
|
auth_token = os.environ['AUTH_TOKEN']
|
||||||
@@ -22,8 +24,7 @@ def parse_json():
|
|||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
return 'Emergelope'
|
return render_template('index.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/debug')
|
@app.route('/debug')
|
||||||
def debug():
|
def debug():
|
||||||
@@ -40,6 +41,8 @@ def debug():
|
|||||||
|
|
||||||
@app.route('/3c9d6880-107b-4c03-8356-2778b7bd8209')
|
@app.route('/3c9d6880-107b-4c03-8356-2778b7bd8209')
|
||||||
def initiate_cluster_fuck():
|
def initiate_cluster_fuck():
|
||||||
|
return
|
||||||
|
|
||||||
client = Client(account_sid, auth_token)
|
client = Client(account_sid, auth_token)
|
||||||
sids = []
|
sids = []
|
||||||
numbers = parse_json()
|
numbers = parse_json()
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
Flask
|
Flask
|
||||||
|
Werkzeug
|
||||||
twilio
|
twilio
|
||||||
|
google-cloud-datastore
|
||||||
129
templates/index.html
Normal file
129
templates/index.html
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Title</title>
|
||||||
|
<!-- Required meta tags -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
|
||||||
|
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
|
||||||
|
crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<style>
|
||||||
|
/* Sticky footer styles
|
||||||
|
-------------------------------------------------- */
|
||||||
|
|
||||||
|
html {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
/* Margin bottom by footer height */
|
||||||
|
margin-bottom: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
/* Set the fixed height of the footer here */
|
||||||
|
height: 60px;
|
||||||
|
line-height: 60px;
|
||||||
|
/* Vertically center the text there */
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom page CSS
|
||||||
|
-------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Not required for template or sticky footer method. */
|
||||||
|
|
||||||
|
body > .container {
|
||||||
|
padding: 60px 15px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer > .container {
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<!-- Fixed navbar -->
|
||||||
|
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
|
||||||
|
<a class="navbar-brand"
|
||||||
|
href="#">Fixed navbar</a>
|
||||||
|
<button class="navbar-toggler"
|
||||||
|
type="button"
|
||||||
|
data-toggle="collapse"
|
||||||
|
data-target="#navbarCollapse"
|
||||||
|
aria-controls="navbarCollapse"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse"
|
||||||
|
id="navbarCollapse">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link"
|
||||||
|
href="#">Home
|
||||||
|
<span class="sr-only">(current)</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link"
|
||||||
|
href="#">Link</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link disabled"
|
||||||
|
href="#">Disabled</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<form class="form-inline mt-2 mt-md-0">
|
||||||
|
<input class="form-control mr-sm-2"
|
||||||
|
type="text"
|
||||||
|
placeholder="Search"
|
||||||
|
aria-label="Search">
|
||||||
|
<button class="btn btn-outline-success my-2 my-sm-0"
|
||||||
|
type="submit">Search
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Begin page content -->
|
||||||
|
<main role="main" class="container">
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container">
|
||||||
|
<span class="text-muted">Place sticky footer content here.</span>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
<!-- Optional JavaScript -->
|
||||||
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
|
||||||
|
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
|
||||||
|
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
|
||||||
|
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user