server.proto 8.3 KB

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