Coverage for src/couchers/urls.py: 95%
64 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-12-20 18:03 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-12-20 18:03 +0000
1# The source of truth for URLs is
2# //docs/urls.md
3# Please make sure this file stays in sync with that file as well as
4# //app/web/src/routes.ts
7from couchers.config import config
10def app_link():
11 return f"{config['BASE_URL']}/"
14def icon_url():
15 return f"{config['BASE_URL']}/logo512.png"
18def profile_link():
19 return f"{config['BASE_URL']}/profile"
22def user_link(*, username):
23 return f"{config['BASE_URL']}/user/{username}"
26def edit_profile_link():
27 return f"{config['BASE_URL']}/profile/edit"
30def signup_link(*, token):
31 return f"{config['BASE_URL']}/signup?token={token}"
34def account_settings_link():
35 return f"{config['BASE_URL']}/account-settings"
38def notification_settings_link():
39 return f"{config['BASE_URL']}/account-settings/notification-settings"
42def feature_preview_link():
43 return f"{config['BASE_URL']}/preview"
46def password_reset_link(*, password_reset_token):
47 return f"{config['BASE_URL']}/complete-password-reset?token={password_reset_token}"
50def host_request_link_host():
51 return f"{config['BASE_URL']}/messages/hosting/"
54def host_request_link_guest():
55 return f"{config['BASE_URL']}/messages/surfing/"
58def host_request(*, host_request_id):
59 return f"{config['BASE_URL']}/messages/request/{host_request_id}"
62def messages_link():
63 return f"{config['BASE_URL']}/messages/"
66def chat_link(*, chat_id):
67 return f"{config['BASE_URL']}/messages/chats/{chat_id}"
70def event_link(*, occurrence_id, slug="e"):
71 return f"{config['BASE_URL']}/event/{occurrence_id}/{slug}"
74def community_link(*, node_id, slug="e"):
75 return f"{config['BASE_URL']}/community/{node_id}/{slug}"
78def leave_reference_link(*, reference_type, to_user_id, host_request_id=None):
79 assert reference_type in ["friend", "surfed", "hosted"]
80 if host_request_id:
81 return f"{config['BASE_URL']}/leave-reference/{reference_type}/{to_user_id}/{host_request_id}"
82 else:
83 return f"{config['BASE_URL']}/leave-reference/{reference_type}/{to_user_id}"
86def profile_references_link():
87 return f"{config['BASE_URL']}/profile/references"
90def friend_requests_link():
91 return f"{config['BASE_URL']}/connections/friends/"
94def media_upload_url(*, path):
95 return f"{config['MEDIA_SERVER_UPLOAD_BASE_URL']}/{path}"
98def change_email_link(*, confirmation_token):
99 return f"{config['BASE_URL']}/confirm-email?token={confirmation_token}"
102def donation_cancelled_url():
103 return f"{config['BASE_URL']}/donate?cancelled=true"
106def donation_success_url():
107 return f"{config['BASE_URL']}/donate?success=true"
110def complete_strong_verification_url(*, verification_attempt_token):
111 return f"{config['BASE_URL']}/complete-strong-verification?verification_attempt_token={verification_attempt_token}"
114def delete_account_link(*, account_deletion_token):
115 return f"{config['BASE_URL']}/delete-account?token={account_deletion_token}"
118def recover_account_link(*, account_undelete_token):
119 return f"{config['BASE_URL']}/recover-account?token={account_undelete_token}"
122def unsubscribe_link(*, payload, sig):
123 return f"{config['BASE_URL']}/unsubscribe?payload={payload}&sig={sig}"
126def media_url(*, filename, size):
127 return f"{config['MEDIA_SERVER_BASE_URL']}/img/{size}/{filename}"
130def console_link(*, page):
131 return f"{config['CONSOLE_BASE_URL']}/{page}"