server.proto 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. syntax = "proto3";
  2. package chatto.admin.v1;
  3. import "google/protobuf/field_mask.proto";
  4. import "buf/validate/validate.proto";
  5. import "chatto/api/v1/common.proto";
  6. import "chatto/api/v1/server.proto";
  7. // Runtime-editable server profile settings.
  8. message ServerConfig {
  9. // Server name for page titles. Empty means the default is used.
  10. string server_name = 1;
  11. // Short server description for OG link-preview metadata.
  12. string description = 2;
  13. // Message of the day for the authenticated header.
  14. string motd = 3;
  15. // Welcome message shown on the login page.
  16. string welcome_message = 4;
  17. }
  18. // Request server profile settings.
  19. message GetServerConfigRequest {}
  20. // Server profile settings plus effective public branding.
  21. message GetServerConfigResponse {
  22. reserved 2;
  23. reserved "profile";
  24. // Runtime-editable server profile settings.
  25. ServerConfig config = 1;
  26. // Effective public server profile and branding.
  27. chatto.api.v1.ServerPublicProfile public_profile = 3;
  28. }
  29. // Request to update runtime-editable server profile settings.
  30. message UpdateServerConfigRequest {
  31. // Optional server name for page titles. Set to empty string to use default.
  32. optional string server_name = 1 [(buf.validate.field).string.max_len = 80];
  33. // Optional short server description for OG link-preview metadata. Set to
  34. // empty string to clear.
  35. optional string description = 2 [(buf.validate.field).string.max_len = 500];
  36. // Optional message of the day for the header. Set to empty string to clear.
  37. optional string motd = 3 [(buf.validate.field).string.max_len = 1000];
  38. // Optional welcome message shown on the login page. Set to empty string to
  39. // clear.
  40. optional string welcome_message = 4 [(buf.validate.field).string.max_len = 10000];
  41. // Editable fields to apply or reset: server_name, description, motd, welcome_message.
  42. // Omit to infer populated fields; * selects all editable fields. An explicit
  43. // empty mask is invalid. Unselected values are ignored. Selected absent values
  44. // reset the field to its default, subject to field validation.
  45. google.protobuf.FieldMask update_mask = 5;
  46. }
  47. // Result of updating runtime-editable server profile settings.
  48. message UpdateServerConfigResponse {
  49. reserved 1;
  50. reserved "profile";
  51. // Updated public server profile and branding.
  52. chatto.api.v1.ServerPublicProfile public_profile = 3;
  53. // Updated runtime-editable server profile settings.
  54. ServerConfig config = 2;
  55. }
  56. // Request to upload and set the public server logo.
  57. message UploadServerLogoRequest {
  58. reserved 1 to 3;
  59. reserved "filename", "content_type";
  60. // Image payload. The server validates, resizes, and stores a WebP logo.
  61. chatto.api.v1.ImageUpload image = 4;
  62. }
  63. // Result of uploading the public server logo.
  64. message UploadServerLogoResponse {
  65. reserved 1;
  66. reserved "profile";
  67. // Updated public server profile and branding.
  68. chatto.api.v1.ServerPublicProfile public_profile = 2;
  69. }
  70. // Request to clear the public server logo.
  71. message DeleteServerLogoRequest {}
  72. // Result of clearing the public server logo.
  73. message DeleteServerLogoResponse {
  74. reserved 1;
  75. reserved "profile";
  76. // Updated public server profile and branding.
  77. chatto.api.v1.ServerPublicProfile public_profile = 2;
  78. }
  79. // Request to upload and set the public server banner.
  80. message UploadServerBannerRequest {
  81. reserved 1 to 3;
  82. reserved "filename", "content_type";
  83. // Image payload. The server validates, resizes, and stores a WebP banner.
  84. chatto.api.v1.ImageUpload image = 4;
  85. }
  86. // Result of uploading the public server banner.
  87. message UploadServerBannerResponse {
  88. reserved 1;
  89. reserved "profile";
  90. // Updated public server profile and branding.
  91. chatto.api.v1.ServerPublicProfile public_profile = 2;
  92. }
  93. // Request to clear the public server banner.
  94. message DeleteServerBannerRequest {}
  95. // Result of clearing the public server banner.
  96. message DeleteServerBannerResponse {
  97. reserved 1;
  98. reserved "profile";
  99. // Updated public server profile and branding.
  100. chatto.api.v1.ServerPublicProfile public_profile = 2;
  101. }
  102. // Request for server security configuration.
  103. message GetServerSecurityConfigRequest {}
  104. // Security-sensitive server configuration. The caller must be allowed to
  105. // manage server configuration.
  106. message GetServerSecurityConfigResponse {
  107. // Blocked usernames. Entries are normalized by the server.
  108. repeated string blocked_usernames = 1;
  109. }
  110. // Request to update the server blocked-username list.
  111. message UpdateBlockedUsernamesRequest {
  112. // Complete replacement list. Select blocked_usernames in update_mask and
  113. // omit this field or send [] to clear the list. Empty entries are ignored
  114. // and entries are normalized by the server.
  115. repeated string blocked_usernames = 1 [(buf.validate.field).repeated = {max_items: 1000}];
  116. // Editable fields to apply or reset: blocked_usernames.
  117. // Omit to infer populated fields; * selects all editable fields. An explicit
  118. // empty mask is invalid. Unselected values are ignored. Selected absent values
  119. // reset the field to its default, subject to field validation.
  120. google.protobuf.FieldMask update_mask = 2;
  121. }
  122. // Result of updating the server blocked-username list.
  123. message UpdateBlockedUsernamesResponse {
  124. // Effective blocked usernames after the update.
  125. repeated string blocked_usernames = 1;
  126. }
  127. // One server advertised in the public Neighbor directory.
  128. message Neighbor {
  129. reserved 4;
  130. reserved "testimonial";
  131. // Stable opaque resource ID.
  132. string id = 1;
  133. // Canonical HTTP or HTTPS server origin.
  134. string origin = 2;
  135. // Opaque revision required for update and delete requests.
  136. string revision = 3;
  137. }
  138. // Request to list configured Neighbors.
  139. message ListNeighborsRequest {}
  140. // Configured Neighbors. The response has no ordering contract.
  141. message ListNeighborsResponse {
  142. repeated Neighbor neighbors = 1;
  143. }
  144. // Request for one configured Neighbor.
  145. message GetNeighborRequest {
  146. string neighbor_id = 1 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  147. }
  148. // One configured Neighbor.
  149. message GetNeighborResponse {
  150. Neighbor neighbor = 1;
  151. }
  152. // Request to advertise one server origin.
  153. message CreateNeighborRequest {
  154. reserved 2;
  155. reserved "testimonial";
  156. string origin = 1 [(buf.validate.field).string = {min_len: 1, max_len: 2048}];
  157. }
  158. // Newly configured Neighbor.
  159. message CreateNeighborResponse {
  160. Neighbor neighbor = 1;
  161. }
  162. // Request to change one advertised server origin.
  163. message UpdateNeighborRequest {
  164. reserved 4;
  165. reserved "testimonial";
  166. string neighbor_id = 1 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  167. string origin = 2 [(buf.validate.field).string = {min_len: 1, max_len: 2048}];
  168. string revision = 3 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  169. // Editable fields to apply or reset: origin.
  170. // Omit to infer populated fields; * selects all editable fields. An explicit
  171. // empty mask is invalid. Unselected values are ignored. Selected absent values
  172. // reset the field to its default, subject to field validation.
  173. google.protobuf.FieldMask update_mask = 5;
  174. }
  175. // Updated Neighbor.
  176. message UpdateNeighborResponse {
  177. Neighbor neighbor = 1;
  178. }
  179. // Request to stop advertising one server origin.
  180. message DeleteNeighborRequest {
  181. string neighbor_id = 1 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  182. string revision = 2 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  183. }
  184. // Empty result after a Neighbor is deleted.
  185. message DeleteNeighborResponse {}
  186. // Provides server-administration commands for profile, branding, and security
  187. // settings.
  188. service AdminServerService {
  189. // Gets runtime-editable server profile settings. This RPC requires
  190. // server.manage.
  191. rpc GetServerConfig(GetServerConfigRequest) returns (GetServerConfigResponse);
  192. // Updates runtime-editable server profile settings. This RPC requires
  193. // server.manage.
  194. rpc UpdateServerConfig(UpdateServerConfigRequest) returns (UpdateServerConfigResponse);
  195. // Uploads and sets the public server logo. This RPC requires server.manage.
  196. rpc UploadServerLogo(UploadServerLogoRequest) returns (UploadServerLogoResponse);
  197. // Clears the public server logo. This RPC requires server.manage.
  198. rpc DeleteServerLogo(DeleteServerLogoRequest) returns (DeleteServerLogoResponse);
  199. // Uploads and sets the public server banner. This RPC requires server.manage.
  200. rpc UploadServerBanner(UploadServerBannerRequest) returns (UploadServerBannerResponse);
  201. // Clears the public server banner. This RPC requires server.manage.
  202. rpc DeleteServerBanner(DeleteServerBannerRequest) returns (DeleteServerBannerResponse);
  203. // Returns security-sensitive server configuration. This RPC requires
  204. // server.manage.
  205. rpc GetServerSecurityConfig(GetServerSecurityConfigRequest) returns (GetServerSecurityConfigResponse);
  206. // Updates the blocked-username list. This RPC requires server.manage.
  207. rpc UpdateBlockedUsernames(UpdateBlockedUsernamesRequest) returns (UpdateBlockedUsernamesResponse);
  208. // Lists configured Neighbors. This RPC requires server.manage-neighbors.
  209. rpc ListNeighbors(ListNeighborsRequest) returns (ListNeighborsResponse);
  210. // Gets one configured Neighbor. This RPC requires server.manage-neighbors.
  211. rpc GetNeighbor(GetNeighborRequest) returns (GetNeighborResponse);
  212. // Advertises one server origin. The origin must not identify this server.
  213. // This RPC requires server.manage-neighbors.
  214. rpc CreateNeighbor(CreateNeighborRequest) returns (CreateNeighborResponse);
  215. // Changes one advertised server origin. The new origin must not identify
  216. // this server. This RPC requires server.manage-neighbors.
  217. rpc UpdateNeighbor(UpdateNeighborRequest) returns (UpdateNeighborResponse);
  218. // Stops advertising one server origin. This RPC requires
  219. // server.manage-neighbors.
  220. rpc DeleteNeighbor(DeleteNeighborRequest) returns (DeleteNeighborResponse);
  221. }