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.
This commit is contained in:
parent
3433657ccf
commit
31985ed0fc
1 changed files with 9 additions and 9 deletions
|
|
@ -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 @@ log = getLogger(__name__)
|
|||
|
||||
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 @@ class HTTPFileServer(resource.Resource):
|
|||
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 @@ class FileSharingRequest(server.Request):
|
|||
|
||||
@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 @@ class FileSharing:
|
|||
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 @@ class FileSharing:
|
|||
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 @@ class FileSharing:
|
|||
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 @@ class FileSharing:
|
|||
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]
|
||||
|
|
|
|||
Loading…
Reference in a new issue