mirror of
https://github.com/simon987/sist2.git
synced 2025-12-14 15:59:03 +00:00
Compare commits
18 Commits
7c46ad632a
...
2.10.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 142a4869e6 | |||
| ddb7f8d5d7 | |||
| dfb8c67490 | |||
| 3da2c8cae3 | |||
| 2f0e999b06 | |||
| bf28dc8993 | |||
| c6fee7f6e2 | |||
| 201c2a1a47 | |||
| f3e07fb7f7 | |||
| 7990e5cd2e | |||
| e3ca660983 | |||
| b87fb25458 | |||
| c7a77869ad | |||
|
|
5073b00225 | ||
|
|
4923d1b51f | ||
|
|
097e332015 | ||
|
|
d4babe216b | ||
|
|
44511a2202 |
@@ -20,4 +20,6 @@ third-party/libscan/libscan-test-files/
|
|||||||
**/ext_ffmpeg
|
**/ext_ffmpeg
|
||||||
**/ext_libmobi
|
**/ext_libmobi
|
||||||
**/scan_a_test
|
**/scan_a_test
|
||||||
Dockerfile
|
Dockerfile
|
||||||
|
*.idx/
|
||||||
|
VERSION
|
||||||
|
|||||||
10
.drone.yml
10
.drone.yml
@@ -8,7 +8,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: simon987/ubuntu_ci
|
image: simon987/sist2-build
|
||||||
commands:
|
commands:
|
||||||
- ./ci/build.sh
|
- ./ci/build.sh
|
||||||
- name: docker
|
- name: docker
|
||||||
@@ -19,8 +19,8 @@ steps:
|
|||||||
password:
|
password:
|
||||||
from_secret: DOCKER_PASSWORD
|
from_secret: DOCKER_PASSWORD
|
||||||
repo: simon987/sist2
|
repo: simon987/sist2
|
||||||
context: ./Docker/
|
context: ./
|
||||||
dockerfile: ./Docker/Dockerfile
|
dockerfile: ./Dockerfile
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
auto_tag_suffix: x64-linux
|
auto_tag_suffix: x64-linux
|
||||||
when:
|
when:
|
||||||
@@ -41,7 +41,7 @@ steps:
|
|||||||
source:
|
source:
|
||||||
- ./VERSION
|
- ./VERSION
|
||||||
- ./sist2-x64-linux
|
- ./sist2-x64-linux
|
||||||
- ./sist2-x64-linux-debug.tar.gz
|
- ./sist2-x64-linux-debug
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@@ -53,7 +53,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: simon987/ubuntu_ci_arm
|
image: simon987/sist2-build-arm64
|
||||||
commands:
|
commands:
|
||||||
- ./ci/build_arm64.sh
|
- ./ci/build_arm64.sh
|
||||||
- name: scp files
|
- name: scp files
|
||||||
|
|||||||
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
name: "🐞 Bug Report"
|
||||||
|
about: Submit a bug report
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Device Information (please complete the following information):**
|
||||||
|
- OS: `[e.g., Ubuntu 20.04, WSL2]`
|
||||||
|
- Deployment: `[Linux, Linux ARM64 or Docker]`
|
||||||
|
- Browser *(if relevant)*: `[e.g., chrome, safari]`
|
||||||
|
- SIST2 Version: `[e.g., v2.9.0]`
|
||||||
|
- Elasticsearch Version *(if relevant)* : ``
|
||||||
|
|
||||||
|
**Command with arguments**
|
||||||
|
<!-- `ex: "scan ~/Documents -o ./i2 --threads 3 -q 1.0` -->
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
|
**Steps To Reproduce**
|
||||||
|
Please be specific!
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. etc.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
<!-- A clear and concise description of what you expected to happen. -->
|
||||||
|
|
||||||
|
**Actual Behavior**
|
||||||
|
<!-- A clear and concise description of what actually happens. -->
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
<!-- Add any other context about the problem here. If applicable, please include why you think the bug is occurring and/or troubleshooting you have already performed. -->
|
||||||
|
<!-- If the issue is related to the `scan` module, please attach the files necessary to reproduce the error or email them to me[at]simon987.net. -->
|
||||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: SIST2 Documentation
|
||||||
|
url: https://github.com/simon987/sist2/blob/master/docs/USAGE.md
|
||||||
|
about: Check out the SIST2 documentation for answers to common questions
|
||||||
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
name: "🚀 Feature Request"
|
||||||
|
about: Suggest an idea for SIST2
|
||||||
|
title: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
**Which SIST2 component is your Feature Request related to?**
|
||||||
|
<!-- e.g., Scan, Index, or Web? -->
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
<!-- A clear and concise description of what the problem is. e.g., "I'm always frustrated when [...]" -->
|
||||||
|
|
||||||
|
**What would you like to see happen?**
|
||||||
|
<!-- A clear and concise description of what you want to happen. -->
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
<!-- Add any other context or screenshots about the feature request here. -->
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -16,3 +16,5 @@ bundle.js
|
|||||||
vgcore.*
|
vgcore.*
|
||||||
build/
|
build/
|
||||||
third-party/
|
third-party/
|
||||||
|
*.idx/
|
||||||
|
VERSION
|
||||||
@@ -9,9 +9,7 @@ RUN strip sist2
|
|||||||
|
|
||||||
FROM ubuntu:20.10
|
FROM ubuntu:20.10
|
||||||
|
|
||||||
RUN apt update
|
RUN apt update && apt install -y curl
|
||||||
RUN apt install -y libglib2.0-0 libcurl4 libmagic1 libharfbuzz-bin libopenjp2-7 libarchive13 liblzma5 libzstd1 liblz4-1 \
|
|
||||||
curl libtiff5 libpng16-16 libpcre3
|
|
||||||
|
|
||||||
RUN mkdir -p /usr/share/tessdata && \
|
RUN mkdir -p /usr/share/tessdata && \
|
||||||
cd /usr/share/tessdata/ && \
|
cd /usr/share/tessdata/ && \
|
||||||
|
|||||||
@@ -1 +1,28 @@
|
|||||||
# TODO
|
FROM simon987/sist2-build-arm64 as build
|
||||||
|
MAINTAINER simon987 <me@simon987.net>
|
||||||
|
|
||||||
|
WORKDIR /build/
|
||||||
|
ADD . /build/
|
||||||
|
RUN cmake -DSIST_DEBUG=off -DBUILD_TESTS=off -DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake .
|
||||||
|
RUN make -j$(nproc)
|
||||||
|
RUN strip sist2
|
||||||
|
|
||||||
|
FROM ubuntu:20.10
|
||||||
|
|
||||||
|
RUN apt update && apt install -y curl
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/share/tessdata && \
|
||||||
|
cd /usr/share/tessdata/ && \
|
||||||
|
curl -o /usr/share/tessdata/hin.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/hin.traineddata &&\
|
||||||
|
curl -o /usr/share/tessdata/jpn.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/jpn.traineddata &&\
|
||||||
|
curl -o /usr/share/tessdata/eng.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/eng.traineddata &&\
|
||||||
|
curl -o /usr/share/tessdata/fra.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/fra.traineddata &&\
|
||||||
|
curl -o /usr/share/tessdata/rus.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/rus.traineddata &&\
|
||||||
|
curl -o /usr/share/tessdata/spa.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/spa.traineddata
|
||||||
|
|
||||||
|
COPY --from=build /build/sist2 /root/sist2
|
||||||
|
|
||||||
|
ENV LANG C.UTF-8
|
||||||
|
ENV LC_ALL C.UTF-8
|
||||||
|
|
||||||
|
ENTRYPOINT ["/root/sist2"]
|
||||||
34
README.md
34
README.md
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
[](https://www.codefactor.io/repository/github/simon987/sist2)
|
[](https://www.codefactor.io/repository/github/simon987/sist2)
|
||||||
[](https://files.simon987.net/sist2/simon987_sist2/)
|
[](https://files.simon987.net/.gate/sist2/simon987_sist2/)
|
||||||
|
|
||||||
**Demo**: [sist2.simon987.net](https://sist2.simon987.net/?i=Demo%20files)
|
**Demo**: [sist2.simon987.net](https://sist2.simon987.net/?i=Demo%20files)
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ sist2 (Simple incremental search tool)
|
|||||||
```
|
```
|
||||||
1. Download sist2 executable
|
1. Download sist2 executable
|
||||||
1. Download the [latest sist2 release](https://github.com/simon987/sist2/releases) *
|
1. Download the [latest sist2 release](https://github.com/simon987/sist2/releases) *
|
||||||
1. *(or)* Download a [development snapshot](https://files.simon987.net/sist2/simon987_sist2/) *(Not recommended!)*
|
1. *(or)* Download a [development snapshot](https://files.simon987.net/.gate/sist2/simon987_sist2/) *(Not recommended!)*
|
||||||
1. *(or)* `docker pull simon987/sist2:latest`
|
1. *(or)* `docker pull simon987/sist2:2.10.1-x64-linux`
|
||||||
|
|
||||||
1. See [Usage guide](docs/USAGE.md)
|
1. See [Usage guide](docs/USAGE.md)
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ See [Usage guide](docs/USAGE.md) for more details
|
|||||||
|
|
||||||
## Format support
|
## Format support
|
||||||
|
|
||||||
File type | Library | Content | Thumbnail | Metadata
|
File type | Library | Content | Thumbnail | Metadata
|
||||||
:---|:---|:---|:---|:---
|
:---|:---|:---|:---|:---
|
||||||
pdf,xps,fb2,epub | MuPDF | text+ocr | yes | author, title |
|
pdf,xps,fb2,epub | MuPDF | text+ocr | yes | author, title |
|
||||||
cbz,cbr | *(none)* | - | yes | - |
|
cbz,cbr | *(none)* | - | yes | - |
|
||||||
@@ -116,15 +116,35 @@ sist2 scan --ocr eng ~/Books/Textbooks/
|
|||||||
|
|
||||||
## Build from source
|
## Build from source
|
||||||
|
|
||||||
You can compile **sist2** by yourself if you don't want to use the pre-compiled binaries (GCC 7+ required).
|
You can compile **sist2** by yourself if you don't want to use the pre-compiled binaries
|
||||||
|
|
||||||
|
### With docker (recommended)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone --recursive https://github.com/simon987/sist2/
|
||||||
|
cd sist2
|
||||||
|
docker build . -f ./Dockerfile -t my-sist2-image
|
||||||
|
docker run --rm my-sist2-image cat /root/sist2 > sist2-x64-linux
|
||||||
|
```
|
||||||
|
|
||||||
|
### On a linux computer
|
||||||
|
|
||||||
1. Install compile-time dependencies
|
1. Install compile-time dependencies
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
vcpkg install lmdb cjson glib libarchive[core,bzip2,libxml2,lz4,lzma,lzo] pthread tesseract libxml2 ffmpeg zstd gtest mongoose libmagic libraw curl[core,ssl] jbig2dec brotli libmupdf
|
apt install gcc g++ python3 yasm ragel automake autotools-dev wget libtool libssl-dev curl zip unzip tar xorg-dev libglu1-mesa-dev libxcursor-dev libxml2-dev libxinerama-dev gettext nasm git
|
||||||
```
|
```
|
||||||
|
|
||||||
|
1. Apply vcpkg patches, as per [sist2-build](https://github.com/simon987/sist2-build) Dockerfile
|
||||||
|
|
||||||
2. Build
|
1. Install vcpkg dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vcpkg install curl[core,openssl]
|
||||||
|
vcpkg install lmdb cjson glib brotli libarchive[core,bzip2,libxml2,lz4,lzma,lzo] pthread tesseract libxml2 libmupdf gtest mongoose libuuid libmagic libraw jasper lcms gumbo
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Build
|
||||||
```bash
|
```bash
|
||||||
git clone --recursive https://github.com/simon987/sist2/
|
git clone --recursive https://github.com/simon987/sist2/
|
||||||
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE=<VCPKG_ROOT>/scripts/buildsystems/vcpkg.cmake .
|
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE=<VCPKG_ROOT>/scripts/buildsystems/vcpkg.cmake .
|
||||||
|
|||||||
11
ci/build.sh
11
ci/build.sh
@@ -2,21 +2,18 @@
|
|||||||
|
|
||||||
VCPKG_ROOT="/vcpkg"
|
VCPKG_ROOT="/vcpkg"
|
||||||
|
|
||||||
rm *.gz
|
rm *.gz &>/dev/null
|
||||||
|
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
rm -rf CMakeFiles CMakeCache.txt
|
||||||
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
||||||
make -j 33
|
make -j $(nproc)
|
||||||
strip sist2
|
strip sist2
|
||||||
./sist2 -v > VERSION
|
./sist2 -v > VERSION
|
||||||
cp sist2 Docker/
|
|
||||||
mv sist2 sist2-x64-linux
|
mv sist2 sist2-x64-linux
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
rm -rf CMakeFiles CMakeCache.txt
|
||||||
cmake -DSIST_DEBUG=on -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
cmake -DSIST_DEBUG=on -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
||||||
make -j 33
|
make -j $(nproc)
|
||||||
cp /usr/lib/x86_64-linux-gnu/libasan.so.2.0.0 libasan.so.2
|
mv sist2_debug sist2-x64-linux-debug
|
||||||
mv sist2_debug sist2-x64-linux-debug
|
|
||||||
tar -czf sist2-x64-linux-debug.tar.gz sist2-x64-linux-debug libasan.so.2
|
|
||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
VCPKG_ROOT="/vcpkg"
|
VCPKG_ROOT="/vcpkg"
|
||||||
|
|
||||||
rm *.gz
|
rm *.gz &>/dev/null
|
||||||
|
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
rm -rf CMakeFiles CMakeCache.txt
|
rm -rf CMakeFiles CMakeCache.txt
|
||||||
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
cmake -DSIST_DEBUG=off -DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" .
|
||||||
make -j 4
|
make -j $(nproc)
|
||||||
strip sist2
|
strip sist2
|
||||||
mv sist2 sist2-arm64-linux
|
mv sist2 sist2-arm64-linux
|
||||||
@@ -357,8 +357,7 @@ You can safely copy the `/tags/` database to another index.
|
|||||||
See [Automatic tagging](#automatic-tagging) for information about tag
|
See [Automatic tagging](#automatic-tagging) for information about tag
|
||||||
hierarchies and tag colors.
|
hierarchies and tag colors.
|
||||||
|
|
||||||
\* *It can take a few seconds to take effect in new search queries, and the page needs
|
\* *It can take a few seconds to take effect in new search queries.*
|
||||||
to be reloaded for the tags tab to update*
|
|
||||||
|
|
||||||
|
|
||||||
### Automatic tagging
|
### Automatic tagging
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ typedef struct {
|
|||||||
int fast;
|
int fast;
|
||||||
|
|
||||||
GHashTable *dbg_current_files;
|
GHashTable *dbg_current_files;
|
||||||
|
pthread_mutex_t dbg_current_files_mu;
|
||||||
|
|
||||||
scan_arc_ctx_t arc_ctx;
|
scan_arc_ctx_t arc_ctx;
|
||||||
scan_comic_ctx_t comic_ctx;
|
scan_comic_ctx_t comic_ctx;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
#define EPILOG "Made by simon987 <me@simon987.net>. Released under GPL-3.0"
|
||||||
|
|
||||||
|
|
||||||
static const char *const Version = "2.10.1";
|
static const char *const Version = "2.10.2";
|
||||||
static const char *const usage[] = {
|
static const char *const usage[] = {
|
||||||
"sist2 scan [OPTION]... PATH",
|
"sist2 scan [OPTION]... PATH",
|
||||||
"sist2 index [OPTION]... INDEX",
|
"sist2 index [OPTION]... INDEX",
|
||||||
@@ -168,7 +168,8 @@ void initialize_scan_context(scan_args_t *args) {
|
|||||||
ScanCtx.arc_ctx.passphrase[0] = 0;
|
ScanCtx.arc_ctx.passphrase[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanCtx.dbg_current_files = g_hash_table_new(g_int64_hash, g_int64_equal);
|
ScanCtx.dbg_current_files = g_hash_table_new_full(g_int64_hash, g_int64_equal, NULL, NULL);
|
||||||
|
pthread_mutex_init(&ScanCtx.dbg_current_files_mu, NULL);
|
||||||
|
|
||||||
// Comic
|
// Comic
|
||||||
ScanCtx.comic_ctx.log = _log;
|
ScanCtx.comic_ctx.log = _log;
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ void fs_reset(struct vfile *f) {
|
|||||||
|
|
||||||
void set_dbg_current_file(parse_job_t *job) {
|
void set_dbg_current_file(parse_job_t *job) {
|
||||||
unsigned long long pid = (unsigned long long) pthread_self();
|
unsigned long long pid = (unsigned long long) pthread_self();
|
||||||
|
pthread_mutex_lock(&ScanCtx.dbg_current_files_mu);
|
||||||
g_hash_table_replace(ScanCtx.dbg_current_files, GINT_TO_POINTER(pid), job);
|
g_hash_table_replace(ScanCtx.dbg_current_files, GINT_TO_POINTER(pid), job);
|
||||||
|
pthread_mutex_unlock(&ScanCtx.dbg_current_files_mu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse(void *arg) {
|
void parse(void *arg) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<a class="navbar-brand" href="/">sist2</a>
|
<a class="navbar-brand" href="/">sist2</a>
|
||||||
<span class="badge badge-pill version">2.10.1</span>
|
<span class="badge badge-pill version">2.10.2</span>
|
||||||
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
||||||
<a class="btn ml-auto" href="stats">Stats</a>
|
<a class="btn ml-auto" href="stats">Stats</a>
|
||||||
<button class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings
|
<button class="btn" type="button" data-toggle="modal" data-target="#settings" onclick="loadSettings()">Settings
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<a class="navbar-brand" href="/">sist2</a>
|
<a class="navbar-brand" href="/">sist2</a>
|
||||||
<span class="badge badge-pill version">2.10.1</span>
|
<span class="badge badge-pill version">2.10.2</span>
|
||||||
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
<span class="tagline">Lightning-fast file system indexer and search tool </span>
|
||||||
<a style="margin-left: auto" class="btn" href="/">Back</a>
|
<a style="margin-left: auto" class="btn" href="/">Back</a>
|
||||||
<button class="btn" type="button" data-toggle="modal" data-target="#settings"
|
<button class="btn" type="button" data-toggle="modal" data-target="#settings"
|
||||||
|
|||||||
@@ -220,7 +220,10 @@ void serve_file_from_url(cJSON *json, index_t *idx, struct mg_connection *nc) {
|
|||||||
dyn_buffer_t encoded = url_escape(url);
|
dyn_buffer_t encoded = url_escape(url);
|
||||||
dyn_buffer_write_char(&encoded, '\0');
|
dyn_buffer_write_char(&encoded, '\0');
|
||||||
|
|
||||||
mg_http_reply(nc, 308, "Location: %s", encoded.buf);
|
char location_header[8192];
|
||||||
|
snprintf(location_header, sizeof(location_header), "Location: %s\r\n", encoded.buf);
|
||||||
|
|
||||||
|
mg_http_reply(nc, 308, location_header, "");
|
||||||
dyn_buffer_destroy(&encoded);
|
dyn_buffer_destroy(&encoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +534,7 @@ int validate_auth(struct mg_connection *nc, struct mg_http_message *hm) {
|
|||||||
|
|
||||||
mg_http_creds(hm, user, sizeof(user), pass, sizeof(pass));
|
mg_http_creds(hm, user, sizeof(user), pass, sizeof(pass));
|
||||||
if (strcmp(user, WebCtx.auth_user) != 0 || strcmp(pass, WebCtx.auth_pass) != 0) {
|
if (strcmp(user, WebCtx.auth_user) != 0 || strcmp(pass, WebCtx.auth_pass) != 0) {
|
||||||
mg_http_reply(nc, 401, "WWW-Authenticate: Basic realm=\"sist2\"", "");
|
mg_http_reply(nc, 401, "WWW-Authenticate: Basic realm=\"sist2\"\r\n", "");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -544,7 +547,6 @@ static void ev_router(struct mg_connection *nc, int ev, void *ev_data, UNUSED(vo
|
|||||||
|
|
||||||
if (WebCtx.auth_enabled == TRUE) {
|
if (WebCtx.auth_enabled == TRUE) {
|
||||||
if (!validate_auth(nc, hm)) {
|
if (!validate_auth(nc, hm)) {
|
||||||
nc->is_closing = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -575,7 +577,6 @@ static void ev_router(struct mg_connection *nc, int ev, void *ev_data, UNUSED(vo
|
|||||||
stats_files(nc, hm);
|
stats_files(nc, hm);
|
||||||
} else if (mg_http_match_uri(hm, "/tag/*")) {
|
} else if (mg_http_match_uri(hm, "/tag/*")) {
|
||||||
if (WebCtx.tag_auth_enabled == TRUE && !validate_auth(nc, hm)) {
|
if (WebCtx.tag_auth_enabled == TRUE && !validate_auth(nc, hm)) {
|
||||||
nc->is_closing = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tag(nc, hm);
|
tag(nc, hm);
|
||||||
|
|||||||
2
third-party/argparse
vendored
2
third-party/argparse
vendored
Submodule third-party/argparse updated: 5957da0b44...ffd9c23427
2
third-party/libscan
vendored
2
third-party/libscan
vendored
Submodule third-party/libscan updated: 9be4f02851...a12ec1cb06
Reference in New Issue
Block a user