diff --git a/app.py b/app.py index 2d0d330..5dc7691 100644 --- a/app.py +++ b/app.py @@ -1,13 +1,15 @@ from utils import clean_articles import ldap as l from ldap3 import Server, Connection, ALL, MODIFY_REPLACE -from flask import Flask, g, request, session, redirect, url_for, render_template +from flask import Flask, g, request, session, redirect, url_for, render_template, send_from_directory from flask_simpleldap import LDAP from flask_bootstrap import Bootstrap import os import sqlite3 import requests from utils import clean_articles, get_article +from flask_cache_buster import CacheBuster + app = Flask(__name__) Bootstrap(app) @@ -30,6 +32,14 @@ short_domain = os.environ.get('SHORT_DOMAIN') ldap = LDAP(app) +config = { + 'extensions': ['.js', '.css', '.csv'], + 'hash_size': 10 +} + +cache_buster = CacheBuster(config=config) +cache_buster.register_cache_buster(app) + server = Server(app.config['LDAP_HOST']) conn = Connection(server, app.config['LDAP_USERNAME'], app.config['LDAP_PASSWORD'], auto_bind=True) @@ -41,6 +51,11 @@ def before_request(): g.user = {} +@app.route("/manifest.json") +def manifest(): + return send_from_directory('./', 'manifest.json') + + @app.route('/') @ldap.login_required def index(): diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..0ea97bb --- /dev/null +++ b/manifest.json @@ -0,0 +1,20 @@ +{ + "short_name": "Read TI Later", + "name": "Read TI Later", + "description": "Instapaper outdated. Pocket overrated. Long have we waited. Read TI Later ACTIVATED.", + "icons": [ + { + "src": "/images/icons-192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "/images/icons-512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": "/", + "display": "standalone", + "scope": "/" + } \ No newline at end of file diff --git a/pocket/readitlater.db b/pocket/readitlater.db index 1597720..2ad61af 100644 Binary files a/pocket/readitlater.db and b/pocket/readitlater.db differ diff --git a/static/add_modal.js b/static/add_modal.js index b13c8ef..3c2f5fa 100644 --- a/static/add_modal.js +++ b/static/add_modal.js @@ -2,6 +2,10 @@ function openLinkModal() { $('#addLinkModal').modal('show'); } +function refreshPage() { + window.location.reload(); +} + function addUrl() { $("#link-btn").prop("disabled", true); diff --git a/static/read-it-later.png b/static/read-it-later.png new file mode 100644 index 0000000..b443cf6 Binary files /dev/null and b/static/read-it-later.png differ diff --git a/static/style.css b/static/style.css index fa1772e..335c3ed 100644 --- a/static/style.css +++ b/static/style.css @@ -1,5 +1,21 @@ +html { + width: 100%; + height: 100%; + overflow: hidden; + position: fixed; +} + +.navbar { + position: absolute; + top: 0; + width: 100%; +} + .wrapper { - display: flex; + height: calc(100% - 56px); + overflow: auto; + position: fixed; + top: 56px; width: 100%; align-items: stretch; } @@ -206,6 +222,57 @@ } } +@media all and (display-mode: standalone) { + .navbar { + position: absolute; + top: 0; + width: 100%; + padding-top: 44px !important; + } + + #refreshButton { + display: block !important; + } + + .wrapper { + height: calc(100% - 92px); + overflow: auto; + position: fixed; + top: 92px; + width: 100%; + align-items: stretch; + padding-left: env(safe-area-inset-left); + padding-right: env(safe-area-inset-right); + padding-bottom: env(safe-area-insert-bottom); + } + + @media (min-width: 577px) { + .navbar { + position: absolute; + top: 0; + width: 100%; + padding-top: 24px !important; + } + + #navbarNavDropdown { + padding-left: env(safe-area-inset-left); + padding-right: env(safe-area-inset-right); + } + + .wrapper { + height: calc(100% - 72px); + overflow: auto; + position: fixed; + top: 72px; + width: 100%; + align-items: stretch; + padding-left: env(safe-area-inset-left); + padding-right: env(safe-area-inset-right); + padding-bottom: env(safe-area-insert-bottom); + } + } +} + @media (max-width: 991.98px) { #sidebar { display: none !important; diff --git a/templates/article.j2 b/templates/article.j2 index 6f74561..814b4eb 100644 --- a/templates/article.j2 +++ b/templates/article.j2 @@ -1,6 +1,15 @@ {% extends "bootstrap/base.html" %} {% block title %}Read TI Later{% endblock %} +{% block metas %} +{{super()}} + + + + + +{% endblock %} + {% block styles %} {{super()}} @@ -63,7 +72,7 @@ {% endblock %} {% block content %} -