Mercurial > libervia-backend
diff sat/plugins/plugin_comp_file_sharing.py @ 3681:742e466fa000
merge bookmark `@`
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 26 Sep 2021 16:41:49 +0200 |
parents | 888109774673 02e5e2385a30 |
children | 09f5ac48ffe3 |
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_file_sharing.py Sun Sep 26 16:38:40 2021 +0200 +++ b/sat/plugins/plugin_comp_file_sharing.py Sun Sep 26 16:41:49 2021 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# SAT plugin for parrot mode (experimental) +# Libervia File Sharing component # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify @@ -49,7 +49,7 @@ PLUGIN_INFO = { C.PI_NAME: "File sharing component", - C.PI_IMPORT_NAME: "file_sharing", + C.PI_IMPORT_NAME: "file-sharing", C.PI_MODES: [C.PLUG_MODE_COMPONENT], C.PI_TYPE: C.PLUG_TYPE_ENTRY_POINT, C.PI_PROTOCOLS: [], @@ -208,7 +208,7 @@ request.content = None # the 2 following headers are not standard, but useful in the context of file - # sharing with HTTP Upload: first one allow uploaded to specify the path + # sharing with HTTP Upload: first one allow uploader to specify the path # and second one will disable public exposure of the file through HTTP path = request.getHeader("Xmpp-File-Path") if path: @@ -244,7 +244,7 @@ @property def upload_data(self): - """A tuple with upload_id and filename retrieve from requested path""" + """A tuple with upload_id and filename retrieved from requested path""" if self._upload_data is not None: return self._upload_data @@ -370,9 +370,9 @@ self._getDirectoryMetadataElts) self.files_path = self.host.getLocalPath(None, C.FILES_DIR, profile=False) self.http_port = int(self.host.memory.getConfig( - 'component file_sharing', 'http_upload_port', 8888)) + 'component file-sharing', 'http_upload_port', 8888)) connection_type = self.host.memory.getConfig( - 'component file_sharing', 'http_upload_connection_type', 'https') + 'component file-sharing', 'http_upload_connection_type', 'https') if connection_type not in ('http', 'https'): raise exceptions.ConfigError( 'bad http_upload_connection_type, you must use one of "http" or "https"' @@ -383,7 +383,7 @@ reactor.listenTCP(self.http_port, self.server) else: options = tls.getOptionsFromConfig( - self.host.memory.config, "component file_sharing") + self.host.memory.config, "component file-sharing") tls.TLSOptionsCheck(options) context_factory = tls.getTLSContextFactory(options) reactor.listenSSL(self.http_port, self.server, context_factory) @@ -394,7 +394,7 @@ def profileConnecting(self, client): self.init() public_base_url = self.host.memory.getConfig( - 'component file_sharing', 'http_upload_public_facing_url') + 'component file-sharing', 'http_upload_public_facing_url') if public_base_url is None: client._file_sharing_base_url = f"https://{client.host}:{self.http_port}" else: @@ -410,7 +410,7 @@ def getQuota(self, client, entity): """Return maximum size allowed for all files for entity""" # TODO: handle special entities like admins - quotas = self.host.memory.getConfig("component file_sharing", "quotas_json", {}) + quotas = self.host.memory.getConfig("component file-sharing", "quotas_json", {}) entity_bare_s = entity.userhost() try: quota = quotas["jids"][entity_bare_s]