Skip to content

Commit

Permalink
Add upload link and download link API (#683)
Browse files Browse the repository at this point in the history
* Add upload link and download link API

* Use go 1.22 for ci

* Go add upload link API

* Add norm UTF8 path

* Go add upload link API

* Add seahub_settings.py

* Add projectDir

* Add download link API

* Set and check etag

* Add comment and set no-cache

---------

Co-authored-by: 杨赫然 <[email protected]>
  • Loading branch information
feiniks and 杨赫然 authored Sep 3, 2024
1 parent 59a9f28 commit 95bad89
Show file tree
Hide file tree
Showing 14 changed files with 1,377 additions and 32 deletions.
5 changes: 5 additions & 0 deletions ci/serverctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from collections import namedtuple
from contextlib import contextmanager
from os.path import abspath, basename, dirname, exists, join
import shutil

import requests
from tenacity import TryAgain, retry, stop_after_attempt, wait_fixed
Expand All @@ -24,6 +25,7 @@
class ServerCtl(object):
def __init__(self, topdir, projectdir, datadir, fileserver, db='sqlite3', seaf_server_bin='seaf-server', ccnet_server_bin='ccnet-server'):
self.db = db
self.topdir = topdir
self.datadir = datadir
self.central_conf_dir = join(datadir, 'conf')
self.seafile_conf_dir = join(datadir, 'seafile-data')
Expand Down Expand Up @@ -53,6 +55,9 @@ def setup(self):
os.mkdir (self.central_conf_dir, 0o755)
os.mkdir (self.seafile_conf_dir, 0o755)
os.mkdir (self.ccnet_conf_dir, 0o755)
src = join(self.projectdir, 'tests/conf/seahub_settings.py')
dst = join(self.central_conf_dir, 'seahub_settings.py')
shutil.copyfile(src, dst)

self.init_ccnet()
self.init_seafile()
Expand Down
12 changes: 9 additions & 3 deletions common/seaf-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,25 +418,31 @@ load_seahub_private_key (SeafileSession *session, const char *conf_dir)
char line[256];
char *site_root = NULL;
while (fgets(line, sizeof(line), file)) {
GMatchInfo *match_info;
GMatchInfo *match_info = NULL;
if (g_regex_match (secret_key_regex, line, 0, &match_info)) {
char *sk = g_match_info_fetch (match_info, 1);
session->seahub_pk = sk;
}
g_match_info_free (match_info);
match_info = NULL;

if (g_regex_match (site_root_regex, line, 0, &match_info)) {
site_root = g_match_info_fetch (match_info, 1);
}
g_match_info_free (match_info);
}

if (session->seahub_pk) {
if (site_root) {
session->seahub_url = g_strdup_printf("http://127.0.0.1:8000%sapi/v2.1/internal/user-list/", site_root);
session->seahub_url = g_strdup_printf("http://127.0.0.1:8000%sapi/v2.1/internal", site_root);
} else {
session->seahub_url = g_strdup("http://127.0.0.1:8000/api/v2.1/internal/user-list/");
session->seahub_url = g_strdup("http://127.0.0.1:8000/api/v2.1/internal");
}
session->seahub_conn_pool = connection_pool_new ();
} else {
seaf_warning ("No seahub private key is configured.\n");
}
g_free (site_root);

out:
if (secret_key_regex)
Expand Down
Loading

0 comments on commit 95bad89

Please sign in to comment.