0.29.1原版

This commit is contained in:
anian
2026-07-02 19:14:14 +08:00
commit d94008f0fb
947 changed files with 174905 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
syntax = "proto3";
package memos.store;
import "google/protobuf/timestamp.proto";
import "store/instance_setting.proto";
option go_package = "gen/store";
enum AttachmentStorageType {
ATTACHMENT_STORAGE_TYPE_UNSPECIFIED = 0;
// Attachment is stored locally. AKA, local file system.
LOCAL = 1;
// Attachment is stored in S3.
S3 = 2;
// Attachment is stored in an external storage. The reference is a URL.
EXTERNAL = 3;
}
enum MotionMediaFamily {
MOTION_MEDIA_FAMILY_UNSPECIFIED = 0;
APPLE_LIVE_PHOTO = 1;
ANDROID_MOTION_PHOTO = 2;
}
enum MotionMediaRole {
MOTION_MEDIA_ROLE_UNSPECIFIED = 0;
STILL = 1;
VIDEO = 2;
CONTAINER = 3;
}
message MotionMedia {
MotionMediaFamily family = 1;
MotionMediaRole role = 2;
string group_id = 3;
int64 presentation_timestamp_us = 4;
bool has_embedded_video = 5;
}
message AttachmentPayload {
oneof payload {
S3Object s3_object = 1;
}
MotionMedia motion_media = 10;
message S3Object {
StorageS3Config s3_config = 1;
// key is the S3 object key.
string key = 2;
// last_presigned_time is the last time the object was presigned.
// This is used to determine if the presigned URL is still valid.
google.protobuf.Timestamp last_presigned_time = 3;
}
}
+42
View File
@@ -0,0 +1,42 @@
syntax = "proto3";
package memos.store;
option go_package = "gen/store";
message IdentityProvider {
int32 id = 1;
string name = 2;
enum Type {
TYPE_UNSPECIFIED = 0;
OAUTH2 = 1;
}
Type type = 3;
string identifier_filter = 4;
IdentityProviderConfig config = 5;
string uid = 6;
}
message IdentityProviderConfig {
oneof config {
OAuth2Config oauth2_config = 1;
}
}
message FieldMapping {
string identifier = 1;
string display_name = 2;
string email = 3;
string avatar_url = 4;
}
message OAuth2Config {
string client_id = 1;
string client_secret = 2;
string auth_url = 3;
string token_url = 4;
string user_info_url = 5;
repeated string scopes = 6;
FieldMapping field_mapping = 7;
}
+32
View File
@@ -0,0 +1,32 @@
syntax = "proto3";
package memos.store;
option go_package = "gen/store";
message InboxMessage {
message MemoCommentPayload {
int32 memo_id = 1;
int32 related_memo_id = 2;
}
message MemoMentionPayload {
int32 memo_id = 1;
int32 related_memo_id = 2;
}
// The type of the inbox message.
Type type = 1;
oneof payload {
MemoCommentPayload memo_comment = 2;
MemoMentionPayload memo_mention = 3;
}
enum Type {
TYPE_UNSPECIFIED = 0;
// Memo comment notification.
MEMO_COMMENT = 1;
// Memo mention notification.
MEMO_MENTION = 2;
}
}
+199
View File
@@ -0,0 +1,199 @@
syntax = "proto3";
package memos.store;
import "google/type/color.proto";
option go_package = "gen/store";
enum InstanceSettingKey {
INSTANCE_SETTING_KEY_UNSPECIFIED = 0;
// BASIC is the key for basic settings.
BASIC = 1;
// GENERAL is the key for general settings.
GENERAL = 2;
// STORAGE is the key for storage settings.
STORAGE = 3;
// MEMO_RELATED is the key for memo related settings.
MEMO_RELATED = 4;
// TAGS is the key for tag metadata.
TAGS = 5;
// NOTIFICATION is the key for notification transport settings.
NOTIFICATION = 6;
// AI is the key for AI provider settings.
AI = 7;
}
message InstanceSetting {
InstanceSettingKey key = 1;
oneof value {
InstanceBasicSetting basic_setting = 2;
InstanceGeneralSetting general_setting = 3;
InstanceStorageSetting storage_setting = 4;
InstanceMemoRelatedSetting memo_related_setting = 5;
InstanceTagsSetting tags_setting = 6;
InstanceNotificationSetting notification_setting = 7;
InstanceAISetting ai_setting = 8;
}
}
message InstanceBasicSetting {
// The secret key for instance. Mainly used for session management.
string secret_key = 1;
// The current schema version of database.
string schema_version = 2;
}
message InstanceGeneralSetting {
// disallow_user_registration disallows user registration.
bool disallow_user_registration = 2;
// disallow_password_auth disallows password authentication.
bool disallow_password_auth = 3;
// additional_script is the additional script.
string additional_script = 4;
// additional_style is the additional style.
string additional_style = 5;
// custom_profile is the custom profile.
InstanceCustomProfile custom_profile = 6;
// week_start_day_offset is the week start day offset from Sunday.
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
// Default is Sunday.
int32 week_start_day_offset = 7;
// disallow_change_username disallows changing username.
bool disallow_change_username = 8;
// disallow_change_nickname disallows changing nickname.
bool disallow_change_nickname = 9;
}
message InstanceCustomProfile {
string title = 1;
string description = 2;
string logo_url = 3;
}
message InstanceStorageSetting {
enum StorageType {
STORAGE_TYPE_UNSPECIFIED = 0;
// STORAGE_TYPE_DATABASE is the database storage type.
DATABASE = 1;
// STORAGE_TYPE_LOCAL is the local storage type.
LOCAL = 2;
// STORAGE_TYPE_S3 is the S3 storage type.
S3 = 3;
}
// storage_type is the storage type.
StorageType storage_type = 1;
// The template of file path.
// e.g. assets/{timestamp}_{filename}
string filepath_template = 2;
// The max upload size in megabytes.
int64 upload_size_limit_mb = 3;
// The S3 config.
StorageS3Config s3_config = 4;
}
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
message StorageS3Config {
string access_key_id = 1;
string access_key_secret = 2;
string endpoint = 3;
string region = 4;
string bucket = 5;
bool use_path_style = 6;
}
message InstanceMemoRelatedSetting {
reserved 2;
reserved "display_with_update_time";
// content_length_limit is the limit of content length. Unit is byte.
int32 content_length_limit = 3;
// enable_double_click_edit enables editing on double click.
bool enable_double_click_edit = 4;
// reactions is the list of reactions.
repeated string reactions = 7;
}
message InstanceTagMetadata {
// Optional background color for the tag label.
// When unset, the default tag color is used.
google.type.Color background_color = 1;
// Whether memos with this tag should have their content blurred.
bool blur_content = 2;
}
message InstanceTagsSetting {
// Map of tag name pattern to tag metadata.
// Each key is treated as an anchored regular expression (^pattern$),
// so a single entry like "project/.*" matches all tags under that prefix.
// Exact tag names are also valid (they are trivially valid regex patterns).
map<string, InstanceTagMetadata> tags = 1;
}
message InstanceNotificationSetting {
EmailSetting email = 1;
message EmailSetting {
bool enabled = 1;
string smtp_host = 2;
int32 smtp_port = 3;
string smtp_username = 4;
string smtp_password = 5;
string from_email = 6;
string from_name = 7;
string reply_to = 8;
bool use_tls = 9;
bool use_ssl = 10;
}
}
message InstanceAISetting {
// providers is the list of AI provider configurations available instance-wide.
repeated AIProviderConfig providers = 1;
// transcription is the speech-to-text feature configuration.
// When unset or transcription.provider_id is empty, transcription is disabled.
TranscriptionConfig transcription = 2;
}
message AIProviderConfig {
string id = 1;
string title = 2;
AIProviderType type = 3;
string endpoint = 4;
// api_key is write-only at the API layer and is required by the server to call providers.
string api_key = 5;
}
enum AIProviderType {
AI_PROVIDER_TYPE_UNSPECIFIED = 0;
OPENAI = 1;
GEMINI = 2;
}
// TranscriptionConfig configures the speech-to-text feature.
message TranscriptionConfig {
// provider_id references an entry in InstanceAISetting.providers[].id.
// Empty string means transcription is disabled.
string provider_id = 1;
// model is the provider-specific model identifier.
// Empty string falls back to the engine default.
// OPENAI examples:
// - whisper-1 (legacy, lower cost)
// - gpt-4o-transcribe, gpt-4o-mini-transcribe (higher quality)
// - gpt-4o-transcribe-diarize (includes speaker labels)
// GEMINI examples:
// - gemini-2.5-flash (default, multimodal call)
// - gemini-2.5-pro
string model = 2;
// language is the default ISO 639-1 language hint sent to the provider.
// Empty string lets the provider auto-detect.
string language = 3;
// prompt is a default spelling/vocabulary hint passed to the provider.
// Used as the OpenAI Whisper "prompt" parameter (a soft hint that the model
// may ignore) and folded into the Gemini generation prompt as a "Context and
// spelling hints" block (which the LLM will treat more literally).
string prompt = 4;
}
+29
View File
@@ -0,0 +1,29 @@
syntax = "proto3";
package memos.store;
option go_package = "gen/store";
message MemoPayload {
Property property = 1;
Location location = 2;
repeated string tags = 3;
// The calculated properties from the memo content.
message Property {
bool has_link = 1;
bool has_task_list = 2;
bool has_code = 3;
bool has_incomplete_tasks = 4;
// The title extracted from the first H1 heading, if present.
string title = 5;
}
message Location {
string placeholder = 1;
double latitude = 2;
double longitude = 3;
}
}
+113
View File
@@ -0,0 +1,113 @@
syntax = "proto3";
package memos.store;
import "google/protobuf/timestamp.proto";
option go_package = "gen/store";
message UserSetting {
enum Key {
KEY_UNSPECIFIED = 0;
// General user settings.
GENERAL = 1;
// The shortcuts of the user.
SHORTCUTS = 4;
// The webhooks of the user.
WEBHOOKS = 5;
// Refresh tokens for the user.
REFRESH_TOKENS = 6;
// Personal access tokens for the user.
PERSONAL_ACCESS_TOKENS = 7;
}
int32 user_id = 1;
Key key = 2;
oneof value {
GeneralUserSetting general = 3;
ShortcutsUserSetting shortcuts = 6;
WebhooksUserSetting webhooks = 7;
RefreshTokensUserSetting refresh_tokens = 8;
PersonalAccessTokensUserSetting personal_access_tokens = 9;
}
}
message GeneralUserSetting {
// The user's locale.
string locale = 1;
// The user's memo visibility setting.
string memo_visibility = 2;
// The user's theme preference.
// This references a CSS file in the web/public/themes/ directory.
string theme = 3;
}
message RefreshTokensUserSetting {
message RefreshToken {
// Unique identifier (matches 'tid' claim in JWT)
string token_id = 1;
// When the token expires
google.protobuf.Timestamp expires_at = 2;
// When the token was created
google.protobuf.Timestamp created_at = 3;
// Client information for session management UI
ClientInfo client_info = 4;
// Optional description
string description = 5;
}
message ClientInfo {
// User agent string of the client.
string user_agent = 1;
// IP address of the client.
string ip_address = 2;
// Optional. Device type (e.g., "mobile", "desktop", "tablet").
string device_type = 3;
// Optional. Operating system (e.g., "iOS 17.0", "Windows 11").
string os = 4;
// Optional. Browser name and version (e.g., "Chrome 119.0").
string browser = 5;
}
repeated RefreshToken refresh_tokens = 1;
}
message PersonalAccessTokensUserSetting {
message PersonalAccessToken {
// Unique identifier for this token
string token_id = 1;
// SHA-256 hash of the actual token
string token_hash = 2;
// User-provided description
string description = 3;
// When the token expires (null = never)
google.protobuf.Timestamp expires_at = 4;
// When the token was created
google.protobuf.Timestamp created_at = 5;
// When the token was last used
google.protobuf.Timestamp last_used_at = 6;
}
repeated PersonalAccessToken tokens = 1;
}
message ShortcutsUserSetting {
message Shortcut {
string id = 1;
string title = 2;
string filter = 3;
}
repeated Shortcut shortcuts = 1;
}
message WebhooksUserSetting {
message Webhook {
// Unique identifier for the webhook
string id = 1;
// Descriptive title for the webhook
string title = 2;
// The webhook URL endpoint
string url = 3;
}
repeated Webhook webhooks = 1;
}