Event updates, list updates, bacend changes
This commit is contained in:
parent
7fedf2f367
commit
0ebdc31f19
|
@ -86,7 +86,6 @@ def fileManagerAction(_type, _hash = None):
|
|||
view.set_to_home()
|
||||
return redirect("/")
|
||||
|
||||
|
||||
folder = view.get_current_directory()
|
||||
file = view.get_path_part_from_hash(_hash)
|
||||
fpath = os.path.join(folder, file)
|
||||
|
@ -100,6 +99,7 @@ def fileManagerAction(_type, _hash = None):
|
|||
# I.E....this is stupid but for now works better than nothing
|
||||
return view.remuxVideo(_hash, fpath)
|
||||
if _type == "run-locally":
|
||||
msg = "Opened media..."
|
||||
view.openFilelocally(fpath)
|
||||
return msgHandler.createMessageJSON("success", msg)
|
||||
|
||||
|
@ -140,7 +140,7 @@ def manageFavorites(_action):
|
|||
if request.method == 'POST':
|
||||
ACTION = _action.strip()
|
||||
view = get_window_controller().get_window(1).get_view(0)
|
||||
path = view.getPath()
|
||||
path = view.get_current_directory()
|
||||
|
||||
if ACTION == "add":
|
||||
fave = Favorites(link=path)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,28 @@
|
|||
@font-face {
|
||||
font-family: Dosis;
|
||||
src: url("/static/css/fonts/dosis/Dosis-Regular.ttf"),
|
||||
url("/static/css/fonts/dosis/Dosis-Medium.ttf"),
|
||||
url("/static/css/fonts/dosis/Dosis-Light.ttf"),
|
||||
url("/static/css/fonts/dosis/Dosis-ExtraLight.ttf"),
|
||||
url("/static/css/fonts/dosis/Dosis-Bold.ttf"),
|
||||
url("/static/css/fonts/dosis/Dosis-ExtraBold.ttf"),
|
||||
url("/static/css/fonts/dosis/Dosis-SemiBold.ttf"),
|
||||
url("/static/css/fonts/Dosis-VariableFont_wght.ttf"),
|
||||
url("/static/css/fonts/fa-brands-400.ttf"),
|
||||
url("/static/css/fonts/fa-regular-400.ttf"),
|
||||
url("/static/css/fonts/fa-solid-900.ttf");
|
||||
font-style: normal;
|
||||
font-display: auto;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Dosis;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
list-style: none;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
const getCookie = (cookieKey) => {
|
||||
return Cookies.get(cookieKey);
|
||||
}
|
||||
|
||||
const setCookie = (key, value, args = { expires: new Date('December 31, 2034 03:24:00'),
|
||||
path: '/' }) => {
|
||||
Cookies.set(key, value, args);
|
||||
}
|
|
@ -11,10 +11,10 @@ document.body.onload = (eve) => {
|
|||
elm.parentElement.removeChild(elm);
|
||||
|
||||
// Stylesheet for iframe views
|
||||
var link = document.createElement("link");
|
||||
let link = document.createElement("link");
|
||||
link.href = formatURL("static/css/iframe.css");
|
||||
link.type = "text/css";
|
||||
link.rel = "stylesheet";
|
||||
link.rel = "stylesheet";
|
||||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
}, 500);
|
||||
}
|
||||
|
@ -22,47 +22,30 @@ document.body.onload = (eve) => {
|
|||
|
||||
|
||||
|
||||
|
||||
const openFile = (eve) => {
|
||||
let target = eve.target;
|
||||
let hash = target.getAttribute("app");
|
||||
listFilesAjax(hash);
|
||||
const target = eve.target;
|
||||
const ftype = target.getAttribute("ftype");
|
||||
const title = target.getAttribute("title");
|
||||
const hash = target.getAttribute("hash");
|
||||
const parts = title.split('.');
|
||||
const extension = "." + parts[parts.length - 1].toLowerCase();
|
||||
|
||||
if (ftype === "dir") {
|
||||
listFilesAjax(hash);
|
||||
} else if (ftype === "video") {
|
||||
showMedia(hash, extension, "video");
|
||||
} else {
|
||||
showMedia(hash, extension, "file");
|
||||
}
|
||||
}
|
||||
|
||||
const openFileLocally = (eve) => {
|
||||
let target = eve.target;
|
||||
let hash = target.getAttribute("app");
|
||||
const target = eve.target;
|
||||
const hash = target.getAttribute("hash");
|
||||
openWithLocalProgram(hash);
|
||||
}
|
||||
|
||||
// Actions for content
|
||||
// document.getElementById('file-grid').ondblclick = (event) => {
|
||||
// let target = event.target;
|
||||
// let className = target.className;
|
||||
//
|
||||
// // Left click detect
|
||||
// if (event.which == 1) {
|
||||
// // If clicking on container
|
||||
// if (className === "dir-style" || className === "video-style" ||
|
||||
// className === "file-style" || className === "image-style") {
|
||||
// const title = target.getAttribute("title");
|
||||
// const hash = target.getAttribute("hash");
|
||||
// const parts = title.split('.');
|
||||
// const extension = "." + parts[parts.length - 1].toLowerCase();
|
||||
//
|
||||
// if (className === "dir-style") {
|
||||
// listFilesAjax(hash);
|
||||
// } else if (className === "video-style") {
|
||||
// showMedia(hash, extension, "video");
|
||||
// } else {
|
||||
// showMedia(hash, extension, "file");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,5 @@ const updateHTMLDirList = async (data) => {
|
|||
else
|
||||
tggl_faves_btn.classList.remove("btn-info");
|
||||
|
||||
console.log(data.list);
|
||||
|
||||
renderFilesList(data.list);
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ class FilesList extends React.Component {
|
|||
{card_body}
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<input app={hash} onClick={this.openThisLocally} ftype={filetype} class="btn btn-secondary btn-sm float-left" type="button" value="Open Locally"/>
|
||||
<input app={hash} onClick={this.openThis} ftype={filetype} class="btn btn-secondary btn-sm float-right" title={name} type="button" value="Open"/>
|
||||
<input hash={hash} onClick={this.openThisLocally} ftype={filetype} class="btn btn-secondary btn-sm float-left" type="button" value="Open Locally"/>
|
||||
<input hash={hash} onClick={this.openThis} ftype={filetype} class="btn btn-secondary btn-sm float-right" title={name} type="button" value="Open"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -121,7 +121,7 @@ const setupFile = async (hash, extension) => {
|
|||
|
||||
|
||||
const openWithLocalProgram = async (hash, extension = "") => {
|
||||
const url = "run-locally/" + hash;
|
||||
const url = "api/file-manager-action/run-locally/" + hash;
|
||||
let data = await fetchData(url);
|
||||
let message = data.message;
|
||||
displayMessage(message.text, message.type);
|
||||
|
@ -186,6 +186,30 @@ const updateBackground = (srcLink, isvideo = true) => {
|
|||
}
|
||||
|
||||
|
||||
const manageFavorites = (elm) => {
|
||||
const classType = "btn-info";
|
||||
const hasClass = elm.classList.contains(classType);
|
||||
if (hasClass) {
|
||||
elm.classList.remove(classType);
|
||||
action = "delete";
|
||||
} else {
|
||||
elm.classList.add(classType);
|
||||
action = "add";
|
||||
}
|
||||
|
||||
manageFavoritesAjax(action);
|
||||
}
|
||||
|
||||
|
||||
const loadFave = (id) => {
|
||||
loadFavoriteLink(id);
|
||||
document.getElementById("favorites-modal")
|
||||
.getElementsByClassName("modal-footer")[0]
|
||||
.children[0].click()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Message handler
|
||||
const displayMessage = (message, type, timeout, msgWindow = "page-alert-zone") => {
|
||||
let alertField = document.getElementById(msgWindow);
|
||||
|
|
|
@ -8,11 +8,21 @@
|
|||
<div id="navbarTogglerHeader" class="row collapse navbar-collapse">
|
||||
<div class="col-sm">
|
||||
{% if current_directory %}
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<i id="back-btn" class="fa fa-arrow-left" aria-hidden="true" title="Back..." hash="{{dot_dots[1][1]}}">
|
||||
Back...
|
||||
</i>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<i id="refresh-btn" class="fa fa-refresh" aria-hidden="true" title="Refresh..." hash="{{dot_dots[0][1]}}">
|
||||
Refresh...
|
||||
</i>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<div class="input-group input-group-sm justify-content-center">
|
||||
<button title="Other Options..." class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#options-modal">⚙</button>
|
||||
<button title="Refresh..." id="refresh-btn" class="btn btn-sm btn-secondary" hash="{{dot_dots[0][1]}}">↻</button>
|
||||
<button title="Back..." id="back-btn" class="btn btn-sm btn-secondary" hash="{{dot_dots[1][1]}}">⇐</button>
|
||||
|
||||
<input id="search-files-field" type="text" class="form-control" aria-label="Search..." placeholder="Search..." style="max-width: 260px">
|
||||
<div class="input-group-prepend">
|
||||
|
@ -27,23 +37,18 @@
|
|||
<div class="input-group input-group-sm justify-content-center">
|
||||
<button class="btn btn-sm btn-secondary" data-toggle="modal"
|
||||
data-target="#favorites-modal">Faves List ↕</button>
|
||||
<button id="tggl-faves-btn" class="btn btn-sm btn-secondary" title="Add/Delete from favorites..." >☆</button>
|
||||
<button id="scroll-files-to-top-btn" class="btn btn-sm btn-secondary" title="Scroll to top..." >Scroll Files To Top</button>
|
||||
</div>
|
||||
</li>
|
||||
{% else %}
|
||||
<!-- Branding -->
|
||||
<div class="navbar-brand">
|
||||
<div class="site-branding">
|
||||
<h4 class="site-title">
|
||||
<a href="{{ url_for('home') }}" title="{{TITLE}} Home" rel="home">
|
||||
{{TITLE}}
|
||||
</a>
|
||||
</h4>
|
||||
<h6 class="site-description">For the files!</h6>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
<li class="nav-item">
|
||||
<button id="tggl-faves-btn" class="btn btn-sm btn-secondary" title="Add/Delete from favorites..." >☆</button>
|
||||
</li>
|
||||
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="col col-lg-auto">
|
||||
|
|
|
@ -5,13 +5,6 @@
|
|||
{% block header_meta %}
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{% if post %}
|
||||
<meta name="author" content="{{post.meta_author}}">
|
||||
<meta name="copyright" content="CC0">
|
||||
<meta name="description" content="{{post.meta_description}}">
|
||||
<meta name="keywords" content="{{post.meta_keywords}}">
|
||||
{% endif %}
|
||||
<meta name="robots" content="index,follow">
|
||||
{% block header_meta_additional %}
|
||||
{% endblock header_meta_additional %}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Python imports
|
||||
import hashlib
|
||||
import os
|
||||
from os import listdir
|
||||
from os.path import isdir, isfile, join
|
||||
|
||||
|
@ -85,7 +86,7 @@ class View(Settings, Launcher, Path):
|
|||
def get_files_formatted(self):
|
||||
files = self.hashSet(self.files),
|
||||
dirs = self.hashSet(self.dirs),
|
||||
videos = self.hashSet(self.vids),
|
||||
videos = self.get_videos(),
|
||||
images = self.hashSet(self.images),
|
||||
desktops = self.hashSet(self.desktop),
|
||||
ungrouped = self.hashSet(self.ungrouped)
|
||||
|
@ -132,7 +133,16 @@ class View(Settings, Launcher, Path):
|
|||
return self.hashSet(self.dirs)
|
||||
|
||||
def get_videos(self):
|
||||
return self.hashSet(self.vids)
|
||||
videos_set = self.hashSet(self.vids)
|
||||
current_directory = self.get_current_directory()
|
||||
for video in videos_set:
|
||||
hashImgPth = join(self.ABS_THUMBS_PTH, video[1]) + ".jpg"
|
||||
if not os.path.exists(hashImgPth) :
|
||||
fullPath = join(current_directory, video[0])
|
||||
self.logger.debug(f"Hash Path: {hashImgPth}\nFile Path: {fullPath}")
|
||||
self.generateVideoThumbnail(fullPath, hashImgPth)
|
||||
|
||||
return videos_set
|
||||
|
||||
def get_images(self):
|
||||
return self.hashSet(self.images)
|
||||
|
|
Loading…
Reference in New Issue