diff --git a/.gitignore b/.gitignore index 5df64ca..47eff86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .env -assests/screenshot.png +__pycache__/ + +app/static/screenshots/* +!app/static/screenshots/.keep \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c99bf49..78da38a 100755 --- a/Dockerfile +++ b/Dockerfile @@ -133,6 +133,7 @@ FROM build as devcontainer RUN apt-get update && apt-get install -y --no-install-recommends \ ansible \ + dnsutils \ exa \ iproute2 \ jq \ diff --git a/Makefile b/Makefile index bfc1b42..104610a 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,8 @@ -run: - python3 app/app.py \ No newline at end of file +.PHONY: run +SITE_PACKAGES := $(shell pip show pip | grep '^Location' | cut -f2 -d':') +run: $(SITE_PACKAGES) + python3 app/app.py + +$(SITE_PACKAGES): requirements.txt + pip install -r requirements.txt + touch requirements.txt \ No newline at end of file diff --git a/app/app.py b/app/app.py index 773472d..9715655 100644 --- a/app/app.py +++ b/app/app.py @@ -4,9 +4,7 @@ from flask import Flask, render_template, request from selenium import webdriver -app = Flask(__name__, - static_url_path='', - static_folder='assets') +app = Flask(__name__) def expand_url(url): try: @@ -41,4 +39,9 @@ def index(): return render_template('index.html', url=url, current_year=datetime.now().year) if __name__ == '__main__': - app.run(host='0.0.0.0', port=5000, debug=os.environ.get("FLASK_DEBUG", "False")) \ No newline at end of file + port = int(os.environ.get("ONGOING_PORT", 9380)) + if os.environ.get("FLASK_DEBUG", "False") == "True": + app.run(port=port, debug=True) + else: + from waitress import serve + serve(app, host='0.0.0.0', port=port) \ No newline at end of file diff --git a/app/assets/screenshot.png b/app/assets/screenshot.png deleted file mode 100644 index 0f927be..0000000 Binary files a/app/assets/screenshot.png and /dev/null differ diff --git a/app/static/css/index.css b/app/static/css/index.css new file mode 100644 index 0000000..211deac --- /dev/null +++ b/app/static/css/index.css @@ -0,0 +1,86 @@ +body { + display: flex; + flex-direction: column; + min-height: 100vh; + background-color: #212529; + color: #f8f9fa; + font-family: Helvetica, Verdana, Arial, sans-serif; + font-size: 1em; + margin: 0; +} + +.container { + flex-grow: 1; +} + +a { + color: #61dafb; + text-decoration: none; +} + +#spinner { + display: none; +} + +#screenshot { + padding-bottom: 5px; +} + +#screenshot img { + max-width: 100%; + border: 1px solid #343a40; + padding: 5px; + background-color: #343a40; +} + +#expandedUrl { + display: none; +} + +.card { + background-color: #343a40; + margin-bottom: 0; + height: 100%; +} + +.card-header { + background-color: #212529; +} + +.card-footer { + background-color: #212529; + position: static; + width: auto; + padding-top: 1.5em; +} + +.form-control { + background-color: #495057; + color: #f8f9fa; + border-color: #6c757d; +} + +.form-control:focus { + background-color: #343a40; + color: #f8f9fa; + border-color: #61dafb; + box-shadow: 0 0 0 0.25rem rgba(97, 218, 251, 0.25); +} + +.btn-primary { + background-color: #212529; + border-color: #495057; + color: #61dafb; +} + +.btn-primary:hover { + background-color: #495057; + border-color: #6c757d; + color: #61dafb; +} + +.input-group-text { + background-color: #495057; + color: #f8f9fa; + border-color: #6c757d; +} \ No newline at end of file diff --git a/app/assets/spinner.gif b/app/static/images/spinner.gif similarity index 100% rename from app/assets/spinner.gif rename to app/static/images/spinner.gif diff --git a/app/static/screenshots/.keep b/app/static/screenshots/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/index.html b/app/templates/index.html index 1df86ae..2a012a7 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,109 +1,74 @@ - + OnGoing URL Expander - + + - - - -
+ + +
-
-
-
-

OnGoing URL Expander

-
-
-
-
- - - - - Loading... - -
-
{{ url }}
-
-
-
- -
- +
+ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7513659..ab09922 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ flask requests selenium -pillow \ No newline at end of file +pillow +waitress \ No newline at end of file