import type { RuntimeTranslator } from '@/i18n/runtime';
import { type PolicySection } from './types';
import { CodeBlock } from '@/components/ui/code-block';
/**
* ------------------------------------------------------------------
* 使用指南 (How To Use)
* ------------------------------------------------------------------
*/
export function createHowToUseSections(rt: RuntimeTranslator): PolicySection[] {
return [
{
value: 'quick-start',
title: rt('1_quick_start_ef8fbb58'),
content: (
{rt('a_guide_to_the_general_purpose_full_9cd8c987')}
-
{rt('architecture_e992b65c')}{' '}
{rt('go_gin_gorm_redis_asynq_backend_react_d5fe02d3')}
-
{rt('authentication_d36b345b')}{' '}
{rt(
'local_username_password_registration_and_login_plus_583ab638',
)}
-
{rt('access_tokens_b7b856d3')}{' '}
{rt('personal_developer_access_tokens_api_keys_for_4b407149')}
-
{rt('observability_ea0cc1bf')}{' '}
{rt(
'zap_structured_logging_and_opentelemetry_distributed_tracing_9fd6da9f',
)}
),
},
{
value: 'auth-security',
title: rt('2_authentication_and_security_settings_76967059'),
content: (
{rt(
'the_platform_combines_authentication_methods_to_support_bc9f1772',
)}
{rt('2_1_username_and_password_authentication_97184f8f')}
-
{rt('registration_and_password_login_c5bd6cb4')}{' '}
{rt('users_can_register_and_create_sessions_with_21883e04')}{' '}
bcrypt
{' '}
{rt('salted_hashing_dc2a9b63')}
-
{rt('system_switches_53741557')}{' '}
{rt(
'administrators_can_disable_password_registration_or_login_a2648e62',
)}
{rt('2_2_third_party_oidc_providers_f14083c8')}
{rt('users_can_link_external_accounts_from_their_c08d3f5a')}
-
{rt('open_4540d74d')}
{rt('settings_profile_32835b0d')}{' '}
{rt('message_a173cce8')}
-
{rt(
'under_linked_accounts_view_existing_connections_or_5151eb9b',
)}
- {rt('after_linking_use_the_oidc_login_button_6095b15d')}
),
children: [
{
value: '2-1-login',
title: rt('2_1_username_and_password_authentication_97184f8f'),
},
{
value: '2-2-oidc',
title: rt('2_2_third_party_oidc_providers_f14083c8'),
},
],
},
{
value: 'access-token',
title: rt('3_integrating_personal_access_tokens_af2647b5'),
content: (
{rt('personal_access_tokens_allow_developers_and_third_9a242a0e')}
{rt('3_1_token_generation_and_storage_2b78c681')}
-
{rt('one_time_plaintext_display_fd13912a')}{' '}
{rt('a_newly_generated_plaintext_token_such_as_57eb11a1')}{' '}
at_xxx
{rt('is_displayed_only_once_copy_and_save_8d378c8a')}
-
{rt('secure_hash_storage_1ce392ff')}{' '}
{rt('only_a_sha_256_hash_of_the_dbf434b1')}
{rt('3_2_calling_apis_with_headers_fccd7b0d')}
{rt('use_your_saved_plaintext_token_with_either_3af53a05')}
{rt('method_1_authorization_bearer_header_2a9c2a6c')}
{rt('method_2_custom_x_access_token_header_4548169f')}
),
children: [
{
value: '3-1-generation',
title: rt('3_1_token_generation_and_storage_2b78c681'),
},
{
value: '3-2-usage',
title: rt('3_2_calling_apis_with_headers_fccd7b0d'),
},
],
},
{
value: 'config-system',
title: rt('4_dynamic_system_configuration_b3bf8c49'),
content: (
{rt('the_built_in_key_value_configuration_module_713f6d05')}
-
{rt('cached_reads_35828322')}{' '}
{rt('configuration_is_read_from_the_database_through_3e9f6a34')}
-
{rt('core_system_configuration_keys_6dc02be8')}
-
site_name
{rt('platform_display_name_116219b1')}
-
password_login_enabled
{rt('password_login_switch_153eaa45')}
-
registration_enabled
{rt('user_registration_switch_827b5b21')}
-
max_api_keys_per_user
{rt('maximum_tokens_per_regular_user_default_5_5dd6d9e7')}
),
},
{
value: 'worker-scheduler',
title: rt('5_background_tasks_and_scheduling_7142ce96'),
content: (
{rt('cobra_provides_separate_commands_so_worker_services_1bbae2df')}
-
{rt('scheduled_dispatch_scheduler_command_e79062ad')}
{' '}
{rt('enqueues_tasks_in_redis_according_to_their_694e5985')}
-
{rt('workers_with_queue_priorities_worker_command_faa970b1')}
{' '}
{rt('asynq_consumes_tasks_by_priority_and_executes_69d82251')}
),
},
{
value: 'tracing-metrics',
title: rt('6_distributed_tracing_and_structured_logs_e8971cad'),
content: (
{rt(
'the_platform_integrates_monitoring_components_for_observability_2b1da50f',
)}
-
{rt('ui_openTelemetryTracing')}{' '}
{rt(
'tracing_context_is_propagated_automatically_gin_requests_0f549cce',
)}
-
{rt('zap_structured_logs_1c9725e8')}{' '}
{rt('standardizes_backend_console_and_log_output_as_16970757')}
),
},
];
}