Mercurial > libervia-backend
diff sat/plugins/plugin_comp_file_sharing.py @ 3677:02e5e2385a30
component (file-sharing): use `file-sharing` instead of `file_sharing`:
a dash is used instead of underscore for entry-point and config section., as it is best
practice to use dash on command-line.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 26 Sep 2021 16:35:56 +0200 |
parents | ab72b8ac3bd2 |
children | 742e466fa000 6d298323eed2 |
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_file_sharing.py Sun Sep 26 16:35:49 2021 +0200 +++ b/sat/plugins/plugin_comp_file_sharing.py Sun Sep 26 16:35:56 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 @@ -48,7 +48,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: [], @@ -207,7 +207,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: @@ -243,7 +243,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 @@ -369,9 +369,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"' @@ -382,7 +382,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) @@ -393,7 +393,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: @@ -409,7 +409,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]