server.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. reserved 4;
  118. reserved "testimonial";
  119. // Stable opaque resource ID.
  120. string id = 1;
  121. // Canonical HTTP or HTTPS server origin.
  122. string origin = 2;
  123. // Opaque revision required for update and delete requests.
  124. string revision = 3;
  125. }
  126. // Request to list configured Neighbors.
  127. message ListNeighborsRequest {}
  128. // Configured Neighbors. The response has no ordering contract.
  129. message ListNeighborsResponse {
  130. repeated Neighbor neighbors = 1;
  131. }
  132. // Request for one configured Neighbor.
  133. message GetNeighborRequest {
  134. string neighbor_id = 1 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  135. }
  136. // One configured Neighbor.
  137. message GetNeighborResponse {
  138. Neighbor neighbor = 1;
  139. }
  140. // Request to advertise one server origin.
  141. message CreateNeighborRequest {
  142. reserved 2;
  143. reserved "testimonial";
  144. string origin = 1 [(buf.validate.field).string = {min_len: 1, max_len: 2048}];
  145. }
  146. // Newly configured Neighbor.
  147. message CreateNeighborResponse {
  148. Neighbor neighbor = 1;
  149. }
  150. // Request to change one advertised server origin.
  151. message UpdateNeighborRequest {
  152. reserved 4;
  153. reserved "testimonial";
  154. string neighbor_id = 1 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  155. string origin = 2 [(buf.validate.field).string = {min_len: 1, max_len: 2048}];
  156. string revision = 3 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  157. }
  158. // Updated Neighbor.
  159. message UpdateNeighborResponse {
  160. Neighbor neighbor = 1;
  161. }
  162. // Request to stop advertising one server origin.
  163. message DeleteNeighborRequest {
  164. string neighbor_id = 1 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  165. string revision = 2 [(buf.validate.field).string = {min_len: 1, max_len: 64}];
  166. }
  167. // Empty result after a Neighbor is deleted.
  168. message DeleteNeighborResponse {}
  169. // Provides server-administration commands for profile, branding, and security
  170. // settings.
  171. service AdminServerService {
  172. // Gets runtime-editable server profile settings. This RPC requires
  173. // server.manage.
  174. rpc GetServerConfig(GetServerConfigRequest) returns (GetServerConfigResponse);
  175. // Updates runtime-editable server profile settings. This RPC requires
  176. // server.manage.
  177. rpc UpdateServerConfig(UpdateServerConfigRequest) returns (UpdateServerConfigResponse);
  178. // Uploads and sets the public server logo. This RPC requires server.manage.
  179. rpc UploadServerLogo(UploadServerLogoRequest) returns (UploadServerLogoResponse);
  180. // Clears the public server logo. This RPC requires server.manage.
  181. rpc DeleteServerLogo(DeleteServerLogoRequest) returns (DeleteServerLogoResponse);
  182. // Uploads and sets the public server banner. This RPC requires server.manage.
  183. rpc UploadServerBanner(UploadServerBannerRequest) returns (UploadServerBannerResponse);
  184. // Clears the public server banner. This RPC requires server.manage.
  185. rpc DeleteServerBanner(DeleteServerBannerRequest) returns (DeleteServerBannerResponse);
  186. // Returns security-sensitive server configuration. This RPC requires
  187. // server.manage.
  188. rpc GetServerSecurityConfig(GetServerSecurityConfigRequest) returns (GetServerSecurityConfigResponse);
  189. // Updates the blocked-username list. This RPC requires server.manage.
  190. rpc UpdateBlockedUsernames(UpdateBlockedUsernamesRequest) returns (UpdateBlockedUsernamesResponse);
  191. // Lists configured Neighbors. This RPC requires server.manage-neighbors.
  192. rpc ListNeighbors(ListNeighborsRequest) returns (ListNeighborsResponse);
  193. // Gets one configured Neighbor. This RPC requires server.manage-neighbors.
  194. rpc GetNeighbor(GetNeighborRequest) returns (GetNeighborResponse);
  195. // Advertises one server origin. The origin must not identify this server.
  196. // This RPC requires server.manage-neighbors.
  197. rpc CreateNeighbor(CreateNeighborRequest) returns (CreateNeighborResponse);
  198. // Changes one advertised server origin. The new origin must not identify
  199. // this server. This RPC requires server.manage-neighbors.
  200. rpc UpdateNeighbor(UpdateNeighborRequest) returns (UpdateNeighborResponse);
  201. // Stops advertising one server origin. This RPC requires
  202. // server.manage-neighbors.
  203. rpc DeleteNeighbor(DeleteNeighborRequest) returns (DeleteNeighborResponse);
  204. }