first commit
Some checks failed
Backend Tests / Static Checks (push) Has been cancelled
Backend Tests / Tests (other) (push) Has been cancelled
Backend Tests / Tests (plugin) (push) Has been cancelled
Backend Tests / Tests (server) (push) Has been cancelled
Backend Tests / Tests (store) (push) Has been cancelled
Build Canary Image / build-frontend (push) Has been cancelled
Build Canary Image / build-push (linux/amd64) (push) Has been cancelled
Build Canary Image / build-push (linux/arm64) (push) Has been cancelled
Build Canary Image / merge (push) Has been cancelled
Frontend Tests / Lint (push) Has been cancelled
Frontend Tests / Build (push) Has been cancelled
Proto Linter / Lint Protos (push) Has been cancelled

This commit is contained in:
2026-03-04 06:30:47 +00:00
commit bb402d4ccc
777 changed files with 135661 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
syntax = "proto3";
package memos.store;
option go_package = "gen/store";
message ActivityMemoCommentPayload {
int32 memo_id = 1;
int32 related_memo_id = 2;
}
message ActivityPayload {
ActivityMemoCommentPayload memo_comment = 1;
}

View File

@@ -0,0 +1,22 @@
syntax = "proto3";
package memos.store;
option go_package = "gen/store";
message AISettings {
GroqSettings groq = 1;
OllamaSettings ollama = 2;
}
message GroqSettings {
string api_key = 1;
string default_model = 2;
bool enabled = 3;
}
message OllamaSettings {
string host = 1;
string default_model = 2;
bool enabled = 3;
}

View File

@@ -0,0 +1,33 @@
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;
}
message AttachmentPayload {
oneof payload {
S3Object s3_object = 1;
}
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;
}
}

41
proto/store/idp.proto Normal file
View File

@@ -0,0 +1,41 @@
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;
}
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;
}

18
proto/store/inbox.proto Normal file
View File

@@ -0,0 +1,18 @@
syntax = "proto3";
package memos.store;
option go_package = "gen/store";
message InboxMessage {
// The type of the inbox message.
Type type = 1;
// The system-generated unique ID of related activity.
optional int32 activity_id = 2;
enum Type {
TYPE_UNSPECIFIED = 0;
// Memo comment notification.
MEMO_COMMENT = 1;
}
}

View File

@@ -0,0 +1,110 @@
syntax = "proto3";
package memos.store;
import "store/ai_settings.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;
// AI is the key for AI settings.
AI = 5;
}
message InstanceSetting {
InstanceSettingKey key = 1;
oneof value {
InstanceBasicSetting basic_setting = 2;
InstanceGeneralSetting general_setting = 3;
InstanceStorageSetting storage_setting = 4;
InstanceMemoRelatedSetting memo_related_setting = 5;
AISettings ai_settings = 6;
}
}
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 {
// disallow_public_visibility disallows set memo as public visibility.
bool disallow_public_visibility = 1;
// display_with_update_time orders and displays memo with update time.
bool display_with_update_time = 2;
// 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;
}

27
proto/store/memo.proto Normal file
View File

@@ -0,0 +1,27 @@
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;
}
message Location {
string placeholder = 1;
double latitude = 2;
double longitude = 3;
}
}

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;
}