MCPcopy Create free account

hub / github.com/ahtavarasmus/lightfriend / functions

Functions2,907 in github.com/ahtavarasmus/lightfriend

↓ 8 callersFunctionarray_to_base64url
Convert Uint8Array to base64url string
frontend/src/utils/webauthn.rs:64
↓ 8 callersFunctionauth_app
()
backend/tests/telnyx_handlers_test.rs:187
↓ 8 callersMethodbuild
(self)
backend/src/context.rs:206
↓ 8 callersFunctionbuild_digest_for_user
Build a sectioned digest for a single user. Pure-ish: makes DB queries and one round of async lookups for bridge read receipts, but does not send any
backend/src/jobs/scheduler.rs:1482
↓ 8 callersFunctioncapitalize_first
(s: &str)
frontend/src/dashboard/rule_builder.rs:6294
↓ 8 callersFunctioncheck_secret
Validates the X-Maintenance-Secret header against the MAINTENANCE_SECRET env var.
backend/src/handlers/maintenance_handlers.rs:15
↓ 8 callersFunctioncheck_user_credits
Checks if a user has sufficient credits to perform an action. For SMS events (message, noti_msg, digest): just checks credits > 0. Actual SMS cost is
backend/src/utils/usage.rs:94
↓ 8 callersFunctionformat_timestamp
(timestamp: i64, timezone: Option<String>)
backend/src/utils/bridge.rs:115
↓ 8 callersMethodget_messages_for_room
Get messages for a specific room, ordered by created_at DESC.
backend/src/repositories/ontology_repository.rs:1151
↓ 8 callersMethodget_user_settings
(&self, user_id: i32)
backend/src/test_utils.rs:1019
↓ 8 callersMethodget_vehicle_data
Get vehicle data including charge, climate, and vehicle state
backend/src/api/tesla.rs:315
↓ 8 callersFunctionget_webauthn
Get the global WebAuthn instance
backend/src/utils/webauthn_config.rs:8
↓ 8 callersFunctionhas_auto_features
Centralized plan feature helpers. All plan_type gating should go through these two functions. If tier names change in the future, only this file need
backend/src/utils/plan_features.rs:8
↓ 8 callersMethodrecord_telnyx_delivery_fallback_error
( &self, message_sid: &str, error: &str, )
backend/src/repositories/twilio_status_repository_impl.rs:108
↓ 8 callersMethodreserve_idempotency_key
Look up an idempotency key, reserving a fresh row if the key is unseen. The whole sequence runs in a transaction so concurrent requests with the same
backend/src/repositories/webhook_tokens_repository.rs:229
↓ 8 callersFunctionsearch_bridge_rooms
( service: &str, state: &Arc<AppState>, user_id: i32, search_term: &str, )
backend/src/utils/bridge.rs:3008
↓ 8 callersMethodset_route
Replace the in-memory routing order for a country. Called once per row at startup from `main.rs` after loading `provider_routes`, and again from the a
backend/src/channels/router.rs:62
↓ 8 callersFunctionsetup_test_encryption
Set up test encryption key (call once before BYOT tests)
backend/src/test_utils.rs:612
↓ 7 callersFunctionauth_app
()
backend/tests/sinch_handlers_test.rs:130
↓ 7 callersMethodbuild_query_tools
Build one tool definition per entity type, injecting user-specific enum values.
backend/src/ontology/registry.rs:141
↓ 7 callersMethodchat_completion_with_fallback
( &self, usage_repo: Option<&Arc<crate::repositories::llm_usage_repository::LlmUsageRepository
backend/src/ai_config.rs:340
↓ 7 callersFunctionclamp_sms_body
Clamp a body to the provider-safe SMS request size while preserving UTF-8 boundaries and making the truncation visible to the recipient.
backend/src/utils/sms_sanitizer.rs:71
↓ 7 callersFunctioncompare_optional
(label: &str, live: &Option<String>, build: &Option<String>)
tools/attestation-verifier/src/main.rs:174
↓ 7 callersMethodcreate_bridge
(&self, new_bridge: NewPgBridge)
backend/src/repositories/user_repository.rs:1240
↓ 7 callersFunctioncreate_test_message
(message_sid: &str, status: &str)
backend/tests/twilio_status_service_test.rs:17
↓ 7 callersMethoddispatch_sms
Twilio-specific SMS dispatch. Assumes preprocessing (URL filter, empty-body guard, message-history logging, dev-mode skip) has already run at the prov
backend/src/services/twilio_message_service.rs:281
↓ 7 callersFunctionfetch_bridge_messages
( service: &str, state: &Arc<AppState>, user_id: i32, start_time: i64, _unread_only: bool,
backend/src/utils/bridge.rs:1087
↓ 7 callersMethodget_all_users
(&self)
backend/src/repositories/user_core.rs:360
↓ 7 callersMethodget_events_due_for_friend_notification
Events whose deadline is inside the accountability grace window (now >= due_at - grace_secs, still before due_at) and which haven't already triggered
backend/src/repositories/ontology_repository.rs:2267
↓ 7 callersMethodget_max_processed_uid
Return the highest numeric `email_uid` value in `processed_emails` for a given (user_id, imap_connection_id). Used by the IDLE loop to resync mail tha
backend/src/repositories/user_repository.rs:397
↓ 7 callersMethodget_message_by_email_room_id
Look up an existing email-sourced message by its deterministic `email_<uid>` room_id. Used by the IDLE path (and cron) to avoid inserting the same ema
backend/src/repositories/ontology_repository.rs:1137
↓ 7 callersFunctionget_resend_config
Get Resend client, from email, and reply-to email from environment. Returns None if RESEND_API_KEY is not set (email sending is optional).
backend/src/utils/email.rs:42
↓ 7 callersFunctionget_sender_prefix
(service: &str)
backend/src/utils/bridge.rs:141
↓ 7 callersMethodget_tesla_region
(&self, user_id: i32)
backend/src/repositories/user_repository.rs:1054
↓ 7 callersMethodget_twilio_credentials
Get Twilio credentials from PG `user_secrets` table.
backend/src/repositories/user_repository.rs:1580
↓ 7 callersFunctionget_valid_tesla_access_token
Helper function to get valid Tesla access token (with auto-refresh)
backend/src/handlers/tesla_auth.rs:648
↓ 7 callersMethodmark_messages_seen_in_room
Mark messages in a room as seen (user read them on the native platform). Sets seen_at on all messages with created_at <= seen_up_to_ts that haven't be
backend/src/repositories/ontology_repository.rs:1920
↓ 7 callersFunctionmint
Helper: insert a token with the given cap and return (raw, row).
backend/tests/webhook_sms_test.rs:34
↓ 7 callersFunctionopen_imap_session
Open an authenticated IMAP session over TLS. This is the canonical async path used by all IMAP entry points in this crate. Layered timeouts: `tokio::
backend/src/handlers/imap_handlers.rs:50
↓ 7 callersFunctionparam_str
(params: &serde_json::Value, key: &str)
backend/src/tools/ontology.rs:358
↓ 7 callersMethodset_person_edit
Upsert a person edit (user override).
backend/src/repositories/ontology_repository.rs:518
↓ 7 callersFunctionstop_matrix_user_if_no_bridges
Tear down the Matrix client and sync loop for `user_id`, but only if they have no remaining connected bridges. Call this from bridge disconnect flows
backend/src/utils/matrix_auth.rs:891
↓ 7 callersMethodupdate_critical_enabled
( &self, _user_id: i32, _enabled: Option<String>, )
backend/src/test_utils.rs:1247
↓ 7 callersMethodupdate_digest_enabled
(&self, _user_id: i32, _value: bool)
backend/src/test_utils.rs:1133
↓ 7 callersMethodupdate_preferred_number
( &self, user_id: i32, preferred_number: &str, )
backend/src/repositories/user_core.rs:733
↓ 7 callersMethodupdate_user_credits
Credits management
backend/src/repositories/user_subscriptions.rs:32
↓ 7 callersMethodupdate_user_credits_left
( &self, user_id: i32, new_credits_left: f32, )
backend/src/repositories/user_subscriptions.rs:40
↓ 7 callersMethodupsert_person
Find-or-create a Person + Channel. Returns the Person. Used by bridge.rs for auto-creation on first message from recognized phone contacts.
backend/src/repositories/ontology_repository.rs:207
↓ 6 callersFunctioncompute_twilio_signature
Pure function: compute the Twilio signature for a given URL+params+token. Useful for tests.
backend/src/api/twilio_utils.rs:74
↓ 6 callersMethodconnection
(&self)
backend/src/repositories/tuwunel_cleanup_repository.rs:190
↓ 6 callersFunctioncreate_llm_test_state
Create an AppState with real LLM credentials (loads from .env)
backend/tests/llm_integration_test.rs:26
↓ 6 callersFunctioncreate_test_rooms
()
backend/tests/bridge_test.rs:330
↓ 6 callersMethodcreate_user
( &self, new_user: crate::handlers::auth_dtos::NewUser, )
backend/src/test_utils.rs:895
↓ 6 callersMethoddelete_message_by_matrix_event_id
Delete the `ont_messages` row matching `(user_id, matrix_event_id)`. Returns the number of rows deleted (0 = no matching row, 1 = matched). Called by
backend/src/repositories/ontology_repository.rs:1116
↓ 6 callersMethoddetermine_sending_strategy
Determine the sending strategy for a user (From number vs Messaging Service). Returns (from_number, use_messaging_service, should_update_preferred).
backend/src/services/twilio_message_service.rs:129
↓ 6 callersMethodensure_user_info_exists
Helper function to ensure user_info exists (PG)
backend/src/repositories/user_core.rs:468
↓ 6 callersMethodfind_by_email
(&self, search_email: &str)
backend/src/repositories/user_core.rs:285
↓ 6 callersFunctionfind_exact_room
(bridge_rooms: &[BridgeRoom], search_term: &str)
backend/src/utils/bridge.rs:624
↓ 6 callersFunctionfresh_keypair
Build (signing_key, base64_public_key) for a fresh test keypair.
backend/tests/telnyx_handlers_test.rs:194
↓ 6 callersFunctiongenerate_tokens_and_response
( state: &Arc<AppState>, user_id: i32, )
backend/src/handlers/auth_handlers.rs:657
↓ 6 callersFunctionget_country_name
(code: &str)
backend/src/handlers/pricing_handlers.rs:134
↓ 6 callersMethodget_credentials_by_user
Get all credentials for a user
backend/src/repositories/webauthn_repository.rs:70
↓ 6 callersMethodget_message
Get a message from the mock repository.
backend/src/repositories/mock_twilio_status_repository.rs:63
↓ 6 callersMethodget_person_with_channels
Get a single Person with Channels and edits.
backend/src/repositories/ontology_repository.rs:477
↓ 6 callersFunctionget_service_rooms
(client: &MatrixClient, service: &str)
backend/src/utils/bridge.rs:328
↓ 6 callersMethodget_stripe_customer_id
Stripe related methods
backend/src/repositories/user_subscriptions.rs:102
↓ 6 callersMethodis_totp_enabled
Check if TOTP is enabled for a user
backend/src/repositories/totp_repository.rs:82
↓ 6 callersFunctionlog_ok
(msg: str)
scripts/imap_idle_stress.py:78
↓ 6 callersFunctionlog_warn
(msg: str)
scripts/imap_idle_stress.py:82
↓ 6 callersFunctionmake_callback_params
()
backend/tests/twilio_handlers_test.rs:217
↓ 6 callersMethodmark_email_as_processed
Mark an email as processed
backend/src/repositories/user_repository.rs:1748
↓ 6 callersFunctionnow_timestamp
()
backend/src/repositories/tuwunel_cleanup_repository.rs:197
↓ 6 callersFunctionparse_list_logins
Parse a full bridgev2 `list-logins` body into a vec of entries. Unknown lines (help text, errors) are skipped; only lines that match the verified form
backend/src/utils/bridge_responses.rs:191
↓ 6 callersFunctionrelease_idempotency
Best-effort cleanup of an in-flight idempotency row when the request fails before completing. Errors are logged but not propagated — the row will natu
backend/src/handlers/webhook_sms_handlers.rs:479
↓ 6 callersFunctionrule
(trigger_config: serde_json::Value)
backend/tests/group_attention_gate_test.rs:6
↓ 6 callersMethodsend_command_with_body
Generic command sender with JSON body
backend/src/api/tesla.rs:662
↓ 6 callersFunctionsend_message
Send a message through the full SMS processing pipeline (with real LLM, no Twilio send)
backend/tests/llm_integration_test.rs:65
↓ 6 callersMethodsend_message
Send a text message to a room
backend/src/test_utils/matrix_test_server.rs:256
↓ 6 callersMethodset_cabin_overheat_protection
Set cabin overheat protection on/off
backend/src/api/tesla.rs:487
↓ 6 callersFunctionsetup_user_with_location
Create a test user with location, timezone, and autopilot plan set. Autopilot is needed so tracking items pass the plan gate.
backend/tests/llm_integration_test.rs:38
↓ 6 callersFunctionstep
Run one step of the purge: push a Running entry, run the future, then update the entry to Done / Failed based on the result. On failure the error is a
backend/src/services/data_purge.rs:214
↓ 6 callersMethodupdate_notify
Update user's notify preference in user_settings
backend/src/repositories/user_core.rs:1140
↓ 5 callersFunctionapply_sms_url_filter
Sanitize a message body for A2P 10DLC delivery. Two passes: 1. Re-fang defanged emails and domains (e.g. `user[.]name(at)example[.]com` → `user.name@
backend/src/utils/sms_sanitizer.rs:64
↓ 5 callersFunctionassert_no_item
Assert that NO item was created (question/realtime request)
backend/tests/llm_integration_test.rs:124
↓ 5 callersFunctionbase64url_to_array
Convert a base64url string to Uint8Array
frontend/src/utils/webauthn.rs:37
↓ 5 callersMethodclaim_send_slot
Atomically reserve one send slot. Resets the daily window when the stored `daily_reset_at` is in the past, then increments `daily_sent` only if it wou
backend/src/repositories/webhook_tokens_repository.rs:140
↓ 5 callersFunctionclassify_whatsapp_start_chat
Strict classifier for `!wa start-chat` reply bodies. Returns `None` for unrecognized bodies; caller must NOT treat that as a success or a failure — o
backend/src/utils/bridge_responses.rs:359
↓ 5 callersFunctionclean_url
()
frontend/src/pages/home.rs:451
↓ 5 callersMethodcount_usage_activities_since
( &self, user_id: i32, since_ts: i32, activity_types: &[&str], )
backend/src/repositories/user_repository.rs:544
↓ 5 callersMethodcreate_room
Create a room
backend/src/test_utils/matrix_test_server.rs:195
↓ 5 callersFunctiondecode_rfc2047
Decode RFC 2047 MIME encoded words (e.g. =?UTF-8?Q?...?=) in header values. Uses mail_parser for correct handling of all charset/encoding variants.
backend/src/handlers/imap_handlers.rs:23
↓ 5 callersMethoddelete_message
( &self, credentials: &TwilioCredentials, message_sid: &str, )
backend/src/api/twilio_client.rs:369
↓ 5 callersFunctionempty_user_data
()
backend/tests/ontology_registry_test.rs:9
↓ 5 callersFunctionensure_matrix_user_running
Ensure the Matrix client, event handlers, and sync loop are running for `user_id`. This is the single entry point for acquiring a Matrix client. Idemp
backend/src/utils/matrix_auth.rs:818
↓ 5 callersMethodfetch_message_price
Fetch the price of a sent message.
backend/src/services/twilio_message_service.rs:553
↓ 5 callersMethodfind_by_stripe_customer_id
( &self, customer_id: &str, )
backend/src/repositories/user_subscriptions.rs:147
↓ 5 callersFunctionfirst_connected_identifier
Convenience: identifier (usually phone number) of the first CONNECTED login. The identifier is the value inside parentheses in the `list-logins` line
backend/src/utils/bridge_responses.rs:281
↓ 5 callersMethodget_login_phone_for_matrix_user
Look up the WhatsApp phone number that a Matrix user is logged into the bridge as. Returns Ok(None) if the user is not currently logged in. Note: thi
backend/src/repositories/whatsapp_bridge_repository.rs:142
↓ 5 callersFunctionget_notification_only_pricing
Get pricing for a country with segment-based multipliers. This fetches pricing from Twilio (with 24h cache) and applies segment-based formulas: - Not
backend/src/api/twilio_pricing.rs:68
↓ 5 callersMethodget_persons
Get all Persons for a user.
backend/src/repositories/ontology_repository.rs:413
← previousnext →101–200 of 2,907, ranked by callers