Add nginx proxy support
This commit is contained in:
parent
5bd7d548c1
commit
48b8ac3c3d
4 changed files with 37 additions and 5 deletions
|
@ -5,6 +5,8 @@ from flask_login import LoginManager
|
||||||
from flask_bootstrap import Bootstrap5
|
from flask_bootstrap import Bootstrap5
|
||||||
from flask_fontawesome import FontAwesome
|
from flask_fontawesome import FontAwesome
|
||||||
|
|
||||||
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
|
|
||||||
from authlib.integrations.flask_client import OAuth
|
from authlib.integrations.flask_client import OAuth
|
||||||
|
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
|
@ -17,6 +19,8 @@ oauth = OAuth()
|
||||||
def create_app():
|
def create_app():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
app.wsgi_app = ProxyFix(app.wsgi_app)
|
||||||
|
|
||||||
app.config.from_pyfile('config.py')
|
app.config.from_pyfile('config.py')
|
||||||
|
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
|
|
@ -171,24 +171,34 @@
|
||||||
$.get(`/admin/event/${id}`, (data) => {
|
$.get(`/admin/event/${id}`, (data) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
if (data.status == "error") {
|
if (data.status == "error") {
|
||||||
is_new = "yes"
|
// This is a new event, do nothing!
|
||||||
} else {
|
} else {
|
||||||
name = data.name,
|
name = data.name,
|
||||||
description = data.description,
|
description = data.description,
|
||||||
loc = data.location
|
loc = data.location
|
||||||
|
|
||||||
start = new Date(data.start_time)
|
start = new Date(data.start_time)
|
||||||
start_day = start.toLocaleDateString()
|
|
||||||
|
var day = ("0" + start.getDate()).slice(-2);
|
||||||
|
var month = ("0" + (start.getMonth() + 1)).slice(-2);
|
||||||
|
|
||||||
|
start_day = start.getFullYear()+"-"+(month)+"-"+(day);
|
||||||
console.log(start_day)
|
console.log(start_day)
|
||||||
start_time = start.toLocaleTimeString()
|
start_time = start.toLocaleTimeString()
|
||||||
|
console.log(start_time)
|
||||||
end = new Date(data.end_time)
|
end = new Date(data.end_time)
|
||||||
end_day = end.toLocaleDateString()
|
|
||||||
end_time = end.toLocaleTimeString()
|
var day = ("0" + end.getDate()).slice(-2);
|
||||||
|
var month = ("0" + (end.getMonth() + 1)).slice(-2);
|
||||||
|
|
||||||
|
end_day = end.getFullYear()+"-"+(month)+"-"+(day);
|
||||||
|
end_time = `${end.getHours()}:${end.getMinutes()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
modal.find('#name').val(name)
|
modal.find('#name').val(name)
|
||||||
modal.find('#location').val(loc)
|
modal.find('#location').val(loc)
|
||||||
modal.find('#description').val(description)
|
modal.find('#description').val(description)
|
||||||
|
console.log(start_day)
|
||||||
modal.find('#start_day').val(start_day)
|
modal.find('#start_day').val(start_day)
|
||||||
modal.find('#start_time').val(start_time)
|
modal.find('#start_time').val(start_time)
|
||||||
modal.find('#end_day').val(end_day)
|
modal.find('#end_day').val(end_day)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<th>Created</th>
|
<th>Created</th>
|
||||||
<th>Last Login</th>
|
<th>Last Login</th>
|
||||||
<th>Officer?</th>
|
<th>Officer?</th>
|
||||||
|
<th>Options</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -20,6 +21,22 @@
|
||||||
<td>{{ u.created }}</td>
|
<td>{{ u.created }}</td>
|
||||||
<td>{{ u.last_login }}</td>
|
<td>{{ u.last_login }}</td>
|
||||||
<td>{{ u.is_admin }}</td>
|
<td>{{ u.is_admin }}</td>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="#" class="btn btn-primary dropdown-toggle"
|
||||||
|
data-bs-toggle="dropdown"><span
|
||||||
|
class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
{% if u.is_admin %}
|
||||||
|
<li class="dropdown-item">Demote Officer</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="dropdown-item">Promote Officer</li>
|
||||||
|
{% endif %}
|
||||||
|
<li class="dropdown-item">View Event Checkins</li>
|
||||||
|
<li class="dropdown-item">Delete Member</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -26,3 +26,4 @@ ulid==1.1
|
||||||
urllib3==2.2.1
|
urllib3==2.2.1
|
||||||
Werkzeug==2.3.7
|
Werkzeug==2.3.7
|
||||||
WTForms==3.1.2
|
WTForms==3.1.2
|
||||||
|
flask_wtf
|
||||||
|
|
Loading…
Add table
Reference in a new issue