Updated ui and scripts

This commit is contained in:
itdominator 2021-11-13 13:41:05 -06:00
parent baae6e097c
commit 6622875703
3 changed files with 67 additions and 78 deletions

View File

@ -18,7 +18,8 @@ class Config(object):
DEBUG = False DEBUG = False
TESTING = False TESTING = False
THREADED = True THREADED = True
SECRET_KEY = secrets.token_hex(32) SECRET_KEY = "2A#GQafbREoblgMSQYomZSxbaPE6dt#"
# SECRET_KEY = secrets.token_hex(32)
HOME_PTH = os.path.expanduser("~") HOME_PTH = os.path.expanduser("~")
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__)) ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))

View File

@ -26,7 +26,7 @@ const postAjaxController = (data, action, hash, fname) => {
if (action === "delete") { if (action === "delete") {
query = '[fileHash="' + hash + '"]'; query = '[fileHash="' + hash + '"]';
elm = document.querySelector(query); elm = document.querySelector(query);
while ( !elm.className.includes("row r") ) { while ( !elm.className.includes("list-group-item") ) {
elm = elm.parentElement; elm = elm.parentElement;
} }
elm.parentElement.removeChild(elm); elm.parentElement.removeChild(elm);

View File

@ -2,116 +2,105 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
<!-- Upload controls --> <!-- Upload controls -->
<div class="row sticky-top"> <div class="col sticky-top">
<div class="col"> <div class="row">
<div class="row controls-secondary"> <div class="col">
<div class="col"> <div class="row controls-secondary">
<button class="btn btn-info" data-toggle="modal" <div class="col">
data-target="#uploaderModal">Upload...</button> <button class="btn btn-info" data-toggle="modal"
data-target="#uploaderModal">Upload...</button>
</div>
{% if oidc_isAdmin() %}
<div class="col">
<button id="googlePicker" class="btn btn-success">GDrive</button>
</div>
<div class="col">
<button id="notesToViewBtn" class="btn btn-secondary">Notes</button>
</div>
<div class="col">
<button id="filesToViewBtn" class="btn btn-secondary">Files</button>
</div>
{% endif %}
{% if oidc_loggedin() %}
<a href="/logout">
<button title="Logout..." class="btn btn-danger">
Logout
</button>
</a>
{% else %}
<a href="/login">
<button title="Login..." class="btn btn-success">
Login
</button>
</a>
{% endif %}
</div> </div>
{% if oidc_isAdmin() %}
<div class="col">
<button id="googlePicker" class="btn btn-success">GDrive</button>
</div>
<div class="col">
<button id="notesToViewBtn" class="btn btn-secondary">Notes</button>
</div>
<div class="col">
<button id="filesToViewBtn" class="btn btn-secondary">Files</button>
</div>
{% endif %}
{% if oidc_loggedin() %}
<a href="/logout">
<button title="Logout..." class="btn btn-danger">
Logout
</button>
</a>
{% else %}
<a href="/login">
<button title="Login..." class="btn btn-success">
Login
</button>
</a>
{% endif %}
</div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<!-- Message zone --> <!-- Message zone -->
<div id="page-alert-zone"></div> <div id="page-alert-zone"></div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Google Drive Picker --> <!-- Google Drive Picker -->
<div class="row"> <div class="col">
<div id="result"></div> <div id="result"></div>
</div> </div>
<!-- Upload(ed) List --> <!-- Upload(ed) List -->
<div class="row"> <div class="col">
<h3 style="width: 100%;">Server Files:</h3>
{% if oidc_isAdmin() %} {% if oidc_isAdmin() %}
<div class="col scroller" style="height:80vh; overflow-y: scroll;"> <div class="col scroller" style="height:80vh; overflow-y: scroll;">
<!-- Uploadeed Files List --> <!-- Uploadeed Files List -->
<ul class="list-group" style=""> <ul class="list-group" style="">
<span id="notesToView"></span> <span id="notesToView"></span>
{% for note in notes %} {% for note in notes %}
<li class="row rtext t{{ loop.index }}" textStrID="{{note['id']}}"> <li class="list-group-item card-text t{{ loop.index }}" textStrID="{{note['id']}}">
<div class="col-sm-2 list-group-item text-center"> <span class="badge badge-primary badge-pill">
<p class="server-file-card text-left"> <img class="menu-item" src="{{ url_for('static', filename='imgs/octicons/trashcan.svg')}}" title="Delete..."
<img class="menu-item" src="{{ url_for('static', filename='imgs/octicons/trashcan.svg')}}" title="Delete..." alt="Delete" data-toggle="modal" data-target="#deleteDialogModalText"
alt="Delete" data-toggle="modal" data-target="#deleteDialogModalText" onclick="preDeleteText(this.parentElement.parentElement)" />
onclick="preDeleteText(this.parentElement.parentElement.parentElement)" /> </span>
</p> {% if "youtu.be" in note["string"].strip().lower() or "www.youtube.com/watch?v=" in note["string"].strip().lower() %}
</div> {% if "youtu.be" in note["string"].strip() %}
<div class="col-md-10 list-group-item">
{% if "youtu.be" in note["string"].strip().lower() or "www.youtube.com/watch?v=" in note["string"].strip().lower() %}
{% if "youtu.be" in note["string"].strip() %}
<span class="list-group-item list-group-item-action justify-content-center text-center">
{{note["string"]}} {{note["string"]}}
<iframe class="card-img-top" <iframe class="card-img-top"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
autoplay="" allowfullscreen="true" width="650px" height="400px" frameborder="0" autoplay="" allowfullscreen="true" width="650px" height="400px" frameborder="0"
src="{{note['string'] | replace('youtu.be/', 'www.youtube.com/embed/')}}"> src="{{note['string'] | replace('youtu.be/', 'www.youtube.com/embed/')}}">
</iframe> </iframe>
</span> {% elif "www.youtube.com/watch?v=" in note["string"].strip().lower() %}
{% elif "www.youtube.com/watch?v=" in note["string"].strip().lower() %}
<span class="list-group-item list-group-item-action justify-content-center text-center">
{{note["string"]}} {{note["string"]}}
<iframe class="card-img-top" <iframe class="card-img-top"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
autoplay="" allowfullscreen="true" width="650px" height="400px" frameborder="0" autoplay="" allowfullscreen="true" width="650px" height="400px" frameborder="0"
src="{{note['string'] | replace('www.youtube.com/watch?v=', 'www.youtube.com/embed/')}}"> src="{{note['string'] | replace('www.youtube.com/watch?v=', 'www.youtube.com/embed/')}}">
</iframe> </iframe>
</span> {% endif %}
{% endif %} {% elif note["string"].strip().startswith( ("http:", "https:", "ftp:", "file:") ) %}
{% elif note["string"].strip().startswith( ("http:", "https:", "ftp:", "file:") ) %} {% if note["string"].strip().endswith( (".jpg", ".jpeg", ".png", ".gif") ) %}
{% if note["string"].strip().endswith( (".jpg", ".jpeg", ".png", ".gif") ) %}
<div class="list-group-item list-group-item-action justify-content-center text-center">
<a href="{{note['string']}}" target="_blank"> <a href="{{note['string']}}" target="_blank">
{{note["string"]}} {{note["string"]}}
</a> </a>
<img class="card-img-top server-image" src="{{note['string']}}" width="650px" height="auto" /> <img class="card-img-top server-image" src="{{note['string']}}" width="650px" height="auto" />
</div> {% else %}
{% else %} <a href="{{note['string']}}" target="_blank">
<a class="list-group-item list-group-item-action" href="{{note['string']}}" target="_blank"> {{note["string"]}}
{{note["string"]}} </a>
</a> {% endif %}
{% elif note["string"].strip() %}
<pre>{{note["string"]}}</pre>
{% endif %} {% endif %}
{% elif note["string"].strip() %} </li>
<pre class="list-group-item list-group-item-action">{{note["string"]}}</pre>
{% endif %}
</div>
</li>
{% endfor %} {% endfor %}
<span id="filesToView"></span> <span id="filesToView"></span>
{% for file in files %} {% for file in files %}
<li class="row r{{ loop.index }}"> <li class="list-group-item r{{ loop.index }}">
<div class="col list-group-item text-center">
<p class="server-file-card text-right" fileName="{{file[0]}}" fileHash="{{file[1]}}"> <p class="server-file-card text-right" fileName="{{file[0]}}" fileHash="{{file[1]}}">
<span class="file-name" style="float:left;">{{file[0]}}</span> <span class="file-name" style="float:left;">{{file[0]}}</span>
<img class="menu-item" src="{{ url_for('static', filename='imgs/octicons/pencil.svg')}}" title="Edit..." <img class="menu-item" src="{{ url_for('static', filename='imgs/octicons/pencil.svg')}}" title="Edit..."
@ -122,16 +111,15 @@
onclick="preDeleteFile(this.parentElement)" /> onclick="preDeleteFile(this.parentElement)" />
</p> </p>
{% if file[0].lower().endswith( (".png", ".jpg", ".jpeg") ) %} {% if file[0].lower().endswith( (".png", ".jpg", ".jpeg") ) %}
<a class="list-group-item-action content-align-center" href="{{ url_for('uploads')}}/{{file[0]}}" target="_blank"> <a href="{{ url_for('uploads')}}/{{file[0]}}" target="_blank">
<img class="card-img-top server-image" src="{{ url_for('uploads')}}/{{file[0]}}" alt="{{file[0]}}" /> <img class="card-img-top" src="{{ url_for('uploads')}}/{{file[0]}}" alt="{{file[0]}}" />
</a> </a>
{% elif file[0].lower().endswith( (".mp4", ".webm") ) %} {% elif file[0].lower().endswith( (".mp4", ".webm") ) %}
<video class="card-img-top" src="{{ url_for('uploads')}}/{{file[0]}}" controls></video> <video class="card-img-top" src="{{ url_for('uploads')}}/{{file[0]}}" controls></video>
{% else %} {% else %}
<a class="list-group-item list-group-item-action" href="{{ url_for('uploads')}}/{{file[0]}}" target="_blank">{{file[0]}}</a> <a href="{{ url_for('uploads')}}/{{file[0]}}" target="_blank">{{file[0]}}</a>
{% endif %} {% endif %}
</div> </li>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>