mirror of
https://github.com/simon987/sist2.git
synced 2025-12-12 15:08:53 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f8f1a27180 | |||
| 784c3c9435 | |||
| f8b081a3f4 | |||
| 5661573b06 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,7 +11,7 @@ Makefile
|
||||
LOG
|
||||
sist2*
|
||||
index.sist2/
|
||||
bundle.css
|
||||
bundle*.css
|
||||
bundle.js
|
||||
*.a
|
||||
vgcore.*
|
||||
|
||||
@@ -116,10 +116,10 @@ if (WITH_SIST2)
|
||||
|
||||
target_compile_options(sist2
|
||||
PRIVATE
|
||||
-O3
|
||||
# -O3
|
||||
# -march=native
|
||||
-fno-stack-protector
|
||||
-fomit-frame-pointer
|
||||
# -fno-stack-protector
|
||||
# -fomit-frame-pointer
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(
|
||||
|
||||
@@ -56,7 +56,7 @@ sist2 web --bind 0.0.0.0 --port 4321 ./my_idx1 ./my_idx2 ./my_idx3
|
||||
|
||||
File type | Library | Content | Thumbnail | Metadata
|
||||
:---|:---|:---|:---|:---
|
||||
pdf,xps,cbz,cbr,fb2,epub | MuPDF | yes | yes, `png` | *planned* |
|
||||
pdf,xps,cbz,cbr,fb2,epub | MuPDF | yes | yes, `png` | title |
|
||||
`audio/*` | libav | - | yes, `jpeg` | ID3 tags |
|
||||
`video/*` | libav | - | yes, `jpeg` | *planned* |
|
||||
`image/*` | libav | - | yes, `jpeg` | *planned* |
|
||||
@@ -85,7 +85,7 @@ binaries.
|
||||
```bash
|
||||
pkg install cmake gcc yasm gmake bash ffmpeg e2fsprogs-uuid
|
||||
```
|
||||
__
|
||||
|
||||
2. Build
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/simon987/sist2
|
||||
|
||||
3
mime.csv
3
mime.csv
@@ -91,7 +91,7 @@ application/x-esrehber, es
|
||||
application/x-excel, xla|xld|xlk|xlt|xlv
|
||||
application/x-executable, exe
|
||||
application/x-font-sfn,
|
||||
application/x-font-ttf, ttf
|
||||
application/x-font-ttf, ttf|ttc
|
||||
application/x-freelance, pre
|
||||
application/x-git,
|
||||
application/x-gsp, gsp
|
||||
@@ -359,3 +359,4 @@ image/x-tga,
|
||||
application/x-wine-extension-ini,
|
||||
application/x-cbz, cbz
|
||||
application/x-cbr, cbr
|
||||
application/x-ms-compress-szdd, fon
|
||||
|
||||
|
@@ -6,9 +6,11 @@ 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
|
||||
rm web/css/bundle*.css 2> /dev/null
|
||||
cat web/css/*.min.css > web/css/bundle.css
|
||||
cat web/css/main.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/serve_static.py > src/web/static_generated.c
|
||||
|
||||
@@ -24,6 +24,7 @@ pdf = (
|
||||
|
||||
font = (
|
||||
"application/vnd.ms-opentype",
|
||||
"application/x-ms-compress-szdd"
|
||||
"application/x-font-sfn",
|
||||
"application/x-font-ttf",
|
||||
"font/otf",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
files = [
|
||||
"web/css/bundle.css",
|
||||
"web/css/bundle_dark.css",
|
||||
"web/js/bundle.js",
|
||||
"web/img/bg-bars.png",
|
||||
"web/img/sprite-skin-flat.png",
|
||||
"web/img/sprite-skin-flat-dark.png",
|
||||
"web/search.html",
|
||||
]
|
||||
|
||||
|
||||
@@ -197,8 +197,12 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
|
||||
*(buf.buf + line.ext) = '\0';
|
||||
}
|
||||
cJSON_AddStringToObject(document, "name", buf.buf + line.base);
|
||||
*(buf.buf + line.base - 1) = '\0';
|
||||
cJSON_AddStringToObject(document, "path", buf.buf);
|
||||
if (line.base > 0) {
|
||||
*(buf.buf + line.base - 1) = '\0';
|
||||
cJSON_AddStringToObject(document, "path", buf.buf);
|
||||
} else {
|
||||
cJSON_AddStringToObject(document, "path", "");
|
||||
}
|
||||
|
||||
enum metakey key = getc(file);
|
||||
while (key != '\n') {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
||||
|
||||
|
||||
static const char *const Version = "1.0.10";
|
||||
static const char *const Version = "1.0.14";
|
||||
static const char *const usage[] = {
|
||||
"sist2 scan [OPTION]... PATH",
|
||||
"sist2 index [OPTION]... INDEX",
|
||||
|
||||
@@ -15,12 +15,12 @@ typedef struct text_dimensions {
|
||||
} text_dimensions_t;
|
||||
|
||||
typedef struct glyph {
|
||||
unsigned int top;
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
unsigned int descent;
|
||||
unsigned int ascent;
|
||||
unsigned int advance_width;
|
||||
int top;
|
||||
int height;
|
||||
int width;
|
||||
int descent;
|
||||
int ascent;
|
||||
int advance_width;
|
||||
unsigned char *pixmap;
|
||||
} glyph_t;
|
||||
|
||||
@@ -39,10 +39,10 @@ glyph_t ft_glyph_to_glyph(FT_GlyphSlot slot) {
|
||||
|
||||
glyph.pixmap = slot->bitmap.buffer;
|
||||
|
||||
glyph.width = slot->bitmap.width;
|
||||
glyph.height = slot->bitmap.rows;
|
||||
glyph.width = (int) slot->bitmap.width;
|
||||
glyph.height = (int) slot->bitmap.rows;
|
||||
glyph.top = slot->bitmap_top;
|
||||
glyph.advance_width = slot->advance.x / 64;
|
||||
glyph.advance_width = (int) slot->advance.x / 64;
|
||||
|
||||
glyph.descent = MAX(0, glyph.height - glyph.top);
|
||||
glyph.ascent = MAX(0, MAX(glyph.top, glyph.height) - glyph.descent);
|
||||
@@ -50,10 +50,6 @@ glyph_t ft_glyph_to_glyph(FT_GlyphSlot slot) {
|
||||
return glyph;
|
||||
}
|
||||
|
||||
__always_inline
|
||||
glyph_t get_glyph(char character, FT_Face face) {
|
||||
}
|
||||
|
||||
text_dimensions_t text_dimension(char *text, FT_Face face) {
|
||||
text_dimensions_t dimensions;
|
||||
|
||||
@@ -62,7 +58,7 @@ text_dimensions_t text_dimension(char *text, FT_Face face) {
|
||||
int num_chars = (int) strlen(text);
|
||||
|
||||
unsigned int max_ascent = 0;
|
||||
unsigned int max_descent = 0;
|
||||
int max_descent = 0;
|
||||
|
||||
char pc = 0;
|
||||
for (int i = 0; i < num_chars; i++) {
|
||||
@@ -72,7 +68,7 @@ text_dimensions_t text_dimension(char *text, FT_Face face) {
|
||||
glyph_t glyph = ft_glyph_to_glyph(face->glyph);
|
||||
|
||||
max_descent = MAX(max_descent, glyph.descent);
|
||||
max_ascent = MAX(max_ascent, glyph.ascent);
|
||||
max_ascent = MAX(max_ascent, MAX(glyph.height, glyph.ascent));
|
||||
|
||||
int kerning_x = kerning_offset(c, pc, face);
|
||||
dimensions.width += MAX(glyph.advance_width, glyph.width) + kerning_x;
|
||||
@@ -195,6 +191,9 @@ void parse_font(const char *buf, size_t buf_len, document_t *doc) {
|
||||
glyph_t glyph = ft_glyph_to_glyph(face->glyph);
|
||||
|
||||
pen.x += kerning_offset(c, pc, face);
|
||||
if (pen.x <= 0) {
|
||||
pen.x = ABS(glyph.advance_width - glyph.width);
|
||||
}
|
||||
pen.y = dimensions.height - glyph.ascent - dimensions.baseline;
|
||||
|
||||
draw_glyph(&glyph, pen.x, pen.y, dimensions, bitmap);
|
||||
|
||||
@@ -107,6 +107,15 @@ AVFrame *read_frame(AVFormatContext *pFormatCtx, AVCodecContext *decoder, int st
|
||||
return frame;
|
||||
}
|
||||
|
||||
#define APPEND_TAG_META(doc, tag, keyname) \
|
||||
text_buffer_t tex = text_buffer_create(4096); \
|
||||
text_buffer_append_string(&tex, tag->value); \
|
||||
meta_line_t *meta_tag = malloc(sizeof(meta_line_t) + tex.dyn_buffer.cur); \
|
||||
meta_tag->key = keyname; \
|
||||
strcpy(meta_tag->strval, tex.dyn_buffer.buf); \
|
||||
APPEND_META(doc, meta_tag) \
|
||||
text_buffer_destroy(&tex);
|
||||
|
||||
void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) {
|
||||
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
@@ -115,35 +124,40 @@ void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) {
|
||||
for (; *key; ++key) *key = (char) tolower(*key);
|
||||
|
||||
if (strcmp(tag->key, "artist") == 0) {
|
||||
size_t len = strlen(tag->value);
|
||||
meta_line_t *meta_tag = malloc(sizeof(meta_line_t) + len);
|
||||
meta_tag->key = MetaArtist;
|
||||
memcpy(meta_tag->strval, tag->value, len);
|
||||
APPEND_META(doc, meta_tag)
|
||||
APPEND_TAG_META(doc, tag, MetaArtist)
|
||||
} else if (strcmp(tag->key, "genre") == 0) {
|
||||
size_t len = strlen(tag->value);
|
||||
meta_line_t *meta_tag = malloc(sizeof(meta_line_t) + len);
|
||||
meta_tag->key = MetaGenre;
|
||||
memcpy(meta_tag->strval, tag->value, len);
|
||||
APPEND_META(doc, meta_tag)
|
||||
APPEND_TAG_META(doc, tag, MetaGenre)
|
||||
} else if (strcmp(tag->key, "title") == 0) {
|
||||
size_t len = strlen(tag->value);
|
||||
meta_line_t *meta_tag = malloc(sizeof(meta_line_t) + len);
|
||||
meta_tag->key = MetaTitle;
|
||||
memcpy(meta_tag->strval, tag->value, len);
|
||||
APPEND_META(doc, meta_tag)
|
||||
APPEND_TAG_META(doc, tag, MetaTitle)
|
||||
} else if (strcmp(tag->key, "album_artist") == 0) {
|
||||
size_t len = strlen(tag->value);
|
||||
meta_line_t *meta_tag = malloc(sizeof(meta_line_t) + len);
|
||||
meta_tag->key = MetaAlbumArtist;
|
||||
memcpy(meta_tag->strval, tag->value, len);
|
||||
APPEND_META(doc, meta_tag)
|
||||
APPEND_TAG_META(doc, tag, MetaAlbumArtist)
|
||||
} else if (strcmp(tag->key, "album") == 0) {
|
||||
size_t len = strlen(tag->value);
|
||||
meta_line_t *meta_tag = malloc(sizeof(meta_line_t) + len);
|
||||
meta_tag->key = MetaAlbum;
|
||||
memcpy(meta_tag->strval, tag->value, len);
|
||||
APPEND_META(doc, meta_tag)
|
||||
APPEND_TAG_META(doc, tag, MetaAlbum)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void append_video_meta(AVFormatContext *pFormatCtx, document_t *doc, int include_audio_tags) {
|
||||
|
||||
meta_line_t *meta_duration = malloc(sizeof(meta_line_t));
|
||||
meta_duration->key = MetaMediaDuration;
|
||||
meta_duration->longval = pFormatCtx->duration / AV_TIME_BASE;
|
||||
APPEND_META(doc, meta_duration)
|
||||
|
||||
meta_line_t *meta_bitrate = malloc(sizeof(meta_line_t));
|
||||
meta_bitrate->key = MetaMediaBitrate;
|
||||
meta_bitrate->intval = pFormatCtx->bit_rate;
|
||||
APPEND_META(doc, meta_bitrate)
|
||||
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
while ((tag = av_dict_get(pFormatCtx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
|
||||
char *key = tag->key;
|
||||
for (; *key; ++key) *key = (char) tolower(*key);
|
||||
|
||||
if (strcmp(tag->key, "title") == 0 && include_audio_tags) {
|
||||
APPEND_TAG_META(doc, tag, MetaTitle)
|
||||
} else if (strcmp(tag->key, "comment") == 0) {
|
||||
APPEND_TAG_META(doc, tag, MetaContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,15 +221,7 @@ void parse_media(const char *filepath, document_t *doc) {
|
||||
|
||||
if (stream->nb_frames > 1) {
|
||||
//This is a video (not a still image)
|
||||
meta_line_t *meta_duration = malloc(sizeof(meta_line_t));
|
||||
meta_duration->key = MetaMediaDuration;
|
||||
meta_duration->longval = pFormatCtx->duration / AV_TIME_BASE;
|
||||
APPEND_META(doc, meta_duration)
|
||||
|
||||
meta_line_t *meta_bitrate = malloc(sizeof(meta_line_t));
|
||||
meta_bitrate->key = MetaMediaBitrate;
|
||||
meta_bitrate->intval = pFormatCtx->bit_rate;
|
||||
APPEND_META(doc, meta_bitrate)
|
||||
append_video_meta(pFormatCtx, doc, audio_stream == -1);
|
||||
}
|
||||
|
||||
if (stream->codecpar->width <= 20 || stream->codecpar->height <= 20) {
|
||||
|
||||
@@ -112,7 +112,7 @@ enum mime {
|
||||
application_x_esrehber=655464,
|
||||
application_x_excel=655465,
|
||||
application_x_executable=655466,
|
||||
application_x_font_sfn=655467 | 0x20000000,
|
||||
application_x_font_sfn=655467,
|
||||
application_x_font_ttf=655468 | 0x20000000,
|
||||
application_x_freelance=655469,
|
||||
application_x_git=655470,
|
||||
@@ -148,224 +148,225 @@ enum mime {
|
||||
application_x_mif=655500,
|
||||
application_x_mix_transfer=655501,
|
||||
application_x_mobipocket_ebook=655502,
|
||||
application_x_ms_pdb=655503,
|
||||
application_x_ms_reader=655504,
|
||||
application_x_navi_animation=655505,
|
||||
application_x_navidoc=655506,
|
||||
application_x_navimap=655507,
|
||||
application_x_navistyle=655508,
|
||||
application_x_netcdf=655509,
|
||||
application_x_newton_compatible_pkg=655510,
|
||||
application_x_object=655511,
|
||||
application_x_omc=655512,
|
||||
application_x_omcdatamaker=655513,
|
||||
application_x_omcregerator=655514,
|
||||
application_x_pagemaker=655515,
|
||||
application_x_pcl=655516,
|
||||
application_x_pixclscript=655517,
|
||||
application_x_pkcs7_certreqresp=655518,
|
||||
application_x_pkcs7_signature=655519,
|
||||
application_x_project=655520,
|
||||
application_x_qpro=655521,
|
||||
application_x_rar=655522,
|
||||
application_x_rpm=655523,
|
||||
application_x_sdp=655524,
|
||||
application_x_sea=655525,
|
||||
application_x_seelogo=655526,
|
||||
application_x_setupscript=655527,
|
||||
application_x_shar=655528,
|
||||
application_x_sharedlib=655529,
|
||||
application_x_shockwave_flash=655530,
|
||||
application_x_sprite=655531,
|
||||
application_x_sqlite3=655532,
|
||||
application_x_sv4cpio=655533,
|
||||
application_x_sv4crc=655534,
|
||||
application_x_tar=655535,
|
||||
application_x_tbook=655536,
|
||||
application_x_tex_tfm=655537,
|
||||
application_x_texinfo=655538,
|
||||
application_x_ustar=655539,
|
||||
application_x_visio=655540,
|
||||
application_x_vnd_audioexplosion_mzz=655541,
|
||||
application_x_vnd_ls_xpix=655542,
|
||||
application_x_vrml=655543,
|
||||
application_x_wais_source=655544,
|
||||
application_x_wine_extension_ini=655545,
|
||||
application_x_wintalk=655546,
|
||||
application_x_world=655547,
|
||||
application_x_wri=655548,
|
||||
application_x_x509_ca_cert=655549,
|
||||
application_x_xz=655550,
|
||||
application_xml=655551,
|
||||
application_zip=655552,
|
||||
audio_it=458945,
|
||||
audio_make=458946,
|
||||
audio_mid=458947,
|
||||
audio_midi=458948,
|
||||
audio_mp4=458949,
|
||||
audio_mpeg=458950,
|
||||
audio_ogg=458951,
|
||||
audio_s3m=458952,
|
||||
audio_tsp_audio=458953,
|
||||
audio_tsplayer=458954,
|
||||
audio_vnd_qcelp=458955,
|
||||
audio_voxware=458956,
|
||||
audio_x_flac=458957,
|
||||
audio_x_gsm=458958,
|
||||
audio_x_jam=458959,
|
||||
audio_x_liveaudio=458960,
|
||||
audio_x_m4a=458961,
|
||||
audio_x_midi=458962,
|
||||
audio_x_mod=458963,
|
||||
audio_x_mp4a_latm=458964,
|
||||
audio_x_mpeg_3=458965,
|
||||
audio_x_mpequrl=458966,
|
||||
audio_x_nspaudio=458967,
|
||||
audio_x_pn_realaudio=458968,
|
||||
audio_x_psid=458969,
|
||||
audio_x_realaudio=458970,
|
||||
audio_x_twinvq=458971,
|
||||
audio_x_twinvq_plugin=458972,
|
||||
audio_x_voc=458973,
|
||||
audio_x_wav=458974,
|
||||
audio_xm=458975,
|
||||
font_otf=327904 | 0x20000000,
|
||||
font_sfnt=327905 | 0x20000000,
|
||||
font_woff=327906 | 0x20000000,
|
||||
font_woff2=327907 | 0x20000000,
|
||||
image_cmu_raster=524516,
|
||||
image_fif=524517,
|
||||
image_florian=524518,
|
||||
image_g3fax=524519,
|
||||
image_gif=524520,
|
||||
image_ief=524521,
|
||||
image_jpeg=524522,
|
||||
image_jutvision=524523,
|
||||
image_naplps=524524,
|
||||
image_pict=524525,
|
||||
image_png=524526,
|
||||
image_svg=524527 | 0x80000000,
|
||||
image_svg_xml=524528 | 0x80000000,
|
||||
image_tiff=524529,
|
||||
image_vnd_adobe_photoshop=524530 | 0x80000000,
|
||||
image_vnd_djvu=524531 | 0x80000000,
|
||||
image_vnd_fpx=524532,
|
||||
image_vnd_microsoft_icon=524533,
|
||||
image_vnd_rn_realflash=524534,
|
||||
image_vnd_rn_realpix=524535,
|
||||
image_vnd_wap_wbmp=524536,
|
||||
image_vnd_xiff=524537,
|
||||
image_webp=524538,
|
||||
image_x_cmu_raster=524539,
|
||||
image_x_cur=524540,
|
||||
image_x_dwg=524541,
|
||||
image_x_eps=524542,
|
||||
image_x_exr=524543,
|
||||
image_x_icns=524544,
|
||||
image_x_icon=524545 | 0x80000000,
|
||||
image_x_jg=524546,
|
||||
image_x_jps=524547,
|
||||
image_x_ms_bmp=524548,
|
||||
image_x_niff=524549,
|
||||
image_x_pcx=524550,
|
||||
image_x_pict=524551,
|
||||
image_x_portable_bitmap=524552,
|
||||
image_x_portable_graymap=524553,
|
||||
image_x_portable_pixmap=524554,
|
||||
image_x_quicktime=524555,
|
||||
image_x_rgb=524556,
|
||||
image_x_tga=524557,
|
||||
image_x_tiff=524558,
|
||||
image_x_xcf=524559 | 0x80000000,
|
||||
image_x_xpixmap=524560 | 0x80000000,
|
||||
image_x_xwindowdump=524561,
|
||||
message_rfc822=196882,
|
||||
model_vnd_dwf=65811,
|
||||
model_vnd_gdl=65812,
|
||||
model_vnd_gs_gdl=65813,
|
||||
model_vrml=65814,
|
||||
model_x_pov=65815,
|
||||
text_asp=590104,
|
||||
text_css=590105,
|
||||
text_html=590106,
|
||||
text_javascript=590107,
|
||||
text_mcf=590108,
|
||||
text_pascal=590109,
|
||||
text_plain=590110,
|
||||
text_richtext=590111,
|
||||
text_scriplet=590112,
|
||||
text_tab_separated_values=590113,
|
||||
text_troff=590114,
|
||||
text_uri_list=590115,
|
||||
text_vnd_abc=590116,
|
||||
text_vnd_fmi_flexstor=590117,
|
||||
text_vnd_wap_wml=590118,
|
||||
text_vnd_wap_wmlscript=590119,
|
||||
text_webviewhtml=590120,
|
||||
text_x_Algol68=590121,
|
||||
text_x_asm=590122,
|
||||
text_x_audiosoft_intra=590123,
|
||||
text_x_awk=590124,
|
||||
text_x_bcpl=590125,
|
||||
text_x_c=590126,
|
||||
text_x_c__=590127,
|
||||
text_x_component=590128,
|
||||
text_x_diff=590129,
|
||||
text_x_fortran=590130,
|
||||
text_x_java=590131,
|
||||
text_x_la_asf=590132,
|
||||
text_x_lisp=590133,
|
||||
text_x_m=590134,
|
||||
text_x_m4=590135,
|
||||
text_x_makefile=590136,
|
||||
text_x_msdos_batch=590137,
|
||||
text_x_pascal=590138,
|
||||
text_x_perl=590139,
|
||||
text_x_php=590140,
|
||||
text_x_po=590141,
|
||||
text_x_python=590142,
|
||||
text_x_ruby=590143,
|
||||
text_x_sass=590144,
|
||||
text_x_scss=590145,
|
||||
text_x_server_parsed_html=590146,
|
||||
text_x_setext=590147,
|
||||
text_x_sgml=590148,
|
||||
text_x_shellscript=590149,
|
||||
text_x_speech=590150,
|
||||
text_x_tcl=590151,
|
||||
text_x_tex=590152,
|
||||
text_x_uil=590153,
|
||||
text_x_uuencode=590154,
|
||||
text_x_vcalendar=590155,
|
||||
text_x_vcard=590156,
|
||||
text_xml=590157,
|
||||
video_animaflex=393550,
|
||||
video_avi=393551,
|
||||
video_avs_video=393552,
|
||||
video_mp4=393553,
|
||||
video_mpeg=393554,
|
||||
video_quicktime=393555,
|
||||
video_vdo=393556,
|
||||
video_vivo=393557,
|
||||
video_vnd_rn_realvideo=393558,
|
||||
video_vosaic=393559,
|
||||
video_webm=393560,
|
||||
video_x_amt_demorun=393561,
|
||||
video_x_amt_showrun=393562,
|
||||
video_x_atomic3d_feature=393563,
|
||||
video_x_dl=393564,
|
||||
video_x_dv=393565,
|
||||
video_x_fli=393566,
|
||||
video_x_flv=393567,
|
||||
video_x_isvideo=393568,
|
||||
video_x_jng=393569 | 0x80000000,
|
||||
video_x_matroska=393570,
|
||||
video_x_mng=393571,
|
||||
video_x_motion_jpeg=393572,
|
||||
video_x_ms_asf=393573,
|
||||
video_x_msvideo=393574,
|
||||
video_x_qtc=393575,
|
||||
video_x_sgi_movie=393576,
|
||||
application_x_ms_compress_szdd=655503,
|
||||
application_x_ms_pdb=655504,
|
||||
application_x_ms_reader=655505,
|
||||
application_x_navi_animation=655506,
|
||||
application_x_navidoc=655507,
|
||||
application_x_navimap=655508,
|
||||
application_x_navistyle=655509,
|
||||
application_x_netcdf=655510,
|
||||
application_x_newton_compatible_pkg=655511,
|
||||
application_x_object=655512,
|
||||
application_x_omc=655513,
|
||||
application_x_omcdatamaker=655514,
|
||||
application_x_omcregerator=655515,
|
||||
application_x_pagemaker=655516,
|
||||
application_x_pcl=655517,
|
||||
application_x_pixclscript=655518,
|
||||
application_x_pkcs7_certreqresp=655519,
|
||||
application_x_pkcs7_signature=655520,
|
||||
application_x_project=655521,
|
||||
application_x_qpro=655522,
|
||||
application_x_rar=655523,
|
||||
application_x_rpm=655524,
|
||||
application_x_sdp=655525,
|
||||
application_x_sea=655526,
|
||||
application_x_seelogo=655527,
|
||||
application_x_setupscript=655528,
|
||||
application_x_shar=655529,
|
||||
application_x_sharedlib=655530,
|
||||
application_x_shockwave_flash=655531,
|
||||
application_x_sprite=655532,
|
||||
application_x_sqlite3=655533,
|
||||
application_x_sv4cpio=655534,
|
||||
application_x_sv4crc=655535,
|
||||
application_x_tar=655536,
|
||||
application_x_tbook=655537,
|
||||
application_x_tex_tfm=655538,
|
||||
application_x_texinfo=655539,
|
||||
application_x_ustar=655540,
|
||||
application_x_visio=655541,
|
||||
application_x_vnd_audioexplosion_mzz=655542,
|
||||
application_x_vnd_ls_xpix=655543,
|
||||
application_x_vrml=655544,
|
||||
application_x_wais_source=655545,
|
||||
application_x_wine_extension_ini=655546,
|
||||
application_x_wintalk=655547,
|
||||
application_x_world=655548,
|
||||
application_x_wri=655549,
|
||||
application_x_x509_ca_cert=655550,
|
||||
application_x_xz=655551,
|
||||
application_xml=655552,
|
||||
application_zip=655553,
|
||||
audio_it=458946,
|
||||
audio_make=458947,
|
||||
audio_mid=458948,
|
||||
audio_midi=458949,
|
||||
audio_mp4=458950,
|
||||
audio_mpeg=458951,
|
||||
audio_ogg=458952,
|
||||
audio_s3m=458953,
|
||||
audio_tsp_audio=458954,
|
||||
audio_tsplayer=458955,
|
||||
audio_vnd_qcelp=458956,
|
||||
audio_voxware=458957,
|
||||
audio_x_flac=458958,
|
||||
audio_x_gsm=458959,
|
||||
audio_x_jam=458960,
|
||||
audio_x_liveaudio=458961,
|
||||
audio_x_m4a=458962,
|
||||
audio_x_midi=458963,
|
||||
audio_x_mod=458964,
|
||||
audio_x_mp4a_latm=458965,
|
||||
audio_x_mpeg_3=458966,
|
||||
audio_x_mpequrl=458967,
|
||||
audio_x_nspaudio=458968,
|
||||
audio_x_pn_realaudio=458969,
|
||||
audio_x_psid=458970,
|
||||
audio_x_realaudio=458971,
|
||||
audio_x_twinvq=458972,
|
||||
audio_x_twinvq_plugin=458973,
|
||||
audio_x_voc=458974,
|
||||
audio_x_wav=458975,
|
||||
audio_xm=458976,
|
||||
font_otf=327905 | 0x20000000,
|
||||
font_sfnt=327906 | 0x20000000,
|
||||
font_woff=327907 | 0x20000000,
|
||||
font_woff2=327908 | 0x20000000,
|
||||
image_cmu_raster=524517,
|
||||
image_fif=524518,
|
||||
image_florian=524519,
|
||||
image_g3fax=524520,
|
||||
image_gif=524521,
|
||||
image_ief=524522,
|
||||
image_jpeg=524523,
|
||||
image_jutvision=524524,
|
||||
image_naplps=524525,
|
||||
image_pict=524526,
|
||||
image_png=524527,
|
||||
image_svg=524528 | 0x80000000,
|
||||
image_svg_xml=524529 | 0x80000000,
|
||||
image_tiff=524530,
|
||||
image_vnd_adobe_photoshop=524531 | 0x80000000,
|
||||
image_vnd_djvu=524532 | 0x80000000,
|
||||
image_vnd_fpx=524533,
|
||||
image_vnd_microsoft_icon=524534,
|
||||
image_vnd_rn_realflash=524535,
|
||||
image_vnd_rn_realpix=524536,
|
||||
image_vnd_wap_wbmp=524537,
|
||||
image_vnd_xiff=524538,
|
||||
image_webp=524539,
|
||||
image_x_cmu_raster=524540,
|
||||
image_x_cur=524541,
|
||||
image_x_dwg=524542,
|
||||
image_x_eps=524543,
|
||||
image_x_exr=524544,
|
||||
image_x_icns=524545,
|
||||
image_x_icon=524546 | 0x80000000,
|
||||
image_x_jg=524547,
|
||||
image_x_jps=524548,
|
||||
image_x_ms_bmp=524549,
|
||||
image_x_niff=524550,
|
||||
image_x_pcx=524551,
|
||||
image_x_pict=524552,
|
||||
image_x_portable_bitmap=524553,
|
||||
image_x_portable_graymap=524554,
|
||||
image_x_portable_pixmap=524555,
|
||||
image_x_quicktime=524556,
|
||||
image_x_rgb=524557,
|
||||
image_x_tga=524558,
|
||||
image_x_tiff=524559,
|
||||
image_x_xcf=524560 | 0x80000000,
|
||||
image_x_xpixmap=524561 | 0x80000000,
|
||||
image_x_xwindowdump=524562,
|
||||
message_rfc822=196883,
|
||||
model_vnd_dwf=65812,
|
||||
model_vnd_gdl=65813,
|
||||
model_vnd_gs_gdl=65814,
|
||||
model_vrml=65815,
|
||||
model_x_pov=65816,
|
||||
text_asp=590105,
|
||||
text_css=590106,
|
||||
text_html=590107,
|
||||
text_javascript=590108,
|
||||
text_mcf=590109,
|
||||
text_pascal=590110,
|
||||
text_plain=590111,
|
||||
text_richtext=590112,
|
||||
text_scriplet=590113,
|
||||
text_tab_separated_values=590114,
|
||||
text_troff=590115,
|
||||
text_uri_list=590116,
|
||||
text_vnd_abc=590117,
|
||||
text_vnd_fmi_flexstor=590118,
|
||||
text_vnd_wap_wml=590119,
|
||||
text_vnd_wap_wmlscript=590120,
|
||||
text_webviewhtml=590121,
|
||||
text_x_Algol68=590122,
|
||||
text_x_asm=590123,
|
||||
text_x_audiosoft_intra=590124,
|
||||
text_x_awk=590125,
|
||||
text_x_bcpl=590126,
|
||||
text_x_c=590127,
|
||||
text_x_c__=590128,
|
||||
text_x_component=590129,
|
||||
text_x_diff=590130,
|
||||
text_x_fortran=590131,
|
||||
text_x_java=590132,
|
||||
text_x_la_asf=590133,
|
||||
text_x_lisp=590134,
|
||||
text_x_m=590135,
|
||||
text_x_m4=590136,
|
||||
text_x_makefile=590137,
|
||||
text_x_msdos_batch=590138,
|
||||
text_x_pascal=590139,
|
||||
text_x_perl=590140,
|
||||
text_x_php=590141,
|
||||
text_x_po=590142,
|
||||
text_x_python=590143,
|
||||
text_x_ruby=590144,
|
||||
text_x_sass=590145,
|
||||
text_x_scss=590146,
|
||||
text_x_server_parsed_html=590147,
|
||||
text_x_setext=590148,
|
||||
text_x_sgml=590149,
|
||||
text_x_shellscript=590150,
|
||||
text_x_speech=590151,
|
||||
text_x_tcl=590152,
|
||||
text_x_tex=590153,
|
||||
text_x_uil=590154,
|
||||
text_x_uuencode=590155,
|
||||
text_x_vcalendar=590156,
|
||||
text_x_vcard=590157,
|
||||
text_xml=590158,
|
||||
video_animaflex=393551,
|
||||
video_avi=393552,
|
||||
video_avs_video=393553,
|
||||
video_mp4=393554,
|
||||
video_mpeg=393555,
|
||||
video_quicktime=393556,
|
||||
video_vdo=393557,
|
||||
video_vivo=393558,
|
||||
video_vnd_rn_realvideo=393559,
|
||||
video_vosaic=393560,
|
||||
video_webm=393561,
|
||||
video_x_amt_demorun=393562,
|
||||
video_x_amt_showrun=393563,
|
||||
video_x_atomic3d_feature=393564,
|
||||
video_x_dl=393565,
|
||||
video_x_dv=393566,
|
||||
video_x_fli=393567,
|
||||
video_x_flv=393568,
|
||||
video_x_isvideo=393569,
|
||||
video_x_jng=393570 | 0x80000000,
|
||||
video_x_matroska=393571,
|
||||
video_x_mng=393572,
|
||||
video_x_motion_jpeg=393573,
|
||||
video_x_ms_asf=393574,
|
||||
video_x_msvideo=393575,
|
||||
video_x_qtc=393576,
|
||||
video_x_sgi_movie=393577,
|
||||
};
|
||||
char *mime_get_mime_text(unsigned int mime_id) {switch (mime_id) {
|
||||
case application_arj: return "application/arj";
|
||||
@@ -728,6 +729,7 @@ case image_x_tga: return "image/x-tga";
|
||||
case application_x_wine_extension_ini: return "application/x-wine-extension-ini";
|
||||
case application_x_cbz: return "application/x-cbz";
|
||||
case application_x_cbr: return "application/x-cbr";
|
||||
case application_x_ms_compress_szdd: return "application/x-ms-compress-szdd";
|
||||
default: return NULL;}}
|
||||
GHashTable *mime_get_ext_table() {GHashTable *ext_table = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
g_hash_table_insert(ext_table, "arj", (gpointer)application_arj);
|
||||
@@ -857,6 +859,7 @@ g_hash_table_insert(ext_table, "xlt", (gpointer)application_x_excel);
|
||||
g_hash_table_insert(ext_table, "xlv", (gpointer)application_x_excel);
|
||||
g_hash_table_insert(ext_table, "exe", (gpointer)application_x_executable);
|
||||
g_hash_table_insert(ext_table, "ttf", (gpointer)application_x_font_ttf);
|
||||
g_hash_table_insert(ext_table, "ttc", (gpointer)application_x_font_ttf);
|
||||
g_hash_table_insert(ext_table, "pre", (gpointer)application_x_freelance);
|
||||
g_hash_table_insert(ext_table, "gsp", (gpointer)application_x_gsp);
|
||||
g_hash_table_insert(ext_table, "gss", (gpointer)application_x_gss);
|
||||
@@ -1207,6 +1210,7 @@ g_hash_table_insert(ext_table, "vcf", (gpointer)text_x_vcard);
|
||||
g_hash_table_insert(ext_table, "hlp", (gpointer)application_winhelp);
|
||||
g_hash_table_insert(ext_table, "cbz", (gpointer)application_x_cbz);
|
||||
g_hash_table_insert(ext_table, "cbr", (gpointer)application_x_cbr);
|
||||
g_hash_table_insert(ext_table, "fon", (gpointer)application_x_ms_compress_szdd);
|
||||
return ext_table;}
|
||||
GHashTable *mime_get_mime_table() {GHashTable *mime_table = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
g_hash_table_insert(mime_table, "application/arj", (gpointer)application_arj);
|
||||
@@ -1569,5 +1573,6 @@ g_hash_table_insert(mime_table, "image/x-tga", (gpointer)image_x_tga);
|
||||
g_hash_table_insert(mime_table, "application/x-wine-extension-ini", (gpointer)application_x_wine_extension_ini);
|
||||
g_hash_table_insert(mime_table, "application/x-cbz", (gpointer)application_x_cbz);
|
||||
g_hash_table_insert(mime_table, "application/x-cbr", (gpointer)application_x_cbr);
|
||||
g_hash_table_insert(mime_table, "application/x-ms-compress-szdd", (gpointer)application_x_ms_compress_szdd);
|
||||
return mime_table;}
|
||||
#endif
|
||||
|
||||
@@ -75,6 +75,17 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
|
||||
stream = fz_open_memory(ctx, buf, buf_len);
|
||||
fzdoc = fz_open_document_with_stream(ctx, mime_get_mime_text(doc->mime), stream);
|
||||
|
||||
char title[4096] = {'\0',};
|
||||
fz_lookup_metadata(ctx, fzdoc, FZ_META_INFO_TITLE, title, sizeof(title));
|
||||
printf("Title: %s\n", title); //todo rmv
|
||||
|
||||
if (strlen(title) > 0) {
|
||||
meta_line_t *meta_content = malloc(sizeof(meta_line_t) + strlen(title) + 1);
|
||||
meta_content->key = MetaTitle;
|
||||
strcpy(meta_content->strval, title);
|
||||
APPEND_META(doc, meta_content)
|
||||
}
|
||||
|
||||
int page_count = fz_count_pages(ctx, fzdoc);
|
||||
|
||||
fz_page *cover = render_cover(ctx, doc, fzdoc);
|
||||
@@ -84,8 +95,7 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
|
||||
text_buffer_t text_buf = text_buffer_create(ScanCtx.content_size);
|
||||
|
||||
for (int current_page = 0; current_page < page_count; current_page++) {
|
||||
fz_page *page;
|
||||
if (current_page == 0) {
|
||||
fz_page *page; if (current_page == 0) {
|
||||
page = cover;
|
||||
} else {
|
||||
page = fz_load_page(ctx, fzdoc, current_page);
|
||||
|
||||
@@ -89,6 +89,14 @@ void text_buffer_terminate_string(text_buffer_t *buf) {
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, '\0');
|
||||
}
|
||||
|
||||
int text_buffer_append_string(text_buffer_t *buf, char * str) {
|
||||
char * ptr = str;
|
||||
while (*ptr) {
|
||||
text_buffer_append_char(buf, *ptr++);
|
||||
}
|
||||
text_buffer_terminate_string(buf);
|
||||
}
|
||||
|
||||
int text_buffer_append_char(text_buffer_t *buf, int c) {
|
||||
|
||||
if (SHOULD_IGNORE_CHAR(c)) {
|
||||
|
||||
@@ -56,6 +56,7 @@ text_buffer_t text_buffer_create(int max_size);
|
||||
|
||||
void text_buffer_terminate_string(text_buffer_t *buf);
|
||||
|
||||
int text_buffer_append_string(text_buffer_t *buf, char * str);
|
||||
int text_buffer_append_char(text_buffer_t *buf, int c);
|
||||
|
||||
void incremental_put(GHashTable *table, unsigned long inode_no, int mtime);
|
||||
|
||||
@@ -43,27 +43,40 @@ int javascript(void *p, onion_request *req, onion_response *res) {
|
||||
return OCS_PROCESSED;
|
||||
}
|
||||
|
||||
int style(void *p, onion_request *req, onion_response *res) {
|
||||
set_default_headers(res);
|
||||
onion_response_set_header(res, "Content-Type", "text/css");
|
||||
onion_response_set_length(res, sizeof(bundle_css));
|
||||
onion_response_write(res, bundle_css, sizeof(bundle_css));
|
||||
return OCS_PROCESSED;
|
||||
int client_requested_dark_theme(onion_request *req) {
|
||||
const char *cookie = onion_request_get_cookie(req, "sist");
|
||||
if (cookie == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return strcmp(cookie, "dark") == 0;
|
||||
}
|
||||
|
||||
int bg_bars(void *p, onion_request *req, onion_response *res) {
|
||||
int style(void *p, onion_request *req, onion_response *res) {
|
||||
set_default_headers(res);
|
||||
onion_response_set_header(res, "Content-Type", "image/png");
|
||||
onion_response_set_length(res, sizeof(bg_bars_png));
|
||||
onion_response_write(res, bg_bars_png, sizeof(bg_bars_png));
|
||||
|
||||
onion_response_set_header(res, "Content-Type", "text/css");
|
||||
|
||||
if (client_requested_dark_theme(req)) {
|
||||
onion_response_set_length(res, sizeof(bundle_dark_css));
|
||||
onion_response_write(res, bundle_dark_css, sizeof(bundle_dark_css));
|
||||
} else {
|
||||
onion_response_set_length(res, sizeof(bundle_css));
|
||||
onion_response_write(res, bundle_css, sizeof(bundle_css));
|
||||
}
|
||||
return OCS_PROCESSED;
|
||||
}
|
||||
|
||||
int img_sprite_skin_flag(void *p, onion_request *req, onion_response *res) {
|
||||
set_default_headers(res);
|
||||
onion_response_set_header(res, "Content-Type", "image/png");
|
||||
onion_response_set_length(res, sizeof(sprite_skin_flat_png));
|
||||
onion_response_write(res, sprite_skin_flat_png, sizeof(sprite_skin_flat_png));
|
||||
if (client_requested_dark_theme(req)) {
|
||||
onion_response_set_length(res, sizeof(sprite_skin_flat_dark_png));
|
||||
onion_response_write(res, sprite_skin_flat_dark_png, sizeof(sprite_skin_flat_dark_png));
|
||||
} else {
|
||||
onion_response_set_length(res, sizeof(sprite_skin_flat_png));
|
||||
onion_response_write(res, sprite_skin_flat_png, sizeof(sprite_skin_flat_png));
|
||||
}
|
||||
return OCS_PROCESSED;
|
||||
}
|
||||
|
||||
@@ -326,7 +339,7 @@ int index_info(void *p, onion_request *req, onion_response *res) {
|
||||
cJSON_AddStringToObject(idx_json, "name", idx->desc.name);
|
||||
cJSON_AddStringToObject(idx_json, "version", idx->desc.version);
|
||||
cJSON_AddStringToObject(idx_json, "id", idx->desc.uuid);
|
||||
cJSON_AddNumberToObject(idx_json, "timestamp", (double)idx->desc.timestamp);
|
||||
cJSON_AddNumberToObject(idx_json, "timestamp", (double) idx->desc.timestamp);
|
||||
cJSON_AddItemToArray(arr, idx_json);
|
||||
}
|
||||
|
||||
@@ -362,7 +375,7 @@ int file(void *p, onion_request *req, onion_response *res) {
|
||||
|
||||
int ret;
|
||||
if (strlen(idx->desc.rewrite_url) == 0) {
|
||||
ret =serve_file_from_disk(source, idx, req, res);
|
||||
ret = serve_file_from_disk(source, idx, req, res);
|
||||
} else {
|
||||
ret = serve_file_from_url(source, idx, req, res);
|
||||
}
|
||||
@@ -384,7 +397,6 @@ void serve(const char *hostname, const char *port) {
|
||||
onion_url_add(urls, "", search_index);
|
||||
onion_url_add(urls, "css", style);
|
||||
onion_url_add(urls, "js", javascript);
|
||||
onion_url_add(urls, "img/bg-bars.png", bg_bars);
|
||||
onion_url_add(urls, "img/sprite-skin-flat.png", img_sprite_skin_flag);
|
||||
|
||||
onion_url_add(urls, "es", search);
|
||||
|
||||
File diff suppressed because one or more lines are too long
242
web/css/dark.css
Normal file
242
web/css/dark.css
Normal file
@@ -0,0 +1,242 @@
|
||||
a {
|
||||
color: #00BCD4;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow-y: scroll;
|
||||
background: black;
|
||||
}
|
||||
|
||||
.progress {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 1em;
|
||||
background: #212121;
|
||||
color: #e0e0e0;
|
||||
border-radius: 1px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-size: 1.75rem;
|
||||
padding: 0;
|
||||
color: #f5f5f5;
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background: #546b7a;
|
||||
}
|
||||
|
||||
.navbar a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.navbar span {
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.document {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.document p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.document:hover p {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.badge-video {
|
||||
color: #FFFFFF;
|
||||
background-color: #F27761;
|
||||
}
|
||||
|
||||
.badge-image {
|
||||
color: #FFFFFF;
|
||||
background-color: #AA99C9;
|
||||
}
|
||||
|
||||
.badge-audio {
|
||||
color: #FFFFFF;
|
||||
background-color: #00ADEF;
|
||||
}
|
||||
|
||||
.badge-resolution {
|
||||
color: #212529;
|
||||
background-color: #B0BEC5;
|
||||
}
|
||||
|
||||
.badge-text {
|
||||
color: #FFFFFF;
|
||||
background-color: #FAAB3C;
|
||||
}
|
||||
|
||||
.card-img-overlay {
|
||||
pointer-events: none;
|
||||
padding: 0.75rem;
|
||||
|
||||
bottom: unset;
|
||||
top: 0;
|
||||
left: unset;
|
||||
right: unset;
|
||||
}
|
||||
|
||||
.file-title {
|
||||
font-size: 10pt;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.badge {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.fit {
|
||||
display: block;
|
||||
min-width: 64px;
|
||||
max-width: 100%;
|
||||
max-height: 175px;
|
||||
margin: 0 auto 0;
|
||||
padding: 3px 3px 0 3px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.audio-fit {
|
||||
height: 39px;
|
||||
vertical-align: bottom;
|
||||
display: inline;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.card-columns {
|
||||
column-count: 4;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1500px) {
|
||||
.container {
|
||||
max-width: 1440px;
|
||||
}
|
||||
|
||||
.card-columns {
|
||||
column-count: 5;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1800px) {
|
||||
.container {
|
||||
max-width: 1550px;
|
||||
}
|
||||
}
|
||||
|
||||
mark {
|
||||
background: #fff217;
|
||||
border-radius: 0;
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
||||
.content-div {
|
||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 13px;
|
||||
padding: 1em;
|
||||
background-color: #37474F;
|
||||
border: 1px solid #616161;
|
||||
border-radius: 4px;
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
.irs-single, .irs-from, .irs-to {
|
||||
font-size: 13px;
|
||||
background-color: #00BCD4;
|
||||
}
|
||||
|
||||
.irs-slider {
|
||||
cursor: col-resize;
|
||||
}
|
||||
|
||||
.irs {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
.custom-select {
|
||||
overflow: auto;
|
||||
background-color: #37474F;
|
||||
border: 1px solid #616161;
|
||||
color: #bdbdbd;
|
||||
}
|
||||
|
||||
.custom-select:focus {
|
||||
border-color: #757575;
|
||||
outline: 0;
|
||||
box-shadow: 0 0 0 .2rem rgba(0, 123, 255, .25);
|
||||
}
|
||||
|
||||
option {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
background-color: #37474F;
|
||||
border: 1px solid #616161;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
background-color: #546E7A;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.input-group-text {
|
||||
background: #263238;
|
||||
border: 1px solid #616161;
|
||||
color: #dbdbdb;
|
||||
}
|
||||
|
||||
::placeholder {
|
||||
color: #BDBDBD !important;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
.inspire-tree .selected > .wholerow, .inspire-tree .selected > .title-wrap:hover + .wholerow {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.inspire-tree .icon-expand::before, .inspire-tree .icon-collapse::before {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.inspire-tree .title {
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.inspire-tree {
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
font-family: Helvetica, Nueue, Verdana, sans-serif;
|
||||
max-height: 350px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.page-indicator {
|
||||
line-height: 1rem;
|
||||
padding: 0.5rem;
|
||||
background: #212121;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.btn-xs {
|
||||
padding: .1rem .3rem;
|
||||
font-size: .875rem;
|
||||
border-radius: .2rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #eee;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ body {overflow-y:scroll;}
|
||||
|
||||
.card {
|
||||
margin-top: 1em;
|
||||
box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
|
||||
}
|
||||
.navbar-brand {
|
||||
font-size: 1.75rem;
|
||||
@@ -87,6 +88,7 @@ body {overflow-y:scroll;}
|
||||
height: 39px;
|
||||
vertical-align: bottom;
|
||||
display: inline;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
@@ -159,6 +161,7 @@ mark {
|
||||
.page-indicator {
|
||||
line-height: 1rem;
|
||||
padding: 0.5rem;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.btn-xs {
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.3 KiB |
BIN
web/img/sprite-skin-flat-dark.png
Normal file
BIN
web/img/sprite-skin-flat-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 595 B |
@@ -82,7 +82,7 @@ function shouldPlayVideo(hit) {
|
||||
*/
|
||||
function createDocCard(hit) {
|
||||
let docCard = document.createElement("div");
|
||||
docCard.setAttribute("class", "card shadow-sm");
|
||||
docCard.setAttribute("class", "card");
|
||||
|
||||
let docCardBody = document.createElement("div");
|
||||
docCardBody.setAttribute("class", "card-body document");
|
||||
@@ -197,7 +197,7 @@ function createDocCard(hit) {
|
||||
let contentHl = getContentHighlight(hit);
|
||||
if (contentHl !== undefined) {
|
||||
let contentDiv = document.createElement("div");
|
||||
contentDiv.setAttribute("class", "content-div bg-light");
|
||||
contentDiv.setAttribute("class", "content-div");
|
||||
contentDiv.insertAdjacentHTML('afterbegin', contentHl);
|
||||
docCard.appendChild(contentDiv);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ function makePreloader() {
|
||||
|
||||
function makePageIndicator(searchResult) {
|
||||
let pageIndicator = document.createElement("div");
|
||||
pageIndicator.setAttribute("class", "page-indicator shadow-sm bg-light font-weight-light");
|
||||
pageIndicator.setAttribute("class", "page-indicator font-weight-light");
|
||||
const totalHits = searchResult["hits"]["total"].hasOwnProperty("value")
|
||||
? searchResult["hits"]["total"]["value"] : searchResult["hits"]["total"];
|
||||
pageIndicator.appendChild(document.createTextNode(docCount + " / " + totalHits));
|
||||
|
||||
@@ -21,6 +21,17 @@ jQuery["jsonPost"] = function (url, data) {
|
||||
});
|
||||
};
|
||||
|
||||
window.onload = () => {
|
||||
$("#theme").on("click", () => {
|
||||
if (!document.cookie.includes("sist")) {
|
||||
document.cookie = "sist=dark";
|
||||
} else {
|
||||
document.cookie = "sist=; Max-Age=-99999999;";
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
};
|
||||
|
||||
function toggleSearchBar() {
|
||||
searchDebounced();
|
||||
}
|
||||
@@ -105,7 +116,7 @@ $.jsonPost("es", {
|
||||
new autoComplete({
|
||||
selector: '#pathBar',
|
||||
minChars: 1,
|
||||
delay: 75,
|
||||
delay: 400,
|
||||
renderItem: function (item) {
|
||||
return '<div class="autocomplete-suggestion" data-val="' + item + '">' + item + '</div>';
|
||||
},
|
||||
@@ -268,14 +279,6 @@ function search() {
|
||||
//Search stats
|
||||
searchResults.appendChild(makeStatsCard(searchResult));
|
||||
|
||||
//Autocomplete
|
||||
if (searchResult.hasOwnProperty("suggest") && searchResult["suggest"].hasOwnProperty("path")) {
|
||||
pathAutoComplete = [];
|
||||
for (let i = 0; i < searchResult["suggest"]["path"][0]["options"].length; i++) {
|
||||
pathAutoComplete.push(searchResult["suggest"]["path"][0]["options"][i].text)
|
||||
}
|
||||
}
|
||||
|
||||
//Setup page
|
||||
let resultContainer = makeResultContainer();
|
||||
searchResults.appendChild(resultContainer);
|
||||
@@ -287,7 +290,6 @@ function search() {
|
||||
});
|
||||
}
|
||||
|
||||
let pathAutoComplete = [];
|
||||
let size_min = 0;
|
||||
let size_max = 10000000000000;
|
||||
|
||||
@@ -295,8 +297,8 @@ let searchDebounced = _.debounce(function () {
|
||||
coolingDown = false;
|
||||
search()
|
||||
}, 500);
|
||||
|
||||
searchBar.addEventListener("keyup", searchDebounced);
|
||||
document.getElementById("pathBar").addEventListener("keyup", searchDebounced);
|
||||
|
||||
//Size slider
|
||||
$("#sizeSlider").ionRangeSlider({
|
||||
@@ -347,15 +349,18 @@ updateIndices();
|
||||
//Suggest
|
||||
function getPathChoices() {
|
||||
return new Promise(getPaths => {
|
||||
|
||||
let xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function () {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
getPaths(JSON.parse(xhttp.responseText))
|
||||
$.jsonPost("es", {
|
||||
suggest: {
|
||||
path: {
|
||||
prefix: pathBar.value,
|
||||
completion: {
|
||||
field: "suggest-path",
|
||||
skip_duplicates: true,
|
||||
size: 10000
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
xhttp.open("GET", "suggest?prefix=" + pathBar.value, true);
|
||||
xhttp.send();
|
||||
});
|
||||
}).then(resp => getPaths(resp["suggest"]["path"][0]["options"].map(opt => opt["_source"]["path"])));
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light">
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
<a class="navbar-brand" href="/">sist2</a>
|
||||
<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>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
|
||||
Reference in New Issue
Block a user