Compare commits

...

11 Commits

Author SHA1 Message Date
5a2820d339 UI tweak auto-select based on query args 2020-01-11 17:48:51 -05:00
b7f13f425c Fix memory leaks (whoops) 2020-01-11 17:34:34 -05:00
d1a2f9b1d5 Strip binary (CI) 2020-01-07 14:32:39 -05:00
71f17986db build settings 2020-01-06 21:34:41 -05:00
acdd2fb3c1 Use bundled ffmpeg libraries 2020-01-06 16:25:34 -05:00
0cda6c00e1 CI attempt 2020-01-03 20:21:07 -05:00
14d0e5a1e1 possible fix for #18 2019-12-28 14:32:42 -05:00
0d06d39281 Path in list view #16 2019-12-28 14:32:05 -05:00
80708ca636 Merge pull request #17 from dpieski/patch-1
maybe a typo in cli.c
2019-12-23 18:33:28 -05:00
Andrew
43b7b40dc4 maybe a typo in cli.c
possibly corrected a typo
2019-12-23 13:18:18 -06:00
d051f541e2 Show client error on ES connection failure, fixes #13 2019-12-21 20:52:53 -05:00
24 changed files with 217 additions and 55 deletions

69
.teamcity/settings.kts vendored Normal file
View File

@@ -0,0 +1,69 @@
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.ExecBuildStep
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.exec
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
/*
The settings script is an entry point for defining a TeamCity
project hierarchy. The script should contain a single call to the
project() function with a Project instance or an init function as
an argument.
VcsRoots, BuildTypes, Templates, and subprojects can be
registered inside the project using the vcsRoot(), buildType(),
template(), and subProject() methods respectively.
To debug settings scripts in command-line, run the
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
command and attach your debugger to the port 8000.
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
-> Tool Windows -> Maven Projects), find the generate task node
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
'Debug' option is available in the context menu for the task.
*/
version = "2019.2"
project {
vcsRoot(HttpsGithubComSimon987sist2refsHeadsMaster)
buildType(Build)
}
object Build : BuildType({
name = "Build"
artifactRules = """
sist2
sist2_scan
""".trimIndent()
vcs {
root(HttpsGithubComSimon987sist2refsHeadsMaster)
}
steps {
exec {
name = "Build"
path = "./ci/build.sh"
dockerImage = "simon987/general_ci"
dockerImagePlatform = ExecBuildStep.ImagePlatform.Linux
dockerPull = true
}
}
triggers {
vcs {
}
}
})
object HttpsGithubComSimon987sist2refsHeadsMaster : GitVcsRoot({
name = "https://github.com/simon987/sist2#refs/heads/master"
url = "https://github.com/simon987/sist2"
})

View File

@@ -86,16 +86,13 @@ endif ()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig/") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig/")
find_package(LibMagic REQUIRED) #find_package(OpenSSL REQUIRED)
find_package(FFmpeg REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0) pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GOBJECT REQUIRED gobject-2.0) pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
pkg_check_modules(UUID REQUIRED uuid) pkg_check_modules(UUID REQUIRED uuid)
add_definitions(${LIBMAGIC_CFLAGS_OTHER})
add_definitions(${UUID_CFLAGS_OTHER}) add_definitions(${UUID_CFLAGS_OTHER})
add_definitions(${GLIB_CFLAGS_OTHER}) add_definitions(${GLIB_CFLAGS_OTHER})
add_definitions(${GOBJECT_CFLAGS_OTHER}) add_definitions(${GOBJECT_CFLAGS_OTHER})
@@ -108,11 +105,9 @@ list(REMOVE_ITEM UUID_LIBRARIES pcre)
if (WITH_SIST2) if (WITH_SIST2)
target_include_directories( target_include_directories(
sist2 PUBLIC sist2 PUBLIC
${LIBMAGIC_INCLUDE_DIRS}
${GOBJECT_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${FFMPEG_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/lib/ffmpeg/
${FREETYPE_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS}
${UUID_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/ ${PROJECT_SOURCE_DIR}/
@@ -125,7 +120,6 @@ if (WITH_SIST2)
target_link_directories( target_link_directories(
sist2 PUBLIC sist2 PUBLIC
${UUID_LIBRARY_DIRS} ${UUID_LIBRARY_DIRS}
${FFMPEG_LIBRARY_DIRS}
) )
@@ -150,8 +144,6 @@ if (WITH_SIST2)
${PROJECT_SOURCE_DIR}/lib/libavutil.a ${PROJECT_SOURCE_DIR}/lib/libavutil.a
${PROJECT_SOURCE_DIR}/lib/libswscale.a ${PROJECT_SOURCE_DIR}/lib/libswscale.a
${PROJECT_SOURCE_DIR}/lib/libswresample.a ${PROJECT_SOURCE_DIR}/lib/libswresample.a
# ${FFMPEG_LIBRARIES}
# swscale
# mupdf # mupdf
${PROJECT_SOURCE_DIR}/lib/libmupdf.a ${PROJECT_SOURCE_DIR}/lib/libmupdf.a
@@ -164,7 +156,7 @@ if (WITH_SIST2)
curl curl
m m
bz2 bz2
magic ${PROJECT_SOURCE_DIR}/lib/libmagic.a
${PROJECT_SOURCE_DIR}/lib/libharfbuzz.a ${PROJECT_SOURCE_DIR}/lib/libharfbuzz.a
${PROJECT_SOURCE_DIR}/lib/libopenjp2.a ${PROJECT_SOURCE_DIR}/lib/libopenjp2.a
freetype freetype
@@ -196,7 +188,7 @@ if (WITH_SIST2_SCAN)
${LIBMAGIC_INCLUDE_DIRS} ${LIBMAGIC_INCLUDE_DIRS}
${GOBJECT_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}
${FFMPEG_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/lib/ffmpeg/
${GLIB_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS}
${UUID_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS}
@@ -210,7 +202,6 @@ if (WITH_SIST2_SCAN)
target_link_directories( target_link_directories(
sist2_scan PUBLIC sist2_scan PUBLIC
${UUID_LIBRARY_DIRS} ${UUID_LIBRARY_DIRS}
${FFMPEG_LIBRARY_DIRS}
) )
target_compile_options(sist2_scan target_compile_options(sist2_scan
PRIVATE PRIVATE

View File

@@ -121,10 +121,10 @@ binaries.
*(Debian)* *(Debian)*
```bash ```bash
apt install git cmake pkg-config libglib2.0-dev\ apt install git cmake pkg-config libglib2.0-dev \
libssl-dev uuid-dev libavformat-dev libswscale-dev \ libssl-dev uuid-dev python3 libmagic-dev libfreetype6-dev \
python3 libmagic-dev libfreetype6-dev libcurl-dev \ libcurl-dev libbz2-dev yasm libharfbuzz-dev ragel \
libbz2-dev yasm libharfbuzz-dev ragel libarchive-dev libarchive-dev
``` ```
*(FreeBSD)* *(FreeBSD)*
```bash ```bash

8
ci/build.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
./scripts/get_static_libs.sh
cmake .
make
strip sist2
strip sist2_scan

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -252,7 +252,7 @@ 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/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 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
text/richtext, rt|rtf|rtx text/richtext, rt|rtf|rtx
text/rtf, text/rtf,
text/scriplet, wsc text/scriplet, wsc
1 application/arj arj
252 text/javascript js
253 text/mcf mcf
254 text/pascal pas
255 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 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
256 text/richtext rt|rtf|rtx
257 text/rtf
258 text/scriplet wsc

View File

@@ -1,8 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
THREADS=$(nproc)
cd lib cd lib
cd mupdf cd mupdf
USE_SYSTEM_HARFBUZZ=yes USE_SYSTEM_OPENJPEG=yes HAVE_X11=no HAVE_GLUT=no make -j 4 make USE_SYSTEM_HARFBUZZ=yes USE_SYSTEM_OPENJPEG=yes HAVE_X11=no HAVE_GLUT=no -j $THREADS
cd .. cd ..
mv mupdf/build/release/libmupdf.a . mv mupdf/build/release/libmupdf.a .
@@ -12,7 +15,7 @@ mv mupdf/build/release/libmupdf-third.a .
cd openjpeg cd openjpeg
#cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O3 -march=native -DNDEBUG" #cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O3 -march=native -DNDEBUG"
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O3" cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O3"
make -j 4 make -j $THREADS
cd .. cd ..
mv openjpeg/bin/libopenjp2.a . mv openjpeg/bin/libopenjp2.a .
@@ -20,7 +23,7 @@ mv openjpeg/bin/libopenjp2.a .
cd harfbuzz cd harfbuzz
./autogen.sh ./autogen.sh
./configure --disable-shared --enable-static ./configure --disable-shared --enable-static
make -j 4 make -j $THREADS
cd .. cd ..
mv harfbuzz/src/.libs/libharfbuzz.a . mv harfbuzz/src/.libs/libharfbuzz.a .
@@ -31,7 +34,7 @@ cd ffmpeg
--disable-manpages --disable-postproc --disable-avfilter \ --disable-manpages --disable-postproc --disable-avfilter \
--disable-alsa --disable-lzma --disable-xlib --disable-debug\ --disable-alsa --disable-lzma --disable-xlib --disable-debug\
--disable-vdpau --disable-vaapi --disable-sdl2 --disable-network --disable-vdpau --disable-vaapi --disable-sdl2 --disable-network
make -j 4 make -j $THREADS
cd .. cd ..
mv ffmpeg/libavcodec/libavcodec.a . mv ffmpeg/libavcodec/libavcodec.a .
@@ -48,14 +51,14 @@ cmake -DONION_USE_SSL=false -DONION_USE_PAM=false -DONION_USE_PNG=false -DONION_
-DONION_USE_JPEG=false -DONION_USE_XML2=false -DONION_USE_SYSTEMD=false -DONION_USE_SQLITE3=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_REDIS=false -DONION_USE_GC=false -DONION_USE_TESTS=false -DONION_EXAMPLES=false \
-DONION_USE_BINDINGS_CPP=false .. -DONION_USE_BINDINGS_CPP=false ..
make -j 4 make -j $THREADS
cd ../.. cd ../..
mv onion/build/src/onion/libonion_static.a . mv onion/build/src/onion/libonion_static.a .
#bzip2 #bzip2
cd bzip2-1.0.6 cd bzip2-1.0.6
make -j 4 make -j $THREADS
cd .. cd ..
mv bzip2-1.0.6/libbz2.a . mv bzip2-1.0.6/libbz2.a .
@@ -63,7 +66,7 @@ mv bzip2-1.0.6/libbz2.a .
cd libmagic cd libmagic
./autogen.sh ./autogen.sh
./configure --enable-static --disable-shared ./configure --enable-static --disable-shared
make -j 4 make -j $THREADS
cd .. cd ..
mv libmagic/src/.libs/libmagic.a . mv libmagic/src/.libs/libmagic.a .
@@ -72,13 +75,13 @@ cd libarchive/build
./autogen.sh ./autogen.sh
cd .. cd ..
./configure --without-nettle --without-expat --without-xml2 --without-openssl ./configure --without-nettle --without-expat --without-xml2 --without-openssl
make -j 4 make -j $THREADS
cd .. cd ..
mv libarchive/.libs/libarchive.a . mv libarchive/.libs/libarchive.a .
# lz4 # lz4
cd lz4 cd lz4
make -j 4 make -j $THREADS
cd .. cd ..
mv lz4/lib/liblz4.a . mv lz4/lib/liblz4.a .
@@ -89,13 +92,13 @@ rm xz-5.2.3.tar.gz
cd xz-5.2.3 cd xz-5.2.3
./autogen.sh ./autogen.sh
./configure ./configure
make -j 4 make -j $THREADS
cd .. cd ..
mv xz-5.2.3/src/liblzma/.libs/liblzma.a . mv xz-5.2.3/src/liblzma/.libs/liblzma.a .
# zstd # zstd
cd zstd cd zstd
make -j 4 make -j $THREADS
cd .. cd ..
mv zstd/lib/libzstd.a . mv zstd/lib/libzstd.a .

View File

@@ -141,7 +141,7 @@ int scan_args_validate(scan_args_t *args, int argc, const char **argv) {
LOG_DEBUGF("cli.c", "arg content_size=%d", args->content_size) LOG_DEBUGF("cli.c", "arg content_size=%d", args->content_size)
LOG_DEBUGF("cli.c", "arg threads=%d", args->threads) LOG_DEBUGF("cli.c", "arg threads=%d", args->threads)
LOG_DEBUGF("cli.c", "arg incremental=%s", args->incremental) LOG_DEBUGF("cli.c", "arg incremental=%s", args->incremental)
LOG_DEBUGF("cli.c", "arg output=%s", args->incremental) LOG_DEBUGF("cli.c", "arg output=%s", args->output)
LOG_DEBUGF("cli.c", "arg rewrite_url=%s", args->rewrite_url) LOG_DEBUGF("cli.c", "arg rewrite_url=%s", args->rewrite_url)
LOG_DEBUGF("cli.c", "arg name=%s", args->name) LOG_DEBUGF("cli.c", "arg name=%s", args->name)
LOG_DEBUGF("cli.c", "arg depth=%d", args->depth) LOG_DEBUGF("cli.c", "arg depth=%d", args->depth)

View File

@@ -10,7 +10,7 @@
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0" #define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
static const char *const Version = "1.1.13"; static const char *const Version = "1.1.14";
static const char *const usage[] = { static const char *const usage[] = {
"sist2 scan [OPTION]... PATH", "sist2 scan [OPTION]... PATH",
"sist2 index [OPTION]... INDEX", "sist2 index [OPTION]... INDEX",

View File

@@ -1,7 +1,7 @@
#include "doc.h" #include "doc.h"
#include "src/ctx.h" #include "src/ctx.h"
static void dump_text(mceTextReader_t *reader, dyn_buffer_t *buf) { void dump_text(mceTextReader_t *reader, dyn_buffer_t *buf) {
mce_skip_attributes(reader); mce_skip_attributes(reader);
@@ -66,7 +66,7 @@ void read_part(opcContainer *c, dyn_buffer_t *buf, opcPart part, document_t *doc
mce_start_element(&reader, NULL, NULL) { mce_start_element(&reader, NULL, NULL) {
dump_text(&reader, buf); dump_text(&reader, buf);
} mce_end_element(&reader); } mce_end_element(&reader);
}mce_end_document(&reader); } mce_end_document(&reader);
mceTextReaderCleanup(&reader); mceTextReaderCleanup(&reader);
} }

View File

@@ -322,6 +322,8 @@ void parse_media_filename(const char *filepath, document_t *doc) {
int res = avformat_open_input(&pFormatCtx, filepath, NULL, NULL); int res = avformat_open_input(&pFormatCtx, filepath, NULL, NULL);
if (res < 0) { if (res < 0) {
LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res)) LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res))
avformat_close_input(&pFormatCtx);
avformat_free_context(pFormatCtx);
return; return;
} }
@@ -357,13 +359,22 @@ void parse_media_vfile(struct vfile *f, document_t *doc) {
int res = avformat_open_input(&pFormatCtx, "", NULL, NULL); int res = avformat_open_input(&pFormatCtx, "", NULL, NULL);
if (res == -5) { if (res == -5) {
// Tried to parse media that requires seek // Tried to parse media that requires seek
av_free(io_ctx->buffer);
avio_context_free(&io_ctx);
avformat_close_input(&pFormatCtx);
avformat_free_context(pFormatCtx);
return; return;
} else if (res < 0) { } else if (res < 0) {
LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res)) LOG_ERRORF(doc->filepath, "(media.c) avformat_open_input() returned [%d] %s", res, av_err2str(res))
av_free(io_ctx->buffer);
avio_context_free(&io_ctx);
avformat_close_input(&pFormatCtx);
avformat_free_context(pFormatCtx);
return; return;
} }
parse_media(pFormatCtx, doc); parse_media(pFormatCtx, doc);
av_free(io_ctx); av_free(io_ctx->buffer);
avio_context_free(&io_ctx);
} }

View File

@@ -1193,6 +1193,8 @@ g_hash_table_insert(ext_table, "srt", (gpointer)text_plain);
g_hash_table_insert(ext_table, "nfo", (gpointer)text_plain); g_hash_table_insert(ext_table, "nfo", (gpointer)text_plain);
g_hash_table_insert(ext_table, "sfv", (gpointer)text_plain); g_hash_table_insert(ext_table, "sfv", (gpointer)text_plain);
g_hash_table_insert(ext_table, "m3u", (gpointer)text_plain); g_hash_table_insert(ext_table, "m3u", (gpointer)text_plain);
g_hash_table_insert(ext_table, "csv", (gpointer)text_plain);
g_hash_table_insert(ext_table, "eml", (gpointer)text_plain);
g_hash_table_insert(ext_table, "rt", (gpointer)text_richtext); g_hash_table_insert(ext_table, "rt", (gpointer)text_richtext);
g_hash_table_insert(ext_table, "rtf", (gpointer)text_richtext); g_hash_table_insert(ext_table, "rtf", (gpointer)text_richtext);
g_hash_table_insert(ext_table, "rtx", (gpointer)text_richtext); g_hash_table_insert(ext_table, "rtx", (gpointer)text_richtext);

View File

@@ -1,4 +1,3 @@
#include <src/ctx.h>
#include "src/sist.h" #include "src/sist.h"
#include "src/ctx.h" #include "src/ctx.h"

View File

@@ -12,11 +12,11 @@
#include <ftw.h> #include <ftw.h>
#include <uuid.h> #include <uuid.h>
#include <magic.h> #include <magic.h>
#include <libavformat/avformat.h> #include "libavformat/avformat.h"
#include <libswscale/swscale.h> #include "libswscale/swscale.h"
#include <libswresample/swresample.h> #include "libswresample/swresample.h"
#include <libavcodec/avcodec.h> #include "libavcodec/avcodec.h"
#include <libavutil/imgutils.h> #include "libavutil/imgutils.h"
#include <ctype.h> #include <ctype.h>
#include <mupdf/fitz.h> #include <mupdf/fitz.h>
#include <mupdf/pdf.h> #include <mupdf/pdf.h>

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,23 @@
outline: 0; outline: 0;
} }
.path-row {
display: -ms-flexbox;
display: flex;
-ms-flex-align: start;
align-items: flex-start;
}
.tag-container {
margin-left: 0.3rem;
}
.path-line {
color: #BBB;
text-overflow: ellipsis;
overflow: hidden;
}
a { a {
color: #00BCD4; color: #00BCD4;
} }
@@ -24,7 +41,11 @@ body {
} }
.sub-document { .sub-document {
background: #37474F; background: #37474F !important;
}
.list-group-item.sub-document {
border-top: 1px solid #646464 !important;
} }
.sub-document .text-muted { .sub-document .text-muted {
@@ -112,6 +133,7 @@ body {
} }
.file-title { .file-title {
width: 100%;
font-size: 10pt; font-size: 10pt;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;

1
web/css/jquery.toast.min.css vendored Normal file
View File

@@ -0,0 +1 @@
.jq-toast-wrap,.jq-toast-wrap *{margin:0;padding:0}.jq-toast-wrap{display:block;position:fixed;width:250px;pointer-events:none!important;letter-spacing:normal;z-index:9000!important}.jq-toast-wrap.bottom-left{bottom:20px;left:20px}.jq-toast-wrap.bottom-right{bottom:20px;right:40px}.jq-toast-wrap.top-left{top:20px;left:20px}.jq-toast-wrap.top-right{top:20px;right:40px}.jq-toast-single{display:block;width:100%;padding:10px;margin:0 0 5px;border-radius:4px;font-size:12px;font-family:arial,sans-serif;line-height:17px;position:relative;pointer-events:all!important;background-color:#444;color:#fff}.jq-toast-single h2{font-family:arial,sans-serif;font-size:14px;margin:0 0 7px;background:0 0;color:inherit;line-height:inherit;letter-spacing:normal}.jq-toast-single a{color:#eee;text-decoration:none;font-weight:700;border-bottom:1px solid #fff;padding-bottom:3px;font-size:12px}.jq-toast-single ul{margin:0 0 0 15px;background:0 0;padding:0}.jq-toast-single ul li{list-style-type:disc!important;line-height:17px;background:0 0;margin:0;padding:0;letter-spacing:normal}.close-jq-toast-single{position:absolute;top:3px;right:7px;font-size:14px;cursor:pointer}.jq-toast-loader{display:block;position:absolute;top:-2px;height:5px;width:0;left:0;border-radius:5px;background:red}.jq-toast-loaded{width:100%}.jq-has-icon{padding:10px 10px 10px 50px;background-repeat:no-repeat;background-position:10px}.jq-icon-info{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=);background-color:#31708f;color:#d9edf7;border-color:#bce8f1}.jq-icon-warning{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=);background-color:#8a6d3b;color:#fcf8e3;border-color:#faebcc}.jq-icon-error{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=);background-color:#a94442;color:#f2dede;border-color:#ebccd1}.jq-icon-success{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==);color:#dff0d8;background-color:#3c763d;border-color:#d6e9c6}

View File

@@ -2,6 +2,23 @@
outline: 0; outline: 0;
} }
.path-row {
display: -ms-flexbox;
display: flex;
-ms-flex-align: start;
align-items: flex-start;
}
.tag-container {
margin-left: 0.3rem;
}
.path-line {
color: #444;
text-overflow: ellipsis;
overflow: hidden;
}
body { body {
overflow-y: scroll; overflow-y: scroll;
} }
@@ -16,7 +33,7 @@ body {
} }
.sub-document { .sub-document {
background: #AB47BC1F; background: #AB47BC1F !important;
} }
.navbar-brand { .navbar-brand {
@@ -82,6 +99,7 @@ body {
} }
.file-title { .file-title {
width: 100%;
font-size: 10pt; font-size: 10pt;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;

1
web/js/7_jquery.toast.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -367,6 +367,10 @@ function createDocLine(hit) {
const line = document.createElement("div"); const line = document.createElement("div");
line.setAttribute("class", "list-group-item flex-column align-items-start"); line.setAttribute("class", "list-group-item flex-column align-items-start");
if (hit["_source"].hasOwnProperty("parent")) {
line.classList.add("sub-document");
isSubDocument = true;
}
const title = makeTitle(hit); const title = makeTitle(hit);
@@ -396,8 +400,16 @@ function createDocLine(hit) {
titleDiv.appendChild(contentDiv); titleDiv.appendChild(contentDiv);
} }
let pathLine = document.createElement("div");
pathLine.setAttribute("class", "path-row");
let path = document.createElement("div");
path.setAttribute("class", "path-line");
path.setAttribute("title", hit["_source"]["path"] + "/");
path.appendChild(document.createTextNode(hit["_source"]["path"] + "/"));
let tagContainer = document.createElement("div"); let tagContainer = document.createElement("div");
tagContainer.setAttribute("class", ""); tagContainer.setAttribute("class", "tag-container");
for (let i = 0; i < tags.length; i++) { for (let i = 0; i < tags.length; i++) {
tagContainer.appendChild(tags[i]); tagContainer.appendChild(tags[i]);
@@ -409,7 +421,9 @@ function createDocLine(hit) {
sizeTag.setAttribute("class", "text-muted"); sizeTag.setAttribute("class", "text-muted");
tagContainer.appendChild(sizeTag); tagContainer.appendChild(sizeTag);
titleDiv.appendChild(tagContainer); titleDiv.appendChild(pathLine);
pathLine.appendChild(path);
pathLine.appendChild(tagContainer);
return line; return line;
} }

View File

@@ -19,6 +19,19 @@ if (localStorage.getItem("mode") === null) {
mode = localStorage.getItem("mode") mode = localStorage.getItem("mode")
} }
function showEsError() {
$.toast({
heading: "Elasticsearch connection error",
text: "sist2 web module encountered an error while connecting " +
"to Elasticsearch. See server logs for more information.",
stack: false,
bgColor: "#a94442",
textColor: "#f2dede",
position: 'bottom-right',
hideAfter: false
});
}
jQuery["jsonPost"] = function (url, data) { jQuery["jsonPost"] = function (url, data) {
return jQuery.ajax({ return jQuery.ajax({
url: url, url: url,
@@ -26,6 +39,7 @@ jQuery["jsonPost"] = function (url, data) {
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json" contentType: "application/json"
}).fail(err => { }).fail(err => {
showEsError();
console.log(err); console.log(err);
}); });
}; };
@@ -46,19 +60,28 @@ function toggleFuzzy() {
} }
$.jsonPost("i").then(resp => { $.jsonPost("i").then(resp => {
const urlIndices = (new URLSearchParams(location.search)).get("i");
resp["indices"].forEach(idx => { resp["indices"].forEach(idx => {
const opt = $("<option>") const opt = $("<option>")
.attr("value", idx.id) .attr("value", idx.id)
.append(idx.name); .append(idx.name);
if (!idx.name.includes("(nsfw)")) {
opt.attr("selected", !idx.name.includes("(nsfw)")); if (urlIndices) {
if (urlIndices.split(",").indexOf(idx.name) !== -1) {
opt.attr("selected", true);
selectedIndices.push(idx.id);
}
} else if (!idx.name.includes("(nsfw)")) {
opt.attr("selected", true);
selectedIndices.push(idx.id); selectedIndices.push(idx.id);
} }
$("#indices").append(opt); $("#indices").append(opt);
}); });
}); });
function handleTreeClick (tree) { function handleTreeClick(tree) {
return (event, node, handler) => { return (event, node, handler) => {
event.preventTreeDefault(); event.preventTreeDefault();
@@ -127,7 +150,7 @@ $.jsonPost("es", {
function leafTag(tag) { function leafTag(tag) {
const tokens = tag.split("."); const tokens = tag.split(".");
return tokens[tokens.length-1] return tokens[tokens.length - 1]
} }
// Tags tree // Tags tree
@@ -145,8 +168,8 @@ $.jsonPost("es", {
resp["aggregations"]["tags"]["buckets"] resp["aggregations"]["tags"]["buckets"]
.sort((a, b) => a["key"].localeCompare(b["key"])) .sort((a, b) => a["key"].localeCompare(b["key"]))
.forEach(bucket => { .forEach(bucket => {
addTag(tagMap, bucket["key"], bucket["key"], bucket["doc_count"]) addTag(tagMap, bucket["key"], bucket["key"], bucket["doc_count"])
}); });
tagMap.push({"text": "All", "id": "any"}); tagMap.push({"text": "All", "id": "any"});
tagTree = new InspireTree({ tagTree = new InspireTree({

View File

@@ -11,7 +11,7 @@
<nav class="navbar navbar-expand-lg"> <nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="/">sist2</a> <a class="navbar-brand" href="/">sist2</a>
<span class="badge badge-pill version">v1.1.13</span> <span class="badge badge-pill version">v1.1.14</span>
<span class="tagline">Lightning-fast file system indexer and search tool </span> <span class="tagline">Lightning-fast file system indexer and search tool </span>
<a style="margin-left: auto" id="theme" class="btn" title="Toggle theme" href="/">Theme</a> <a style="margin-left: auto" id="theme" class="btn" title="Toggle theme" href="/">Theme</a>
</nav> </nav>