diff --git a/mipac/models/meta.py b/mipac/models/meta.py index ed2707ca..a525f281 100644 --- a/mipac/models/meta.py +++ b/mipac/models/meta.py @@ -8,7 +8,9 @@ IAdminMeta, IFeatures, ISensitiveMediaDetection, - ISensitiveMediaDetectionSentivity, IMetaDetailed, IMetaDetailedOnly, + ISensitiveMediaDetectionSentivity, + IMetaDetailed, + IMetaDetailedOnly, ) if TYPE_CHECKING: @@ -92,263 +94,462 @@ class Meta(PartialMeta[IMetaDetailed], MetaDetailedOnly): def __init__(self, instance_metadata: IMetaDetailed, *, client: ClientManager) -> None: super().__init__(instance_metadata, client=client) - class AdminMeta: - def __init__(self, raw_meta: IAdminMeta, *, client: ClientManager) -> None: - self.__raw_meta: IAdminMeta = raw_meta - self.__client: ClientManager = client + def __init__(self, raw_admin_meta: IAdminMeta): + self.__raw_admin_meta: IAdminMeta = raw_admin_meta @property - def maintainer_name(self) -> str | None: - return self.__raw_meta["maintainer_name"] + def cache_remote_files(self): + return self.__raw_admin_meta["cache_remote_files"] @property - def maintainer_email(self) -> str | None: - return self.__raw_meta["maintainer_email"] + def cache_remote_sensitive_files(self): + return self.__raw_admin_meta["cache_remote_sensitive_files"] @property - def version(self) -> str: - return self.__raw_meta["version"] + def email_required_for_signup(self): + return self.__raw_admin_meta["email_required_for_signup"] @property - def name(self) -> str | None: - return self.__raw_meta["name"] + def enable_hcaptcha(self): + return self.__raw_admin_meta["enable_hcaptcha"] @property - def short_name(self) -> str | None: - return self.__raw_meta["short_name"] + def hcaptcha_site_key(self): + return self.__raw_admin_meta["hcaptcha_site_key"] @property - def uri(self) -> str: - return self.__raw_meta["uri"] + def enable_mcaptcha(self): + return self.__raw_admin_meta["enable_mcaptcha"] @property - def description(self) -> str | None: - return self.__raw_meta["description"] + def mcaptcha_site_key(self): + return self.__raw_admin_meta["mcaptcha_site_key"] @property - def langs(self) -> list[str]: - return self.__raw_meta["langs"] + def mcaptcha_instance_url(self): + return self.__raw_admin_meta["mcaptcha_instance_url"] @property - def tos_url(self) -> str: - return self.__raw_meta["tos_url"] + def enable_recaptcha(self): + return self.__raw_admin_meta["enable_recaptcha"] @property - def repository_url(self) -> str: - return self.__raw_meta["repository_url"] + def recaptcha_site_key(self): + return self.__raw_admin_meta["recaptcha_site_key"] @property - def feedback_url(self) -> str: - return self.__raw_meta["feedback_url"] + def enable_turnstile(self): + return self.__raw_admin_meta["enable_turnstile"] @property - def disable_registration(self) -> bool: - return self.__raw_meta["disable_registration"] + def turnstile_site_key(self): + return self.__raw_admin_meta["turnstile_site_key"] @property - def email_required_for_signup(self) -> bool: - return self.__raw_meta["email_required_for_signup"] + def enable_testcaptcha(self): + return self.__raw_admin_meta["enable_testcaptcha"] @property - def enable_hcaptcha(self) -> bool: - return self.__raw_meta["enable_hcaptcha"] + def sw_publickey(self): + return self.__raw_admin_meta["sw_publickey"] @property - def hcaptcha_site_key(self) -> str | None: - return self.__raw_meta["hcaptcha_site_key"] + def mascot_image_url(self): + return self.__raw_admin_meta["mascot_image_url"] @property - def enable_recaptcha(self) -> bool: - return self.__raw_meta["enable_recaptcha"] + def banner_url(self): + return self.__raw_admin_meta["banner_url"] @property - def recaptcha_site_key(self) -> str: - return self.__raw_meta["recaptcha_site_key"] + def server_error_image_url(self): + return self.__raw_admin_meta["server_error_image_url"] @property - def enable_turnstile(self) -> bool: - return self.__raw_meta["enable_turnstile"] + def info_image_url(self): + return self.__raw_admin_meta["info_image_url"] @property - def turnstile_site_key(self) -> str: - return self.__raw_meta["turnstile_site_key"] + def not_found_image_url(self): + return self.__raw_admin_meta["not_found_image_url"] @property - def sw_publickey(self) -> str | None: - return self.__raw_meta["sw_publickey"] + def icon_url(self): + return self.__raw_admin_meta["icon_url"] @property - def theme_color(self) -> str: - return self.__raw_meta["theme_color"] + def app192_icon_url(self): + return self.__raw_admin_meta["app192_icon_url"] @property - def mascot_image_url(self) -> str: - return self.__raw_meta["mascot_image_url"] + def app512_icon_url(self): + return self.__raw_admin_meta["app512_icon_url"] @property - def banner_url(self) -> str | None: - return self.__raw_meta["banner_url"] + def enable_email(self): + return self.__raw_admin_meta["enable_email"] @property - def server_error_image_url(self) -> str | None: - return self.__raw_meta["server_error_image_url"] + def enable_service_worker(self): + return self.__raw_admin_meta["enable_service_worker"] @property - def not_found_image_url(self) -> str | None: - return self.__raw_meta["not_found_image_url"] + def translator_available(self): + return self.__raw_admin_meta["translator_available"] @property - def info_image_url(self) -> str | None: - return self.__raw_meta["info_image_url"] + def silenced_hosts(self): + return self.__raw_admin_meta.get("silenced_hosts") @property - def icon_url(self) -> str | None: - return self.__raw_meta["icon_url"] + def media_silenced_hosts(self): + return self.__raw_admin_meta["media_silenced_hosts"] @property - def appint_icon_url(self) -> str | None: - return self.__raw_meta["appint_icon_url"] + def pinned_users(self): + return self.__raw_admin_meta["pinned_users"] @property - def background_image_url(self) -> str | None: - return self.__raw_meta["background_image_url"] + def hidden_tags(self): + return self.__raw_admin_meta["hidden_tags"] @property - def logo_image_url(self) -> str | None: - return self.__raw_meta["logo_image_url"] + def blocked_hosts(self): + return self.__raw_admin_meta["blocked_hosts"] @property - def default_light_theme(self) -> str | None: - return self.__raw_meta["default_light_theme"] + def sensitive_words(self): + return self.__raw_admin_meta["sensitive_words"] @property - def default_dark_theme(self) -> str | None: - return self.__raw_meta["default_dark_theme"] + def prohibited_words(self): + return self.__raw_admin_meta["prohibited_words"] @property - def enable_email(self) -> bool: - return self.__raw_meta["enable_email"] + def prohibited_words_for_name_of_user(self): + return self.__raw_admin_meta["prohibited_words_for_name_of_user"] @property - def enable_service_worker(self) -> bool: - return self.__raw_meta["enable_service_worker"] + def banned_email_domains(self): + return self.__raw_admin_meta.get("banned_email_domains") @property - def translator_available(self) -> bool: - return self.__raw_meta["translator_available"] + def preserved_usernames(self): + return self.__raw_admin_meta["preserved_usernames"] @property - def cache_remote_files(self) -> bool: - return self.__raw_meta["cache_remote_files"] + def hcaptcha_secret_key(self): + return self.__raw_admin_meta["hcaptcha_secret_key"] @property - def cache_remote_sensitive_files(self) -> bool: - return self.__raw_meta["cache_remote_sensitive_files"] + def mcaptcha_secret_key(self): + return self.__raw_admin_meta["mcaptcha_secret_key"] @property - def pinned_users(self) -> list[str]: - return self.__raw_meta["pinned_users"] + def recaptcha_secret_key(self): + return self.__raw_admin_meta["recaptcha_secret_key"] @property - def hidden_tags(self) -> list[str]: - return self.__raw_meta["hidden_tags"] + def turnstile_secret_key(self): + return self.__raw_admin_meta["turnstile_secret_key"] @property - def blocked_hosts(self) -> list[str]: - return self.__raw_meta["blocked_hosts"] + def sensitive_media_detection(self): + return self.__raw_admin_meta["sensitive_media_detection"] @property - def sensitive_words(self) -> list[str]: - return self.__raw_meta["sensitive_words"] + def sensitive_media_detection_sensitivity(self): + return self.__raw_admin_meta["sensitive_media_detection_sensitivity"] @property - def preserved_usernames(self) -> list[str]: - return self.__raw_meta["preserved_usernames"] + def set_sensitive_flag_automatically(self): + return self.__raw_admin_meta["set_sensitive_flag_automatically"] @property - def hcaptcha_secret_key(self) -> str | None: - return self.__raw_meta["hcaptcha_secret_key"] + def enable_sensitive_media_detection_for_videos(self): + return self.__raw_admin_meta["enable_sensitive_media_detection_for_videos"] @property - def recaptcha_secret_key(self) -> str: - return self.__raw_meta["recaptcha_secret_key"] + def proxy_account_id(self): + return self.__raw_admin_meta["proxy_account_id"] @property - def turnstile_secret_key(self) -> str: - return self.__raw_meta["turnstile_secret_key"] + def email(self): + return self.__raw_admin_meta["email"] @property - def sensitive_media_detection(self) -> ISensitiveMediaDetection: - return self.__raw_meta["sensitive_media_detection"] + def smtp_secure(self): + return self.__raw_admin_meta["smtp_secure"] @property - def sensitive_media_detection_sensitivity(self) -> ISensitiveMediaDetectionSentivity: - return self.__raw_meta["sensitive_media_detection_sensitivity"] + def smtp_host(self): + return self.__raw_admin_meta["smtp_host"] @property - def set_sensitive_flag_automatically(self) -> bool: - return self.__raw_meta["set_sensitive_flag_automatically"] + def smtp_port(self): + return self.__raw_admin_meta["smtp_port"] @property - def enable_sensitive_media_detection_for_videos(self) -> bool: - return self.__raw_meta["enable_sensitive_media_detection_for_videos"] + def smtp_user(self): + return self.__raw_admin_meta["smtp_user"] @property - def proxy_account_id(self) -> str: - return self.__raw_meta["proxy_account_id"] + def smtp_pass(self): + return self.__raw_admin_meta["smtp_pass"] @property - def summaly_proxy(self) -> str | None: - return self.__raw_meta["summaly_proxy"] + def sw_private_key(self): + return self.__raw_admin_meta["sw_private_key"] @property - def email(self) -> str: - return self.__raw_meta["email"] + def use_object_storage(self): + return self.__raw_admin_meta["use_object_storage"] @property - def smtp_secure(self) -> bool: - return self.__raw_meta["smtp_secure"] + def object_storage_base_url(self): + return self.__raw_admin_meta["object_storage_base_url"] @property - def smtp_host(self) -> str: - return self.__raw_meta["smtp_host"] + def object_storage_bucket(self): + return self.__raw_admin_meta["object_storage_bucket"] @property - def smtp_port(self) -> int: - return self.__raw_meta["smtp_port"] + def object_storage_prefix(self): + return self.__raw_admin_meta["object_storage_prefix"] @property - def smtp_user(self) -> str: - return self.__raw_meta["smtp_user"] + def object_storage_endpoint(self): + return self.__raw_admin_meta["object_storage_endpoint"] @property - def smtp_pass(self) -> str: - return self.__raw_meta["smtp_pass"] + def object_storage_region(self): + return self.__raw_admin_meta["object_storage_region"] @property - def sw_private_key(self) -> str | None: - return self.__raw_meta["sw_private_key"] + def object_storage_port(self): + return self.__raw_admin_meta["object_storage_port"] @property - def use_object_storage(self) -> bool: - return self.__raw_meta["use_object_storage"] + def object_storage_access_key(self): + return self.__raw_admin_meta["object_storage_access_key"] @property - def object_storage_base_url(self) -> str: - return self.__raw_meta["object_storage_base_url"] + def object_storage_secret_key(self): + return self.__raw_admin_meta["object_storage_secret_key"] @property - def object_storage_bucket(self) -> str: - return self.__raw_meta["object_storage_bucket"] + def object_storage_use_ssl(self): + return self.__raw_admin_meta["object_storage_use_ssl"] @property - def object_storage_prefix(self) -> str: - return self.__raw_meta["object_storage_prefix"] + def object_storage_use_proxy(self): + return self.__raw_admin_meta["object_storage_use_proxy"] @property - def object_storage_endpoint(self) -> str: - return self.__raw_meta["object_storage_endpoint"] + def object_storage_set_public_read(self): + return self.__raw_admin_meta["object_storage_set_public_read"] - def _get(self, key: str) -> Any | None: - return self.__raw_meta.get(key) + @property + def enable_ip_logging(self): + return self.__raw_admin_meta["enable_ip_logging"] + + @property + def enable_active_email_validation(self): + return self.__raw_admin_meta["enable_active_email_validation"] + + @property + def enable_verifymail_api(self): + return self.__raw_admin_meta["enable_verifymail_api"] + + @property + def verifymail_auth_key(self): + return self.__raw_admin_meta["verifymail_auth_key"] + + @property + def enable_truemail_api(self): + return self.__raw_admin_meta["enable_truemail_api"] + + @property + def truemail_instance(self): + return self.__raw_admin_meta["truemail_instance"] + + @property + def truemail_auth_key(self): + return self.__raw_admin_meta["truemail_auth_key"] + + @property + def enable_charts_for_remote_user(self): + return self.__raw_admin_meta["enable_charts_for_remote_user"] + + @property + def enable_charts_for_federated_instances(self): + return self.__raw_admin_meta["enable_charts_for_federated_instances"] + + @property + def enable_stats_for_federated_instances(self): + return self.__raw_admin_meta["enable_stats_for_federated_instances"] + + @property + def enable_server_machine_stats(self): + return self.__raw_admin_meta["enable_server_machine_stats"] + + @property + def enable_identicon_generation(self): + return self.__raw_admin_meta["enable_identicon_generation"] + + @property + def manifest_json_override(self): + return self.__raw_admin_meta["manifest_json_override"] + + @property + def policies(self): + return self.__raw_admin_meta["policies"] + + @property + def enable_fanout_timeline(self): + return self.__raw_admin_meta["enable_fanout_timeline"] + + @property + def enable_fanout_timeline_db_fallback(self): + return self.__raw_admin_meta["enable_fanout_timeline_db_fallback"] + + @property + def per_local_user_user_timeline_cache_max(self): + return self.__raw_admin_meta["per_local_user_user_timeline_cache_max"] + + @property + def per_remote_user_user_timeline_cache_max(self): + return self.__raw_admin_meta["per_remote_user_user_timeline_cache_max"] + + @property + def per_user_home_timeline_cache_max(self): + return self.__raw_admin_meta["per_user_home_timeline_cache_max"] + + @property + def per_user_list_timeline_cache_max(self): + return self.__raw_admin_meta["per_user_list_timeline_cache_max"] + + @property + def enable_reactions_buffering(self): + return self.__raw_admin_meta["enable_reactions_buffering"] + + @property + def notes_per_one_ad(self): + return self.__raw_admin_meta["notes_per_one_ad"] + + @property + def background_image_url(self): + return self.__raw_admin_meta["background_image_url"] + + @property + def deepl_auth_key(self): + return self.__raw_admin_meta["deepl_auth_key"] + + @property + def deepl_is_pro(self): + return self.__raw_admin_meta["deepl_is_pro"] + + @property + def default_dark_theme(self): + return self.__raw_admin_meta["default_dark_theme"] + + @property + def default_light_theme(self): + return self.__raw_admin_meta["default_light_theme"] + + @property + def description(self): + return self.__raw_admin_meta["description"] + + @property + def disable_registration(self): + return self.__raw_admin_meta["disable_registration"] + + @property + def impressum_url(self): + return self.__raw_admin_meta["impressum_url"] + + @property + def maintainer_email(self): + return self.__raw_admin_meta["maintainer_email"] + + @property + def maintainer_name(self): + return self.__raw_admin_meta["maintainer_name"] + + @property + def name(self): + return self.__raw_admin_meta["name"] + + @property + def short_name(self): + return self.__raw_admin_meta["short_name"] + + @property + def object_storage_s3_force_path_style(self): + return self.__raw_admin_meta["object_storage_s3_force_path_style"] + + @property + def privacy_policy_url(self): + return self.__raw_admin_meta["privacy_policy_url"] + + @property + def inquiry_url(self): + return self.__raw_admin_meta["inquiry_url"] + + @property + def repository_url(self): + return self.__raw_admin_meta["repository_url"] + + @property + def summaly_proxy(self): + return self.__raw_admin_meta["summaly_proxy"] + + @property + def theme_color(self): + return self.__raw_admin_meta["theme_color"] + + @property + def tos_url(self): + return self.__raw_admin_meta["tos_url"] + + @property + def uri(self): + return self.__raw_admin_meta["uri"] + + @property + def version(self): + return self.__raw_admin_meta["version"] + + @property + def url_preview_enabled(self): + return self.__raw_admin_meta["url_preview_enabled"] + + @property + def url_preview_timeout(self): + return self.__raw_admin_meta["url_preview_timeout"] + + @property + def url_preview_maximum_content_length(self): + return self.__raw_admin_meta["url_preview_maximum_content_length"] + + @property + def url_preview_require_content_length(self): + return self.__raw_admin_meta["url_preview_require_content_length"] + + @property + def url_preview_user_agent(self): + return self.__raw_admin_meta["url_preview_user_agent"] + + @property + def url_preview_summary_proxy_url(self): + return self.__raw_admin_meta["url_preview_summary_proxy_url"] + + @property + def federation(self): + return self.__raw_admin_meta["federation"] + + @property + def federation_hosts(self): + return self.__raw_admin_meta["federation_hosts"] diff --git a/mipac/types/meta.py b/mipac/types/meta.py index 2b76cede..f93c8a6c 100644 --- a/mipac/types/meta.py +++ b/mipac/types/meta.py @@ -96,91 +96,121 @@ class IMetaDetailedOnly(TypedDict): class IMeta(IPartialMeta, TypedDict): ... - -class IAdminMeta(TypedDict): # IMetaに含まれる物が多くあるけど、ない場合もあるので別にする - maintainer_name: str | None - maintainer_email: str | None - version: str - name: str | None - short_name: str | None - uri: str - description: str | None - langs: list[str] - tos_url: str - repository_url: str - feedback_url: str - disable_registration: bool +class IAdminMeta(TypedDict): + cache_remote_files: bool + cache_remote_sensitive_files: bool email_required_for_signup: bool enable_hcaptcha: bool hcaptcha_site_key: str | None + enable_mcaptcha: bool + mcaptcha_site_key: str | None + mcaptcha_instance_url: str | None enable_recaptcha: bool - recaptcha_site_key: str + recaptcha_site_key: str | None enable_turnstile: bool - turnstile_site_key: str + turnstile_site_key: str | None + enable_testcaptcha: bool sw_publickey: str | None - theme_color: str - mascot_image_url: str + mascot_image_url: str | None banner_url: str | None server_error_image_url: str | None - not_found_image_url: str | None info_image_url: str | None + not_found_image_url: str | None icon_url: str | None - appint_icon_url: str | None - appint_icon_url: str | None - background_image_url: str | None - logo_image_url: str | None - default_light_theme: str | None - default_dark_theme: str | None + app192_icon_url: str | None + app512_icon_url: str | None enable_email: bool enable_service_worker: bool translator_available: bool - cache_remote_files: bool - cache_remote_sensitive_files: bool + silenced_hosts: NotRequired[list[str]] + media_silenced_hosts: list[str] pinned_users: list[str] hidden_tags: list[str] blocked_hosts: list[str] sensitive_words: list[str] + prohibited_words: list[str] + prohibited_words_for_name_of_user: list[str] + banned_email_domains: NotRequired[list[str]] preserved_usernames: list[str] hcaptcha_secret_key: str | None - recaptcha_secret_key: str - turnstile_secret_key: str - sensitive_media_detection: ISensitiveMediaDetection - sensitive_media_detection_sensitivity: ISensitiveMediaDetectionSentivity + mcaptcha_secret_key: str | None + recaptcha_secret_key: str | None + turnstile_secret_key: str | None + sensitive_media_detection: str + sensitive_media_detection_sensitivity: str set_sensitive_flag_automatically: bool enable_sensitive_media_detection_for_videos: bool - proxy_account_id: str - summaly_proxy: str | None - email: str + proxy_account_id: str | None + email: str | None smtp_secure: bool - smtp_host: str - smtp_port: int - smtp_user: str - smtp_pass: str + smtp_host: str | None + smtp_port: float | None + smtp_user: str | None + smtp_pass: str | None sw_private_key: str | None use_object_storage: bool - object_storage_base_url: str - object_storage_bucket: str - object_storage_prefix: str - object_storage_endpoint: str - object_storage_region: str - object_storage_port: str | None - object_storage_access_key: str - object_storage_secret_key: str - object_storage_use_s_s_l: bool + object_storage_base_url: str | None + object_storage_bucket: str | None + object_storage_prefix: str | None + object_storage_endpoint: str | None + object_storage_region: str | None + object_storage_port: float | None + object_storage_access_key: str | None + object_storage_secret_key: str | None + object_storage_use_ssl: bool object_storage_use_proxy: bool object_storage_set_public_read: bool - object_storage_sint_force_path_style: bool - deepl_auth_key: str | None - deepl_is_pro: bool enable_ip_logging: bool enable_active_email_validation: bool + enable_verifymail_api: bool + verifymail_auth_key: str | None + enable_truemail_api: bool + truemail_instance: str | None + truemail_auth_key: str | None enable_charts_for_remote_user: bool enable_charts_for_federated_instances: bool + enable_stats_for_federated_instances: bool enable_server_machine_stats: bool enable_identicon_generation: bool - policies: IRolePolicies - manifest_json_override: dict[str, Any] - + manifest_json_override: str + policies: dict + enable_fanout_timeline: bool + enable_fanout_timeline_db_fallback: bool + per_local_user_user_timeline_cache_max: float + per_remote_user_user_timeline_cache_max: float + per_user_home_timeline_cache_max: float + per_user_list_timeline_cache_max: float + enable_reactions_buffering: bool + notes_per_one_ad: float + background_image_url: str | None + deepl_auth_key: str | None + deepl_is_pro: bool + default_dark_theme: str | None + default_light_theme: str | None + description: str | None + disable_registration: bool + impressum_url: str | None + maintainer_email: str | None + maintainer_name: str | None + name: str | None + short_name: str | None + object_storage_s3_force_path_style: bool + privacy_policy_url: str | None + inquiry_url: str | None + repository_url: str | None + summaly_proxy: str | None + theme_color: str | None + tos_url: str | None + uri: str + version: str + url_preview_enabled: bool + url_preview_timeout: float + url_preview_maximum_content_length: float + url_preview_require_content_length: bool + url_preview_user_agent: str | None + url_preview_summary_proxy_url: str | None + federation: str + federation_hosts: list[str] class IUpdateMetaBody(TypedDict, total=False): announcements: list