mirror of
https://github.com/simon987/sist2.git
synced 2025-12-15 00:09:12 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c762d0de08 |
@@ -1,31 +0,0 @@
|
|||||||
.idea/
|
|
||||||
*.sist2
|
|
||||||
docs/
|
|
||||||
test_i/
|
|
||||||
test_i_inc/
|
|
||||||
Testing/
|
|
||||||
.drone.yml
|
|
||||||
**/cmake_install.cmake
|
|
||||||
**/CMakeCache.txt
|
|
||||||
**/CMakeFiles/
|
|
||||||
LICENSE
|
|
||||||
Makefile
|
|
||||||
**/*.md
|
|
||||||
**/*.cbp
|
|
||||||
VERSION
|
|
||||||
**/node_modules/
|
|
||||||
.git/
|
|
||||||
sist2-*-linux-debug
|
|
||||||
sist2-*-linux
|
|
||||||
sist2_debug
|
|
||||||
sist2
|
|
||||||
**/libscan-test-files
|
|
||||||
**/scan_ub_test
|
|
||||||
**/scan_a_test
|
|
||||||
**/scan_test
|
|
||||||
**/ext_ffmpeg
|
|
||||||
**/ext_libmobi
|
|
||||||
**/ext_libwpd
|
|
||||||
**/core
|
|
||||||
*.a
|
|
||||||
tmp_scan/
|
|
||||||
88
.drone.yml
88
.drone.yml
@@ -1,88 +0,0 @@
|
|||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: amd64
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: simon987/sist2-build
|
|
||||||
commands:
|
|
||||||
- ./scripts/build.sh
|
|
||||||
- name: scp files
|
|
||||||
image: appleboy/drone-scp
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
from_secret: SSH_HOST
|
|
||||||
port:
|
|
||||||
from_secret: SSH_PORT
|
|
||||||
user:
|
|
||||||
from_secret: SSH_USER
|
|
||||||
key:
|
|
||||||
from_secret: SSH_KEY
|
|
||||||
target: /files/sist2/${DRONE_REPO_OWNER}_${DRONE_REPO_NAME}/${DRONE_BRANCH}_${DRONE_BUILD_NUMBER}_${DRONE_COMMIT}/
|
|
||||||
source:
|
|
||||||
- ./VERSION
|
|
||||||
- ./sist2-x64-linux
|
|
||||||
- ./sist2-x64-linux-debug
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: DOCKER_USER
|
|
||||||
password:
|
|
||||||
from_secret: DOCKER_PASSWORD
|
|
||||||
repo: simon987/sist2
|
|
||||||
context: ./
|
|
||||||
dockerfile: ./Dockerfile
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: x64-linux
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: arm64
|
|
||||||
|
|
||||||
platform:
|
|
||||||
arch: arm64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: simon987/sist2-build-arm64
|
|
||||||
commands:
|
|
||||||
- ./scripts/build_arm64.sh
|
|
||||||
- name: scp files
|
|
||||||
image: appleboy/drone-scp
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
from_secret: SSH_HOST
|
|
||||||
port:
|
|
||||||
from_secret: SSH_PORT
|
|
||||||
user:
|
|
||||||
from_secret: SSH_USER
|
|
||||||
key:
|
|
||||||
from_secret: SSH_KEY
|
|
||||||
target: /files/sist2/${DRONE_REPO_OWNER}_${DRONE_REPO_NAME}/arm_${DRONE_BRANCH}_${DRONE_BUILD_NUMBER}_${DRONE_COMMIT}/
|
|
||||||
source:
|
|
||||||
- ./sist2-arm64-linux
|
|
||||||
- ./sist2-arm64-linux-debug
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: DOCKER_USER
|
|
||||||
password:
|
|
||||||
from_secret: DOCKER_PASSWORD
|
|
||||||
repo: simon987/sist2
|
|
||||||
context: ./
|
|
||||||
dockerfile: ./Dockerfile.arm64
|
|
||||||
auto_tag: true
|
|
||||||
auto_tag_suffix: arm64-linux
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,3 +1,3 @@
|
|||||||
CMakeModules/* linguist-vendored
|
CMakeModules/* linguist-vendored
|
||||||
**/*_generated.c linguist-vendored
|
web/js/*.min.js linguist-vendored
|
||||||
**/*_generated.h linguist-vendored
|
web/css/*.min.css linguist-vendored
|
||||||
|
|||||||
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,40 +0,0 @@
|
|||||||
---
|
|
||||||
name: "🐞 Bug Report"
|
|
||||||
about: Submit a bug report
|
|
||||||
title: ''
|
|
||||||
labels: bug
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Device Information (please complete the following information):**
|
|
||||||
- OS: `[e.g., Ubuntu 20.04, WSL2]`
|
|
||||||
- Deployment: `[Linux, Linux ARM64 or Docker]`
|
|
||||||
- Browser *(if relevant)*: `[e.g., chrome, safari]`
|
|
||||||
- SIST2 Version: `[e.g., v2.9.0]`
|
|
||||||
- Elasticsearch Version *(if relevant)* : ``
|
|
||||||
|
|
||||||
**Command with arguments**
|
|
||||||
<!-- `ex: "scan ~/Documents -o ./i2 --threads 3 -q 1.0` -->
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
|
||||||
|
|
||||||
**Steps To Reproduce**
|
|
||||||
Please be specific!
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. etc.
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
<!-- A clear and concise description of what you expected to happen. -->
|
|
||||||
|
|
||||||
**Actual Behavior**
|
|
||||||
<!-- A clear and concise description of what actually happens. -->
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
<!-- Add any other context about the problem here. If applicable, please include why you think the bug is occurring and/or troubleshooting you have already performed. -->
|
|
||||||
<!-- If the issue is related to the `scan` module, please attach the files necessary to reproduce the error or email them to me[at]simon987.net. -->
|
|
||||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: SIST2 Documentation
|
|
||||||
url: https://github.com/simon987/sist2/blob/master/docs/USAGE.md
|
|
||||||
about: Check out the SIST2 documentation for answers to common questions
|
|
||||||
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
name: "🚀 Feature Request"
|
|
||||||
about: Suggest an idea for SIST2
|
|
||||||
title: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
**Which SIST2 component is your Feature Request related to?**
|
|
||||||
<!-- e.g., Scan, Index, or Web? -->
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
<!-- A clear and concise description of what the problem is. e.g., "I'm always frustrated when [...]" -->
|
|
||||||
|
|
||||||
**What would you like to see happen?**
|
|
||||||
<!-- A clear and concise description of what you want to happen. -->
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
<!-- Add any other context or screenshots about the feature request here. -->
|
|
||||||
18
.github/ISSUE_TEMPLATE/issue-template.md
vendored
18
.github/ISSUE_TEMPLATE/issue-template.md
vendored
@@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
name: Issue template
|
|
||||||
about: General
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
sist2 version:
|
|
||||||
|
|
||||||
Platform (Linux or Docker, x86-64 or arm64):
|
|
||||||
|
|
||||||
Elasticsearch version:
|
|
||||||
|
|
||||||
Command with arguments: `ex: "scan ~/Documents -o ./i2 --threads 3 -q 1.0`
|
|
||||||
|
|
||||||
If the issue is related to the `scan` module, please attach the files necessary to reproduce the error or email them to me[at]simon987.net.
|
|
||||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
.idea
|
.idea
|
||||||
thumbs
|
thumbs
|
||||||
|
test
|
||||||
*.cbp
|
*.cbp
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
@@ -9,20 +10,8 @@ Makefile
|
|||||||
*.out
|
*.out
|
||||||
LOG
|
LOG
|
||||||
sist2*
|
sist2*
|
||||||
!sist2-vue/
|
index.sist2/
|
||||||
*.sist2/
|
|
||||||
bundle*.css
|
bundle*.css
|
||||||
bundle.js
|
bundle.js
|
||||||
*.a
|
*.a
|
||||||
vgcore.*
|
vgcore.*
|
||||||
build/
|
|
||||||
third-party/argparse
|
|
||||||
*.idx/
|
|
||||||
VERSION
|
|
||||||
git_hash.h
|
|
||||||
Testing/
|
|
||||||
test_i
|
|
||||||
test_i_inc
|
|
||||||
node_modules/
|
|
||||||
.cmake/
|
|
||||||
i_inc/
|
|
||||||
30
.gitmodules
vendored
30
.gitmodules
vendored
@@ -1,12 +1,18 @@
|
|||||||
[submodule "third-party/argparse"]
|
[submodule "argparse"]
|
||||||
path = third-party/argparse
|
path = argparse
|
||||||
url = https://github.com/simon987/argparse
|
url = https://github.com/cofyc/argparse
|
||||||
[submodule "third-party/libscan/third-party/utf8.h"]
|
[submodule "cJSON"]
|
||||||
path = third-party/libscan/third-party/utf8.h
|
path = cJSON
|
||||||
url = https://github.com/sheredom/utf8.h
|
url = https://github.com/DaveGamble/cJSON
|
||||||
[submodule "third-party/libscan/third-party/antiword"]
|
[submodule "lib/mupdf"]
|
||||||
path = third-party/libscan/third-party/antiword
|
path = lib/mupdf
|
||||||
url = https://github.com/simon987/antiword
|
url = git://git.ghostscript.com/mupdf.git
|
||||||
[submodule "third-party/libscan/third-party/libmobi"]
|
[submodule "lib/onion"]
|
||||||
path = third-party/libscan/third-party/libmobi
|
path = lib/onion
|
||||||
url = https://github.com/bfabiszewski/libmobi
|
url = https://github.com/davidmoreno/onion
|
||||||
|
[submodule "lib/ffmpeg"]
|
||||||
|
path = lib/ffmpeg
|
||||||
|
url = https://git.ffmpeg.org/ffmpeg.git
|
||||||
|
[submodule "lmdb"]
|
||||||
|
path = lmdb
|
||||||
|
url = https://github.com/LMDB/lmdb
|
||||||
|
|||||||
338
CMakeLists.txt
338
CMakeLists.txt
@@ -1,154 +1,230 @@
|
|||||||
cmake_minimum_required(VERSION 3.7)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
|
option(WITH_SIST2 "Build main executable" ON)
|
||||||
|
option(WITH_SIST2_SCAN "Build scan executable" ON)
|
||||||
|
|
||||||
project(sist2 C)
|
project(sist2 C)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
|
||||||
|
|
||||||
option(SIST_DEBUG "Build a debug executable" on)
|
if (WITH_SIST2)
|
||||||
option(SIST_FAST "Enable more optimisation flags" off)
|
add_executable(
|
||||||
option(SIST_FAKE_STORE "Disable IO operations of LMDB stores for debugging purposes" 0)
|
|
||||||
|
|
||||||
add_compile_definitions(
|
|
||||||
"SIST_PLATFORM=${SIST_PLATFORM}"
|
|
||||||
)
|
|
||||||
|
|
||||||
if (SIST_DEBUG)
|
|
||||||
add_compile_definitions(
|
|
||||||
"SIST_DEBUG=${SIST_DEBUG}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(third-party/libscan)
|
|
||||||
set(ARGPARSE_SHARED off)
|
|
||||||
add_subdirectory(third-party/argparse)
|
|
||||||
|
|
||||||
add_executable(sist2
|
|
||||||
src/main.c
|
|
||||||
src/sist.h
|
|
||||||
src/io/walk.h src/io/walk.c
|
|
||||||
src/io/store.h src/io/store.c
|
|
||||||
src/tpool.h src/tpool.c
|
|
||||||
src/parsing/parse.h src/parsing/parse.c
|
|
||||||
src/io/serialize.h src/io/serialize.c
|
|
||||||
src/parsing/mime.h src/parsing/mime.c src/parsing/mime_generated.c
|
|
||||||
src/index/web.c src/index/web.h
|
|
||||||
src/web/serve.c src/web/serve.h
|
|
||||||
src/index/elastic.c src/index/elastic.h
|
|
||||||
src/util.c src/util.h
|
|
||||||
src/ctx.h src/types.h
|
|
||||||
src/log.c src/log.h
|
|
||||||
src/cli.c src/cli.h
|
|
||||||
src/stats.c src/stats.h src/ctx.c
|
|
||||||
src/parsing/sidecar.c src/parsing/sidecar.h
|
|
||||||
|
|
||||||
# argparse
|
|
||||||
third-party/argparse/argparse.h third-party/argparse/argparse.c
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_directories(sist2 PRIVATE BEFORE ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/)
|
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib)
|
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
|
|
||||||
pkg_search_module(GLIB REQUIRED glib-2.0)
|
|
||||||
|
|
||||||
find_package(lmdb CONFIG REQUIRED)
|
|
||||||
find_package(cJSON CONFIG REQUIRED)
|
|
||||||
find_package(unofficial-mongoose CONFIG REQUIRED)
|
|
||||||
find_package(CURL CONFIG REQUIRED)
|
|
||||||
find_library(MAGIC_LIB
|
|
||||||
NAMES libmagic.so.1 magic
|
|
||||||
PATHS /usr/lib/x86_64-linux-gnu/ /usr/lib/aarch64-linux-gnu/
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
target_include_directories(
|
|
||||||
sist2 PUBLIC
|
|
||||||
${CMAKE_SOURCE_DIR}/third-party/onion/src/
|
|
||||||
${CMAKE_SOURCE_DIR}/third-party/utf8.h/
|
|
||||||
${CMAKE_SOURCE_DIR}/third-party/libscan/
|
|
||||||
${CMAKE_SOURCE_DIR}/
|
|
||||||
${GLIB_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_options(
|
|
||||||
sist2
|
|
||||||
PRIVATE
|
|
||||||
-fPIC
|
|
||||||
)
|
|
||||||
|
|
||||||
if (SIST_DEBUG)
|
|
||||||
target_compile_options(
|
|
||||||
sist2
|
sist2
|
||||||
PRIVATE
|
src/main.c
|
||||||
-g
|
src/sist.h
|
||||||
-fstack-protector
|
src/io/walk.h src/io/walk.c
|
||||||
-fno-omit-frame-pointer
|
src/parsing/media.h src/parsing/media.c
|
||||||
-fsanitize=address
|
src/parsing/pdf.h src/parsing/pdf.c
|
||||||
-fno-inline
|
src/io/store.h src/io/store.c
|
||||||
# -O2
|
src/tpool.h src/tpool.c
|
||||||
)
|
src/parsing/parse.h src/parsing/parse.c
|
||||||
target_link_options(
|
src/io/serialize.h src/io/serialize.c
|
||||||
sist2
|
src/parsing/mime.h src/parsing/mime.c src/parsing/mime_generated.c
|
||||||
PRIVATE
|
src/parsing/text.h src/parsing/text.c
|
||||||
-fsanitize=address
|
src/index/web.c src/index/web.h
|
||||||
-static-libasan
|
src/web/serve.c src/web/serve.h
|
||||||
)
|
src/index/elastic.c src/index/elastic.h
|
||||||
set_target_properties(
|
src/util.c src/util.h
|
||||||
sist2
|
src/ctx.h src/types.h src/parsing/font.c src/parsing/font.h
|
||||||
PROPERTIES
|
|
||||||
OUTPUT_NAME sist2_debug
|
|
||||||
)
|
|
||||||
elseif (SIST_FAST)
|
|
||||||
target_compile_options(
|
|
||||||
sist2
|
|
||||||
PRIVATE
|
|
||||||
|
|
||||||
-Ofast
|
# argparse
|
||||||
-march=native
|
argparse/argparse.h argparse/argparse.c
|
||||||
-fno-stack-protector
|
|
||||||
-fomit-frame-pointer
|
|
||||||
-freciprocal-math
|
|
||||||
)
|
|
||||||
else ()
|
|
||||||
target_compile_options(
|
|
||||||
sist2
|
|
||||||
PRIVATE
|
|
||||||
|
|
||||||
-Ofast
|
# cJSON
|
||||||
-fno-stack-protector
|
cJSON/cJSON.h cJSON/cJSON.c
|
||||||
-fomit-frame-pointer
|
|
||||||
|
# LMDB
|
||||||
|
lmdb/libraries/liblmdb/lmdb.h lmdb/libraries/liblmdb/mdb.c
|
||||||
|
lmdb/libraries/liblmdb/midl.h lmdb/libraries/liblmdb/midl.c
|
||||||
|
src/cli.c src/cli.h
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_dependencies(
|
if (WITH_SIST2_SCAN)
|
||||||
sist2
|
add_executable(
|
||||||
scan
|
sist2_scan
|
||||||
argparse
|
src/main.c
|
||||||
)
|
src/sist.h
|
||||||
|
src/io/walk.h src/io/walk.c
|
||||||
|
src/parsing/media.h src/parsing/media.c
|
||||||
|
src/parsing/pdf.h src/parsing/pdf.c
|
||||||
|
src/io/store.h src/io/store.c
|
||||||
|
src/tpool.h src/tpool.c
|
||||||
|
src/parsing/parse.h src/parsing/parse.c
|
||||||
|
src/io/serialize.h src/io/serialize.c
|
||||||
|
src/parsing/mime.h src/parsing/mime.c src/parsing/mime_generated.c
|
||||||
|
src/parsing/text.h src/parsing/text.c
|
||||||
|
src/util.c src/util.h
|
||||||
|
src/ctx.h src/types.h src/parsing/font.c src/parsing/font.h
|
||||||
|
|
||||||
target_link_libraries(
|
# argparse
|
||||||
sist2
|
argparse/argparse.h argparse/argparse.c
|
||||||
|
|
||||||
z
|
# cJSON
|
||||||
lmdb
|
cJSON/cJSON.h cJSON/cJSON.c
|
||||||
cjson
|
|
||||||
argparse
|
|
||||||
${GLIB_LDFLAGS}
|
|
||||||
unofficial::mongoose::mongoose
|
|
||||||
CURL::libcurl
|
|
||||||
|
|
||||||
pthread
|
# LMDB
|
||||||
|
lmdb/libraries/liblmdb/lmdb.h lmdb/libraries/liblmdb/mdb.c
|
||||||
|
lmdb/libraries/liblmdb/midl.h lmdb/libraries/liblmdb/midl.c
|
||||||
|
src/cli.c src/cli.h
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
c
|
find_package(PkgConfig REQUIRED)
|
||||||
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig/")
|
||||||
|
|
||||||
scan
|
find_package(LibMagic REQUIRED)
|
||||||
|
find_package(FFmpeg REQUIRED)
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
find_package(Freetype REQUIRED)
|
||||||
|
|
||||||
${MAGIC_LIB}
|
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||||
)
|
pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
|
||||||
|
pkg_check_modules(UUID REQUIRED uuid)
|
||||||
|
|
||||||
|
add_definitions(${LIBMAGIC_CFLAGS_OTHER})
|
||||||
|
add_definitions(${UUID_CFLAGS_OTHER})
|
||||||
|
add_definitions(${GLIB_CFLAGS_OTHER})
|
||||||
|
add_definitions(${GOBJECT_CFLAGS_OTHER})
|
||||||
|
add_definitions(${FREETYPE_CFLAGS_OTHER})
|
||||||
|
|
||||||
|
list(REMOVE_ITEM GLIB_LIBRARIES pcre)
|
||||||
|
list(REMOVE_ITEM GOBJECT_LIBRARIES pcre)
|
||||||
|
list(REMOVE_ITEM UUID_LIBRARIES pcre)
|
||||||
|
|
||||||
|
if (WITH_SIST2)
|
||||||
|
target_include_directories(
|
||||||
|
sist2 PUBLIC
|
||||||
|
${LIBMAGIC_INCLUDE_DIRS}
|
||||||
|
${GOBJECT_INCLUDE_DIRS}
|
||||||
|
${OPENSSL_INCLUDE_DIR}
|
||||||
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
|
${GLIB_INCLUDE_DIRS}
|
||||||
|
${FREETYPE_INCLUDE_DIRS}
|
||||||
|
${UUID_INCLUDE_DIRS}
|
||||||
|
${PROJECT_SOURCE_DIR}/
|
||||||
|
${PROJECT_SOURCE_DIR}/lmdb/libraries/liblmdb/
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/onion/src/
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/mupdf/include/
|
||||||
|
)
|
||||||
|
target_link_directories(
|
||||||
|
sist2 PUBLIC
|
||||||
|
${UUID_LIBRARY_DIRS}
|
||||||
|
${FFMPEG_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
target_compile_options(sist2
|
||||||
|
PRIVATE
|
||||||
|
-O3
|
||||||
|
# -march=native
|
||||||
|
-fno-stack-protector
|
||||||
|
-fomit-frame-pointer
|
||||||
|
)
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(
|
||||||
|
sist2
|
||||||
|
|
||||||
|
${GLIB_LIBRARIES}
|
||||||
|
${GOBJECT_LIBRARIES}
|
||||||
|
${UUID_LIBRARIES}
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libavcodec.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libavformat.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libavutil.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libswscale.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libswresample.a
|
||||||
|
# ${FFMPEG_LIBRARIES}
|
||||||
|
# swscale
|
||||||
|
|
||||||
|
# mupdf
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libmupdf.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libmupdf-third.a
|
||||||
|
|
||||||
|
# onion
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libonion_static.a
|
||||||
|
|
||||||
|
pthread
|
||||||
|
curl
|
||||||
|
m
|
||||||
|
bz2
|
||||||
|
magic
|
||||||
|
)
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (WITH_SIST2_SCAN)
|
||||||
|
|
||||||
|
set_target_properties(
|
||||||
|
sist2_scan
|
||||||
|
PROPERTIES COMPILE_DEFINITIONS SIST_SCAN_ONLY
|
||||||
|
)
|
||||||
|
set_target_properties(
|
||||||
|
sist2_scan
|
||||||
|
PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS SIST_SCAN_ONLY
|
||||||
|
LINK_FLAGS -static
|
||||||
|
)
|
||||||
|
target_include_directories(
|
||||||
|
sist2_scan PUBLIC
|
||||||
|
${LIBMAGIC_INCLUDE_DIRS}
|
||||||
|
${GOBJECT_INCLUDE_DIRS}
|
||||||
|
${OPENSSL_INCLUDE_DIR}
|
||||||
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
|
${GLIB_INCLUDE_DIRS}
|
||||||
|
${UUID_INCLUDE_DIRS}
|
||||||
|
${FREETYPE_INCLUDE_DIRS}
|
||||||
|
${PROJECT_SOURCE_DIR}/
|
||||||
|
${PROJECT_SOURCE_DIR}/lmdb/libraries/liblmdb/
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/onion/src/
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/mupdf/include/
|
||||||
|
)
|
||||||
|
target_link_directories(
|
||||||
|
sist2_scan PUBLIC
|
||||||
|
${UUID_LIBRARY_DIRS}
|
||||||
|
${FFMPEG_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
target_compile_options(sist2_scan
|
||||||
|
PRIVATE
|
||||||
|
-O3
|
||||||
|
# -march=native
|
||||||
|
-fno-stack-protector
|
||||||
|
-fomit-frame-pointer
|
||||||
|
)
|
||||||
|
TARGET_LINK_LIBRARIES(
|
||||||
|
sist2_scan
|
||||||
|
|
||||||
|
${GLIB_LIBRARIES}
|
||||||
|
${GOBJECT_LIBRARIES}
|
||||||
|
${UUID_LIBRARIES}
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libavcodec.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libavformat.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libavutil.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libswscale.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libswresample.a
|
||||||
|
|
||||||
|
# mupdf
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libmupdf.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libmupdf-third.a
|
||||||
|
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libbz2.a
|
||||||
|
${PROJECT_SOURCE_DIR}/lib/libmagic.a
|
||||||
|
|
||||||
|
pthread
|
||||||
|
m
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
before_sist2
|
before_sist2
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/before_build.sh
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/before_build.sh
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(sist2 before_sist2)
|
IF (WITH_SIST2)
|
||||||
|
add_dependencies(sist2 before_sist2)
|
||||||
|
else ()
|
||||||
|
add_dependencies(sist2_scan before_sist2)
|
||||||
|
endif ()
|
||||||
|
|||||||
80
CMakeModules/FindFFmpeg.cmake
vendored
Normal file
80
CMakeModules/FindFFmpeg.cmake
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil)
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# FFMPEG_FOUND - system has ffmpeg or libav
|
||||||
|
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
|
||||||
|
# FFMPEG_LIBRARIES - Link these to use ffmpeg
|
||||||
|
# FFMPEG_LIBAVCODEC
|
||||||
|
# FFMPEG_LIBAVFORMAT
|
||||||
|
# FFMPEG_LIBAVUTIL
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
|
||||||
|
# Modified for other libraries by Lasse Kärkkäinen <tronic>
|
||||||
|
# Modified for Hedgewars by Stepik777
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
#
|
||||||
|
|
||||||
|
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||||
|
# in cache already
|
||||||
|
set(FFMPEG_FOUND TRUE)
|
||||||
|
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||||
|
# use pkg-config to get the directories and then use these values
|
||||||
|
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||||
|
find_package(PkgConfig)
|
||||||
|
if (PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
|
||||||
|
pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
|
||||||
|
pkg_check_modules(_FFMPEG_AVUTIL libavutil)
|
||||||
|
endif (PKG_CONFIG_FOUND)
|
||||||
|
|
||||||
|
find_path(FFMPEG_AVCODEC_INCLUDE_DIR
|
||||||
|
NAMES libavcodec/avcodec.h
|
||||||
|
PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
|
||||||
|
PATH_SUFFIXES ffmpeg libav
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FFMPEG_LIBAVCODEC
|
||||||
|
NAMES avcodec
|
||||||
|
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FFMPEG_LIBAVFORMAT
|
||||||
|
NAMES avformat
|
||||||
|
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(FFMPEG_LIBAVUTIL
|
||||||
|
NAMES avutil
|
||||||
|
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
|
||||||
|
set(FFMPEG_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (FFMPEG_FOUND)
|
||||||
|
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(FFMPEG_LIBRARIES
|
||||||
|
${FFMPEG_LIBAVCODEC}
|
||||||
|
${FFMPEG_LIBAVFORMAT}
|
||||||
|
${FFMPEG_LIBAVUTIL}
|
||||||
|
)
|
||||||
|
|
||||||
|
endif (FFMPEG_FOUND)
|
||||||
|
|
||||||
|
if (FFMPEG_FOUND)
|
||||||
|
if (NOT FFMPEG_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}")
|
||||||
|
endif (NOT FFMPEG_FIND_QUIETLY)
|
||||||
|
else (FFMPEG_FOUND)
|
||||||
|
if (FFMPEG_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil")
|
||||||
|
endif (FFMPEG_FIND_REQUIRED)
|
||||||
|
endif (FFMPEG_FOUND)
|
||||||
|
|
||||||
|
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
|
||||||
|
|
||||||
|
|
||||||
100
CMakeModules/FindLibMagic.cmake
vendored
Normal file
100
CMakeModules/FindLibMagic.cmake
vendored
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2013-2013, Lars Baehren <lbaehren@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
# are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# - Check for the presence of LIBMAGIC
|
||||||
|
#
|
||||||
|
# The following variables are set when LIBMAGIC is found:
|
||||||
|
# LIBMAGIC_FOUND = Set to true, if all components of LIBMAGIC have been
|
||||||
|
# found.
|
||||||
|
# LIBMAGIC_INCLUDES = Include path for the header files of LIBMAGIC
|
||||||
|
# LIBMAGIC_LIBRARIES = Link these to use LIBMAGIC
|
||||||
|
# LIBMAGIC_LFLAGS = Linker flags (optional)
|
||||||
|
|
||||||
|
if (NOT LIBMAGIC_FOUND)
|
||||||
|
|
||||||
|
if (NOT LIBMAGIC_ROOT_DIR)
|
||||||
|
set (LIBMAGIC_ROOT_DIR ${CMAKE_INSTALL_PREFIX})
|
||||||
|
endif (NOT LIBMAGIC_ROOT_DIR)
|
||||||
|
|
||||||
|
##____________________________________________________________________________
|
||||||
|
## Check for the header files
|
||||||
|
|
||||||
|
find_path (LIBMAGIC_FILE_H
|
||||||
|
NAMES file/file.h
|
||||||
|
HINTS ${LIBMAGIC_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
)
|
||||||
|
if (LIBMAGIC_FILE_H)
|
||||||
|
list (APPEND LIBMAGIC_INCLUDES ${LIBMAGIC_FILE_H})
|
||||||
|
endif (LIBMAGIC_FILE_H)
|
||||||
|
|
||||||
|
find_path (LIBMAGIC_MAGIC_H
|
||||||
|
NAMES magic.h
|
||||||
|
HINTS ${LIBMAGIC_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}
|
||||||
|
PATH_SUFFIXES include include/linux
|
||||||
|
)
|
||||||
|
if (LIBMAGIC_MAGIC_H)
|
||||||
|
list (APPEND LIBMAGIC_INCLUDES ${LIBMAGIC_MAGIC_H})
|
||||||
|
endif (LIBMAGIC_MAGIC_H)
|
||||||
|
|
||||||
|
list (REMOVE_DUPLICATES LIBMAGIC_INCLUDES)
|
||||||
|
|
||||||
|
##____________________________________________________________________________
|
||||||
|
## Check for the library
|
||||||
|
|
||||||
|
find_library (LIBMAGIC_LIBRARIES magic
|
||||||
|
HINTS ${LIBMAGIC_ROOT_DIR} ${CMAKE_INSTALL_PREFIX}
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
)
|
||||||
|
|
||||||
|
##____________________________________________________________________________
|
||||||
|
## Actions taken when all components have been found
|
||||||
|
|
||||||
|
#find_package_handle_standard_args (LIBMAGIC DEFAULT_MSG LIBMAGIC_LIBRARIES LIBMAGIC_INCLUDES)
|
||||||
|
|
||||||
|
if (LIBMAGIC_FOUND)
|
||||||
|
if (NOT LIBMAGIC_FIND_QUIETLY)
|
||||||
|
message (STATUS "Found components for LIBMAGIC")
|
||||||
|
message (STATUS "LIBMAGIC_ROOT_DIR = ${LIBMAGIC_ROOT_DIR}")
|
||||||
|
message (STATUS "LIBMAGIC_INCLUDES = ${LIBMAGIC_INCLUDES}")
|
||||||
|
message (STATUS "LIBMAGIC_LIBRARIES = ${LIBMAGIC_LIBRARIES}")
|
||||||
|
endif (NOT LIBMAGIC_FIND_QUIETLY)
|
||||||
|
else (LIBMAGIC_FOUND)
|
||||||
|
if (LIBMAGIC_FIND_REQUIRED)
|
||||||
|
message (FATAL_ERROR "Could not find LIBMAGIC!")
|
||||||
|
endif (LIBMAGIC_FIND_REQUIRED)
|
||||||
|
endif (LIBMAGIC_FOUND)
|
||||||
|
|
||||||
|
##____________________________________________________________________________
|
||||||
|
## Mark advanced variables
|
||||||
|
|
||||||
|
mark_as_advanced (
|
||||||
|
LIBMAGIC_ROOT_DIR
|
||||||
|
LIBMAGIC_INCLUDES
|
||||||
|
LIBMAGIC_LIBRARIES
|
||||||
|
)
|
||||||
|
|
||||||
|
endif (NOT LIBMAGIC_FOUND)
|
||||||
478
CMakeModules/FindOpenSSL.cmake
vendored
Normal file
478
CMakeModules/FindOpenSSL.cmake
vendored
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
|
||||||
|
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
|
||||||
|
(("${ssl_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") OR
|
||||||
|
("${crypto_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")))
|
||||||
|
set(_OpenSSL_has_dependencies TRUE)
|
||||||
|
find_package(Threads)
|
||||||
|
else()
|
||||||
|
set(_OpenSSL_has_dependencies FALSE)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
function(_OpenSSL_add_dependencies libraries_var library)
|
||||||
|
if(CMAKE_THREAD_LIBS_INIT)
|
||||||
|
list(APPEND ${libraries_var} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
endif()
|
||||||
|
list(APPEND ${libraries_var} ${CMAKE_DL_LIBS})
|
||||||
|
set(${libraries_var} ${${libraries_var}} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(_OpenSSL_target_add_dependencies target)
|
||||||
|
if(_OpenSSL_has_dependencies)
|
||||||
|
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads )
|
||||||
|
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS} )
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
pkg_check_modules(_OPENSSL QUIET openssl)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
|
||||||
|
if(OPENSSL_USE_STATIC_LIBS)
|
||||||
|
set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
if(WIN32)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
else()
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
# http://www.slproweb.com/products/Win32OpenSSL.html
|
||||||
|
set(_OPENSSL_ROOT_HINTS
|
||||||
|
${OPENSSL_ROOT_DIR}
|
||||||
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
|
||||||
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
|
||||||
|
ENV OPENSSL_ROOT_DIR
|
||||||
|
)
|
||||||
|
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||||
|
set(_OPENSSL_ROOT_PATHS
|
||||||
|
"${_programfiles}/OpenSSL"
|
||||||
|
"${_programfiles}/OpenSSL-Win32"
|
||||||
|
"${_programfiles}/OpenSSL-Win64"
|
||||||
|
"C:/OpenSSL/"
|
||||||
|
"C:/OpenSSL-Win32/"
|
||||||
|
"C:/OpenSSL-Win64/"
|
||||||
|
)
|
||||||
|
unset(_programfiles)
|
||||||
|
else ()
|
||||||
|
set(_OPENSSL_ROOT_HINTS
|
||||||
|
${OPENSSL_ROOT_DIR}
|
||||||
|
ENV OPENSSL_ROOT_DIR
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(_OPENSSL_ROOT_HINTS_AND_PATHS
|
||||||
|
HINTS ${_OPENSSL_ROOT_HINTS}
|
||||||
|
PATHS ${_OPENSSL_ROOT_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(OPENSSL_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
openssl/ssl.h
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
HINTS
|
||||||
|
${_OPENSSL_INCLUDEDIR}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32 AND NOT CYGWIN)
|
||||||
|
if(MSVC)
|
||||||
|
# /MD and /MDd are the standard values - if someone wants to use
|
||||||
|
# others, the libnames have to change here too
|
||||||
|
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
|
||||||
|
# enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL)
|
||||||
|
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
|
||||||
|
# * MD for dynamic-release
|
||||||
|
# * MDd for dynamic-debug
|
||||||
|
# * MT for static-release
|
||||||
|
# * MTd for static-debug
|
||||||
|
|
||||||
|
# Implementation details:
|
||||||
|
# We are using the libraries located in the VC subdir instead of the parent directory even though :
|
||||||
|
# libeay32MD.lib is identical to ../libeay32.lib, and
|
||||||
|
# ssleay32MD.lib is identical to ../ssleay32.lib
|
||||||
|
# enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
|
||||||
|
|
||||||
|
if (OPENSSL_MSVC_STATIC_RT)
|
||||||
|
set(_OPENSSL_MSVC_RT_MODE "MT")
|
||||||
|
else ()
|
||||||
|
set(_OPENSSL_MSVC_RT_MODE "MD")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib
|
||||||
|
if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" )
|
||||||
|
set(_OPENSSL_MSVC_ARCH_SUFFIX "64")
|
||||||
|
else()
|
||||||
|
set(_OPENSSL_MSVC_ARCH_SUFFIX "32")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OPENSSL_USE_STATIC_LIBS)
|
||||||
|
set(_OPENSSL_PATH_SUFFIXES
|
||||||
|
"lib/VC/static"
|
||||||
|
"VC/static"
|
||||||
|
"lib"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(_OPENSSL_PATH_SUFFIXES
|
||||||
|
"lib/VC"
|
||||||
|
"VC"
|
||||||
|
"lib"
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
find_library(LIB_EAY_DEBUG
|
||||||
|
NAMES
|
||||||
|
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||||
|
libcrypto${_OPENSSL_MSVC_RT_MODE}d
|
||||||
|
libcryptod
|
||||||
|
libeay32${_OPENSSL_MSVC_RT_MODE}d
|
||||||
|
libeay32d
|
||||||
|
cryptod
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
${_OPENSSL_PATH_SUFFIXES}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(LIB_EAY_RELEASE
|
||||||
|
NAMES
|
||||||
|
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||||
|
libcrypto${_OPENSSL_MSVC_RT_MODE}
|
||||||
|
libcrypto
|
||||||
|
libeay32${_OPENSSL_MSVC_RT_MODE}
|
||||||
|
libeay32
|
||||||
|
crypto
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
${_OPENSSL_PATH_SUFFIXES}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(SSL_EAY_DEBUG
|
||||||
|
NAMES
|
||||||
|
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||||
|
libssl${_OPENSSL_MSVC_RT_MODE}d
|
||||||
|
libssld
|
||||||
|
ssleay32${_OPENSSL_MSVC_RT_MODE}d
|
||||||
|
ssleay32d
|
||||||
|
ssld
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
${_OPENSSL_PATH_SUFFIXES}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(SSL_EAY_RELEASE
|
||||||
|
NAMES
|
||||||
|
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||||
|
libssl${_OPENSSL_MSVC_RT_MODE}
|
||||||
|
libssl
|
||||||
|
ssleay32${_OPENSSL_MSVC_RT_MODE}
|
||||||
|
ssleay32
|
||||||
|
ssl
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
${_OPENSSL_PATH_SUFFIXES}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
|
||||||
|
set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
|
||||||
|
set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
|
||||||
|
set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||||
|
select_library_configurations(LIB_EAY)
|
||||||
|
select_library_configurations(SSL_EAY)
|
||||||
|
|
||||||
|
mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
|
||||||
|
SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
|
||||||
|
set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} )
|
||||||
|
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} )
|
||||||
|
elseif(MINGW)
|
||||||
|
# same player, for MinGW
|
||||||
|
set(LIB_EAY_NAMES crypto libeay32)
|
||||||
|
set(SSL_EAY_NAMES ssl ssleay32)
|
||||||
|
find_library(LIB_EAY
|
||||||
|
NAMES
|
||||||
|
${LIB_EAY_NAMES}
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"lib/MinGW"
|
||||||
|
"lib"
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(SSL_EAY
|
||||||
|
NAMES
|
||||||
|
${SSL_EAY_NAMES}
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"lib/MinGW"
|
||||||
|
"lib"
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(SSL_EAY LIB_EAY)
|
||||||
|
set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
|
||||||
|
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
|
||||||
|
unset(LIB_EAY_NAMES)
|
||||||
|
unset(SSL_EAY_NAMES)
|
||||||
|
else()
|
||||||
|
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
|
||||||
|
find_library(LIB_EAY
|
||||||
|
NAMES
|
||||||
|
libcrypto
|
||||||
|
libeay32
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
HINTS
|
||||||
|
${_OPENSSL_LIBDIR}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(SSL_EAY
|
||||||
|
NAMES
|
||||||
|
libssl
|
||||||
|
ssleay32
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
HINTS
|
||||||
|
${_OPENSSL_LIBDIR}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(SSL_EAY LIB_EAY)
|
||||||
|
set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
|
||||||
|
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
|
||||||
|
find_library(OPENSSL_SSL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
ssl
|
||||||
|
ssleay32
|
||||||
|
ssleay32MD
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
HINTS
|
||||||
|
${_OPENSSL_LIBDIR}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(OPENSSL_CRYPTO_LIBRARY
|
||||||
|
NAMES
|
||||||
|
crypto
|
||||||
|
NAMES_PER_DIR
|
||||||
|
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||||
|
HINTS
|
||||||
|
${_OPENSSL_LIBDIR}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# compat defines
|
||||||
|
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
|
||||||
|
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
_OpenSSL_test_and_find_dependencies("${OPENSSL_SSL_LIBRARY}" "${OPENSSL_CRYPTO_LIBRARY}")
|
||||||
|
if(_OpenSSL_has_dependencies)
|
||||||
|
_OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES "${OPENSSL_SSL_LIBRARY}" )
|
||||||
|
_OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES "${OPENSSL_CRYPTO_LIBRARY}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
function(from_hex HEX DEC)
|
||||||
|
string(TOUPPER "${HEX}" HEX)
|
||||||
|
set(_res 0)
|
||||||
|
string(LENGTH "${HEX}" _strlen)
|
||||||
|
|
||||||
|
while (_strlen GREATER 0)
|
||||||
|
math(EXPR _res "${_res} * 16")
|
||||||
|
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
|
||||||
|
string(SUBSTRING "${HEX}" 1 -1 HEX)
|
||||||
|
if (NIBBLE STREQUAL "A")
|
||||||
|
math(EXPR _res "${_res} + 10")
|
||||||
|
elseif (NIBBLE STREQUAL "B")
|
||||||
|
math(EXPR _res "${_res} + 11")
|
||||||
|
elseif (NIBBLE STREQUAL "C")
|
||||||
|
math(EXPR _res "${_res} + 12")
|
||||||
|
elseif (NIBBLE STREQUAL "D")
|
||||||
|
math(EXPR _res "${_res} + 13")
|
||||||
|
elseif (NIBBLE STREQUAL "E")
|
||||||
|
math(EXPR _res "${_res} + 14")
|
||||||
|
elseif (NIBBLE STREQUAL "F")
|
||||||
|
math(EXPR _res "${_res} + 15")
|
||||||
|
else()
|
||||||
|
math(EXPR _res "${_res} + ${NIBBLE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(LENGTH "${HEX}" _strlen)
|
||||||
|
endwhile()
|
||||||
|
|
||||||
|
set(${DEC} ${_res} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
|
||||||
|
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
|
||||||
|
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
|
||||||
|
|
||||||
|
if(openssl_version_str)
|
||||||
|
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
|
||||||
|
# The status gives if this is a developer or prerelease and is ignored here.
|
||||||
|
# Major, minor, and fix directly translate into the version numbers shown in
|
||||||
|
# the string. The patch field translates to the single character suffix that
|
||||||
|
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
|
||||||
|
# on.
|
||||||
|
|
||||||
|
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
|
||||||
|
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
|
||||||
|
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
|
||||||
|
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
|
||||||
|
from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
|
||||||
|
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
|
||||||
|
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
|
||||||
|
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
|
||||||
|
|
||||||
|
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
|
||||||
|
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
|
||||||
|
# 96 is the ASCII code of 'a' minus 1
|
||||||
|
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
|
||||||
|
unset(_tmp)
|
||||||
|
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
|
||||||
|
# this should be updated to handle that, too. This has not happened yet
|
||||||
|
# so it is simply ignored here for now.
|
||||||
|
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} )
|
||||||
|
list(REMOVE_DUPLICATES OPENSSL_LIBRARIES)
|
||||||
|
|
||||||
|
foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
|
||||||
|
if(_comp STREQUAL "Crypto")
|
||||||
|
if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
|
||||||
|
(EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
|
||||||
|
EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
|
||||||
|
EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
|
||||||
|
)
|
||||||
|
set(OpenSSL_${_comp}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(OpenSSL_${_comp}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
elseif(_comp STREQUAL "SSL")
|
||||||
|
if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
|
||||||
|
(EXISTS "${OPENSSL_SSL_LIBRARY}" OR
|
||||||
|
EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR
|
||||||
|
EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
|
||||||
|
)
|
||||||
|
set(OpenSSL_${_comp}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(OpenSSL_${_comp}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "${_comp} is not a valid OpenSSL component")
|
||||||
|
set(OpenSSL_${_comp}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
unset(_comp)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||||
|
find_package_handle_standard_args(OpenSSL
|
||||||
|
REQUIRED_VARS
|
||||||
|
OPENSSL_CRYPTO_LIBRARY
|
||||||
|
OPENSSL_INCLUDE_DIR
|
||||||
|
VERSION_VAR
|
||||||
|
OPENSSL_VERSION
|
||||||
|
HANDLE_COMPONENTS
|
||||||
|
FAIL_MESSAGE
|
||||||
|
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
|
||||||
|
|
||||||
|
if(OPENSSL_FOUND)
|
||||||
|
if(NOT TARGET OpenSSL::Crypto AND
|
||||||
|
(EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
|
||||||
|
EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
|
||||||
|
EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
|
||||||
|
)
|
||||||
|
add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
|
||||||
|
if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
|
||||||
|
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
|
||||||
|
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
||||||
|
IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}")
|
||||||
|
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
_OpenSSL_target_add_dependencies(OpenSSL::Crypto)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET OpenSSL::SSL AND
|
||||||
|
(EXISTS "${OPENSSL_SSL_LIBRARY}" OR
|
||||||
|
EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR
|
||||||
|
EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
|
||||||
|
)
|
||||||
|
add_library(OpenSSL::SSL UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
|
||||||
|
if(EXISTS "${OPENSSL_SSL_LIBRARY}")
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||||
|
IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
|
||||||
|
set_property(TARGET OpenSSL::SSL APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
||||||
|
IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}")
|
||||||
|
set_property(TARGET OpenSSL::SSL APPEND PROPERTY
|
||||||
|
IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
if(TARGET OpenSSL::Crypto)
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||||
|
endif()
|
||||||
|
_OpenSSL_target_add_dependencies(OpenSSL::SSL)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Restore the original find library ordering
|
||||||
|
if(OPENSSL_USE_STATIC_LIBS)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
endif()
|
||||||
268
CMakeModules/FindPackageHandleStandardArgs.cmake
vendored
Normal file
268
CMakeModules/FindPackageHandleStandardArgs.cmake
vendored
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
|
||||||
|
|
||||||
|
# internal helper macro
|
||||||
|
macro(_FPHSA_FAILURE_MESSAGE _msg)
|
||||||
|
set (__msg "${_msg}")
|
||||||
|
if (FPHSA_REASON_FAILURE_MESSAGE)
|
||||||
|
string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n")
|
||||||
|
endif()
|
||||||
|
if (${_NAME}_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "${__msg}")
|
||||||
|
else ()
|
||||||
|
if (NOT ${_NAME}_FIND_QUIETLY)
|
||||||
|
message(STATUS "${__msg}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
# internal helper macro to generate the failure message when used in CONFIG_MODE:
|
||||||
|
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||||
|
# <PackageName>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
|
||||||
|
if(${_NAME}_CONFIG)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
|
||||||
|
else()
|
||||||
|
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
|
||||||
|
# List them all in the error message:
|
||||||
|
if(${_NAME}_CONSIDERED_CONFIGS)
|
||||||
|
set(configsText "")
|
||||||
|
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
|
||||||
|
math(EXPR configsCount "${configsCount} - 1")
|
||||||
|
foreach(currentConfigIndex RANGE ${configsCount})
|
||||||
|
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
|
||||||
|
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
|
||||||
|
string(APPEND configsText "\n ${filename} (version ${version})")
|
||||||
|
endforeach()
|
||||||
|
if (${_NAME}_NOT_FOUND_MESSAGE)
|
||||||
|
if (FPHSA_REASON_FAILURE_MESSAGE)
|
||||||
|
string(PREPEND FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}\n ")
|
||||||
|
else()
|
||||||
|
set(FPHSA_REASON_FAILURE_MESSAGE "${${_NAME}_NOT_FOUND_MESSAGE}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
string(APPEND configsText "\n")
|
||||||
|
endif()
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:${configsText}")
|
||||||
|
|
||||||
|
else()
|
||||||
|
# Simple case: No Config-file was found at all:
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
|
||||||
|
|
||||||
|
# Set up the arguments for `cmake_parse_arguments`.
|
||||||
|
set(options CONFIG_MODE HANDLE_COMPONENTS)
|
||||||
|
set(oneValueArgs FAIL_MESSAGE REASON_FAILURE_MESSAGE VERSION_VAR FOUND_VAR)
|
||||||
|
set(multiValueArgs REQUIRED_VARS)
|
||||||
|
|
||||||
|
# Check whether we are in 'simple' or 'extended' mode:
|
||||||
|
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
|
||||||
|
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
|
||||||
|
|
||||||
|
if(${INDEX} EQUAL -1)
|
||||||
|
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
|
||||||
|
set(FPHSA_REQUIRED_VARS ${ARGN})
|
||||||
|
set(FPHSA_VERSION_VAR)
|
||||||
|
else()
|
||||||
|
cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
|
||||||
|
|
||||||
|
if(FPHSA_UNPARSED_ARGUMENTS)
|
||||||
|
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FPHSA_FAIL_MESSAGE)
|
||||||
|
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# In config-mode, we rely on the variable <PackageName>_CONFIG, which is set by find_package()
|
||||||
|
# when it successfully found the config-file, including version checking:
|
||||||
|
if(FPHSA_CONFIG_MODE)
|
||||||
|
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
|
||||||
|
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
|
||||||
|
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT FPHSA_REQUIRED_VARS)
|
||||||
|
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# now that we collected all arguments, process them
|
||||||
|
|
||||||
|
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
|
||||||
|
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
|
||||||
|
|
||||||
|
string(TOUPPER ${_NAME} _NAME_UPPER)
|
||||||
|
string(TOLOWER ${_NAME} _NAME_LOWER)
|
||||||
|
|
||||||
|
if(FPHSA_FOUND_VAR)
|
||||||
|
if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
|
||||||
|
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# collect all variables which were not found, so they can be printed, so the
|
||||||
|
# user knows better what went wrong (#6375)
|
||||||
|
set(MISSING_VARS "")
|
||||||
|
set(DETAILS "")
|
||||||
|
# check if all passed variables are valid
|
||||||
|
set(FPHSA_FOUND_${_NAME} TRUE)
|
||||||
|
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
|
||||||
|
if(NOT ${_CURRENT_VAR})
|
||||||
|
set(FPHSA_FOUND_${_NAME} FALSE)
|
||||||
|
string(APPEND MISSING_VARS " ${_CURRENT_VAR}")
|
||||||
|
else()
|
||||||
|
string(APPEND DETAILS "[${${_CURRENT_VAR}}]")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
if(FPHSA_FOUND_${_NAME})
|
||||||
|
set(${_NAME}_FOUND TRUE)
|
||||||
|
set(${_NAME_UPPER}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(${_NAME}_FOUND FALSE)
|
||||||
|
set(${_NAME_UPPER}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# component handling
|
||||||
|
unset(FOUND_COMPONENTS_MSG)
|
||||||
|
unset(MISSING_COMPONENTS_MSG)
|
||||||
|
|
||||||
|
if(FPHSA_HANDLE_COMPONENTS)
|
||||||
|
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||||
|
if(${_NAME}_${comp}_FOUND)
|
||||||
|
|
||||||
|
if(NOT DEFINED FOUND_COMPONENTS_MSG)
|
||||||
|
set(FOUND_COMPONENTS_MSG "found components:")
|
||||||
|
endif()
|
||||||
|
string(APPEND FOUND_COMPONENTS_MSG " ${comp}")
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
if(NOT DEFINED MISSING_COMPONENTS_MSG)
|
||||||
|
set(MISSING_COMPONENTS_MSG "missing components:")
|
||||||
|
endif()
|
||||||
|
string(APPEND MISSING_COMPONENTS_MSG " ${comp}")
|
||||||
|
|
||||||
|
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||||
|
set(${_NAME}_FOUND FALSE)
|
||||||
|
string(APPEND MISSING_VARS " ${comp}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
|
||||||
|
string(APPEND DETAILS "[c${COMPONENT_MSG}]")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# version handling:
|
||||||
|
set(VERSION_MSG "")
|
||||||
|
set(VERSION_OK TRUE)
|
||||||
|
|
||||||
|
# check with DEFINED here as the requested or found version may be "0"
|
||||||
|
if (DEFINED ${_NAME}_FIND_VERSION)
|
||||||
|
if(DEFINED ${FPHSA_VERSION_VAR})
|
||||||
|
set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
|
||||||
|
|
||||||
|
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
|
||||||
|
# count the dots in the version string
|
||||||
|
string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}")
|
||||||
|
# add one dot because there is one dot more than there are components
|
||||||
|
string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
|
||||||
|
if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
|
||||||
|
# Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
|
||||||
|
# is at most 4 here. Therefore a simple lookup table is used.
|
||||||
|
if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
|
||||||
|
set(_VERSION_REGEX "[^.]*")
|
||||||
|
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
|
||||||
|
set(_VERSION_REGEX "[^.]*\\.[^.]*")
|
||||||
|
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
|
||||||
|
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
|
||||||
|
else ()
|
||||||
|
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
|
||||||
|
endif ()
|
||||||
|
string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}")
|
||||||
|
unset(_VERSION_REGEX)
|
||||||
|
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
|
||||||
|
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
|
||||||
|
endif ()
|
||||||
|
unset(_VERSION_HEAD)
|
||||||
|
else ()
|
||||||
|
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION)
|
||||||
|
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
unset(_VERSION_DOTS)
|
||||||
|
|
||||||
|
else() # minimum version specified:
|
||||||
|
if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION)
|
||||||
|
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
set(VERSION_OK FALSE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
endif ()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
# if the package was not found, but a version was given, add that to the output:
|
||||||
|
if(${_NAME}_FIND_VERSION_EXACT)
|
||||||
|
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
else()
|
||||||
|
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
else ()
|
||||||
|
# Check with DEFINED as the found version may be 0.
|
||||||
|
if(DEFINED ${FPHSA_VERSION_VAR})
|
||||||
|
set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")")
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(VERSION_OK)
|
||||||
|
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
|
||||||
|
else()
|
||||||
|
set(${_NAME}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# print the result:
|
||||||
|
if (${_NAME}_FOUND)
|
||||||
|
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
|
||||||
|
else ()
|
||||||
|
|
||||||
|
if(FPHSA_CONFIG_MODE)
|
||||||
|
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
|
||||||
|
else()
|
||||||
|
if(NOT VERSION_OK)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
|
||||||
|
else()
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
|
||||||
|
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
48
CMakeModules/FindPackageMessage.cmake
vendored
Normal file
48
CMakeModules/FindPackageMessage.cmake
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#[=======================================================================[.rst:
|
||||||
|
FindPackageMessage
|
||||||
|
------------------
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
find_package_message(<name> "message for user" "find result details")
|
||||||
|
|
||||||
|
This function is intended to be used in FindXXX.cmake modules files.
|
||||||
|
It will print a message once for each unique find result. This is
|
||||||
|
useful for telling the user where a package was found. The first
|
||||||
|
argument specifies the name (XXX) of the package. The second argument
|
||||||
|
specifies the message to display. The third argument lists details
|
||||||
|
about the find result so that if they change the message will be
|
||||||
|
displayed again. The macro also obeys the QUIET argument to the
|
||||||
|
find_package command.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
.. code-block:: cmake
|
||||||
|
|
||||||
|
if(X11_FOUND)
|
||||||
|
find_package_message(X11 "Found X11: ${X11_X11_LIB}"
|
||||||
|
"[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
|
||||||
|
else()
|
||||||
|
...
|
||||||
|
endif()
|
||||||
|
#]=======================================================================]
|
||||||
|
|
||||||
|
function(find_package_message pkg msg details)
|
||||||
|
# Avoid printing a message repeatedly for the same find result.
|
||||||
|
if(NOT ${pkg}_FIND_QUIETLY)
|
||||||
|
string(REPLACE "\n" "" details "${details}")
|
||||||
|
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
|
||||||
|
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
|
||||||
|
# The message has not yet been printed.
|
||||||
|
message(STATUS "${msg}")
|
||||||
|
|
||||||
|
# Save the find details in the cache to avoid printing the same
|
||||||
|
# message again.
|
||||||
|
set("${DETAILS_VAR}" "${details}"
|
||||||
|
CACHE INTERNAL "Details about finding ${pkg}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
28
Dockerfile
28
Dockerfile
@@ -1,28 +0,0 @@
|
|||||||
FROM simon987/sist2-build as build
|
|
||||||
MAINTAINER simon987 <me@simon987.net>
|
|
||||||
|
|
||||||
WORKDIR /build/
|
|
||||||
COPY . .
|
|
||||||
RUN cmake -DSIST_PLATFORM=x64_linux -DSIST_DEBUG=off -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake .
|
|
||||||
RUN make -j$(nproc)
|
|
||||||
RUN strip sist2 || mv sist2_debug sist2
|
|
||||||
|
|
||||||
FROM --platform="linux/amd64" ubuntu:21.10
|
|
||||||
|
|
||||||
RUN apt update && apt install -y curl libasan5 libmagic1 && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN mkdir -p /usr/share/tessdata && \
|
|
||||||
cd /usr/share/tessdata/ && \
|
|
||||||
curl -o /usr/share/tessdata/hin.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/hin.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/jpn.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/jpn.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/eng.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/eng.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/fra.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/fra.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/rus.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/rus.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/spa.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/spa.traineddata
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/sist2"]
|
|
||||||
|
|
||||||
ENV LANG C.UTF-8
|
|
||||||
ENV LC_ALL C.UTF-8
|
|
||||||
|
|
||||||
COPY --from=build /build/sist2 /root/sist2
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
FROM simon987/sist2-build-arm64 as build
|
|
||||||
MAINTAINER simon987 <me@simon987.net>
|
|
||||||
|
|
||||||
WORKDIR /build/
|
|
||||||
ADD . /build/
|
|
||||||
RUN cmake -DSIST_PLATFORM=arm64_linux -DSIST_DEBUG=off -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake .
|
|
||||||
RUN make -j$(nproc)
|
|
||||||
RUN strip sist2
|
|
||||||
|
|
||||||
FROM --platform="linux/arm64/v8" ubuntu:21.10
|
|
||||||
|
|
||||||
RUN apt update && apt install -y curl libasan5 && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN mkdir -p /usr/share/tessdata && \
|
|
||||||
cd /usr/share/tessdata/ && \
|
|
||||||
curl -o /usr/share/tessdata/hin.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/hin.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/jpn.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/jpn.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/eng.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/eng.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/fra.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/fra.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/rus.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/rus.traineddata &&\
|
|
||||||
curl -o /usr/share/tessdata/spa.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/spa.traineddata
|
|
||||||
|
|
||||||
ENV LANG C.UTF-8
|
|
||||||
ENV LC_ALL C.UTF-8
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/sist2"]
|
|
||||||
|
|
||||||
COPY --from=build /build/sist2 /root/sist2
|
|
||||||
176
README.md
176
README.md
@@ -1,8 +1,5 @@
|
|||||||

|

|
||||||
[](https://www.codefactor.io/repository/github/simon987/sist2)
|
[](https://www.codefactor.io/repository/github/simon987/sist2)
|
||||||
[](https://files.simon987.net/.gate/sist2/simon987_sist2/)
|
|
||||||
|
|
||||||
**Demo**: [sist2.simon987.net](https://sist2.simon987.net/)
|
|
||||||
|
|
||||||
# sist2
|
# sist2
|
||||||
|
|
||||||
@@ -10,152 +7,89 @@ sist2 (Simple incremental search tool)
|
|||||||
|
|
||||||
*Warning: sist2 is in early development*
|
*Warning: sist2 is in early development*
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Fast, low memory usage, multi-threaded
|
* Fast, low memory usage
|
||||||
* Mobile-friendly Web interface
|
|
||||||
* Portable (all its features are packaged in a single executable)
|
* Portable (all its features are packaged in a single executable)
|
||||||
* Extracts text and metadata from common file types \*
|
* Extracts text from common file types\*
|
||||||
* Generates thumbnails \*
|
* Generates thumbnails\*
|
||||||
* Incremental scanning
|
* Incremental scanning
|
||||||
* Manual tagging from the UI and automatic tagging based on file attributes via [user scripts](docs/scripting.md)
|
|
||||||
* Recursive scan inside archive files \*\*
|
|
||||||
* OCR support with tesseract \*\*\*
|
|
||||||
* Stats page & disk utilisation visualization
|
|
||||||
|
|
||||||
\* See [format support](#format-support)
|
|
||||||
\*\* See [Archive files](#archive-files)
|
|
||||||
\*\*\* See [OCR](#ocr)
|
|
||||||
|
|
||||||

|
\* See [format support](#format-support)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
1. Have an Elasticsearch (>= 6.8.X, ideally >=7.14.0) instance running
|
1. Have an [Elasticsearch](https://www.elastic.co/downloads/elasticsearch) instance running
|
||||||
1. Download [from official website](https://www.elastic.co/downloads/elasticsearch)
|
1. Download the [latest sist2 release](https://github.com/simon987/sist2/releases)
|
||||||
1. *(or)* Run using docker:
|
|
||||||
```bash
|
|
||||||
docker run -d -p 9200:9200 -e "discovery.type=single-node" elasticsearch:7.14.0
|
|
||||||
```
|
|
||||||
1. *(or)* Run using docker-compose:
|
|
||||||
```yaml
|
|
||||||
elasticsearch:
|
|
||||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
|
|
||||||
environment:
|
|
||||||
- discovery.type=single-node
|
|
||||||
- "ES_JAVA_OPTS=-Xms1G -Xmx2G"
|
|
||||||
```
|
|
||||||
1. Download sist2 executable
|
|
||||||
1. Download the [latest sist2 release](https://github.com/simon987/sist2/releases).
|
|
||||||
Select the file corresponding to your CPU architecture and mark the binary as executable with `chmod +x` *
|
|
||||||
2. *(or)* Download a [development snapshot](https://files.simon987.net/.gate/sist2/simon987_sist2/) *(Not
|
|
||||||
recommended!)*
|
|
||||||
3. *(or)* `docker pull simon987/sist2:2.12.1-x64-linux`
|
|
||||||
|
|
||||||
1. See [Usage guide](docs/USAGE.md)
|
*Windows users*: `sist2` runs under [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)
|
||||||
|
|
||||||
|
*Mac users*: See [#1](https://github.com/simon987/sist2/issues/1)
|
||||||
|
|
||||||
\* *Windows users*: **sist2** runs under [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux)
|
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
See [Usage guide](docs/USAGE.md) for more details
|

|
||||||
|
|
||||||
1. Scan a directory: `sist2 scan ~/Documents -o ./docs_idx`
|
See help page `sist2 --help` for more details.
|
||||||
1. Push index to Elasticsearch: `sist2 index ./docs_idx`
|
|
||||||
1. Start web interface: `sist2 web ./docs_idx`
|
**Scan a directory**
|
||||||
|
```bash
|
||||||
|
sist2 scan ~/Documents -o ./orig_idx/
|
||||||
|
sist2 scan --threads 4 --content-size 16384 /mnt/Pictures
|
||||||
|
sist2 scan --incremental ./orig_idx/ -o ./updated_idx/ ~/Documents
|
||||||
|
```
|
||||||
|
|
||||||
|
**Push index to Elasticsearch or file**
|
||||||
|
```bash
|
||||||
|
sist2 index --force-reset ./my_idx
|
||||||
|
sist2 index --print ./my_idx > raw_documents.ndjson
|
||||||
|
```
|
||||||
|
|
||||||
|
**Start web interface**
|
||||||
|
```bash
|
||||||
|
sist2 web --bind 0.0.0.0 --port 4321 ./my_idx1 ./my_idx2 ./my_idx3
|
||||||
|
```
|
||||||
|
|
||||||
## Format support
|
## Format support
|
||||||
|
|
||||||
| File type | Library | Content | Thumbnail | Metadata |
|
File type | Library | Content | Thumbnail | Metadata
|
||||||
|:--------------------------------------------------------------------------|:-----------------------------------------------------------------------------|:---------|:------------|:---------------------------------------------------------------------------------------------------------------------------------------|
|
:---|:---|:---|:---|:---
|
||||||
| pdf,xps,fb2,epub | MuPDF | text+ocr | yes | author, title |
|
pdf,xps,cbz,cbr,fb2,epub | MuPDF | yes | yes, `png` | *planned* |
|
||||||
| cbz,cbr | [libscan](https://github.com/simon987/sist2/tree/master/third-party/libscan) | - | yes | - |
|
`audio/*` | libav | - | yes, `jpeg` | ID3 tags |
|
||||||
| `audio/*` | ffmpeg | - | yes | ID3 tags |
|
`video/*` | libav | - | yes, `jpeg` | *planned* |
|
||||||
| `video/*` | ffmpeg | - | yes | title, comment, artist |
|
`image/*` | libav | - | yes, `jpeg` | *planned* |
|
||||||
| `image/*` | ffmpeg | ocr | yes | [Common EXIF tags](https://github.com/simon987/sist2/blob/efdde2734eca9b14a54f84568863b7ffd59bdba3/src/parsing/media.c#L190), GPS tags |
|
ttf,ttc,cff,woff,fnt,otf | Freetype2 | - | yes, `bmp` | Name & style |
|
||||||
| raw, rw2, dng, cr2, crw, dcr, k25, kdc, mrw, pef, xf3, arw, sr2, srf, erf | LibRaw | no | yes | Common EXIF tags, GPS tags |
|
`text/plain` | *(none)* | yes | no | - |
|
||||||
| ttf,ttc,cff,woff,fnt,otf | Freetype2 | - | yes, `bmp` | Name & style |
|
docx, xlsx, pptx | | *planned* | no | *planned* |
|
||||||
| `text/plain` | [libscan](https://github.com/simon987/sist2/tree/master/third-party/libscan) | yes | no | - |
|
|
||||||
| html, xml | [libscan](https://github.com/simon987/sist2/tree/master/third-party/libscan) | yes | no | - |
|
|
||||||
| tar, zip, rar, 7z, ar ... | Libarchive | yes\* | - | no |
|
|
||||||
| docx, xlsx, pptx | [libscan](https://github.com/simon987/sist2/tree/master/third-party/libscan) | yes | if embedded | creator, modified_by, title |
|
|
||||||
| doc (MS Word 97-2003) | antiword | yes | yes | author, title |
|
|
||||||
| mobi, azw, azw3 | libmobi | yes | no | author, title |
|
|
||||||
| wpd (WordPerfect) | libwpd | yes | no | *planned* |
|
|
||||||
| json, jsonl, ndjson | [libscan](https://github.com/simon987/sist2/tree/master/third-party/libscan) | yes | - | - |
|
|
||||||
|
|
||||||
\* *See [Archive files](#archive-files)*
|
|
||||||
|
|
||||||
### Archive files
|
|
||||||
|
|
||||||
**sist2** will scan files stored into archive files (zip, tar, 7z...) as if they were directly in the file system.
|
|
||||||
Recursive (archives inside archives)
|
|
||||||
scan is also supported.
|
|
||||||
|
|
||||||
**Limitations**:
|
|
||||||
|
|
||||||
* Support for parsing media files with formats that require *seek* (e.g. `.gif`, `.mp4` w/ fragmented metadata etc.)
|
|
||||||
is limitted (see `--mem-buffer` option)
|
|
||||||
* Archive files are scanned sequentially, by a single thread. On systems where
|
|
||||||
**sist2** is not I/O bound, scans might be faster when larger archives are split into smaller parts.
|
|
||||||
|
|
||||||
### OCR
|
|
||||||
|
|
||||||
You can enable OCR support for ebook (pdf,xps,fb2,epub) or image file types with the
|
|
||||||
`--ocr-lang <lang>` option in combination with `--ocr-images` and/or `--ocr-ebooks`.
|
|
||||||
Download the language data files with your package manager (`apt install tesseract-ocr-eng`) or
|
|
||||||
directly [from Github](https://github.com/tesseract-ocr/tesseract/wiki/Data-Files).
|
|
||||||
|
|
||||||
The `simon987/sist2` image comes with common languages
|
|
||||||
(hin, jpn, eng, fra, rus, spa) pre-installed.
|
|
||||||
|
|
||||||
You can use the `+` separator to specify multiple languages. The language
|
|
||||||
name must be identical to the `*.traineddata` file installed on your system
|
|
||||||
(use `chi_sim` rather than `chi-sim`).
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sist2 scan --ocr-ebooks --ocr-lang jpn ~/Books/Manga/
|
|
||||||
sist2 scan --ocr-images --ocr-lang eng ~/Images/Screenshots/
|
|
||||||
sist2 scan --ocr-ebooks --ocr-images --ocr-lang eng+chi_sim ~/Chinese-Bilingual/
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build from source
|
## Build from source
|
||||||
|
|
||||||
You can compile **sist2** by yourself if you don't want to use the pre-compiled binaries
|
You can compile **sist2** by yourself if you don't want to use the pre-compiled
|
||||||
|
binaries.
|
||||||
### With docker (recommended)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone --recursive https://github.com/simon987/sist2/
|
|
||||||
cd sist2
|
|
||||||
docker build . -f ./Dockerfile -t my-sist2-image
|
|
||||||
docker run --rm --entrypoint cat my-sist2-image /root/sist2 > sist2-x64-linux
|
|
||||||
```
|
|
||||||
|
|
||||||
### On a linux computer
|
|
||||||
|
|
||||||
1. Install compile-time dependencies
|
1. Install compile-time dependencies
|
||||||
|
|
||||||
```bash
|
*(Debian)*
|
||||||
apt install gcc g++ python3 yasm ragel automake autotools-dev wget libtool libssl-dev curl zip unzip tar xorg-dev libglu1-mesa-dev libxcursor-dev libxml2-dev libxinerama-dev gettext nasm git
|
```bash
|
||||||
|
apt install git cmake pkg-config libglib2.0-dev\
|
||||||
|
libssl-dev uuid-dev libavformat-dev libswscale-dev \
|
||||||
|
python3 libmagic-dev libfreetype6-dev libcurl-dev \
|
||||||
|
libbz2-dev yasm
|
||||||
```
|
```
|
||||||
|
*(FreeBSD)*
|
||||||
1. Apply vcpkg patches, as per [sist2-build](https://github.com/simon987/sist2-build) Dockerfile
|
|
||||||
|
|
||||||
1. Install vcpkg dependencies
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
vcpkg install curl[core,openssl]
|
pkg install cmake gcc yasm gmake bash ffmpeg e2fsprogs-uuid
|
||||||
vcpkg install lmdb cjson glib brotli libarchive[core,bzip2,libxml2,lz4,lzma,lzo] pthread tesseract libxml2 libmupdf gtest mongoose libmagic libraw jasper lcms gumbo
|
```
|
||||||
```
|
__
|
||||||
|
2. Build
|
||||||
1. Build
|
|
||||||
```bash
|
```bash
|
||||||
git clone --recursive https://github.com/simon987/sist2/
|
git clone --recurse-submodules https://github.com/simon987/sist2
|
||||||
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE=<VCPKG_ROOT>/scripts/buildsystems/vcpkg.cmake .
|
./scripts/get_static_libs.sh
|
||||||
|
cmake .
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
1
argparse
Submodule
1
argparse
Submodule
Submodule argparse added at fafc503d23
1
cJSON
Submodule
1
cJSON
Submodule
Submodule cJSON added at 2de7d04aaf
@@ -1,7 +0,0 @@
|
|||||||
install:
|
|
||||||
install sist2-update-all.sh /usr/bin/sist2-update-all.sh
|
|
||||||
install sist2-update-files.sh /usr/bin/sist2-update-files.sh
|
|
||||||
install sist2-update-nextcloud.sh /usr/bin/sist2-update-nextcloud.sh
|
|
||||||
install sist2-update.service /etc/systemd/system/sist2-update.service
|
|
||||||
install sist2-update.timer /etc/systemd/system/sist2-update.timer
|
|
||||||
systemctl daemon-reload
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# Systemd integration example
|
|
||||||
|
|
||||||
This example contains my (yatli) personal configuration for sist2 auto-updating.
|
|
||||||
The following indices are involved in this configuration:
|
|
||||||
|
|
||||||
| Index | Path | Description |
|
|
||||||
|-----------|------------------|--------------------------------------------|
|
|
||||||
| files | /zpool/files | Main file repository |
|
|
||||||
| nextcloud | /zpool/nextcloud | Externally synchronized to a cloud account |
|
|
||||||
|
|
||||||
The systemd integration achieves automatic sist2 scanning & indexing everyday at 3:00AM.
|
|
||||||
|
|
||||||
### Tailoring the configuration for yourself
|
|
||||||
|
|
||||||
`sist2-update-all.sh` calls update scripts for each sist2 index. Add or remove
|
|
||||||
update scripts accordingly to suit your need. Each update script (e.g.
|
|
||||||
`sist2-update-files.sh`) has important parameters laid down at the beginning so
|
|
||||||
make sure to edit them to point to your files and index locations.
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# install the services and scripts
|
|
||||||
sudo make install
|
|
||||||
# enable & start the timer
|
|
||||||
sudo systemctl enable sist2-update.timer
|
|
||||||
sudo systemctl start sist2-update.timer
|
|
||||||
# verify that the timer has been enabled
|
|
||||||
systemctl list-timers --all
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
echo "Update index: Files"
|
|
||||||
source ${__dir}/sist2-update-files.sh
|
|
||||||
echo "Update index: Nextcloud"
|
|
||||||
source ${__dir}/sist2-update-nextcloud.sh
|
|
||||||
echo "Done. Restarting sist2."
|
|
||||||
docker restart sist2-sist2-1
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
DATE=$(date +%Y_%m_%d)
|
|
||||||
CONTENT=/zpool/files
|
|
||||||
ORIG=/mnt/ssd/sist-index/files.idx
|
|
||||||
NEW=/mnt/ssd/sist-index/files_$DATE.idx
|
|
||||||
EXCLUDE='ZArchives|TorrentStore|TorrentDownload|624f0c59-1fef-44f6-95e9-7483296f2833|ubuntu-full-2021-12-07'
|
|
||||||
NAME=Files
|
|
||||||
#REWRITE_URL="http://localhost:33333/activate?collection=$NAME&path="
|
|
||||||
REWRITE_URL=""
|
|
||||||
|
|
||||||
sist2 scan \
|
|
||||||
--threads 14 \
|
|
||||||
--mem-throttle 32768 \
|
|
||||||
--quality 1.0 \
|
|
||||||
--name $NAME \
|
|
||||||
--ocr-lang=eng+chi_sim \
|
|
||||||
--ocr-ebooks \
|
|
||||||
--ocr-images \
|
|
||||||
--exclude=$EXCLUDE \
|
|
||||||
--rewrite-url=$REWRITE_URL \
|
|
||||||
--incremental=$ORIG \
|
|
||||||
--output=$NEW \
|
|
||||||
$CONTENT
|
|
||||||
echo ">>> Scan complete"
|
|
||||||
rm -rf $ORIG
|
|
||||||
mv $NEW $ORIG
|
|
||||||
|
|
||||||
unset http_proxy
|
|
||||||
unset https_proxy
|
|
||||||
unset HTTP_PROXY
|
|
||||||
unset HTTPS_PROXY
|
|
||||||
sist2 index $ORIG --incremental-index
|
|
||||||
echo ">>> Index complete"
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
DATE=$(date +%Y_%m_%d)
|
|
||||||
CONTENT=/zpool/nextcloud/v-yadli
|
|
||||||
ORIG=/mnt/ssd/sist-index/nextcloud.idx
|
|
||||||
NEW=/mnt/ssd/sist-index/nextcloud_$DATE.idx
|
|
||||||
EXCLUDE='Yatao|.*263418493\\/Image\\/.*'
|
|
||||||
NAME=NextCloud
|
|
||||||
# REWRITE_URL="http://localhost:33333/activate?collection=$NAME&path="
|
|
||||||
REWRITE_URL=""
|
|
||||||
|
|
||||||
sist2 scan \
|
|
||||||
--threads 14 \
|
|
||||||
--mem-throttle 32768 \
|
|
||||||
--quality 1.0 \
|
|
||||||
--name $NAME \
|
|
||||||
--ocr-lang=eng+chi_sim \
|
|
||||||
--ocr-ebooks \
|
|
||||||
--ocr-images \
|
|
||||||
--exclude=$EXCLUDE \
|
|
||||||
--rewrite-url=$REWRITE_URL \
|
|
||||||
--incremental=$ORIG \
|
|
||||||
--output=$NEW \
|
|
||||||
$CONTENT
|
|
||||||
echo ">>> Scan complete"
|
|
||||||
rm -rf $ORIG
|
|
||||||
mv $NEW $ORIG
|
|
||||||
|
|
||||||
unset http_proxy
|
|
||||||
unset https_proxy
|
|
||||||
unset HTTP_PROXY
|
|
||||||
unset HTTPS_PROXY
|
|
||||||
sist2 index $ORIG --incremental-index
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=sist2-update
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=yatli
|
|
||||||
ExecStart=/bin/bash /usr/bin/sist2-update-all.sh
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=sist2-update
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=*-*-* 3:00:00
|
|
||||||
Persistent=true
|
|
||||||
Unit=sist2-update.service
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
372
docs/USAGE.md
372
docs/USAGE.md
@@ -1,372 +0,0 @@
|
|||||||
# Usage
|
|
||||||
|
|
||||||
*More examples (specifically with docker/compose) are in progress*
|
|
||||||
|
|
||||||
* [scan](#scan)
|
|
||||||
* [options](#scan-options)
|
|
||||||
* [examples](#scan-examples)
|
|
||||||
* [index format](#index-format)
|
|
||||||
* [index](#index)
|
|
||||||
* [options](#index-options)
|
|
||||||
* [examples](#index-examples)
|
|
||||||
* [web](#web)
|
|
||||||
* [options](#web-options)
|
|
||||||
* [examples](#web-examples)
|
|
||||||
* [rewrite_url](#rewrite_url)
|
|
||||||
* [elasticsearch](#elasticsearch)
|
|
||||||
* [exec-script](#exec-script)
|
|
||||||
* [tagging](#tagging)
|
|
||||||
* [sidecar files](#sidecar-files)
|
|
||||||
|
|
||||||
```
|
|
||||||
Usage: sist2 scan [OPTION]... PATH
|
|
||||||
or: sist2 index [OPTION]... INDEX
|
|
||||||
or: sist2 web [OPTION]... INDEX...
|
|
||||||
or: sist2 exec-script [OPTION]... INDEX
|
|
||||||
Lightning-fast file system indexer and search tool.
|
|
||||||
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
-v, --version Show version and exit
|
|
||||||
--verbose Turn on logging
|
|
||||||
--very-verbose Turn on debug messages
|
|
||||||
|
|
||||||
Scan options
|
|
||||||
-t, --threads=<int> Number of threads. DEFAULT=1
|
|
||||||
--mem-throttle=<int> Total memory threshold in MiB for scan throttling. DEFAULT=0
|
|
||||||
-q, --thumbnail-quality=<flt> Thumbnail quality, on a scale of 1.0 to 31.0, 1.0 being the best. DEFAULT=1
|
|
||||||
--thumbnail-size=<int> Thumbnail size, in pixels. DEFAULT=500
|
|
||||||
--thumbnail-count=<int> Number of thumbnails to generate. Set a value > 1 to create video previews, set to 0 to disable thumbnails. DEFAULT=1
|
|
||||||
--content-size=<int> Number of bytes to be extracted from text documents. Set to 0 to disable. DEFAULT=32768
|
|
||||||
--incremental=<str> Reuse an existing index and only scan modified files.
|
|
||||||
-o, --output=<str> Output directory. DEFAULT=index.sist2/
|
|
||||||
--rewrite-url=<str> Serve files from this url instead of from disk.
|
|
||||||
--name=<str> Index display name. DEFAULT: (name of the directory)
|
|
||||||
--depth=<int> Scan up to DEPTH subdirectories deep. Use 0 to only scan files in PATH. DEFAULT: -1
|
|
||||||
--archive=<str> Archive file mode (skip|list|shallow|recurse). skip: Don't parse, list: only get file names as text, shallow: Don't parse archives inside archives. DEFAULT: recurse
|
|
||||||
--archive-passphrase=<str> Passphrase for encrypted archive files
|
|
||||||
--ocr-lang=<str> Tesseract language (use 'tesseract --list-langs' to see which are installed on your machine)
|
|
||||||
--ocr-images Enable OCR'ing of image files.
|
|
||||||
--ocr-ebooks Enable OCR'ing of ebook files.
|
|
||||||
-e, --exclude=<str> Files that match this regex will not be scanned
|
|
||||||
--fast Only index file names & mime type
|
|
||||||
--treemap-threshold=<str> Relative size threshold for treemap (see USAGE.md). DEFAULT: 0.0005
|
|
||||||
--mem-buffer=<int> Maximum memory buffer size per thread in MiB for files inside archives (see USAGE.md). DEFAULT: 2000
|
|
||||||
--read-subtitles Read subtitles from media files.
|
|
||||||
--fast-epub Faster but less accurate EPUB parsing (no thumbnails, metadata)
|
|
||||||
--checksums Calculate file checksums when scanning.
|
|
||||||
--list-file=<str> Specify a list of newline-delimited paths to be scanned instead of normal directory traversal. Use '-' to read from stdin.
|
|
||||||
|
|
||||||
Index options
|
|
||||||
-t, --threads=<int> Number of threads. DEFAULT=1
|
|
||||||
--es-url=<str> Elasticsearch url with port. DEFAULT=http://localhost:9200
|
|
||||||
--es-index=<str> Elasticsearch index name. DEFAULT=sist2
|
|
||||||
-p, --print Just print JSON documents to stdout.
|
|
||||||
--incremental-index Conduct incremental indexing, assumes that the old index is already digested by Elasticsearch.
|
|
||||||
--script-file=<str> Path to user script.
|
|
||||||
--mappings-file=<str> Path to Elasticsearch mappings.
|
|
||||||
--settings-file=<str> Path to Elasticsearch settings.
|
|
||||||
--async-script Execute user script asynchronously.
|
|
||||||
--batch-size=<int> Index batch size. DEFAULT: 100
|
|
||||||
-f, --force-reset Reset Elasticsearch mappings and settings. (You must use this option the first time you use the index command)
|
|
||||||
|
|
||||||
Web options
|
|
||||||
--es-url=<str> Elasticsearch url. DEFAULT=http://localhost:9200
|
|
||||||
--es-index=<str> Elasticsearch index name. DEFAULT=sist2
|
|
||||||
--bind=<str> Listen on this address. DEFAULT=localhost:4090
|
|
||||||
--auth=<str> Basic auth in user:password format
|
|
||||||
--tag-auth=<str> Basic auth in user:password format for tagging
|
|
||||||
--tagline=<str> Tagline in navbar
|
|
||||||
--dev Serve html & js files from disk (for development)
|
|
||||||
--lang=<str> Default UI language. Can be changed by the user
|
|
||||||
|
|
||||||
Exec-script options
|
|
||||||
--es-url=<str> Elasticsearch url. DEFAULT=http://localhost:9200
|
|
||||||
--es-index=<str> Elasticsearch index name. DEFAULT=sist2
|
|
||||||
--script-file=<str> Path to user script.
|
|
||||||
--async-script Execute user script asynchronously.
|
|
||||||
Made by simon987 <me@simon987.net>. Released under GPL-3.0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Scan
|
|
||||||
|
|
||||||
### Scan options
|
|
||||||
|
|
||||||
* `-t, --threads`
|
|
||||||
Number of threads for file parsing. **Do not set a number higher than `$(nproc)` or `$(Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors` in Windows!**
|
|
||||||
* `--mem-throttle`
|
|
||||||
Total memory threshold in MiB for scan throttling. Worker threads will not start a new parse job
|
|
||||||
until the total memory usage of sist2 is below this threshold. Set to 0 to disable. DEFAULT=0
|
|
||||||
* `-q, --thumbnail-quality`
|
|
||||||
Thumbnail quality, on a scale of 1.0 to 31.0, 1.0 being the best.
|
|
||||||
* `--thumbnail-size`
|
|
||||||
Thumbnail size in pixels.
|
|
||||||
* `--thumbnail-count`
|
|
||||||
Maximum number of thumbnails to generate. When set to a value >= 2, thumbnails for video previews
|
|
||||||
will be generated. The actual number of thumbnails generated depends on the length of the video (maximum 1 image
|
|
||||||
every ~7s). Set to 0 to completely disable thumbnails.
|
|
||||||
* `--content-size`
|
|
||||||
Number of bytes of text to be extracted from the content of files (plain text, PDFs etc.).
|
|
||||||
Repeated whitespace and special characters do not count toward this limit.
|
|
||||||
Set to 0 to completely disable content parsing.
|
|
||||||
* `--incremental`
|
|
||||||
Specify an existing index. Information about files in this index that were not modified (based on *mtime* attribute)
|
|
||||||
will be copied to the new index and will not be parsed again.
|
|
||||||
* `-o, --output` Output directory.
|
|
||||||
* `--rewrite-url` Set the `rewrite_url` option for the web module (See [rewrite_url](#rewrite_url))
|
|
||||||
* `--name` Set the `name` option for the web module
|
|
||||||
* `--depth` Maximum scan dept. Set to 0 only scan files directly in the root directory, set to -1 for infinite depth
|
|
||||||
* `--archive` Archive file mode.
|
|
||||||
* skip: Don't parse
|
|
||||||
* list: Only get file names as text
|
|
||||||
* shallow: Don't parse archives inside archives.
|
|
||||||
* recurse: Scan archives recursively (default)
|
|
||||||
* `--ocr-lang`, `--ocr-ebooks`, `--ocr-images` See [OCR](../README.md#OCR)
|
|
||||||
* `-e, --exclude` Regex pattern to exclude files. A file is excluded if the pattern matches any
|
|
||||||
part of the full absolute path.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
* `-e ".*\.ttf"`: Ignore ttf files
|
|
||||||
* `-e ".*\.(ttf|rar)"`: Ignore ttf and rar files
|
|
||||||
* `-e "^/mnt/backups/"`: Ignore all files in the `/mnt/backups/` directory
|
|
||||||
* `-e "^/mnt/Data[12]/"`: Ignore all files in the `/mnt/Data1/` and `/mnt/Data2/` directory
|
|
||||||
* `-e "(^/usr/)|(^/var/)|(^/media/DRIVE-A/tmp/)|(^/media/DRIVE-B/Trash/)"` Exclude the
|
|
||||||
`/usr`, `/var`, `/media/DRIVE-A/tmp`, `/media/DRIVE-B/Trash` directories
|
|
||||||
* `--fast` Only index file names and mime type
|
|
||||||
* `--treemap-threshold` Directories smaller than (`treemap-threshold` * `<total size of the index>`)
|
|
||||||
will not be considered for the disk utilisation visualization; their size will be added to
|
|
||||||
the parent directory. If the parent directory is still smaller than the threshold, it will also be "merged upwards"
|
|
||||||
and so on.
|
|
||||||
|
|
||||||
In effect, smaller `treemap-threshold` values will yield a more detailed
|
|
||||||
(but also a more cluttered and harder to read) visualization.
|
|
||||||
|
|
||||||
* `--mem-buffer` Maximum memory buffer size in MiB (per thread) for files inside archives. Media files
|
|
||||||
larger than this number will be read sequentially and no *seek* operations will be supported.
|
|
||||||
|
|
||||||
To check if a media file can be parsed without *seek*, execute `cat file.mp4 | ffprobe -`
|
|
||||||
* `--read-subtitles` When enabled, will attempt to read the subtitles stream from media files.
|
|
||||||
* `--fast-epub` Much faster but less accurate EPUB parsing. When enabled, sist2 will use a simple HTML parser to read epub files instead of the MuPDF library. No thumbnails are generated and author/title metadata are not parsed.
|
|
||||||
* `--checksums` Calculate file checksums (SHA1) when scanning files. This option does not cause any additional read
|
|
||||||
operations. Checksums are not calculated for all file types, unless the file is inside an archive. When enabled, duplicate
|
|
||||||
files are hidden in the web UI (this behaviour can be toggled in the Configuration page).
|
|
||||||
|
|
||||||
### Scan examples
|
|
||||||
|
|
||||||
Simple scan
|
|
||||||
```bash
|
|
||||||
sist2 scan ~/Documents
|
|
||||||
|
|
||||||
sist2 scan \
|
|
||||||
--threads 4 --content-size 16000000 --quality 1.0 --archive shallow \
|
|
||||||
--name "My Documents" --rewrite-url "http://nas.domain.local/My Documents/" \
|
|
||||||
~/Documents -o ./documents.idx/
|
|
||||||
```
|
|
||||||
|
|
||||||
Incremental scan
|
|
||||||
```
|
|
||||||
sist2 scan --incremental ./orig_idx/ -o ./updated_idx/ ~/Documents
|
|
||||||
```
|
|
||||||
|
|
||||||
### Index format
|
|
||||||
|
|
||||||
A typical `ndjson` type index structure looks like this:
|
|
||||||
```
|
|
||||||
documents.idx/
|
|
||||||
├── descriptor.json
|
|
||||||
├── _index_main.ndjson.zst
|
|
||||||
├── treemap.csv
|
|
||||||
├── agg_mime.csv
|
|
||||||
├── agg_date.csv
|
|
||||||
├── add_size.csv
|
|
||||||
├── thumbs/
|
|
||||||
| ├── data.mdb
|
|
||||||
| └── lock.mdb
|
|
||||||
├── tags/
|
|
||||||
| ├── data.mdb
|
|
||||||
| └── lock.mdb
|
|
||||||
└── meta/
|
|
||||||
├── data.mdb
|
|
||||||
└── lock.mdb
|
|
||||||
```
|
|
||||||
|
|
||||||
The `_index_*.ndjson.zst` files contain the document data in JSON format, in a compressed newline-delemited file.
|
|
||||||
|
|
||||||
The `thumbs/` folder is a [LMDB](https://en.wikipedia.org/wiki/Lightning_Memory-Mapped_Database)
|
|
||||||
database containing the thumbnails.
|
|
||||||
|
|
||||||
The `descriptor.json` file contains general information about the index. The
|
|
||||||
following fields are safe to modify manually: `root`, `name`, [rewrite_url](#rewrite_url) and `timestamp`.
|
|
||||||
|
|
||||||
The `.csv` are pre-computed aggregations necessary for the stats page.
|
|
||||||
|
|
||||||
*thumbs/*:
|
|
||||||
|
|
||||||
LMDB key-value store. Keys are **binary** 16-byte md5 hash* (`_id` field)
|
|
||||||
and values are raw image bytes.
|
|
||||||
|
|
||||||
*\* Hash is calculated from the full path of the file, including the extension, relative to the index root*
|
|
||||||
|
|
||||||
|
|
||||||
## Index
|
|
||||||
### Index options
|
|
||||||
* `--es-url`
|
|
||||||
Elasticsearch url and port. If you are using docker, make sure that both containers are on the
|
|
||||||
same network.
|
|
||||||
* `--es-index`
|
|
||||||
Elasticsearch index name. DEFAULT=sist2
|
|
||||||
* `-p, --print`
|
|
||||||
Print index in JSON format to stdout.
|
|
||||||
* `--incremental-index`
|
|
||||||
Conduct incremental indexing. Assumes that the old index is already ingested in Elasticsearch.
|
|
||||||
Only the new changes since the last scan will be sent.
|
|
||||||
* `--script-file`
|
|
||||||
Path to user script. See [Scripting](scripting.md).
|
|
||||||
* `--mappings-file`
|
|
||||||
Path to custom Elasticsearch mappings. If none is specified, [the bundled mappings](https://github.com/simon987/sist2/tree/master/schema) will be used.
|
|
||||||
* `--settings-file`
|
|
||||||
Path to custom Elasticsearch settings. *(See above)*
|
|
||||||
* `--async-script`
|
|
||||||
Use `wait_for_completion=false` elasticsearch option while executing user script.
|
|
||||||
(See [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html))
|
|
||||||
* `--batch-size=<int>`
|
|
||||||
Index batch size. Indexing is generally faster with larger batches, but payloads that
|
|
||||||
are too large will fail and additional overhead for retrying with smaller sizes may slow
|
|
||||||
down the process.
|
|
||||||
* `-f, --force-reset`
|
|
||||||
Reset Elasticsearch mappings and settings.
|
|
||||||
* `-t, --threads` Number of threads to use. Ideally, choose a number equal to the number of logical cores of the machine hosting Elasticsearch.
|
|
||||||
|
|
||||||
### Index examples
|
|
||||||
|
|
||||||
**Push to elasticsearch**
|
|
||||||
```bash
|
|
||||||
sist2 index --force-reset --batch-size 1000 --es-url http://localhost:9200 ./my_index/
|
|
||||||
sist2 index ./my_index/
|
|
||||||
```
|
|
||||||
|
|
||||||
**Save index in JSON format**
|
|
||||||
```bash
|
|
||||||
sist2 index --print ./my_index/ > my_index.ndjson
|
|
||||||
```
|
|
||||||
|
|
||||||
**Inspect contents of an index**
|
|
||||||
```bash
|
|
||||||
sist2 index --print ./my_index/ | jq | less
|
|
||||||
```
|
|
||||||
|
|
||||||
## Web
|
|
||||||
|
|
||||||
### Web options
|
|
||||||
* `--es-url=<str>` Elasticsearch url.
|
|
||||||
* `--es-index`
|
|
||||||
Elasticsearch index name. DEFAULT=sist2
|
|
||||||
* `--bind=<str>` Listen on this address.
|
|
||||||
* `--auth=<str>` Basic auth in user:password format
|
|
||||||
* `--tag-auth=<str>` Basic auth in user:password format. Works the same way as the
|
|
||||||
`--auth` argument, but authentication is only applied the `/tag/` endpoint.
|
|
||||||
* `--tagline=<str>` When specified, will replace the default tagline in the navbar.
|
|
||||||
* `--dev` Serve html & js files from disk (for development, used to modify frontend files without having to recompile)
|
|
||||||
* `--lang=<str>` Set the default web UI language (See #180 for a list of supported languages, default
|
|
||||||
is `en`). The user can change the language in the configuration page
|
|
||||||
|
|
||||||
### Web examples
|
|
||||||
|
|
||||||
**Single index**
|
|
||||||
```bash
|
|
||||||
sist2 web --auth admin:hunter2 --bind 0.0.0.0:8888 my_index
|
|
||||||
```
|
|
||||||
|
|
||||||
**Multiple indices**
|
|
||||||
```bash
|
|
||||||
# Indices will be displayed in this order in the web interface
|
|
||||||
sist2 web index1 index2 index3 index4
|
|
||||||
```
|
|
||||||
|
|
||||||
### rewrite_url
|
|
||||||
|
|
||||||
When the `rewrite_url` field is not empty, the web module ignores the `root`
|
|
||||||
field and will return a HTTP redirect to `<rewrite_url><path>/<name><extension>`
|
|
||||||
instead of serving the file from disk.
|
|
||||||
Both the `root` and `rewrite_url` fields are safe to manually modify from the
|
|
||||||
`descriptor.json` file.
|
|
||||||
|
|
||||||
# Elasticsearch
|
|
||||||
|
|
||||||
Elasticsearch versions >=6.8.0, 7.X.X and 8.X.X are supported by sist2.
|
|
||||||
|
|
||||||
Using a version >=7.14.0 is recommended to enable the following features:
|
|
||||||
|
|
||||||
- Bug fix for large documents (See #198)
|
|
||||||
|
|
||||||
When using a legacy version of ES, a notice will be displayed next to the sist2 version in the web UI.
|
|
||||||
If you don't care about the features above, you can ignore it or disable it in the configuration page.
|
|
||||||
|
|
||||||
## exec-script
|
|
||||||
|
|
||||||
The `exec-script` command is used to execute a user script for an index that has already been imported to Elasticsearch with the `index` command. Note that the documents will not be reset to their default state before each execution as the `index` command does: if you make undesired changes to the documents by accident, you will need to run `index` again to revert to the original state.
|
|
||||||
|
|
||||||
|
|
||||||
# Tagging
|
|
||||||
|
|
||||||
### Manual tagging
|
|
||||||
|
|
||||||
You can modify tags of individual documents directly from the
|
|
||||||
`web` interface. Note that you can setup authentication for this feature
|
|
||||||
with the `--tag-auth` option (See [web options](#web-options))
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Tags that are manually added are saved both in the
|
|
||||||
index folder (in `/tags/`) and in Elasticsearch*. When re-`index`ing,
|
|
||||||
they are read from the index and automatically applied.
|
|
||||||
|
|
||||||
You can safely copy the `/tags/` database to another index.
|
|
||||||
|
|
||||||
See [Automatic tagging](#automatic-tagging) for information about tag
|
|
||||||
hierarchies and tag colors.
|
|
||||||
|
|
||||||
\* *It can take a few seconds to take effect in new search queries.*
|
|
||||||
|
|
||||||
|
|
||||||
### Automatic tagging
|
|
||||||
|
|
||||||
See [scripting](scripting.md) documentation.
|
|
||||||
|
|
||||||
# Sidecar files
|
|
||||||
|
|
||||||
When scanning, sist2 will read metadata from `.s2meta` JSON files and overwrite the
|
|
||||||
original document's indexed metadata (does not modify the actual file). Sidecar metadata files will also work inside archives.
|
|
||||||
Sidecar files themselves are not saved in the index.
|
|
||||||
|
|
||||||
This feature is useful to leverage third-party applications such as speech-to-text or
|
|
||||||
OCR to add additional metadata to a file.
|
|
||||||
|
|
||||||
**Example**
|
|
||||||
|
|
||||||
```
|
|
||||||
~/Documents/
|
|
||||||
├── Video.mp4
|
|
||||||
└── Video.mp4.s2meta
|
|
||||||
```
|
|
||||||
|
|
||||||
The sidecar file must have exactly the same file path and the `.s2meta` suffix.
|
|
||||||
|
|
||||||
`Video.mp4.s2meta`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"content": "This sidecar file will overwrite some metadata fields of Video.mp4",
|
|
||||||
"author": "Some author",
|
|
||||||
"duration": 12345,
|
|
||||||
"bitrate": 67890,
|
|
||||||
"some_arbitrary_field": [1,2,3]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
sist2 scan ~/Documents -o ./docs.idx
|
|
||||||
sist2 index ./docs.idx
|
|
||||||
```
|
|
||||||
|
|
||||||
*NOTE*: It is technically possible to overwrite the `tag` value using sidecar files, however,
|
|
||||||
it is not currently possible to restore both manual tags and sidecar tags without user scripts
|
|
||||||
while reindexing.
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB |
@@ -1,142 +0,0 @@
|
|||||||
## User scripts
|
|
||||||
|
|
||||||
*This document is under construction, more in-depth guide coming soon*
|
|
||||||
|
|
||||||
During the `index` step, you can use the `--script-file <script>` option to
|
|
||||||
modify documents or add user tags. This option is mainly used to
|
|
||||||
implement automatic tagging based on file attributes.
|
|
||||||
|
|
||||||
The scripting language used
|
|
||||||
([Painless Scripting Language](https://www.elastic.co/guide/en/elasticsearch/painless/7.4/index.html))
|
|
||||||
is very similar to Java, but you should be able to create user scripts
|
|
||||||
without programming experience at all if you're somewhat familiar with
|
|
||||||
regex.
|
|
||||||
|
|
||||||
This is the base structure of the documents we're working with:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"_id": "e171405c-fdb5-4feb-bb32-82637bc32084",
|
|
||||||
"_index": "sist2",
|
|
||||||
"_type": "_doc",
|
|
||||||
"_source": {
|
|
||||||
"index": "206b3050-e821-421a-891d-12fcf6c2db0d",
|
|
||||||
"mime": "application/json",
|
|
||||||
"size": 1799,
|
|
||||||
"mtime": 1545443685,
|
|
||||||
"extension": "md",
|
|
||||||
"name": "README",
|
|
||||||
"path": "sist2/scripting",
|
|
||||||
"content": "..."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Example script**
|
|
||||||
|
|
||||||
This script checks if the `genre` attribute exists, if it does
|
|
||||||
it adds the `genre.<genre>` tag.
|
|
||||||
```Java
|
|
||||||
ArrayList tags = ctx._source.tag = new ArrayList();
|
|
||||||
|
|
||||||
if (ctx._source?.genre != null) {
|
|
||||||
tags.add("genre." + ctx._source.genre.toLowerCase());
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can use `.` to create a hierarchical tag tree:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
To use regular expressions, you need to add this line in `/etc/elasticsearch/elasticsearch.yml`
|
|
||||||
```yaml
|
|
||||||
script.painless.regex.enabled: true
|
|
||||||
```
|
|
||||||
Or, if you're using docker add `-e "script.painless.regex.enabled=true"`
|
|
||||||
|
|
||||||
**Tag color**
|
|
||||||
|
|
||||||
You can specify the color for an individual tag by appending an
|
|
||||||
hexadecimal color code (`#RRGGBBAA`) to the tag name.
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
|
|
||||||
If `(20XX)` is in the file name, add the `year.<year>` tag:
|
|
||||||
```Java
|
|
||||||
ArrayList tags = ctx._source.tag = new ArrayList();
|
|
||||||
|
|
||||||
Matcher m = /[\(\.+](20[0-9]{2})[\)\.+]/.matcher(ctx._source.name);
|
|
||||||
if (m.find()) {
|
|
||||||
tags.add("year." + m.group(1));
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Use default *Calibre* folder structure to infer author.
|
|
||||||
```Java
|
|
||||||
ArrayList tags = ctx._source.tag = new ArrayList();
|
|
||||||
|
|
||||||
// We expect the book path to look like this:
|
|
||||||
// /path/to/Calibre Library/Author/Title/Title - Author.pdf
|
|
||||||
|
|
||||||
if (ctx._source.name.contains("-") && ctx._source.extension == "pdf") {
|
|
||||||
String[] names = ctx._source.name.splitOnToken('-');
|
|
||||||
tags.add("author." + names[1].strip());
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
If the file matches a specific pattern `AAAA-000 fName1 lName1, <fName2 lName2>...`, add the `actress.<actress>` and
|
|
||||||
`studio.<studio>` tag:
|
|
||||||
```Java
|
|
||||||
ArrayList tags = ctx._source.tag = new ArrayList();
|
|
||||||
|
|
||||||
Matcher m = /([A-Z]{4})-[0-9]{3} (.*)/.matcher(ctx._source.name);
|
|
||||||
if (m.find()) {
|
|
||||||
tags.add("studio." + m.group(1));
|
|
||||||
|
|
||||||
// Take the matched group (.*), and add a tag for
|
|
||||||
// each name, separated by comma
|
|
||||||
for (String name : m.group(2).splitOnToken(',')) {
|
|
||||||
tags.add("actress." + name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Set the name of the last folder (`/path/to/<studio>/file.mp4`) to `studio.<studio>` tag
|
|
||||||
```Java
|
|
||||||
ArrayList tags = ctx._source.tag = new ArrayList();
|
|
||||||
|
|
||||||
if (ctx._source.path != "") {
|
|
||||||
String[] names = ctx._source.path.splitOnToken('/');
|
|
||||||
tags.add("studio." + names[names.length-1]);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Parse `EXIF:F Number` tag
|
|
||||||
```Java
|
|
||||||
if (ctx._source?.exif_fnumber != null) {
|
|
||||||
String[] values = ctx._source.exif_fnumber.splitOnToken(' ');
|
|
||||||
String aperture = String.valueOf(Float.parseFloat(values[0]) / Float.parseFloat(values[1]));
|
|
||||||
if (aperture == "NaN") {
|
|
||||||
aperture = "0,0";
|
|
||||||
}
|
|
||||||
tags.add("Aperture.f/" + aperture.replace(".", ","));
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Display year and months from `EXIF:DateTime` tag
|
|
||||||
```Java
|
|
||||||
if (ctx._source?.exif_datetime != null) {
|
|
||||||
SimpleDateFormat parser = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
|
|
||||||
Date date = parser.parse(ctx._source.exif_datetime);
|
|
||||||
|
|
||||||
SimpleDateFormat yp = new SimpleDateFormat("yyyy");
|
|
||||||
SimpleDateFormat mp = new SimpleDateFormat("MMMMMMMMM");
|
|
||||||
|
|
||||||
String year = yp.format(date);
|
|
||||||
String month = mp.format(date);
|
|
||||||
|
|
||||||
tags.add("Month." + month);
|
|
||||||
tags.add("Year." + year);
|
|
||||||
}
|
|
||||||
|
|
||||||
```
|
|
||||||
BIN
docs/sist2.png
BIN
docs/sist2.png
Binary file not shown.
|
Before Width: | Height: | Size: 1011 KiB |
BIN
docs/stats.png
BIN
docs/stats.png
Binary file not shown.
|
Before Width: | Height: | Size: 167 KiB |
1
lib/ffmpeg
Submodule
1
lib/ffmpeg
Submodule
Submodule lib/ffmpeg added at 0481a1f6e5
1
lib/mupdf
Submodule
1
lib/mupdf
Submodule
Submodule lib/mupdf added at 91782a4348
1
lib/onion
Submodule
1
lib/onion
Submodule
Submodule lib/onion added at d8d4cc9290
1
lmdb
Submodule
1
lmdb
Submodule
Submodule lmdb added at 5c012bbe03
@@ -2,18 +2,14 @@ application/arj, arj
|
|||||||
application/base64, mme
|
application/base64, mme
|
||||||
application/binhex, hqx
|
application/binhex, hqx
|
||||||
application/book, boo|book
|
application/book, boo|book
|
||||||
application/CDFV2-corrupt,
|
|
||||||
application/CDFV2, sdv
|
application/CDFV2, sdv
|
||||||
application/clariscad, ccad
|
application/clariscad, ccad
|
||||||
application/commonground, dp
|
application/commonground, dp
|
||||||
application/csv,
|
|
||||||
application/dicom, dcm
|
|
||||||
application/drafting, drw
|
application/drafting, drw
|
||||||
application/epub+zip, epub
|
|
||||||
application/freeloader, frl
|
application/freeloader, frl
|
||||||
application/futuresplash, spl
|
application/futuresplash, spl
|
||||||
application/groupwise, vew
|
application/groupwise, vew
|
||||||
application/gzip, gz|tgz
|
application/gzip, gz
|
||||||
application/hta, hta
|
application/hta, hta
|
||||||
application/i-deas, unv
|
application/i-deas, unv
|
||||||
application/iges, iges|igs
|
application/iges, iges|igs
|
||||||
@@ -21,8 +17,8 @@ application/inf, inf
|
|||||||
application/java-archive, jar
|
application/java-archive, jar
|
||||||
application/java, class
|
application/java, class
|
||||||
application/javascript,
|
application/javascript,
|
||||||
|
application/x-archive, a
|
||||||
application/json, json
|
application/json, json
|
||||||
application/ndjson, jsonl|ndjson
|
|
||||||
application/marc, mrc
|
application/marc, mrc
|
||||||
application/mbedlet, mbd
|
application/mbedlet, mbd
|
||||||
application/mime, aps
|
application/mime, aps
|
||||||
@@ -31,9 +27,7 @@ application/msword, doc|dot|w6w|wiz|word
|
|||||||
application/netmc, mcp
|
application/netmc, mcp
|
||||||
application/octet-stream, bin|dump|gpg
|
application/octet-stream, bin|dump|gpg
|
||||||
application/oda, oda
|
application/oda, oda
|
||||||
application/ogg, ogv
|
|
||||||
application/pdf, pdf
|
application/pdf, pdf
|
||||||
application/pgp-keys,
|
|
||||||
application/pgp-signature, pgp
|
application/pgp-signature, pgp
|
||||||
application/pkcs7-signature, p7s
|
application/pkcs7-signature, p7s
|
||||||
application/pkix-cert, cer|crt
|
application/pkix-cert, cer|crt
|
||||||
@@ -49,10 +43,6 @@ application/vda, vda
|
|||||||
application/vnd.fdf, fdf
|
application/vnd.fdf, fdf
|
||||||
application/vnd.font-fontforge-sfd, sfd
|
application/vnd.font-fontforge-sfd, sfd
|
||||||
application/vnd.hp-hpgl, hgl|hpg|hpgl
|
application/vnd.hp-hpgl, hgl|hpg|hpgl
|
||||||
application/vnd.iccprofile, icm
|
|
||||||
application/vnd.iccprofile, icm
|
|
||||||
application/vnd.lotus-1-2-3,
|
|
||||||
application/vnd.ms-cab-compressed, cab
|
|
||||||
application/vnd.ms-excel, xlb|xlc|xll|xlm|xls|xlw
|
application/vnd.ms-excel, xlb|xlc|xll|xlm|xls|xlw
|
||||||
application/vnd.ms-fontobject, eot
|
application/vnd.ms-fontobject, eot
|
||||||
application/vnd.ms-opentype, otf
|
application/vnd.ms-opentype, otf
|
||||||
@@ -64,73 +54,45 @@ application/vnd.ms-project, mpp
|
|||||||
application/vnd.oasis.opendocument.base, odb
|
application/vnd.oasis.opendocument.base, odb
|
||||||
application/vnd.oasis.opendocument.formula, odf
|
application/vnd.oasis.opendocument.formula, odf
|
||||||
application/vnd.oasis.opendocument.graphics, odg
|
application/vnd.oasis.opendocument.graphics, odg
|
||||||
application/vnd.oasis.opendocument.presentation, odp
|
|
||||||
application/vnd.oasis.opendocument.spreadsheet, ods
|
|
||||||
application/vnd.oasis.opendocument.text, odt
|
application/vnd.oasis.opendocument.text, odt
|
||||||
application/vnd.openxmlformats-officedocument.presentationml.presentation, pptx
|
|
||||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xlsx
|
|
||||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document, docx
|
|
||||||
application/vnd.symbian.install,
|
|
||||||
application/vnd.tcpdump.pcap, pcap
|
|
||||||
application/vnd.wap.wmlc, wmlc
|
application/vnd.wap.wmlc, wmlc
|
||||||
application/vnd.wap.wmlscriptc, wmlsc
|
application/vnd.wap.wmlscriptc, wmlsc
|
||||||
application/vnd.xara, web
|
application/vnd.xara, web
|
||||||
application/vocaltec-media-desc, vmd
|
application/vocaltec-media-desc, vmd
|
||||||
application/vocaltec-media-file, vmf
|
application/vocaltec-media-file, vmf
|
||||||
application/warc, warc
|
application/wordperfect6.0, w60
|
||||||
application/winhelp, hlp
|
application/wordperfect6.1, w61
|
||||||
application/wordperfect, wp|wp5|wp6|wpd|w60|w61
|
application/wordperfect, wp|wp5|wp6|wpd
|
||||||
application/x-123, wk1
|
application/x-123, wk1
|
||||||
application/x-7z-compressed, 7z
|
|
||||||
application/x-aim, aim
|
application/x-aim, aim
|
||||||
application/x-apple-diskimage,
|
|
||||||
application/x-arc,
|
|
||||||
application/x-archive, a
|
|
||||||
application/x-atari-7800-rom, a78
|
|
||||||
application/x-authorware-bin, aab
|
application/x-authorware-bin, aab
|
||||||
application/x-authorware-map, aam
|
application/x-authorware-map, aam
|
||||||
application/x-authorware-seg, aas
|
application/x-authorware-seg, aas
|
||||||
application/x-avira-qua,
|
|
||||||
application/x-bcpio, bcpio
|
application/x-bcpio, bcpio
|
||||||
application/x-bittorrent, torrent
|
application/x-bittorrent, torrent
|
||||||
application/x-bsh, bsh
|
application/x-bsh, bsh
|
||||||
application/x-bytecode.python, pyc
|
application/x-bytecode.python, pyc
|
||||||
application/x-bzip2, boz|bz2
|
application/x-bzip2, boz|bz2
|
||||||
application/x-bzip, bz
|
application/x-bzip, bz
|
||||||
application/x-cbr, cbr
|
|
||||||
application/x-cbz, cbz
|
|
||||||
application/x-cdlink, vcd
|
application/x-cdlink, vcd
|
||||||
application/x-chat, cha|chat
|
application/x-chat, cha|chat
|
||||||
application/x-chrome-extension,
|
|
||||||
application/x-cocoa, cco
|
application/x-cocoa, cco
|
||||||
application/x-conference, nsc
|
application/x-conference, nsc
|
||||||
application/x-coredump,
|
|
||||||
application/x-cpio, cpio
|
application/x-cpio, cpio
|
||||||
application/x-dbf, dbf
|
application/x-dbf, dbf
|
||||||
application/x-dbt,
|
application/x-dbt,
|
||||||
application/x-debian-package, deb
|
|
||||||
application/x-deepv, deepv
|
application/x-deepv, deepv
|
||||||
application/x-director, dir|dxr
|
application/x-director, dcr|dir|dxr
|
||||||
application/x-dmp, dmp
|
|
||||||
application/x-dosdriver,
|
|
||||||
application/x-dosexec, dll
|
application/x-dosexec, dll
|
||||||
application/x-dvi, dvi
|
application/x-dvi, dvi
|
||||||
application/x-elc, elc
|
application/x-elc, elc
|
||||||
application/x-empty,
|
|
||||||
application/x-envoy, env|evy
|
application/x-envoy, env|evy
|
||||||
application/x-esrehber, es
|
application/x-esrehber, es
|
||||||
application/x-excel, xla|xld|xlk|xlt|xlv
|
application/x-excel, xla|xld|xlk|xlt|xlv
|
||||||
application/x-executable, exe
|
application/x-executable, exe
|
||||||
application/x-font-gdos,
|
|
||||||
application/x-font-pf2, pf2
|
|
||||||
application/x-font-pfm, pfm
|
|
||||||
application/x-font-sfn,
|
application/x-font-sfn,
|
||||||
application/x-font-ttf, ttf|ttc
|
application/x-font-ttf, ttf|ttc
|
||||||
application/x-fptapplication/x-dbt,
|
|
||||||
application/x-freelance, pre
|
application/x-freelance, pre
|
||||||
application/x-gamecube-rom,
|
|
||||||
application/x-gdbm,
|
|
||||||
application/x-gettext-translation,
|
|
||||||
application/x-git,
|
application/x-git,
|
||||||
application/x-gsp, gsp
|
application/x-gsp, gsp
|
||||||
application/x-gss, gss
|
application/x-gss, gss
|
||||||
@@ -140,67 +102,46 @@ application/x-hdf, hdf
|
|||||||
application/x-helpfile, help
|
application/x-helpfile, help
|
||||||
application/x-httpd-imap, imap
|
application/x-httpd-imap, imap
|
||||||
application/x-ima, ima
|
application/x-ima, ima
|
||||||
application/x-innosetup,
|
|
||||||
application/x-internett-signup, ins
|
application/x-internett-signup, ins
|
||||||
application/x-inventor, iv
|
application/x-inventor, iv
|
||||||
application/x-ip2, ip
|
application/x-ip2, ip
|
||||||
application/x-java-applet,
|
application/x-java-applet,
|
||||||
application/x-java-commerce, jcm
|
application/x-java-commerce, jcm
|
||||||
application/x-java-image,
|
application/x-java-image,
|
||||||
application/x-java-jmod, jmod
|
|
||||||
application/x-java-keystore,
|
application/x-java-keystore,
|
||||||
application/x-kdelnk,
|
|
||||||
application/x-koan, skd|skm|skp|skt
|
application/x-koan, skd|skm|skp|skt
|
||||||
application/x-latex, latex|ltx
|
application/x-latex, latex|ltx
|
||||||
application/x-livescreen, ivy
|
application/x-livescreen, ivy
|
||||||
application/x-lotus, wq1
|
application/x-lotus, wq1
|
||||||
application/x-lz4+json, jsonlz4
|
|
||||||
application/x-lz4, lz4
|
|
||||||
application/x-lzh-compressed,
|
|
||||||
application/x-lzh, lzh
|
application/x-lzh, lzh
|
||||||
application/x-lzip, lz
|
|
||||||
application/x-lzma, lzma
|
|
||||||
application/x-lzop, lzo
|
|
||||||
application/x-lzx, lzx
|
application/x-lzx, lzx
|
||||||
application/x-mach-binary, jnilib|dylib
|
application/x-mach-binary, jnilib|dylib
|
||||||
application/x-mach-executable,
|
application/x-mach-executable,
|
||||||
application/x-magic-cap-package-1.0, mc$
|
application/x-magic-cap-package-1.0, mc$
|
||||||
application/x-mathcad, mcd
|
application/x-mathcad, mcd
|
||||||
application/x-maxis-dbpf,
|
|
||||||
application/x-meme, mm
|
application/x-meme, mm
|
||||||
application/x-midi, midi
|
application/x-midi, midi
|
||||||
application/x-mif, mif
|
application/x-mif, mif
|
||||||
application/x-mix-transfer, nix
|
application/x-mix-transfer, nix
|
||||||
application/xml, opf
|
application/xml, opf
|
||||||
application/x-mobipocket-ebook, mobi
|
|
||||||
application/vnd.amazon.mobi8-ebook, azw|azw3
|
|
||||||
application/x-msaccess, accdb
|
|
||||||
application/x-ms-compress-szdd, fon
|
|
||||||
application/x-ms-pdb, pdb
|
application/x-ms-pdb, pdb
|
||||||
application/x-ms-reader, lit
|
|
||||||
application/x-n64-rom, z64
|
|
||||||
application/x-navi-animation, ani
|
application/x-navi-animation, ani
|
||||||
application/x-navidoc, nvd
|
application/x-navidoc, nvd
|
||||||
application/x-navimap, map
|
application/x-navimap, map
|
||||||
application/x-navistyle, stl
|
application/x-navistyle, stl
|
||||||
application/x-nes-rom, nes
|
|
||||||
application/x-netcdf, cdf|nc
|
application/x-netcdf, cdf|nc
|
||||||
application/x-newton-compatible-pkg, pkg
|
application/x-newton-compatible-pkg, pkg
|
||||||
application/x-nintendo-ds-rom,
|
|
||||||
application/x-object, o
|
application/x-object, o
|
||||||
application/x-omcdatamaker, omcd
|
application/x-omcdatamaker, omcd
|
||||||
application/x-omc, omc
|
application/x-omc, omc
|
||||||
application/x-omcregerator, omcr
|
application/x-omcregerator, omcr
|
||||||
application/x-pagemaker, pm4|pm5
|
application/x-pagemaker, pm4|pm5
|
||||||
application/x-pcl, pcl
|
application/x-pcl, pcl
|
||||||
application/x-pgp-keyring,
|
|
||||||
application/x-pixclscript, plx
|
application/x-pixclscript, plx
|
||||||
application/x-pkcs7-certreqresp, p7r
|
application/x-pkcs7-certreqresp, p7r
|
||||||
application/x-pkcs7-signature, p7a
|
application/x-pkcs7-signature, p7a
|
||||||
application/x-project, mpc|mpt|mpv|mpx
|
application/x-project, mpc|mpt|mpv|mpx
|
||||||
application/x-qpro, wb1
|
application/x-qpro, wb1
|
||||||
application/x-rar, rar
|
|
||||||
application/x-rpm, rpm
|
|
||||||
application/x-sdp, sdp
|
application/x-sdp, sdp
|
||||||
application/x-sea, sea
|
application/x-sea, sea
|
||||||
application/x-seelogo, sl
|
application/x-seelogo, sl
|
||||||
@@ -208,17 +149,12 @@ application/x-setupscript,
|
|||||||
application/x-sharedlib, so
|
application/x-sharedlib, so
|
||||||
application/x-shar, shar
|
application/x-shar, shar
|
||||||
application/x-shockwave-flash, swf
|
application/x-shockwave-flash, swf
|
||||||
application/x-snappy-framed,
|
|
||||||
application/x-sprite, spr|sprite
|
application/x-sprite, spr|sprite
|
||||||
application/x-sqlite3,
|
application/x-sqlite3,
|
||||||
application/x-stargallery-thm,
|
|
||||||
application/x-stuffit, sit
|
|
||||||
application/x-sv4cpio, sv4cpio
|
application/x-sv4cpio, sv4cpio
|
||||||
application/x-sv4crc, sv4crc
|
application/x-sv4crc, sv4crc
|
||||||
application/x-tar, tar
|
application/x-tar, tar
|
||||||
application/x-tbook, sbk|tbk
|
application/x-tbook, sbk|tbk
|
||||||
application/x-terminfo,
|
|
||||||
application/x-terminfo2,
|
|
||||||
application/x-texinfo, texi|texinfo
|
application/x-texinfo, texi|texinfo
|
||||||
application/x-tex-tfm, tfm
|
application/x-tex-tfm, tfm
|
||||||
application/x-ustar, ustar
|
application/x-ustar, ustar
|
||||||
@@ -227,22 +163,16 @@ application/x-vnd.audioexplosion.mzz, mzz
|
|||||||
application/x-vnd.ls-xpix, xpix
|
application/x-vnd.ls-xpix, xpix
|
||||||
application/x-vrml, vrml
|
application/x-vrml, vrml
|
||||||
application/x-wais-source, src|wsrc
|
application/x-wais-source, src|wsrc
|
||||||
application/x-wine-extension-ini,
|
|
||||||
application/x-wintalk, wtk
|
application/x-wintalk, wtk
|
||||||
application/x-world, svr
|
application/x-world, svr
|
||||||
application/x-wri, wri
|
application/x-wri, wri
|
||||||
application/x-x509-ca-cert, der
|
application/x-x509-ca-cert, der
|
||||||
application/x-xz, xz
|
application/x-xz, xz
|
||||||
application/x-zip,
|
|
||||||
application/x-zstd, zst
|
|
||||||
application/zip, zip
|
application/zip, zip
|
||||||
application/zlib, z
|
|
||||||
!audio/basic, au
|
|
||||||
audio/it, it
|
audio/it, it
|
||||||
audio/make, funk|my|pfunk
|
audio/make, funk|my|pfunk
|
||||||
audio/midi, kar
|
audio/midi, kar
|
||||||
audio/mid, rmi
|
audio/mid, rmi
|
||||||
audio/mp4, m4b
|
|
||||||
audio/mpeg, m2a|mpa
|
audio/mpeg, m2a|mpa
|
||||||
audio/ogg, ogg
|
audio/ogg, ogg
|
||||||
audio/s3m, s3m
|
audio/s3m, s3m
|
||||||
@@ -250,10 +180,7 @@ audio/tsp-audio, tsi
|
|||||||
audio/tsplayer, tsp
|
audio/tsplayer, tsp
|
||||||
audio/vnd.qcelp, qcp
|
audio/vnd.qcelp, qcp
|
||||||
audio/voxware, vox
|
audio/voxware, vox
|
||||||
audio/x-aiff, aiff|aif
|
|
||||||
audio/x-flac, flac
|
|
||||||
audio/x-gsm, gsd|gsm
|
audio/x-gsm, gsd|gsm
|
||||||
audio/x-hx-aac-adts,
|
|
||||||
audio/x-jam, jam
|
audio/x-jam, jam
|
||||||
audio/x-liveaudio, lam
|
audio/x-liveaudio, lam
|
||||||
audio/x-m4a, m4a
|
audio/x-m4a, m4a
|
||||||
@@ -267,24 +194,17 @@ audio/x-nspaudio, lma
|
|||||||
audio/x-pn-realaudio, ram|rm|rmm|rmp
|
audio/x-pn-realaudio, ram|rm|rmm|rmp
|
||||||
audio/x-psid, sid
|
audio/x-psid, sid
|
||||||
audio/x-realaudio, ra
|
audio/x-realaudio, ra
|
||||||
audio/x-s3m,
|
|
||||||
audio/x-twinvq-plugin, vqe|vql
|
audio/x-twinvq-plugin, vqe|vql
|
||||||
audio/x-twinvq, vqf
|
audio/x-twinvq, vqf
|
||||||
audio/x-voc, voc
|
audio/x-voc, voc
|
||||||
audio/x-wav, wav
|
audio/x-wav, wav
|
||||||
!audio/x-xbox360-executable, xex
|
|
||||||
!audio/x-xbox-executable, xbe
|
|
||||||
font/otf,
|
font/otf,
|
||||||
font/sfnt,
|
font/sfnt,
|
||||||
font/woff2, woff2
|
|
||||||
font/woff, woff
|
|
||||||
image/bmp,
|
|
||||||
image/cmu-raster, rast
|
image/cmu-raster, rast
|
||||||
image/fif, fif
|
image/fif, fif
|
||||||
image/florian, flo|turbot
|
image/florian, flo|turbot
|
||||||
image/g3fax, g3
|
image/g3fax, g3
|
||||||
image/gif, gif
|
image/gif, gif
|
||||||
image/heic, heic
|
|
||||||
image/ief, ief|iefs
|
image/ief, ief|iefs
|
||||||
image/jpeg, jfif|jfif-tbnl|jpe|jpeg|jpg
|
image/jpeg, jfif|jfif-tbnl|jpe|jpeg|jpg
|
||||||
image/jutvision, jut
|
image/jutvision, jut
|
||||||
@@ -293,9 +213,6 @@ image/pict, pic|pict
|
|||||||
image/png, png|x-png
|
image/png, png|x-png
|
||||||
!image/svg, svg
|
!image/svg, svg
|
||||||
!image/svg+xml,
|
!image/svg+xml,
|
||||||
image/tiff,
|
|
||||||
!image/vnd.adobe.photoshop, psd
|
|
||||||
!image/vnd.djvu, djvu
|
|
||||||
image/vnd.fpx, fpx
|
image/vnd.fpx, fpx
|
||||||
image/vnd.microsoft.icon,
|
image/vnd.microsoft.icon,
|
||||||
image/vnd.rn-realflash, rf
|
image/vnd.rn-realflash, rf
|
||||||
@@ -303,15 +220,9 @@ image/vnd.rn-realpix, rp
|
|||||||
image/vnd.wap.wbmp, wbmp
|
image/vnd.wap.wbmp, wbmp
|
||||||
image/vnd.xiff, xif
|
image/vnd.xiff, xif
|
||||||
image/webp, webp
|
image/webp, webp
|
||||||
image/wmf,
|
|
||||||
image/x-3ds, 3ds
|
|
||||||
image/x-award-bioslogo,
|
|
||||||
image/x-cmu-raster, ras
|
image/x-cmu-raster, ras
|
||||||
image/x-cur, tga
|
|
||||||
image/x-dwg, dwg|dxf|svf
|
image/x-dwg, dwg|dxf|svf
|
||||||
image/x-eps,
|
image/x-eps,
|
||||||
image/x-exr, exr
|
|
||||||
image/x-gem,
|
|
||||||
image/x-icns,
|
image/x-icns,
|
||||||
!image/x-icon, ico
|
!image/x-icon, ico
|
||||||
image/x-jg, art
|
image/x-jg, art
|
||||||
@@ -325,34 +236,34 @@ image/x-portable-graymap, pgm
|
|||||||
image/x-portable-pixmap, ppm
|
image/x-portable-pixmap, ppm
|
||||||
image/x-quicktime, qif|qti|qtif
|
image/x-quicktime, qif|qti|qtif
|
||||||
image/x-rgb, rgb
|
image/x-rgb, rgb
|
||||||
image/x-tga,
|
|
||||||
image/x-tiff, tif|tiff
|
image/x-tiff, tif|tiff
|
||||||
image/x-win-bitmap,
|
image/tiff,
|
||||||
!image/x-xcf, xcf
|
!image/x-xcf, xcf
|
||||||
!image/x-xpixmap, xpm
|
!image/x-xpixmap, xpm
|
||||||
image/x-xwindowdump, xwd
|
|
||||||
message/news,
|
|
||||||
message/rfc822, mht|mhtml|mime
|
message/rfc822, mht|mhtml|mime
|
||||||
model/vnd.dwf, dwf
|
model/vnd.dwf, dwf
|
||||||
model/vnd.gdl, gdl
|
|
||||||
model/vnd.gs.gdl, gdsl
|
|
||||||
model/vrml, wrz
|
model/vrml, wrz
|
||||||
model/x-pov, pov
|
model/x-pov, pov
|
||||||
text/asp, asp
|
text/asp, asp
|
||||||
text/css, css
|
text/css, css
|
||||||
|
text/x-sass, sass
|
||||||
|
text/x-scss, scss
|
||||||
text/html, acgi|htm|html|htmls|htx|shtml
|
text/html, acgi|htm|html|htmls|htx|shtml
|
||||||
text/javascript, js
|
text/javascript, js
|
||||||
text/mcf, mcf
|
text/mcf, mcf
|
||||||
text/pascal, pas
|
text/pascal, pas
|
||||||
text/PGP,
|
text/plain, com|cmd|conf|def|g|idc|list|lst|mar|sdml|text|txt|md|groovy|license|properties|desktop|ini|rst|cmake|ipynb|readme|less|lo|go|yml|d|cs|hpp|srt
|
||||||
text/plain, com|cmd|conf|def|g|idc|list|lst|mar|sdml|text|txt|md|groovy|license|properties|desktop|ini|rst|cmake|ipynb|readme|less|lo|go|yml|d|cs|hpp|srt|nfo|sfv|m3u|csv|eml|make|log|markdown|yaml
|
|
||||||
application/vnd.coffeescript, coffee
|
|
||||||
text/richtext, rt|rtf|rtx
|
text/richtext, rt|rtf|rtx
|
||||||
text/rtf,
|
|
||||||
text/scriplet, wsc
|
text/scriplet, wsc
|
||||||
|
text/x-awk, awk
|
||||||
|
!video/x-jng, jng
|
||||||
|
video/x-mng, mng
|
||||||
|
image/x-cur, tga
|
||||||
|
image/x-xwindowdump, xwd
|
||||||
|
!image/vnd.adobe.photoshop, psd
|
||||||
text/tab-separated-values, tsv
|
text/tab-separated-values, tsv
|
||||||
text/troff, man|me|ms|roff|t|tr
|
text/troff, man|me|ms|roff|t|tr
|
||||||
text/uri-list, uji|unis|uri|uris
|
text/uri-list, uni|unis|uri|uris
|
||||||
text/vnd.abc, abc
|
text/vnd.abc, abc
|
||||||
text/vnd.fmi.flexstor, flx
|
text/vnd.fmi.flexstor, flx
|
||||||
text/vnd.wap.wmlscript, wmls
|
text/vnd.wap.wmlscript, wmls
|
||||||
@@ -361,7 +272,6 @@ text/webviewhtml, htt
|
|||||||
text/x-Algol68,
|
text/x-Algol68,
|
||||||
text/x-asm, asm|s
|
text/x-asm, asm|s
|
||||||
text/x-audiosoft-intra, aip
|
text/x-audiosoft-intra, aip
|
||||||
text/x-awk, awk
|
|
||||||
text/x-bcpl,
|
text/x-bcpl,
|
||||||
text/x-c, c|cc|h
|
text/x-c, c|cc|h
|
||||||
text/x-c++, cpp|cxx|c++
|
text/x-c++, cpp|cxx|c++
|
||||||
@@ -376,31 +286,23 @@ text/x-makefile, am|mak
|
|||||||
text/xml, xml|pom|iml|plist
|
text/xml, xml|pom|iml|plist
|
||||||
text/x-m, m
|
text/x-m, m
|
||||||
text/x-msdos-batch, bat
|
text/x-msdos-batch, bat
|
||||||
text/x-ms-regedit, reg
|
|
||||||
text/x-objective-c,
|
|
||||||
text/x-pascal, p
|
text/x-pascal, p
|
||||||
text/x-perl, pl
|
text/x-perl, pl
|
||||||
text/x-php, php
|
text/x-php, php
|
||||||
text/x-po, po
|
|
||||||
text/x-python, py
|
text/x-python, py
|
||||||
text/x-ruby, rb
|
text/x-ruby, rb
|
||||||
text/x-sass, sass
|
|
||||||
text/x-scss, scss
|
|
||||||
text/x-server-parsed-html, ssi
|
text/x-server-parsed-html, ssi
|
||||||
text/x-setext, etx
|
text/x-setext, etx
|
||||||
text/x-sgml, sgm|sgml
|
text/x-sgml, sgm|sgml
|
||||||
text/x-shellscript, sh
|
text/x-shellscript, sh
|
||||||
text/x-speech, talk
|
text/x-speech, talk
|
||||||
text/x-tcl,
|
|
||||||
text/x-tex, tex
|
text/x-tex, tex
|
||||||
text/x-uil, uil
|
text/x-uil, uil
|
||||||
text/x-uuencode, uue
|
text/x-uuencode, uue
|
||||||
text/x-vcalendar, vcs
|
text/x-vcalendar, vcs
|
||||||
text/x-vcard, vcf
|
|
||||||
video/animaflex, afl
|
video/animaflex, afl
|
||||||
video/avi, avi
|
video/avi, avi
|
||||||
video/avs-video, avs
|
video/avs-video, avs
|
||||||
video/MP2T,
|
|
||||||
video/mp4, mp4
|
video/mp4, mp4
|
||||||
video/mpeg, m1v|m2v|mpe|mpeg|mpg
|
video/mpeg, m1v|m2v|mpe|mpeg|mpg
|
||||||
video/quicktime, moov|mov|qt
|
video/quicktime, moov|mov|qt
|
||||||
@@ -415,36 +317,46 @@ video/x-atomic3d-feature, fmf
|
|||||||
video/x-dl, dl
|
video/x-dl, dl
|
||||||
video/x-dv, dif|dv
|
video/x-dv, dif|dv
|
||||||
video/x-fli, fli
|
video/x-fli, fli
|
||||||
video/x-flv, flv
|
|
||||||
video/x-isvideo, isu
|
video/x-isvideo, isu
|
||||||
!video/x-jng, jng
|
|
||||||
video/x-m4v, m4v
|
|
||||||
video/x-matroska, mkv
|
|
||||||
video/x-mng, mng
|
|
||||||
video/x-motion-jpeg, mjpg
|
video/x-motion-jpeg, mjpg
|
||||||
video/x-ms-asf, asf|asx|wmv
|
video/x-ms-asf, asf|asx
|
||||||
video/x-msvideo, divx
|
|
||||||
video/x-qtc, qtc
|
video/x-qtc, qtc
|
||||||
video/x-sgi-movie, movie|mv
|
video/x-sgi-movie, movie|mv
|
||||||
x-epoc/x-sisx-app,
|
application/x-7z-compressed, 7z
|
||||||
application/x-zstd-dictionary,
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document, docx
|
||||||
application/vnd.ms-outlook, msg
|
text/x-po, po
|
||||||
image/x-olympus-orf, orf
|
application/x-rpm, rpm
|
||||||
image/x-nikon-nef, nef
|
application/x-debian-package, deb
|
||||||
image/x-fuji-raf, raf
|
application/vnd.iccprofile, icm
|
||||||
image/x-panasonic-raw, rw2|raw
|
application/dicom, dcm
|
||||||
image/x-adobe-dng, dng
|
image/x-exr, exr
|
||||||
image/x-canon-cr2, cr2
|
application/vnd.iccprofile, icm
|
||||||
image/x-canon-crw, crw
|
video/x-matroska, mkv
|
||||||
image/x-dcraw,
|
application/x-empty,
|
||||||
image/x-kodak-dcr, dcr
|
model/vnd.gdl, gdl
|
||||||
image/x-kodak-k25, k25
|
model/vnd.gs.gdl, gdsl
|
||||||
image/x-kodak-kdc, kdc
|
font/woff, woff
|
||||||
image/x-minolta-mrw, mrw
|
font/woff2, woff2
|
||||||
image/x-pentax-pef, pef
|
application/epub+zip, epub
|
||||||
image/x-sigma-x3f, xf3
|
application/x-mobipocket-ebook, mobi
|
||||||
image/x-sony-arw, arw
|
audio/x-flac, flac
|
||||||
image/x-sony-sr2, sr2
|
application/x-rar, rar
|
||||||
image/x-sony-srf, srf
|
video/x-msvideo, divx
|
||||||
image/x-epson-erf, erf
|
video/x-flv, flv
|
||||||
sist2/sidecar, s2meta
|
application/x-kdelnk,
|
||||||
|
text/x-tcl,
|
||||||
|
application/ogg, ogv
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xlsx
|
||||||
|
application/vnd.ms-cab-compressed, cab
|
||||||
|
audio/mp4, m4b
|
||||||
|
!image/vnd.djvu, djvu
|
||||||
|
application/x-ms-reader, lit
|
||||||
|
application/CDFV2-corrupt,
|
||||||
|
text/x-vcard, vcf
|
||||||
|
application/x-innosetup,
|
||||||
|
application/winhelp, hlp
|
||||||
|
image/x-tga,
|
||||||
|
application/x-wine-extension-ini,
|
||||||
|
application/x-cbz, cbz
|
||||||
|
application/x-cbr, cbr
|
||||||
|
application/x-ms-compress-szdd, fon
|
||||||
|
@@ -1,70 +1,31 @@
|
|||||||
{
|
{
|
||||||
"properties": {
|
"properties": {
|
||||||
"_tie": {
|
|
||||||
"type": "keyword",
|
|
||||||
"doc_values": true
|
|
||||||
},
|
|
||||||
"checksum": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"_depth": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"path": {
|
"path": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"analyzer": "path_analyzer",
|
"analyzer": "path_analyzer",
|
||||||
"copy_to": "suggest-path",
|
"copy_to": "suggest-path"
|
||||||
"fielddata": true,
|
|
||||||
"fields": {
|
|
||||||
"nGram": {
|
|
||||||
"type": "text",
|
|
||||||
"analyzer": "my_nGram"
|
|
||||||
},
|
|
||||||
"text": {
|
|
||||||
"type": "text",
|
|
||||||
"analyzer": "content_analyzer"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"suggest-path": {
|
"suggest-path": {
|
||||||
"type": "completion",
|
"type": "completion",
|
||||||
"analyzer": "case_insensitive_kw_analyzer"
|
"analyzer": "keyword"
|
||||||
},
|
},
|
||||||
"mime": {
|
"mime": {
|
||||||
"type": "keyword"
|
"type": "keyword"
|
||||||
},
|
},
|
||||||
"parent": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"thumbnail": {
|
|
||||||
"type": "integer",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"videoc": {
|
"videoc": {
|
||||||
"type": "keyword",
|
"type": "keyword"
|
||||||
"index": false
|
|
||||||
},
|
},
|
||||||
"audioc": {
|
"audioc": {
|
||||||
"type": "keyword",
|
"type": "keyword"
|
||||||
"index": false
|
|
||||||
},
|
},
|
||||||
"duration": {
|
"duration": {
|
||||||
"type": "integer",
|
"type": "float"
|
||||||
"index": false
|
|
||||||
},
|
},
|
||||||
"width": {
|
"width": {
|
||||||
"type": "integer",
|
"type": "integer"
|
||||||
"index": false
|
|
||||||
},
|
},
|
||||||
"height": {
|
"height": {
|
||||||
"type": "integer",
|
"type": "integer"
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"pages": {
|
|
||||||
"type": "integer",
|
|
||||||
"index": false
|
|
||||||
},
|
},
|
||||||
"mtime": {
|
"mtime": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
@@ -78,7 +39,6 @@
|
|||||||
"name": {
|
"name": {
|
||||||
"analyzer": "content_analyzer",
|
"analyzer": "content_analyzer",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"fielddata": true,
|
|
||||||
"fields": {
|
"fields": {
|
||||||
"nGram": {
|
"nGram": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -110,23 +70,6 @@
|
|||||||
"analyzer": "my_nGram",
|
"analyzer": "my_nGram",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
"_keyword.*": {
|
|
||||||
"type": "keyword"
|
|
||||||
},
|
|
||||||
"_text.*": {
|
|
||||||
"analyzer": "content_analyzer",
|
|
||||||
"type": "text",
|
|
||||||
"fields": {
|
|
||||||
"nGram": {
|
|
||||||
"type": "text",
|
|
||||||
"analyzer": "my_nGram"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"_url": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"content": {
|
"content": {
|
||||||
"analyzer": "content_analyzer",
|
"analyzer": "content_analyzer",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -137,70 +80,6 @@
|
|||||||
"analyzer": "my_nGram"
|
"analyzer": "my_nGram"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"tag": {
|
|
||||||
"type": "text",
|
|
||||||
"fielddata": true,
|
|
||||||
"analyzer": "tag_analyzer",
|
|
||||||
"copy_to": "suggest-tag"
|
|
||||||
},
|
|
||||||
"suggest-tag": {
|
|
||||||
"type": "completion",
|
|
||||||
"analyzer": "case_insensitive_kw_analyzer"
|
|
||||||
},
|
|
||||||
"exif_make": {
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"exif_model": {
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"exif:software": {
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"exif_exposure_time": {
|
|
||||||
"type": "keyword"
|
|
||||||
},
|
|
||||||
"exif_fnumber": {
|
|
||||||
"type": "keyword"
|
|
||||||
},
|
|
||||||
"exif_iso_speed_ratings": {
|
|
||||||
"type": "keyword"
|
|
||||||
},
|
|
||||||
"exif_focal_length": {
|
|
||||||
"type": "keyword"
|
|
||||||
},
|
|
||||||
"exif_user_comment": {
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"exif_gps_longitude_ref": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"exif_gps_longitude_dms": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"exif_gps_longitude_dec": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"exif_gps_latitude_ref": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"exif_gps_latitude_dms": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"exif_gps_latitude_dec": {
|
|
||||||
"type": "keyword",
|
|
||||||
"index": false
|
|
||||||
},
|
|
||||||
"author": {
|
|
||||||
"type": "text"
|
|
||||||
},
|
|
||||||
"modified_by": {
|
|
||||||
"type": "text"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"description": "Copy _id to _tie, save path depth",
|
|
||||||
"processors": [
|
|
||||||
{
|
|
||||||
"script": {
|
|
||||||
"source": "ctx._tie = ctx._id; ctx._depth = ctx.path.length() == 0 ? 0 : 1 + ctx.path.length() - ctx.path.replace(\"/\", \"\").length();"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,22 +1,15 @@
|
|||||||
{
|
{
|
||||||
"index": {
|
"index": {
|
||||||
"refresh_interval": "30s",
|
"refresh_interval": "30s",
|
||||||
"codec": "best_compression",
|
"codec": "best_compression"
|
||||||
"number_of_replicas": 0,
|
|
||||||
"highlight.max_analyzed_offset": 1000000
|
|
||||||
},
|
},
|
||||||
"analysis": {
|
"analysis": {
|
||||||
"tokenizer": {
|
"tokenizer": {
|
||||||
"path_tokenizer": {
|
"path_tokenizer": {
|
||||||
"type": "path_hierarchy",
|
"type": "path_hierarchy"
|
||||||
"delimiter": "/"
|
|
||||||
},
|
|
||||||
"tag_tokenizer": {
|
|
||||||
"type": "path_hierarchy",
|
|
||||||
"delimiter": "."
|
|
||||||
},
|
},
|
||||||
"my_nGram_tokenizer": {
|
"my_nGram_tokenizer": {
|
||||||
"type": "ngram",
|
"type": "nGram",
|
||||||
"min_gram": 3,
|
"min_gram": 3,
|
||||||
"max_gram": 3
|
"max_gram": 3
|
||||||
}
|
}
|
||||||
@@ -28,18 +21,6 @@
|
|||||||
"lowercase"
|
"lowercase"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tag_analyzer": {
|
|
||||||
"tokenizer": "tag_tokenizer",
|
|
||||||
"filter": [
|
|
||||||
"lowercase"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"case_insensitive_kw_analyzer": {
|
|
||||||
"tokenizer": "keyword",
|
|
||||||
"filter": [
|
|
||||||
"lowercase"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"my_nGram": {
|
"my_nGram": {
|
||||||
"tokenizer": "my_nGram_tokenizer",
|
"tokenizer": "my_nGram_tokenizer",
|
||||||
"filter": [
|
"filter": [
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
{
|
|
||||||
"index": {
|
|
||||||
"refresh_interval": "30s",
|
|
||||||
"codec": "best_compression",
|
|
||||||
"number_of_replicas": 0
|
|
||||||
},
|
|
||||||
"analysis": {
|
|
||||||
"tokenizer": {
|
|
||||||
"path_tokenizer": {
|
|
||||||
"type": "path_hierarchy",
|
|
||||||
"delimiter": "/"
|
|
||||||
},
|
|
||||||
"tag_tokenizer": {
|
|
||||||
"type": "path_hierarchy",
|
|
||||||
"delimiter": "."
|
|
||||||
},
|
|
||||||
"my_nGram_tokenizer": {
|
|
||||||
"type": "nGram",
|
|
||||||
"min_gram": 3,
|
|
||||||
"max_gram": 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"analyzer": {
|
|
||||||
"path_analyzer": {
|
|
||||||
"tokenizer": "path_tokenizer",
|
|
||||||
"filter": [
|
|
||||||
"lowercase"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"tag_analyzer": {
|
|
||||||
"tokenizer": "tag_tokenizer",
|
|
||||||
"filter": [
|
|
||||||
"lowercase"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"case_insensitive_kw_analyzer": {
|
|
||||||
"tokenizer": "keyword",
|
|
||||||
"filter": [
|
|
||||||
"lowercase"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"my_nGram": {
|
|
||||||
"tokenizer": "my_nGram_tokenizer",
|
|
||||||
"filter": [
|
|
||||||
"lowercase",
|
|
||||||
"asciifolding"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"content_analyzer": {
|
|
||||||
"tokenizer": "standard",
|
|
||||||
"filter": [
|
|
||||||
"lowercase",
|
|
||||||
"asciifolding"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,9 +2,16 @@
|
|||||||
|
|
||||||
rm -rf index.sist2/
|
rm -rf index.sist2/
|
||||||
|
|
||||||
|
rm web/js/bundle.js 2> /dev/null
|
||||||
|
cat `ls web/js/*.min.js` > web/js/bundle.js
|
||||||
|
cat web/js/{util,dom,search}.js >> web/js/bundle.js
|
||||||
|
|
||||||
|
rm web/css/bundle*.css 2> /dev/null
|
||||||
|
cat web/css/*.min.css > web/css/bundle.css
|
||||||
|
cat web/css/light.css >> web/css/bundle.css
|
||||||
|
cat web/css/*.min.css > web/css/bundle_dark.css
|
||||||
|
cat web/css/dark.css >> web/css/bundle_dark.css
|
||||||
|
|
||||||
python3 scripts/mime.py > src/parsing/mime_generated.c
|
python3 scripts/mime.py > src/parsing/mime_generated.c
|
||||||
python3 scripts/serve_static.py > src/web/static_generated.c
|
python3 scripts/serve_static.py > src/web/static_generated.c
|
||||||
python3 scripts/index_static.py > src/index/static_generated.c
|
python3 scripts/index_static.py > src/index/static_generated.c
|
||||||
python3 scripts/magic_static.py > src/magic_generated.c
|
|
||||||
|
|
||||||
printf "static const char *const Sist2CommitHash = \"%s\";\n" $(git rev-parse HEAD) > src/git_hash.h
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
VCPKG_ROOT="/vcpkg"
|
|
||||||
|
|
||||||
git submodule update --init --recursive
|
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
|
||||||
cmake -DSIST_PLATFORM=x64_linux -DSIST_DEBUG=off -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
|
||||||
make -j $(nproc)
|
|
||||||
strip sist2
|
|
||||||
./sist2 -v > VERSION
|
|
||||||
mv sist2 sist2-x64-linux
|
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
|
||||||
cmake -DSIST_PLATFORM=x64_linux -DSIST_DEBUG=on -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
|
||||||
make -j $(nproc)
|
|
||||||
mv sist2_debug sist2-x64-linux-debug
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
VCPKG_ROOT="/vcpkg"
|
|
||||||
|
|
||||||
git submodule update --init --recursive
|
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
|
||||||
cmake -DSIST_PLATFORM=arm64_linux -DSIST_DEBUG=off -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
|
||||||
make -j $(nproc)
|
|
||||||
strip sist2
|
|
||||||
mv sist2 sist2-arm64-linux
|
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
|
||||||
cmake -DSIST_PLATFORM=arm64_linux -DSIST_DEBUG=on -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
|
||||||
make -j $(nproc)
|
|
||||||
strip sist2
|
|
||||||
mv sist2_debug sist2-arm64-linux-debug
|
|
||||||
57
scripts/get_static_libs.sh
Executable file
57
scripts/get_static_libs.sh
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
cd lib
|
||||||
|
|
||||||
|
cd mupdf
|
||||||
|
HAVE_X11=no HAVE_GLUT=no make -j 4
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mv mupdf/build/release/libmupdf.a .
|
||||||
|
mv mupdf/build/release/libmupdf-third.a .
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
cd ffmpeg
|
||||||
|
./configure --disable-shared --enable-static --disable-ffmpeg --disable-ffplay \
|
||||||
|
--disable-ffprobe --disable-doc\
|
||||||
|
--disable-manpages --disable-postproc --disable-avfilter \
|
||||||
|
--disable-alsa --disable-lzma --disable-xlib --disable-debug\
|
||||||
|
--disable-vdpau --disable-vaapi --disable-sdl2 --disable-network
|
||||||
|
make -j 4
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mv ffmpeg/libavcodec/libavcodec.a .
|
||||||
|
mv ffmpeg/libavformat/libavformat.a .
|
||||||
|
mv ffmpeg/libavutil/libavutil.a .
|
||||||
|
mv ffmpeg/libswresample/libswresample.a .
|
||||||
|
mv ffmpeg/libswscale/libswscale.a .
|
||||||
|
|
||||||
|
# onion
|
||||||
|
cd onion
|
||||||
|
mkdir build 2> /dev/null
|
||||||
|
cd build
|
||||||
|
cmake -DONION_USE_SSL=false -DONION_USE_PAM=false -DONION_USE_PNG=false -DONION_USE_JPEG=false \
|
||||||
|
-DONION_USE_JPEG=false -DONION_USE_XML2=false -DONION_USE_SYSTEMD=false -DONION_USE_SQLITE3=false \
|
||||||
|
-DONION_USE_REDIS=false -DONION_USE_GC=false -DONION_USE_TESTS=false -DONION_EXAMPLES=false \
|
||||||
|
-DONION_USE_BINDINGS_CPP=false ..
|
||||||
|
make -j 4
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
mv onion/build/src/onion/libonion_static.a .
|
||||||
|
|
||||||
|
#bzip2
|
||||||
|
git clone https://github.com/enthought/bzip2-1.0.6
|
||||||
|
cd bzip2-1.0.6
|
||||||
|
make -j 4
|
||||||
|
cd ..
|
||||||
|
mv bzip2-1.0.6/libbz2.a .
|
||||||
|
|
||||||
|
# magic
|
||||||
|
git clone https://github.com/threatstack/libmagic
|
||||||
|
cd libmagic
|
||||||
|
./autogen.sh
|
||||||
|
./configure --enable-static --disable-shared
|
||||||
|
make -j 4
|
||||||
|
cd ..
|
||||||
|
mv libmagic/src/.libs/libmagic.a .
|
||||||
|
|
||||||
|
|
||||||
|
cd ..
|
||||||
44
scripts/get_static_libs_freebsd.sh
Executable file
44
scripts/get_static_libs_freebsd.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
cd lib
|
||||||
|
|
||||||
|
# mupdf
|
||||||
|
cd mupdf
|
||||||
|
HAVE_X11=no HAVE_GLUT=no gmake -j 4
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mv mupdf/build/release/libmupdf.a .
|
||||||
|
mv mupdf/build/release/libmupdf-third.a .
|
||||||
|
|
||||||
|
# ffmpeg
|
||||||
|
cd ffmpeg
|
||||||
|
./configure --disable-shared --enable-static --disable-ffmpeg --disable-ffplay \
|
||||||
|
--disable-ffprobe --disable-doc\
|
||||||
|
--disable-manpages --disable-postproc --disable-avfilter \
|
||||||
|
--disable-alsa --disable-lzma --disable-xlib --disable-debug\
|
||||||
|
--disable-vdpau --disable-vaapi --disable-sdl2 --disable-network
|
||||||
|
gmake -j 4
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mv ffmpeg/libavcodec/libavcodec.a .
|
||||||
|
mv ffmpeg/libavformat/libavformat.a .
|
||||||
|
mv ffmpeg/libavutil/libavutil.a .
|
||||||
|
mv ffmpeg/libswresample/libswresample.a .
|
||||||
|
mv ffmpeg/libswscale/libswscale.a .
|
||||||
|
|
||||||
|
#bzip2
|
||||||
|
git clone https://github.com/enthought/bzip2-1.0.6
|
||||||
|
cd bzip2-1.0.6
|
||||||
|
make -j 4
|
||||||
|
cd ..
|
||||||
|
mv bzip2-1.0.6/libbz2.a .
|
||||||
|
|
||||||
|
# magic
|
||||||
|
git clone https://github.com/threatstack/libmagic
|
||||||
|
cd libmagic
|
||||||
|
./autogen.sh
|
||||||
|
./configure --enable-static --disable-shared
|
||||||
|
make -j 4
|
||||||
|
cd ..
|
||||||
|
mv libmagic/src/.libs/libmagic.a .
|
||||||
|
|
||||||
|
cd ..
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
import json
|
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"schema/mappings.json",
|
"schema/mappings.json",
|
||||||
"schema/settings.json",
|
"schema/settings.json",
|
||||||
"schema/settings_legacy.json",
|
|
||||||
"schema/pipeline.json",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +9,6 @@ def clean(filepath):
|
|||||||
|
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
with open(file, "r") as f:
|
with open(file, "rb") as f:
|
||||||
data = json.dumps(json.load(f), separators=(",", ":")).encode()
|
data = f.read()
|
||||||
data += b'\0'
|
|
||||||
print("char %s[%d] = {%s};" % (clean(file), len(data), ",".join(str(int(b)) for b in data)))
|
print("char %s[%d] = {%s};" % (clean(file), len(data), ",".join(str(int(b)) for b in data)))
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
|
|
||||||
try:
|
|
||||||
with open("/usr/lib/file/magic.mgc", "rb") as f:
|
|
||||||
data = f.read()
|
|
||||||
except:
|
|
||||||
data = bytes([])
|
|
||||||
|
|
||||||
print("char magic_database_buffer[%d] = {%s};" % (len(data), ",".join(str(int(b)) for b in data)))
|
|
||||||
@@ -3,7 +3,6 @@ noparse = set()
|
|||||||
ext_in_hash = set()
|
ext_in_hash = set()
|
||||||
|
|
||||||
major_mime = {
|
major_mime = {
|
||||||
"sist2": 0,
|
|
||||||
"model": 1,
|
"model": 1,
|
||||||
"example": 2,
|
"example": 2,
|
||||||
"message": 3,
|
"message": 3,
|
||||||
@@ -13,12 +12,12 @@ major_mime = {
|
|||||||
"audio": 7,
|
"audio": 7,
|
||||||
"image": 8,
|
"image": 8,
|
||||||
"text": 9,
|
"text": 9,
|
||||||
"application": 10,
|
"application": 10
|
||||||
"x-epoc": 11,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pdf = (
|
pdf = (
|
||||||
"application/pdf",
|
"application/pdf",
|
||||||
|
"application/x-cbz",
|
||||||
"application/epub+zip",
|
"application/epub+zip",
|
||||||
"application/vnd.ms-xpsdocument",
|
"application/vnd.ms-xpsdocument",
|
||||||
)
|
)
|
||||||
@@ -34,68 +33,6 @@ font = (
|
|||||||
"font/woff2"
|
"font/woff2"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Archive "formats"
|
|
||||||
archive = (
|
|
||||||
"application/x-tar",
|
|
||||||
"application/zip",
|
|
||||||
"application/x-rar",
|
|
||||||
"application/x-arc",
|
|
||||||
"application/x-warc",
|
|
||||||
"application/x-7z-compressed",
|
|
||||||
)
|
|
||||||
|
|
||||||
# Archive "filters"
|
|
||||||
arc_filter = (
|
|
||||||
"application/gzip",
|
|
||||||
"application/x-bzip2",
|
|
||||||
"application/x-xz",
|
|
||||||
"application/x-zstd",
|
|
||||||
"application/x-lzma",
|
|
||||||
"application/x-lz4",
|
|
||||||
"application/x-lzip",
|
|
||||||
"application/x-lzop",
|
|
||||||
)
|
|
||||||
|
|
||||||
doc = (
|
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
||||||
)
|
|
||||||
|
|
||||||
mobi = (
|
|
||||||
"application/x-mobipocket-ebook",
|
|
||||||
"application/vnd.amazon.mobi8-ebook"
|
|
||||||
)
|
|
||||||
|
|
||||||
markup = (
|
|
||||||
"text/xml",
|
|
||||||
"text/html",
|
|
||||||
"text/x-sgml"
|
|
||||||
)
|
|
||||||
|
|
||||||
raw = (
|
|
||||||
"image/x-olympus-orf",
|
|
||||||
"image/x-nikon-nef",
|
|
||||||
"image/x-fuji-raf",
|
|
||||||
"image/x-panasonic-raw",
|
|
||||||
"image/x-adobe-dng",
|
|
||||||
"image/x-canon-cr2",
|
|
||||||
"image/x-canon-crw",
|
|
||||||
"image/x-dcraw",
|
|
||||||
"image/x-kodak-dcr",
|
|
||||||
"image/x-kodak-k25",
|
|
||||||
"image/x-kodak-kdc",
|
|
||||||
"image/x-minolta-mrw",
|
|
||||||
"image/x-pentax-pef",
|
|
||||||
"image/x-sigma-x3f",
|
|
||||||
"image/x-sony-arw",
|
|
||||||
"image/x-sony-sr2",
|
|
||||||
"image/x-sony-srf",
|
|
||||||
"image/x-minolta-mrw",
|
|
||||||
"image/x-pentax-pef",
|
|
||||||
"image/x-epson-erf",
|
|
||||||
)
|
|
||||||
|
|
||||||
cnt = 1
|
cnt = 1
|
||||||
|
|
||||||
|
|
||||||
@@ -110,24 +47,8 @@ def mime_id(mime):
|
|||||||
mime_id += " | 0x40000000"
|
mime_id += " | 0x40000000"
|
||||||
elif mime in font:
|
elif mime in font:
|
||||||
mime_id += " | 0x20000000"
|
mime_id += " | 0x20000000"
|
||||||
elif mime in archive:
|
|
||||||
mime_id += " | 0x10000000"
|
|
||||||
elif mime in arc_filter:
|
|
||||||
mime_id += " | 0x08000000"
|
|
||||||
elif mime in doc:
|
|
||||||
mime_id += " | 0x04000000"
|
|
||||||
elif mime in mobi:
|
|
||||||
mime_id += " | 0x02000000"
|
|
||||||
elif mime in markup:
|
|
||||||
mime_id += " | 0x01000000"
|
|
||||||
elif mime in raw:
|
|
||||||
mime_id += " | 0x00800000"
|
|
||||||
elif mime == "application/x-empty":
|
elif mime == "application/x-empty":
|
||||||
cnt -= 1
|
|
||||||
return "1"
|
return "1"
|
||||||
elif mime == "sist2/sidecar":
|
|
||||||
cnt -= 1
|
|
||||||
return "2"
|
|
||||||
return mime_id
|
return mime_id
|
||||||
|
|
||||||
|
|
||||||
@@ -135,7 +56,7 @@ def clean(t):
|
|||||||
return t.replace("/", "_").replace(".", "_").replace("+", "_").replace("-", "_")
|
return t.replace("/", "_").replace(".", "_").replace("+", "_").replace("-", "_")
|
||||||
|
|
||||||
|
|
||||||
with open("scripts/mime.csv") as f:
|
with open("mime.csv") as f:
|
||||||
for l in f:
|
for l in f:
|
||||||
mime, ext_list = l.split(",")
|
mime, ext_list = l.split(",")
|
||||||
if l.startswith("!"):
|
if l.startswith("!"):
|
||||||
@@ -147,7 +68,7 @@ with open("scripts/mime.csv") as f:
|
|||||||
print("// **Generated by mime.py**")
|
print("// **Generated by mime.py**")
|
||||||
print("#ifndef MIME_GENERATED_C")
|
print("#ifndef MIME_GENERATED_C")
|
||||||
print("#define MIME_GENERATED_C")
|
print("#define MIME_GENERATED_C")
|
||||||
print("#include <glib.h>\n")
|
print("#include <glib-2.0/glib.h>\n")
|
||||||
print("#include <stdlib.h>\n")
|
print("#include <stdlib.h>\n")
|
||||||
# Enum
|
# Enum
|
||||||
print("enum mime {")
|
print("enum mime {")
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
make clean
|
|
||||||
rm -rf CMakeFiles/ CMakeCache.txt Makefile \
|
|
||||||
third-party/libscan/CMakeFiles third-party/libscan/CMakeCache.txt third-party/libscan/third-party/ext_ffmpeg \
|
|
||||||
third-party/libscan/third-party/ext_libmobi third-party/libscan/Makefile
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
files = [
|
files = [
|
||||||
"sist2-vue/src/assets/favicon.ico",
|
"web/css/bundle.css",
|
||||||
"sist2-vue/dist/css/chunk-vendors.css",
|
"web/css/bundle_dark.css",
|
||||||
"sist2-vue/dist/css/index.css",
|
"web/js/bundle.js",
|
||||||
"sist2-vue/dist/js/chunk-vendors.js",
|
"web/img/sprite-skin-flat.png",
|
||||||
"sist2-vue/dist/js/index.js",
|
"web/img/sprite-skin-flat-dark.png",
|
||||||
"sist2-vue/dist/index.html",
|
"web/search.html",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -13,10 +13,6 @@ def clean(filepath):
|
|||||||
|
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
try:
|
with open(file, "rb") as f:
|
||||||
with open(file, "rb") as f:
|
data = f.read()
|
||||||
data = f.read()
|
|
||||||
except:
|
|
||||||
data = bytes([])
|
|
||||||
|
|
||||||
print("char %s[%d] = {%s};" % (clean(file), len(data), ",".join(str(int(b)) for b in data)))
|
print("char %s[%d] = {%s};" % (clean(file), len(data), ",".join(str(int(b)) for b in data)))
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
docker run --rm -it --name "sist2-dev-es-6"\
|
|
||||||
-p 9202:9200 -e "discovery.type=single-node" \
|
|
||||||
-e "ES_JAVA_OPTS=-Xms8g -Xmx8g" elasticsearch:6.8.0
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
docker run --rm -it --name "sist2-dev-es"\
|
|
||||||
-p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" \
|
|
||||||
-e "ES_JAVA_OPTS=-Xms8g -Xmx8g" elasticsearch:8.1.2
|
|
||||||
23
sist2-vue/.gitignore
vendored
23
sist2-vue/.gitignore
vendored
@@ -1,23 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
|
|
||||||
# Editor directories and files
|
|
||||||
.idea
|
|
||||||
.vscode
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
*.iml
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
"presets": [
|
|
||||||
"@vue/cli-plugin-babel/preset"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
9
sist2-vue/dist/css/chunk-vendors.css
vendored
9
sist2-vue/dist/css/chunk-vendors.css
vendored
File diff suppressed because one or more lines are too long
1
sist2-vue/dist/css/index.css
vendored
1
sist2-vue/dist/css/index.css
vendored
File diff suppressed because one or more lines are too long
3
sist2-vue/dist/index.html
vendored
3
sist2-vue/dist/index.html
vendored
@@ -1,3 +0,0 @@
|
|||||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>sist2</title><link href="css/chunk-vendors.css" rel="preload" as="style"><link href="css/index.css" rel="preload" as="style"><link href="js/chunk-vendors.js" rel="preload" as="script"><link href="js/index.js" rel="preload" as="script"><link href="css/chunk-vendors.css" rel="stylesheet"><link href="css/index.css" rel="stylesheet"></head><body><noscript><style>body {
|
|
||||||
height: initial;
|
|
||||||
}</style><div style="text-align: center; margin-top: 100px"><strong>We're sorry but sist2 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong><br><strong>Nous sommes désolés mais sist2 ne fonctionne pas correctement si JavaScript est activé. Veuillez l'activer pour continuer.</strong></div></noscript><div id="app"></div><script src="js/chunk-vendors.js"></script><script src="js/index.js"></script></body></html>
|
|
||||||
140
sist2-vue/dist/js/chunk-vendors.js
vendored
140
sist2-vue/dist/js/chunk-vendors.js
vendored
File diff suppressed because one or more lines are too long
1
sist2-vue/dist/js/index.js
vendored
1
sist2-vue/dist/js/index.js
vendored
File diff suppressed because one or more lines are too long
28145
sist2-vue/package-lock.json
generated
28145
sist2-vue/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "sist2",
|
|
||||||
"version": "2.11.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"serve": "vue-cli-service serve",
|
|
||||||
"build": "vue-cli-service build --mode production"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@egjs/vue-infinitegrid": "3.3.0",
|
|
||||||
"axios": "^0.25.0",
|
|
||||||
"bootstrap-vue": "^2.21.2",
|
|
||||||
"core-js": "^3.6.5",
|
|
||||||
"d3": "^5.16.0",
|
|
||||||
"date-fns": "^2.21.3",
|
|
||||||
"dom-to-image": "^2.6.0",
|
|
||||||
"fslightbox-vue": "file:../../../mnt/Hatchery/main/projects/sist2/fslightbox-vue-pro-1.3.1.tgz",
|
|
||||||
"nouislider": "^15.2.0",
|
|
||||||
"underscore": "^1.13.1",
|
|
||||||
"vue": "^2.6.12",
|
|
||||||
"vue-color": "^2.8.1",
|
|
||||||
"vue-i18n": "^8.24.4",
|
|
||||||
"vue-masonry-wall": "^0.3.2",
|
|
||||||
"vue-router": "^3.2.0",
|
|
||||||
"vue-simple-suggest": "^1.11.1",
|
|
||||||
"vuex": "^3.4.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/polyfill": "^7.11.5",
|
|
||||||
"@vue/cli-plugin-babel": "~4.5.0",
|
|
||||||
"@vue/cli-plugin-router": "~4.5.0",
|
|
||||||
"@vue/cli-plugin-typescript": "~4.5.0",
|
|
||||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
|
||||||
"@vue/cli-service": "~4.5.0",
|
|
||||||
"@vue/test-utils": "^1.0.3",
|
|
||||||
"bootstrap": "^4.5.2",
|
|
||||||
"inspire-tree": "^4.3.1",
|
|
||||||
"inspire-tree-dom": "^4.0.6",
|
|
||||||
"mutationobserver-shim": "^0.3.7",
|
|
||||||
"popper.js": "^1.16.1",
|
|
||||||
"portal-vue": "^2.1.7",
|
|
||||||
"sass": "^1.26.11",
|
|
||||||
"sass-loader": "^10.0.2",
|
|
||||||
"typescript": "~4.1.5",
|
|
||||||
"vue-cli-plugin-bootstrap-vue": "~0.7.0",
|
|
||||||
"vue-template-compiler": "^2.6.11"
|
|
||||||
},
|
|
||||||
"browserslist": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions",
|
|
||||||
"not dead"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'/>
|
|
||||||
|
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
height: initial;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div style="text-align: center; margin-top: 100px">
|
|
||||||
<strong>
|
|
||||||
We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
|
||||||
Please enable it to continue.
|
|
||||||
</strong>
|
|
||||||
<br/>
|
|
||||||
<strong>
|
|
||||||
Nous sommes désolés mais <%= htmlWebpackPlugin.options.title %> ne fonctionne pas correctement
|
|
||||||
si JavaScript est activé.
|
|
||||||
Veuillez l'activer pour continuer.
|
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
</noscript>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,317 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div id="app" :class="getClass()">
|
|
||||||
<NavBar></NavBar>
|
|
||||||
<router-view v-if="!configLoading"/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import NavBar from "@/components/NavBar";
|
|
||||||
import {mapGetters} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {NavBar},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
configLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapGetters(["optTheme"]),
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.dispatch("loadConfiguration").then(() => {
|
|
||||||
this.$root.$i18n.locale = this.$store.state.optLang;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$store.subscribe((mutation) => {
|
|
||||||
if (mutation.type === "setOptLang") {
|
|
||||||
this.$root.$i18n.locale = mutation.payload;
|
|
||||||
this.configLoading = true;
|
|
||||||
window.setTimeout(() => this.configLoading = false, 10);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getClass() {
|
|
||||||
return {
|
|
||||||
"theme-light": this.optTheme === "light",
|
|
||||||
"theme-black": this.optTheme === "black",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
,
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
/*font-family: Avenir, Helvetica, Arial, sans-serif;*/
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
/*text-align: center;*/
|
|
||||||
color: #2c3e50;
|
|
||||||
padding-bottom: 1em;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Black theme*/
|
|
||||||
.theme-black {
|
|
||||||
background-color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .card, .theme-black .modal-content {
|
|
||||||
background: #212121;
|
|
||||||
color: #e0e0e0;
|
|
||||||
border-radius: 1px;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.theme-black .table {
|
|
||||||
color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .table td, .theme-black .table th {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .table thead th {
|
|
||||||
border-bottom: 1px solid #646464;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .custom-select {
|
|
||||||
overflow: auto;
|
|
||||||
background-color: #37474F;
|
|
||||||
border: 1px solid #616161;
|
|
||||||
color: #bdbdbd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .custom-select:focus {
|
|
||||||
border-color: #757575;
|
|
||||||
outline: 0;
|
|
||||||
box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .inspire-tree .selected > .wholerow, .theme-black .inspire-tree .selected > .title-wrap:hover + .wholerow {
|
|
||||||
background: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .inspire-tree .icon-expand::before, .theme-black .inspire-tree .icon-collapse::before {
|
|
||||||
background-color: black !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .inspire-tree .title {
|
|
||||||
color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .inspire-tree {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 14px;
|
|
||||||
font-family: Helvetica, Nueue, Verdana, sans-serif;
|
|
||||||
max-height: 350px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.inspire-tree [type=checkbox] {
|
|
||||||
left: 22px !important;
|
|
||||||
top: 7px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .form-control {
|
|
||||||
background-color: #37474F;
|
|
||||||
border: 1px solid #616161;
|
|
||||||
color: #dbdbdb !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .form-control:focus {
|
|
||||||
background-color: #546E7A;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .input-group-text, .theme-black .default-input {
|
|
||||||
background: #37474F !important;
|
|
||||||
border: 1px solid #616161 !important;
|
|
||||||
color: #dbdbdb !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black ::placeholder {
|
|
||||||
color: #BDBDBD !important;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .nav-tabs .nav-link {
|
|
||||||
color: #e0e0e0;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .nav-tabs .nav-item.show .nav-link, .theme-black .nav-tabs .nav-link.active {
|
|
||||||
background-color: #212121;
|
|
||||||
border-color: #616161 #616161 #212121;
|
|
||||||
color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .nav-tabs .nav-link:focus, .theme-black .nav-tabs .nav-link:focus {
|
|
||||||
border-color: #616161 #616161 #212121;
|
|
||||||
color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .nav-tabs .nav-link:focus, .theme-black .nav-tabs .nav-link:hover {
|
|
||||||
border-color: #e0e0e0 #e0e0e0 #212121;
|
|
||||||
color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .nav-tabs {
|
|
||||||
border-bottom: #616161;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black a:hover, .theme-black .btn:hover {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .b-dropdown a:hover {
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .btn {
|
|
||||||
color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .modal-header .close {
|
|
||||||
color: #e0e0e0;
|
|
||||||
text-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .modal-header {
|
|
||||||
border-bottom: 1px solid #646464;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------- */
|
|
||||||
|
|
||||||
#nav {
|
|
||||||
padding: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav a {
|
|
||||||
font-weight: bold;
|
|
||||||
color: #2c3e50;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav a.router-link-exact-active {
|
|
||||||
color: #42b983;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
padding-top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 650px) {
|
|
||||||
.mobile {
|
|
||||||
display: initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
.not-mobile {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-single-column .fit {
|
|
||||||
max-height: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
padding-top: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
.lightbox-caption {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-icon {
|
|
||||||
width: 1rem;
|
|
||||||
margin-right: 0.2rem;
|
|
||||||
cursor: pointer;
|
|
||||||
line-height: 1rem;
|
|
||||||
height: 1rem;
|
|
||||||
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKICAgICB2aWV3Qm94PSIwIDAgNDI2LjY2NyA0MjYuNjY3IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MjYuNjY3IDQyNi42Njc7IiBmaWxsPSIjZmZmIj4KPGc+CiAgICA8Zz4KICAgICAgICA8Zz4KICAgICAgICAgICAgPHJlY3QgeD0iMTkyIiB5PSIxOTIiIHdpZHRoPSI0Mi42NjciIGhlaWdodD0iMTI4Ii8+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yMTMuMzMzLDBDOTUuNDY3LDAsMCw5NS40NjcsMCwyMTMuMzMzczk1LjQ2NywyMTMuMzMzLDIxMy4zMzMsMjEzLjMzM1M0MjYuNjY3LDMzMS4yLDQyNi42NjcsMjEzLjMzMwogICAgICAgICAgICAgICAgUzMzMS4yLDAsMjEzLjMzMywweiBNMjEzLjMzMywzODRjLTk0LjA4LDAtMTcwLjY2Ny03Ni41ODctMTcwLjY2Ny0xNzAuNjY3UzExOS4yNTMsNDIuNjY3LDIxMy4zMzMsNDIuNjY3CiAgICAgICAgICAgICAgICBTMzg0LDExOS4yNTMsMzg0LDIxMy4zMzNTMzA3LjQxMywzODQsMjEzLjMzMywzODR6Ii8+CiAgICAgICAgICAgIDxyZWN0IHg9IjE5MiIgeT0iMTA2LjY2NyIgd2lkdGg9IjQyLjY2NyIgaGVpZ2h0PSI0Mi42NjciLz4KICAgICAgICA8L2c+CiAgICA8L2c+CjwvZz4KPC9zdmc+Cg==);
|
|
||||||
filter: brightness(45%);
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-title {
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 1500px) {
|
|
||||||
.container {
|
|
||||||
max-width: 1440px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.noUi-connects {
|
|
||||||
border-radius: 1px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
mark {
|
|
||||||
background: #fff217;
|
|
||||||
border-radius: 0;
|
|
||||||
padding: 1px 0;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black mark {
|
|
||||||
background: rgba(251, 191, 41, 0.25);
|
|
||||||
border-radius: 0;
|
|
||||||
padding: 1px 0;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .content-div mark {
|
|
||||||
background: rgba(251, 191, 41, 0.40);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-div {
|
|
||||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
||||||
font-size: 13px;
|
|
||||||
padding: 1em;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 4px;
|
|
||||||
margin: 3px;
|
|
||||||
white-space: normal;
|
|
||||||
color: #000;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .content-div {
|
|
||||||
background-color: #37474F;
|
|
||||||
border: 1px solid #616161;
|
|
||||||
color: #E0E0E0FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.graph {
|
|
||||||
display: inline-block;
|
|
||||||
width: 40%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pointer {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,401 +0,0 @@
|
|||||||
import axios from "axios";
|
|
||||||
import {ext, strUnescape, lum} from "./util";
|
|
||||||
|
|
||||||
export interface EsTag {
|
|
||||||
id: string
|
|
||||||
count: number
|
|
||||||
color: string | undefined
|
|
||||||
isLeaf: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Tag {
|
|
||||||
style: string
|
|
||||||
text: string
|
|
||||||
rawText: string
|
|
||||||
fg: string
|
|
||||||
bg: string
|
|
||||||
userTag: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Index {
|
|
||||||
name: string
|
|
||||||
version: string
|
|
||||||
id: string
|
|
||||||
idPrefix: string
|
|
||||||
timestamp: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EsHit {
|
|
||||||
_index: string
|
|
||||||
_id: string
|
|
||||||
_score: number
|
|
||||||
_type: string
|
|
||||||
_tags: Tag[]
|
|
||||||
_seq: number
|
|
||||||
_source: {
|
|
||||||
path: string
|
|
||||||
size: number
|
|
||||||
mime: string
|
|
||||||
name: string
|
|
||||||
extension: string
|
|
||||||
index: string
|
|
||||||
_depth: number
|
|
||||||
mtime: number
|
|
||||||
videoc: string
|
|
||||||
audioc: string
|
|
||||||
parent: string
|
|
||||||
width: number
|
|
||||||
height: number
|
|
||||||
duration: number
|
|
||||||
tag: string[]
|
|
||||||
checksum: string
|
|
||||||
thumbnail: string
|
|
||||||
}
|
|
||||||
_props: {
|
|
||||||
isSubDocument: boolean
|
|
||||||
isImage: boolean
|
|
||||||
isGif: boolean
|
|
||||||
isVideo: boolean
|
|
||||||
isPlayableVideo: boolean
|
|
||||||
isPlayableImage: boolean
|
|
||||||
isAudio: boolean
|
|
||||||
hasThumbnail: boolean
|
|
||||||
hasVidPreview: boolean
|
|
||||||
/** Number of thumbnails available */
|
|
||||||
tnNum: number
|
|
||||||
}
|
|
||||||
highlight: {
|
|
||||||
name: string[] | undefined,
|
|
||||||
content: string[] | undefined,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIdPrefix(indices: Index[], id: string): string {
|
|
||||||
for (let i = 4; i < 32; i++) {
|
|
||||||
const prefix = id.slice(0, i);
|
|
||||||
|
|
||||||
if (indices.filter(idx => idx.id.slice(0, i) == prefix).length == 1) {
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EsResult {
|
|
||||||
took: number
|
|
||||||
|
|
||||||
hits: {
|
|
||||||
// TODO: ES 6.X ?
|
|
||||||
total: {
|
|
||||||
value: number
|
|
||||||
}
|
|
||||||
hits: EsHit[]
|
|
||||||
}
|
|
||||||
|
|
||||||
aggregations: any
|
|
||||||
}
|
|
||||||
|
|
||||||
class Sist2Api {
|
|
||||||
|
|
||||||
private baseUrl: string
|
|
||||||
|
|
||||||
constructor(baseUrl: string) {
|
|
||||||
this.baseUrl = baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
getSist2Info(): Promise<any> {
|
|
||||||
return axios.get(`${this.baseUrl}i`).then(resp => {
|
|
||||||
const indices = resp.data.indices as Index[];
|
|
||||||
|
|
||||||
resp.data.indices = indices.map(idx => {
|
|
||||||
return {
|
|
||||||
id: idx.id,
|
|
||||||
name: idx.name,
|
|
||||||
timestamp: idx.timestamp,
|
|
||||||
version: idx.version,
|
|
||||||
idPrefix: getIdPrefix(indices, idx.id)
|
|
||||||
} as Index;
|
|
||||||
});
|
|
||||||
|
|
||||||
return resp.data;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
setHitProps(hit: EsHit): void {
|
|
||||||
hit["_props"] = {} as any;
|
|
||||||
|
|
||||||
const mimeCategory = hit._source.mime == null ? null : hit._source.mime.split("/")[0];
|
|
||||||
|
|
||||||
if ("parent" in hit._source) {
|
|
||||||
hit._props.isSubDocument = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("thumbnail" in hit._source) {
|
|
||||||
hit._props.hasThumbnail = true;
|
|
||||||
|
|
||||||
if (Number.isNaN(Number(hit._source.thumbnail))) {
|
|
||||||
// Backwards compatibility
|
|
||||||
hit._props.tnNum = 1;
|
|
||||||
hit._props.hasVidPreview = false;
|
|
||||||
} else {
|
|
||||||
hit._props.tnNum = Number(hit._source.thumbnail);
|
|
||||||
hit._props.hasVidPreview = hit._props.tnNum > 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (mimeCategory) {
|
|
||||||
case "image":
|
|
||||||
if (hit._source.videoc === "gif") {
|
|
||||||
hit._props.isGif = true;
|
|
||||||
} else {
|
|
||||||
hit._props.isImage = true;
|
|
||||||
}
|
|
||||||
if ("width" in hit._source && !hit._props.isSubDocument && hit._source.videoc !== "tiff"
|
|
||||||
&& hit._source.videoc !== "raw" && hit._source.videoc !== "ppm") {
|
|
||||||
hit._props.isPlayableImage = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "video":
|
|
||||||
if ("videoc" in hit._source) {
|
|
||||||
hit._props.isVideo = true;
|
|
||||||
}
|
|
||||||
if (hit._props.isVideo) {
|
|
||||||
const videoc = hit._source.videoc;
|
|
||||||
const mime = hit._source.mime;
|
|
||||||
|
|
||||||
hit._props.isPlayableVideo = mime != null &&
|
|
||||||
mime.startsWith("video/") &&
|
|
||||||
!hit._props.isSubDocument &&
|
|
||||||
hit._source.extension !== "mkv" &&
|
|
||||||
hit._source.extension !== "avi" &&
|
|
||||||
hit._source.extension !== "mov" &&
|
|
||||||
videoc !== "hevc" &&
|
|
||||||
videoc !== "mpeg1video" &&
|
|
||||||
videoc !== "mpeg2video" &&
|
|
||||||
videoc !== "wmv3";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "audio":
|
|
||||||
if ("audioc" in hit._source && !hit._props.isSubDocument) {
|
|
||||||
hit._props.isAudio = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setHitTags(hit: EsHit): void {
|
|
||||||
const tags = [] as Tag[];
|
|
||||||
|
|
||||||
const mimeCategory = hit._source.mime == null ? null : hit._source.mime.split("/")[0];
|
|
||||||
|
|
||||||
switch (mimeCategory) {
|
|
||||||
case "image":
|
|
||||||
case "video":
|
|
||||||
if ("videoc" in hit._source && hit._source.videoc) {
|
|
||||||
tags.push({
|
|
||||||
style: "video",
|
|
||||||
text: hit._source.videoc.replace(" ", ""),
|
|
||||||
userTag: false
|
|
||||||
} as Tag);
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case "audio":
|
|
||||||
if ("audioc" in hit._source && hit._source.audioc) {
|
|
||||||
tags.push({
|
|
||||||
style: "audio",
|
|
||||||
text: hit._source.audioc,
|
|
||||||
userTag: false
|
|
||||||
} as Tag);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// User tags
|
|
||||||
if ("tag" in hit._source) {
|
|
||||||
hit._source.tag.forEach(tag => {
|
|
||||||
tags.push(this.createUserTag(tag));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
hit._tags = tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
createUserTag(tag: string): Tag {
|
|
||||||
const tokens = tag.split(".");
|
|
||||||
|
|
||||||
const colorToken = tokens.pop() as string;
|
|
||||||
|
|
||||||
const bg = colorToken;
|
|
||||||
const fg = lum(colorToken) > 50 ? "#000" : "#fff";
|
|
||||||
|
|
||||||
return {
|
|
||||||
style: "user",
|
|
||||||
fg: fg,
|
|
||||||
bg: bg,
|
|
||||||
text: tokens.join("."),
|
|
||||||
rawText: tag,
|
|
||||||
userTag: true,
|
|
||||||
} as Tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
esQuery(query: any): Promise<EsResult> {
|
|
||||||
return axios.post(`${this.baseUrl}es`, query).then(resp => {
|
|
||||||
const res = resp.data as EsResult;
|
|
||||||
|
|
||||||
if (res.hits?.hits) {
|
|
||||||
res.hits.hits.forEach((hit: EsHit) => {
|
|
||||||
hit["_source"]["name"] = strUnescape(hit["_source"]["name"]);
|
|
||||||
hit["_source"]["path"] = strUnescape(hit["_source"]["path"]);
|
|
||||||
|
|
||||||
this.setHitProps(hit);
|
|
||||||
this.setHitTags(hit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getMimeTypes(query = undefined) {
|
|
||||||
const AGGS = {
|
|
||||||
mimeTypes: {
|
|
||||||
terms: {
|
|
||||||
field: "mime",
|
|
||||||
size: 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!query) {
|
|
||||||
query = {
|
|
||||||
aggs: AGGS,
|
|
||||||
size: 0,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
query.size = 0;
|
|
||||||
query.aggs = AGGS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.esQuery(query).then(resp => {
|
|
||||||
const mimeMap: any[] = [];
|
|
||||||
const buckets = resp["aggregations"]["mimeTypes"]["buckets"];
|
|
||||||
|
|
||||||
buckets.sort((a: any, b: any) => a.key > b.key).forEach((bucket: any) => {
|
|
||||||
const tmp = bucket["key"].split("/");
|
|
||||||
const category = tmp[0];
|
|
||||||
const mime = tmp[1];
|
|
||||||
|
|
||||||
let category_exists = false;
|
|
||||||
|
|
||||||
const child = {
|
|
||||||
"id": bucket["key"],
|
|
||||||
"text": `${mime} (${bucket["doc_count"]})`
|
|
||||||
};
|
|
||||||
|
|
||||||
mimeMap.forEach(node => {
|
|
||||||
if (node.text === category) {
|
|
||||||
node.children.push(child);
|
|
||||||
category_exists = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!category_exists) {
|
|
||||||
mimeMap.push({text: category, children: [child], id: category});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
mimeMap.forEach(node => {
|
|
||||||
if (node.children) {
|
|
||||||
node.children.sort((a, b) => a.id.localeCompare(b.id));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
mimeMap.sort((a, b) => a.id.localeCompare(b.id))
|
|
||||||
|
|
||||||
return {buckets, mimeMap};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_createEsTag(tag: string, count: number): EsTag {
|
|
||||||
const tokens = tag.split(".");
|
|
||||||
|
|
||||||
if (/.*\.#[0-9a-f]{6}/.test(tag)) {
|
|
||||||
return {
|
|
||||||
id: tokens.slice(0, -1).join("."),
|
|
||||||
color: tokens.pop(),
|
|
||||||
isLeaf: true,
|
|
||||||
count: count
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: tag,
|
|
||||||
count: count,
|
|
||||||
isLeaf: false,
|
|
||||||
color: undefined
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
getTags() {
|
|
||||||
return this.esQuery({
|
|
||||||
aggs: {
|
|
||||||
tags: {
|
|
||||||
terms: {
|
|
||||||
field: "tag",
|
|
||||||
size: 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
size: 0,
|
|
||||||
}).then(resp => {
|
|
||||||
const seen = new Set();
|
|
||||||
|
|
||||||
const tags = resp["aggregations"]["tags"]["buckets"]
|
|
||||||
.sort((a: any, b: any) => a["key"].localeCompare(b["key"]))
|
|
||||||
.map((bucket: any) => this._createEsTag(bucket["key"], bucket["doc_count"]));
|
|
||||||
|
|
||||||
// Remove duplicates (same tag with different color)
|
|
||||||
return tags.filter((t: EsTag) => {
|
|
||||||
if (seen.has(t.id)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
seen.add(t.id);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
saveTag(tag: string, hit: EsHit) {
|
|
||||||
return axios.post(`${this.baseUrl}tag/` + hit["_source"]["index"], {
|
|
||||||
delete: false,
|
|
||||||
name: tag,
|
|
||||||
doc_id: hit["_id"]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteTag(tag: string, hit: EsHit) {
|
|
||||||
return axios.post(`${this.baseUrl}tag/` + hit["_source"]["index"], {
|
|
||||||
delete: true,
|
|
||||||
name: tag,
|
|
||||||
doc_id: hit["_id"]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getTreemapCsvUrl(indexId: string) {
|
|
||||||
return `${this.baseUrl}s/${indexId}/1`;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMimeCsvUrl(indexId: string) {
|
|
||||||
return `${this.baseUrl}s/${indexId}/2`;
|
|
||||||
}
|
|
||||||
|
|
||||||
getSizeCsv(indexId: string) {
|
|
||||||
return `${this.baseUrl}s/${indexId}/3`;
|
|
||||||
}
|
|
||||||
|
|
||||||
getDateCsv(indexId: string) {
|
|
||||||
return `${this.baseUrl}s/${indexId}/4`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default new Sist2Api("");
|
|
||||||
@@ -1,252 +0,0 @@
|
|||||||
import store from "./store";
|
|
||||||
import {EsHit, Index} from "@/Sist2Api";
|
|
||||||
|
|
||||||
const SORT_MODES = {
|
|
||||||
score: {
|
|
||||||
mode: [
|
|
||||||
{_score: {order: "desc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._score
|
|
||||||
},
|
|
||||||
random: {
|
|
||||||
mode: [
|
|
||||||
{_score: {order: "desc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._score
|
|
||||||
},
|
|
||||||
dateAsc: {
|
|
||||||
mode: [
|
|
||||||
{mtime: {order: "asc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._source.mtime
|
|
||||||
},
|
|
||||||
dateDesc: {
|
|
||||||
mode: [
|
|
||||||
{mtime: {order: "desc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._source.mtime
|
|
||||||
},
|
|
||||||
sizeAsc: {
|
|
||||||
mode: [
|
|
||||||
{size: {order: "asc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._source.size
|
|
||||||
},
|
|
||||||
sizeDesc: {
|
|
||||||
mode: [
|
|
||||||
{size: {order: "desc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._source.size
|
|
||||||
},
|
|
||||||
nameAsc: {
|
|
||||||
mode: [
|
|
||||||
{name: {order: "asc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._source.name
|
|
||||||
},
|
|
||||||
nameDesc: {
|
|
||||||
mode: [
|
|
||||||
{name: {order: "desc"}},
|
|
||||||
{_tie: {order: "asc"}}
|
|
||||||
],
|
|
||||||
key: (hit: EsHit) => hit._source.name
|
|
||||||
}
|
|
||||||
} as any;
|
|
||||||
|
|
||||||
interface SortMode {
|
|
||||||
text: string
|
|
||||||
mode: any[]
|
|
||||||
key: (hit: EsHit) => any
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class Sist2Query {
|
|
||||||
|
|
||||||
searchQuery(blankSearch: boolean = false): any {
|
|
||||||
|
|
||||||
const getters = store.getters;
|
|
||||||
|
|
||||||
const searchText = getters.searchText;
|
|
||||||
const pathText = getters.pathText;
|
|
||||||
const empty = searchText === "";
|
|
||||||
const sizeMin = getters.sizeMin;
|
|
||||||
const sizeMax = getters.sizeMax;
|
|
||||||
const dateMin = getters.dateMin;
|
|
||||||
const dateMax = getters.dateMax;
|
|
||||||
const fuzzy = getters.fuzzy;
|
|
||||||
const size = getters.size;
|
|
||||||
const after = getters.lastDoc;
|
|
||||||
const selectedIndexIds = getters.selectedIndices.map((idx: Index) => idx.id)
|
|
||||||
const selectedMimeTypes = getters.selectedMimeTypes;
|
|
||||||
const selectedTags = getters.selectedTags;
|
|
||||||
|
|
||||||
const legacyES = store.state.sist2Info.esVersionLegacy;
|
|
||||||
|
|
||||||
const filters = [
|
|
||||||
{terms: {index: selectedIndexIds}}
|
|
||||||
] as any[];
|
|
||||||
|
|
||||||
const fields = [
|
|
||||||
"name^8",
|
|
||||||
"content^3",
|
|
||||||
"album^8", "artist^8", "title^8", "genre^2", "album_artist^8",
|
|
||||||
"font_name^6"
|
|
||||||
];
|
|
||||||
|
|
||||||
if (getters.optSearchInPath) {
|
|
||||||
fields.push("path.text^5");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fuzzy) {
|
|
||||||
fields.push("content.nGram");
|
|
||||||
if (getters.optSearchInPath) {
|
|
||||||
fields.push("path.nGram");
|
|
||||||
}
|
|
||||||
fields.push("name.nGram^3");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!blankSearch) {
|
|
||||||
if (sizeMin && sizeMax) {
|
|
||||||
filters.push({range: {size: {gte: sizeMin, lte: sizeMax}}})
|
|
||||||
} else if (sizeMin) {
|
|
||||||
filters.push({range: {size: {gte: sizeMin}}})
|
|
||||||
} else if (sizeMax) {
|
|
||||||
filters.push({range: {size: {lte: sizeMax}}})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dateMin && dateMax) {
|
|
||||||
filters.push({range: {mtime: {gte: dateMin, lte: dateMax}}})
|
|
||||||
} else if (dateMin) {
|
|
||||||
filters.push({range: {mtime: {gte: dateMin}}})
|
|
||||||
} else if (dateMax) {
|
|
||||||
filters.push({range: {mtime: {lte: dateMax}}})
|
|
||||||
}
|
|
||||||
|
|
||||||
const path = pathText.replace(/\/$/, "").toLowerCase(); //remove trailing slashes
|
|
||||||
|
|
||||||
if (path !== "") {
|
|
||||||
filters.push({term: {path: path}})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedMimeTypes.length > 0) {
|
|
||||||
filters.push({terms: {"mime": selectedMimeTypes}});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedTags.length > 0) {
|
|
||||||
if (getters.optTagOrOperator) {
|
|
||||||
filters.push({terms: {"tag": selectedTags}});
|
|
||||||
} else {
|
|
||||||
selectedTags.forEach((tag: string) => filters.push({term: {"tag": tag}}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let query;
|
|
||||||
if (getters.optQueryMode === "simple") {
|
|
||||||
query = {
|
|
||||||
simple_query_string: {
|
|
||||||
query: searchText,
|
|
||||||
fields: fields,
|
|
||||||
default_operator: "and"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
query = {
|
|
||||||
query_string: {
|
|
||||||
query: searchText,
|
|
||||||
default_field: "name",
|
|
||||||
default_operator: "and"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const q = {
|
|
||||||
_source: {
|
|
||||||
excludes: ["content", "_tie"]
|
|
||||||
},
|
|
||||||
query: {
|
|
||||||
bool: {
|
|
||||||
filter: filters,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sort: SORT_MODES[getters.sortMode].mode,
|
|
||||||
aggs:
|
|
||||||
{
|
|
||||||
total_size: {"sum": {"field": "size"}},
|
|
||||||
total_count: {"value_count": {"field": "size"}}
|
|
||||||
},
|
|
||||||
size: size,
|
|
||||||
} as any;
|
|
||||||
|
|
||||||
if (!empty && !blankSearch) {
|
|
||||||
q.query.bool.must = query;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (after) {
|
|
||||||
q.search_after = [SORT_MODES[getters.sortMode].key(after), after["_id"]];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getters.optHighlight) {
|
|
||||||
q.highlight = {
|
|
||||||
pre_tags: ["<mark>"],
|
|
||||||
post_tags: ["</mark>"],
|
|
||||||
fragment_size: getters.optFragmentSize,
|
|
||||||
number_of_fragments: 1,
|
|
||||||
order: "score",
|
|
||||||
fields: {
|
|
||||||
content: {},
|
|
||||||
name: {},
|
|
||||||
"name.nGram": {},
|
|
||||||
"content.nGram": {},
|
|
||||||
font_name: {},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!legacyES) {
|
|
||||||
q.highlight.max_analyzed_offset = 999_999;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getters.optSearchInPath) {
|
|
||||||
q.highlight.fields["path.text"] = {};
|
|
||||||
q.highlight.fields["path.nGram"] = {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getters.sortMode === "random") {
|
|
||||||
q.query = {
|
|
||||||
function_score: {
|
|
||||||
query: {
|
|
||||||
bool: {
|
|
||||||
must: filters,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
functions: [
|
|
||||||
{
|
|
||||||
random_score: {
|
|
||||||
seed: getters.seed,
|
|
||||||
field: "_seq_no",
|
|
||||||
},
|
|
||||||
weight: 1000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
boost_mode: "sum"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty && !blankSearch) {
|
|
||||||
q.query.function_score.query.bool.must.push(query);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default new Sist2Query();
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,28 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="content-div" v-html="content()" v-if="content()"></div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "ContentDiv",
|
|
||||||
props: ["doc"],
|
|
||||||
methods: {
|
|
||||||
content() {
|
|
||||||
if (!this.doc.highlight) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.doc.highlight["content.nGram"]) {
|
|
||||||
return this.doc.highlight["content.nGram"][0];
|
|
||||||
}
|
|
||||||
if (this.doc.highlight.content) {
|
|
||||||
return this.doc.highlight.content[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="graph">
|
|
||||||
<svg id="date-histogram"></svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import * as d3 from "d3";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
|
|
||||||
const formatSI = d3.format("~s");
|
|
||||||
|
|
||||||
|
|
||||||
function dateHistogram(data, svg, title) {
|
|
||||||
let bins = data.map(d => {
|
|
||||||
return {
|
|
||||||
length: Number(d.count),
|
|
||||||
x0: Number(d.bucket),
|
|
||||||
x1: Number(d.bucket) + 2629800
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bins.sort((a, b) => a.length - b.length);
|
|
||||||
|
|
||||||
const margin = {
|
|
||||||
top: 50,
|
|
||||||
right: 20,
|
|
||||||
bottom: 70,
|
|
||||||
left: 40
|
|
||||||
};
|
|
||||||
|
|
||||||
const thresh = d3.quantile(bins, 0.9, d => d.length);
|
|
||||||
bins = bins.filter(d => d.length > thresh);
|
|
||||||
|
|
||||||
const width = 550;
|
|
||||||
const height = 450;
|
|
||||||
|
|
||||||
svg.selectAll("*").remove();
|
|
||||||
svg.attr("viewBox", [0, 0, width, height]);
|
|
||||||
|
|
||||||
const y = d3.scaleLinear()
|
|
||||||
.domain([0, d3.max(bins, d => d.length)]).nice()
|
|
||||||
.range([height - margin.bottom, margin.top]);
|
|
||||||
|
|
||||||
const x = d3.scaleLinear()
|
|
||||||
.domain(d3.extent(bins, d => d.x0)).nice()
|
|
||||||
.range([margin.left, width - margin.right]);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("fill", "steelblue")
|
|
||||||
.selectAll("rect")
|
|
||||||
.data(bins)
|
|
||||||
.join("rect")
|
|
||||||
.attr("x", d => x(d.x0) + 1)
|
|
||||||
.attr("width", d => Math.max(1, x(d.x1) - x(d.x0) - 1))
|
|
||||||
.attr("y", d => y(d.length))
|
|
||||||
.attr("height", d => y(0) - y(d.length))
|
|
||||||
.call(g => g
|
|
||||||
.append("title")
|
|
||||||
.text(d => d.length)
|
|
||||||
);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(0,${height - margin.bottom})`)
|
|
||||||
.call(
|
|
||||||
d3.axisBottom(x)
|
|
||||||
.ticks(width / 30)
|
|
||||||
.tickSizeOuter(0)
|
|
||||||
.tickFormat(t => d3.timeFormat("%Y-%m-%d")(d3.utcParse("%s")(t)))
|
|
||||||
)
|
|
||||||
.call(g => g
|
|
||||||
.selectAll("text")
|
|
||||||
.style("text-anchor", "end")
|
|
||||||
.attr("dx", "-.8em")
|
|
||||||
.attr("dy", ".15em")
|
|
||||||
.attr("transform", "rotate(-65)")
|
|
||||||
)
|
|
||||||
.call(g => g.append("text")
|
|
||||||
.attr("x", width - margin.right)
|
|
||||||
.attr("y", -4)
|
|
||||||
.attr("fill", "currentColor")
|
|
||||||
.attr("font-weight", "bold")
|
|
||||||
.attr("text-anchor", "end")
|
|
||||||
.text("mtime")
|
|
||||||
);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(${margin.left},0)`)
|
|
||||||
.call(
|
|
||||||
d3.axisLeft(y)
|
|
||||||
.ticks(height / 40)
|
|
||||||
.tickFormat(t => formatSI(t))
|
|
||||||
)
|
|
||||||
.call(g => g.select(".domain").remove())
|
|
||||||
.call(g => g.select(".tick:last-of-type text").clone()
|
|
||||||
.attr("x", 4)
|
|
||||||
.attr("text-anchor", "start")
|
|
||||||
.attr("font-weight", "bold")
|
|
||||||
.text("File count"));
|
|
||||||
|
|
||||||
svg.append("text")
|
|
||||||
.attr("x", (width / 2))
|
|
||||||
.attr("y", (margin.top / 2))
|
|
||||||
.attr("text-anchor", "middle")
|
|
||||||
.style("font-size", "16px")
|
|
||||||
.text(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "D3DateHistogram",
|
|
||||||
props: ["indexId"],
|
|
||||||
mounted() {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
indexId: function () {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
update(indexId) {
|
|
||||||
const svg = d3.select("#date-histogram");
|
|
||||||
|
|
||||||
d3.csv(Sist2Api.getDateCsv(indexId)).then(tabularData => {
|
|
||||||
dateHistogram(tabularData.slice(), svg, this.$t("d3.dateHistogram"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="graph">
|
|
||||||
<svg id="agg-mime-count"></svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import * as d3 from "d3";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
|
|
||||||
const formatSI = d3.format("~s");
|
|
||||||
const barHeight = 20;
|
|
||||||
const ordinalColor = d3.scaleOrdinal(d3.schemeCategory10);
|
|
||||||
|
|
||||||
function mimeBarCount(data, svg, fillOpacity, title) {
|
|
||||||
|
|
||||||
const margin = {
|
|
||||||
top: 50,
|
|
||||||
right: 0,
|
|
||||||
bottom: 10,
|
|
||||||
left: Math.max(
|
|
||||||
d3.max(data.sort((a, b) => b.count - a.count).slice(0, 15), d => d.mime.length) * 6,
|
|
||||||
d3.max(data.sort((a, b) => b.size - a.size).slice(0, 15), d => d.mime.length) * 6,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
data.forEach(d => {
|
|
||||||
d.name = d.mime;
|
|
||||||
d.value = Number(d.count);
|
|
||||||
});
|
|
||||||
|
|
||||||
data = data.sort((a, b) => b.value - a.value).slice(0, 15);
|
|
||||||
|
|
||||||
const width = 550;
|
|
||||||
const height = Math.ceil((data.length + 0.1) * barHeight) + margin.top + margin.bottom;
|
|
||||||
|
|
||||||
svg.selectAll("*").remove();
|
|
||||||
svg.attr("viewBox", [0, 0, width, height]);
|
|
||||||
|
|
||||||
const y = d3.scaleBand()
|
|
||||||
.domain(d3.range(data.length))
|
|
||||||
.rangeRound([margin.top, height - margin.bottom]);
|
|
||||||
|
|
||||||
const x = d3.scaleLinear()
|
|
||||||
.domain([0, d3.max(data, d => d.value)])
|
|
||||||
.range([margin.left, width - margin.right]);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("fill-opacity", fillOpacity)
|
|
||||||
.selectAll("rect")
|
|
||||||
.data(data)
|
|
||||||
.join("rect")
|
|
||||||
.attr("fill", d => ordinalColor(d.name))
|
|
||||||
.attr("x", x(0))
|
|
||||||
.attr("y", (d, i) => y(i))
|
|
||||||
.attr("width", d => x(d.value) - x(0))
|
|
||||||
.attr("height", y.bandwidth())
|
|
||||||
.append("title")
|
|
||||||
.text(d => d3.format(",")(d.value));
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(0,${margin.top})`)
|
|
||||||
.call(d3.axisTop(x).ticks(width / 80, data.format).tickFormat(formatSI))
|
|
||||||
.call(g => g.select(".domain").remove());
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(${margin.left},0)`)
|
|
||||||
.call(d3.axisLeft(y).tickFormat(i => data[i].name).tickSizeOuter(0));
|
|
||||||
|
|
||||||
svg.append("text")
|
|
||||||
.attr("x", (width / 2))
|
|
||||||
.attr("y", (margin.top / 2))
|
|
||||||
.attr("text-anchor", "middle")
|
|
||||||
.style("font-size", "16px")
|
|
||||||
.text(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "D3MimeBarSize",
|
|
||||||
props: ["indexId"],
|
|
||||||
mounted() {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
indexId: function () {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
update(indexId) {
|
|
||||||
const mimeSvgCount = d3.select("#agg-mime-count");
|
|
||||||
const fillOpacity = this.$store.state.optTheme === "black" ? 0.9 : 0.6;
|
|
||||||
|
|
||||||
d3.csv(Sist2Api.getMimeCsvUrl(indexId)).then(tabularData => {
|
|
||||||
mimeBarCount(tabularData.slice(), mimeSvgCount, fillOpacity, this.$t("d3.mimeCount"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="graph">
|
|
||||||
<svg id="agg-mime-size"></svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import * as d3 from "d3";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
|
|
||||||
const formatSI = d3.format("~s");
|
|
||||||
const barHeight = 20;
|
|
||||||
const ordinalColor = d3.scaleOrdinal(d3.schemeCategory10);
|
|
||||||
|
|
||||||
function mimeBarSize(data, svg, fillOpacity, title) {
|
|
||||||
|
|
||||||
const margin = {
|
|
||||||
top: 50,
|
|
||||||
right: 0,
|
|
||||||
bottom: 10,
|
|
||||||
left: Math.max(
|
|
||||||
d3.max(data.sort((a, b) => b.count - a.count).slice(0, 15), d => d.mime.length) * 6,
|
|
||||||
d3.max(data.sort((a, b) => b.size - a.size).slice(0, 15), d => d.mime.length) * 6,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
data.forEach(d => {
|
|
||||||
d.name = d.mime;
|
|
||||||
d.value = Number(d.size);
|
|
||||||
});
|
|
||||||
data = data.sort((a, b) => b.value - a.value).slice(0, 15);
|
|
||||||
|
|
||||||
const width = 550;
|
|
||||||
const height = Math.ceil((data.length + 0.1) * barHeight) + margin.top + margin.bottom;
|
|
||||||
|
|
||||||
svg.selectAll("*").remove();
|
|
||||||
svg.attr("viewBox", [0, 0, width, height]);
|
|
||||||
|
|
||||||
const y = d3.scaleBand()
|
|
||||||
.domain(d3.range(data.length))
|
|
||||||
.rangeRound([margin.top, height - margin.bottom]);
|
|
||||||
|
|
||||||
const x = d3.scaleLinear()
|
|
||||||
.domain([0, d3.max(data, d => d.value)])
|
|
||||||
.range([margin.left, width - margin.right]);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("fill-opacity", fillOpacity)
|
|
||||||
.selectAll("rect")
|
|
||||||
.data(data)
|
|
||||||
.join("rect")
|
|
||||||
.attr("fill", d => ordinalColor(d.name))
|
|
||||||
.attr("x", x(0))
|
|
||||||
.attr("y", (d, i) => y(i))
|
|
||||||
.attr("width", d => x(d.value) - x(0))
|
|
||||||
.attr("height", y.bandwidth())
|
|
||||||
.append("title")
|
|
||||||
.text(d => formatSI(d.value));
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(0,${margin.top})`)
|
|
||||||
.call(d3.axisTop(x).ticks(width / 80, data.format).tickFormat(formatSI))
|
|
||||||
.call(g => g.select(".domain").remove());
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(${margin.left},0)`)
|
|
||||||
.call(d3.axisLeft(y).tickFormat(i => data[i].name).tickSizeOuter(0));
|
|
||||||
|
|
||||||
svg.append("text")
|
|
||||||
.attr("x", (width / 2))
|
|
||||||
.attr("y", (margin.top / 2))
|
|
||||||
.attr("text-anchor", "middle")
|
|
||||||
.style("font-size", "16px")
|
|
||||||
.text(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "D3MimeBarSize",
|
|
||||||
props: ["indexId"],
|
|
||||||
mounted() {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
indexId: function () {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
update(indexId) {
|
|
||||||
const mimeSvgSize = d3.select("#agg-mime-size");
|
|
||||||
const fillOpacity = this.$store.state.optTheme === "black" ? 0.9 : 0.6;
|
|
||||||
|
|
||||||
d3.csv(Sist2Api.getMimeCsvUrl(indexId)).then(tabularData => {
|
|
||||||
mimeBarSize(tabularData.slice(), mimeSvgSize, fillOpacity, this.$t("d3.mimeSize"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="graph">
|
|
||||||
<svg id="size-histogram"></svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import * as d3 from "d3";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
|
|
||||||
const formatSI = d3.format("~s");
|
|
||||||
|
|
||||||
function sizeHistogram(data, svg, title) {
|
|
||||||
|
|
||||||
let bins = data.map(d => {
|
|
||||||
return {
|
|
||||||
length: Number(d.count),
|
|
||||||
x0: Number(d.bucket),
|
|
||||||
x1: Number(d.bucket) + (5 * 1024 * 1024)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
bins = bins.sort((a, b) => b.length - a.length).slice(0, 25);
|
|
||||||
|
|
||||||
const margin = {
|
|
||||||
top: 50,
|
|
||||||
right: 20,
|
|
||||||
bottom: 70,
|
|
||||||
left: 40
|
|
||||||
};
|
|
||||||
|
|
||||||
const width = 550;
|
|
||||||
const height = 450;
|
|
||||||
|
|
||||||
svg.selectAll("*").remove();
|
|
||||||
svg.attr("viewBox", [0, 0, width, height]);
|
|
||||||
|
|
||||||
const y = d3.scaleLinear()
|
|
||||||
.domain([0, d3.max(bins, d => d.length)])
|
|
||||||
.range([height - margin.bottom, margin.top]);
|
|
||||||
|
|
||||||
const x = d3.scaleLinear()
|
|
||||||
.domain(d3.extent(bins, d => d.x0)).nice()
|
|
||||||
.range([margin.left, width - margin.right]);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("fill", "steelblue")
|
|
||||||
.selectAll("rect")
|
|
||||||
.data(bins)
|
|
||||||
.join("rect")
|
|
||||||
.attr("x", d => x(d.x0) + 1)
|
|
||||||
.attr("width", d => Math.max(1, x(d.x1) - x(d.x0) - 1))
|
|
||||||
.attr("y", d => y(d.length))
|
|
||||||
.attr("height", d => y(0) - y(d.length))
|
|
||||||
.call(g => g
|
|
||||||
.append("title")
|
|
||||||
.text(d => d.length)
|
|
||||||
);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(0,${height - margin.bottom})`)
|
|
||||||
.call(
|
|
||||||
d3.axisBottom(x)
|
|
||||||
.ticks(width / 30)
|
|
||||||
.tickSizeOuter(0)
|
|
||||||
.tickFormat(formatSI)
|
|
||||||
)
|
|
||||||
.call(g => g
|
|
||||||
.selectAll("text")
|
|
||||||
.style("text-anchor", "end")
|
|
||||||
.attr("dx", "-.8em")
|
|
||||||
.attr("dy", ".15em")
|
|
||||||
.attr("transform", "rotate(-65)")
|
|
||||||
)
|
|
||||||
.call(g => g.append("text")
|
|
||||||
.attr("x", width - margin.right)
|
|
||||||
.attr("y", -4)
|
|
||||||
.attr("fill", "currentColor")
|
|
||||||
.attr("font-weight", "bold")
|
|
||||||
.attr("text-anchor", "end")
|
|
||||||
.text("size (bytes)")
|
|
||||||
);
|
|
||||||
|
|
||||||
svg.append("g")
|
|
||||||
.attr("transform", `translate(${margin.left},0)`)
|
|
||||||
.call(
|
|
||||||
d3.axisLeft(y)
|
|
||||||
.ticks(height / 40)
|
|
||||||
.tickFormat(t => formatSI(t))
|
|
||||||
)
|
|
||||||
.call(g => g.select(".domain").remove())
|
|
||||||
.call(g => g.select(".tick:last-of-type text").clone()
|
|
||||||
.attr("x", 4)
|
|
||||||
.attr("text-anchor", "start")
|
|
||||||
.attr("font-weight", "bold")
|
|
||||||
.text("File count"));
|
|
||||||
|
|
||||||
svg.append("text")
|
|
||||||
.attr("x", (width / 2))
|
|
||||||
.attr("y", (margin.top / 2))
|
|
||||||
.attr("text-anchor", "middle")
|
|
||||||
.style("font-size", "16px")
|
|
||||||
.text(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "D3SizeHistogram",
|
|
||||||
props: ["indexId"],
|
|
||||||
mounted() {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
indexId: function () {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
update(indexId) {
|
|
||||||
const svg = d3.select("#size-histogram");
|
|
||||||
|
|
||||||
d3.csv(Sist2Api.getSizeCsv(indexId)).then(tabularData => {
|
|
||||||
sizeHistogram(tabularData.slice(), svg, this.$t("d3.sizeHistogram"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,267 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<b-btn style="float:right;margin-bottom: 10px" @click="downloadTreemap()" variant="primary">
|
|
||||||
{{ $t("download") }}
|
|
||||||
</b-btn>
|
|
||||||
<svg id="treemap"></svg>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import * as d3 from "d3";
|
|
||||||
import {burrow} from "@/util-js"
|
|
||||||
import {humanFileSize} from "@/util";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
import domtoimage from "dom-to-image";
|
|
||||||
|
|
||||||
|
|
||||||
const TILING_MODES = {
|
|
||||||
"squarify": d3.treemapSquarify,
|
|
||||||
"binary": d3.treemapBinary,
|
|
||||||
"sliceDice": d3.treemapSliceDice,
|
|
||||||
"slice": d3.treemapSlice,
|
|
||||||
"dice": d3.treemapDice,
|
|
||||||
};
|
|
||||||
|
|
||||||
const COLORS = {
|
|
||||||
"PuBuGn": d3.interpolatePuBuGn,
|
|
||||||
"PuRd": d3.interpolatePuRd,
|
|
||||||
"PuBu": d3.interpolatePuBu,
|
|
||||||
"YlOrBr": d3.interpolateYlOrBr,
|
|
||||||
"YlOrRd": d3.interpolateYlOrRd,
|
|
||||||
"YlGn": d3.interpolateYlGn,
|
|
||||||
"YlGnBu": d3.interpolateYlGnBu,
|
|
||||||
"Plasma": d3.interpolatePlasma,
|
|
||||||
"Magma": d3.interpolateMagma,
|
|
||||||
"Inferno": d3.interpolateInferno,
|
|
||||||
"Viridis": d3.interpolateViridis,
|
|
||||||
"Turbo": d3.interpolateTurbo,
|
|
||||||
};
|
|
||||||
|
|
||||||
const SIZES = {
|
|
||||||
"small": [800, 600],
|
|
||||||
"medium": [1300, 750],
|
|
||||||
"large": [1900, 900],
|
|
||||||
"x-large": [2800, 1700],
|
|
||||||
"xx-large": [3600, 2000],
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const uids = {};
|
|
||||||
|
|
||||||
function uid(name) {
|
|
||||||
let id = uids[name] || 0;
|
|
||||||
uids[name] = id + 1;
|
|
||||||
return name + id;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cascade(root, offset) {
|
|
||||||
const x = new Map;
|
|
||||||
const y = new Map;
|
|
||||||
return root.eachAfter(d => {
|
|
||||||
if (d.children && d.children.length !== 0) {
|
|
||||||
x.set(d, 1 + d3.max(d.children, c => c.x1 === d.x1 - offset ? x.get(c) : NaN));
|
|
||||||
y.set(d, 1 + d3.max(d.children, c => c.y1 === d.y1 - offset ? y.get(c) : NaN));
|
|
||||||
} else {
|
|
||||||
x.set(d, 0);
|
|
||||||
y.set(d, 0);
|
|
||||||
}
|
|
||||||
}).eachBefore(d => {
|
|
||||||
d.x1 -= 2 * offset * x.get(d);
|
|
||||||
d.y1 -= 2 * offset * y.get(d);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function cascadeTreemap(data, svg, width, height, tilingMode, treemapColor) {
|
|
||||||
const root = cascade(
|
|
||||||
d3.treemap()
|
|
||||||
.size([width, height])
|
|
||||||
.tile(TILING_MODES[tilingMode])
|
|
||||||
.paddingOuter(3)
|
|
||||||
.paddingTop(16)
|
|
||||||
.paddingInner(1)
|
|
||||||
.round(true)(
|
|
||||||
d3.hierarchy(data)
|
|
||||||
.sum(d => d.value)
|
|
||||||
.sort((a, b) => b.value - a.value)
|
|
||||||
),
|
|
||||||
3 // treemap.paddingOuter
|
|
||||||
);
|
|
||||||
|
|
||||||
const maxDepth = Math.max(...root.descendants().map(d => d.depth));
|
|
||||||
const color = d3.scaleSequential([maxDepth, -1], COLORS[treemapColor]);
|
|
||||||
|
|
||||||
svg.append("filter")
|
|
||||||
.attr("id", "shadow")
|
|
||||||
.append("feDropShadow")
|
|
||||||
.attr("flood-opacity", 0.3)
|
|
||||||
.attr("dx", 0)
|
|
||||||
.attr("stdDeviation", 3);
|
|
||||||
|
|
||||||
const node = svg.selectAll("g")
|
|
||||||
.data(
|
|
||||||
d3.nest()
|
|
||||||
.key(d => d.depth).sortKeys(d3.ascending)
|
|
||||||
.entries(root.descendants())
|
|
||||||
)
|
|
||||||
.join("g")
|
|
||||||
.attr("filter", "url(#shadow)")
|
|
||||||
.selectAll("g")
|
|
||||||
.data(d => d.values)
|
|
||||||
.join("g")
|
|
||||||
.attr("transform", d => `translate(${d.x0},${d.y0})`);
|
|
||||||
|
|
||||||
node.append("title")
|
|
||||||
.text(d => `${d.ancestors().reverse().splice(1).map(d => d.data.name).join("/")}\n${humanFileSize(d.value)}`);
|
|
||||||
|
|
||||||
node.append("rect")
|
|
||||||
.attr("id", d => (d.nodeUid = uid("node")))
|
|
||||||
.attr("fill", d => color(d.depth))
|
|
||||||
.attr("width", d => d.x1 - d.x0)
|
|
||||||
.attr("height", d => d.y1 - d.y0);
|
|
||||||
|
|
||||||
node.append("clipPath")
|
|
||||||
.attr("id", d => (d.clipUid = uid("clip")))
|
|
||||||
.append("use")
|
|
||||||
.attr("href", d => `#${d.nodeUid}`);
|
|
||||||
|
|
||||||
node.append("text")
|
|
||||||
.attr("fill", d => d3.hsl(color(d.depth)).l > .5 ? "#333" : "#eee")
|
|
||||||
.attr("clip-path", d => `url(#${d.clipUid})`)
|
|
||||||
.selectAll("tspan")
|
|
||||||
.data(d => [d.data.name, humanFileSize(d.value)])
|
|
||||||
.join("tspan")
|
|
||||||
.text(d => d);
|
|
||||||
|
|
||||||
node.filter(d => d.children).selectAll("tspan")
|
|
||||||
.attr("dx", 3)
|
|
||||||
.attr("y", 13);
|
|
||||||
|
|
||||||
node.filter(d => !d.children).selectAll("tspan")
|
|
||||||
.attr("x", 3)
|
|
||||||
.attr("y", (d, i) => `${i === 0 ? 1.1 : 2.3}em`);
|
|
||||||
}
|
|
||||||
|
|
||||||
function flatTreemap(data, svg, width, height, groupingDepth, tilingMode, fillOpacity) {
|
|
||||||
const ordinalColor = d3.scaleOrdinal(d3.schemeCategory10);
|
|
||||||
|
|
||||||
const root = d3.treemap()
|
|
||||||
.tile(TILING_MODES[tilingMode])
|
|
||||||
.size([width, height])
|
|
||||||
.padding(1)
|
|
||||||
.round(true)(
|
|
||||||
d3.hierarchy(data)
|
|
||||||
.sum(d => d.value)
|
|
||||||
.sort((a, b) => b.value - a.value)
|
|
||||||
);
|
|
||||||
|
|
||||||
const leaf = svg.selectAll("g")
|
|
||||||
.data(root.leaves())
|
|
||||||
.join("g")
|
|
||||||
.attr("transform", d => `translate(${d.x0},${d.y0})`);
|
|
||||||
|
|
||||||
leaf.append("title")
|
|
||||||
.text(d => `${d.ancestors().reverse().map(d => d.data.name).join("/")}\n${humanFileSize(d.value)}`);
|
|
||||||
|
|
||||||
leaf.append("rect")
|
|
||||||
.attr("id", d => (d.leafUid = uid("leaf")))
|
|
||||||
.attr("fill", d => {
|
|
||||||
while (d.depth > groupingDepth) d = d.parent;
|
|
||||||
return ordinalColor(d.data.name);
|
|
||||||
})
|
|
||||||
.attr("fill-opacity", fillOpacity)
|
|
||||||
.attr("width", d => d.x1 - d.x0)
|
|
||||||
.attr("height", d => d.y1 - d.y0);
|
|
||||||
|
|
||||||
leaf.append("clipPath")
|
|
||||||
.attr("id", d => (d.clipUid = uid("clip")))
|
|
||||||
.append("use")
|
|
||||||
.attr("href", d => `#${d.leafUid}`);
|
|
||||||
|
|
||||||
leaf.append("text")
|
|
||||||
.attr("clip-path", d => `url(#${d.clipUid})`)
|
|
||||||
.selectAll("tspan")
|
|
||||||
.data(d => {
|
|
||||||
if (d.data.name === ".") {
|
|
||||||
d = d.parent;
|
|
||||||
}
|
|
||||||
return [d.data.name, humanFileSize(d.value)]
|
|
||||||
})
|
|
||||||
.join("tspan")
|
|
||||||
.attr("x", 2)
|
|
||||||
.attr("y", (d, i) => `${i === 0 ? 1.1 : 2.3}em`)
|
|
||||||
.text(d => d);
|
|
||||||
}
|
|
||||||
|
|
||||||
function exportTreemap(indexName, width, height) {
|
|
||||||
domtoimage.toBlob(document.getElementById("treemap"), {width: width, height: height})
|
|
||||||
.then(function (blob) {
|
|
||||||
let a = document.createElement("a");
|
|
||||||
let url = URL.createObjectURL(blob);
|
|
||||||
|
|
||||||
a.href = url;
|
|
||||||
a.download = `${indexName}_treemap.png`;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
setTimeout(function () {
|
|
||||||
document.body.removeChild(a);
|
|
||||||
window.URL.revokeObjectURL(url);
|
|
||||||
}, 0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "D3Treemap",
|
|
||||||
props: ["indexId"],
|
|
||||||
watch: {
|
|
||||||
indexId: function () {
|
|
||||||
this.update(this.indexId);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.update(this.indexId);
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
update(indexId) {
|
|
||||||
const width = SIZES[this.$store.state.optTreemapSize][0];
|
|
||||||
const height = SIZES[this.$store.state.optTreemapSize][1];
|
|
||||||
const tilingMode = this.$store.state.optTreemapTiling;
|
|
||||||
const groupingDepth = this.$store.state.optTreemapColorGroupingDepth;
|
|
||||||
const treemapColor = this.$store.state.optTreemapColor;
|
|
||||||
const treemapType = this.$store.state.optTreemapType;
|
|
||||||
|
|
||||||
const treemapSvg = d3.select("#treemap");
|
|
||||||
|
|
||||||
treemapSvg.selectAll("*").remove();
|
|
||||||
treemapSvg.attr("viewBox", [0, 0, width, height])
|
|
||||||
.attr("xmlns", "http://www.w3.org/2000/svg")
|
|
||||||
.attr("xmlns:xlink", "http://www.w3.org/1999/xlink")
|
|
||||||
.attr("version", "1.1")
|
|
||||||
.style("overflow", "visible")
|
|
||||||
.style("font", "10px sans-serif");
|
|
||||||
|
|
||||||
d3.csv(Sist2Api.getTreemapCsvUrl(indexId)).then(tabularData => {
|
|
||||||
tabularData.forEach(row => {
|
|
||||||
row.taxonomy = row.path.split("/");
|
|
||||||
row.size = Number(row.size);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (treemapType === "cascaded") {
|
|
||||||
const data = burrow(tabularData, false);
|
|
||||||
cascadeTreemap(data, treemapSvg, width, height, tilingMode, treemapColor);
|
|
||||||
} else {
|
|
||||||
const data = burrow(tabularData.sort((a, b) => b.taxonomy.length - a.taxonomy.length), true);
|
|
||||||
const fillOpacity = this.$store.state.optTheme === "black" ? 0.9 : 0.6;
|
|
||||||
flatTreemap(data, treemapSvg, width, height, groupingDepth, tilingMode, fillOpacity);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
downloadTreemap() {
|
|
||||||
const width = SIZES[this.$store.state.optTreemapSize][0];
|
|
||||||
const height = SIZES[this.$store.state.optTreemapSize][1];
|
|
||||||
|
|
||||||
exportTreemap(this.indexId, width, height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-if="$store.state.optUseDatePicker">
|
|
||||||
<b-row>
|
|
||||||
<b-col sm="6">
|
|
||||||
<b-form-datepicker
|
|
||||||
value-as-date
|
|
||||||
:date-format-options="{ year: 'numeric', month: '2-digit', day: '2-digit' }"
|
|
||||||
:locale="$store.state.optLang"
|
|
||||||
class="mb-2"
|
|
||||||
:value="dateMin" @input="setDateMin"></b-form-datepicker>
|
|
||||||
</b-col>
|
|
||||||
<b-col sm="6">
|
|
||||||
<b-form-datepicker
|
|
||||||
value-as-date
|
|
||||||
:date-format-options="{ year: 'numeric', month: '2-digit', day: '2-digit' }"
|
|
||||||
:locale="$store.state.optLang"
|
|
||||||
class="mb-2"
|
|
||||||
:value="dateMax" @input="setDateMax"></b-form-datepicker>
|
|
||||||
</b-col>
|
|
||||||
</b-row>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
<b-row>
|
|
||||||
<b-col style="height: 70px;">
|
|
||||||
<div id="dateSlider"></div>
|
|
||||||
</b-col>
|
|
||||||
</b-row>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import noUiSlider from 'nouislider';
|
|
||||||
import 'nouislider/dist/nouislider.css';
|
|
||||||
import {humanDate} from "@/util";
|
|
||||||
import {mergeTooltips} from "@/util-js";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "DateSlider",
|
|
||||||
methods: {
|
|
||||||
setDateMin(val) {
|
|
||||||
const epochDate = Math.ceil(+val / 1000);
|
|
||||||
this.$store.commit("setDateMin", epochDate);
|
|
||||||
},
|
|
||||||
setDateMax(val) {
|
|
||||||
const epochDate = Math.ceil(+val / 1000);
|
|
||||||
this.$store.commit("setDateMax", epochDate);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
dateMin() {
|
|
||||||
const dateMin = this.$store.state.dateMin ? this.$store.state.dateMin : this.$store.state.dateBoundsMin;
|
|
||||||
return new Date(dateMin * 1000)
|
|
||||||
},
|
|
||||||
dateMax() {
|
|
||||||
const dateMax = this.$store.state.dateMax ? this.$store.state.dateMax : this.$store.state.dateBoundsMax;
|
|
||||||
return new Date(dateMax * 1000)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.subscribe((mutation) => {
|
|
||||||
if (mutation.type === "setDateBoundsMax") {
|
|
||||||
const elem = document.getElementById("dateSlider");
|
|
||||||
|
|
||||||
if (elem === null) {
|
|
||||||
// Using b-form-datepicker, skip initialisation of slider
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elem.children.length > 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dateMax = this.$store.state.dateBoundsMax;
|
|
||||||
const dateMin = this.$store.state.dateBoundsMin;
|
|
||||||
|
|
||||||
const slider = noUiSlider.create(elem, {
|
|
||||||
start: [
|
|
||||||
this.$store.state.dateMin ? this.$store.state.dateMin : dateMin,
|
|
||||||
this.$store.state.dateMax ? this.$store.state.dateMax : dateMax
|
|
||||||
],
|
|
||||||
|
|
||||||
tooltips: [true, true],
|
|
||||||
behaviour: "drag-tap",
|
|
||||||
connect: true,
|
|
||||||
range: {
|
|
||||||
"min": dateMin,
|
|
||||||
"max": dateMax,
|
|
||||||
},
|
|
||||||
format: {
|
|
||||||
to: x => humanDate(x),
|
|
||||||
from: x => x
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mergeTooltips(elem, 10, " - ", true)
|
|
||||||
|
|
||||||
elem.querySelectorAll('.noUi-connect')[0].classList.add("slider-color0")
|
|
||||||
|
|
||||||
slider.on("set", (values, handle, unencoded) => {
|
|
||||||
if (handle === 0) {
|
|
||||||
this.$store.commit("setDateMin", unencoded[0] === dateMin ? undefined : Math.round(unencoded[0]));
|
|
||||||
} else {
|
|
||||||
this.$store.commit("setDateMax", unencoded[1] >= dateMax ? undefined : Math.round(unencoded[1]));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
#dateSlider {
|
|
||||||
margin-top: 34px;
|
|
||||||
height: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-card class="mb-4 mt-4">
|
|
||||||
<b-card-title><DebugIcon class="mr-1"></DebugIcon>{{ $t("debug") }}</b-card-title>
|
|
||||||
<p v-html="$t('debugDescription')"></p>
|
|
||||||
|
|
||||||
<b-card-body>
|
|
||||||
|
|
||||||
<b-table :items="tableItems" small borderless responsive="md" thead-class="hidden" class="mb-0"></b-table>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
<IndexDebugInfo v-for="idx of $store.state.sist2Info.indices" :key="idx.id" :index="idx" class="mt-2"></IndexDebugInfo>
|
|
||||||
</b-card-body>
|
|
||||||
</b-card>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import IndexDebugInfo from "@/components/IndexDebugInfo";
|
|
||||||
import DebugIcon from "@/components/icons/DebugIcon";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "DebugInfo.vue",
|
|
||||||
components: {DebugIcon, IndexDebugInfo},
|
|
||||||
computed: {
|
|
||||||
tableItems() {
|
|
||||||
return [
|
|
||||||
{key: "version", value: this.$store.state.sist2Info.version},
|
|
||||||
{key: "platform", value: this.$store.state.sist2Info.platform},
|
|
||||||
{key: "debugBinary", value: this.$store.state.sist2Info.debug},
|
|
||||||
{key: "sist2CommitHash", value: this.$store.state.sist2Info.sist2Hash},
|
|
||||||
{key: "esIndex", value: this.$store.state.sist2Info.esIndex},
|
|
||||||
{key: "tagline", value: this.$store.state.sist2Info.tagline},
|
|
||||||
{key: "dev", value: this.$store.state.sist2Info.dev},
|
|
||||||
{key: "mongooseVersion", value: this.$store.state.sist2Info.mongooseVersion},
|
|
||||||
{key: "esVersion", value: this.$store.state.sist2Info.esVersion},
|
|
||||||
{key: "esVersionSupported", value: this.$store.state.sist2Info.esVersionSupported},
|
|
||||||
{key: "esVersionLegacy", value: this.$store.state.sist2Info.esVersionLegacy},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-button-group>
|
|
||||||
<b-button variant="primary" :title="$t('displayMode.list')" :pressed="optDisplay==='list'"
|
|
||||||
@click="setOptDisplay('list')">
|
|
||||||
<svg width="20px" height="20px" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
||||||
<path fill="currentColor"
|
|
||||||
d="M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"></path>
|
|
||||||
</svg>
|
|
||||||
</b-button>
|
|
||||||
|
|
||||||
<b-button variant="primary" :title="$t('displayMode.grid')" :pressed="optDisplay==='grid'"
|
|
||||||
@click="setOptDisplay('grid')">
|
|
||||||
<svg width="20px" height="20px" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
||||||
<path fill="currentColor"
|
|
||||||
d="M149.333 56v80c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V56c0-13.255 10.745-24 24-24h101.333c13.255 0 24 10.745 24 24zm181.334 240v-80c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.256 0 24.001-10.745 24.001-24zm32-240v80c0 13.255 10.745 24 24 24H488c13.255 0 24-10.745 24-24V56c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24zm-32 80V56c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.256 0 24.001-10.745 24.001-24zm-205.334 56H24c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24zM0 376v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H24c-13.255 0-24 10.745-24 24zm386.667-56H488c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24zm0 160H488c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H386.667c-13.255 0-24 10.745-24 24v80c0 13.255 10.745 24 24 24zM181.333 376v80c0 13.255 10.745 24 24 24h101.333c13.255 0 24-10.745 24-24v-80c0-13.255-10.745-24-24-24H205.333c-13.255 0-24 10.745-24 24z"></path>
|
|
||||||
</svg>
|
|
||||||
</b-button>
|
|
||||||
</b-button-group>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {mapGetters, mapMutations} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "DisplayModeToggle",
|
|
||||||
computed: {
|
|
||||||
...mapGetters(["optDisplay"])
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapMutations(["setOptDisplay"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="doc-card" :class="{'sub-document': doc._props.isSubDocument}" :style="`width: ${width}px`"
|
|
||||||
@click="$store.commit('busTnTouchStart', null)">
|
|
||||||
<b-card
|
|
||||||
no-body
|
|
||||||
img-top
|
|
||||||
>
|
|
||||||
<!-- Info modal-->
|
|
||||||
<DocInfoModal :show="showInfo" :doc="doc" @close="showInfo = false"></DocInfoModal>
|
|
||||||
|
|
||||||
<ContentDiv :doc="doc"></ContentDiv>
|
|
||||||
|
|
||||||
<!-- Thumbnail-->
|
|
||||||
<FullThumbnail :doc="doc" :small-badge="smallBadge" @onThumbnailClick="onThumbnailClick()"></FullThumbnail>
|
|
||||||
|
|
||||||
<!-- Audio player-->
|
|
||||||
<audio v-if="doc._props.isAudio" ref="audio" preload="none" class="audio-fit fit" controls
|
|
||||||
:type="doc._source.mime"
|
|
||||||
:src="`f/${doc._id}`"
|
|
||||||
@play="onAudioPlay()"></audio>
|
|
||||||
|
|
||||||
<b-card-body class="padding-03">
|
|
||||||
|
|
||||||
<!-- Title line -->
|
|
||||||
<div style="display: flex">
|
|
||||||
<span class="info-icon" @click="onInfoClick()"></span>
|
|
||||||
<DocFileTitle :doc="doc"></DocFileTitle>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tags -->
|
|
||||||
<div class="card-text">
|
|
||||||
<TagContainer :hit="doc"></TagContainer>
|
|
||||||
</div>
|
|
||||||
</b-card-body>
|
|
||||||
</b-card>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {ext, humanFileSize, humanTime} from "@/util";
|
|
||||||
import TagContainer from "@/components/TagContainer.vue";
|
|
||||||
import DocFileTitle from "@/components/DocFileTitle.vue";
|
|
||||||
import DocInfoModal from "@/components/DocInfoModal.vue";
|
|
||||||
import ContentDiv from "@/components/ContentDiv.vue";
|
|
||||||
import FullThumbnail from "@/components/FullThumbnail";
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {FullThumbnail, ContentDiv, DocInfoModal, DocFileTitle, TagContainer},
|
|
||||||
props: ["doc", "width"],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
ext: ext,
|
|
||||||
showInfo: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
smallBadge() {
|
|
||||||
return this.width < 150;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
humanFileSize: humanFileSize,
|
|
||||||
humanTime: humanTime,
|
|
||||||
onInfoClick() {
|
|
||||||
this.showInfo = true;
|
|
||||||
},
|
|
||||||
async onThumbnailClick() {
|
|
||||||
this.$store.commit("setUiLightboxSlide", this.doc._seq);
|
|
||||||
await this.$store.dispatch("showLightbox");
|
|
||||||
},
|
|
||||||
onAudioPlay() {
|
|
||||||
document.getElementsByTagName("audio").forEach((el) => {
|
|
||||||
if (el !== this.$refs["audio"]) {
|
|
||||||
el.pause();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
.fit {
|
|
||||||
display: block;
|
|
||||||
min-width: 64px;
|
|
||||||
max-width: 100%;
|
|
||||||
/*max-height: 400px;*/
|
|
||||||
margin: 0 auto 0;
|
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.audio-fit {
|
|
||||||
height: 39px;
|
|
||||||
vertical-align: bottom;
|
|
||||||
display: inline;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
.padding-03 {
|
|
||||||
padding: 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
margin-top: 1em;
|
|
||||||
margin-left: 0;
|
|
||||||
margin-right: 0;
|
|
||||||
box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .08) !important;
|
|
||||||
border-radius: 0;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body {
|
|
||||||
padding: 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.doc-card {
|
|
||||||
padding-left: 3px;
|
|
||||||
padding-right: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub-document .card {
|
|
||||||
background: #AB47BC1F !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .sub-document .card {
|
|
||||||
background: #37474F !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub-document .fit {
|
|
||||||
padding: 4px 4px 0 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<template>
|
|
||||||
<GridLayout
|
|
||||||
ref="grid-layout"
|
|
||||||
:options="gridOptions"
|
|
||||||
@append="append"
|
|
||||||
@layout-complete="$emit('layout-complete')"
|
|
||||||
>
|
|
||||||
<DocCard v-for="doc in docs" :key="doc._id" :doc="doc" :width="width"></DocCard>
|
|
||||||
</GridLayout>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Vue from "vue";
|
|
||||||
import DocCard from "@/components/DocCard";
|
|
||||||
|
|
||||||
import VueInfiniteGrid from "@egjs/vue-infinitegrid";
|
|
||||||
|
|
||||||
Vue.use(VueInfiniteGrid);
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
DocCard,
|
|
||||||
},
|
|
||||||
props: ["docs", "append"],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
width: 0,
|
|
||||||
gridOptions: {
|
|
||||||
align: "center",
|
|
||||||
margin: 0,
|
|
||||||
transitionDuration: 0,
|
|
||||||
isOverflowScroll: false,
|
|
||||||
isConstantSize: false,
|
|
||||||
useFit: false,
|
|
||||||
// Indicates whether keep the number of DOMs is maintained. If the useRecycle value is 'true', keep the number
|
|
||||||
// of DOMs is maintained. If the useRecycle value is 'false', the number of DOMs will increase as card elements
|
|
||||||
// are added.
|
|
||||||
useRecycle: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
colCount() {
|
|
||||||
const columns = this.$store.getters["optColumns"];
|
|
||||||
|
|
||||||
if (columns === "auto") {
|
|
||||||
return Math.round(this.$refs["grid-layout"].$el.scrollWidth / 300)
|
|
||||||
}
|
|
||||||
return columns;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.width = this.$refs["grid-layout"].$el.scrollWidth / this.colCount;
|
|
||||||
|
|
||||||
if (this.colCount === 1) {
|
|
||||||
this.$refs["grid-layout"].$el.classList.add("grid-single-column");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.subscribe((mutation) => {
|
|
||||||
if (mutation.type === "busUpdateWallItems" && this.$refs["grid-layout"]) {
|
|
||||||
this.$refs["grid-layout"].updateItems();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a :href="`f/${doc._id}`" class="file-title-anchor" target="_blank">
|
|
||||||
<div class="file-title" :title="doc._source.path + '/' + doc._source.name + ext(doc)"
|
|
||||||
v-html="fileName() + ext(doc)"></div>
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {ext} from "@/util";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "DocFileTitle",
|
|
||||||
props: ["doc"],
|
|
||||||
methods: {
|
|
||||||
ext: ext,
|
|
||||||
fileName() {
|
|
||||||
if (!this.doc.highlight) {
|
|
||||||
return this.doc._source.name;
|
|
||||||
}
|
|
||||||
if (this.doc.highlight["name.nGram"]) {
|
|
||||||
return this.doc.highlight["name.nGram"];
|
|
||||||
}
|
|
||||||
if (this.doc.highlight.name) {
|
|
||||||
return this.doc.highlight.name;
|
|
||||||
}
|
|
||||||
return this.doc._source.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.file-title-anchor {
|
|
||||||
max-width: calc(100% - 1.2rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.file-title {
|
|
||||||
width: 100%;
|
|
||||||
line-height: 1rem;
|
|
||||||
height: 1.1rem;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
font-size: 16px;
|
|
||||||
font-family: "Source Sans Pro", sans-serif;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .file-title {
|
|
||||||
color: #ddd;
|
|
||||||
}
|
|
||||||
.theme-black .file-title:hover {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-light .file-title {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.doc-card .file-title {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-modal :visible="show" size="lg" :hide-footer="true" static lazy @close="$emit('close')" @hide="$emit('close')"
|
|
||||||
>
|
|
||||||
<template #modal-title>
|
|
||||||
<h5 class="modal-title" :title="doc._source.name + ext(doc)">
|
|
||||||
{{ doc._source.name + ext(doc) }}
|
|
||||||
<router-link :to="`/file?byId=${doc._id}`">#</router-link>
|
|
||||||
</h5>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<img v-if="doc._props.hasThumbnail" :src="`t/${doc._source.index}/${doc._id}`" alt="" class="fit card-img-top">
|
|
||||||
|
|
||||||
<InfoTable :doc="doc"></InfoTable>
|
|
||||||
|
|
||||||
<LazyContentDiv :doc-id="doc._id"></LazyContentDiv>
|
|
||||||
</b-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {ext} from "@/util";
|
|
||||||
import InfoTable from "@/components/InfoTable";
|
|
||||||
import LazyContentDiv from "@/components/LazyContentDiv";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "DocInfoModal",
|
|
||||||
components: {LazyContentDiv, InfoTable},
|
|
||||||
props: ["doc", "show"],
|
|
||||||
methods: {
|
|
||||||
ext: ext,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-list-group class="mt-3">
|
|
||||||
<DocListItem v-for="doc in docs" :key="doc._id" :doc="doc"></DocListItem>
|
|
||||||
</b-list-group>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import DocListItem from "@/components/DocListItem.vue";
|
|
||||||
import Vue from "vue";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
name: "DocList",
|
|
||||||
components: {DocListItem},
|
|
||||||
props: ["docs", "append"],
|
|
||||||
mounted() {
|
|
||||||
window.addEventListener("scroll", () => {
|
|
||||||
const threshold = 400;
|
|
||||||
const app = document.getElementById("app");
|
|
||||||
|
|
||||||
if ((window.innerHeight + window.scrollY) >= app.offsetHeight - threshold) {
|
|
||||||
this.append();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
.theme-black .list-group-item {
|
|
||||||
background: #212121;
|
|
||||||
color: #e0e0e0;
|
|
||||||
|
|
||||||
border-bottom: none;
|
|
||||||
border-left: none;
|
|
||||||
border-right: none;
|
|
||||||
border-radius: 0;
|
|
||||||
padding: .25rem 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .list-group-item:first-child {
|
|
||||||
border-top: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-list-group-item class="flex-column align-items-start mb-2" :class="{'sub-document': doc._props.isSubDocument}"
|
|
||||||
@mouseenter="onTnEnter()" @mouseleave="onTnLeave()">
|
|
||||||
|
|
||||||
<!-- Info modal-->
|
|
||||||
<DocInfoModal :show="showInfo" :doc="doc" @close="showInfo = false"></DocInfoModal>
|
|
||||||
|
|
||||||
<div class="media ml-2">
|
|
||||||
|
|
||||||
<!-- Thumbnail-->
|
|
||||||
<div v-if="doc._props.hasThumbnail" class="align-self-start mr-2 wrapper-sm">
|
|
||||||
<div class="img-wrapper">
|
|
||||||
<div v-if="doc._props.isPlayableVideo" class="play">
|
|
||||||
<svg viewBox="0 0 494.942 494.942" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="m35.353 0 424.236 247.471-424.236 247.471z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<img v-if="doc._props.isPlayableImage || doc._props.isPlayableVideo"
|
|
||||||
:src="(doc._props.isGif && hover) ? `f/${doc._id}` : `t/${doc._source.index}/${doc._id}`"
|
|
||||||
alt=""
|
|
||||||
class="pointer fit-sm" @click="onThumbnailClick()">
|
|
||||||
<img v-else :src="`t/${doc._source.index}/${doc._id}`" alt=""
|
|
||||||
class="fit-sm">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="file-icon-wrapper" style="">
|
|
||||||
<FileIcon></FileIcon>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Doc line-->
|
|
||||||
<div class="doc-line ml-3">
|
|
||||||
<div style="display: flex">
|
|
||||||
<span class="info-icon" @click="showInfo = true"></span>
|
|
||||||
<DocFileTitle :doc="doc"></DocFileTitle>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Content highlight -->
|
|
||||||
<ContentDiv :doc="doc"></ContentDiv>
|
|
||||||
|
|
||||||
<div class="path-row">
|
|
||||||
<div class="path-line" v-html="path()"></div>
|
|
||||||
<TagContainer :hit="doc"></TagContainer>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="doc._source.pages || doc._source.author" class="path-row text-muted">
|
|
||||||
<span v-if="doc._source.pages">{{ doc._source.pages }} {{
|
|
||||||
doc._source.pages > 1 ? $t("pages") : $t("page")
|
|
||||||
}}</span>
|
|
||||||
<span v-if="doc._source.author && doc._source.pages" class="mx-1">-</span>
|
|
||||||
<span v-if="doc._source.author">{{ doc._source.author }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</b-list-group-item>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import TagContainer from "@/components/TagContainer";
|
|
||||||
import DocFileTitle from "@/components/DocFileTitle";
|
|
||||||
import DocInfoModal from "@/components/DocInfoModal";
|
|
||||||
import ContentDiv from "@/components/ContentDiv";
|
|
||||||
import FileIcon from "@/components/icons/FileIcon";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "DocListItem",
|
|
||||||
components: {FileIcon, ContentDiv, DocInfoModal, DocFileTitle, TagContainer},
|
|
||||||
props: ["doc"],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hover: false,
|
|
||||||
showInfo: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async onThumbnailClick() {
|
|
||||||
this.$store.commit("setUiLightboxSlide", this.doc._seq);
|
|
||||||
await this.$store.dispatch("showLightbox");
|
|
||||||
},
|
|
||||||
path() {
|
|
||||||
if (!this.doc.highlight) {
|
|
||||||
return this.doc._source.path + "/"
|
|
||||||
}
|
|
||||||
if (this.doc.highlight["path.text"]) {
|
|
||||||
return this.doc.highlight["path.text"] + "/"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.doc.highlight["path.nGram"]) {
|
|
||||||
return this.doc.highlight["path.nGram"] + "/"
|
|
||||||
}
|
|
||||||
return this.doc._source.path + "/"
|
|
||||||
},
|
|
||||||
onTnEnter() {
|
|
||||||
this.hover = true;
|
|
||||||
},
|
|
||||||
onTnLeave() {
|
|
||||||
this.hover = false;
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.sub-document {
|
|
||||||
background: #AB47BC1F !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .sub-document {
|
|
||||||
background: #37474F !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-group {
|
|
||||||
margin-top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-group-item {
|
|
||||||
padding: .25rem 0.5rem;
|
|
||||||
|
|
||||||
box-shadow: 0 0.125rem 0.25rem rgb(0 0 0 / 8%) !important;
|
|
||||||
border-radius: 0;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.path-row {
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
|
||||||
-ms-flex-align: start;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.path-line {
|
|
||||||
color: #808080;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
margin-right: 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .path-line {
|
|
||||||
color: #bbb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play {
|
|
||||||
position: absolute;
|
|
||||||
width: 18px;
|
|
||||||
height: 18px;
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play svg {
|
|
||||||
fill: rgba(0, 0, 0, 0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-group-item .img-wrapper {
|
|
||||||
width: 88px;
|
|
||||||
height: 88px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fit-sm {
|
|
||||||
max-height: 100%;
|
|
||||||
max-width: 100%;
|
|
||||||
width: auto;
|
|
||||||
height: auto;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
margin: auto;
|
|
||||||
|
|
||||||
/*box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.12);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.doc-line {
|
|
||||||
max-width: calc(100% - 88px - 1.5rem);
|
|
||||||
flex: 1;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin-top: auto;
|
|
||||||
margin-bottom: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.file-icon-wrapper {
|
|
||||||
width: calc(88px + .5rem);
|
|
||||||
height: 88px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-if="doc._props.hasThumbnail" class="img-wrapper" @mouseenter="onTnEnter()" @mouseleave="onTnLeave()"
|
|
||||||
@touchstart="onTouchStart()">
|
|
||||||
<div v-if="doc._props.isAudio" class="card-img-overlay" :class="{'small-badge': smallBadge}">
|
|
||||||
<span class="badge badge-resolution">{{ humanTime(doc._source.duration) }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="doc._props.isImage && !hover && doc._props.tnW / doc._props.tnH < 5"
|
|
||||||
class="card-img-overlay"
|
|
||||||
:class="{'small-badge': smallBadge}">
|
|
||||||
<span class="badge badge-resolution">{{ `${doc._source.width}x${doc._source.height}` }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="(doc._props.isVideo || doc._props.isGif) && doc._source.duration > 0 && !hover"
|
|
||||||
class="card-img-overlay"
|
|
||||||
:class="{'small-badge': smallBadge}">
|
|
||||||
<span class="badge badge-resolution">{{ humanTime(doc._source.duration) }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="doc._props.isPlayableVideo" class="play">
|
|
||||||
<svg viewBox="0 0 494.942 494.942" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="m35.353 0 424.236 247.471-424.236 247.471z"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<img ref="tn"
|
|
||||||
v-if="doc._props.isPlayableImage || doc._props.isPlayableVideo"
|
|
||||||
:src="tnSrc"
|
|
||||||
alt=""
|
|
||||||
:style="{height: (doc._props.isGif && hover) ? `${tnHeight()}px` : undefined}"
|
|
||||||
class="pointer fit card-img-top" @click="onThumbnailClick()">
|
|
||||||
<img v-else :src="tnSrc" alt=""
|
|
||||||
class="fit card-img-top">
|
|
||||||
|
|
||||||
<ThumbnailProgressBar v-if="hover && doc._props.hasVidPreview"
|
|
||||||
:progress="(currentThumbnailNum + 1) / (doc._props.tnNum)"
|
|
||||||
></ThumbnailProgressBar>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {humanTime} from "@/util";
|
|
||||||
import ThumbnailProgressBar from "@/components/ThumbnailProgressBar";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "FullThumbnail",
|
|
||||||
props: ["doc", "smallBadge"],
|
|
||||||
components: {ThumbnailProgressBar},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hover: false,
|
|
||||||
currentThumbnailNum: 0,
|
|
||||||
timeoutId: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.$store.subscribe((mutation) => {
|
|
||||||
if (mutation.type === "busTnTouchStart" && mutation.payload !== this.doc._id) {
|
|
||||||
this.onTnLeave();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
tnSrc() {
|
|
||||||
const doc = this.doc;
|
|
||||||
const props = doc._props;
|
|
||||||
if (props.isGif && this.hover) {
|
|
||||||
return `f/${doc._id}`;
|
|
||||||
}
|
|
||||||
return (this.currentThumbnailNum === 0)
|
|
||||||
? `t/${doc._source.index}/${doc._id}`
|
|
||||||
: `t/${doc._source.index}/${doc._id}${String(this.currentThumbnailNum).padStart(4, "0")}`;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
humanTime: humanTime,
|
|
||||||
onThumbnailClick() {
|
|
||||||
this.$emit("onThumbnailClick");
|
|
||||||
},
|
|
||||||
tnHeight() {
|
|
||||||
return this.$refs.tn.height;
|
|
||||||
},
|
|
||||||
tnWidth() {
|
|
||||||
return this.$refs.tn.width;
|
|
||||||
},
|
|
||||||
onTnEnter() {
|
|
||||||
this.hover = true;
|
|
||||||
if (this.doc._props.hasVidPreview) {
|
|
||||||
this.currentThumbnailNum += 1;
|
|
||||||
this.scheduleNextTnNum();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onTnLeave() {
|
|
||||||
this.currentThumbnailNum = 0;
|
|
||||||
this.hover = false;
|
|
||||||
if (this.timeoutId !== null) {
|
|
||||||
window.clearTimeout(this.timeoutId);
|
|
||||||
this.timeoutId = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scheduleNextTnNum() {
|
|
||||||
const INTERVAL = this.$store.state.optVidPreviewInterval ?? 700;
|
|
||||||
this.timeoutId = window.setTimeout(() => {
|
|
||||||
if (!this.hover) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.scheduleNextTnNum();
|
|
||||||
if (this.currentThumbnailNum === this.doc._props.tnNum - 1) {
|
|
||||||
this.currentThumbnailNum = 0;
|
|
||||||
} else {
|
|
||||||
this.currentThumbnailNum += 1;
|
|
||||||
}
|
|
||||||
}, INTERVAL);
|
|
||||||
},
|
|
||||||
onTouchStart() {
|
|
||||||
this.$store.commit("busTnTouchStart", this.doc._id);
|
|
||||||
if (!this.hover) {
|
|
||||||
this.onTnEnter()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.img-wrapper {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.img-wrapper:hover svg {
|
|
||||||
fill: rgba(0, 0, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-img-top {
|
|
||||||
border-top-left-radius: 0;
|
|
||||||
border-top-right-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play {
|
|
||||||
position: absolute;
|
|
||||||
width: 25px;
|
|
||||||
height: 25px;
|
|
||||||
left: 50%;
|
|
||||||
top: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play svg {
|
|
||||||
fill: rgba(0, 0, 0, 0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.badge-resolution {
|
|
||||||
color: #212529;
|
|
||||||
background-color: #FFC107;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-img-overlay {
|
|
||||||
pointer-events: none;
|
|
||||||
padding: 0.75rem;
|
|
||||||
bottom: unset;
|
|
||||||
top: 0;
|
|
||||||
left: unset;
|
|
||||||
right: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-badge {
|
|
||||||
padding: 1px 3px;
|
|
||||||
font-size: 70%;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-modal :visible="show" size="lg" :hide-footer="true" static :title="$t('help.help')"
|
|
||||||
@close="$emit('close')"
|
|
||||||
@hide="$emit('close')"
|
|
||||||
>
|
|
||||||
<h2>{{$t("help.simpleSearch")}}</h2>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td><code>+</code></td>
|
|
||||||
<td>{{$t("help.and")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>|</code></td>
|
|
||||||
<td>{{$t("help.or")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>-</code></td>
|
|
||||||
<td>{{$t("help.not")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>""</code></td>
|
|
||||||
<td>{{$t("help.quotes")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>{{$t("help.term")}}*</code></td>
|
|
||||||
<td>{{$t("help.prefix")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>(</code> {{$t("and")}} <code>)</code></td>
|
|
||||||
<td>{{$t("help.parens")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>{{$t("help.term")}}~N</code></td>
|
|
||||||
<td>{{$t("help.tildeTerm")}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>"..."~N</code></td>
|
|
||||||
<td>{{$t("help.tildePhrase")}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<p v-html="$t('help.example1')"></p>
|
|
||||||
|
|
||||||
<p v-html="$t('help.defaultOperator')"></p>
|
|
||||||
|
|
||||||
<p v-html="$t('help.fuzzy')"></p>
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<p v-html="$t('help.moreInfoSimple')"></p>
|
|
||||||
|
|
||||||
<p></p>
|
|
||||||
|
|
||||||
<h2>{{$t("help.advancedSearch")}}</h2>
|
|
||||||
<p v-html="$t('help.moreInfoAdvanced')"></p>
|
|
||||||
|
|
||||||
</b-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "HelpDialog",
|
|
||||||
props: ["show"]
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<h4>[{{ index.name }}]</h4>
|
|
||||||
<b-table :items="tableItems" small borderless responsive="md" thead-class="hidden" class="mb-0"></b-table>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {humanDate} from "@/util";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "IndexDebugInfo",
|
|
||||||
props: ["index"],
|
|
||||||
computed: {
|
|
||||||
tableItems() {
|
|
||||||
return [
|
|
||||||
{key: this.$t("name"), value: this.index.name},
|
|
||||||
{key: this.$t("id"), value: this.index.id},
|
|
||||||
{key: this.$t("indexVersion"), value: this.index.version},
|
|
||||||
{key: this.$t("rewriteUrl"), value: this.index.rewriteUrl},
|
|
||||||
{key: this.$t("timestamp"), value: humanDate(this.index.timestamp)},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-if="isMobile">
|
|
||||||
<b-form-select
|
|
||||||
:value="selectedIndicesIds"
|
|
||||||
@change="onSelect($event)"
|
|
||||||
:options="indices" multiple :select-size="6" text-field="name"
|
|
||||||
value-field="id"></b-form-select>
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-content-center">
|
|
||||||
<span>
|
|
||||||
{{ selectedIndices.length }}
|
|
||||||
{{ selectedIndices.length === 1 ? $t("indexPicker.selectedIndex") : $t("indexPicker.selectedIndices") }}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<b-button variant="link" @click="selectAll()"> {{ $t("indexPicker.selectAll") }}</b-button>
|
|
||||||
<b-button variant="link" @click="selectNone()"> {{ $t("indexPicker.selectNone") }}</b-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<b-list-group id="index-picker-desktop" class="unselectable">
|
|
||||||
<b-list-group-item
|
|
||||||
v-for="idx in indices"
|
|
||||||
@click="toggleIndex(idx, $event)"
|
|
||||||
@click.shift="shiftClick(idx, $event)"
|
|
||||||
class="d-flex justify-content-between align-items-center list-group-item-action pointer"
|
|
||||||
:class="{active: lastClickIndex === idx}"
|
|
||||||
>
|
|
||||||
<div class="d-flex">
|
|
||||||
<b-checkbox style="pointer-events: none" :checked="isSelected(idx)"></b-checkbox>
|
|
||||||
{{ idx.name }}
|
|
||||||
<span class="text-muted timestamp-text ml-2">{{ formatIdxDate(idx.timestamp) }}</span>
|
|
||||||
</div>
|
|
||||||
<b-badge class="version-badge">v{{ idx.version }}</b-badge>
|
|
||||||
</b-list-group-item>
|
|
||||||
</b-list-group>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import SmallBadge from "./SmallBadge.vue"
|
|
||||||
import {mapActions, mapGetters} from "vuex";
|
|
||||||
import Vue from "vue";
|
|
||||||
import {format} from "date-fns";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
components: {
|
|
||||||
SmallBadge
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loading: true,
|
|
||||||
lastClickIndex: null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapGetters([
|
|
||||||
"indices", "selectedIndices"
|
|
||||||
]),
|
|
||||||
selectedIndicesIds() {
|
|
||||||
return this.selectedIndices.map(idx => idx.id)
|
|
||||||
},
|
|
||||||
isMobile() {
|
|
||||||
return window.innerWidth <= 650;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapActions({
|
|
||||||
setSelectedIndices: "setSelectedIndices"
|
|
||||||
}),
|
|
||||||
shiftClick(index, e) {
|
|
||||||
if (this.lastClickIndex === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const select = this.isSelected(this.lastClickIndex);
|
|
||||||
|
|
||||||
let leftBoundary = this.indices.indexOf(this.lastClickIndex);
|
|
||||||
let rightBoundary = this.indices.indexOf(index);
|
|
||||||
|
|
||||||
if (rightBoundary < leftBoundary) {
|
|
||||||
let tmp = leftBoundary;
|
|
||||||
leftBoundary = rightBoundary;
|
|
||||||
rightBoundary = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = leftBoundary; i <= rightBoundary; i++) {
|
|
||||||
if (select) {
|
|
||||||
if (!this.isSelected(this.indices[i])) {
|
|
||||||
this.setSelectedIndices([this.indices[i], ...this.selectedIndices]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.setSelectedIndices(this.selectedIndices.filter(idx => idx !== this.indices[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectAll() {
|
|
||||||
this.setSelectedIndices(this.indices);
|
|
||||||
},
|
|
||||||
selectNone() {
|
|
||||||
this.setSelectedIndices([]);
|
|
||||||
},
|
|
||||||
onSelect(value) {
|
|
||||||
this.setSelectedIndices(this.indices.filter(idx => value.includes(idx.id)));
|
|
||||||
},
|
|
||||||
formatIdxDate(timestamp: number): string {
|
|
||||||
return format(new Date(timestamp * 1000), "yyyy-MM-dd");
|
|
||||||
},
|
|
||||||
toggleIndex(index, e) {
|
|
||||||
if (e.shiftKey) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lastClickIndex = index;
|
|
||||||
if (this.isSelected(index)) {
|
|
||||||
this.setSelectedIndices(this.selectedIndices.filter(idx => idx.id != index.id));
|
|
||||||
} else {
|
|
||||||
this.setSelectedIndices([index, ...this.selectedIndices]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isSelected(index) {
|
|
||||||
return this.selectedIndices.find(idx => idx.id == index.id) != null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.timestamp-text {
|
|
||||||
line-height: 24px;
|
|
||||||
font-size: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .version-badge {
|
|
||||||
color: #eee !important;
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.version-badge {
|
|
||||||
color: #222 !important;
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-group-item {
|
|
||||||
padding: 0.2em 0.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#index-picker-desktop {
|
|
||||||
overflow-y: auto;
|
|
||||||
max-height: 132px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-link:focus {
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.unselectable {
|
|
||||||
user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list-group-item.active {
|
|
||||||
z-index: 2;
|
|
||||||
background-color: inherit;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .list-group-item {
|
|
||||||
border: 1px solid rgba(255,255,255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .list-group-item:first-child {
|
|
||||||
border: 1px solid rgba(255,255,255, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .list-group-item.active {
|
|
||||||
z-index: 2;
|
|
||||||
background-color: inherit;
|
|
||||||
color: inherit;
|
|
||||||
border: 1px solid rgba(255,255,255, 0.3);
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .list-group {
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-table :items="tableItems" small borderless responsive="md" thead-class="hidden" class="mb-0 mt-4">
|
|
||||||
<template #cell(value)="data">
|
|
||||||
<span v-if="'html' in data.item" v-html="data.item.html"></span>
|
|
||||||
<span v-else>{{ data.value }}</span>
|
|
||||||
</template>
|
|
||||||
</b-table>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {humanDate, humanFileSize} from "@/util";
|
|
||||||
|
|
||||||
function makeGpsLink(latitude, longitude) {
|
|
||||||
|
|
||||||
if (isNaN(latitude) || isNaN(longitude)) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return `<a target="_blank" href="https://maps.google.com/?q=${latitude},${longitude}&ll=${latitude},${longitude}&t=k&z=17">${latitude}, ${longitude}</a>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function dmsToDecimal(dms, ref) {
|
|
||||||
const tokens = dms.split(",")
|
|
||||||
|
|
||||||
const d = Number(tokens[0].trim().split(":")[0]) / Number(tokens[0].trim().split(":")[1])
|
|
||||||
const m = Number(tokens[1].trim().split(":")[0]) / Number(tokens[1].trim().split(":")[1])
|
|
||||||
const s = Number(tokens[2].trim().split(":")[0]) / Number(tokens[2].trim().split(":")[1])
|
|
||||||
|
|
||||||
return (d + (m / 60) + (s / 3600)) * (ref === "S" || ref === "W" ? -1 : 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "InfoTable",
|
|
||||||
props: ["doc"],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
indexName: "loading..."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
tableItems() {
|
|
||||||
this.indexName;
|
|
||||||
const src = this.doc._source;
|
|
||||||
|
|
||||||
const items = [
|
|
||||||
{key: "index", value: `[${this.indexName}]`},
|
|
||||||
{key: "mtime", value: humanDate(src.mtime)},
|
|
||||||
{key: "mime", value: src.mime},
|
|
||||||
{key: "size", value: humanFileSize(src.size)},
|
|
||||||
{key: "path", value: src.path},
|
|
||||||
];
|
|
||||||
|
|
||||||
if ("width" in this.doc._source) {
|
|
||||||
items.push({
|
|
||||||
key: "image size",
|
|
||||||
value: `${src.width}x${src.height}`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const fields = [
|
|
||||||
"title", "duration", "audioc", "videoc",
|
|
||||||
"bitrate", "artist", "album", "album_artist", "genre", "font_name", "author",
|
|
||||||
"modified_by", "pages", "tag",
|
|
||||||
"exif_make", "exif_software", "exif_exposure_time", "exif_fnumber", "exif_focal_length",
|
|
||||||
"exif_user_comment", "exif_iso_speed_ratings", "exif_model", "exif_datetime",
|
|
||||||
"checksum"
|
|
||||||
];
|
|
||||||
|
|
||||||
fields.forEach(field => {
|
|
||||||
if (field in src) {
|
|
||||||
items.push({key: field, value: src[field]});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.keys(src).forEach(key => {
|
|
||||||
if (key.startsWith("mt_") || key.startsWith("int_")) {
|
|
||||||
items.push({key: key, value: src[key]});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Exif GPS
|
|
||||||
if ("exif_gps_longitude_dec" in src) {
|
|
||||||
items.push({
|
|
||||||
key: "Exif GPS",
|
|
||||||
html: makeGpsLink(src["exif_gps_latitude_dec"], src["exif_gps_longitude_dec"]),
|
|
||||||
});
|
|
||||||
} else if ("exif_gps_longitude_dms" in src) {
|
|
||||||
items.push({
|
|
||||||
key: "Exif GPS",
|
|
||||||
html: makeGpsLink(
|
|
||||||
dmsToDecimal(src["exif_gps_latitude_dms"], src["exif_gps_latitude_ref"]),
|
|
||||||
dmsToDecimal(src["exif_gps_longitude_dms"], src["exif_gps_longitude_ref"]),
|
|
||||||
),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
if (this.$store.getters.indexMap[this.doc.index]) {
|
|
||||||
this.indexName = this.$store.getters.indexMap[this.doc._source.index].name
|
|
||||||
}
|
|
||||||
|
|
||||||
window.setTimeout(() => {
|
|
||||||
this.indexName = this.$store.getters.indexMap[this.doc._source.index].name
|
|
||||||
}, 500)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Preloader v-if="loading"></Preloader>
|
|
||||||
<div v-else-if="content" class="content-div" v-html="content"></div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
import Preloader from "@/components/Preloader";
|
|
||||||
import Sist2Query from "@/Sist2Query";
|
|
||||||
import store from "@/store";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "LazyContentDiv",
|
|
||||||
components: {Preloader},
|
|
||||||
props: ["docId"],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
content: "",
|
|
||||||
loading: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
const query = Sist2Query.searchQuery();
|
|
||||||
|
|
||||||
if (this.$store.state.optHighlight) {
|
|
||||||
|
|
||||||
const fields = this.$store.state.fuzzy
|
|
||||||
? {"content.nGram": {}}
|
|
||||||
: {content: {}};
|
|
||||||
|
|
||||||
query.highlight = {
|
|
||||||
pre_tags: ["<mark>"],
|
|
||||||
post_tags: ["</mark>"],
|
|
||||||
number_of_fragments: 0,
|
|
||||||
fields,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!store.state.sist2Info.esVersionLegacy) {
|
|
||||||
query.highlight.max_analyzed_offset = 999_999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("function_score" in query.query) {
|
|
||||||
query.query = query.query.function_score.query;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!("must" in query.query.bool)) {
|
|
||||||
query.query.bool.must = [];
|
|
||||||
} else if (!Array.isArray(query.query.bool.must)) {
|
|
||||||
query.query.bool.must = [query.query.bool.must];
|
|
||||||
}
|
|
||||||
|
|
||||||
query.query.bool.must.push({match: {_id: this.docId}});
|
|
||||||
|
|
||||||
delete query["sort"];
|
|
||||||
delete query["aggs"];
|
|
||||||
delete query["search_after"];
|
|
||||||
delete query.query["function_score"];
|
|
||||||
|
|
||||||
query._source = {
|
|
||||||
includes: ["content", "name", "path", "extension"]
|
|
||||||
}
|
|
||||||
|
|
||||||
query.size = 1;
|
|
||||||
|
|
||||||
Sist2Api.esQuery(query).then(resp => {
|
|
||||||
this.loading = false;
|
|
||||||
if (resp.hits.hits.length === 1) {
|
|
||||||
this.content = this.getContent(resp.hits.hits[0]);
|
|
||||||
} else {
|
|
||||||
console.log("FIXME: could not get content")
|
|
||||||
console.log(resp)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getContent(doc) {
|
|
||||||
if (!doc.highlight) {
|
|
||||||
return doc._source.content;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.highlight["content.nGram"]) {
|
|
||||||
return doc.highlight["content.nGram"][0];
|
|
||||||
}
|
|
||||||
if (doc.highlight.content) {
|
|
||||||
return doc.highlight.content[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div :class="{'disable-animations': $store.state.optSimpleLightbox}">
|
|
||||||
<FsLightbox
|
|
||||||
ref="lightbox"
|
|
||||||
:key="lightboxKey"
|
|
||||||
:toggler="showLightbox"
|
|
||||||
:sources="lightboxSources"
|
|
||||||
:thumbs="lightboxThumbs"
|
|
||||||
:captions="lightboxCaptions"
|
|
||||||
:types="lightboxTypes"
|
|
||||||
:source-index="lightboxSlide"
|
|
||||||
:custom-toolbar-buttons="customButtons"
|
|
||||||
:slideshow-time="$store.getters.optLightboxSlideDuration * 1000"
|
|
||||||
:zoom-increment="0.25"
|
|
||||||
:load-only-current-source="$store.getters.optLightboxLoadOnlyCurrent"
|
|
||||||
:on-close="onClose"
|
|
||||||
:on-open="onShow"
|
|
||||||
:on-slide-change="onSlideChange"
|
|
||||||
></FsLightbox>
|
|
||||||
|
|
||||||
<a id="lightbox-download" style="display: none"></a>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import FsLightbox from "fslightbox-vue";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Lightbox",
|
|
||||||
components: {FsLightbox},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
disableAnimations: true,
|
|
||||||
customButtons: [
|
|
||||||
{
|
|
||||||
viewBox: "0 0 384.928 384.928",
|
|
||||||
d: "M321.339,245.334c-4.74-4.692-12.439-4.704-17.179,0l-99.551,98.564V12.03 c0-6.641-5.438-12.03-12.151-12.03s-12.151,5.39-12.151,12.03v331.868l-99.551-98.552c-4.74-4.704-12.439-4.704-17.179,0 s-4.74,12.319,0,17.011l120.291,119.088c4.692,4.644,12.499,4.644,17.191,0l120.291-119.088 C326.091,257.653,326.091,250.038,321.339,245.334C316.599,240.642,326.091,250.038,321.339,245.334z",
|
|
||||||
width: "17px",
|
|
||||||
height: "17px",
|
|
||||||
title: "Download",
|
|
||||||
onClick: this.onDownloadClick
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
showLightbox() {
|
|
||||||
return this.$store.getters["uiShowLightbox"];
|
|
||||||
},
|
|
||||||
lightboxSources() {
|
|
||||||
return this.$store.getters["uiLightboxSources"];
|
|
||||||
},
|
|
||||||
lightboxThumbs() {
|
|
||||||
return this.$store.getters["uiLightboxThumbs"];
|
|
||||||
},
|
|
||||||
lightboxKey() {
|
|
||||||
return this.$store.getters["uiLightboxKey"];
|
|
||||||
},
|
|
||||||
lightboxSlide() {
|
|
||||||
return this.$store.getters["uiLightboxSlide"];
|
|
||||||
},
|
|
||||||
lightboxCaptions() {
|
|
||||||
return this.$store.getters["uiLightboxCaptions"];
|
|
||||||
},
|
|
||||||
lightboxTypes() {
|
|
||||||
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: {
|
|
||||||
keyDownListener(e) {
|
|
||||||
|
|
||||||
const isLightboxOpen = this.$refs.lightbox === undefined || this.$refs.lightbox.$el.tagName === undefined;
|
|
||||||
|
|
||||||
if (isLightboxOpen) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lightboxStore = this.$refs.lightbox.fsLightboxStore.slice(-1)[0];
|
|
||||||
|
|
||||||
switch (e.key) {
|
|
||||||
case " ": {
|
|
||||||
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];
|
|
||||||
|
|
||||||
if (vid) {
|
|
||||||
if (vid.paused) {
|
|
||||||
vid.play();
|
|
||||||
} else {
|
|
||||||
vid.pause()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case "ArrowUp":
|
|
||||||
case "k": {
|
|
||||||
if (!lightboxStore.data.isThumbing && lightboxStore.core.thumbsToggler) {
|
|
||||||
lightboxStore.core.thumbsToggler.toggleThumbs();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case "ArrowDown":
|
|
||||||
case "j": {
|
|
||||||
if (lightboxStore.data.isThumbing && lightboxStore.core.thumbsToggler) {
|
|
||||||
lightboxStore.core.thumbsToggler.toggleThumbs();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case "h": {
|
|
||||||
if (lightboxStore.core.stageManager.getPreviousSlideIndex) {
|
|
||||||
lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getPreviousSlideIndex());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case "l": {
|
|
||||||
if (lightboxStore.core.stageManager.getNextSlideIndex) {
|
|
||||||
lightboxStore.core.slideIndexChanger.jumpTo(lightboxStore.core.stageManager.getNextSlideIndex());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
onDownloadClick() {
|
|
||||||
const url = this.lightboxSources[this.lightboxSlide];
|
|
||||||
|
|
||||||
const a = document.getElementById("lightbox-download");
|
|
||||||
a.setAttribute("href", url);
|
|
||||||
a.setAttribute("download", "");
|
|
||||||
a.click();
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
this.$store.commit("setUiLightboxIsOpen", true);
|
|
||||||
},
|
|
||||||
onClose() {
|
|
||||||
this.$store.commit("setUiLightboxIsOpen", false);
|
|
||||||
},
|
|
||||||
onSlideChange() {
|
|
||||||
// Pause all videos when changing slide
|
|
||||||
document.getElementsByTagName("video").forEach((el) => {
|
|
||||||
el.pause();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.fslightbox-toolbar-button:nth-child(2) {
|
|
||||||
order: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fslightbox-toolbar-button:nth-child(1) {
|
|
||||||
order: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fslightbox-toolbar-button:nth-child(3) {
|
|
||||||
order: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fslightbox-toolbar-button:nth-child(4) {
|
|
||||||
order: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fslightbox-toolbar-button:nth-child(5) {
|
|
||||||
order: 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 650px) {
|
|
||||||
/* Disable fullscreen on mobile because it's buggy */
|
|
||||||
.fslightbox-toolbar-button:nth-child(6) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fslightbox-toolbar-button:nth-child(6) {
|
|
||||||
order: 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fslightbox-toolbar-button:nth-child(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>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="lightbox-caption">
|
|
||||||
<p>
|
|
||||||
<b>{{
|
|
||||||
`[${$store.getters.indices.find(i => i.id === hit._source.index).name}]`
|
|
||||||
}}</b>{{ `${hit._source.path === '' ? '' : '/'}${hit._source.path}/${hit._source.name}${ext(hit)}` }}
|
|
||||||
</p>
|
|
||||||
<p style="margin-top: -1em">
|
|
||||||
<span v-if="hit._source.width">{{ `${hit._source.width}x${hit._source.height}`}}</span>
|
|
||||||
{{ ` (${humanFileSize(hit._source.size)})` }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {ext, humanFileSize} from "@/util";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "LightboxCaption",
|
|
||||||
props: ["hit"],
|
|
||||||
methods: {
|
|
||||||
humanFileSize: humanFileSize,
|
|
||||||
ext: ext
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div id="mimeTree"></div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import InspireTree from "inspire-tree";
|
|
||||||
import InspireTreeDOM from "inspire-tree-dom";
|
|
||||||
|
|
||||||
import "inspire-tree-dom/dist/inspire-tree-light.min.css";
|
|
||||||
import {getSelectedTreeNodes, getTreeNodeAttributes} from "@/util";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
import Sist2Query from "@/Sist2Query";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "MimePicker",
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
mimeTree: null,
|
|
||||||
stashedMimeTreeAttributes: null,
|
|
||||||
updateBusy: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.subscribe((mutation) => {
|
|
||||||
if (mutation.type === "setUiMimeMap" && this.mimeTree === null) {
|
|
||||||
this.initializeTree();
|
|
||||||
} else if (mutation.type === "busSearch") {
|
|
||||||
this.updateTree();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleTreeClick(node, e) {
|
|
||||||
if (e === "indeterminate" || e === "collapsed" || e === 'rendered' || e === "focused") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.updateBusy) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.commit("setSelectedMimeTypes", getSelectedTreeNodes(this.mimeTree));
|
|
||||||
},
|
|
||||||
updateTree() {
|
|
||||||
|
|
||||||
if (this.$store.getters.optUpdateMimeMap === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.updateBusy) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.updateBusy = true;
|
|
||||||
|
|
||||||
if (this.stashedMimeTreeAttributes === null) {
|
|
||||||
this.stashedMimeTreeAttributes = getTreeNodeAttributes(this.mimeTree);
|
|
||||||
}
|
|
||||||
|
|
||||||
const query = Sist2Query.searchQuery();
|
|
||||||
|
|
||||||
Sist2Api.getMimeTypes(query).then(({buckets, mimeMap}) => {
|
|
||||||
this.$store.commit("setUiMimeMap", mimeMap);
|
|
||||||
this.$store.commit("setUiDetailsMimeAgg", buckets);
|
|
||||||
|
|
||||||
this.mimeTree.removeAll();
|
|
||||||
this.mimeTree.addNodes(mimeMap);
|
|
||||||
|
|
||||||
// Restore selected mimes
|
|
||||||
if (this.stashedMimeTreeAttributes === null) {
|
|
||||||
// NOTE: This happens when successive fast searches are triggered
|
|
||||||
this.stashedMimeTreeAttributes = {};
|
|
||||||
// Always add the selected mime types
|
|
||||||
this.$store.state.selectedMimeTypes.forEach(mime => {
|
|
||||||
this.stashedMimeTreeAttributes[mime] = {
|
|
||||||
checked: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.entries(this.stashedMimeTreeAttributes).forEach(([mime, attributes]) => {
|
|
||||||
if (this.mimeTree.node(mime)) {
|
|
||||||
if (attributes.checked) {
|
|
||||||
this.mimeTree.node(mime).select();
|
|
||||||
}
|
|
||||||
if (attributes.collapsed === false) {
|
|
||||||
this.mimeTree.node(mime).expand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.stashedMimeTreeAttributes = null;
|
|
||||||
this.updateBusy = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
initializeTree() {
|
|
||||||
const mimeMap = this.$store.state.uiMimeMap;
|
|
||||||
|
|
||||||
this.mimeTree = new InspireTree({
|
|
||||||
selection: {
|
|
||||||
mode: "checkbox"
|
|
||||||
},
|
|
||||||
data: mimeMap
|
|
||||||
});
|
|
||||||
|
|
||||||
new InspireTreeDOM(this.mimeTree, {
|
|
||||||
target: "#mimeTree"
|
|
||||||
});
|
|
||||||
this.mimeTree.on("node.state.changed", this.handleTreeClick);
|
|
||||||
this.mimeTree.deselect();
|
|
||||||
|
|
||||||
if (this.$store.state._onLoadSelectedMimeTypes.length > 0) {
|
|
||||||
this.$store.state._onLoadSelectedMimeTypes.forEach(mime => {
|
|
||||||
this.mimeTree.node(mime).select();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
#mimeTree {
|
|
||||||
max-height: 350px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-navbar>
|
|
||||||
<b-navbar-brand v-if="$route.path !== '/'" to="/">
|
|
||||||
<Sist2Icon></Sist2Icon>
|
|
||||||
</b-navbar-brand>
|
|
||||||
<b-navbar-brand v-else href=".">
|
|
||||||
<Sist2Icon></Sist2Icon>
|
|
||||||
</b-navbar-brand>
|
|
||||||
|
|
||||||
<span class="badge badge-pill version" v-if="$store && $store.state.sist2Info">
|
|
||||||
v{{ sist2Version() }}<span v-if="isDebug()">-dbg</span><span v-if="isLegacy() && !hideLegacy()">-<a
|
|
||||||
href="https://github.com/simon987/sist2/blob/master/docs/USAGE.md#elasticsearch" target="_blank">legacyES</a></span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span v-if="$store && $store.state.sist2Info" class="tagline" v-html="tagline()"></span>
|
|
||||||
|
|
||||||
<b-button class="ml-auto" to="stats" variant="link">{{ $t("stats") }}</b-button>
|
|
||||||
<b-button to="config" variant="link">{{ $t("config") }}</b-button>
|
|
||||||
</b-navbar>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import Sist2Icon from "@/components/icons/Sist2Icon";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "NavBar",
|
|
||||||
components: {Sist2Icon},
|
|
||||||
methods: {
|
|
||||||
tagline() {
|
|
||||||
return this.$store.state.sist2Info.tagline;
|
|
||||||
},
|
|
||||||
sist2Version() {
|
|
||||||
return this.$store.state.sist2Info.version;
|
|
||||||
},
|
|
||||||
isDebug() {
|
|
||||||
return this.$store.state.sist2Info.debug;
|
|
||||||
},
|
|
||||||
isLegacy() {
|
|
||||||
return this.$store.state.sist2Info.esVersionLegacy;
|
|
||||||
},
|
|
||||||
hideLegacy() {
|
|
||||||
return this.$store.state.optHideLegacy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.navbar {
|
|
||||||
box-shadow: 0 0.125rem 0.25rem rgb(0 0 0 / 8%) !important;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .navbar {
|
|
||||||
background: #546b7a30;
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
color: #222 !important;
|
|
||||||
font-size: 1.75rem;
|
|
||||||
padding: 0;
|
|
||||||
font-family: Hack;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand:hover {
|
|
||||||
color: #000 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.version {
|
|
||||||
color: #222 !important;
|
|
||||||
margin-left: -18px;
|
|
||||||
margin-top: -14px;
|
|
||||||
font-size: 11px;
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .version {
|
|
||||||
color: #f5f5f5 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .navbar-brand {
|
|
||||||
font-size: 1.75rem;
|
|
||||||
padding: 0;
|
|
||||||
color: #f5f5f5 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black a:hover, .theme-black .btn:hover {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .navbar span {
|
|
||||||
color: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 650px) {
|
|
||||||
.tagline {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.version {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-light .btn-link {
|
|
||||||
color: #222;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,245 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div class="input-group" style="margin-bottom: 0.5em; margin-top: 1em">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
|
|
||||||
<b-button variant="outline-secondary" @click="$refs['path-modal'].show()">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" width="20px">
|
|
||||||
<path
|
|
||||||
fill="currentColor"
|
|
||||||
d="M288 224h224a32 32 0 0 0 32-32V64a32 32 0 0 0-32-32H400L368 0h-80a32 32 0 0 0-32 32v64H64V8a8 8 0 0 0-8-8H40a8 8 0 0 0-8 8v392a16 16 0 0 0 16 16h208v64a32 32 0 0 0 32 32h224a32 32 0 0 0 32-32V352a32 32 0 0 0-32-32H400l-32-32h-80a32 32 0 0 0-32 32v64H64V128h192v64a32 32 0 0 0 32 32zm0 96h66.74l32 32H512v128H288zm0-288h66.74l32 32H512v128H288z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</b-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<VueSimpleSuggest
|
|
||||||
class="form-control-fix-flex"
|
|
||||||
@input="setPathText"
|
|
||||||
:value="getPathText"
|
|
||||||
:list="suggestPath"
|
|
||||||
:max-suggestions="0"
|
|
||||||
:placeholder="$t('pathBar.placeholder')"
|
|
||||||
>
|
|
||||||
<!-- Suggestion item template-->
|
|
||||||
<div slot="suggestion-item" slot-scope="{ suggestion, query }">
|
|
||||||
<div class="suggestion-line" :title="suggestion">
|
|
||||||
<strong>{{ query }}</strong>{{ getSuggestionWithoutQueryPrefix(suggestion, query) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</VueSimpleSuggest>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<b-modal ref="path-modal" :title="$t('pathBar.modalTitle')" size="lg" :hide-footer="true" static>
|
|
||||||
<div id="pathTree"></div>
|
|
||||||
</b-modal>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import InspireTree from "inspire-tree";
|
|
||||||
import InspireTreeDOM from "inspire-tree-dom";
|
|
||||||
|
|
||||||
import "inspire-tree-dom/dist/inspire-tree-light.min.css";
|
|
||||||
import Sist2Api from "@/Sist2Api";
|
|
||||||
import {mapGetters, mapMutations} from "vuex";
|
|
||||||
import VueSimpleSuggest from 'vue-simple-suggest'
|
|
||||||
import 'vue-simple-suggest/dist/styles.css' // Optional CSS
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "PathTree",
|
|
||||||
components: {
|
|
||||||
VueSimpleSuggest
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
mimeTree: null,
|
|
||||||
pathItems: [],
|
|
||||||
tmpPath: ""
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapGetters(["getPathText"])
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.subscribe((mutation) => {
|
|
||||||
// Wait until indices are loaded to get the root paths
|
|
||||||
if (mutation.type === "setIndices") {
|
|
||||||
let pathTree = new InspireTree({
|
|
||||||
data: (node, resolve, reject) => {
|
|
||||||
return this.getNextDepth(node);
|
|
||||||
},
|
|
||||||
sort: "text"
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$store.state.indices.forEach(idx => {
|
|
||||||
pathTree.addNode({
|
|
||||||
id: "/" + idx.id,
|
|
||||||
values: ["/" + idx.id],
|
|
||||||
text: `/[${idx.name}]`,
|
|
||||||
index: idx.id,
|
|
||||||
depth: 0,
|
|
||||||
children: true
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
new InspireTreeDOM(pathTree, {
|
|
||||||
target: "#pathTree"
|
|
||||||
});
|
|
||||||
|
|
||||||
pathTree.on("node.click", this.handleTreeClick);
|
|
||||||
pathTree.expand();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapMutations(["setPathText"]),
|
|
||||||
getSuggestionWithoutQueryPrefix(suggestion, query) {
|
|
||||||
return suggestion.slice(query.length)
|
|
||||||
},
|
|
||||||
async getPathChoices() {
|
|
||||||
return new Promise(getPaths => {
|
|
||||||
const q = {
|
|
||||||
suggest: {
|
|
||||||
path: {
|
|
||||||
prefix: this.getPathText,
|
|
||||||
completion: {
|
|
||||||
field: "suggest-path",
|
|
||||||
skip_duplicates: true,
|
|
||||||
size: 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Sist2Api.esQuery(q)
|
|
||||||
.then(resp => getPaths(resp["suggest"]["path"][0]["options"].map(opt => opt["_source"]["path"])));
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async suggestPath(term) {
|
|
||||||
if (!this.$store.state.optSuggestPath) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
term = term.toLowerCase();
|
|
||||||
|
|
||||||
const choices = await this.getPathChoices();
|
|
||||||
|
|
||||||
let matches = [];
|
|
||||||
for (let i = 0; i < choices.length; i++) {
|
|
||||||
if (~choices[i].toLowerCase().indexOf(term)) {
|
|
||||||
matches.push(choices[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return matches.sort((a, b) => a.length - b.length);
|
|
||||||
},
|
|
||||||
getNextDepth(node) {
|
|
||||||
const q = {
|
|
||||||
query: {
|
|
||||||
bool: {
|
|
||||||
filter: [
|
|
||||||
{term: {index: node.index}},
|
|
||||||
{range: {_depth: {gte: node.depth + 1, lte: node.depth + 3}}},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
aggs: {
|
|
||||||
paths: {
|
|
||||||
terms: {
|
|
||||||
field: "path",
|
|
||||||
size: 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
size: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
if (node.depth > 0) {
|
|
||||||
q.query.bool.must = {
|
|
||||||
prefix: {
|
|
||||||
path: node.id,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return Sist2Api.esQuery(q).then(resp => {
|
|
||||||
const buckets = resp["aggregations"]["paths"]["buckets"];
|
|
||||||
if (!buckets) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const paths = [];
|
|
||||||
|
|
||||||
return buckets
|
|
||||||
.filter(bucket => bucket.key.length > node.id.length || node.id.startsWith("/"))
|
|
||||||
.sort((a, b) => a.key > b.key)
|
|
||||||
.map(bucket => {
|
|
||||||
|
|
||||||
if (paths.some(n => bucket.key.startsWith(n))) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const name = node.id.startsWith("/") ? bucket.key : bucket.key.slice(node.id.length + 1);
|
|
||||||
|
|
||||||
paths.push(bucket.key);
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: bucket.key,
|
|
||||||
text: `${name}/ (${bucket.doc_count})`,
|
|
||||||
depth: node.depth + 1,
|
|
||||||
index: node.index,
|
|
||||||
values: [bucket.key],
|
|
||||||
children: true,
|
|
||||||
}
|
|
||||||
}).filter(x => x !== null)
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleTreeClick(e, node, handler) {
|
|
||||||
if (node.depth !== 0) {
|
|
||||||
this.setPathText(node.id);
|
|
||||||
this.$refs['path-modal'].hide()
|
|
||||||
|
|
||||||
this.$emit("search");
|
|
||||||
}
|
|
||||||
|
|
||||||
handler();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
#mimeTree {
|
|
||||||
max-height: 350px;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control-fix-flex {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
width: 1%;
|
|
||||||
min-width: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.suggestion-line {
|
|
||||||
max-width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.suggestions {
|
|
||||||
max-height: 250px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.theme-black .suggestions {
|
|
||||||
color: black
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-progress value="1" max="1" animated></b-progress>
|
|
||||||
</template>
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
<template>
|
|
||||||
<b-card v-if="lastResultsLoaded" id="results">
|
|
||||||
<span>{{ hitCount }} {{ hitCount === 1 ? $t("hit") : $t("hits") }}</span>
|
|
||||||
|
|
||||||
<div style="float: right">
|
|
||||||
<b-button v-b-toggle.collapse-1 variant="primary" class="not-mobile" @click="onToggle()">{{
|
|
||||||
$t("details")
|
|
||||||
}}
|
|
||||||
</b-button>
|
|
||||||
|
|
||||||
<template v-if="hitCount !== 0">
|
|
||||||
<SortSelect class="ml-2"></SortSelect>
|
|
||||||
|
|
||||||
<DisplayModeToggle class="ml-2"></DisplayModeToggle>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<b-collapse id="collapse-1" class="pt-2" style="clear:both;">
|
|
||||||
<b-card>
|
|
||||||
<b-table :items="tableItems" small borderless bordered thead-class="hidden" class="mb-0"></b-table>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
<h4>
|
|
||||||
{{$t("mimeTypes")}}
|
|
||||||
<b-button size="sm" variant="primary" class="float-right" @click="onCopyClick"><ClipboardIcon/></b-button>
|
|
||||||
</h4>
|
|
||||||
<Preloader v-if="$store.state.uiDetailsMimeAgg == null"></Preloader>
|
|
||||||
<b-table
|
|
||||||
v-else
|
|
||||||
sort-by="doc_count"
|
|
||||||
:sort-desc="true"
|
|
||||||
thead-class="hidden"
|
|
||||||
:items="$store.state.uiDetailsMimeAgg" small bordered class="mb-0"
|
|
||||||
></b-table>
|
|
||||||
</b-card>
|
|
||||||
</b-collapse>
|
|
||||||
</b-card>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import Sist2Api, {EsResult} from "@/Sist2Api";
|
|
||||||
import Vue from "vue";
|
|
||||||
import {humanFileSize} from "@/util";
|
|
||||||
import DisplayModeToggle from "@/components/DisplayModeToggle.vue";
|
|
||||||
import SortSelect from "@/components/SortSelect.vue";
|
|
||||||
import Preloader from "@/components/Preloader.vue";
|
|
||||||
import Sist2Query from "@/Sist2Query";
|
|
||||||
import ClipboardIcon from "@/components/icons/ClipboardIcon.vue";
|
|
||||||
|
|
||||||
export default Vue.extend({
|
|
||||||
name: "ResultsCard",
|
|
||||||
components: {ClipboardIcon, Preloader, SortSelect, DisplayModeToggle},
|
|
||||||
created() {
|
|
||||||
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
lastResultsLoaded() {
|
|
||||||
return this.$store.state.lastQueryResults != null;
|
|
||||||
},
|
|
||||||
hitCount() {
|
|
||||||
return (this.$store.state.lastQueryResults as EsResult).aggregations.total_count.value;
|
|
||||||
},
|
|
||||||
tableItems() {
|
|
||||||
const items = [];
|
|
||||||
|
|
||||||
|
|
||||||
items.push({key: this.$t("queryTime"), value: this.took()});
|
|
||||||
items.push({key: this.$t("totalSize"), value: this.totalSize()});
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
took() {
|
|
||||||
return (this.$store.state.lastQueryResults as EsResult).took + "ms";
|
|
||||||
},
|
|
||||||
totalSize() {
|
|
||||||
return humanFileSize((this.$store.state.lastQueryResults as EsResult).aggregations.total_size.value);
|
|
||||||
},
|
|
||||||
onToggle() {
|
|
||||||
const show = !document.getElementById("collapse-1").classList.contains("show");
|
|
||||||
this.$store.commit("setUiShowDetails", show);
|
|
||||||
|
|
||||||
if (show && this.$store.state.uiDetailsMimeAgg == null && !this.$store.state.optUpdateMimeMap) {
|
|
||||||
// Mime aggs are not updated automatically, update now
|
|
||||||
this.forceUpdateMimeAgg();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onCopyClick() {
|
|
||||||
let tsvString = "";
|
|
||||||
this.$store.state.uiDetailsMimeAgg.slice().sort((a,b) => b["doc_count"] - a["doc_count"]).forEach(row => {
|
|
||||||
tsvString += `${row["key"]}\t${row["doc_count"]}\n`;
|
|
||||||
});
|
|
||||||
|
|
||||||
navigator.clipboard.writeText(tsvString);
|
|
||||||
|
|
||||||
this.$bvToast.toast(
|
|
||||||
this.$t("toast.copiedToClipboard"),
|
|
||||||
{
|
|
||||||
title: null,
|
|
||||||
noAutoHide: false,
|
|
||||||
toaster: "b-toaster-bottom-right",
|
|
||||||
headerClass: "hidden",
|
|
||||||
bodyClass: "toast-body-info",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
forceUpdateMimeAgg() {
|
|
||||||
const query = Sist2Query.searchQuery();
|
|
||||||
Sist2Api.getMimeTypes(query).then(({buckets}) => {
|
|
||||||
this.$store.commit("setUiDetailsMimeAgg", buckets);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
#results {
|
|
||||||
margin-top: 1em;
|
|
||||||
|
|
||||||
box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .08) !important;
|
|
||||||
border-radius: 0;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#results .card-body {
|
|
||||||
padding: 0.7em 1.25em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<b-input-group>
|
|
||||||
<b-form-input :value="searchText"
|
|
||||||
:placeholder="advanced() ? $t('searchBar.advanced') : $t('searchBar.simple')"
|
|
||||||
@input="setSearchText($event)"></b-form-input>
|
|
||||||
|
|
||||||
<template #prepend>
|
|
||||||
<b-input-group-text>
|
|
||||||
<b-form-checkbox :checked="fuzzy" title="Toggle fuzzy searching" @change="setFuzzy($event)">
|
|
||||||
{{ $t("searchBar.fuzzy") }}
|
|
||||||
</b-form-checkbox>
|
|
||||||
</b-input-group-text>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #append>
|
|
||||||
<b-button variant="outline-secondary" @click="$emit('show-help')">{{$t("help.help")}}</b-button>
|
|
||||||
</template>
|
|
||||||
</b-input-group>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import {mapGetters, mapMutations} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
optQueryMode: "optQueryMode",
|
|
||||||
searchText: "searchText",
|
|
||||||
fuzzy: "fuzzy",
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapMutations({
|
|
||||||
setSearchText: "setSearchText",
|
|
||||||
setFuzzy: "setFuzzy"
|
|
||||||
}),
|
|
||||||
advanced() {
|
|
||||||
return this.optQueryMode === "advanced"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user