音楽で楽しみましょう!-Let's have fun with music!-
Signed-off-by: Shin'ya Minazuki <shinyoukai@laidback.moe>
This commit is contained in:
parent
7c3206bf83
commit
54c6d22102
517 changed files with 637 additions and 639 deletions
6
.env.dev
6
.env.dev
|
|
@ -2,15 +2,15 @@ DJANGO_ALLOWED_HOSTS=.funkwhale.test,localhost,nginx,0.0.0.0,127.0.0.1,.gitpod.i
|
||||||
DJANGO_SETTINGS_MODULE=config.settings.local
|
DJANGO_SETTINGS_MODULE=config.settings.local
|
||||||
DJANGO_SECRET_KEY=dev
|
DJANGO_SECRET_KEY=dev
|
||||||
C_FORCE_ROOT=true
|
C_FORCE_ROOT=true
|
||||||
FUNKWHALE_HOSTNAME=localhost
|
FUNQUAIL_HOSTNAME=localhost
|
||||||
FUNKWHALE_PROTOCOL=http
|
FUNQUAIL_PROTOCOL=http
|
||||||
PYTHONDONTWRITEBYTECODE=true
|
PYTHONDONTWRITEBYTECODE=true
|
||||||
VUE_PORT=8080
|
VUE_PORT=8080
|
||||||
MUSIC_DIRECTORY_PATH=/music
|
MUSIC_DIRECTORY_PATH=/music
|
||||||
BROWSABLE_API_ENABLED=True
|
BROWSABLE_API_ENABLED=True
|
||||||
FORWARDED_PROTO=http
|
FORWARDED_PROTO=http
|
||||||
LDAP_ENABLED=False
|
LDAP_ENABLED=False
|
||||||
FUNKWHALE_SPA_HTML_ROOT=http://nginx/
|
FUNQUAIL_SPA_HTML_ROOT=http://nginx/
|
||||||
PYTHONTRACEMALLOC=0
|
PYTHONTRACEMALLOC=0
|
||||||
MEDIA_ROOT=/data/media
|
MEDIA_ROOT=/data/media
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ Describe the expected behaviour.
|
||||||
The version of your instance can be found on the footer : Source code (x.y)
|
The version of your instance can be found on the footer : Source code (x.y)
|
||||||
-->
|
-->
|
||||||
|
|
||||||
**Funkwhale version(s) affected**: x.y
|
**FunQuail version(s) affected**: x.y
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
If relevant, share additional context here like:
|
If relevant, share additional context here like:
|
||||||
|
|
|
||||||
1
Makefile
1
Makefile
|
|
@ -1,5 +1,4 @@
|
||||||
SHELL := bash
|
SHELL := bash
|
||||||
CPU_CORES := $(shell N=$$(nproc); echo $$(( $$N > 4 ? 4 : $$N )))
|
|
||||||
|
|
||||||
BAKE_FILES = \
|
BAKE_FILES = \
|
||||||
docker-bake.json \
|
docker-bake.json \
|
||||||
|
|
|
||||||
29
README.md
29
README.md
|
|
@ -1,26 +1,5 @@
|
||||||
# Funkwhale
|
# FunQuail
|
||||||
|
A platform for uploading, sharing, and publishing audio content across the federated[^1] web.\
|
||||||
|
Curate your music library, listen to podcasts, or create your own content and share it with the world.
|
||||||
|
|
||||||
[](https://funkwhale.audio)
|
This project began existence as a hard-fork of [Funkwhale](https://funkwhale.audio).
|
||||||
|
|
||||||
Funkwhale is a platform for uploading, sharing, and publishing audio content across the federated web. Curate your music library, listen to podcasts, or create your own content and share it with the world.
|
|
||||||
|
|
||||||
## Contribute
|
|
||||||
|
|
||||||
Want to help make Funkwhale even better? We welcome contributions from across the community. Whether you are a designer, a translator, a technical writer, or a developer, we look forward to seeing your work!
|
|
||||||
|
|
||||||
You can find contribution information in our [documentation hub](https://docs.funkwhale.audio).
|
|
||||||
|
|
||||||
- [Developer guides](https://docs.funkwhale.audio/developer/index.html)
|
|
||||||
- [Contributor guides](https://docs.funkwhale.audio/contributing.html)
|
|
||||||
|
|
||||||
## Get help
|
|
||||||
|
|
||||||
Got a question or need help? Head over to our [forum](https://forum.funkwhale.audio/t/support) and open up a discussion.
|
|
||||||
|
|
||||||
## Report a security issue
|
|
||||||
|
|
||||||
If you find a security issue or vulnerability, please report it on our [GitLab instance](https://dev.funkwhale.audio/funkwhale/funkwhale/-/issues). When you open your issue, select the **This issue is confidential and should only be visible to team members with at least Reporter access** option. This ensures developers can verify and patch the issue before disclosing it.
|
|
||||||
|
|
||||||
## Code of conduct
|
|
||||||
|
|
||||||
The Funkwhale collective adheres to a [code of conduct](https://funkwhale.audio/code-of-conduct) in all our community spaces. Please familiarize yourself with this code and follow it when participating in discussions in our spaces.
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
# Funkwhale API
|
# FunQuail API
|
||||||
|
|
||||||
This is the Funkwhale API. Check out our [API explorer](https://docs.funkwhale.audio/swagger/) for interactive documentation.
|
This is the FunQuail API. Check out our [API explorer](https://funquail.laidback.moe/docs/swagger/) for interactive documentation.
|
||||||
|
|
||||||
## OAuth Authentication
|
## OAuth Authentication
|
||||||
|
|
||||||
Funkwhale uses the OAuth [authorization grant flow](https://tools.ietf.org/html/rfc6749#section-4.1) for external apps. This flow is a secure way to authenticate apps that requires a user's explicit consent to perform actions. You can use our demo server at <https://demo.funkwhale.audio> for testing purposes.
|
FunQuail uses the OAuth [authorization grant flow](https://tools.ietf.org/html/rfc6749#section-4.1) for external apps. This flow is a secure way to authenticate apps that requires a user's explicit consent to perform actions. You can use our demo server at <https://demo.funkwhale.audio> for testing purposes.
|
||||||
|
|
||||||
To authenticate with the Funkwhale API:
|
To authenticate with the FunQuail API:
|
||||||
|
|
||||||
1. Create an application by sending a `POST` request to `api/v1/oauth/apps`. Include your scopes and redirect URI (use `urn:ietf:wg:oauth:2.0:oob`
|
1. Create an application by sending a `POST` request to `api/v1/oauth/apps`. Include your scopes and redirect URI (use `urn:ietf:wg:oauth:2.0:oob`
|
||||||
to get an authorization code you can copy)
|
to get an authorization code you can copy)
|
||||||
|
|
@ -15,7 +15,7 @@ To authenticate with the Funkwhale API:
|
||||||
4. Use your access token to authenticate your calls with the following format: `Authorization: Bearer <token>`
|
4. Use your access token to authenticate your calls with the following format: `Authorization: Bearer <token>`
|
||||||
5. Refresh your access token by sending a refresh request to `/api/v1/oauth/token`
|
5. Refresh your access token by sending a refresh request to `/api/v1/oauth/token`
|
||||||
|
|
||||||
For more detailed instructions, see [our API authentication documentation](https://docs.funkwhale.audio/developers/authentication.html).
|
For more detailed instructions, see [our API authentication documentation](https://funquail.laidback.moe/docs/developers/authentication.html).
|
||||||
|
|
||||||
## Application token authentication
|
## Application token authentication
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ If you have an account on your target pod, you can create an application at `/se
|
||||||
|
|
||||||
## Rate limiting
|
## Rate limiting
|
||||||
|
|
||||||
Funkwhale supports rate-limiting as of version 0.2.0. Pod admins can choose to rate limit specific endpoints to prevent abuse and improve the stability of the service. If the server drops a request due to rate-limiting, it returns a `429` status code.
|
FunQuail supports rate-limiting as of version 0.2.0. Pod admins can choose to rate limit specific endpoints to prevent abuse and improve the stability of the service. If the server drops a request due to rate-limiting, it returns a `429` status code.
|
||||||
|
|
||||||
Each API call returns HTTP headers to pass the following information:
|
Each API call returns HTTP headers to pass the following information:
|
||||||
|
|
||||||
|
|
@ -32,8 +32,8 @@ Each API call returns HTTP headers to pass the following information:
|
||||||
- How many more requests in the scope can be made within the rate-limit timeframe (`X-RateLimit-Remaining`)
|
- How many more requests in the scope can be made within the rate-limit timeframe (`X-RateLimit-Remaining`)
|
||||||
- How much time does the client need to wait to send another request (`Retry-After`)
|
- How much time does the client need to wait to send another request (`Retry-After`)
|
||||||
|
|
||||||
For more information, check our [rate limit documentation](https://docs.funkwhale.audio/developer/api/rate-limit.html)
|
For more information, check our [rate limit documentation](https://funquail.laidback.moe/docs/developer/api/rate-limit.html)
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
For more information about API usage, refer to [our API documentation](https://docs.funkwhale.audio/api.html).
|
For more information about API usage, refer to [our API documentation](https://funquail.laidback.moe/docs/api.html).
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ def load_settings(name, settings):
|
||||||
"text": django_settings.ENV,
|
"text": django_settings.ENV,
|
||||||
}
|
}
|
||||||
values = {}
|
values = {}
|
||||||
prefix = f"FUNKWHALE_PLUGIN_{name.upper()}"
|
prefix = f"FUNQUAIL_PLUGIN_{name.upper()}"
|
||||||
for s in settings:
|
for s in settings:
|
||||||
key = "_".join([prefix, s["name"].upper()])
|
key = "_".join([prefix, s["name"].upper()])
|
||||||
value = mapping[s["type"]](key, default=s.get("default", None))
|
value = mapping[s["type"]](key, default=s.get("default", None))
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ LOGLEVEL = (
|
||||||
"DEBUG" if env.bool("DEBUG", False) else env("LOGLEVEL", default="info").upper()
|
"DEBUG" if env.bool("DEBUG", False) else env("LOGLEVEL", default="info").upper()
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
Default logging level for the Funkwhale processes.
|
Default logging level for the FunQuail processes.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
The `DEBUG` variable overrides the `LOGLEVEL` if it is set to `TRUE`.
|
The `DEBUG` variable overrides the `LOGLEVEL` if it is set to `TRUE`.
|
||||||
|
|
@ -39,7 +39,7 @@ Available levels:
|
||||||
IS_DOCKER_SETUP = env.bool("IS_DOCKER_SETUP", False)
|
IS_DOCKER_SETUP = env.bool("IS_DOCKER_SETUP", False)
|
||||||
|
|
||||||
|
|
||||||
if env("FUNKWHALE_SENTRY_DSN", default=None) is not None:
|
if env("FUNQUAIL_SENTRY_DSN", default=None) is not None:
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
|
|
@ -47,15 +47,15 @@ if env("FUNKWHALE_SENTRY_DSN", default=None) is not None:
|
||||||
from funkwhale_api import __version__ as version
|
from funkwhale_api import __version__ as version
|
||||||
|
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
dsn=env("FUNKWHALE_SENTRY_DSN"),
|
dsn=env("FUNQUAIL_SENTRY_DSN"),
|
||||||
integrations=[DjangoIntegration(), CeleryIntegration()],
|
integrations=[DjangoIntegration(), CeleryIntegration()],
|
||||||
traces_sample_rate=env("FUNKWHALE_SENTRY_SR", default=0.25),
|
traces_sample_rate=env("FUNQUAIL_SENTRY_SR", default=0.25),
|
||||||
send_default_pii=False,
|
send_default_pii=False,
|
||||||
environment="api",
|
environment="api",
|
||||||
debug=env.bool("DEBUG", False),
|
debug=env.bool("DEBUG", False),
|
||||||
release=version,
|
release=version,
|
||||||
)
|
)
|
||||||
sentry_sdk.set_tag("instance", env("FUNKWHALE_HOSTNAME"))
|
sentry_sdk.set_tag("instance", env("FUNQUAIL_HOSTNAME"))
|
||||||
|
|
||||||
LOGGING_CONFIG = None
|
LOGGING_CONFIG = None
|
||||||
logging.config.dictConfig(
|
logging.config.dictConfig(
|
||||||
|
|
@ -114,24 +114,24 @@ else:
|
||||||
logger.info("Loaded env file at %s/.env", path)
|
logger.info("Loaded env file at %s/.env", path)
|
||||||
break
|
break
|
||||||
|
|
||||||
FUNKWHALE_PLUGINS_PATH = env(
|
FUNQUAIL_PLUGINS_PATH = env(
|
||||||
"FUNKWHALE_PLUGINS_PATH", default="/srv/funkwhale/plugins/"
|
"FUNQUAIL_PLUGINS_PATH", default="/srv/funkwhale/plugins/"
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
Path to a directory containing Funkwhale plugins.
|
Path to a directory containing FunQuail plugins.
|
||||||
These are imported at runtime.
|
These are imported at runtime.
|
||||||
"""
|
"""
|
||||||
sys.path.append(FUNKWHALE_PLUGINS_PATH)
|
sys.path.append(FUNQUAIL_PLUGINS_PATH)
|
||||||
CORE_PLUGINS = [
|
CORE_PLUGINS = [
|
||||||
"funkwhale_api.contrib.scrobbler",
|
"funkwhale_api.contrib.scrobbler",
|
||||||
"funkwhale_api.contrib.listenbrainz",
|
"funkwhale_api.contrib.listenbrainz",
|
||||||
"funkwhale_api.contrib.maloja",
|
"funkwhale_api.contrib.maloja",
|
||||||
]
|
]
|
||||||
|
|
||||||
LOAD_CORE_PLUGINS = env.bool("FUNKWHALE_LOAD_CORE_PLUGINS", default=True)
|
LOAD_CORE_PLUGINS = env.bool("FUNQUAIL_LOAD_CORE_PLUGINS", default=True)
|
||||||
PLUGINS = [p for p in env.list("FUNKWHALE_PLUGINS", default=[]) if p]
|
PLUGINS = [p for p in env.list("FUNQUAIL_PLUGINS", default=[]) if p]
|
||||||
"""
|
"""
|
||||||
List of Funkwhale plugins to load.
|
List of FunQuail plugins to load.
|
||||||
"""
|
"""
|
||||||
if LOAD_CORE_PLUGINS:
|
if LOAD_CORE_PLUGINS:
|
||||||
PLUGINS = CORE_PLUGINS + PLUGINS
|
PLUGINS = CORE_PLUGINS + PLUGINS
|
||||||
|
|
@ -149,40 +149,40 @@ from .. import plugins # noqa
|
||||||
plugins.startup.autodiscover([p + ".funkwhale_startup" for p in PLUGINS])
|
plugins.startup.autodiscover([p + ".funkwhale_startup" for p in PLUGINS])
|
||||||
DEPENDENCIES = plugins.trigger_filter(plugins.PLUGINS_DEPENDENCIES, [], enabled=True)
|
DEPENDENCIES = plugins.trigger_filter(plugins.PLUGINS_DEPENDENCIES, [], enabled=True)
|
||||||
plugins.install_dependencies(DEPENDENCIES)
|
plugins.install_dependencies(DEPENDENCIES)
|
||||||
FUNKWHALE_HOSTNAME = None
|
FUNQUAIL_HOSTNAME = None
|
||||||
FUNKWHALE_HOSTNAME_SUFFIX = env("FUNKWHALE_HOSTNAME_SUFFIX", default=None)
|
FUNQUAIL_HOSTNAME_SUFFIX = env("FUNQUAIL_HOSTNAME_SUFFIX", default=None)
|
||||||
FUNKWHALE_HOSTNAME_PREFIX = env("FUNKWHALE_HOSTNAME_PREFIX", default=None)
|
FUNQUAIL_HOSTNAME_PREFIX = env("FUNQUAIL_HOSTNAME_PREFIX", default=None)
|
||||||
if FUNKWHALE_HOSTNAME_PREFIX and FUNKWHALE_HOSTNAME_SUFFIX:
|
if FUNQUAIL_HOSTNAME_PREFIX and FUNQUAIL_HOSTNAME_SUFFIX:
|
||||||
# We're in traefik case, in development
|
# We're in traefik case, in development
|
||||||
FUNKWHALE_HOSTNAME = "{}.{}".format(
|
FUNQUAIL_HOSTNAME = "{}.{}".format(
|
||||||
FUNKWHALE_HOSTNAME_PREFIX, FUNKWHALE_HOSTNAME_SUFFIX
|
FUNQUAIL_HOSTNAME_PREFIX, FUNQUAIL_HOSTNAME_SUFFIX
|
||||||
)
|
)
|
||||||
FUNKWHALE_PROTOCOL = env("FUNKWHALE_PROTOCOL", default="https")
|
FUNQUAIL_PROTOCOL = env("FUNQUAIL_PROTOCOL", default="https")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
FUNKWHALE_HOSTNAME = env("FUNKWHALE_HOSTNAME")
|
FUNQUAIL_HOSTNAME = env("FUNQUAIL_HOSTNAME")
|
||||||
"""
|
"""
|
||||||
Hostname of your Funkwhale pod, e.g. ``mypod.audio``.
|
Hostname of your FunQuail pod, e.g. ``mypod.audio``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
FUNKWHALE_PROTOCOL = env("FUNKWHALE_PROTOCOL", default="https")
|
FUNQUAIL_PROTOCOL = env("FUNQUAIL_PROTOCOL", default="https")
|
||||||
"""
|
"""
|
||||||
Protocol end users will use to access your pod, either
|
Protocol end users will use to access your pod, either
|
||||||
``http`` or ``https``.
|
``http`` or ``https``.
|
||||||
"""
|
"""
|
||||||
except Exception:
|
except Exception:
|
||||||
FUNKWHALE_URL = env("FUNKWHALE_URL")
|
FUNQUAIL_URL = env("FUNQUAIL_URL")
|
||||||
_parsed = urlsplit(FUNKWHALE_URL)
|
_parsed = urlsplit(FUNQUAIL_URL)
|
||||||
FUNKWHALE_HOSTNAME = _parsed.netloc
|
FUNQUAIL_HOSTNAME = _parsed.netloc
|
||||||
FUNKWHALE_PROTOCOL = _parsed.scheme
|
FUNQUAIL_PROTOCOL = _parsed.scheme
|
||||||
|
|
||||||
FUNKWHALE_PROTOCOL = FUNKWHALE_PROTOCOL.lower()
|
FUNQUAIL_PROTOCOL = FUNQUAIL_PROTOCOL.lower()
|
||||||
FUNKWHALE_HOSTNAME = FUNKWHALE_HOSTNAME.lower()
|
FUNQUAIL_HOSTNAME = FUNQUAIL_HOSTNAME.lower()
|
||||||
FUNKWHALE_URL = f"{FUNKWHALE_PROTOCOL}://{FUNKWHALE_HOSTNAME}"
|
FUNQUAIL_URL = f"{FUNQUAIL_PROTOCOL}://{FUNQUAIL_HOSTNAME}"
|
||||||
FUNKWHALE_SPA_HTML_ROOT = env("FUNKWHALE_SPA_HTML_ROOT", default=FUNKWHALE_URL)
|
FUNQUAIL_SPA_HTML_ROOT = env("FUNQUAIL_SPA_HTML_ROOT", default=FUNQUAIL_URL)
|
||||||
"""
|
"""
|
||||||
URL or path to the Web Application files.
|
URL or path to the Web Application files.
|
||||||
Funkwhale needs access to it so that it can inject <meta> tags relevant
|
FunQuail needs access to it so that it can inject <meta> tags relevant
|
||||||
to the given page (e.g page title, cover, etc.).
|
to the given page (e.g page title, cover, etc.).
|
||||||
|
|
||||||
If a URL is specified, the index.html file will be fetched through HTTP.
|
If a URL is specified, the index.html file will be fetched through HTTP.
|
||||||
|
|
@ -193,20 +193,20 @@ Use something like ``/srv/funkwhale/front/dist/`` if the web processes shows
|
||||||
request errors related to this.
|
request errors related to this.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
FUNKWHALE_SPA_HTML_CACHE_DURATION = env.int(
|
FUNQUAIL_SPA_HTML_CACHE_DURATION = env.int(
|
||||||
"FUNKWHALE_SPA_HTML_CACHE_DURATION", default=60 * 15
|
"FUNQUAIL_SPA_HTML_CACHE_DURATION", default=60 * 15
|
||||||
)
|
)
|
||||||
FUNKWHALE_EMBED_URL = env("FUNKWHALE_EMBED_URL", default=FUNKWHALE_URL + "/embed.html")
|
FUNQUAIL_EMBED_URL = env("FUNQUAIL_EMBED_URL", default=FUNQUAIL_URL + "/embed.html")
|
||||||
FUNKWHALE_SPA_REWRITE_MANIFEST = env.bool(
|
FUNQUAIL_SPA_REWRITE_MANIFEST = env.bool(
|
||||||
"FUNKWHALE_SPA_REWRITE_MANIFEST", default=True
|
"FUNQUAIL_SPA_REWRITE_MANIFEST", default=True
|
||||||
)
|
)
|
||||||
FUNKWHALE_SPA_REWRITE_MANIFEST_URL = env.bool(
|
FUNQUAIL_SPA_REWRITE_MANIFEST_URL = env.bool(
|
||||||
"FUNKWHALE_SPA_REWRITE_MANIFEST_URL", default=None
|
"FUNQUAIL_SPA_REWRITE_MANIFEST_URL", default=None
|
||||||
)
|
)
|
||||||
|
|
||||||
APP_NAME = "Funkwhale"
|
APP_NAME = "FunQuail"
|
||||||
|
|
||||||
FEDERATION_HOSTNAME = env("FEDERATION_HOSTNAME", default=FUNKWHALE_HOSTNAME).lower()
|
FEDERATION_HOSTNAME = env("FEDERATION_HOSTNAME", default=FUNQUAIL_HOSTNAME).lower()
|
||||||
FEDERATION_SERVICE_ACTOR_USERNAME = env(
|
FEDERATION_SERVICE_ACTOR_USERNAME = env(
|
||||||
"FEDERATION_SERVICE_ACTOR_USERNAME", default="service"
|
"FEDERATION_SERVICE_ACTOR_USERNAME", default="service"
|
||||||
)
|
)
|
||||||
|
|
@ -219,9 +219,9 @@ actor or channel.
|
||||||
More pages means more content will be loaded, but will require more resources.
|
More pages means more content will be loaded, but will require more resources.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=[]) + [FUNKWHALE_HOSTNAME]
|
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=[]) + [FUNQUAIL_HOSTNAME]
|
||||||
"""
|
"""
|
||||||
List of allowed hostnames for which the Funkwhale server will answer.
|
List of allowed hostnames for which the FunQuail server will answer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# APP CONFIGURATION
|
# APP CONFIGURATION
|
||||||
|
|
@ -286,7 +286,7 @@ LOCAL_APPS = (
|
||||||
|
|
||||||
ADDITIONAL_APPS = env.list("ADDITIONAL_APPS", default=[])
|
ADDITIONAL_APPS = env.list("ADDITIONAL_APPS", default=[])
|
||||||
"""
|
"""
|
||||||
List of Django apps to load in addition to Funkwhale plugins and apps.
|
List of Django apps to load in addition to FunQuail plugins and apps.
|
||||||
"""
|
"""
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
LOCAL_APPS
|
LOCAL_APPS
|
||||||
|
|
@ -341,11 +341,11 @@ FIXTURE_DIRS = (str(APPS_DIR.path("fixtures")),)
|
||||||
# EMAIL
|
# EMAIL
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
DEFAULT_FROM_EMAIL = env(
|
DEFAULT_FROM_EMAIL = env(
|
||||||
"DEFAULT_FROM_EMAIL", default=f"Funkwhale <noreply@{FUNKWHALE_HOSTNAME}>"
|
"DEFAULT_FROM_EMAIL", default=f"FunQuail <noreply@{FUNQUAIL_HOSTNAME}>"
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
The name and email address used to send system emails.
|
The name and email address used to send system emails.
|
||||||
Defaults to ``Funkwhale <noreply@yourdomain>``.
|
Defaults to ``FunQuail <noreply@yourdomain>``.
|
||||||
|
|
||||||
Available formats:
|
Available formats:
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ Available formats:
|
||||||
- ``<Email address>``
|
- ``<Email address>``
|
||||||
|
|
||||||
"""
|
"""
|
||||||
EMAIL_SUBJECT_PREFIX = env("EMAIL_SUBJECT_PREFIX", default="[Funkwhale] ")
|
EMAIL_SUBJECT_PREFIX = env("EMAIL_SUBJECT_PREFIX", default="[FunQuail] ")
|
||||||
"""
|
"""
|
||||||
Subject prefix for system emails.
|
Subject prefix for system emails.
|
||||||
"""
|
"""
|
||||||
|
|
@ -542,7 +542,7 @@ STATIC_ROOT = env("STATIC_ROOT", default=str(ROOT_DIR("staticfiles")))
|
||||||
The path where static files are collected.
|
The path where static files are collected.
|
||||||
"""
|
"""
|
||||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
|
||||||
STATIC_URL = env("STATIC_URL", default=FUNKWHALE_URL + "/staticfiles/")
|
STATIC_URL = env("STATIC_URL", default=FUNQUAIL_URL + "/staticfiles/")
|
||||||
DEFAULT_FILE_STORAGE = "funkwhale_api.common.storage.ASCIIFileSystemStorage"
|
DEFAULT_FILE_STORAGE = "funkwhale_api.common.storage.ASCIIFileSystemStorage"
|
||||||
|
|
||||||
PROXY_MEDIA = env.bool("PROXY_MEDIA", default=True)
|
PROXY_MEDIA = env.bool("PROXY_MEDIA", default=True)
|
||||||
|
|
@ -652,10 +652,10 @@ The path where you store media files (such as album covers or audio tracks)
|
||||||
on your system. Make sure this directory actually exists.
|
on your system. Make sure this directory actually exists.
|
||||||
"""
|
"""
|
||||||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
|
||||||
MEDIA_URL = env("MEDIA_URL", default=FUNKWHALE_URL + "/media/")
|
MEDIA_URL = env("MEDIA_URL", default=FUNQUAIL_URL + "/media/")
|
||||||
"""
|
"""
|
||||||
The URL from which your pod serves media files. Change this if you're hosting media
|
The URL from which your pod serves media files. Change this if you're hosting media
|
||||||
files on a separate domain, or if you host Funkwhale on a non-standard port.
|
files on a separate domain, or if you host FunQuail on a non-standard port.
|
||||||
"""
|
"""
|
||||||
FILE_UPLOAD_PERMISSIONS = 0o644
|
FILE_UPLOAD_PERMISSIONS = 0o644
|
||||||
|
|
||||||
|
|
@ -663,7 +663,7 @@ ATTACHMENTS_UNATTACHED_PRUNE_DELAY = env.int(
|
||||||
"ATTACHMENTS_UNATTACHED_PRUNE_DELAY", default=3600 * 24
|
"ATTACHMENTS_UNATTACHED_PRUNE_DELAY", default=3600 * 24
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
The delay in seconds before Funkwhale prunes uploaded but detached attachments
|
The delay in seconds before FunQuail prunes uploaded but detached attachments
|
||||||
from the system.
|
from the system.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -991,7 +991,7 @@ Validators include password length, common words, similarity with username.
|
||||||
"""
|
"""
|
||||||
if DISABLE_PASSWORD_VALIDATORS:
|
if DISABLE_PASSWORD_VALIDATORS:
|
||||||
AUTH_PASSWORD_VALIDATORS = []
|
AUTH_PASSWORD_VALIDATORS = []
|
||||||
ACCOUNT_ADAPTER = "funkwhale_api.users.adapters.FunkwhaleAccountAdapter"
|
ACCOUNT_ADAPTER = "funkwhale_api.users.adapters.FunQuailAccountAdapter"
|
||||||
CORS_ORIGIN_ALLOW_ALL = True
|
CORS_ORIGIN_ALLOW_ALL = True
|
||||||
# CORS_ORIGIN_WHITELIST = (
|
# CORS_ORIGIN_WHITELIST = (
|
||||||
# 'localhost',
|
# 'localhost',
|
||||||
|
|
@ -1000,7 +1000,7 @@ CORS_ORIGIN_ALLOW_ALL = True
|
||||||
CORS_ALLOW_CREDENTIALS = True
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
"DEFAULT_PAGINATION_CLASS": "funkwhale_api.common.pagination.FunkwhalePagination",
|
"DEFAULT_PAGINATION_CLASS": "funkwhale_api.common.pagination.FunQuailPagination",
|
||||||
"PAGE_SIZE": 25,
|
"PAGE_SIZE": 25,
|
||||||
"DEFAULT_PARSER_CLASSES": (
|
"DEFAULT_PARSER_CLASSES": (
|
||||||
"rest_framework.parsers.JSONParser",
|
"rest_framework.parsers.JSONParser",
|
||||||
|
|
@ -1034,7 +1034,7 @@ of the service, especially on public pods .
|
||||||
if THROTTLING_ENABLED:
|
if THROTTLING_ENABLED:
|
||||||
REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"] = env.list(
|
REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"] = env.list(
|
||||||
"THROTTLE_CLASSES",
|
"THROTTLE_CLASSES",
|
||||||
default=["funkwhale_api.common.throttling.FunkwhaleThrottle"],
|
default=["funkwhale_api.common.throttling.FunQuailThrottle"],
|
||||||
)
|
)
|
||||||
|
|
||||||
THROTTLING_SCOPES = {
|
THROTTLING_SCOPES = {
|
||||||
|
|
@ -1296,7 +1296,7 @@ Default timeout for external requests.
|
||||||
|
|
||||||
MUSIC_DIRECTORY_PATH = env("MUSIC_DIRECTORY_PATH", default=None)
|
MUSIC_DIRECTORY_PATH = env("MUSIC_DIRECTORY_PATH", default=None)
|
||||||
"""
|
"""
|
||||||
The path on your server where Funkwhale places
|
The path on your server where FunQuail places
|
||||||
files from in-place imports. This path needs to be
|
files from in-place imports. This path needs to be
|
||||||
readable by the webserver and ``api`` and ``worker``
|
readable by the webserver and ``api`` and ``worker``
|
||||||
processes.
|
processes.
|
||||||
|
|
@ -1408,9 +1408,9 @@ INSTANCE_SUPPORT_MESSAGE_DELAY = env.int("INSTANCE_SUPPORT_MESSAGE_DELAY", defau
|
||||||
The number of days before your pod shows the "support your pod" message.
|
The number of days before your pod shows the "support your pod" message.
|
||||||
The timer starts after the user signs up.
|
The timer starts after the user signs up.
|
||||||
"""
|
"""
|
||||||
FUNKWHALE_SUPPORT_MESSAGE_DELAY = env.int("FUNKWHALE_SUPPORT_MESSAGE_DELAY", default=15)
|
FUNQUAIL_SUPPORT_MESSAGE_DELAY = env.int("FUNQUAIL_SUPPORT_MESSAGE_DELAY", default=15)
|
||||||
"""
|
"""
|
||||||
The number of days before your pod shows the "support Funkwhale" message.
|
The number of days before your pod shows the "support FunQuail" message.
|
||||||
The timer starts after the user signs up.
|
The timer starts after the user signs up.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -1466,7 +1466,7 @@ IGNORE_FORWARDED_HOST_AND_PROTO = env.bool(
|
||||||
"IGNORE_FORWARDED_HOST_AND_PROTO", default=True
|
"IGNORE_FORWARDED_HOST_AND_PROTO", default=True
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
Use :attr:`FUNKWHALE_HOSTNAME` and :attr:`FUNKWHALE_PROTOCOL`
|
Use :attr:`FUNQUAIL_HOSTNAME` and :attr:`FUNQUAIL_PROTOCOL`
|
||||||
instead of request header.
|
instead of request header.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ CSRF_TRUSTED_ORIGINS = [o for o in ALLOWED_HOSTS]
|
||||||
|
|
||||||
REST_FRAMEWORK["DEFAULT_SCHEMA_CLASS"] = "funkwhale_api.schema.CustomAutoSchema"
|
REST_FRAMEWORK["DEFAULT_SCHEMA_CLASS"] = "funkwhale_api.schema.CustomAutoSchema"
|
||||||
SPECTACULAR_SETTINGS = {
|
SPECTACULAR_SETTINGS = {
|
||||||
"TITLE": "Funkwhale API",
|
"TITLE": "FunQuail API",
|
||||||
"DESCRIPTION": open("Readme.md").read(),
|
"DESCRIPTION": open("Readme.md").read(),
|
||||||
"VERSION": funkwhale_version,
|
"VERSION": funkwhale_version,
|
||||||
"SCHEMA_PATH_PREFIX": "/api/(v[0-9])?",
|
"SCHEMA_PATH_PREFIX": "/api/(v[0-9])?",
|
||||||
|
|
@ -112,7 +112,7 @@ SPECTACULAR_SETTINGS = {
|
||||||
"SERVERS": [
|
"SERVERS": [
|
||||||
{"url": "https://demo.funkwhale.audio", "description": "Demo Server"},
|
{"url": "https://demo.funkwhale.audio", "description": "Demo Server"},
|
||||||
{
|
{
|
||||||
"url": "https://funkwhale.audio",
|
"url": "https://funquail.laidback.moe",
|
||||||
"description": "Read server with real content",
|
"description": "Read server with real content",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -121,7 +121,7 @@ SPECTACULAR_SETTINGS = {
|
||||||
"variables": {
|
"variables": {
|
||||||
"domain": {
|
"domain": {
|
||||||
"default": "yourdomain",
|
"default": "yourdomain",
|
||||||
"description": "Your Funkwhale Domain",
|
"description": "Your FunQuail Domain",
|
||||||
},
|
},
|
||||||
"protocol": {"enum": ["http", "https"], "default": "https"},
|
"protocol": {"enum": ["http", "https"], "default": "https"},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.environ.setdefault("FUNKWHALE_URL", "http://funkwhale.dev")
|
os.environ.setdefault("FUNQUAIL_URL", "http://funkwhale.dev")
|
||||||
|
|
||||||
from .common import * # noqa
|
from .common import * # noqa
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ v1_patterns += [
|
||||||
r"^",
|
r"^",
|
||||||
include(("funkwhale_api.users.api_urls", "users"), namespace="users"),
|
include(("funkwhale_api.users.api_urls", "users"), namespace="users"),
|
||||||
),
|
),
|
||||||
# XXX: remove if Funkwhale 1.1
|
# XXX: remove if FunQuail 1.1
|
||||||
url(
|
url(
|
||||||
r"^users/",
|
r"^users/",
|
||||||
include(("funkwhale_api.users.api_urls", "users"), namespace="users-nested"),
|
include(("funkwhale_api.users.api_urls", "users"), namespace="users-nested"),
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ funkwhale-manage migrate
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
exec gunicorn config.asgi:application \
|
exec gunicorn config.asgi:application \
|
||||||
--workers "${FUNKWHALE_WEB_WORKERS-1}" \
|
--workers "${FUNQUAIL_WEB_WORKERS-1}" \
|
||||||
--worker-class uvicorn.workers.UvicornWorker \
|
--worker-class uvicorn.workers.UvicornWorker \
|
||||||
--bind 0.0.0.0:5000 \
|
--bind 0.0.0.0:5000 \
|
||||||
${GUNICORN_ARGS-}
|
${GUNICORN_ARGS-}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ def channel_detail(query, redirect_to_ap):
|
||||||
raise middleware.ApiRedirect(obj.actor.fid)
|
raise middleware.ApiRedirect(obj.actor.fid)
|
||||||
|
|
||||||
obj_url = utils.join_url(
|
obj_url = utils.join_url(
|
||||||
settings.FUNKWHALE_URL,
|
settings.FUNQUAIL_URL,
|
||||||
utils.spa_reverse(
|
utils.spa_reverse(
|
||||||
"channel_detail", kwargs={"username": obj.actor.full_username}
|
"channel_detail", kwargs={"username": obj.actor.full_username}
|
||||||
),
|
),
|
||||||
|
|
@ -72,7 +72,7 @@ def channel_detail(query, redirect_to_ap):
|
||||||
"rel": "alternate",
|
"rel": "alternate",
|
||||||
"type": "application/json+oembed",
|
"type": "application/json+oembed",
|
||||||
"href": (
|
"href": (
|
||||||
utils.join_url(settings.FUNKWHALE_URL, reverse("api:v1:oembed"))
|
utils.join_url(settings.FUNQUAIL_URL, reverse("api:v1:oembed"))
|
||||||
+ f"?format=json&url={urllib.parse.quote_plus(obj_url)}"
|
+ f"?format=json&url={urllib.parse.quote_plus(obj_url)}"
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +116,7 @@ class ChannelViewSet(
|
||||||
opml = serializers.get_opml(
|
opml = serializers.get_opml(
|
||||||
channels=queryset,
|
channels=queryset,
|
||||||
date=timezone.now(),
|
date=timezone.now(),
|
||||||
title="Funkwhale channels OPML export",
|
title="FunQuail channels OPML export",
|
||||||
)
|
)
|
||||||
xml_body = renderers.render_xml(renderers.dict_to_xml_tree("opml", opml))
|
xml_body = renderers.render_xml(renderers.dict_to_xml_tree("opml", opml))
|
||||||
return http.HttpResponse(xml_body, content_type="application/xml")
|
return http.HttpResponse(xml_body, content_type="application/xml")
|
||||||
|
|
@ -24,7 +24,7 @@ def install(plugin):
|
||||||
return click.echo("No plugin provided")
|
return click.echo("No plugin provided")
|
||||||
|
|
||||||
click.echo("Installing plugins…")
|
click.echo("Installing plugins…")
|
||||||
pip_install(list(plugin), settings.FUNKWHALE_PLUGINS_PATH)
|
pip_install(list(plugin), settings.FUNQUAIL_PLUGINS_PATH)
|
||||||
|
|
||||||
|
|
||||||
def pip_install(deps, target):
|
def pip_install(deps, target):
|
||||||
|
|
@ -133,7 +133,7 @@ def users():
|
||||||
"--password",
|
"--password",
|
||||||
prompt="Password (leave empty to have a random one generated)",
|
prompt="Password (leave empty to have a random one generated)",
|
||||||
hide_input=True,
|
hide_input=True,
|
||||||
envvar="FUNKWHALE_CLI_USER_PASSWORD",
|
envvar="FUNQUAIL_CLI_USER_PASSWORD",
|
||||||
default="",
|
default="",
|
||||||
help="If empty, a random password will be generated and displayed in console output",
|
help="If empty, a random password will be generated and displayed in console output",
|
||||||
)
|
)
|
||||||
|
|
@ -207,7 +207,7 @@ def delete(username, hard):
|
||||||
@click.option("--permission-library/--no-permission-library", default=None)
|
@click.option("--permission-library/--no-permission-library", default=None)
|
||||||
@click.option("--permission-moderation/--no-permission-moderation", default=None)
|
@click.option("--permission-moderation/--no-permission-moderation", default=None)
|
||||||
@click.option("--permission-settings/--no-permission-settings", default=None)
|
@click.option("--permission-settings/--no-permission-settings", default=None)
|
||||||
@click.option("--password", default=None, envvar="FUNKWHALE_CLI_USER_UPDATE_PASSWORD")
|
@click.option("--password", default=None, envvar="FUNQUAIL_CLI_USER_UPDATE_PASSWORD")
|
||||||
@click.option(
|
@click.option(
|
||||||
"-q",
|
"-q",
|
||||||
"--upload-quota",
|
"--upload-quota",
|
||||||
|
|
@ -14,7 +14,7 @@ class Command(BaseCommand):
|
||||||
"""
|
"""
|
||||||
if not os.environ.get("FORCE") == "1":
|
if not os.environ.get("FORCE") == "1":
|
||||||
raise CommandError(
|
raise CommandError(
|
||||||
"Running createsuperuser on your Funkwhale instance bypasses some of our checks "
|
"Running createsuperuser on your FunQuail instance bypasses some of our checks "
|
||||||
"which can lead to unexpected behavior of your instance. We therefore suggest to "
|
"which can lead to unexpected behavior of your instance. We therefore suggest to "
|
||||||
"run `funkwhale-manage fw users create --superuser` instead."
|
"run `funkwhale-manage fw users create --superuser` instead."
|
||||||
)
|
)
|
||||||
|
|
@ -32,7 +32,7 @@ class Command(BaseCommand):
|
||||||
self.stdout.write("")
|
self.stdout.write("")
|
||||||
self.stdout.write("Available commands:")
|
self.stdout.write("Available commands:")
|
||||||
self.stdout.write("init - Initialize gitpod workspace")
|
self.stdout.write("init - Initialize gitpod workspace")
|
||||||
self.stdout.write("dev - Run Funkwhale in development mode with debug server")
|
self.stdout.write("dev - Run FunQuail in development mode with debug server")
|
||||||
self.stdout.write("")
|
self.stdout.write("")
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
|
|
@ -14,7 +14,7 @@ class Command(BaseCommand):
|
||||||
force = os.environ.get("FORCE") == "1"
|
force = os.environ.get("FORCE") == "1"
|
||||||
if not force:
|
if not force:
|
||||||
raise CommandError(
|
raise CommandError(
|
||||||
"Running makemigrations on your Funkwhale instance can have desastrous"
|
"Running makemigrations on your FunQuail instance can have desastrous"
|
||||||
" consequences. This command is disabled, and should only be run in "
|
" consequences. This command is disabled, and should only be run in "
|
||||||
"development environments."
|
"development environments."
|
||||||
)
|
)
|
||||||
|
|
@ -31,11 +31,11 @@ def should_fallback_to_spa(path):
|
||||||
|
|
||||||
|
|
||||||
def serve_spa(request):
|
def serve_spa(request):
|
||||||
html = get_spa_html(settings.FUNKWHALE_SPA_HTML_ROOT)
|
html = get_spa_html(settings.FUNQUAIL_SPA_HTML_ROOT)
|
||||||
head, tail = html.split("</head>", 1)
|
head, tail = html.split("</head>", 1)
|
||||||
if settings.FUNKWHALE_SPA_REWRITE_MANIFEST:
|
if settings.FUNQUAIL_SPA_REWRITE_MANIFEST:
|
||||||
new_url = (
|
new_url = (
|
||||||
settings.FUNKWHALE_SPA_REWRITE_MANIFEST_URL
|
settings.FUNQUAIL_SPA_REWRITE_MANIFEST_URL
|
||||||
or federation_utils.full_url(urls.reverse("api:v1:instance:spa-manifest"))
|
or federation_utils.full_url(urls.reverse("api:v1:instance:spa-manifest"))
|
||||||
)
|
)
|
||||||
title = preferences.get("instance__name")
|
title = preferences.get("instance__name")
|
||||||
|
|
@ -128,7 +128,7 @@ def get_spa_file(spa_url, name):
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
response.encoding = "utf-8"
|
response.encoding = "utf-8"
|
||||||
content = response.text
|
content = response.text
|
||||||
caches["local"].set(cache_key, content, settings.FUNKWHALE_SPA_HTML_CACHE_DURATION)
|
caches["local"].set(cache_key, content, settings.FUNQUAIL_SPA_HTML_CACHE_DURATION)
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -151,13 +151,13 @@ def get_default_head_tags(path):
|
||||||
"tag": "meta",
|
"tag": "meta",
|
||||||
"property": "og:image",
|
"property": "og:image",
|
||||||
"content": utils.join_url(
|
"content": utils.join_url(
|
||||||
settings.FUNKWHALE_URL, "/android-chrome-512x512.png"
|
settings.FUNQUAIL_URL, "/android-chrome-512x512.png"
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "meta",
|
"tag": "meta",
|
||||||
"property": "og:url",
|
"property": "og:url",
|
||||||
"content": utils.join_url(settings.FUNKWHALE_URL, path),
|
"content": utils.join_url(settings.FUNQUAIL_URL, path),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from rest_framework.pagination import PageNumberPagination, _positive_int
|
from rest_framework.pagination import PageNumberPagination, _positive_int
|
||||||
|
|
||||||
|
|
||||||
class FunkwhalePagination(PageNumberPagination):
|
class FunQuailPagination(PageNumberPagination):
|
||||||
page_size_query_param = "page_size"
|
page_size_query_param = "page_size"
|
||||||
default_max_page_size = 50
|
default_max_page_size = 50
|
||||||
default_page_size = None
|
default_page_size = None
|
||||||
|
|
@ -99,7 +99,7 @@ def update_orphan_uploads(open_api, stdout):
|
||||||
def set_fid(queryset, path, stdout):
|
def set_fid(queryset, path, stdout):
|
||||||
model = queryset.model._meta.label
|
model = queryset.model._meta.label
|
||||||
qs = queryset.filter(fid=None)
|
qs = queryset.filter(fid=None)
|
||||||
base_url = f"{settings.FUNKWHALE_URL}{path}"
|
base_url = f"{settings.FUNQUAIL_URL}{path}"
|
||||||
stdout.write(f"* Assigning federation ids to {model} entries (path: {base_url})")
|
stdout.write(f"* Assigning federation ids to {model} entries (path: {base_url})")
|
||||||
new_fid = functions.Concat(Value(base_url), F("uuid"), output_field=CharField())
|
new_fid = functions.Concat(Value(base_url), F("uuid"), output_field=CharField())
|
||||||
total = qs.update(fid=new_fid)
|
total = qs.update(fid=new_fid)
|
||||||
|
|
@ -119,7 +119,7 @@ def generate_actor_urls(part, stdout):
|
||||||
stdout.write(f"* Update {field} for local actors...")
|
stdout.write(f"* Update {field} for local actors...")
|
||||||
|
|
||||||
queryset = federation_models.Actor.objects.local().filter(**{field: None})
|
queryset = federation_models.Actor.objects.local().filter(**{field: None})
|
||||||
base_url = f"{settings.FUNKWHALE_URL}/federation/actors/"
|
base_url = f"{settings.FUNQUAIL_URL}/federation/actors/"
|
||||||
|
|
||||||
new_field = functions.Concat(
|
new_field = functions.Concat(
|
||||||
Value(base_url),
|
Value(base_url),
|
||||||
|
|
@ -4,7 +4,7 @@ from django.conf import settings
|
||||||
import funkwhale_api
|
import funkwhale_api
|
||||||
|
|
||||||
|
|
||||||
class FunkwhaleSession(requests.Session):
|
class FunQuailSession(requests.Session):
|
||||||
def request(self, *args, **kwargs):
|
def request(self, *args, **kwargs):
|
||||||
kwargs.setdefault("verify", settings.EXTERNAL_REQUESTS_VERIFY_SSL)
|
kwargs.setdefault("verify", settings.EXTERNAL_REQUESTS_VERIFY_SSL)
|
||||||
kwargs.setdefault("timeout", settings.EXTERNAL_REQUESTS_TIMEOUT)
|
kwargs.setdefault("timeout", settings.EXTERNAL_REQUESTS_TIMEOUT)
|
||||||
|
|
@ -13,11 +13,11 @@ class FunkwhaleSession(requests.Session):
|
||||||
|
|
||||||
def get_user_agent():
|
def get_user_agent():
|
||||||
return "python-requests (funkwhale/{}; +{})".format(
|
return "python-requests (funkwhale/{}; +{})".format(
|
||||||
funkwhale_api.__version__, settings.FUNKWHALE_URL
|
funkwhale_api.__version__, settings.FUNQUAIL_URL
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_session():
|
def get_session():
|
||||||
s = FunkwhaleSession()
|
s = FunQuailSession()
|
||||||
s.headers["User-Agent"] = get_user_agent()
|
s.headers["User-Agent"] = get_user_agent()
|
||||||
return s
|
return s
|
||||||
|
|
@ -34,7 +34,7 @@ def get_scope_for_action_and_ident_type(action, ident_type, view_conf={}):
|
||||||
|
|
||||||
def get_status(ident, now):
|
def get_status(ident, now):
|
||||||
data = []
|
data = []
|
||||||
throttle = FunkwhaleThrottle()
|
throttle = FunQuailThrottle()
|
||||||
for key in sorted(settings.THROTTLING_RATES.keys()):
|
for key in sorted(settings.THROTTLING_RATES.keys()):
|
||||||
conf = settings.THROTTLING_RATES[key]
|
conf = settings.THROTTLING_RATES[key]
|
||||||
row_data = {"id": key, "rate": conf["rate"], "description": conf["description"]}
|
row_data = {"id": key, "rate": conf["rate"], "description": conf["description"]}
|
||||||
|
|
@ -79,7 +79,7 @@ def get_status(ident, now):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
class FunkwhaleThrottle(rest_throttling.SimpleRateThrottle):
|
class FunQuailThrottle(rest_throttling.SimpleRateThrottle):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -132,7 +132,7 @@ DummyView = collections.namedtuple("DummyView", "action throttling_scopes")
|
||||||
|
|
||||||
def check_request(request, scope):
|
def check_request(request, scope):
|
||||||
"""
|
"""
|
||||||
A simple wrapper around FunkwhaleThrottle for views that aren't API views
|
A simple wrapper around FunQuailThrottle for views that aren't API views
|
||||||
or cannot use rest_framework automatic throttling.
|
or cannot use rest_framework automatic throttling.
|
||||||
|
|
||||||
Raise TooManyRequests if limit is reached.
|
Raise TooManyRequests if limit is reached.
|
||||||
|
|
@ -144,7 +144,7 @@ def check_request(request, scope):
|
||||||
action=scope,
|
action=scope,
|
||||||
throttling_scopes={scope: {"anonymous": scope, "authenticated": scope}},
|
throttling_scopes={scope: {"anonymous": scope, "authenticated": scope}},
|
||||||
)
|
)
|
||||||
throttle = FunkwhaleThrottle()
|
throttle = FunQuailThrottle()
|
||||||
if not throttle.allow_request(request, view):
|
if not throttle.allow_request(request, view):
|
||||||
raise TooManyRequests()
|
raise TooManyRequests()
|
||||||
return True
|
return True
|
||||||
|
|
@ -452,7 +452,7 @@ def update_modification_date(obj, field="modification_date", date=None):
|
||||||
|
|
||||||
def monkey_patch_request_build_absolute_uri():
|
def monkey_patch_request_build_absolute_uri():
|
||||||
"""
|
"""
|
||||||
Since we have FUNKWHALE_HOSTNAME and PROTOCOL hardcoded in settings, we can
|
Since we have FUNQUAIL_HOSTNAME and PROTOCOL hardcoded in settings, we can
|
||||||
override django's multisite logic which can break when reverse proxy aren't configured
|
override django's multisite logic which can break when reverse proxy aren't configured
|
||||||
properly.
|
properly.
|
||||||
"""
|
"""
|
||||||
|
|
@ -460,14 +460,14 @@ def monkey_patch_request_build_absolute_uri():
|
||||||
|
|
||||||
def scheme(self):
|
def scheme(self):
|
||||||
if settings.IGNORE_FORWARDED_HOST_AND_PROTO:
|
if settings.IGNORE_FORWARDED_HOST_AND_PROTO:
|
||||||
return settings.FUNKWHALE_PROTOCOL
|
return settings.FUNQUAIL_PROTOCOL
|
||||||
return builtin_scheme.fget(self)
|
return builtin_scheme.fget(self)
|
||||||
|
|
||||||
builtin_get_host = request.HttpRequest.get_host
|
builtin_get_host = request.HttpRequest.get_host
|
||||||
|
|
||||||
def get_host(self):
|
def get_host(self):
|
||||||
if settings.IGNORE_FORWARDED_HOST_AND_PROTO:
|
if settings.IGNORE_FORWARDED_HOST_AND_PROTO:
|
||||||
return settings.FUNKWHALE_HOSTNAME
|
return settings.FUNQUAIL_HOSTNAME
|
||||||
return builtin_get_host(self)
|
return builtin_get_host(self)
|
||||||
|
|
||||||
request.HttpRequest.scheme = property(scheme)
|
request.HttpRequest.scheme = property(scheme)
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue