Compare commits

...

3 Commits

10 changed files with 140 additions and 16 deletions

View File

@ -1,2 +1,3 @@
docker run --rm -it -p 9200:9200 -e "discovery.type=single-node" \ docker run --rm -it --name "sist2-dev-es"\
-p 9200:9200 -e "discovery.type=single-node" \
-e "ES_JAVA_OPTS=-Xms8g -Xmx8g" elasticsearch:7.14.0 -e "ES_JAVA_OPTS=-Xms8g -Xmx8g" elasticsearch:7.14.0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
<template> <template>
<div> <div :class="{'disable-animations': $store.state.optSimpleLightbox}">
<FsLightbox <FsLightbox
ref="lightbox"
:key="lightboxKey" :key="lightboxKey"
:toggler="showLightbox" :toggler="showLightbox"
:sources="lightboxSources" :sources="lightboxSources"
@ -10,7 +11,7 @@
:source-index="lightboxSlide" :source-index="lightboxSlide"
:custom-toolbar-buttons="customButtons" :custom-toolbar-buttons="customButtons"
:slideshow-time="$store.getters.optLightboxSlideDuration * 1000" :slideshow-time="$store.getters.optLightboxSlideDuration * 1000"
:zoom-increment="0.5" :zoom-increment="0.25"
:load-only-current-source="$store.getters.optLightboxLoadOnlyCurrent" :load-only-current-source="$store.getters.optLightboxLoadOnlyCurrent"
:on-close="onClose" :on-close="onClose"
:on-open="onShow" :on-open="onShow"
@ -29,6 +30,7 @@ export default {
components: {FsLightbox}, components: {FsLightbox},
data() { data() {
return { return {
disableAnimations: true,
customButtons: [ customButtons: [
{ {
viewBox: "0 0 384.928 384.928", viewBox: "0 0 384.928 384.928",
@ -64,7 +66,83 @@ export default {
return this.$store.getters["uiLightboxTypes"]; return this.$store.getters["uiLightboxTypes"];
} }
}, },
mounted() {
const listener = document.onkeydown;
document.onkeydown = (e) => {
const ret = this.keyDownListener(e)
if (listener && ret) {
return listener(e);
}
};
},
methods: { methods: {
keyDownListener(e) {
if (this.$refs.lightbox === undefined) {
return true;
}
const lightboxStore = this.$refs.lightbox.fsLightboxStore.slice(-1)[0];
switch (e.key) {
case " ": {
console.log("SPACE")
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
// Find video at current slide, toggle play/pause
[...document.getElementsByClassName("fslightbox-absoluted")].forEach(elem => {
if (elem.style.transform === "translate(0px)" || elem.style.transform === "translate(0px, 0px)") {
const vid = elem.getElementsByTagName("video")[0];
console.log(elem)
console.log(vid)
if (vid) {
if (vid.paused) {
vid.play();
console.log("PLAY")
} else {
vid.pause()
console.log("PAUSE")
}
}
}
return false;
});
return false;
}
case "ArrowUp":
case "k": {
if (!lightboxStore.data.isThumbing) {
lightboxStore.core.thumbsToggler.toggleThumbs();
}
return false;
}
case "ArrowDown":
case "j": {
if (lightboxStore.data.isThumbing) {
lightboxStore.core.thumbsToggler.toggleThumbs();
}
return false;
}
case "h": {
lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getPreviousSlideIndex());
break;
}
case "l": {
lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getNextSlideIndex());
return false;
}
}
return true;
},
onDownloadClick() { onDownloadClick() {
const url = this.lightboxSources[this.lightboxSlide]; const url = this.lightboxSources[this.lightboxSlide];
@ -125,4 +203,20 @@ export default {
.fslightbox-toolbar-button:nth-child(7) { .fslightbox-toolbar-button:nth-child(7) {
order: 7; order: 7;
} }
.disable-animations .fslightbox-container {
background: rgba(30,30,30,.9);
}
.disable-animations .fslightbox-transform-transition {
transition: none;
}
.disable-animations .fslightbox-fade-in-strong {
animation: none;
}
.fslightbox-container video, .fslightbox-container img {
cursor: unset !important;
}
</style> </style>

View File

@ -72,7 +72,8 @@ export default {
hideLegacy: "Hide the 'legacyES' Elasticsearch notice", hideLegacy: "Hide the 'legacyES' Elasticsearch notice",
updateMimeMap: "Update the Media Types tree in real time", updateMimeMap: "Update the Media Types tree in real time",
useDatePicker: "Use a Date Picker component rather than a slider", useDatePicker: "Use a Date Picker component rather than a slider",
vidPreviewInterval: "Video preview frame duration in ms" vidPreviewInterval: "Video preview frame duration in ms",
simpleLightbox: "Disable animations in image viewer",
}, },
queryMode: { queryMode: {
simple: "Simple", simple: "Simple",
@ -239,7 +240,8 @@ export default {
hideLegacy: "Masquer la notice 'legacyES' Elasticsearch", hideLegacy: "Masquer la notice 'legacyES' Elasticsearch",
updateMimeMap: "Mettre à jour l'arbre de Types de médias en temps réel", updateMimeMap: "Mettre à jour l'arbre de Types de médias en temps réel",
useDatePicker: "Afficher un composant « Date Picker » plutôt qu'un slider", useDatePicker: "Afficher un composant « Date Picker » plutôt qu'un slider",
vidPreviewInterval: "Durée des images d'aperçu video en millisecondes" vidPreviewInterval: "Durée des images d'aperçu video en millisecondes",
simpleLightbox: "Désactiver les animations du visualiseur d'images",
}, },
queryMode: { queryMode: {
simple: "Simple", simple: "Simple",
@ -406,7 +408,8 @@ export default {
hideLegacy: "隐藏'legacyES' Elasticsearch 通知", hideLegacy: "隐藏'legacyES' Elasticsearch 通知",
updateMimeMap: "媒体类型树的实时更新", updateMimeMap: "媒体类型树的实时更新",
useDatePicker: "使用日期选择器组件而不是滑块", useDatePicker: "使用日期选择器组件而不是滑块",
vidPreviewInterval: "视频预览帧的持续时间,以毫秒为单位" vidPreviewInterval: "视频预览帧的持续时间,以毫秒为单位",
simpleLightbox: "在图片查看器中,禁用动画",
}, },
queryMode: { queryMode: {
simple: "简单", simple: "简单",

View File

@ -51,6 +51,7 @@ export default new Vuex.Store({
optUpdateMimeMap: false, optUpdateMimeMap: false,
optUseDatePicker: false, optUseDatePicker: false,
optVidPreviewInterval: 700, optVidPreviewInterval: 700,
optSimpleLightbox: true,
_onLoadSelectedIndices: [] as string[], _onLoadSelectedIndices: [] as string[],
_onLoadSelectedMimeTypes: [] as string[], _onLoadSelectedMimeTypes: [] as string[],
@ -161,6 +162,7 @@ export default new Vuex.Store({
setOptUpdateMimeMap: (state, val) => state.optUpdateMimeMap = val, setOptUpdateMimeMap: (state, val) => state.optUpdateMimeMap = val,
setOptUseDatePicker: (state, val) => state.optUseDatePicker = val, setOptUseDatePicker: (state, val) => state.optUseDatePicker = val,
setOptVidPreviewInterval: (state, val) => state.optVidPreviewInterval = val, setOptVidPreviewInterval: (state, val) => state.optVidPreviewInterval = val,
setOptSimpleLightbox: (state, val) => state.optSimpleLightbox = val,
setOptLightboxLoadOnlyCurrent: (state, val) => state.optLightboxLoadOnlyCurrent = val, setOptLightboxLoadOnlyCurrent: (state, val) => state.optLightboxLoadOnlyCurrent = val,
setOptLightboxSlideDuration: (state, val) => state.optLightboxSlideDuration = val, setOptLightboxSlideDuration: (state, val) => state.optLightboxSlideDuration = val,
@ -378,5 +380,6 @@ export default new Vuex.Store({
optUpdateMimeMap: state => state.optUpdateMimeMap, optUpdateMimeMap: state => state.optUpdateMimeMap,
optUseDatePicker: state => state.optUseDatePicker, optUseDatePicker: state => state.optUseDatePicker,
optVidPreviewInterval: state => state.optVidPreviewInterval, optVidPreviewInterval: state => state.optVidPreviewInterval,
optSimpleLightbox: state => state.optSimpleLightbox,
} }
}) })

View File

@ -45,6 +45,11 @@
<b-form-checkbox :checked="optUseDatePicker" @input="setOptUseDatePicker"> <b-form-checkbox :checked="optUseDatePicker" @input="setOptUseDatePicker">
{{ $t("opt.useDatePicker") }} {{ $t("opt.useDatePicker") }}
</b-form-checkbox> </b-form-checkbox>
<b-form-checkbox :checked="optSimpleLightbox" @input="setOptSimpleLightbox">{{
$t("opt.simpleLightbox")
}}
</b-form-checkbox>
</b-card> </b-card>
<br/> <br/>
@ -239,6 +244,7 @@ export default {
"optUpdateMimeMap", "optUpdateMimeMap",
"optUseDatePicker", "optUseDatePicker",
"optVidPreviewInterval", "optVidPreviewInterval",
"optSimpleLightbox",
]), ]),
clientWidth() { clientWidth() {
return window.innerWidth; return window.innerWidth;
@ -285,6 +291,7 @@ export default {
"setOptUpdateMimeMap", "setOptUpdateMimeMap",
"setOptUseDatePicker", "setOptUseDatePicker",
"setOptVidPreviewInterval", "setOptVidPreviewInterval",
"setOptSimpleLightbox",
]), ]),
onResetClick() { onResetClick() {
localStorage.removeItem("sist2_configuration"); localStorage.removeItem("sist2_configuration");

View File

@ -60,7 +60,7 @@ static const char *const Version = VERSION;
#define SIST_PLATFORM unknown #define SIST_PLATFORM unknown
#endif #endif
#define EXPECTED_MONGOOSE_VERSION "7.3" #define EXPECTED_MONGOOSE_VERSION "7.6"
#define Q(x) #x #define Q(x) #x
#define QUOTE(x) Q(x) #define QUOTE(x) Q(x)

View File

@ -12,6 +12,13 @@
#define HTTP_TEXT_TYPE_HEADER "Content-Type: text/plain;charset=utf-8\r\n" #define HTTP_TEXT_TYPE_HEADER "Content-Type: text/plain;charset=utf-8\r\n"
#define HTTP_REPLY_NOT_FOUND mg_http_reply(nc, 404, HTTP_SERVER_HEADER HTTP_TEXT_TYPE_HEADER, "Not found"); #define HTTP_REPLY_NOT_FOUND mg_http_reply(nc, 404, HTTP_SERVER_HEADER HTTP_TEXT_TYPE_HEADER, "Not found");
static struct mg_http_serve_opts DefaultServeOpts = {
.fs = NULL,
.ssi_pattern = NULL,
.root_dir = NULL,
.mime_types = ""
};
static void send_response_line(struct mg_connection *nc, int status_code, size_t length, char *extra_headers) { static void send_response_line(struct mg_connection *nc, int status_code, size_t length, char *extra_headers) {
mg_printf( mg_printf(
@ -54,7 +61,7 @@ store_t *get_tag_store(const char *index_id) {
void search_index(struct mg_connection *nc, struct mg_http_message *hm) { void search_index(struct mg_connection *nc, struct mg_http_message *hm) {
if (WebCtx.dev) { if (WebCtx.dev) {
mg_http_serve_file(nc, hm, "sist2-vue/dist/index.html", "text/html", NULL); mg_http_serve_file(nc, hm, "sist2-vue/dist/index.html", &DefaultServeOpts);
} else { } else {
send_response_line(nc, 200, sizeof(index_html), "Content-Type: text/html"); send_response_line(nc, 200, sizeof(index_html), "Content-Type: text/html");
mg_send(nc, index_html, sizeof(index_html)); mg_send(nc, index_html, sizeof(index_html));
@ -104,12 +111,13 @@ void stats_files(struct mg_connection *nc, struct mg_http_message *hm) {
strcpy(full_path, index->path); strcpy(full_path, index->path);
strcat(full_path, file); strcat(full_path, file);
mg_http_serve_file(nc, hm, full_path, "text/csv", disposition); struct mg_http_serve_opts opts = {};
mg_http_serve_file(nc, hm, full_path, &opts);
} }
void javascript(struct mg_connection *nc, struct mg_http_message *hm) { void javascript(struct mg_connection *nc, struct mg_http_message *hm) {
if (WebCtx.dev) { if (WebCtx.dev) {
mg_http_serve_file(nc, hm, "sist2-vue/dist/js/index.js", "application/javascript", NULL); mg_http_serve_file(nc, hm, "sist2-vue/dist/js/index.js", &DefaultServeOpts);
} else { } else {
send_response_line(nc, 200, sizeof(index_js), "Content-Type: application/javascript"); send_response_line(nc, 200, sizeof(index_js), "Content-Type: application/javascript");
mg_send(nc, index_js, sizeof(index_js)); mg_send(nc, index_js, sizeof(index_js));
@ -118,7 +126,7 @@ void javascript(struct mg_connection *nc, struct mg_http_message *hm) {
void javascript_vendor(struct mg_connection *nc, struct mg_http_message *hm) { void javascript_vendor(struct mg_connection *nc, struct mg_http_message *hm) {
if (WebCtx.dev) { if (WebCtx.dev) {
mg_http_serve_file(nc, hm, "sist2-vue/dist/js/chunk-vendors.js", "application/javascript", NULL); mg_http_serve_file(nc, hm, "sist2-vue/dist/js/chunk-vendors.js", &DefaultServeOpts);
} else { } else {
send_response_line(nc, 200, sizeof(chunk_vendors_js), "Content-Type: application/javascript"); send_response_line(nc, 200, sizeof(chunk_vendors_js), "Content-Type: application/javascript");
mg_send(nc, chunk_vendors_js, sizeof(chunk_vendors_js)); mg_send(nc, chunk_vendors_js, sizeof(chunk_vendors_js));
@ -274,10 +282,18 @@ void serve_file_from_disk(cJSON *json, index_t *idx, struct mg_connection *nc, s
char disposition[8192]; char disposition[8192];
snprintf(disposition, sizeof(disposition), snprintf(disposition, sizeof(disposition),
HTTP_SERVER_HEADER "Content-Disposition: inline; filename=\"%s%s%s\"\r\nAccept-Ranges: bytes\r\n", HTTP_SERVER_HEADER "Content-Disposition: inline; filename=\"%s%s%s\"\r\n"
"Accept-Ranges: bytes\r\nCache-Control: no-store\r\n",
name, strlen(ext) == 0 ? "" : ".", ext); name, strlen(ext) == 0 ? "" : ".", ext);
mg_http_serve_file(nc, hm, full_path, mime, disposition); char mime_mapping[1024];
snprintf(mime_mapping, sizeof(mime_mapping), "%s=%s", ext, mime);
struct mg_http_serve_opts opts = {
.extra_headers = disposition,
.mime_types = mime_mapping
};
mg_http_serve_file(nc, hm, full_path, &opts);
} }
void cache_es_version() { void cache_es_version() {

File diff suppressed because one or more lines are too long