mirror of
https://github.com/simon987/sist2.git
synced 2025-12-20 02:26:08 +00:00
Compare commits
1 Commits
d7038be35b
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbdc880392 |
@@ -147,7 +147,6 @@ add_dependencies(
|
|||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
sist2
|
sist2
|
||||||
|
|
||||||
m
|
|
||||||
z
|
z
|
||||||
argparse
|
argparse
|
||||||
unofficial::mongoose::mongoose
|
unofficial::mongoose::mongoose
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
FROM sist2app/sist2-build as build
|
FROM simon987/sist2-build as build
|
||||||
|
MAINTAINER simon987 <me@simon987.net>
|
||||||
|
|
||||||
WORKDIR /build/
|
WORKDIR /build/
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
FROM sist2app/sist2-build-arm64 as build
|
FROM simon987/sist2-build-arm64 as build
|
||||||
|
MAINTAINER simon987 <me@simon987.net>
|
||||||
|
|
||||||
WORKDIR /build/
|
WORKDIR /build/
|
||||||
|
|
||||||
|
|||||||
14
sist2-vue/package-lock.json
generated
14
sist2-vue/package-lock.json
generated
@@ -4110,12 +4110,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/braces": {
|
"node_modules/braces": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fill-range": "^7.0.1"
|
"fill-range": "^7.1.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -6334,9 +6334,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fill-range": {
|
"node_modules/fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
|
|||||||
@@ -478,7 +478,8 @@ index_descriptor_t *database_read_index_descriptor(database_t *db) {
|
|||||||
database_iterator_t *database_create_delete_list_iterator(database_t *db) {
|
database_iterator_t *database_create_delete_list_iterator(database_t *db) {
|
||||||
|
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
sqlite3_prepare_v2(db->db, "SELECT id FROM delete_list", -1, &stmt, NULL);
|
sqlite3_prepare_v2(db->db, "SELECT doc.id FROM delete_list "
|
||||||
|
"INNER JOIN document doc ON doc.ROWID = delete_list.id;", -1, &stmt, NULL);
|
||||||
|
|
||||||
database_iterator_t *iter = malloc(sizeof(database_iterator_t));
|
database_iterator_t *iter = malloc(sizeof(database_iterator_t));
|
||||||
|
|
||||||
|
|||||||
@@ -161,8 +161,7 @@ void parse(parse_job_t *job) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int document_exists = database_mark_document(ProcData.index_db, doc->filepath + ScanCtx.index.desc.root_len, doc->mtime);
|
if (database_mark_document(ProcData.index_db, doc->filepath + ScanCtx.index.desc.root_len, doc->mtime)) {
|
||||||
if (document_exists) {
|
|
||||||
CLOSE_FILE(job->vfile)
|
CLOSE_FILE(job->vfile)
|
||||||
free(doc);
|
free(doc);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ static const int VersionPatch = 2;
|
|||||||
#define SIST_PLATFORM unknown
|
#define SIST_PLATFORM unknown
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EXPECTED_MONGOOSE_VERSION "7.16"
|
#define EXPECTED_MONGOOSE_VERSION "7.13"
|
||||||
|
|
||||||
#define Q(x) #x
|
#define Q(x) #x
|
||||||
#define QUOTE(x) Q(x)
|
#define QUOTE(x) Q(x)
|
||||||
|
|||||||
@@ -50,13 +50,13 @@ void get_embedding(struct mg_connection *nc, struct mg_http_message *hm) {
|
|||||||
|
|
||||||
sist_id_t sid;
|
sist_id_t sid;
|
||||||
|
|
||||||
if (hm->uri.len != SIST_SID_LEN + 2 + 4 || !parse_sid(&sid, hm->uri.buf + 3)) {
|
if (hm->uri.len != SIST_SID_LEN + 2 + 4 || !parse_sid(&sid, hm->uri.ptr + 3)) {
|
||||||
LOG_DEBUGF("serve.c", "Invalid embedding path: %.*s", (int) hm->uri.len, hm->uri.buf);
|
LOG_DEBUGF("serve.c", "Invalid embedding path: %.*s", (int) hm->uri.len, hm->uri.ptr);
|
||||||
HTTP_REPLY_NOT_FOUND
|
HTTP_REPLY_NOT_FOUND
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int model_id = (int) strtol(hm->uri.buf + SIST_SID_LEN + 3, NULL, 10);
|
int model_id = (int) strtol(hm->uri.ptr + SIST_SID_LEN + 3, NULL, 10);
|
||||||
|
|
||||||
database_t *db = web_get_database(sid.index_id);
|
database_t *db = web_get_database(sid.index_id);
|
||||||
if (db == NULL) {
|
if (db == NULL) {
|
||||||
@@ -86,11 +86,11 @@ void stats_files(struct mg_connection *nc, struct mg_http_message *hm) {
|
|||||||
char index_id_str[9];
|
char index_id_str[9];
|
||||||
char arg_stat_type[5];
|
char arg_stat_type[5];
|
||||||
|
|
||||||
memcpy(index_id_str, hm->uri.buf + 3, 8);
|
memcpy(index_id_str, hm->uri.ptr + 3, 8);
|
||||||
*(index_id_str + 8) = '\0';
|
*(index_id_str + 8) = '\0';
|
||||||
int index_id = (int) strtol(index_id_str, NULL, 16);
|
int index_id = (int) strtol(index_id_str, NULL, 16);
|
||||||
|
|
||||||
memcpy(arg_stat_type, hm->uri.buf + 3 + 9, 4);
|
memcpy(arg_stat_type, hm->uri.ptr + 3 + 9, 4);
|
||||||
*(arg_stat_type + sizeof(arg_stat_type) - 1) = '\0';
|
*(arg_stat_type + sizeof(arg_stat_type) - 1) = '\0';
|
||||||
|
|
||||||
database_stat_type_d stat_type = database_get_stat_type_by_mnemonic(arg_stat_type);
|
database_stat_type_d stat_type = database_get_stat_type_by_mnemonic(arg_stat_type);
|
||||||
@@ -135,19 +135,19 @@ void serve_chunk_vendors_js(struct mg_connection *nc, struct mg_http_message *hm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void serve_favicon_ico(struct mg_connection *nc, UNUSED(struct mg_http_message *hm)) {
|
void serve_favicon_ico(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
web_serve_asset_favicon_ico(nc);
|
web_serve_asset_favicon_ico(nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serve_style_css(struct mg_connection *nc, UNUSED(struct mg_http_message *hm)) {
|
void serve_style_css(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
web_serve_asset_style_css(nc);
|
web_serve_asset_style_css(nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serve_chunk_vendors_css(struct mg_connection *nc, UNUSED(struct mg_http_message *hm)) {
|
void serve_chunk_vendors_css(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
web_serve_asset_chunk_vendors_css(nc);
|
web_serve_asset_chunk_vendors_css(nc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serve_thumbnail(struct mg_connection *nc, UNUSED(struct mg_http_message *hm), int index_id,
|
void serve_thumbnail(struct mg_connection *nc, struct mg_http_message *hm, int index_id,
|
||||||
int doc_id, int arg_num) {
|
int doc_id, int arg_num) {
|
||||||
|
|
||||||
database_t *db = web_get_database(index_id);
|
database_t *db = web_get_database(index_id);
|
||||||
@@ -179,13 +179,13 @@ void serve_thumbnail(struct mg_connection *nc, UNUSED(struct mg_http_message *hm
|
|||||||
void thumbnail_with_num(struct mg_connection *nc, struct mg_http_message *hm) {
|
void thumbnail_with_num(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
sist_id_t sid;
|
sist_id_t sid;
|
||||||
|
|
||||||
if (hm->uri.len != SIST_SID_LEN + 2 + 4 || !parse_sid(&sid, hm->uri.buf + 3)) {
|
if (hm->uri.len != SIST_SID_LEN + 2 + 4 || !parse_sid(&sid, hm->uri.ptr + 3)) {
|
||||||
LOG_DEBUGF("serve.c", "Invalid thumbnail path: %.*s", (int) hm->uri.len, hm->uri.buf);
|
LOG_DEBUGF("serve.c", "Invalid thumbnail path: %.*s", (int) hm->uri.len, hm->uri.ptr);
|
||||||
HTTP_REPLY_NOT_FOUND
|
HTTP_REPLY_NOT_FOUND
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int num = (int) strtol(hm->uri.buf + SIST_SID_LEN + 3, NULL, 10);
|
int num = (int) strtol(hm->uri.ptr + SIST_SID_LEN + 3, NULL, 10);
|
||||||
|
|
||||||
serve_thumbnail(nc, hm, sid.index_id, sid.doc_id, num);
|
serve_thumbnail(nc, hm, sid.index_id, sid.doc_id, num);
|
||||||
}
|
}
|
||||||
@@ -193,8 +193,8 @@ void thumbnail_with_num(struct mg_connection *nc, struct mg_http_message *hm) {
|
|||||||
void thumbnail(struct mg_connection *nc, struct mg_http_message *hm) {
|
void thumbnail(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
sist_id_t sid;
|
sist_id_t sid;
|
||||||
|
|
||||||
if (hm->uri.len != 20 || !parse_sid(&sid, hm->uri.buf + 3)) {
|
if (hm->uri.len != 20 || !parse_sid(&sid, hm->uri.ptr + 3)) {
|
||||||
LOG_DEBUGF("serve.c", "Invalid thumbnail path: %.*s", (int) hm->uri.len, hm->uri.buf);
|
LOG_DEBUGF("serve.c", "Invalid thumbnail path: %.*s", (int) hm->uri.len, hm->uri.ptr);
|
||||||
HTTP_REPLY_NOT_FOUND
|
HTTP_REPLY_NOT_FOUND
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ void search(struct mg_connection *nc, struct mg_http_message *hm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *body = malloc(hm->body.len + 1);
|
char *body = malloc(hm->body.len + 1);
|
||||||
memcpy(body, hm->body.buf, hm->body.len);
|
memcpy(body, hm->body.ptr, hm->body.len);
|
||||||
*(body + hm->body.len) = '\0';
|
*(body + hm->body.len) = '\0';
|
||||||
|
|
||||||
char url[4096];
|
char url[4096];
|
||||||
@@ -416,8 +416,8 @@ cJSON *get_root_document_by_id(int index_id, int doc_id) {
|
|||||||
void file(struct mg_connection *nc, struct mg_http_message *hm) {
|
void file(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
sist_id_t sid;
|
sist_id_t sid;
|
||||||
|
|
||||||
if (hm->uri.len != 20 || !parse_sid(&sid, hm->uri.buf + 3)) {
|
if (hm->uri.len != 20 || !parse_sid(&sid, hm->uri.ptr + 3)) {
|
||||||
LOG_DEBUGF("serve.c", "Invalid file path: %.*s", (int) hm->uri.len, hm->uri.buf);
|
LOG_DEBUGF("serve.c", "Invalid file path: %.*s", (int) hm->uri.len, hm->uri.ptr);
|
||||||
HTTP_REPLY_NOT_FOUND
|
HTTP_REPLY_NOT_FOUND
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -528,14 +528,14 @@ subreq_ctx_t *elastic_write_tag(const char *sid, const tag_req_t *req) {
|
|||||||
|
|
||||||
void tag(struct mg_connection *nc, struct mg_http_message *hm) {
|
void tag(struct mg_connection *nc, struct mg_http_message *hm) {
|
||||||
sist_id_t sid;
|
sist_id_t sid;
|
||||||
if (hm->uri.len != 22 || !parse_sid(&sid, hm->uri.buf + 5)) {
|
if (hm->uri.len != 22 || !parse_sid(&sid, hm->uri.ptr + 5)) {
|
||||||
LOG_DEBUGF("serve.c", "Invalid tag path: %.*s", (int) hm->uri.len, hm->uri.buf);
|
LOG_DEBUGF("serve.c", "Invalid tag path: %.*s", (int) hm->uri.len, hm->uri.ptr);
|
||||||
HTTP_REPLY_NOT_FOUND
|
HTTP_REPLY_NOT_FOUND
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *body = malloc(hm->body.len + 1);
|
char *body = malloc(hm->body.len + 1);
|
||||||
memcpy(body, hm->body.buf, hm->body.len);
|
memcpy(body, hm->body.ptr, hm->body.len);
|
||||||
*(body + hm->body.len) = '\0';
|
*(body + hm->body.len) = '\0';
|
||||||
cJSON *json = cJSON_Parse(body);
|
cJSON *json = cJSON_Parse(body);
|
||||||
free(body);
|
free(body);
|
||||||
@@ -612,7 +612,7 @@ int check_auth0(struct mg_http_message *hm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
token_str = malloc(token.len + 1);
|
token_str = malloc(token.len + 1);
|
||||||
strncpy(token_str, token.buf, token.len);
|
strncpy(token_str, token.ptr, token.len);
|
||||||
*(token_str + token.len) = '\0';
|
*(token_str + token.len) = '\0';
|
||||||
|
|
||||||
int res = auth0_verify_jwt(
|
int res = auth0_verify_jwt(
|
||||||
@@ -642,15 +642,13 @@ static void ev_router(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char uri[256];
|
char uri[256];
|
||||||
memcpy(uri, hm->uri.buf, hm->uri.len);
|
memcpy(uri, hm->uri.ptr, hm->uri.len);
|
||||||
*(uri + hm->uri.len) = '\0';
|
*(uri + hm->uri.len) = '\0';
|
||||||
LOG_DEBUGF("serve.c", "<%s> GET %s",
|
LOG_DEBUGF("serve.c", "<%s> GET %s",
|
||||||
web_address_to_string(&(nc->rem)),
|
web_address_to_string(&(nc->rem)),
|
||||||
uri
|
uri
|
||||||
);
|
);
|
||||||
|
|
||||||
#define mg_http_match_uri(hm, pattern) mg_match((hm)->uri, mg_str(pattern), NULL)
|
|
||||||
|
|
||||||
if (mg_http_match_uri(hm, "/")) {
|
if (mg_http_match_uri(hm, "/")) {
|
||||||
serve_index_html(nc, hm);
|
serve_index_html(nc, hm);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -420,8 +420,8 @@ void fts_get_document(struct mg_connection *nc, struct mg_http_message *hm) {
|
|||||||
|
|
||||||
sist_id_t sid;
|
sist_id_t sid;
|
||||||
|
|
||||||
if (hm->uri.len != 24 || !parse_sid(&sid, hm->uri.buf + 7)) {
|
if (hm->uri.len != 24 || !parse_sid(&sid, hm->uri.ptr + 7)) {
|
||||||
LOG_DEBUGF("serve.c", "Invalid /fts/d/ path: %.*s", (int) hm->uri.len, hm->uri.buf);
|
LOG_DEBUGF("serve.c", "Invalid /fts/d/ path: %.*s", (int) hm->uri.len, hm->uri.ptr);
|
||||||
HTTP_REPLY_NOT_FOUND
|
HTTP_REPLY_NOT_FOUND
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ cJSON *web_get_json_body(struct mg_http_message *hm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *body = malloc(hm->body.len + 1);
|
char *body = malloc(hm->body.len + 1);
|
||||||
memcpy(body, hm->body.buf, hm->body.len);
|
memcpy(body, hm->body.ptr, hm->body.len);
|
||||||
*(body + hm->body.len) = '\0';
|
*(body + hm->body.len) = '\0';
|
||||||
cJSON *json = cJSON_Parse(body);
|
cJSON *json = cJSON_Parse(body);
|
||||||
free(body);
|
free(body);
|
||||||
@@ -87,7 +87,7 @@ char *web_get_string_body(struct mg_http_message *hm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *body = malloc(hm->body.len + 1);
|
char *body = malloc(hm->body.len + 1);
|
||||||
memcpy(body, hm->body.buf, hm->body.len);
|
memcpy(body, hm->body.ptr, hm->body.len);
|
||||||
*(body + hm->body.len) = '\0';
|
*(body + hm->body.len) = '\0';
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
|
|||||||
Reference in New Issue
Block a user