6 Commits
0.0.3 ... 0.0.4

Author SHA1 Message Date
d8438e13f5 Fix getting seafile server URL 2020-08-25 23:17:58 +03:00
e73c62d034 Update github workflow 2020-08-25 22:55:13 +03:00
6048280983 Update installation process in Dockerfile 2020-08-25 21:30:44 +03:00
e35cf0efa5 Fix incorrect schema issue 2020-08-25 21:17:34 +03:00
ebf7574bde Update github workflow 2020-06-04 22:32:57 +03:00
e4268c0b21 Update github workflow 2020-06-04 22:29:20 +03:00
6 changed files with 12 additions and 21 deletions

View File

@@ -2,20 +2,14 @@ name: Docker
on: on:
push: push:
# Publish `master` as Docker `latest` image.
branches: branches:
- master - master
# Publish `v1.2.3` tags as releases.
tags: tags:
- '*' - '*'
# Run tests for any PRs.
pull_request: pull_request:
jobs: jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -31,10 +25,7 @@ jobs:
docker build . --file Dockerfile docker build . --file Dockerfile
fi fi
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push: push:
# Ensure test job passes before pushing image.
needs: test needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -49,3 +40,5 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: snegov/seafile-client repository: snegov/seafile-client
tag_with_ref: true tag_with_ref: true
add_git_labels: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}

View File

@@ -1,10 +1,10 @@
FROM python:3-slim FROM python:3-slim
RUN apt-get update && apt-get install gnupg -y && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install gnupg curl -y && rm -rf /var/lib/apt/lists/*
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61 && \ RUN curl https://linux-clients.seafile.com/seafile.key | apt-key add - && \
echo deb http://deb.seadrive.org buster main | tee /etc/apt/sources.list.d/seafile.list && \ echo 'deb [arch=amd64] http://linux-clients.seafile.com/seafile-deb/buster/ stable main' > /etc/apt/sources.list.d/seafile.list && \
apt-get update -y && \ apt-get update -y && \
apt-get install -y seafile-cli procps curl grep && \ apt-get install -y seafile-cli procps grep && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
WORKDIR /seafile-client WORKDIR /seafile-client

View File

@@ -14,7 +14,6 @@ services:
environment: environment:
- LIBRARY_ID=<your-library-id-here> - LIBRARY_ID=<your-library-id-here>
- SERVER_HOST=<server-host> - SERVER_HOST=<server-host>
- SERVER_PORT=<server-port>
- USERNAME=<username> - USERNAME=<username>
- PASSWORD=<password> - PASSWORD=<password>
- DATA_DIR=<directory-path-to-sync> - DATA_DIR=<directory-path-to-sync>
@@ -26,8 +25,7 @@ services:
## Environment variables: ## Environment variables:
- `LIBRARY_ID=<your-library-id-here>` ID of library to sync; multiple libraries could be separated by colon `:` - `LIBRARY_ID=<your-library-id-here>` ID of library to sync; multiple libraries could be separated by colon `:`
- `SERVER_HOST=<server-host>` Hostname of your seafile server, eg: seafile.example.com - `SERVER_HOST=<server-host>` Hostname of your seafile server, eg: seafile.example.com. If you're using non-standart port, specify it here, eg: seafile.example.com:8080
- `SERVER_PORT=<server-port>` Which port the server is hosted on: usually 443 (https) or 80 (http)
- `USERNAME=<username>` Seafile account username - `USERNAME=<username>` Seafile account username
- `PASSWORD=<password>` Seafile account password - `PASSWORD=<password>` Seafile account password
- `DATA_DIR=<directory-path-to-sync>` The path where to put the files - `DATA_DIR=<directory-path-to-sync>` The path where to put the files

View File

@@ -7,7 +7,6 @@ services:
environment: environment:
- LIBRARY_ID=<your-library-id-here> - LIBRARY_ID=<your-library-id-here>
- SERVER_HOST=<server-host> - SERVER_HOST=<server-host>
- SERVER_PORT=<server-port>
- USERNAME=<username> - USERNAME=<username>
- PASSWORD=<password> - PASSWORD=<password>
- DATA_DIR=<directory-path-to-sync> - DATA_DIR=<directory-path-to-sync>

View File

@@ -2,6 +2,7 @@ import logging
import os import os
import subprocess import subprocess
import time import time
from urllib.parse import urlparse
import requests import requests
@@ -14,8 +15,9 @@ logging.basicConfig(format="%(asctime)s %(message)s",
class SeafileClient: class SeafileClient:
def __init__(self, host: str, port: int, user: str, passwd: str): def __init__(self, host: str, user: str, passwd: str):
self.url = f"https://{host}:{port}" up = urlparse(requests.get(f"http://{host}").url)
self.url = f"{up.scheme}://{up.netloc}"
self.user = user self.user = user
self.password = passwd self.password = passwd
self.__token = None self.__token = None

View File

@@ -15,7 +15,6 @@ def main():
parser.add_argument("--gid", default=os.getenv("SEAFILE_GID"), type=int) parser.add_argument("--gid", default=os.getenv("SEAFILE_GID"), type=int)
parser.add_argument("--data-dir", default=os.getenv("DATA_DIR")) parser.add_argument("--data-dir", default=os.getenv("DATA_DIR"))
parser.add_argument("--host", default=os.getenv("SERVER_HOST")) parser.add_argument("--host", default=os.getenv("SERVER_HOST"))
parser.add_argument("--port", default=os.getenv("SERVER_PORT"), type=int)
parser.add_argument("--username", default=os.getenv("USERNAME")) parser.add_argument("--username", default=os.getenv("USERNAME"))
parser.add_argument("--password", default=os.getenv("PASSWORD")) parser.add_argument("--password", default=os.getenv("PASSWORD"))
parser.add_argument("--libs", default=os.getenv("LIBRARY_ID")) parser.add_argument("--libs", default=os.getenv("LIBRARY_ID"))
@@ -24,7 +23,7 @@ def main():
setup_uid(args.uid, args.gid) setup_uid(args.uid, args.gid)
start_seaf_daemon() start_seaf_daemon()
create_dir(args.data_dir) create_dir(args.data_dir)
client = SeafileClient(args.host, args.port, args.username, args.password) client = SeafileClient(args.host, args.username, args.password)
for lib_id in args.libs.split(sep=":"): for lib_id in args.libs.split(sep=":"):
client.sync_lib(lib_id, args.data_dir) client.sync_lib(lib_id, args.data_dir)
client.watch_status() client.watch_status()