mirror of
https://github.com/simon987/sist2.git
synced 2025-12-12 15:08:53 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bdbd7ca7ed | |||
| 9b7c56a608 | |||
| 4109ba6d34 | |||
| 69f0c1f2cf | |||
| c063d87232 | |||
| f44e6336dc | |||
| 7be6234f0d | |||
| 85ab2858f6 | |||
| cbb043f03f | |||
| 50fcec25f7 | |||
| b4199a1fd8 | |||
| ef79681024 | |||
| 0d4deb3eb3 |
269
CMakeLists.txt
269
CMakeLists.txt
@@ -1,38 +1,74 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
option(WITH_SIST2 "Build main executable" ON)
|
||||
option(WITH_SIST2_SCAN "Build scan executable" ON)
|
||||
|
||||
project(sist2 C)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
|
||||
|
||||
add_executable(
|
||||
sist2
|
||||
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/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/parsing/font.c src/parsing/font.h
|
||||
if (WITH_SIST2)
|
||||
add_executable(
|
||||
sist2
|
||||
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/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/parsing/font.c src/parsing/font.h
|
||||
|
||||
# argparse
|
||||
argparse/argparse.h argparse/argparse.c
|
||||
# argparse
|
||||
argparse/argparse.h argparse/argparse.c
|
||||
|
||||
# cJSON
|
||||
cJSON/cJSON.h cJSON/cJSON.c
|
||||
# cJSON
|
||||
cJSON/cJSON.h cJSON/cJSON.c
|
||||
|
||||
# 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)
|
||||
# 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 ()
|
||||
|
||||
if (WITH_SIST2_SCAN)
|
||||
add_executable(
|
||||
sist2_scan
|
||||
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
|
||||
|
||||
# argparse
|
||||
argparse/argparse.h argparse/argparse.c
|
||||
|
||||
# cJSON
|
||||
cJSON/cJSON.h cJSON/cJSON.c
|
||||
|
||||
# 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 ()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig/")
|
||||
@@ -46,82 +82,149 @@ pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
|
||||
pkg_check_modules(UUID REQUIRED uuid)
|
||||
|
||||
include_directories(${LIBMAGIC_INCLUDE_DIRS})
|
||||
link_directories(${LIBMAGIC_LIBRARY_DIRS})
|
||||
add_definitions(${LIBMAGIC_CFLAGS_OTHER})
|
||||
|
||||
link_directories(${UUID_LIBRARY_DIRS})
|
||||
include_directories(${UUID_INCLUDE_DIRS})
|
||||
add_definitions(${UUID_CFLAGS_OTHER})
|
||||
|
||||
include_directories(${GLIB_INCLUDE_DIRS})
|
||||
link_directories(${GLIB_LIBRARY_DIRS})
|
||||
add_definitions(${GLIB_CFLAGS_OTHER})
|
||||
|
||||
include_directories(${GOBJECT_INCLUDE_DIRS})
|
||||
link_directories(${GOBJECT_LIBRARY_DIRS})
|
||||
add_definitions(${GOBJECT_CFLAGS_OTHER})
|
||||
|
||||
link_directories(${FFMPEG_LIBRARY_DIRS})
|
||||
include_directories(${FFMPEG_INCLUDE_DIRS})
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
link_directories(${OPENSSL_CRYPTO_LIBRARY})
|
||||
add_definitions(${FREETYPE_CFLAGS_OTHER})
|
||||
|
||||
list(REMOVE_ITEM GLIB_LIBRARIES pcre)
|
||||
list(REMOVE_ITEM GOBJECT_LIBRARIES pcre)
|
||||
list(REMOVE_ITEM UUID_LIBRARIES pcre)
|
||||
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS})
|
||||
add_definitions(${FREETYPE_CFLAGS_OTHER})
|
||||
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}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/
|
||||
${PROJECT_SOURCE_DIR}/lmdb/libraries/liblmdb/
|
||||
${PROJECT_SOURCE_DIR}/lib/onion/src/
|
||||
${PROJECT_SOURCE_DIR}/lib/mupdf/include/
|
||||
)
|
||||
|
||||
target_compile_options(sist2
|
||||
PRIVATE
|
||||
-O3
|
||||
# -march=native
|
||||
-fno-stack-protector
|
||||
-fomit-frame-pointer
|
||||
)
|
||||
target_compile_options(sist2
|
||||
PRIVATE
|
||||
-O3
|
||||
# -march=native
|
||||
-fno-stack-protector
|
||||
-fomit-frame-pointer
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(
|
||||
sist2
|
||||
TARGET_LINK_LIBRARIES(
|
||||
sist2
|
||||
|
||||
${GLIB_LIBRARIES}
|
||||
${GOBJECT_LIBRARIES}
|
||||
${UUID_LIBRARIES}
|
||||
${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
|
||||
# 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
|
||||
# mupdf
|
||||
${PROJECT_SOURCE_DIR}/lib/libmupdf.a
|
||||
${PROJECT_SOURCE_DIR}/lib/libmupdf-third.a
|
||||
|
||||
# onion
|
||||
${PROJECT_SOURCE_DIR}/lib/libonion_static.a
|
||||
# onion
|
||||
${PROJECT_SOURCE_DIR}/lib/libonion_static.a
|
||||
|
||||
pthread
|
||||
curl
|
||||
m
|
||||
bz2
|
||||
magic
|
||||
)
|
||||
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(
|
||||
before_sist2
|
||||
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()
|
||||
@@ -80,7 +80,12 @@ binaries.
|
||||
libssl-dev uuid-dev libavformat-dev libswscale-dev \
|
||||
python3 libmagic-dev libfreetype6-dev libcurl-dev \
|
||||
libbz2-dev yasm
|
||||
|
||||
```
|
||||
*(FreeBSD)*
|
||||
```bash
|
||||
pkg install cmake gcc yasm gmake bash ffmpeg e2fsprogs-uuid
|
||||
```
|
||||
__
|
||||
2. Build
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/simon987/sist2
|
||||
|
||||
4
mime.csv
4
mime.csv
@@ -356,4 +356,6 @@ text/x-vcard, vcf
|
||||
application/x-innosetup,
|
||||
application/winhelp, hlp
|
||||
image/x-tga,
|
||||
application/x-wine-extension-ini,
|
||||
application/x-wine-extension-ini,
|
||||
application/x-cbz, cbz
|
||||
application/x-cbr, cbr
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"index": {
|
||||
"refresh_interval": "-1",
|
||||
"refresh_interval": "30s",
|
||||
"codec": "best_compression"
|
||||
},
|
||||
"analysis": {
|
||||
@@ -24,13 +24,15 @@
|
||||
"my_nGram": {
|
||||
"tokenizer": "my_nGram_tokenizer",
|
||||
"filter": [
|
||||
"lowercase"
|
||||
"lowercase",
|
||||
"asciifolding"
|
||||
]
|
||||
},
|
||||
"content_analyzer": {
|
||||
"tokenizer": "standard",
|
||||
"filter": [
|
||||
"lowercase"
|
||||
"lowercase",
|
||||
"asciifolding"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rm -rf index.sist2/
|
||||
|
||||
rm web/js/bundle.js 2> /dev/null
|
||||
cat `ls -v web/js/*.min.js` > web/js/bundle.js
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
cd lib
|
||||
|
||||
cd mupdf
|
||||
@@ -36,4 +36,22 @@ 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 ..
|
||||
@@ -17,7 +17,6 @@ major_mime = {
|
||||
|
||||
pdf = (
|
||||
"application/pdf",
|
||||
"application/x-cbr",
|
||||
"application/x-cbz",
|
||||
"application/vnd.ms-xpsdocument",
|
||||
)
|
||||
@@ -71,7 +70,7 @@ with open("mime.csv") as f:
|
||||
print("#include <stdlib.h>\n")
|
||||
# Enum
|
||||
print("enum mime {")
|
||||
for mime, ext in mimes.items():
|
||||
for mime, ext in sorted(mimes.items()):
|
||||
print(" " + clean(mime) + "=" + mime_id(mime) + ",")
|
||||
print("};")
|
||||
|
||||
|
||||
22
src/cli.c
22
src/cli.c
@@ -17,16 +17,6 @@ scan_args_t *scan_args_create() {
|
||||
return args;
|
||||
}
|
||||
|
||||
index_args_t *index_args_create() {
|
||||
index_args_t *args = calloc(sizeof(index_args_t), 1);
|
||||
return args;
|
||||
}
|
||||
|
||||
web_args_t *web_args_create() {
|
||||
web_args_t *args = calloc(sizeof(web_args_t), 1);
|
||||
return args;
|
||||
}
|
||||
|
||||
int scan_args_validate(scan_args_t *args, int argc, const char **argv) {
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Required positional argument: PATH.\n");
|
||||
@@ -100,6 +90,7 @@ int scan_args_validate(scan_args_t *args, int argc, const char **argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
int index_args_validate(index_args_t *args, int argc, const char **argv) {
|
||||
|
||||
if (argc < 2) {
|
||||
@@ -153,3 +144,14 @@ int web_args_validate(web_args_t *args, int argc, const char **argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
index_args_t *index_args_create() {
|
||||
index_args_t *args = calloc(sizeof(index_args_t), 1);
|
||||
return args;
|
||||
}
|
||||
|
||||
web_args_t *web_args_create() {
|
||||
web_args_t *args = calloc(sizeof(web_args_t), 1);
|
||||
return args;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@ typedef struct scan_args {
|
||||
char *path;
|
||||
} scan_args_t;
|
||||
|
||||
scan_args_t *scan_args_create();
|
||||
int scan_args_validate(scan_args_t *args, int argc, const char **argv);
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
typedef struct index_args {
|
||||
char *es_url;
|
||||
const char *index_path;
|
||||
@@ -30,12 +34,11 @@ typedef struct web_args {
|
||||
const char **indices;
|
||||
} web_args_t;
|
||||
|
||||
scan_args_t *scan_args_create();
|
||||
index_args_t *index_args_create();
|
||||
web_args_t *web_args_create();
|
||||
|
||||
int scan_args_validate(scan_args_t *args, int argc, const char **argv);
|
||||
int index_args_validate(index_args_t *args, int argc, const char **argv);
|
||||
int web_args_validate(web_args_t *args, int argc, const char **argv);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,6 +26,7 @@ struct {
|
||||
} ScanCtx;
|
||||
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
struct {
|
||||
char *es_url;
|
||||
} IndexCtx;
|
||||
@@ -35,6 +36,7 @@ struct {
|
||||
int index_count;
|
||||
struct index_t indices[16];
|
||||
} WebCtx;
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -70,7 +70,8 @@ void elastic_flush() {
|
||||
|
||||
while (line != NULL) {
|
||||
char action_str[512];
|
||||
snprintf(action_str, 512, "{\"index\":{\"_id\": \"%s\"}}\n", line->uuid_str);
|
||||
snprintf(action_str, 512,
|
||||
"{\"index\":{\"_id\":\"%s\", \"_type\":\"_doc\", \"_index\":\"sist2\"}}\n", line->uuid_str);
|
||||
size_t action_str_len = strlen(action_str);
|
||||
|
||||
size_t line_len = strlen(line->line);
|
||||
@@ -98,6 +99,14 @@ void elastic_flush() {
|
||||
snprintf(bulk_url, 4096, "%s/sist2/_bulk", Indexer->es_url);
|
||||
response_t *r = web_post(bulk_url, buf, "Content-Type: application/x-ndjson");
|
||||
printf("Indexed %3d documents (%zukB) <%d>\n", count, buf_cur / 1024, r->status_code);
|
||||
|
||||
cJSON *ret_json = cJSON_Parse(r->body);
|
||||
if (cJSON_GetObjectItem(ret_json, "errors")->valueint != 0) {
|
||||
fprintf(stderr, "%s\n", r->body);
|
||||
}
|
||||
|
||||
cJSON_Delete(ret_json);
|
||||
|
||||
free_response(r);
|
||||
}
|
||||
|
||||
@@ -187,7 +196,7 @@ void elastic_init(int force_reset) {
|
||||
printf("Update settings <%d>\n", r->status_code);
|
||||
free_response(r);
|
||||
|
||||
snprintf(url, 4096, "%s/sist2/_mappings", IndexCtx.es_url);
|
||||
snprintf(url, 4096, "%s/sist2/_mappings/_doc?include_type_name=true", IndexCtx.es_url);
|
||||
r = web_put(url, mappings_json, "Content-Type: application/json");
|
||||
printf("Update mappings <%d>\n", r->status_code);
|
||||
free_response(r);
|
||||
@@ -201,8 +210,11 @@ void elastic_init(int force_reset) {
|
||||
|
||||
cJSON *elastic_get_document(const char *uuid_str) {
|
||||
char url[4096];
|
||||
snprintf(url, 4096, "%s/sist2/_source/%s", WebCtx.es_url, uuid_str);
|
||||
snprintf(url, 4096, "%s/sist2/_doc/%s", WebCtx.es_url, uuid_str);
|
||||
|
||||
response_t *r = web_get(url);
|
||||
return cJSON_Parse(r->body);
|
||||
if (r->status_code == 200) {
|
||||
return cJSON_Parse(r->body);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -115,8 +115,8 @@ void write_document(document_t *doc) {
|
||||
|
||||
if (IndexFd == -1) {
|
||||
char dstfile[PATH_MAX];
|
||||
pid_t tid = syscall(SYS_gettid);
|
||||
snprintf(dstfile, PATH_MAX, "%s_index_%d", ScanCtx.index.path, tid);
|
||||
pthread_t self = pthread_self();
|
||||
snprintf(dstfile, PATH_MAX, "%s_index_%lu", ScanCtx.index.path, self);
|
||||
IndexFd = open(dstfile, O_CREAT | O_WRONLY | O_APPEND, S_IRUSR | S_IWUSR);
|
||||
|
||||
if (IndexFd == -1) {
|
||||
@@ -232,7 +232,9 @@ void read_index(const char *path, const char index_id[UUID_STR_LEN], index_func
|
||||
case MetaTitle: {
|
||||
buf.cur = 0;
|
||||
while ((c = getc(file)) != 0) {
|
||||
dyn_buffer_write_char(&buf, (char) c);
|
||||
if (!(SHOULD_IGNORE_CHAR(c)) || c == ' ') {
|
||||
dyn_buffer_write_char(&buf, (char) c);
|
||||
}
|
||||
}
|
||||
dyn_buffer_write_char(&buf, '\0');
|
||||
cJSON_AddStringToObject(document, get_meta_key_text(key), buf.buf);
|
||||
|
||||
30
src/main.c
30
src/main.c
@@ -1,11 +1,16 @@
|
||||
#include "sist.h"
|
||||
#include "ctx.h"
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
#define DESCRIPTION "Lightning-fast file system indexer and search tool."
|
||||
#else
|
||||
#define DESCRIPTION "Lightning-fast file system indexer and search tool. (SCAN ONLY)"
|
||||
#endif
|
||||
|
||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
||||
|
||||
|
||||
static const char *const Version = "1.0.0";
|
||||
static const char *const Version = "1.0.8";
|
||||
static const char *const usage[] = {
|
||||
"sist2 scan [OPTION]... PATH",
|
||||
"sist2 index [OPTION]... INDEX",
|
||||
@@ -14,7 +19,9 @@ static const char *const usage[] = {
|
||||
};
|
||||
|
||||
void global_init() {
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
curl_global_init(CURL_GLOBAL_NOTHING);
|
||||
#endif
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
}
|
||||
|
||||
@@ -23,7 +30,7 @@ void init_dir(const char *dirpath) {
|
||||
snprintf(path, PATH_MAX, "%sdescriptor.json", dirpath);
|
||||
|
||||
uuid_t uuid;
|
||||
uuid_generate_time_safe(uuid);
|
||||
uuid_generate(uuid);
|
||||
uuid_unparse(uuid, ScanCtx.index.desc.uuid);
|
||||
time(&ScanCtx.index.desc.timestamp);
|
||||
strcpy(ScanCtx.index.desc.version, Version);
|
||||
@@ -116,6 +123,7 @@ void sist2_scan(scan_args_t *args) {
|
||||
store_destroy(ScanCtx.index.store);
|
||||
}
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
void sist2_index(index_args_t *args) {
|
||||
|
||||
IndexCtx.es_url = args->es_url;
|
||||
@@ -186,6 +194,7 @@ void sist2_web(web_args_t *args) {
|
||||
|
||||
serve(args->bind, args->port);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
@@ -193,10 +202,12 @@ int main(int argc, const char *argv[]) {
|
||||
global_init();
|
||||
|
||||
scan_args_t *scan_args = scan_args_create();
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
index_args_t *index_args = index_args_create();
|
||||
web_args_t *web_args = web_args_create();
|
||||
#endif
|
||||
|
||||
char * common_es_url;
|
||||
char * common_es_url = NULL;
|
||||
|
||||
struct argparse_option options[] = {
|
||||
OPT_HELP(),
|
||||
@@ -214,6 +225,7 @@ int main(int argc, const char *argv[]) {
|
||||
OPT_STRING(0, "rewrite-url", &scan_args->rewrite_url, "Serve files from this url instead of from disk."),
|
||||
OPT_STRING(0, "name", &scan_args->name, "Index display name. DEFAULT: (name of the directory)"),
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
OPT_GROUP("Index options"),
|
||||
OPT_STRING(0, "es-url", &common_es_url, "Elasticsearch url. DEFAULT=http://localhost:9200"),
|
||||
OPT_BOOLEAN('p', "print", &index_args->print, "Just print JSON documents to stdout."),
|
||||
@@ -224,6 +236,7 @@ int main(int argc, const char *argv[]) {
|
||||
OPT_STRING(0, "es-url", &common_es_url, "Elasticsearch url. DEFAULT=http://localhost:9200"),
|
||||
OPT_STRING(0, "bind", &web_args->bind, "Listen on this address. DEFAULT=localhost"),
|
||||
OPT_STRING(0, "port", &web_args->port, "Listen on this port. DEFAULT=4090"),
|
||||
#endif
|
||||
|
||||
OPT_END(),
|
||||
};
|
||||
@@ -233,8 +246,10 @@ int main(int argc, const char *argv[]) {
|
||||
argparse_describe(&argparse, DESCRIPTION, EPILOG);
|
||||
argc = argparse_parse(&argparse, argc, argv);
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
web_args->es_url = common_es_url;
|
||||
index_args->es_url = common_es_url;
|
||||
#endif
|
||||
|
||||
if (argc == 0) {
|
||||
argparse_usage(&argparse);
|
||||
@@ -247,7 +262,10 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
sist2_scan(scan_args);
|
||||
|
||||
} else if (strcmp(argv[0], "index") == 0) {
|
||||
}
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
else if (strcmp(argv[0], "index") == 0) {
|
||||
|
||||
int err = index_args_validate(index_args, argc, argv);
|
||||
if (err != 0) {
|
||||
@@ -263,7 +281,9 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
sist2_web(web_args);
|
||||
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
fprintf(stderr, "Invalid command: '%s'\n", argv[0]);
|
||||
argparse_usage(&argparse);
|
||||
return 1;
|
||||
|
||||
@@ -151,6 +151,7 @@ void append_audio_meta(AVFormatContext *pFormatCtx, document_t *doc) {
|
||||
void parse_media(const char *filepath, document_t *doc) {
|
||||
|
||||
int video_stream = -1;
|
||||
int audio_stream = -1;
|
||||
|
||||
AVFormatContext *pFormatCtx = avformat_alloc_context();
|
||||
if (pFormatCtx == NULL) {
|
||||
@@ -169,31 +170,35 @@ void parse_media(const char *filepath, document_t *doc) {
|
||||
AVStream *stream = pFormatCtx->streams[i];
|
||||
|
||||
if (stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
meta_line_t *meta_audio = malloc(sizeof(meta_line_t));
|
||||
meta_audio->key = MetaMediaAudioCodec;
|
||||
meta_audio->intval = stream->codecpar->codec_id;
|
||||
APPEND_META(doc, meta_audio)
|
||||
|
||||
append_audio_meta(pFormatCtx, doc);
|
||||
if (audio_stream == -1) {
|
||||
meta_line_t *meta_audio = malloc(sizeof(meta_line_t));
|
||||
meta_audio->key = MetaMediaAudioCodec;
|
||||
meta_audio->intval = stream->codecpar->codec_id;
|
||||
APPEND_META(doc, meta_audio)
|
||||
|
||||
append_audio_meta(pFormatCtx, doc);
|
||||
audio_stream = i;
|
||||
}
|
||||
} else if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
|
||||
meta_line_t *meta_vid = malloc(sizeof(meta_line_t));
|
||||
meta_vid->key = MetaMediaVideoCodec;
|
||||
meta_vid->intval = stream->codecpar->codec_id;
|
||||
APPEND_META(doc, meta_vid)
|
||||
if (video_stream == -1) {
|
||||
meta_line_t *meta_vid = malloc(sizeof(meta_line_t));
|
||||
meta_vid->key = MetaMediaVideoCodec;
|
||||
meta_vid->intval = stream->codecpar->codec_id;
|
||||
APPEND_META(doc, meta_vid)
|
||||
|
||||
meta_line_t *meta_w = malloc(sizeof(meta_line_t));
|
||||
meta_w->key = MetaWidth;
|
||||
meta_w->intval = stream->codecpar->width;
|
||||
APPEND_META(doc, meta_w)
|
||||
meta_line_t *meta_w = malloc(sizeof(meta_line_t));
|
||||
meta_w->key = MetaWidth;
|
||||
meta_w->intval = stream->codecpar->width;
|
||||
APPEND_META(doc, meta_w)
|
||||
|
||||
meta_line_t *meta_h = malloc(sizeof(meta_line_t));
|
||||
meta_h->key = MetaHeight;
|
||||
meta_h->intval = stream->codecpar->height;
|
||||
APPEND_META(doc, meta_h)
|
||||
meta_line_t *meta_h = malloc(sizeof(meta_line_t));
|
||||
meta_h->key = MetaHeight;
|
||||
meta_h->intval = stream->codecpar->height;
|
||||
APPEND_META(doc, meta_h)
|
||||
|
||||
video_stream = i;
|
||||
video_stream = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,364 +6,366 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
enum mime {
|
||||
application_arj=655361,
|
||||
application_base64=655362,
|
||||
application_binhex=655363,
|
||||
application_book=655364,
|
||||
application_CDFV2=655365,
|
||||
application_clariscad=655366,
|
||||
application_commonground=655367,
|
||||
application_drafting=655368,
|
||||
application_freeloader=655369,
|
||||
application_futuresplash=655370,
|
||||
application_groupwise=655371,
|
||||
application_gzip=655372,
|
||||
application_hta=655373,
|
||||
application_i_deas=655374,
|
||||
application_iges=655375,
|
||||
application_inf=655376,
|
||||
application_java_archive=655377,
|
||||
application_java=655378,
|
||||
application_javascript=655379,
|
||||
application_x_archive=655380,
|
||||
application_json=655381,
|
||||
application_marc=655382,
|
||||
application_mbedlet=655383,
|
||||
application_mime=655384,
|
||||
application_mspowerpoint=655385,
|
||||
application_msword=655386,
|
||||
application_netmc=655387,
|
||||
application_octet_stream=655388,
|
||||
application_oda=655389,
|
||||
application_pdf=655390 | 0x40000000,
|
||||
application_pgp_signature=655391,
|
||||
application_pkcs7_signature=655392,
|
||||
application_pkix_cert=655393,
|
||||
application_postscript=655394,
|
||||
application_pro_eng=655395,
|
||||
application_ringing_tones=655396,
|
||||
application_smil=655397,
|
||||
application_solids=655398,
|
||||
application_sounder=655399,
|
||||
application_step=655400,
|
||||
application_streamingmedia=655401,
|
||||
application_vda=655402,
|
||||
application_vnd_fdf=655403,
|
||||
application_vnd_font_fontforge_sfd=655404,
|
||||
application_vnd_hp_hpgl=655405,
|
||||
application_vnd_ms_excel=655406,
|
||||
application_vnd_ms_fontobject=655407,
|
||||
application_vnd_ms_opentype=655408 | 0x20000000,
|
||||
application_vnd_ms_pki_certstore=655409,
|
||||
application_vnd_ms_pki_pko=655410,
|
||||
application_vnd_ms_pki_seccat=655411,
|
||||
application_vnd_ms_powerpoint=655412,
|
||||
application_vnd_ms_project=655413,
|
||||
application_vnd_oasis_opendocument_base=655414,
|
||||
application_vnd_oasis_opendocument_formula=655415,
|
||||
application_vnd_oasis_opendocument_graphics=655416,
|
||||
application_vnd_oasis_opendocument_text=655417,
|
||||
application_vnd_wap_wmlc=655418,
|
||||
application_vnd_wap_wmlscriptc=655419,
|
||||
application_vnd_xara=655420,
|
||||
application_vocaltec_media_desc=655421,
|
||||
application_vocaltec_media_file=655422,
|
||||
application_wordperfect6_0=655423,
|
||||
application_wordperfect6_1=655424,
|
||||
application_wordperfect=655425,
|
||||
application_x_123=655426,
|
||||
application_x_aim=655427,
|
||||
application_x_authorware_bin=655428,
|
||||
application_x_authorware_map=655429,
|
||||
application_x_authorware_seg=655430,
|
||||
application_x_bcpio=655431,
|
||||
application_x_bittorrent=655432,
|
||||
application_x_bsh=655433,
|
||||
application_x_bytecode_python=655434,
|
||||
application_x_bzip2=655435,
|
||||
application_x_bzip=655436,
|
||||
application_x_cdlink=655437,
|
||||
application_x_chat=655438,
|
||||
application_x_cocoa=655439,
|
||||
application_x_conference=655440,
|
||||
application_x_cpio=655441,
|
||||
application_x_dbf=655442,
|
||||
application_x_dbt=655443,
|
||||
application_x_deepv=655444,
|
||||
application_x_director=655445,
|
||||
application_x_dosexec=655446,
|
||||
application_x_dvi=655447,
|
||||
application_x_elc=655448,
|
||||
application_x_envoy=655449,
|
||||
application_x_esrehber=655450,
|
||||
application_x_excel=655451,
|
||||
application_x_executable=655452,
|
||||
application_x_font_sfn=655453 | 0x20000000,
|
||||
application_x_font_ttf=655454 | 0x20000000,
|
||||
application_x_freelance=655455,
|
||||
application_x_git=655456,
|
||||
application_x_gsp=655457,
|
||||
application_x_gss=655458,
|
||||
application_x_gtar=655459,
|
||||
application_x_gzip=655460,
|
||||
application_x_hdf=655461,
|
||||
application_x_helpfile=655462,
|
||||
application_x_httpd_imap=655463,
|
||||
application_x_ima=655464,
|
||||
application_x_internett_signup=655465,
|
||||
application_x_inventor=655466,
|
||||
application_x_ip2=655467,
|
||||
application_x_java_applet=655468,
|
||||
application_x_java_commerce=655469,
|
||||
application_x_java_image=655470,
|
||||
application_x_java_keystore=655471,
|
||||
application_x_koan=655472,
|
||||
application_x_latex=655473,
|
||||
application_x_livescreen=655474,
|
||||
application_x_lotus=655475,
|
||||
application_x_lzh=655476,
|
||||
application_x_lzx=655477,
|
||||
application_x_mach_binary=655478,
|
||||
application_x_mach_executable=655479,
|
||||
application_x_magic_cap_package_1_0=655480,
|
||||
application_x_mathcad=655481,
|
||||
application_x_meme=655482,
|
||||
application_x_midi=655483,
|
||||
application_x_mif=655484,
|
||||
application_x_mix_transfer=655485,
|
||||
application_xml=655486,
|
||||
application_x_ms_pdb=655487,
|
||||
application_x_navi_animation=655488,
|
||||
application_x_navidoc=655489,
|
||||
application_x_navimap=655490,
|
||||
application_x_navistyle=655491,
|
||||
application_x_netcdf=655492,
|
||||
application_x_newton_compatible_pkg=655493,
|
||||
application_x_object=655494,
|
||||
application_x_omcdatamaker=655495,
|
||||
application_x_omc=655496,
|
||||
application_x_omcregerator=655497,
|
||||
application_x_pagemaker=655498,
|
||||
application_x_pcl=655499,
|
||||
application_x_pixclscript=655500,
|
||||
application_x_pkcs7_certreqresp=655501,
|
||||
application_x_pkcs7_signature=655502,
|
||||
application_x_project=655503,
|
||||
application_x_qpro=655504,
|
||||
application_x_sdp=655505,
|
||||
application_x_sea=655506,
|
||||
application_x_seelogo=655507,
|
||||
application_x_setupscript=655508,
|
||||
application_x_sharedlib=655509,
|
||||
application_x_shar=655510,
|
||||
application_x_shockwave_flash=655511,
|
||||
application_x_sprite=655512,
|
||||
application_x_sqlite3=655513,
|
||||
application_x_sv4cpio=655514,
|
||||
application_x_sv4crc=655515,
|
||||
application_x_tar=655516,
|
||||
application_x_tbook=655517,
|
||||
application_x_texinfo=655518,
|
||||
application_x_tex_tfm=655519,
|
||||
application_x_ustar=655520,
|
||||
application_x_visio=655521,
|
||||
application_x_vnd_audioexplosion_mzz=655522,
|
||||
application_x_vnd_ls_xpix=655523,
|
||||
application_x_vrml=655524,
|
||||
application_x_wais_source=655525,
|
||||
application_x_wintalk=655526,
|
||||
application_x_world=655527,
|
||||
application_x_wri=655528,
|
||||
application_x_x509_ca_cert=655529,
|
||||
application_x_xz=655530,
|
||||
application_zip=655531,
|
||||
audio_it=458924,
|
||||
audio_make=458925,
|
||||
audio_midi=458926,
|
||||
audio_mid=458927,
|
||||
audio_mpeg=458928,
|
||||
audio_ogg=458929,
|
||||
audio_s3m=458930,
|
||||
audio_tsp_audio=458931,
|
||||
audio_tsplayer=458932,
|
||||
audio_vnd_qcelp=458933,
|
||||
audio_voxware=458934,
|
||||
audio_x_gsm=458935,
|
||||
audio_x_jam=458936,
|
||||
audio_x_liveaudio=458937,
|
||||
audio_x_m4a=458938,
|
||||
audio_x_midi=458939,
|
||||
audio_x_mod=458940,
|
||||
audio_x_mp4a_latm=458941,
|
||||
audio_x_mpeg_3=458942,
|
||||
audio_x_mpequrl=458943,
|
||||
audio_xm=458944,
|
||||
audio_x_nspaudio=458945,
|
||||
audio_x_pn_realaudio=458946,
|
||||
audio_x_psid=458947,
|
||||
audio_x_realaudio=458948,
|
||||
audio_x_twinvq_plugin=458949,
|
||||
audio_x_twinvq=458950,
|
||||
audio_x_voc=458951,
|
||||
audio_x_wav=458952,
|
||||
font_otf=327881 | 0x20000000,
|
||||
font_sfnt=327882 | 0x20000000,
|
||||
image_cmu_raster=524491,
|
||||
image_fif=524492,
|
||||
image_florian=524493,
|
||||
image_g3fax=524494,
|
||||
image_gif=524495,
|
||||
image_ief=524496,
|
||||
image_jpeg=524497,
|
||||
image_jutvision=524498,
|
||||
image_naplps=524499,
|
||||
image_pict=524500,
|
||||
image_png=524501,
|
||||
image_svg=524502 | 0x80000000,
|
||||
image_svg_xml=524503 | 0x80000000,
|
||||
image_vnd_fpx=524504,
|
||||
image_vnd_microsoft_icon=524505,
|
||||
image_vnd_rn_realflash=524506,
|
||||
image_vnd_rn_realpix=524507,
|
||||
image_vnd_wap_wbmp=524508,
|
||||
image_vnd_xiff=524509,
|
||||
image_webp=524510,
|
||||
image_x_cmu_raster=524511,
|
||||
image_x_dwg=524512,
|
||||
image_x_eps=524513,
|
||||
image_x_icns=524514,
|
||||
image_x_icon=524515 | 0x80000000,
|
||||
image_x_jg=524516,
|
||||
image_x_jps=524517,
|
||||
image_x_ms_bmp=524518,
|
||||
image_x_niff=524519,
|
||||
image_x_pcx=524520,
|
||||
image_x_pict=524521,
|
||||
image_x_portable_bitmap=524522,
|
||||
image_x_portable_graymap=524523,
|
||||
image_x_portable_pixmap=524524,
|
||||
image_x_quicktime=524525,
|
||||
image_x_rgb=524526,
|
||||
image_x_tiff=524527,
|
||||
image_tiff=524528,
|
||||
image_x_xcf=524529 | 0x80000000,
|
||||
image_x_xpixmap=524530 | 0x80000000,
|
||||
message_rfc822=196851,
|
||||
model_vnd_dwf=65780,
|
||||
model_vrml=65781,
|
||||
model_x_pov=65782,
|
||||
text_asp=590071,
|
||||
text_css=590072,
|
||||
text_x_sass=590073,
|
||||
text_x_scss=590074,
|
||||
text_html=590075,
|
||||
text_javascript=590076,
|
||||
text_mcf=590077,
|
||||
text_pascal=590078,
|
||||
text_plain=590079,
|
||||
text_richtext=590080,
|
||||
text_scriplet=590081,
|
||||
text_x_awk=590082,
|
||||
video_x_jng=393475 | 0x80000000,
|
||||
video_x_mng=393476,
|
||||
image_x_cur=524549,
|
||||
image_x_xwindowdump=524550,
|
||||
image_vnd_adobe_photoshop=524551 | 0x80000000,
|
||||
text_tab_separated_values=590088,
|
||||
text_troff=590089,
|
||||
text_uri_list=590090,
|
||||
text_vnd_abc=590091,
|
||||
text_vnd_fmi_flexstor=590092,
|
||||
text_vnd_wap_wmlscript=590093,
|
||||
text_vnd_wap_wml=590094,
|
||||
text_webviewhtml=590095,
|
||||
text_x_Algol68=590096,
|
||||
text_x_asm=590097,
|
||||
text_x_audiosoft_intra=590098,
|
||||
text_x_bcpl=590099,
|
||||
text_x_c=590100,
|
||||
text_x_c__=590101,
|
||||
text_x_component=590102,
|
||||
text_x_diff=590103,
|
||||
text_x_fortran=590104,
|
||||
text_x_java=590105,
|
||||
text_x_la_asf=590106,
|
||||
text_x_lisp=590107,
|
||||
text_x_m4=590108,
|
||||
text_x_makefile=590109,
|
||||
text_xml=590110,
|
||||
text_x_m=590111,
|
||||
text_x_msdos_batch=590112,
|
||||
text_x_pascal=590113,
|
||||
text_x_perl=590114,
|
||||
text_x_php=590115,
|
||||
text_x_python=590116,
|
||||
text_x_ruby=590117,
|
||||
text_x_server_parsed_html=590118,
|
||||
text_x_setext=590119,
|
||||
text_x_sgml=590120,
|
||||
text_x_shellscript=590121,
|
||||
text_x_speech=590122,
|
||||
text_x_tex=590123,
|
||||
text_x_uil=590124,
|
||||
text_x_uuencode=590125,
|
||||
text_x_vcalendar=590126,
|
||||
video_animaflex=393519,
|
||||
video_avi=393520,
|
||||
video_avs_video=393521,
|
||||
video_mp4=393522,
|
||||
video_mpeg=393523,
|
||||
video_quicktime=393524,
|
||||
video_vdo=393525,
|
||||
video_vivo=393526,
|
||||
video_vnd_rn_realvideo=393527,
|
||||
video_vosaic=393528,
|
||||
video_webm=393529,
|
||||
video_x_amt_demorun=393530,
|
||||
video_x_amt_showrun=393531,
|
||||
video_x_atomic3d_feature=393532,
|
||||
video_x_dl=393533,
|
||||
video_x_dv=393534,
|
||||
video_x_fli=393535,
|
||||
video_x_isvideo=393536,
|
||||
video_x_motion_jpeg=393537,
|
||||
video_x_ms_asf=393538,
|
||||
video_x_qtc=393539,
|
||||
video_x_sgi_movie=393540,
|
||||
application_x_7z_compressed=655685,
|
||||
application_vnd_openxmlformats_officedocument_wordprocessingml_document=655686,
|
||||
text_x_po=590151,
|
||||
application_x_rpm=655688,
|
||||
application_x_debian_package=655689,
|
||||
application_vnd_iccprofile=655690,
|
||||
application_dicom=655691,
|
||||
image_x_exr=524620,
|
||||
video_x_matroska=393549,
|
||||
application_CDFV2=655361,
|
||||
application_CDFV2_corrupt=655362,
|
||||
application_arj=655363,
|
||||
application_base64=655364,
|
||||
application_binhex=655365,
|
||||
application_book=655366,
|
||||
application_clariscad=655367,
|
||||
application_commonground=655368,
|
||||
application_dicom=655369,
|
||||
application_drafting=655370,
|
||||
application_epub_zip=655371,
|
||||
application_freeloader=655372,
|
||||
application_futuresplash=655373,
|
||||
application_groupwise=655374,
|
||||
application_gzip=655375,
|
||||
application_hta=655376,
|
||||
application_i_deas=655377,
|
||||
application_iges=655378,
|
||||
application_inf=655379,
|
||||
application_java=655380,
|
||||
application_java_archive=655381,
|
||||
application_javascript=655382,
|
||||
application_json=655383,
|
||||
application_marc=655384,
|
||||
application_mbedlet=655385,
|
||||
application_mime=655386,
|
||||
application_mspowerpoint=655387,
|
||||
application_msword=655388,
|
||||
application_netmc=655389,
|
||||
application_octet_stream=655390,
|
||||
application_oda=655391,
|
||||
application_ogg=655392,
|
||||
application_pdf=655393 | 0x40000000,
|
||||
application_pgp_signature=655394,
|
||||
application_pkcs7_signature=655395,
|
||||
application_pkix_cert=655396,
|
||||
application_postscript=655397,
|
||||
application_pro_eng=655398,
|
||||
application_ringing_tones=655399,
|
||||
application_smil=655400,
|
||||
application_solids=655401,
|
||||
application_sounder=655402,
|
||||
application_step=655403,
|
||||
application_streamingmedia=655404,
|
||||
application_vda=655405,
|
||||
application_vnd_fdf=655406,
|
||||
application_vnd_font_fontforge_sfd=655407,
|
||||
application_vnd_hp_hpgl=655408,
|
||||
application_vnd_iccprofile=655409,
|
||||
application_vnd_ms_cab_compressed=655410,
|
||||
application_vnd_ms_excel=655411,
|
||||
application_vnd_ms_fontobject=655412,
|
||||
application_vnd_ms_opentype=655413 | 0x20000000,
|
||||
application_vnd_ms_pki_certstore=655414,
|
||||
application_vnd_ms_pki_pko=655415,
|
||||
application_vnd_ms_pki_seccat=655416,
|
||||
application_vnd_ms_powerpoint=655417,
|
||||
application_vnd_ms_project=655418,
|
||||
application_vnd_oasis_opendocument_base=655419,
|
||||
application_vnd_oasis_opendocument_formula=655420,
|
||||
application_vnd_oasis_opendocument_graphics=655421,
|
||||
application_vnd_oasis_opendocument_text=655422,
|
||||
application_vnd_openxmlformats_officedocument_spreadsheetml_sheet=655423,
|
||||
application_vnd_openxmlformats_officedocument_wordprocessingml_document=655424,
|
||||
application_vnd_wap_wmlc=655425,
|
||||
application_vnd_wap_wmlscriptc=655426,
|
||||
application_vnd_xara=655427,
|
||||
application_vocaltec_media_desc=655428,
|
||||
application_vocaltec_media_file=655429,
|
||||
application_winhelp=655430,
|
||||
application_wordperfect=655431,
|
||||
application_wordperfect6_0=655432,
|
||||
application_wordperfect6_1=655433,
|
||||
application_x_123=655434,
|
||||
application_x_7z_compressed=655435,
|
||||
application_x_aim=655436,
|
||||
application_x_archive=655437,
|
||||
application_x_authorware_bin=655438,
|
||||
application_x_authorware_map=655439,
|
||||
application_x_authorware_seg=655440,
|
||||
application_x_bcpio=655441,
|
||||
application_x_bittorrent=655442,
|
||||
application_x_bsh=655443,
|
||||
application_x_bytecode_python=655444,
|
||||
application_x_bzip=655445,
|
||||
application_x_bzip2=655446,
|
||||
application_x_cbr=655447,
|
||||
application_x_cbz=655448 | 0x40000000,
|
||||
application_x_cdlink=655449,
|
||||
application_x_chat=655450,
|
||||
application_x_cocoa=655451,
|
||||
application_x_conference=655452,
|
||||
application_x_cpio=655453,
|
||||
application_x_dbf=655454,
|
||||
application_x_dbt=655455,
|
||||
application_x_debian_package=655456,
|
||||
application_x_deepv=655457,
|
||||
application_x_director=655458,
|
||||
application_x_dosexec=655459,
|
||||
application_x_dvi=655460,
|
||||
application_x_elc=655461,
|
||||
application_x_empty=1,
|
||||
model_vnd_gdl=65871,
|
||||
model_vnd_gs_gdl=65872,
|
||||
font_woff=328017 | 0x20000000,
|
||||
font_woff2=328018 | 0x20000000,
|
||||
application_epub_zip=655699,
|
||||
application_x_mobipocket_ebook=655700,
|
||||
audio_x_flac=459093,
|
||||
application_x_rar=655702,
|
||||
video_x_msvideo=393559,
|
||||
video_x_flv=393560,
|
||||
application_x_kdelnk=655705,
|
||||
text_x_tcl=590170,
|
||||
application_ogg=655707,
|
||||
application_vnd_openxmlformats_officedocument_spreadsheetml_sheet=655708,
|
||||
application_vnd_ms_cab_compressed=655709,
|
||||
audio_mp4=459102,
|
||||
image_vnd_djvu=524639 | 0x80000000,
|
||||
application_x_ms_reader=655712,
|
||||
application_CDFV2_corrupt=655713,
|
||||
text_x_vcard=590178,
|
||||
application_x_innosetup=655715,
|
||||
application_winhelp=655716,
|
||||
image_x_tga=524645,
|
||||
application_x_wine_extension_ini=655718,
|
||||
application_x_envoy=655463,
|
||||
application_x_esrehber=655464,
|
||||
application_x_excel=655465,
|
||||
application_x_executable=655466,
|
||||
application_x_font_sfn=655467 | 0x20000000,
|
||||
application_x_font_ttf=655468 | 0x20000000,
|
||||
application_x_freelance=655469,
|
||||
application_x_git=655470,
|
||||
application_x_gsp=655471,
|
||||
application_x_gss=655472,
|
||||
application_x_gtar=655473,
|
||||
application_x_gzip=655474,
|
||||
application_x_hdf=655475,
|
||||
application_x_helpfile=655476,
|
||||
application_x_httpd_imap=655477,
|
||||
application_x_ima=655478,
|
||||
application_x_innosetup=655479,
|
||||
application_x_internett_signup=655480,
|
||||
application_x_inventor=655481,
|
||||
application_x_ip2=655482,
|
||||
application_x_java_applet=655483,
|
||||
application_x_java_commerce=655484,
|
||||
application_x_java_image=655485,
|
||||
application_x_java_keystore=655486,
|
||||
application_x_kdelnk=655487,
|
||||
application_x_koan=655488,
|
||||
application_x_latex=655489,
|
||||
application_x_livescreen=655490,
|
||||
application_x_lotus=655491,
|
||||
application_x_lzh=655492,
|
||||
application_x_lzx=655493,
|
||||
application_x_mach_binary=655494,
|
||||
application_x_mach_executable=655495,
|
||||
application_x_magic_cap_package_1_0=655496,
|
||||
application_x_mathcad=655497,
|
||||
application_x_meme=655498,
|
||||
application_x_midi=655499,
|
||||
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,
|
||||
};
|
||||
char *mime_get_mime_text(unsigned int mime_id) {switch (mime_id) {
|
||||
case application_arj: return "application/arj";
|
||||
@@ -724,6 +726,8 @@ case application_x_innosetup: return "application/x-innosetup";
|
||||
case application_winhelp: return "application/winhelp";
|
||||
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";
|
||||
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);
|
||||
@@ -1201,6 +1205,8 @@ g_hash_table_insert(ext_table, "djvu", (gpointer)image_vnd_djvu);
|
||||
g_hash_table_insert(ext_table, "lit", (gpointer)application_x_ms_reader);
|
||||
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);
|
||||
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);
|
||||
@@ -1561,5 +1567,7 @@ g_hash_table_insert(mime_table, "application/x-innosetup", (gpointer)application
|
||||
g_hash_table_insert(mime_table, "application/winhelp", (gpointer)application_winhelp);
|
||||
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);
|
||||
return mime_table;}
|
||||
#endif
|
||||
|
||||
@@ -57,7 +57,7 @@ void parse(void *arg) {
|
||||
doc.ino = job->info.st_ino;
|
||||
doc.mtime = job->info.st_mtim.tv_sec;
|
||||
|
||||
uuid_generate_time_safe(doc.uuid);
|
||||
uuid_generate(doc.uuid);
|
||||
char *buf[PARSE_BUF_SIZE];
|
||||
|
||||
if (job->info.st_size == 0) {
|
||||
|
||||
@@ -28,7 +28,7 @@ fz_page *render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
fz_try(ctx)
|
||||
fz_run_page(ctx, cover, dev, fz_identity, NULL);
|
||||
fz_always(ctx)
|
||||
pthread_mutex_unlock(&ScanCtx.mupdf_mu);
|
||||
pthread_mutex_unlock(&ScanCtx.mupdf_mu);
|
||||
fz_catch(ctx)
|
||||
fz_rethrow(ctx);
|
||||
|
||||
|
||||
11
src/sist.h
11
src/sist.h
@@ -25,19 +25,20 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/stat.h>
|
||||
#include <wordexp.h>
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
#include <onion/onion.h>
|
||||
#include <onion/handler.h>
|
||||
#include <onion/block.h>
|
||||
#include <onion/shortcuts.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "cJSON/cJSON.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "tpool.h"
|
||||
#include "util.h"
|
||||
#include "src/index/elastic.h"
|
||||
#include "io/store.h"
|
||||
#include "io/serialize.h"
|
||||
#include "io/walk.h"
|
||||
@@ -47,9 +48,13 @@
|
||||
#include "parsing/pdf.h"
|
||||
#include "parsing/media.h"
|
||||
#include "parsing/font.h"
|
||||
#include "cli.h"
|
||||
|
||||
#ifndef SIST_SCAN_ONLY
|
||||
#include "src/index/elastic.h"
|
||||
#include "index/web.h"
|
||||
#include "web/serve.h"
|
||||
#include "cli.h"
|
||||
#endif
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -167,7 +167,9 @@ void tpool_destroy(tpool_t *pool) {
|
||||
|
||||
for (size_t i = 0; i < pool->thread_cnt; i++) {
|
||||
pthread_t thread = pool->threads[i];
|
||||
pthread_cancel(thread);
|
||||
if (thread != 0) {
|
||||
pthread_cancel(thread);
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_destroy(&(pool->work_mutex));
|
||||
|
||||
149
src/util.c
149
src/util.c
@@ -1,15 +1,160 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "util.h"
|
||||
|
||||
dyn_buffer_t dyn_buffer_create() {
|
||||
dyn_buffer_t buf;
|
||||
|
||||
buf.size = INITIAL_BUF_SIZE;
|
||||
buf.cur = 0;
|
||||
buf.buf = malloc(INITIAL_BUF_SIZE);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void grow_buffer(dyn_buffer_t *buf, size_t size) {
|
||||
if (buf->cur + size > buf->size) {
|
||||
do {
|
||||
buf->size *= 2;
|
||||
} while (buf->cur + size > buf->size);
|
||||
|
||||
buf->buf = realloc(buf->buf, buf->size);
|
||||
}
|
||||
}
|
||||
|
||||
void grow_buffer_small(dyn_buffer_t *buf) {
|
||||
if (buf->cur + sizeof(long) > buf->size) {
|
||||
buf->size *= 2;
|
||||
buf->buf = realloc(buf->buf, buf->size);
|
||||
}
|
||||
}
|
||||
|
||||
void dyn_buffer_write(dyn_buffer_t *buf, void *data, size_t size) {
|
||||
grow_buffer(buf, size);
|
||||
|
||||
memcpy(buf->buf + buf->cur, data, size);
|
||||
buf->cur += size;
|
||||
}
|
||||
|
||||
void dyn_buffer_write_char(dyn_buffer_t *buf, char c) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(buf->buf + buf->cur) = c;
|
||||
buf->cur += sizeof(c);
|
||||
}
|
||||
|
||||
void dyn_buffer_write_str(dyn_buffer_t *buf, char *str) {
|
||||
dyn_buffer_write(buf, str, strlen(str));
|
||||
dyn_buffer_write_char(buf, '\0');
|
||||
}
|
||||
|
||||
void dyn_buffer_write_int(dyn_buffer_t *buf, int d) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(int *) (buf->buf + buf->cur) = d;
|
||||
buf->cur += sizeof(int);
|
||||
}
|
||||
|
||||
void dyn_buffer_write_short(dyn_buffer_t *buf, short s) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(short *) (buf->buf + buf->cur) = s;
|
||||
buf->cur += sizeof(short);
|
||||
}
|
||||
|
||||
void dyn_buffer_write_long(dyn_buffer_t *buf, unsigned long l) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(unsigned long *) (buf->buf + buf->cur) = l;
|
||||
buf->cur += sizeof(unsigned long);
|
||||
}
|
||||
|
||||
void dyn_buffer_destroy(dyn_buffer_t *buf) {
|
||||
free(buf->buf);
|
||||
}
|
||||
|
||||
void text_buffer_destroy(text_buffer_t *buf) {
|
||||
dyn_buffer_destroy(&buf->dyn_buffer);
|
||||
}
|
||||
|
||||
text_buffer_t text_buffer_create(int max_size) {
|
||||
text_buffer_t text_buf;
|
||||
|
||||
text_buf.dyn_buffer = dyn_buffer_create();
|
||||
text_buf.max_size = max_size;
|
||||
text_buf.last_char_was_whitespace = FALSE;
|
||||
|
||||
return text_buf;
|
||||
}
|
||||
|
||||
void text_buffer_terminate_string(text_buffer_t *buf) {
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, '\0');
|
||||
}
|
||||
|
||||
int text_buffer_append_char(text_buffer_t *buf, int c) {
|
||||
|
||||
if (SHOULD_IGNORE_CHAR(c)) {
|
||||
if (!buf->last_char_was_whitespace) {
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, ' ');
|
||||
buf->last_char_was_whitespace = TRUE;
|
||||
|
||||
if (buf->dyn_buffer.cur >= buf->max_size) {
|
||||
return TEXT_BUF_FULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buf->last_char_was_whitespace = FALSE;
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, (char) c);
|
||||
|
||||
if (buf->dyn_buffer.cur >= buf->max_size) {
|
||||
return TEXT_BUF_FULL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void incremental_put(GHashTable *table, unsigned long inode_no, int mtime) {
|
||||
g_hash_table_insert(table, (gpointer) inode_no, GINT_TO_POINTER(mtime));
|
||||
}
|
||||
|
||||
int incremental_get(GHashTable *table, unsigned long inode_no) {
|
||||
if (table != NULL) {
|
||||
return GPOINTER_TO_INT(g_hash_table_lookup(table, (gpointer) inode_no));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int incremental_mark_file_for_copy(GHashTable *table, unsigned long inode_no) {
|
||||
g_hash_table_insert(table, GINT_TO_POINTER(inode_no), GINT_TO_POINTER(1));
|
||||
}
|
||||
|
||||
|
||||
#define PBSTR "========================================"
|
||||
#define PBWIDTH 40
|
||||
|
||||
dyn_buffer_t url_escape(char *str) {
|
||||
|
||||
dyn_buffer_t text = dyn_buffer_create();
|
||||
|
||||
char * ptr = str;
|
||||
while (*ptr) {
|
||||
if (*ptr == '#') {
|
||||
dyn_buffer_write(&text, "%23", 3);
|
||||
ptr++;
|
||||
}
|
||||
|
||||
dyn_buffer_write_char(&text, *ptr++);
|
||||
}
|
||||
dyn_buffer_write_char(&text, '\0');
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
char *abspath(const char *path) {
|
||||
wordexp_t w;
|
||||
wordexp(path, &w, 0);
|
||||
|
||||
char *abs = canonicalize_file_name(w.we_wordv[0]);
|
||||
char *abs = realpath(w.we_wordv[0], NULL);
|
||||
if (abs == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
179
src/util.h
179
src/util.h
@@ -21,159 +21,48 @@ typedef struct text_buffer {
|
||||
dyn_buffer_t dyn_buffer;
|
||||
} text_buffer_t;
|
||||
|
||||
__always_inline
|
||||
dyn_buffer_t dyn_buffer_create() {
|
||||
dyn_buffer_t buf;
|
||||
|
||||
buf.size = INITIAL_BUF_SIZE;
|
||||
buf.cur = 0;
|
||||
buf.buf = malloc(INITIAL_BUF_SIZE);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void grow_buffer(dyn_buffer_t *buf, size_t size) {
|
||||
if (buf->cur + size > buf->size) {
|
||||
do {
|
||||
buf->size *= 2;
|
||||
} while (buf->cur + size > buf->size);
|
||||
|
||||
buf->buf = realloc(buf->buf, buf->size);
|
||||
}
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void grow_buffer_small(dyn_buffer_t *buf) {
|
||||
if (buf->cur + sizeof(long) > buf->size) {
|
||||
buf->size *= 2;
|
||||
buf->buf = realloc(buf->buf, buf->size);
|
||||
}
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_write(dyn_buffer_t *buf, void *data, size_t size) {
|
||||
grow_buffer(buf, size);
|
||||
|
||||
memcpy(buf->buf + buf->cur, data, size);
|
||||
buf->cur += size;
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_write_char(dyn_buffer_t *buf, char c) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(buf->buf + buf->cur) = c;
|
||||
buf->cur += sizeof(c);
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_write_str(dyn_buffer_t *buf, char *str) {
|
||||
dyn_buffer_write(buf, str, strlen(str));
|
||||
dyn_buffer_write_char(buf, '\0');
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_write_int(dyn_buffer_t *buf, int d) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(int *) (buf->buf + buf->cur) = d;
|
||||
buf->cur += sizeof(int);
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_write_short(dyn_buffer_t *buf, short s) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(short *) (buf->buf + buf->cur) = s;
|
||||
buf->cur += sizeof(short);
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_write_long(dyn_buffer_t *buf, unsigned long l) {
|
||||
grow_buffer_small(buf);
|
||||
|
||||
*(unsigned long *) (buf->buf + buf->cur) = l;
|
||||
buf->cur += sizeof(unsigned long);
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void dyn_buffer_destroy(dyn_buffer_t *buf) {
|
||||
free(buf->buf);
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void text_buffer_destroy(text_buffer_t *buf) {
|
||||
dyn_buffer_destroy(&buf->dyn_buffer);
|
||||
}
|
||||
|
||||
__always_inline
|
||||
text_buffer_t text_buffer_create(int max_size) {
|
||||
text_buffer_t text_buf;
|
||||
|
||||
text_buf.dyn_buffer = dyn_buffer_create();
|
||||
text_buf.max_size = max_size;
|
||||
text_buf.last_char_was_whitespace = FALSE;
|
||||
|
||||
return text_buf;
|
||||
}
|
||||
|
||||
__always_inline
|
||||
void text_buffer_terminate_string(text_buffer_t *buf) {
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, '\0');
|
||||
}
|
||||
|
||||
__always_inline
|
||||
int text_buffer_append_char(text_buffer_t *buf, int c) {
|
||||
|
||||
if (SHOULD_IGNORE_CHAR(c)) {
|
||||
if (!buf->last_char_was_whitespace) {
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, ' ');
|
||||
buf->last_char_was_whitespace = TRUE;
|
||||
|
||||
if (buf->dyn_buffer.cur >= buf->max_size) {
|
||||
return TEXT_BUF_FULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buf->last_char_was_whitespace = FALSE;
|
||||
dyn_buffer_write_char(&buf->dyn_buffer, (char) c);
|
||||
|
||||
if (buf->dyn_buffer.cur >= buf->max_size) {
|
||||
return TEXT_BUF_FULL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *abspath(const char * path);
|
||||
char *expandpath(const char *path);
|
||||
dyn_buffer_t url_escape(char *str);
|
||||
|
||||
void progress_bar_print(double percentage, size_t tn_size, size_t index_size);
|
||||
|
||||
|
||||
__always_inline
|
||||
void incremental_put(GHashTable *table, unsigned long inode_no, int mtime) {
|
||||
g_hash_table_insert(table, (gpointer) inode_no, GINT_TO_POINTER(mtime));
|
||||
}
|
||||
|
||||
__always_inline
|
||||
int incremental_get(GHashTable *table, unsigned long inode_no) {
|
||||
if (table != NULL) {
|
||||
return GPOINTER_TO_INT(g_hash_table_lookup(table, (gpointer) inode_no));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
__always_inline
|
||||
int incremental_mark_file_for_copy(GHashTable *table, unsigned long inode_no) {
|
||||
g_hash_table_insert(table, GINT_TO_POINTER(inode_no), GINT_TO_POINTER(1));
|
||||
}
|
||||
|
||||
GHashTable *incremental_get_table();
|
||||
|
||||
dyn_buffer_t dyn_buffer_create();
|
||||
|
||||
void grow_buffer(dyn_buffer_t *buf, size_t size);
|
||||
|
||||
void grow_buffer_small(dyn_buffer_t *buf);
|
||||
|
||||
void dyn_buffer_write(dyn_buffer_t *buf, void *data, size_t size);
|
||||
|
||||
void dyn_buffer_write_char(dyn_buffer_t *buf, char c);
|
||||
|
||||
void dyn_buffer_write_str(dyn_buffer_t *buf, char *str);
|
||||
|
||||
void dyn_buffer_write_int(dyn_buffer_t *buf, int d);
|
||||
|
||||
void dyn_buffer_write_short(dyn_buffer_t *buf, short s);
|
||||
|
||||
void dyn_buffer_write_long(dyn_buffer_t *buf, unsigned long l);
|
||||
|
||||
void dyn_buffer_destroy(dyn_buffer_t *buf);
|
||||
|
||||
void text_buffer_destroy(text_buffer_t *buf);
|
||||
|
||||
text_buffer_t text_buffer_create(int max_size);
|
||||
|
||||
void text_buffer_terminate_string(text_buffer_t *buf);
|
||||
|
||||
int text_buffer_append_char(text_buffer_t *buf, int c);
|
||||
|
||||
void incremental_put(GHashTable *table, unsigned long inode_no, int mtime);
|
||||
|
||||
int incremental_get(GHashTable *table, unsigned long inode_no);
|
||||
int incremental_mark_file_for_copy(GHashTable *table, unsigned long inode_no);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -287,7 +287,10 @@ int serve_file_from_url(cJSON *json, index_t *idx, onion_request *req, onion_res
|
||||
"%s%s/%s%s%s",
|
||||
idx->desc.rewrite_url, path, name, strlen(ext) == 0 ? "" : ".", ext);
|
||||
|
||||
return onion_shortcut_redirect(url, req, res);
|
||||
dyn_buffer_t encoded = url_escape(url);
|
||||
int ret = onion_shortcut_redirect(encoded.buf, req, res);
|
||||
dyn_buffer_destroy(&encoded);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int serve_file_from_disk(cJSON *json, index_t *idx, onion_request *req, onion_response *res) {
|
||||
@@ -301,6 +304,11 @@ int serve_file_from_disk(cJSON *json, index_t *idx, onion_request *req, onion_re
|
||||
snprintf(full_path, PATH_MAX, "%s%s/%s%s%s",
|
||||
idx->desc.root, path, name, strlen(ext) == 0 ? "" : ".", ext);
|
||||
|
||||
char disposition[8196];
|
||||
snprintf(disposition, sizeof(disposition), "inline; filename=\"%s%s%s\"",
|
||||
name, strlen(ext) == 0 ? "" : ".", ext);
|
||||
onion_response_set_header(res, "Content-Disposition", disposition);
|
||||
|
||||
return chunked_response_file(full_path, mime, 1, req, res);
|
||||
}
|
||||
|
||||
@@ -337,23 +345,19 @@ int file(void *p, onion_request *req, onion_response *res) {
|
||||
return OCS_PROCESSED;
|
||||
}
|
||||
|
||||
cJSON *source = elastic_get_document(arg_uuid);
|
||||
cJSON *doc = elastic_get_document(arg_uuid);
|
||||
cJSON *source = cJSON_GetObjectItem(doc, "_source");
|
||||
cJSON *index_id = cJSON_GetObjectItem(source, "index");
|
||||
if (index_id == NULL) {
|
||||
return OCS_NOT_PROCESSED;
|
||||
}
|
||||
|
||||
const char *index_id = cJSON_GetObjectItem(source, "index")->valuestring;
|
||||
|
||||
index_t *idx = get_index_by_id(index_id);
|
||||
index_t *idx = get_index_by_id(index_id->valuestring);
|
||||
|
||||
if (idx == NULL) {
|
||||
return OCS_NOT_PROCESSED;
|
||||
}
|
||||
|
||||
const char *name = cJSON_GetObjectItem(source, "name")->valuestring;
|
||||
const char *ext = cJSON_GetObjectItem(source, "extension")->valuestring;
|
||||
char disposition[8196];
|
||||
snprintf(disposition, sizeof(disposition), "inline; filename=\"%s%s%s\"",
|
||||
name, strlen(ext) == 0 ? "" : ".", ext);
|
||||
onion_response_set_header(res, "Content-Disposition", disposition);
|
||||
|
||||
if (strlen(idx->desc.rewrite_url) == 0) {
|
||||
return serve_file_from_disk(source, idx, req, res);
|
||||
} else {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,9 @@
|
||||
body {overflow-y:scroll;}
|
||||
|
||||
.progress {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.card {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ function createDocCard(hit) {
|
||||
});
|
||||
} else if ((hit["_source"].hasOwnProperty("width") && hit["_source"]["width"] > 20 && hit["_source"]["height"] > 20)
|
||||
|| hit["_source"]["mime"] === "application/pdf"
|
||||
|| hit["_source"]["mime"] === "application/x-cbz"
|
||||
|| hit["_source"].hasOwnProperty("font_name")
|
||||
) {
|
||||
thumbnail = document.createElement("img");
|
||||
@@ -170,11 +171,10 @@ function createDocCard(hit) {
|
||||
}
|
||||
|
||||
//Tags
|
||||
//todo: handle new tags
|
||||
switch (mimeCategory) {
|
||||
case "video":
|
||||
case "image":
|
||||
if (hit.hasOwnProperty("videoc")) {
|
||||
if (hit["_source"].hasOwnProperty("videoc")) {
|
||||
let formatTag = document.createElement("span");
|
||||
formatTag.setAttribute("class", "badge badge-pill badge-video");
|
||||
formatTag.appendChild(document.createTextNode(hit["_source"]["videoc"].replace(" ", "")));
|
||||
@@ -182,7 +182,7 @@ function createDocCard(hit) {
|
||||
}
|
||||
break;
|
||||
case "audio": {
|
||||
if (hit.hasOwnProperty("audioc")) {
|
||||
if (hit["_source"].hasOwnProperty("audioc")) {
|
||||
let formatTag = document.createElement("span");
|
||||
formatTag.setAttribute("class", "badge badge-pill badge-audio");
|
||||
formatTag.appendChild(document.createTextNode(hit["_source"]["audioc"]));
|
||||
@@ -243,6 +243,17 @@ function createDocCard(hit) {
|
||||
return docCard;
|
||||
}
|
||||
|
||||
function makePreloader() {
|
||||
const elem = document.createElement("div");
|
||||
elem.setAttribute("class", "progress");
|
||||
const bar = document.createElement("div");
|
||||
bar.setAttribute("class", "progress-bar progress-bar-striped progress-bar-animated");
|
||||
bar.setAttribute("style", "width: 100%");
|
||||
elem.appendChild(bar);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function makePageIndicator(searchResult) {
|
||||
let pageIndicator = document.createElement("div");
|
||||
pageIndicator.setAttribute("class", "page-indicator shadow-sm bg-light font-weight-light");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const SIZE = 20;
|
||||
const SIZE = 40;
|
||||
let mimeMap = [];
|
||||
let tree;
|
||||
|
||||
@@ -29,7 +29,7 @@ $.jsonPost("i").then(resp => {
|
||||
resp["indices"].forEach(idx => {
|
||||
$("#indices").append($("<option>")
|
||||
.attr("value", idx.id)
|
||||
.attr("selected", true)
|
||||
.attr("selected", !idx.name.includes("(nsfw)"))
|
||||
.append(idx.name)
|
||||
);
|
||||
selectedIndices.push(idx.id);
|
||||
@@ -193,14 +193,19 @@ function search() {
|
||||
return;
|
||||
}
|
||||
searchBusy = true;
|
||||
|
||||
//Clear old search results
|
||||
let searchResults = document.getElementById("searchResults");
|
||||
while (searchResults.firstChild) {
|
||||
searchResults.removeChild(searchResults.firstChild);
|
||||
}
|
||||
|
||||
const preload = makePreloader();
|
||||
searchResults.appendChild(preload);
|
||||
|
||||
let query = searchBar.value;
|
||||
let condition = $("#barToggle").prop("checked") ? "must" : "should";
|
||||
let empty = query === "";
|
||||
let condition = $("#barToggle").prop("checked") && !empty ? "must" : "should";
|
||||
let filters = [
|
||||
{range: {size: {gte: size_min, lte: size_max}}},
|
||||
{terms: {index: selectedIndices}}
|
||||
@@ -257,6 +262,7 @@ function search() {
|
||||
}).then(searchResult => {
|
||||
scroll_id = searchResult["_scroll_id"];
|
||||
|
||||
preload.remove();
|
||||
//Search stats
|
||||
searchResults.appendChild(makeStatsCard(searchResult));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user