├── .gitignore ├── LICENSE ├── README.md ├── auth.proto ├── category.proto ├── create_identity_record.proto ├── identity.proto ├── model.proto ├── notification.proto ├── post.proto ├── post_appreciation.proto ├── post_rate.proto ├── punishment.proto ├── rate.proto ├── report.proto ├── setting.proto ├── site_config.proto ├── subscribe.proto ├── system_message.proto ├── tag.proto ├── thread.proto ├── thread_appreciation.proto ├── thread_rate.proto ├── treehole.proto ├── upload_file.proto ├── user.proto ├── user_check_in.proto ├── user_device.proto ├── user_fav_thread.proto ├── user_fish.proto ├── user_fish_history.proto ├── user_thread_identity.proto └── user_thread_last_read.proto /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Dongyue Web Team 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # treehole.space proto 2 | 3 | Protobuf and gRPC service definition of(https://treehole.space), yet another anonymous forum. 4 | -------------------------------------------------------------------------------- /auth.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | 5 | enum OAuthLoginChannel { 6 | LoginWithJAccount = 0; 7 | } 8 | 9 | enum LoginSource { 10 | LoginSourceIOS = 0; 11 | LoginSourceAndroid = 1; 12 | LoginSourceWeb = 2; 13 | } 14 | 15 | enum WebSource { 16 | WebSourceLocalhost = 0; 17 | WebSourceDevServer = 1; 18 | WebSourceProdServer = 2; 19 | } -------------------------------------------------------------------------------- /category.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "google/protobuf/wrappers.proto"; 6 | 7 | message Category { 8 | Model model = 1; 9 | string name = 2; 10 | int32 rank = 3; 11 | google.protobuf.Int32Value open_time = 4; 12 | google.protobuf.Int32Value close_time = 5; 13 | google.protobuf.BoolValue is_alice = 6; 14 | google.protobuf.BoolValue hide_in_timeline = 7; 15 | google.protobuf.BoolValue disable_hate = 8; 16 | } 17 | -------------------------------------------------------------------------------- /create_identity_record.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "user.proto"; 6 | 7 | message CreateIdentityRecord { 8 | Model model = 1; 9 | uint64 user_id = 2; 10 | uint32 year = 3; 11 | uint32 month = 4; 12 | uint32 count = 5; 13 | User user = 6; 14 | } 15 | -------------------------------------------------------------------------------- /identity.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | 6 | enum IdentityStatus { 7 | IdentityStatusNormal = 0; 8 | IdentityStatusDeleted = 1; 9 | IdentityStatusBanned = 2; 10 | } 11 | 12 | enum IdentityType { 13 | IdentityTypeNormal = 0; 14 | IdentityTypeAdmin = 1; 15 | } 16 | 17 | message Identity { 18 | Model model = 1; 19 | uint64 user_id = 2; 20 | string code = 3; 21 | IdentityStatus status = 4; 22 | IdentityType type = 5; 23 | bool is_active = 6; 24 | string remark = 7; 25 | bool is_special = 8; 26 | } 27 | -------------------------------------------------------------------------------- /model.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "google/protobuf/timestamp.proto"; 5 | 6 | message Model { 7 | uint64 id = 1; 8 | google.protobuf.Timestamp created_at = 2; 9 | google.protobuf.Timestamp updated_at = 3; 10 | google.protobuf.Timestamp deleted_at = 4; 11 | } 12 | -------------------------------------------------------------------------------- /notification.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "google/protobuf/any.proto"; 5 | import "google/protobuf/wrappers.proto"; 6 | import "model.proto"; 7 | import "user.proto"; 8 | 9 | enum NotificationType { 10 | NotificationTypeThreadReplied = 0; 11 | NotificationTypePostReplied = 1; 12 | NotificationTypeSystem = 2; 13 | } 14 | 15 | message Notification { 16 | Model model = 1; 17 | uint64 user_id = 2; 18 | NotificationType type = 3; 19 | google.protobuf.UInt64Value source_id = 4; 20 | google.protobuf.Any source = 5; 21 | string message = 6; 22 | uint64 count = 7; 23 | bool has_read = 8; 24 | User user = 9; 25 | google.protobuf.UInt64Value target_id = 10; 26 | int64 last_update_at = 11 [jstype = JS_STRING]; 27 | } 28 | -------------------------------------------------------------------------------- /post.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "google/protobuf/wrappers.proto"; 5 | import "model.proto"; 6 | import "identity.proto"; 7 | import "thread.proto"; 8 | import "user_thread_identity.proto"; 9 | 10 | enum PostStatus { 11 | PostStatusNormal = 0; 12 | PostStatusCollapsed = 1; 13 | PostStatusKilled = 2; 14 | PostStatusHide = 3; 15 | } 16 | 17 | message Post { 18 | Model model = 1; 19 | uint64 thread_id = 2; 20 | uint64 floor = 3; 21 | string identity_code = 4; 22 | string content = 5; 23 | uint64 like_count = 6; 24 | uint64 hate_count = 7; 25 | PostStatus status = 8; 26 | google.protobuf.UInt64Value reply_to_post_id = 9; 27 | google.protobuf.StringValue reply_to_identity_code = 10; 28 | google.protobuf.UInt64Value reply_to_floor = 11; 29 | bool is_like = 12; 30 | bool is_hate = 13; 31 | Identity identity = 14; 32 | Post reply_to_post = 15; 33 | Thread thread = 16; 34 | google.protobuf.BoolValue hide_identity = 17; 35 | google.protobuf.UInt64Value user_thread_identity_id = 18; 36 | UserThreadIdentity user_thread_identity = 19; 37 | uint64 appreciation_count = 20; 38 | bool is_appreciated = 21; 39 | bool can_delete = 22; 40 | string remark = 23; 41 | string hide_reason = 24; 42 | string preview = 25; 43 | google.protobuf.BoolValue disable_hate = 26; 44 | } 45 | -------------------------------------------------------------------------------- /post_appreciation.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "post.proto"; 6 | import "user.proto"; 7 | 8 | message PostAppreciation { 9 | Model model = 1; 10 | uint64 post_id = 2; 11 | uint64 user_id = 3; 12 | int32 amount = 4; 13 | Post post = 5; 14 | User user = 6; 15 | } 16 | -------------------------------------------------------------------------------- /post_rate.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "rate.proto"; 6 | 7 | message PostRate { 8 | Model model = 1; 9 | uint64 post_id = 2; 10 | uint64 user_id = 3; 11 | RateType type = 4; 12 | } 13 | -------------------------------------------------------------------------------- /punishment.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "google/protobuf/timestamp.proto"; 6 | import "google/protobuf/wrappers.proto"; 7 | import "thread.proto"; 8 | import "post.proto"; 9 | import "category.proto"; 10 | import "user.proto"; 11 | import "identity.proto"; 12 | 13 | enum PunishType { 14 | PunishTypeMute = 0; 15 | PunishTypeNoCreateThread = 1; 16 | PunishTypeBanCategory = 2; 17 | } 18 | 19 | message Punishment { 20 | Model model = 1; 21 | google.protobuf.Timestamp end_at = 2; 22 | google.protobuf.UInt64Value user_id = 3; 23 | google.protobuf.UInt64Value identity_id = 4; 24 | PunishType type = 5; 25 | string reason = 6; 26 | google.protobuf.UInt64Value category_id = 7; 27 | google.protobuf.UInt64Value from_thread_id = 8; 28 | google.protobuf.UInt64Value from_post_id = 9; 29 | Thread from_thread = 10; 30 | Post from_post = 11; 31 | bool ban_user = 12; 32 | uint64 days = 13; 33 | Category category = 14; 34 | User user = 15; 35 | Identity identity = 16; 36 | uint64 announcement_thread_id = 17; 37 | } 38 | -------------------------------------------------------------------------------- /rate.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | 5 | enum RateType { 6 | RateTypeNormal = 0; 7 | RateTypeHate = -1; 8 | RateTypeLike = 1; 9 | } 10 | -------------------------------------------------------------------------------- /report.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | 6 | enum ReportTarget { 7 | ReportTargetThread = 0; 8 | ReportTargetPost = 1; 9 | } 10 | 11 | enum ReportType { 12 | ReportTypeNormal = 0; 13 | ReportTypePolitics = 1; 14 | ReportTypePorn = 2; 15 | ReportTypeContact = 3; 16 | ReportTypeAbuse = 4; 17 | ReportTypeKY = 5; 18 | } 19 | 20 | message Report { 21 | Model model = 1; 22 | uint64 user_id = 2; 23 | ReportTarget target = 3; 24 | ReportType type = 4; 25 | uint64 target_id = 5; 26 | } 27 | -------------------------------------------------------------------------------- /setting.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "google/protobuf/wrappers.proto"; 6 | 7 | message Setting { 8 | Model model = 1; 9 | uint64 user_id = 2; 10 | string filtered_words = 3; 11 | string filtered_tag_ids = 4; 12 | google.protobuf.BoolValue inactive_read = 5; 13 | google.protobuf.BoolValue hide_bad_posts = 6; 14 | google.protobuf.BoolValue hide_bad_threads = 7; 15 | google.protobuf.BoolValue enable_push_notifications = 8; 16 | google.protobuf.BoolValue enable_utilities = 9; 17 | string filtered_category_ids = 10; 18 | } 19 | -------------------------------------------------------------------------------- /site_config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | 6 | message SiteConfig { 7 | Model model = 1; 8 | string user_bg_url = 2; 9 | } 10 | -------------------------------------------------------------------------------- /subscribe.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "google/protobuf/wrappers.proto"; 5 | import "model.proto"; 6 | import "user.proto"; 7 | import "thread.proto"; 8 | 9 | message Subscribe { 10 | Model model = 1; 11 | uint64 user_id = 2; 12 | google.protobuf.BoolValue subscribe_mention = 3; 13 | google.protobuf.BoolValue subscribe_post = 4; 14 | uint64 thread_id = 5; 15 | User user = 6; 16 | Thread thread = 7; 17 | } 18 | -------------------------------------------------------------------------------- /system_message.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "google/protobuf/wrappers.proto"; 5 | import "model.proto"; 6 | import "thread.proto"; 7 | import "post.proto"; 8 | 9 | message SystemMessage { 10 | Model model = 1; 11 | string title = 2; 12 | string body = 3; 13 | google.protobuf.BoolValue can_rebuttal = 4; 14 | google.protobuf.BoolValue has_rebuttal = 5; 15 | google.protobuf.BoolValue rebuttal_rejected = 6; 16 | google.protobuf.UInt64Value from_thread_id = 7; 17 | google.protobuf.UInt64Value from_post_id = 8; 18 | Thread from_thread = 9; 19 | Post from_post = 10; 20 | } 21 | -------------------------------------------------------------------------------- /tag.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "google/protobuf/wrappers.proto"; 6 | 7 | message Tag { 8 | Model model = 1; 9 | string name = 2; 10 | int64 color = 3; 11 | google.protobuf.BoolValue hide = 4; 12 | google.protobuf.BoolValue browsable = 5; 13 | } 14 | -------------------------------------------------------------------------------- /thread.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "category.proto"; 6 | import "tag.proto"; 7 | import "identity.proto"; 8 | import "google/protobuf/wrappers.proto"; 9 | 10 | enum ThreadStatus { 11 | ThreadStatusNormal = 0; 12 | ThreadStatusHide = 1; 13 | ThreadStatusCollapsed = 2; 14 | } 15 | 16 | message Thread { 17 | Model model = 1; 18 | string title = 2; 19 | uint64 category_id = 3; 20 | Category category = 4; 21 | repeated Tag tags = 5; 22 | string identity_code = 6; 23 | string content = 7; 24 | uint64 view_count = 8; 25 | uint64 like_count = 9; 26 | uint64 hate_count = 10; 27 | uint64 reply_count = 11; 28 | bool is_top = 12; 29 | bool is_fav = 13; 30 | bool is_like = 14; 31 | bool is_hate = 15; 32 | ThreadStatus status = 16; 33 | int64 last_reply_at = 17 [jstype = JS_STRING]; 34 | Identity identity = 18; 35 | bool is_sage = 19; // 下げ 36 | bool is_read_only = 20; 37 | bool hide_in_timeline = 21; 38 | google.protobuf.BoolValue is_alice = 22; 39 | google.protobuf.UInt64Value last_read = 23; 40 | bool has_read = 24; 41 | uint64 appreciation_count = 25; 42 | bool is_appreciated = 26; 43 | bool can_delete = 27; 44 | bool has_popular = 28; 45 | string remark = 29; 46 | string preview = 30; 47 | google.protobuf.BoolValue disable_hate = 31; 48 | string hide_reason = 32; 49 | } 50 | -------------------------------------------------------------------------------- /thread_appreciation.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "thread.proto"; 6 | import "user.proto"; 7 | 8 | message ThreadAppreciation { 9 | Model model = 1; 10 | uint64 thread_id = 2; 11 | uint64 user_id = 3; 12 | int32 amount = 4; 13 | Thread thread = 5; 14 | User user = 6; 15 | } 16 | -------------------------------------------------------------------------------- /thread_rate.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "rate.proto"; 6 | import "thread.proto"; 7 | import "user.proto"; 8 | 9 | message ThreadRate { 10 | Model model = 1; 11 | uint64 thread_id = 2; 12 | uint64 user_id = 3; 13 | RateType type = 4; 14 | Thread thread = 5; 15 | User user = 6; 16 | } 17 | -------------------------------------------------------------------------------- /treehole.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "auth.proto"; 5 | import "user.proto"; 6 | import "category.proto"; 7 | import "tag.proto"; 8 | import "thread.proto"; 9 | import "post.proto"; 10 | import "rate.proto"; 11 | import "identity.proto"; 12 | import "setting.proto"; 13 | import "report.proto"; 14 | import "notification.proto"; 15 | import "subscribe.proto"; 16 | import "user_device.proto"; 17 | import "site_config.proto"; 18 | import "punishment.proto"; 19 | 20 | service TreeHole { 21 | rpc Ping (EmptyRequest) returns (EmptyRequest) {} 22 | rpc GetOAuthConfig (OAuthConfigRequest) returns (OAuthConfigResponse) {} 23 | rpc GetSiteConfig (EmptyRequest) returns (SiteConfig) {} 24 | rpc OAuthLogin (OAuthLoginRequest) returns (OAuthLoginResponse) {} 25 | rpc RegisterDevice (UserDevice) returns (EmptyRequest) {} 26 | rpc GetProfile (EmptyRequest) returns (User) {} 27 | rpc SetActiveIdentity (IDRequest) returns (User) {} 28 | rpc GetAllCategories (EmptyRequest) returns (CategoriesResponse) {} 29 | rpc GetAllTags (TagsRequest) returns (TagsResponse) {} 30 | rpc GetHottestThreads (ThreadsQueryRequest) returns (ThreadsResponse) {} 31 | rpc GetLatestThreads (ThreadsQueryRequest) returns (ThreadsResponse) {} 32 | rpc GetUserThreads (ThreadsQueryRequest) returns (ThreadsResponse) {} 33 | rpc GetUserPosts (PostsQueryRequest) returns (PostsResponse) {} 34 | rpc GetUserFavThreads (ThreadsQueryRequest) returns (ThreadsResponse) {} 35 | rpc GetUserParticipateThreads (ThreadsQueryRequest) returns (ThreadsResponse) {} 36 | rpc GetThreadUserIdentities (Thread) returns (IdentitiesResponse) {} 37 | rpc GetThread (PostsQueryRequest) returns (Thread) {} 38 | rpc GetThreadPosts (PostsQueryRequest) returns (PostsResponse) {} 39 | rpc GetThreadPostsEx (PostsQueryRequestEx) returns (PostsResponse) {} 40 | rpc GetPost (Post) returns (Post) {} 41 | rpc RateThread (RateRequest) returns (Thread) {} 42 | rpc FavThread (FavRequest) returns (Thread) {} 43 | rpc RatePost (RateRequest) returns (Post) {} 44 | rpc AppreciateThread (AppreciateRequest) returns (Thread) {} 45 | rpc AppreciatePost (AppreciateRequest) returns (Post) {} 46 | rpc PutPost (Post) returns (Post) {} 47 | rpc DeletePost (Post) returns (EmptyRequest) {} 48 | rpc PutThread (Thread) returns (Thread) {} 49 | rpc DeleteThread (Thread) returns (EmptyRequest) {} 50 | rpc CreateIdentity (EmptyRequest) returns (User) {} 51 | rpc DisableIdentity (Identity) returns (User) {} 52 | rpc GetCreateIdentityQuota (EmptyRequest) returns (QuotaResponse) {} 53 | rpc UpdateSetting (Setting) returns (Setting) {} 54 | rpc PutReport (Report) returns (Report) {} 55 | rpc SearchThreads (SearchRequest) returns (ThreadsResponse) {} 56 | rpc GetUnreadNotificationCount (EmptyRequest) returns (CountReply) {} 57 | rpc PutNotificationRead (Notification) returns (EmptyRequest) {} 58 | rpc PutAllNotificationRead (EmptyRequest) returns (EmptyRequest) {} 59 | rpc GetAllNotifications (NotificationQueryRequest) returns (NotificationResponse) {} 60 | rpc PutSubscribe (Subscribe) returns (Subscribe) {} 61 | rpc GetSubscribe (Subscribe) returns (Subscribe) {} 62 | rpc GetBrowsableTags (EmptyRequest) returns (TagsResponse) {} 63 | rpc CheckIn (EmptyRequest) returns (FishResponse) {} 64 | rpc GetUploadUrl (UploadRequest) returns (UploadResponse) {} 65 | rpc GetUserStats (EmptyRequest) returns (UserStatsResponse) {} 66 | rpc GetDownloadUrl (UploadResponse) returns (UploadResponse) {} 67 | rpc GetPunishments (EmptyRequest) returns (PunishmentsResponse) {} 68 | } 69 | 70 | enum Sort { 71 | SortAsc = 0; 72 | SortDesc = 1; 73 | SortPopular = 2; 74 | } 75 | 76 | message OAuthConfigRequest { 77 | OAuthLoginChannel channel = 1; 78 | LoginSource source = 2; 79 | } 80 | 81 | message OAuthConfigResponse { 82 | string authorize_url = 1; 83 | string client_id = 2; 84 | repeated string scopes = 3; 85 | } 86 | 87 | message OAuthLoginRequest { 88 | string code = 1; 89 | OAuthLoginChannel channel = 2; 90 | LoginSource source = 3; 91 | WebSource web_source = 4; 92 | } 93 | 94 | message OAuthLoginResponse { 95 | string token = 1; 96 | } 97 | 98 | message EmptyRequest {} 99 | 100 | message CategoriesResponse { 101 | repeated Category categories = 1; 102 | } 103 | 104 | message TagsRequest { 105 | bool all = 1; 106 | } 107 | 108 | message TagsResponse { 109 | repeated Tag tags = 1; 110 | } 111 | 112 | message ThreadsQueryRequest { 113 | int64 last = 1 [jstype = JS_STRING]; 114 | uint32 size = 2; 115 | Sort sort = 3; 116 | uint64 category_id = 4; 117 | repeated uint64 tag_ids = 5; 118 | } 119 | 120 | message PostsQueryRequest { 121 | uint64 thread_id = 1; 122 | uint64 last = 2; 123 | uint64 top = 3; 124 | uint32 size = 4; 125 | Sort sort = 5; 126 | bool only_author = 6; 127 | bool should_statistic = 7; 128 | } 129 | 130 | enum LoadDirection { 131 | LoadDirectionDown = 0; 132 | LoadDirectionUp = 1; 133 | } 134 | 135 | message PostsQueryRequestEx { 136 | uint64 thread_id = 1; 137 | uint64 last = 2; 138 | uint64 top = 3; 139 | uint32 size = 4; 140 | Sort sort = 5; 141 | bool only_author = 6; 142 | LoadDirection direction = 7; 143 | } 144 | 145 | message ThreadsResponse { 146 | repeated Thread threads = 1; 147 | } 148 | 149 | message PostsResponse { 150 | repeated Post posts = 1; 151 | uint64 total = 2; 152 | } 153 | 154 | message RateRequest { 155 | uint64 id = 1; 156 | RateType type = 2; 157 | } 158 | 159 | message AppreciateRequest { 160 | uint64 id = 1; 161 | int32 amount = 2; 162 | } 163 | 164 | message FavRequest { 165 | uint64 id = 1; 166 | bool is_fav = 2; 167 | } 168 | 169 | message IDRequest { 170 | uint64 id = 1; 171 | } 172 | 173 | message QuotaResponse { 174 | uint64 monthly_remain = 1; 175 | uint64 remain = 2; 176 | } 177 | 178 | message SearchRequest { 179 | string keyword = 1; 180 | uint32 page_size = 2; 181 | uint32 offset = 3; 182 | } 183 | 184 | message CountReply { 185 | uint64 count = 1; 186 | } 187 | 188 | message NotificationQueryRequest { 189 | int64 last = 1 [jstype = JS_STRING]; 190 | uint64 page_size = 2; 191 | bool only_unread = 3; 192 | NotificationType type = 4; 193 | } 194 | 195 | message NotificationResponse { 196 | repeated Notification notifications = 1; 197 | } 198 | 199 | message IdentitiesResponse { 200 | repeated Identity identities = 1; 201 | } 202 | 203 | message FishResponse { 204 | double fish_count = 1; 205 | } 206 | 207 | message UploadRequest { 208 | string file_name = 1; 209 | uint64 size = 2; 210 | string md5 = 3; 211 | string content_type = 4; 212 | uint64 width = 5; 213 | uint64 height = 6; 214 | } 215 | 216 | message UploadResponse { 217 | string uuid = 1; 218 | string url = 2; 219 | string name = 3; 220 | uint64 width = 4; 221 | uint64 height = 5; 222 | } 223 | 224 | message UserStatsResponse { 225 | int64 thread_count = 1; 226 | int64 post_count = 2; 227 | int64 got_like_count = 3; 228 | int64 got_hate_count = 4; 229 | int64 sent_like_count = 5; 230 | int64 sent_hate_count = 6; 231 | } 232 | 233 | message PunishmentsResponse { 234 | repeated Punishment punishments = 1; 235 | } -------------------------------------------------------------------------------- /upload_file.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "user.proto"; 6 | 7 | message UploadFile { 8 | Model model = 1; 9 | uint64 user_id = 2; 10 | uint64 thread_id = 3; 11 | User user = 4; 12 | string file_name = 5; 13 | uint64 size = 6; 14 | string uuid = 7; 15 | string content_type = 8; 16 | uint64 width = 9; 17 | uint64 height = 10; 18 | bool audited = 11; 19 | } 20 | -------------------------------------------------------------------------------- /user.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "identity.proto"; 6 | import "setting.proto"; 7 | import "user_fish.proto"; 8 | 9 | enum UserStatus { 10 | UserStatusNormal = 0; 11 | UserStatusReadOnly = 1; 12 | UserStatusBanned = 2; 13 | } 14 | 15 | enum UserRole { 16 | UserRoleNormal = 0; 17 | UserRoleAdmin = 1; 18 | UserRoleSuperAdmin = 2; 19 | } 20 | 21 | message User { 22 | Model model = 1; 23 | string account = 2; 24 | repeated Identity identities = 3; 25 | UserStatus status = 4; 26 | UserRole role = 5; 27 | Setting setting = 6; 28 | UserFish fish = 7; 29 | UserStat stat = 8; 30 | } 31 | 32 | message UserStat { 33 | uint64 user_id = 1; 34 | int64 liked_count = 2; 35 | int64 thread_count = 3; 36 | int64 appreciation_count = 4; 37 | } -------------------------------------------------------------------------------- /user_check_in.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "user.proto"; 6 | 7 | message UserCheckIn { 8 | Model model = 1; 9 | uint64 user_id = 2; 10 | string date = 3; 11 | User user = 4; 12 | } 13 | -------------------------------------------------------------------------------- /user_device.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "user.proto"; 6 | 7 | enum DeviceType { 8 | DeviceTypeIOS = 0; 9 | DeviceTypeAndroid = 1; 10 | DeviceTypeWeb = 2; 11 | } 12 | 13 | message UserDevice { 14 | Model model = 1; 15 | uint64 user_id = 2; 16 | string device_token = 3; 17 | DeviceType device_type = 4; 18 | User user = 5; 19 | } 20 | -------------------------------------------------------------------------------- /user_fav_thread.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "thread.proto"; 6 | import "user.proto"; 7 | import "google/protobuf/wrappers.proto"; 8 | 9 | message UserFavThread { 10 | Model model = 1; 11 | uint64 thread_id = 2; 12 | uint64 user_id = 3; 13 | Thread thread = 4; 14 | User user = 5; 15 | google.protobuf.BoolValue is_fav = 6; 16 | } 17 | -------------------------------------------------------------------------------- /user_fish.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | 6 | message UserFish { 7 | Model model = 1; 8 | uint64 user_id = 2; 9 | double fish_count = 3; 10 | } 11 | -------------------------------------------------------------------------------- /user_fish_history.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "user.proto"; 6 | 7 | message UserFishHistory { 8 | Model model = 1; 9 | uint64 user_id = 2; 10 | double delta = 3; 11 | User user = 4; 12 | string message = 5; 13 | } 14 | -------------------------------------------------------------------------------- /user_thread_identity.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "thread.proto"; 6 | import "user.proto"; 7 | 8 | message UserThreadIdentity { 9 | Model model = 1; 10 | uint64 thread_id = 2; 11 | uint64 user_id = 3; 12 | uint64 index = 4; 13 | Thread thread = 5; 14 | User user = 6; 15 | string alice_code = 7; 16 | } 17 | -------------------------------------------------------------------------------- /user_thread_last_read.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package model; 4 | import "model.proto"; 5 | import "user.proto"; 6 | 7 | message UserThreadLastRead { 8 | Model model = 1; 9 | uint64 thread_id = 2; 10 | uint64 user_id = 3; 11 | User user = 4; 12 | uint64 floor = 5; 13 | } 14 | --------------------------------------------------------------------------------