added server name env var

This commit is contained in:
2025-02-17 15:10:11 -05:00
parent ebbe61e2b2
commit f988ddc489
2 changed files with 12 additions and 5 deletions
+8 -1
View File
@@ -8,6 +8,7 @@ from flask import (
flash, flash,
abort, abort,
jsonify, jsonify,
session
) )
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from flask_login import ( from flask_login import (
@@ -46,7 +47,7 @@ PORT = 5121
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////app/instance/db.sqlite" app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////app/instance/db.sqlite"
app.config["UPLOAD_FOLDER"] = "sites" app.config["UPLOAD_FOLDER"] = "sites"
app.config["SERVER_NAME"] = "tinysite.cloud" app.config["SERVER_NAME"] = "tinysite.cloud"
app.config["SESSION_COOKIE_DOMAIN"] = ".tinysite.cloud" # app.config["SESSION_COOKIE_DOMAIN"] = ".tinysite.cloud"
db = SQLAlchemy(app) db = SQLAlchemy(app)
@@ -104,6 +105,12 @@ class Site(db.Model):
def page_not_found(_): def page_not_found(_):
return render_template("404.html", domain=request.host), 404 return render_template("404.html", domain=request.host), 404
@app.context_processor
def inject_global_variable():
return {
"SERVERNAME": app.config["SERVER_NAME"],
}
# Auth setup # Auth setup
login_manager = LoginManager() login_manager = LoginManager()
+4 -4
View File
@@ -13,7 +13,7 @@
<meta property="og:description" <meta property="og:description"
content="Host and share your static sites effortlessly with ION Static Site Hosting. Enjoy instant deployment, a sleek dark mode interface, and secure, private data handling!"> content="Host and share your static sites effortlessly with ION Static Site Hosting. Enjoy instant deployment, a sleek dark mode interface, and secure, private data handling!">
<meta property="og:image" content="{{ url_for('static', filename='hosting.png') }}"> <meta property="og:image" content="{{ url_for('static', filename='hosting.png') }}">
<meta property="og:url" content="https://sites.ion606.com/"> <meta property="og:url" content="https://{{session['servername']}}/">
<meta name="twitter:card" content="{{ url_for('static', filename='hosting.png') }}"> <meta name="twitter:card" content="{{ url_for('static', filename='hosting.png') }}">
<meta name="twitter:title" content="ION Static Site Hosting"> <meta name="twitter:title" content="ION Static Site Hosting">
<meta name="twitter:description" <meta name="twitter:description"
@@ -53,10 +53,10 @@
<body> <body>
<nav class="navbar"> <nav class="navbar">
<div class="container"> <div class="container">
<a href="{{ url_for('home') }}">Home</a> <a href="https://{{ SERVERNAME }}">Home</a>
{% if current_user.is_authenticated %} {% if current_user.is_authenticated %}
<a href="{{ url_for('dashboard') }}">Dashboard</a> <a href="https://{{ SERVERNAME }}/dashboard">Dashboard</a>
<a href="{{ url_for('logout') }}">Logout</a> <a href="https://{{ SERVERNAME }}/logout">Logout</a>
{% else %} {% else %}
<a href="{{ url_for('login') }}">Login</a> <a href="{{ url_for('login') }}">Login</a>
<a href="{{ url_for('register') }}">Register</a> <a href="{{ url_for('register') }}">Register</a>