Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
25b9dfe403 | ||
![]() |
83fd8af2f5 |
17
.drone.yml
17
.drone.yml
@ -16,12 +16,11 @@ pipeline:
|
|||||||
- zip seafile.zip -r modules icon.png main.py metadata.xml settings.ui
|
- zip seafile.zip -r modules icon.png main.py metadata.xml settings.ui
|
||||||
release:
|
release:
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
settings:
|
api_key:
|
||||||
api_key:
|
from_secret: gitea_token
|
||||||
from_secret: gitea_token
|
base_url: https://git.shimun.net
|
||||||
base_url: https://git.shimun.net
|
files: seafile.zip
|
||||||
files: seafile.zip
|
checksum:
|
||||||
checksum:
|
- sha256
|
||||||
- sha256
|
when:
|
||||||
when:
|
event: tag
|
||||||
event: tag
|
|
||||||
|
@ -111,11 +111,14 @@ class SeafileFile:
|
|||||||
self.size = size
|
self.size = size
|
||||||
|
|
||||||
# curl -v -X PUT -d "p=/foo.md" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/afc3b694-7d4c-4b8a-86a4-89c9f3261b12/file/shared-link/
|
# curl -v -X PUT -d "p=/foo.md" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/afc3b694-7d4c-4b8a-86a4-89c9f3261b12/file/shared-link/
|
||||||
def share(self):
|
def share(self,expire_days=None):
|
||||||
|
data = {'p': self.path}
|
||||||
|
if expire_days and not expire_days == 0:
|
||||||
|
data['expire'] = expire_days
|
||||||
resp = self.session.put("%s/repos/%s/file/shared-link/" % (self.library.client.api_endpoint(), self.library.id),
|
resp = self.session.put("%s/repos/%s/file/shared-link/" % (self.library.client.api_endpoint(), self.library.id),
|
||||||
headers={'Authorization': "Token %s" % self.library.client.token.token,
|
headers={'Authorization': "Token %s" % self.library.client.token.token,
|
||||||
'Accept': 'application/json; indent=4'},
|
'Accept': 'application/json; indent=4'},
|
||||||
data={'p': self.path}
|
data = data
|
||||||
)
|
)
|
||||||
return resp.headers.get("location")
|
return resp.headers.get("location")
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ class SeafScreencloudSettings:
|
|||||||
self.token = None # SefileToken
|
self.token = None # SefileToken
|
||||||
self.upload_scheme = "regular"
|
self.upload_scheme = "regular"
|
||||||
self.url = None
|
self.url = None
|
||||||
|
self.link_expiry = None
|
||||||
|
|
||||||
def _client(self):
|
def _client(self):
|
||||||
if self.token and self.url:
|
if self.token and self.url:
|
||||||
@ -28,6 +29,7 @@ class SeafScreencloudSettings:
|
|||||||
self.client = self._client
|
self.client = self._client
|
||||||
|
|
||||||
self.url = settings.value("seafile-url", None)
|
self.url = settings.value("seafile-url", None)
|
||||||
|
self.link_expiry = int(settings.value("link-expiry", None))
|
||||||
lib = tuple(settings.value("library", "/").split("/"))
|
lib = tuple(settings.value("library", "/").split("/"))
|
||||||
(id, name) = lib
|
(id, name) = lib
|
||||||
if len(id) == 0 or self.client() == None:
|
if len(id) == 0 or self.client() == None:
|
||||||
@ -64,6 +66,8 @@ class SeafScreencloudSettings:
|
|||||||
if self.library is not None:
|
if self.library is not None:
|
||||||
settings.setValue("library", "%s/%s" %
|
settings.setValue("library", "%s/%s" %
|
||||||
(self.library.id, self.library.name))
|
(self.library.id, self.library.name))
|
||||||
|
if self.link_expiry is not None:
|
||||||
|
settings.setValue("link-expiry", self.link_expiry)
|
||||||
settings.setValue("library-path", self.library_path)
|
settings.setValue("library-path", self.library_path)
|
||||||
if self.token != None:
|
if self.token != None:
|
||||||
settings.setValue("auth-username", self.token.username)
|
settings.setValue("auth-username", self.token.username)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user