Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat: add per-user usage limits (#6456)

boojack1a5886d7c1a0
diff --git a/AGENTS.md b/AGENTS.md
index 08b81fc47..0617d2280 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -74,7 +74,7 @@ Every root folder is named for what it holds. Read the folder's `doc.go` or `REA
| `server/frontend/` | Static SPA serving; `dist/` is the built SPA baked in by `go:embed` | |
| `server/mcp/` | Model Context Protocol server | |
| `server/auth/` | JWT access tokens, refresh tokens, PAT handling | |
-| `core/` | Business rules with no HTTP and no SQL: `access`, `notification`, `memopayload`, `memoexport` | store, provider, markdown, filter, internal |
+| `core/` | Business rules with no HTTP and no SQL: `access`, `notification`, `memopayload`, `memoexport`, `usagelimit` | store, provider, markdown, filter, internal |
| `store/` | Store facade, cache, migrations, `Driver` interface; `store/db/{sqlite,mysql,postgres}/` implement it | provider, markdown, filter, internal |
| `markdown/` | Markdown engine: parser, AST, memos syntax extensions, renderer, memo payload | proto/gen, internal |
| `filter/` | CEL filter compiler: parse to IR, render to SQL per driver, filterable field schema | internal |
diff --git a/core/README.md b/core/README.md
index 38d8b2917..37aa3671a 100644
--- a/core/README.md
+++ b/core/README.md
@@ -10,6 +10,7 @@ apply the same way.
| `notification/` | building and dispatching inbox and email notifications |
| `memopayload/` | rebuilding a memo's derived payload from its markdown |
| `memoexport/` | the Memos Export Format container and records used for export and import |
+| `usagelimit/` | which usage limits apply to a user, and whether a memo create or an upload stays within them |
Layering: `core` may import `store`, `provider`, `markdown`, `filter`,
`proto/gen`, and `internal`. It must not import `server` or `cmd`. New
diff --git a/core/usagelimit/usagelimit.go b/core/usagelimit/usagelimit.go
new file mode 100644
index 000000000..a10dcb54f
--- /dev/null
+++ b/core/usagelimit/usagelimit.go
@@ -0,0 +1,195 @@
+// Package usagelimit resolves the usage limits that apply to a user and
+// decides whether creating a memo or uploading a file stays within them.
+//
+// A usage limit sets one value for one metric, for every user (a default) or
+// for one user. For each metric, the user's own limit applies if there is
+// one, otherwise the default, otherwise the metric is unlimited. A value of 0
+// is unlimited. Usage is counted live on every check, so there are no stored
+// counters that can drift; concurrent requests can therefore overshoot a limit
+// by the number of requests in flight.
+package usagelimit
+
+import (
+ "context"
+ "fmt"
+
+ "github.com/pkg/errors"
+
+ storepb "github.com/usememos/memos/proto/gen/store"
+)
+
+// Metric is what a usage limit counts.
+type Metric = storepb.InstanceUsageLimitsSetting_Metric
+
+// The metrics a usage limit can set.
+const (
+ MetricMemos = storepb.InstanceUsageLimitsSetting_MEMOS
+ MetricStorageBytes = storepb.InstanceUsageLimitsSetting_STORAGE_BYTES
+ MetricUploadBytes = storepb.InstanceUsageLimitsSetting_UPLOAD_BYTES
+)
+
+// Store is the data the checks read. *store.Store implements it.
+type Store interface {
+ GetInstanceUsageLimitsSetting(ctx context.Context) (*storepb.InstanceUsageLimitsSetting, error)
+ CountUserMemos(ctx context.Context, creatorID int32) (int64, error)
+ GetAttachmentStorageUsage(ctx context.Context, creatorID int32) (int64, error)
+}
+
+// Limit is the limit in effect for one metric.
+type Limit struct {
+ // Value is the limit. 0 means unlimited.
+ Value int64
+ // Source is the ID of the usage limit the value comes from, or empty when
+ // no usage limit applies.
+ Source string
+}
+
+// Limited reports whether the limit restricts anything.
+func (l Limit) Limited() bool {
+ return l.Value > 0
+}
+
+// Effective is the limit in effect for each metric of one user.
+type Effective struct {
+ Memos Limit
+ StorageBytes Limit
+ UploadBytes Limit
+}
+
+// Resolve returns the limits in effect for userID: for each metric, the user's
+// own limit, otherwise the default, otherwise unlimited.
+func Resolve(setting *storepb.InstanceUsageLimitsSetting, userID int32) Effective {
+ var effective Effective
+ for _, limit := range setting.GetLimits() {
+ if limit.UserId != 0 && limit.UserId != userID {
+ continue
+ }
+ target := effective.get(limit.Metric)
+ if target == nil {
+ continue
+ }
+ // A user's own limit replaces the default, whatever the order.
+ if limit.UserId == 0 && target.Source != "" {
+ continue
+ }
+ *target = Limit{Value: limit.Value, Source: limit.Uid}
+ }
+ return effective
+}
+
+func (e *Effective) get(metric Metric) *Limit {
+ switch metric {
+ case MetricMemos:
+ return &e.Memos
+ case MetricStorageBytes:
+ return &e.StorageBytes
+ case MetricUploadBytes:
+ return &e.UploadBytes
+ default:
+ return nil
+ }
+}
+
+// Refusal is returned when an action would exceed a usage limit.
+type Refusal struct {
+ Metric Metric
+ // Limit is the value of the usage limit that applied.
+ Limit int64
+ // Usage is the current usage: the memo count, the stored bytes, or for
+ // UPLOAD_BYTES the size of the refused file.
+ Usage int64
+ // Source is the ID of the usage limit that applied.
+ Source string
+}
+
+func (r *Refusal) Error() string {
+ return fmt.Sprintf("usage limit %s exceeded: %s limit %d, usage %d", r.Source, r.Metric, r.Limit, r.Usage)
+}
+
+// AsRefusal returns the refusal in err's chain, or nil.
+func AsRefusal(err error) *Refusal {
+ var refusal *Refusal
+ if errors.As(err, &refusal) {
+ return refusal
+ }
+ return nil
+}
+
+// EffectiveFor reads the usage limits and resolves them for userID.
+func EffectiveFor(ctx context.Context, s Store, userID int32) (Effective, error) {
+ setting, err := s.GetInstanceUsageLimitsSetting(ctx)
+ if err != nil {
+ return Effective{}, err
+ }
+ return Resolve(setting, userID), nil
+}
+
+// CheckMemoCreate returns a *Refusal when userID has reached the memo limit.
+// With no memo limit in effect it runs no count query.
+func CheckMemoCreate(ctx context.Context, s Store, userID int32) error {
+ effective, err := EffectiveFor(ctx, s, userID)
+ if err != nil {
+ return err
+ }
+ if !effective.Memos.Limited() {
+ return nil
+ }
+ count, err := s.CountUserMemos(ctx, userID)
+ if err != nil {
+ return errors.Wrap(err, "failed to count memos")
+ }
+ if count >= effective.Memos.Value {
+ return &Refusal{Metric: MetricMemos, Limit: effective.Memos.Value, Usage: count, Source: effective.Memos.Source}
+ }
+ return nil
+}
+
+// CheckUpload returns a *Refusal when storing a file of size bytes would break
+// the per-file limit or the storage limit of userID. instanceUploadLimit is
+// the instance-wide upload limit in bytes, which the caller checks first: a
+// per-file usage limit only applies when it is stricter than that limit. With
+// no storage limit in effect it runs no sum query.
+func CheckUpload(ctx context.Context, s Store, userID int32, size, instanceUploadLimit int64) error {
+ effective, err := EffectiveFor(ctx, s, userID)
+ if err != nil {
+ return err
+ }
+ if upload := effective.UploadBytes; upload.Limited() && upload.Value < instanceUploadLimit && size > upload.Value {
+ return &Refusal{Metric: MetricUploadBytes, Limit: upload.Value, Usage: size, Source: upload.Source}
+ }
+ if !effective.StorageBytes.Limited() {
+ return nil
+ }
+ used, err := s.GetAttachmentStorageUsage(ctx, userID)
+ if err != nil {
+ return errors.Wrap(err, "failed to sum storage usage")
+ }
+ if used+size > effective.StorageBytes.Value {
+ return &Refusal{Metric: MetricStorageBytes, Limit: effective.StorageBytes.Value, Usage: used, Source: effective.StorageBytes.Source}
+ }
+ return nil
+}
+
+// Usage is a user's usage and the limits in effect for the user.
+type Usage struct {
+ MemoCount int64
+ StorageBytes int64
+ Limits Effective
+}
+
+// UsageFor counts userID's memos and stored bytes and resolves the limits.
+func UsageFor(ctx context.Context, s Store, userID int32) (*Usage, error) {
+ effective, err := EffectiveFor(ctx, s, userID)
+ if err != nil {
+ return nil, err
+ }
+ count, err := s.CountUserMemos(ctx, userID)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to count memos")
+ }
+ used, err := s.GetAttachmentStorageUsage(ctx, userID)
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to sum storage usage")
+ }
+ return &Usage{MemoCount: count, StorageBytes: used, Limits: effective}, nil
+}
diff --git a/core/usagelimit/usagelimit_test.go b/core/usagelimit/usagelimit_test.go
new file mode 100644
index 000000000..cd2f977ab
--- /dev/null
+++ b/core/usagelimit/usagelimit_test.go
@@ -0,0 +1,113 @@
+package usagelimit
+
+import (
+ "context"
+ "testing"
+
+ "github.com/pkg/errors"
+ "github.com/stretchr/testify/require"
+
+ storepb "github.com/usememos/memos/proto/gen/store"
+)
+
+type fakeStore struct {
+ setting *storepb.InstanceUsageLimitsSetting
+ memos int64
+ storage int64
+ countCalls int
+ sumCalls int
+ settingErr error
+ countingErr error
+}
+
+func (f *fakeStore) GetInstanceUsageLimitsSetting(context.Context) (*storepb.InstanceUsageLimitsSetting, error) {
+ if f.settingErr != nil {
+ return nil, f.settingErr
+ }
+ if f.setting == nil {
+ return &storepb.InstanceUsageLimitsSetting{}, nil
+ }
+ return f.setting, nil
+}
+
+func (f *fakeStore) CountUserMemos(context.Context, int32) (int64, error) {
+ f.countCalls++
+ return f.memos, f.countingErr
+}
+
+func (f *fakeStore) GetAttachmentStorageUsage(context.Context, int32) (int64, error) {
+ f.sumCalls++
+ return f.storage, f.countingErr
+}
+
+func limit(uid string, metric Metric, userID int32, value int64) *storepb.InstanceUsageLimitsSetting_UsageLimit {
+ return &storepb.InstanceUsageLimitsSetting_UsageLimit{Uid: uid, Metric: metric, UserId: userID, Value: value}
+}
+
+func TestResolve(t *testing.T) {
+ const alice, bob = int32(7), int32(8)
+ setting := &storepb.InstanceUsageLimitsSetting{Limits: []*storepb.InstanceUsageLimitsSetting_UsageLimit{
+ // A user's limit listed before the default still wins.
+ limit("alice-storage", MetricStorageBytes, alice, 5<<30),
+ limit("default-storage", MetricStorageBytes, 0, 1<<30),
+ limit("default-memos", MetricMemos, 0, 1000),
+ limit("alice-memos", MetricMemos, alice, 0),
+ limit("bob-upload", MetricUploadBytes, bob, 10<<20),
+ }}
+
+ require.Equal(t, Effective{
+ Memos: Limit{Value: 0, Source: "alice-memos"},
+ StorageBytes: Limit{Value: 5 << 30, Source: "alice-storage"},
+ }, Resolve(setting, alice), "a user's own limit, even unlimited, replaces the default")
+ require.Equal(t, Effective{
+ Memos: Limit{Value: 1000, Source: "default-memos"},
+ StorageBytes: Limit{Value: 1 << 30, Source: "default-storage"},
+ UploadBytes: Limit{Value: 10 << 20, Source: "bob-upload"},
+ }, Resolve(setting, bob))
+ require.Equal(t, Effective{}, Resolve(&storepb.InstanceUsageLimitsSetting{}, alice), "no limits means unlimited")
+}
+
+func TestCheckMemoCreate(t *testing.T) {
+ ctx := context.Background()
+
+ unlimited := &fakeStore{memos: 1 << 20}
+ require.NoError(t, CheckMemoCreate(ctx, unlimited, 1))
+ require.Zero(t, unlimited.countCalls, "no count query runs without a memo limit")
+
+ limited := &fakeStore{memos: 2, setting: &storepb.InstanceUsageLimitsSetting{Limits: []*storepb.InstanceUsageLimitsSetting_UsageLimit{
+ limit("default-memos", MetricMemos, 0, 3),
+ }}}
+ require.NoError(t, CheckMemoCreate(ctx, limited, 1))
+ limited.memos = 3
+ refusal := AsRefusal(CheckMemoCreate(ctx, limited, 1))
+ require.Equal(t, &Refusal{Metric: MetricMemos, Limit: 3, Usage: 3, Source: "default-memos"}, refusal)
+
+ limited.countingErr = errors.New("database down")
+ err := CheckMemoCreate(ctx, limited, 1)
+ require.Error(t, err)
+ require.Nil(t, AsRefusal(err), "a failed count is an error, not a refusal")
+}
+
+func TestCheckUpload(t *testing.T) {
+ ctx := context.Background()
+ const instanceLimit = 30 << 20
+
+ unlimited := &fakeStore{storage: 1 << 40}
+ require.NoError(t, CheckUpload(ctx, unlimited, 1, 1<<20, instanceLimit))
+ require.Zero(t, unlimited.sumCalls, "no sum query runs without a storage limit")
+
+ s := &fakeStore{storage: 900, setting: &storepb.InstanceUsageLimitsSetting{Limits: []*storepb.InstanceUsageLimitsSetting_UsageLimit{
+ limit("default-storage", MetricStorageBytes, 0, 1000),
+ limit("default-upload", MetricUploadBytes, 0, 200),
+ }}}
+ require.NoError(t, CheckUpload(ctx, s, 1, 100, instanceLimit), "exactly at the storage limit is allowed")
+ require.Equal(t, &Refusal{Metric: MetricStorageBytes, Limit: 1000, Usage: 900, Source: "default-storage"}, AsRefusal(CheckUpload(ctx, s, 1, 101, instanceLimit)))
+ require.Equal(t, &Refusal{Metric: MetricUploadBytes, Limit: 200, Usage: 201, Source: "default-upload"}, AsRefusal(CheckUpload(ctx, s, 1, 201, instanceLimit)))
+
+ // A per-file limit at or above the instance limit has no effect; the
+ // instance limit, checked by the caller, applies instead.
+ s.setting.Limits[1].Value = instanceLimit
+ s.storage = 0
+ s.setting.Limits[0].Value = 0
+ require.NoError(t, CheckUpload(ctx, s, 1, instanceLimit, instanceLimit))
+}
diff --git a/docs/design/user-usage-limits.md b/docs/design/user-usage-limits.md
new file mode 100644
index 000000000..55f9a30a1
--- /dev/null
+++ b/docs/design/user-usage-limits.md
@@ -0,0 +1,101 @@
+# User Usage Limits Design
+
+Status: Draft
+
+Date: 2026-10-11
+
+Existing domain language: [Memos context](../../CONTEXT.md)
+
+Related: [API Abuse Controls Design](api-abuse-controls.md), [Configuration Provisioning Design](configuration-provisioning.md)
+
+## Summary
+
+Every system needs limits to stay fast and reliable. Without per-user limits, growth, mistakes, or abuse in one account can slow down or fill up a shared instance for everyone. Memos has only instance-wide limits: upload size and memo length. Users cannot see how close they are to any limit.
+
+Usage limits keep an instance fast and reliable for everyone. This design adds them for three metrics: memo count, total storage, and the size of one file. A limit applies to every user (a default) or to one user, and a user's own limit replaces the default. With no limits, Memos behaves as before. When a limit is reached, creating a memo or starting an upload is refused with one error contract. Users see their usage in Settings. Nothing is ever hidden or deleted.
+
+## Goals
+
+- An admin can set default limits and per-user limits from the API and the web app.
+- Memo creation and uploads are refused once a limit is reached, on every transport.
+- A refused memo save keeps the draft, and its uploaded files, in the editor.
+- A user can see their usage and the limits that apply to them.
+- An instance with no limits runs no extra count or sum queries.
+
+## Non-goals
+
+- Plans, billing, or anything specific to a hosted service.
+- Limits per role or group, for example all admins.
+- Checking imports against limits. Import is not checked yet.
+- Emails when a user nears a limit.
+
+## Behavior
+
+**Metrics.**
+
+| Metric | Counts | Checked on |
+| --- | --- | --- |
+| `MEMOS` | Every memo row the user created: memos, comments, archived memos, and memos in Spaces | `CreateMemo` and `CreateMemoComment` |
+| `STORAGE_BYTES` | The size of the user's uploads, including uploads not attached to a memo. External links do not count | `CreateAttachment`, and the start and finish of `UploadAttachment` |
+| `UPLOAD_BYTES` | The size of one file. It applies only when it is lower than the instance upload limit | The same calls as storage |
+
+**Resolution.** For each metric, the user's own limit applies if there is one, otherwise the default, otherwise the metric is unlimited. A value of 0 is unlimited, so an admin can exempt one user from a default. Admins are limited like everyone else.
+
+**Counting.** Usage is counted live on every check. There are no stored counters that can drift. Parallel requests at a limit can go over it by the number of requests in flight. A failed count fails the request with `INTERNAL`, so a database problem cannot switch limits off.
+
+**Lowering a limit** below a user's usage deletes nothing. New memos or uploads are refused until the user is under the limit.
+
+## API
+
+Five admin-only calls on `InstanceService`, on the resource `usageLimits/{usage_limit}`:
+
+| Call | Route |
+| --- | --- |
+| `ListUsageLimits` | `GET /api/usageLimits`, with `filter` on `user` and `metric` |
+| `GetUsageLimit` | `GET /api/usageLimits/{id}` |
+| `CreateUsageLimit` | `POST /api/usageLimits` |
+| `UpdateUsageLimit` | `PATCH /api/usageLimits/{id}`; only `value` can change |
+| `DeleteUsageLimit` | `DELETE /api/usageLimits/{id}` |
+
+`metric` and `user` are immutable. A second limit for the same metric and user returns `ALREADY_EXISTS`. An instance holds at most 1,000 limits.
+
+`UserService.GetUserUsage` (`GET /api/users/{user}/usage`) returns the memo count, the stored bytes, and for each metric the limit in effect and the `usageLimits/…` name it comes from. The user and admins can call it.
+
+**Refusal contract.** Code `RESOURCE_EXHAUSTED` (HTTP 429), message `quota exceeded`, with:
+
+- `google.rpc.ErrorInfo`: reason `QUOTA_EXCEEDED`, domain `memos.api`, and metadata `metric`, `limit`, `usage`, and `usage_limit`. For `UPLOAD_BYTES`, `usage` is the size of the refused file.
+- `google.rpc.QuotaFailure`, naming the user as the subject.
+
+There is no `RetryInfo` and no `Retry-After` header, because waiting does not lift a usage limit.
+
+## Storage
+
+All limits are stored in one `system_setting` row, key `USAGE_LIMITS`, as the store message `InstanceUsageLimitsSetting`. Limits store the user ID, so renaming a user keeps their limits. There is no new table.
+
+- **Writes** read the row, change it, and write it back only if it is unchanged since the read. A conflicting write retries up to 5 times, then returns `ABORTED`. Uniqueness and the cap are checked inside this step, so they hold across replicas.
+- **Reads for checks** skip the settings cache, as `ACCESS` does, so a change applies on every replica at the next check.
+- **User deletion** removes that user's limits. Writes also drop limits of users that no longer exist.
+- **Settings file.** A deployment can provide `memos-instance-setting-usage-limits.json` in the store format. The write calls then return `FAILED_PRECONDITION`.
+
+The general `UpdateInstanceSetting` call rejects the `USAGE_LIMITS` key, so the usage-limit calls are the only write path.
+
+## Schema change
+
+Migration `26.10/00` adds indexes on `memo.creator_id` and `attachment.creator_id`, so the count and sum queries stay fast. The schema version moves to `26.10.1`.
+
+## Other changes
+
+- **Storage figures exclude external links.** `GetUserStats` and the storage check no longer count `EXTERNAL` attachments, which store no bytes.
+- **The web editor keeps uploaded files after a failed save.** Before, a refused create left the files as local files, so each retry uploaded them again.
+
+## Web app
+
+- A refused memo save keeps the draft and shows a message that names the limit. A refused upload shows a storage or file-size message.
+- Settings, My Account shows usage against the limits. It is hidden when no limit applies.
+- Settings, Usage limits (admin) is one table. The first row, All users, holds the defaults. Each further row is a user with their own limits, which an admin adds, edits, or removes. A user's cell shows the all-users value in gray when the user has no limit of their own. In a user's form, an empty field uses the all-users limit and 0 means no limit.
+- The form warns when a file-size limit is not below the instance upload limit.
+
+## Upgrade and rollback
+
+- **Upgrade.** Existing instances have no limits, so behavior is unchanged apart from the external-link storage fix and the new indexes.
+- **Rollback.** Restore the database from the backup taken before the upgrade, because older binaries refuse a newer schema. Remove a `memos-instance-setting-usage-limits.json` file first, because older binaries refuse to start with a settings file for a key they do not know.
diff --git a/proto/api/instance_service.proto b/proto/api/instance_service.proto
index ae28a8395..95ee655ca 100644
--- a/proto/api/instance_service.proto
+++ b/proto/api/instance_service.proto
@@ -59,6 +59,47 @@ service InstanceService {
rpc GetInstanceStats(GetInstanceStatsRequest) returns (InstanceStats) {
option (google.api.http) = {get: "/api/instance/stats"};
}
+
+ // ListUsageLimits lists the usage limits: the defaults for every user and the
+ // limits for single users. Admin only.
+ rpc ListUsageLimits(ListUsageLimitsRequest) returns (ListUsageLimitsResponse) {
+ option (google.api.http) = {get: "/api/usageLimits"};
+ }
+
+ // GetUsageLimit gets a usage limit. Admin only.
+ rpc GetUsageLimit(GetUsageLimitRequest) returns (UsageLimit) {
+ option (google.api.http) = {get: "/api/{name=usageLimits/*}"};
+ option (google.api.method_signature) = "name";
+ }
+
+ // CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ // limit per metric and user, and one default per metric. Fails with
+ // FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ rpc CreateUsageLimit(CreateUsageLimitRequest) returns (UsageLimit) {
+ option (google.api.http) = {
+ post: "/api/usageLimits"
+ body: "usage_limit"
+ };
+ option (google.api.method_signature) = "usage_limit,usage_limit_id";
+ }
+
+ // UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ // and user cannot change.
+ rpc UpdateUsageLimit(UpdateUsageLimitRequest) returns (UsageLimit) {
+ option (google.api.http) = {
+ patch: "/api/{usage_limit.name=usageLimits/*}"
+ body: "usage_limit"
+ };
+ option (google.api.method_signature) = "usage_limit,update_mask";
+ }
+
+ // DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ // returns the user to the default; deleting a default makes the metric
+ // unlimited for users without their own limit.
+ rpc DeleteUsageLimit(DeleteUsageLimitRequest) returns (google.protobuf.Empty) {
+ option (google.api.http) = {delete: "/api/{name=usageLimits/*}"};
+ option (google.api.method_signature) = "name";
+ }
}
// InstanceAccessMode controls whether unauthenticated users may access instance content.
@@ -238,7 +279,7 @@ message InstanceSetting {
// Default is assets/{timestamp}_{uuid}_{filename}.
string filepath_template = 3;
- // The maximum upload size in megabytes. Default is 30.
+ // The maximum upload size in megabytes. Default is 32.
int64 upload_size_limit_mb = 4;
// Legacy compatibility field. New clients use default_storage_id.
@@ -530,3 +571,123 @@ message InstanceStats {
// Request message for InstanceService.GetInstanceStats.
message GetInstanceStatsRequest {}
+
+// UsageLimit sets one limit for every user, or for one user. When both exist
+// for the same metric, the limit for the user applies to that user.
+message UsageLimit {
+ option (google.api.resource) = {
+ type: "memos.api/UsageLimit"
+ pattern: "usageLimits/{usage_limit}"
+ singular: "usageLimit"
+ plural: "usageLimits"
+ };
+
+ // Identifier. The resource name of the usage limit.
+ // Format: usageLimits/{usage_limit}
+ string name = 1 [(google.api.field_behavior) = IDENTIFIER];
+
+ // Required. Immutable. What is limited.
+ Metric metric = 2 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.field_behavior) = IMMUTABLE
+ ];
+
+ // Optional. Immutable. The user the limit applies to. Empty means every user.
+ // Format: users/{user}
+ string user = 3 [
+ (google.api.field_behavior) = OPTIONAL,
+ (google.api.field_behavior) = IMMUTABLE,
+ (google.api.resource_reference) = {type: "memos.api/User"}
+ ];
+
+ // Required. The limit. Must not be negative. 0 means unlimited for MEMOS and
+ // STORAGE_BYTES, and no extra limit for UPLOAD_BYTES.
+ int64 value = 4 [(google.api.field_behavior) = REQUIRED];
+
+ // Output only. The creation time.
+ google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Output only. The last update time.
+ google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
+
+ // Metric is what a usage limit counts.
+ enum Metric {
+ METRIC_UNSPECIFIED = 0;
+ // The number of memos the user created, including comments, archived
+ // memos, and memos in Spaces.
+ MEMOS = 1;
+ // The total size in bytes of the user's uploads, including uploads not
+ // attached to a memo. External links do not count.
+ STORAGE_BYTES = 2;
+ // The size in bytes of one uploaded file. It can only lower the instance
+ // upload limit, never raise it.
+ UPLOAD_BYTES = 3;
+ }
+}
+
+// Request message for InstanceService.ListUsageLimits.
+message ListUsageLimitsRequest {
+ // Optional. The maximum number of usage limits to return. If unspecified, at
+ // most 50 are returned. The maximum value is 1000; values above 1000 are
+ // coerced to 1000.
+ int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. A page token from a previous call. Provide it to retrieve the
+ // next page.
+ string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
+
+ // Optional. A CEL filter on `user` and `metric`, combined with `&&`.
+ // `user == ""` selects the defaults for every user.
+ // Example: "user == 'users/steven' && metric == 'STORAGE_BYTES'"
+ string filter = 3 [(google.api.field_behavior) = OPTIONAL];
+}
+
+// Response message for InstanceService.ListUsageLimits.
+message ListUsageLimitsResponse {
+ // The usage limits, defaults first, then by user and metric.
+ repeated UsageLimit usage_limits = 1;
+
+ // A token to retrieve the next page. Empty when there are no more pages.
+ string next_page_token = 2;
+}
+
+// Request message for InstanceService.GetUsageLimit.
+message GetUsageLimitRequest {
+ // Required. The resource name of the usage limit.
+ // Format: usageLimits/{usage_limit}
+ string name = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "memos.api/UsageLimit"}
+ ];
+}
+
+// Request message for InstanceService.CreateUsageLimit.
+message CreateUsageLimitRequest {
+ // Required. The usage limit to create.
+ UsageLimit usage_limit = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // Optional. The ID to use for the usage limit, which becomes the final
+ // segment of its name. Lowercase letters, digits and hyphens, at most 32
+ // characters, starting with a letter. Generated when empty.
+ string usage_limit_id = 2 [(google.api.field_behavior) = OPTIONAL];
+}
+
+// Request message for InstanceService.UpdateUsageLimit.
+message UpdateUsageLimitRequest {
+ // Required. The usage limit with its new value.
+ UsageLimit usage_limit = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // Optional. The fields to update. Only `value` is supported, which is also
+ // the default.
+ google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
+}
+
+// Request message for InstanceService.DeleteUsageLimit.
+message DeleteUsageLimitRequest {
+ // Required. The resource name of the usage limit.
+ // Format: usageLimits/{usage_limit}
+ string name = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "memos.api/UsageLimit"}
+ ];
+}
diff --git a/proto/api/user_service.proto b/proto/api/user_service.proto
index a2253dd30..fa0406ae9 100644
--- a/proto/api/user_service.proto
+++ b/proto/api/user_service.proto
@@ -107,6 +107,13 @@ service UserService {
option (google.api.method_signature) = "name";
}
+ // GetUserUsage returns a user's usage and the usage limits in effect for the
+ // user. Only the user or an admin may call it.
+ rpc GetUserUsage(GetUserUsageRequest) returns (UserUsage) {
+ option (google.api.http) = {get: "/api/{name=users/*/usage}"};
+ option (google.api.method_signature) = "name";
+ }
+
// ListMemoViews lists a user's memo views. Each view is a named, reusable
// CEL filter (see MemoView.filter); pass its filter string directly to the
// ListMemos `filter` argument. Only the user may call it.
@@ -677,6 +684,60 @@ message GetUserStatsRequest {
string filter = 2 [(google.api.field_behavior) = OPTIONAL];
}
+// UserUsage is a user's usage and the usage limits in effect for the user.
+message UserUsage {
+ option (google.api.resource) = {
+ type: "memos.api/UserUsage"
+ pattern: "users/{user}/usage"
+ singular: "userUsage"
+ plural: "userUsages"
+ };
+
+ // Identifier. The resource name of the user usage singleton.
+ // Format: users/{user}/usage
+ string name = 1 [(google.api.field_behavior) = IDENTIFIER];
+
+ // The number of memos the user created, including comments, archived
+ // memos, and memos in Spaces.
+ int64 memo_count = 2;
+
+ // The total size in bytes of the user's uploads, including uploads not
+ // attached to a memo. External links do not count.
+ int64 storage_bytes = 3;
+
+ // The limit on memo_count.
+ EffectiveLimit memos_limit = 4;
+
+ // The limit on storage_bytes.
+ EffectiveLimit storage_bytes_limit = 5;
+
+ // The limit on the size of one uploaded file. It applies only when it is
+ // lower than the instance upload limit.
+ EffectiveLimit upload_bytes_limit = 6;
+
+ // EffectiveLimit is the limit in effect for one metric, and where it comes
+ // from.
+ message EffectiveLimit {
+ // The limit. 0 means unlimited, or no extra limit for upload_bytes_limit.
+ int64 value = 1;
+
+ // The usage limit the value comes from: the user's own limit, or else the
+ // default. Empty when no usage limit applies.
+ // Format: usageLimits/{usage_limit}
+ string usage_limit = 2 [(google.api.resource_reference) = {type: "memos.api/UsageLimit"}];
+ }
+}
+
+// Request message for UserService.GetUserUsage.
+message GetUserUsageRequest {
+ // Required. The resource name of the user usage.
+ // Format: users/{user}/usage
+ string name = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "memos.api/UserUsage"}
+ ];
+}
+
// MemoView is a user's saved memo filter.
message MemoView {
option (google.api.resource) = {
diff --git a/proto/gen/api/apiconnect/instance_service.connect.go b/proto/gen/api/apiconnect/instance_service.connect.go
index 0bc173a52..e50711b05 100644
--- a/proto/gen/api/apiconnect/instance_service.connect.go
+++ b/proto/gen/api/apiconnect/instance_service.connect.go
@@ -52,6 +52,21 @@ const (
// InstanceServiceGetInstanceStatsProcedure is the fully-qualified name of the InstanceService's
// GetInstanceStats RPC.
InstanceServiceGetInstanceStatsProcedure = "/memos.api.InstanceService/GetInstanceStats"
+ // InstanceServiceListUsageLimitsProcedure is the fully-qualified name of the InstanceService's
+ // ListUsageLimits RPC.
+ InstanceServiceListUsageLimitsProcedure = "/memos.api.InstanceService/ListUsageLimits"
+ // InstanceServiceGetUsageLimitProcedure is the fully-qualified name of the InstanceService's
+ // GetUsageLimit RPC.
+ InstanceServiceGetUsageLimitProcedure = "/memos.api.InstanceService/GetUsageLimit"
+ // InstanceServiceCreateUsageLimitProcedure is the fully-qualified name of the InstanceService's
+ // CreateUsageLimit RPC.
+ InstanceServiceCreateUsageLimitProcedure = "/memos.api.InstanceService/CreateUsageLimit"
+ // InstanceServiceUpdateUsageLimitProcedure is the fully-qualified name of the InstanceService's
+ // UpdateUsageLimit RPC.
+ InstanceServiceUpdateUsageLimitProcedure = "/memos.api.InstanceService/UpdateUsageLimit"
+ // InstanceServiceDeleteUsageLimitProcedure is the fully-qualified name of the InstanceService's
+ // DeleteUsageLimit RPC.
+ InstanceServiceDeleteUsageLimitProcedure = "/memos.api.InstanceService/DeleteUsageLimit"
)
// InstanceServiceClient is a client for the memos.api.InstanceService service.
@@ -71,6 +86,22 @@ type InstanceServiceClient interface {
TestInstanceEmailSetting(context.Context, *connect.Request[api.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error)
// GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds.
GetInstanceStats(context.Context, *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error)
+ // ListUsageLimits lists the usage limits: the defaults for every user and the
+ // limits for single users. Admin only.
+ ListUsageLimits(context.Context, *connect.Request[api.ListUsageLimitsRequest]) (*connect.Response[api.ListUsageLimitsResponse], error)
+ // GetUsageLimit gets a usage limit. Admin only.
+ GetUsageLimit(context.Context, *connect.Request[api.GetUsageLimitRequest]) (*connect.Response[api.UsageLimit], error)
+ // CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ // limit per metric and user, and one default per metric. Fails with
+ // FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ CreateUsageLimit(context.Context, *connect.Request[api.CreateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error)
+ // UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ // and user cannot change.
+ UpdateUsageLimit(context.Context, *connect.Request[api.UpdateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error)
+ // DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ // returns the user to the default; deleting a default makes the metric
+ // unlimited for users without their own limit.
+ DeleteUsageLimit(context.Context, *connect.Request[api.DeleteUsageLimitRequest]) (*connect.Response[emptypb.Empty], error)
}
// NewInstanceServiceClient constructs a client for the memos.api.InstanceService service. By
@@ -120,6 +151,36 @@ func NewInstanceServiceClient(httpClient connect.HTTPClient, baseURL string, opt
connect.WithSchema(instanceServiceMethods.ByName("GetInstanceStats")),
connect.WithClientOptions(opts...),
),
+ listUsageLimits: connect.NewClient[api.ListUsageLimitsRequest, api.ListUsageLimitsResponse](
+ httpClient,
+ baseURL+InstanceServiceListUsageLimitsProcedure,
+ connect.WithSchema(instanceServiceMethods.ByName("ListUsageLimits")),
+ connect.WithClientOptions(opts...),
+ ),
+ getUsageLimit: connect.NewClient[api.GetUsageLimitRequest, api.UsageLimit](
+ httpClient,
+ baseURL+InstanceServiceGetUsageLimitProcedure,
+ connect.WithSchema(instanceServiceMethods.ByName("GetUsageLimit")),
+ connect.WithClientOptions(opts...),
+ ),
+ createUsageLimit: connect.NewClient[api.CreateUsageLimitRequest, api.UsageLimit](
+ httpClient,
+ baseURL+InstanceServiceCreateUsageLimitProcedure,
+ connect.WithSchema(instanceServiceMethods.ByName("CreateUsageLimit")),
+ connect.WithClientOptions(opts...),
+ ),
+ updateUsageLimit: connect.NewClient[api.UpdateUsageLimitRequest, api.UsageLimit](
+ httpClient,
+ baseURL+InstanceServiceUpdateUsageLimitProcedure,
+ connect.WithSchema(instanceServiceMethods.ByName("UpdateUsageLimit")),
+ connect.WithClientOptions(opts...),
+ ),
+ deleteUsageLimit: connect.NewClient[api.DeleteUsageLimitRequest, emptypb.Empty](
+ httpClient,
+ baseURL+InstanceServiceDeleteUsageLimitProcedure,
+ connect.WithSchema(instanceServiceMethods.ByName("DeleteUsageLimit")),
+ connect.WithClientOptions(opts...),
+ ),
}
}
@@ -131,6 +192,11 @@ type instanceServiceClient struct {
updateInstanceSetting *connect.Client[api.UpdateInstanceSettingRequest, api.InstanceSetting]
testInstanceEmailSetting *connect.Client[api.TestInstanceEmailSettingRequest, emptypb.Empty]
getInstanceStats *connect.Client[api.GetInstanceStatsRequest, api.InstanceStats]
+ listUsageLimits *connect.Client[api.ListUsageLimitsRequest, api.ListUsageLimitsResponse]
+ getUsageLimit *connect.Client[api.GetUsageLimitRequest, api.UsageLimit]
+ createUsageLimit *connect.Client[api.CreateUsageLimitRequest, api.UsageLimit]
+ updateUsageLimit *connect.Client[api.UpdateUsageLimitRequest, api.UsageLimit]
+ deleteUsageLimit *connect.Client[api.DeleteUsageLimitRequest, emptypb.Empty]
}
// GetInstanceProfile calls memos.api.InstanceService.GetInstanceProfile.
@@ -163,6 +229,31 @@ func (c *instanceServiceClient) GetInstanceStats(ctx context.Context, req *conne
return c.getInstanceStats.CallUnary(ctx, req)
}
+// ListUsageLimits calls memos.api.InstanceService.ListUsageLimits.
+func (c *instanceServiceClient) ListUsageLimits(ctx context.Context, req *connect.Request[api.ListUsageLimitsRequest]) (*connect.Response[api.ListUsageLimitsResponse], error) {
+ return c.listUsageLimits.CallUnary(ctx, req)
+}
+
+// GetUsageLimit calls memos.api.InstanceService.GetUsageLimit.
+func (c *instanceServiceClient) GetUsageLimit(ctx context.Context, req *connect.Request[api.GetUsageLimitRequest]) (*connect.Response[api.UsageLimit], error) {
+ return c.getUsageLimit.CallUnary(ctx, req)
+}
+
+// CreateUsageLimit calls memos.api.InstanceService.CreateUsageLimit.
+func (c *instanceServiceClient) CreateUsageLimit(ctx context.Context, req *connect.Request[api.CreateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error) {
+ return c.createUsageLimit.CallUnary(ctx, req)
+}
+
+// UpdateUsageLimit calls memos.api.InstanceService.UpdateUsageLimit.
+func (c *instanceServiceClient) UpdateUsageLimit(ctx context.Context, req *connect.Request[api.UpdateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error) {
+ return c.updateUsageLimit.CallUnary(ctx, req)
+}
+
+// DeleteUsageLimit calls memos.api.InstanceService.DeleteUsageLimit.
+func (c *instanceServiceClient) DeleteUsageLimit(ctx context.Context, req *connect.Request[api.DeleteUsageLimitRequest]) (*connect.Response[emptypb.Empty], error) {
+ return c.deleteUsageLimit.CallUnary(ctx, req)
+}
+
// InstanceServiceHandler is an implementation of the memos.api.InstanceService service.
type InstanceServiceHandler interface {
// GetInstanceProfile gets the instance profile. Available without authentication, including on a private instance.
@@ -180,6 +271,22 @@ type InstanceServiceHandler interface {
TestInstanceEmailSetting(context.Context, *connect.Request[api.TestInstanceEmailSettingRequest]) (*connect.Response[emptypb.Empty], error)
// GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds.
GetInstanceStats(context.Context, *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error)
+ // ListUsageLimits lists the usage limits: the defaults for every user and the
+ // limits for single users. Admin only.
+ ListUsageLimits(context.Context, *connect.Request[api.ListUsageLimitsRequest]) (*connect.Response[api.ListUsageLimitsResponse], error)
+ // GetUsageLimit gets a usage limit. Admin only.
+ GetUsageLimit(context.Context, *connect.Request[api.GetUsageLimitRequest]) (*connect.Response[api.UsageLimit], error)
+ // CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ // limit per metric and user, and one default per metric. Fails with
+ // FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ CreateUsageLimit(context.Context, *connect.Request[api.CreateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error)
+ // UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ // and user cannot change.
+ UpdateUsageLimit(context.Context, *connect.Request[api.UpdateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error)
+ // DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ // returns the user to the default; deleting a default makes the metric
+ // unlimited for users without their own limit.
+ DeleteUsageLimit(context.Context, *connect.Request[api.DeleteUsageLimitRequest]) (*connect.Response[emptypb.Empty], error)
}
// NewInstanceServiceHandler builds an HTTP handler from the service implementation. It returns the
@@ -225,6 +332,36 @@ func NewInstanceServiceHandler(svc InstanceServiceHandler, opts ...connect.Handl
connect.WithSchema(instanceServiceMethods.ByName("GetInstanceStats")),
connect.WithHandlerOptions(opts...),
)
+ instanceServiceListUsageLimitsHandler := connect.NewUnaryHandler(
+ InstanceServiceListUsageLimitsProcedure,
+ svc.ListUsageLimits,
+ connect.WithSchema(instanceServiceMethods.ByName("ListUsageLimits")),
+ connect.WithHandlerOptions(opts...),
+ )
+ instanceServiceGetUsageLimitHandler := connect.NewUnaryHandler(
+ InstanceServiceGetUsageLimitProcedure,
+ svc.GetUsageLimit,
+ connect.WithSchema(instanceServiceMethods.ByName("GetUsageLimit")),
+ connect.WithHandlerOptions(opts...),
+ )
+ instanceServiceCreateUsageLimitHandler := connect.NewUnaryHandler(
+ InstanceServiceCreateUsageLimitProcedure,
+ svc.CreateUsageLimit,
+ connect.WithSchema(instanceServiceMethods.ByName("CreateUsageLimit")),
+ connect.WithHandlerOptions(opts...),
+ )
+ instanceServiceUpdateUsageLimitHandler := connect.NewUnaryHandler(
+ InstanceServiceUpdateUsageLimitProcedure,
+ svc.UpdateUsageLimit,
+ connect.WithSchema(instanceServiceMethods.ByName("UpdateUsageLimit")),
+ connect.WithHandlerOptions(opts...),
+ )
+ instanceServiceDeleteUsageLimitHandler := connect.NewUnaryHandler(
+ InstanceServiceDeleteUsageLimitProcedure,
+ svc.DeleteUsageLimit,
+ connect.WithSchema(instanceServiceMethods.ByName("DeleteUsageLimit")),
+ connect.WithHandlerOptions(opts...),
+ )
return "/memos.api.InstanceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case InstanceServiceGetInstanceProfileProcedure:
@@ -239,6 +376,16 @@ func NewInstanceServiceHandler(svc InstanceServiceHandler, opts ...connect.Handl
instanceServiceTestInstanceEmailSettingHandler.ServeHTTP(w, r)
case InstanceServiceGetInstanceStatsProcedure:
instanceServiceGetInstanceStatsHandler.ServeHTTP(w, r)
+ case InstanceServiceListUsageLimitsProcedure:
+ instanceServiceListUsageLimitsHandler.ServeHTTP(w, r)
+ case InstanceServiceGetUsageLimitProcedure:
+ instanceServiceGetUsageLimitHandler.ServeHTTP(w, r)
+ case InstanceServiceCreateUsageLimitProcedure:
+ instanceServiceCreateUsageLimitHandler.ServeHTTP(w, r)
+ case InstanceServiceUpdateUsageLimitProcedure:
+ instanceServiceUpdateUsageLimitHandler.ServeHTTP(w, r)
+ case InstanceServiceDeleteUsageLimitProcedure:
+ instanceServiceDeleteUsageLimitHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@@ -271,3 +418,23 @@ func (UnimplementedInstanceServiceHandler) TestInstanceEmailSetting(context.Cont
func (UnimplementedInstanceServiceHandler) GetInstanceStats(context.Context, *connect.Request[api.GetInstanceStatsRequest]) (*connect.Response[api.InstanceStats], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.GetInstanceStats is not implemented"))
}
+
+func (UnimplementedInstanceServiceHandler) ListUsageLimits(context.Context, *connect.Request[api.ListUsageLimitsRequest]) (*connect.Response[api.ListUsageLimitsResponse], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.ListUsageLimits is not implemented"))
+}
+
+func (UnimplementedInstanceServiceHandler) GetUsageLimit(context.Context, *connect.Request[api.GetUsageLimitRequest]) (*connect.Response[api.UsageLimit], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.GetUsageLimit is not implemented"))
+}
+
+func (UnimplementedInstanceServiceHandler) CreateUsageLimit(context.Context, *connect.Request[api.CreateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.CreateUsageLimit is not implemented"))
+}
+
+func (UnimplementedInstanceServiceHandler) UpdateUsageLimit(context.Context, *connect.Request[api.UpdateUsageLimitRequest]) (*connect.Response[api.UsageLimit], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.UpdateUsageLimit is not implemented"))
+}
+
+func (UnimplementedInstanceServiceHandler) DeleteUsageLimit(context.Context, *connect.Request[api.DeleteUsageLimitRequest]) (*connect.Response[emptypb.Empty], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.InstanceService.DeleteUsageLimit is not implemented"))
+}
diff --git a/proto/gen/api/apiconnect/user_service.connect.go b/proto/gen/api/apiconnect/user_service.connect.go
index e626bbd5d..254d909a6 100644
--- a/proto/gen/api/apiconnect/user_service.connect.go
+++ b/proto/gen/api/apiconnect/user_service.connect.go
@@ -63,6 +63,9 @@ const (
// UserServiceGetUserStatsProcedure is the fully-qualified name of the UserService's GetUserStats
// RPC.
UserServiceGetUserStatsProcedure = "/memos.api.UserService/GetUserStats"
+ // UserServiceGetUserUsageProcedure is the fully-qualified name of the UserService's GetUserUsage
+ // RPC.
+ UserServiceGetUserUsageProcedure = "/memos.api.UserService/GetUserUsage"
// UserServiceListMemoViewsProcedure is the fully-qualified name of the UserService's ListMemoViews
// RPC.
UserServiceListMemoViewsProcedure = "/memos.api.UserService/ListMemoViews"
@@ -163,6 +166,9 @@ type UserServiceClient interface {
// GetUserStats returns memo statistics for one user, counting the user's
// memos that the caller can read.
GetUserStats(context.Context, *connect.Request[api.GetUserStatsRequest]) (*connect.Response[api.UserStats], error)
+ // GetUserUsage returns a user's usage and the usage limits in effect for the
+ // user. Only the user or an admin may call it.
+ GetUserUsage(context.Context, *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error)
// ListMemoViews lists a user's memo views. Each view is a named, reusable
// CEL filter (see MemoView.filter); pass its filter string directly to the
// ListMemos `filter` argument. Only the user may call it.
@@ -314,6 +320,12 @@ func NewUserServiceClient(httpClient connect.HTTPClient, baseURL string, opts ..
connect.WithSchema(userServiceMethods.ByName("GetUserStats")),
connect.WithClientOptions(opts...),
),
+ getUserUsage: connect.NewClient[api.GetUserUsageRequest, api.UserUsage](
+ httpClient,
+ baseURL+UserServiceGetUserUsageProcedure,
+ connect.WithSchema(userServiceMethods.ByName("GetUserUsage")),
+ connect.WithClientOptions(opts...),
+ ),
listMemoViews: connect.NewClient[api.ListMemoViewsRequest, api.ListMemoViewsResponse](
httpClient,
baseURL+UserServiceListMemoViewsProcedure,
@@ -462,6 +474,7 @@ type userServiceClient struct {
updateUserSetting *connect.Client[api.UpdateUserSettingRequest, api.UserSetting]
listUserStats *connect.Client[api.ListUserStatsRequest, api.ListUserStatsResponse]
getUserStats *connect.Client[api.GetUserStatsRequest, api.UserStats]
+ getUserUsage *connect.Client[api.GetUserUsageRequest, api.UserUsage]
listMemoViews *connect.Client[api.ListMemoViewsRequest, api.ListMemoViewsResponse]
getMemoView *connect.Client[api.GetMemoViewRequest, api.MemoView]
createMemoView *connect.Client[api.CreateMemoViewRequest, api.MemoView]
@@ -541,6 +554,11 @@ func (c *userServiceClient) GetUserStats(ctx context.Context, req *connect.Reque
return c.getUserStats.CallUnary(ctx, req)
}
+// GetUserUsage calls memos.api.UserService.GetUserUsage.
+func (c *userServiceClient) GetUserUsage(ctx context.Context, req *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error) {
+ return c.getUserUsage.CallUnary(ctx, req)
+}
+
// ListMemoViews calls memos.api.UserService.ListMemoViews.
func (c *userServiceClient) ListMemoViews(ctx context.Context, req *connect.Request[api.ListMemoViewsRequest]) (*connect.Response[api.ListMemoViewsResponse], error) {
return c.listMemoViews.CallUnary(ctx, req)
@@ -686,6 +704,9 @@ type UserServiceHandler interface {
// GetUserStats returns memo statistics for one user, counting the user's
// memos that the caller can read.
GetUserStats(context.Context, *connect.Request[api.GetUserStatsRequest]) (*connect.Response[api.UserStats], error)
+ // GetUserUsage returns a user's usage and the usage limits in effect for the
+ // user. Only the user or an admin may call it.
+ GetUserUsage(context.Context, *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error)
// ListMemoViews lists a user's memo views. Each view is a named, reusable
// CEL filter (see MemoView.filter); pass its filter string directly to the
// ListMemos `filter` argument. Only the user may call it.
@@ -833,6 +854,12 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
connect.WithSchema(userServiceMethods.ByName("GetUserStats")),
connect.WithHandlerOptions(opts...),
)
+ userServiceGetUserUsageHandler := connect.NewUnaryHandler(
+ UserServiceGetUserUsageProcedure,
+ svc.GetUserUsage,
+ connect.WithSchema(userServiceMethods.ByName("GetUserUsage")),
+ connect.WithHandlerOptions(opts...),
+ )
userServiceListMemoViewsHandler := connect.NewUnaryHandler(
UserServiceListMemoViewsProcedure,
svc.ListMemoViews,
@@ -989,6 +1016,8 @@ func NewUserServiceHandler(svc UserServiceHandler, opts ...connect.HandlerOption
userServiceListUserStatsHandler.ServeHTTP(w, r)
case UserServiceGetUserStatsProcedure:
userServiceGetUserStatsHandler.ServeHTTP(w, r)
+ case UserServiceGetUserUsageProcedure:
+ userServiceGetUserUsageHandler.ServeHTTP(w, r)
case UserServiceListMemoViewsProcedure:
userServiceListMemoViewsHandler.ServeHTTP(w, r)
case UserServiceGetMemoViewProcedure:
@@ -1086,6 +1115,10 @@ func (UnimplementedUserServiceHandler) GetUserStats(context.Context, *connect.Re
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUserStats is not implemented"))
}
+func (UnimplementedUserServiceHandler) GetUserUsage(context.Context, *connect.Request[api.GetUserUsageRequest]) (*connect.Response[api.UserUsage], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.GetUserUsage is not implemented"))
+}
+
func (UnimplementedUserServiceHandler) ListMemoViews(context.Context, *connect.Request[api.ListMemoViewsRequest]) (*connect.Response[api.ListMemoViewsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("memos.api.UserService.ListMemoViews is not implemented"))
}
diff --git a/proto/gen/api/instance_service.pb.go b/proto/gen/api/instance_service.pb.go
index 633f20711..13cbae97f 100644
--- a/proto/gen/api/instance_service.pb.go
+++ b/proto/gen/api/instance_service.pb.go
@@ -315,6 +315,65 @@ func (InstanceSetting_StorageSetting_StorageType) EnumDescriptor() ([]byte, []in
return file_api_instance_service_proto_rawDescGZIP(), []int{2, 1, 0}
}
+// Metric is what a usage limit counts.
+type UsageLimit_Metric int32
+
+const (
+ UsageLimit_METRIC_UNSPECIFIED UsageLimit_Metric = 0
+ // The number of memos the user created, including comments, archived
+ // memos, and memos in Spaces.
+ UsageLimit_MEMOS UsageLimit_Metric = 1
+ // The total size in bytes of the user's uploads, including uploads not
+ // attached to a memo. External links do not count.
+ UsageLimit_STORAGE_BYTES UsageLimit_Metric = 2
+ // The size in bytes of one uploaded file. It can only lower the instance
+ // upload limit, never raise it.
+ UsageLimit_UPLOAD_BYTES UsageLimit_Metric = 3
+)
+
+// Enum value maps for UsageLimit_Metric.
+var (
+ UsageLimit_Metric_name = map[int32]string{
+ 0: "METRIC_UNSPECIFIED",
+ 1: "MEMOS",
+ 2: "STORAGE_BYTES",
+ 3: "UPLOAD_BYTES",
+ }
+ UsageLimit_Metric_value = map[string]int32{
+ "METRIC_UNSPECIFIED": 0,
+ "MEMOS": 1,
+ "STORAGE_BYTES": 2,
+ "UPLOAD_BYTES": 3,
+ }
+)
+
+func (x UsageLimit_Metric) Enum() *UsageLimit_Metric {
+ p := new(UsageLimit_Metric)
+ *p = x
+ return p
+}
+
+func (x UsageLimit_Metric) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (UsageLimit_Metric) Descriptor() protoreflect.EnumDescriptor {
+ return file_api_instance_service_proto_enumTypes[5].Descriptor()
+}
+
+func (UsageLimit_Metric) Type() protoreflect.EnumType {
+ return &file_api_instance_service_proto_enumTypes[5]
+}
+
+func (x UsageLimit_Metric) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use UsageLimit_Metric.Descriptor instead.
+func (UsageLimit_Metric) EnumDescriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{10, 0}
+}
+
// InstanceProfile is the basic information about the instance.
type InstanceProfile struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -1000,6 +1059,432 @@ func (*GetInstanceStatsRequest) Descriptor() ([]byte, []int) {
return file_api_instance_service_proto_rawDescGZIP(), []int{9}
}
+// UsageLimit sets one limit for every user, or for one user. When both exist
+// for the same metric, the limit for the user applies to that user.
+type UsageLimit struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Identifier. The resource name of the usage limit.
+ // Format: usageLimits/{usage_limit}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Required. Immutable. What is limited.
+ Metric UsageLimit_Metric `protobuf:"varint,2,opt,name=metric,proto3,enum=memos.api.UsageLimit_Metric" json:"metric,omitempty"`
+ // Optional. Immutable. The user the limit applies to. Empty means every user.
+ // Format: users/{user}
+ User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
+ // Required. The limit. Must not be negative. 0 means unlimited for MEMOS and
+ // STORAGE_BYTES, and no extra limit for UPLOAD_BYTES.
+ Value int64 `protobuf:"varint,4,opt,name=value,proto3" json:"value,omitempty"`
+ // Output only. The creation time.
+ CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
+ // Output only. The last update time.
+ UpdateTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UsageLimit) Reset() {
+ *x = UsageLimit{}
+ mi := &file_api_instance_service_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UsageLimit) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UsageLimit) ProtoMessage() {}
+
+func (x *UsageLimit) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[10]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UsageLimit.ProtoReflect.Descriptor instead.
+func (*UsageLimit) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *UsageLimit) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UsageLimit) GetMetric() UsageLimit_Metric {
+ if x != nil {
+ return x.Metric
+ }
+ return UsageLimit_METRIC_UNSPECIFIED
+}
+
+func (x *UsageLimit) GetUser() string {
+ if x != nil {
+ return x.User
+ }
+ return ""
+}
+
+func (x *UsageLimit) GetValue() int64 {
+ if x != nil {
+ return x.Value
+ }
+ return 0
+}
+
+func (x *UsageLimit) GetCreateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreateTime
+ }
+ return nil
+}
+
+func (x *UsageLimit) GetUpdateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdateTime
+ }
+ return nil
+}
+
+// Request message for InstanceService.ListUsageLimits.
+type ListUsageLimitsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Optional. The maximum number of usage limits to return. If unspecified, at
+ // most 50 are returned. The maximum value is 1000; values above 1000 are
+ // coerced to 1000.
+ PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+ // Optional. A page token from a previous call. Provide it to retrieve the
+ // next page.
+ PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ // Optional. A CEL filter on `user` and `metric`, combined with `&&`.
+ // `user == ""` selects the defaults for every user.
+ // Example: "user == 'users/steven' && metric == 'STORAGE_BYTES'"
+ Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUsageLimitsRequest) Reset() {
+ *x = ListUsageLimitsRequest{}
+ mi := &file_api_instance_service_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUsageLimitsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUsageLimitsRequest) ProtoMessage() {}
+
+func (x *ListUsageLimitsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[11]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListUsageLimitsRequest.ProtoReflect.Descriptor instead.
+func (*ListUsageLimitsRequest) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *ListUsageLimitsRequest) GetPageSize() int32 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+func (x *ListUsageLimitsRequest) GetPageToken() string {
+ if x != nil {
+ return x.PageToken
+ }
+ return ""
+}
+
+func (x *ListUsageLimitsRequest) GetFilter() string {
+ if x != nil {
+ return x.Filter
+ }
+ return ""
+}
+
+// Response message for InstanceService.ListUsageLimits.
+type ListUsageLimitsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The usage limits, defaults first, then by user and metric.
+ UsageLimits []*UsageLimit `protobuf:"bytes,1,rep,name=usage_limits,json=usageLimits,proto3" json:"usage_limits,omitempty"`
+ // A token to retrieve the next page. Empty when there are no more pages.
+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListUsageLimitsResponse) Reset() {
+ *x = ListUsageLimitsResponse{}
+ mi := &file_api_instance_service_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListUsageLimitsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListUsageLimitsResponse) ProtoMessage() {}
+
+func (x *ListUsageLimitsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[12]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListUsageLimitsResponse.ProtoReflect.Descriptor instead.
+func (*ListUsageLimitsResponse) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *ListUsageLimitsResponse) GetUsageLimits() []*UsageLimit {
+ if x != nil {
+ return x.UsageLimits
+ }
+ return nil
+}
+
+func (x *ListUsageLimitsResponse) GetNextPageToken() string {
+ if x != nil {
+ return x.NextPageToken
+ }
+ return ""
+}
+
+// Request message for InstanceService.GetUsageLimit.
+type GetUsageLimitRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The resource name of the usage limit.
+ // Format: usageLimits/{usage_limit}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GetUsageLimitRequest) Reset() {
+ *x = GetUsageLimitRequest{}
+ mi := &file_api_instance_service_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GetUsageLimitRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetUsageLimitRequest) ProtoMessage() {}
+
+func (x *GetUsageLimitRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[13]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetUsageLimitRequest.ProtoReflect.Descriptor instead.
+func (*GetUsageLimitRequest) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *GetUsageLimitRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+// Request message for InstanceService.CreateUsageLimit.
+type CreateUsageLimitRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The usage limit to create.
+ UsageLimit *UsageLimit `protobuf:"bytes,1,opt,name=usage_limit,json=usageLimit,proto3" json:"usage_limit,omitempty"`
+ // Optional. The ID to use for the usage limit, which becomes the final
+ // segment of its name. Lowercase letters, digits and hyphens, at most 32
+ // characters, starting with a letter. Generated when empty.
+ UsageLimitId string `protobuf:"bytes,2,opt,name=usage_limit_id,json=usageLimitId,proto3" json:"usage_limit_id,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *CreateUsageLimitRequest) Reset() {
+ *x = CreateUsageLimitRequest{}
+ mi := &file_api_instance_service_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *CreateUsageLimitRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateUsageLimitRequest) ProtoMessage() {}
+
+func (x *CreateUsageLimitRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[14]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateUsageLimitRequest.ProtoReflect.Descriptor instead.
+func (*CreateUsageLimitRequest) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *CreateUsageLimitRequest) GetUsageLimit() *UsageLimit {
+ if x != nil {
+ return x.UsageLimit
+ }
+ return nil
+}
+
+func (x *CreateUsageLimitRequest) GetUsageLimitId() string {
+ if x != nil {
+ return x.UsageLimitId
+ }
+ return ""
+}
+
+// Request message for InstanceService.UpdateUsageLimit.
+type UpdateUsageLimitRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The usage limit with its new value.
+ UsageLimit *UsageLimit `protobuf:"bytes,1,opt,name=usage_limit,json=usageLimit,proto3" json:"usage_limit,omitempty"`
+ // Optional. The fields to update. Only `value` is supported, which is also
+ // the default.
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UpdateUsageLimitRequest) Reset() {
+ *x = UpdateUsageLimitRequest{}
+ mi := &file_api_instance_service_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UpdateUsageLimitRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateUsageLimitRequest) ProtoMessage() {}
+
+func (x *UpdateUsageLimitRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[15]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateUsageLimitRequest.ProtoReflect.Descriptor instead.
+func (*UpdateUsageLimitRequest) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *UpdateUsageLimitRequest) GetUsageLimit() *UsageLimit {
+ if x != nil {
+ return x.UsageLimit
+ }
+ return nil
+}
+
+func (x *UpdateUsageLimitRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+// Request message for InstanceService.DeleteUsageLimit.
+type DeleteUsageLimitRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The resource name of the usage limit.
+ // Format: usageLimits/{usage_limit}
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *DeleteUsageLimitRequest) Reset() {
+ *x = DeleteUsageLimitRequest{}
+ mi := &file_api_instance_service_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *DeleteUsageLimitRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteUsageLimitRequest) ProtoMessage() {}
+
+func (x *DeleteUsageLimitRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_instance_service_proto_msgTypes[16]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteUsageLimitRequest.ProtoReflect.Descriptor instead.
+func (*DeleteUsageLimitRequest) Descriptor() ([]byte, []int) {
+ return file_api_instance_service_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *DeleteUsageLimitRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
// Challenge describes a proof-of-humanity challenge widget.
type InstanceProfile_Challenge struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -1013,7 +1498,7 @@ type InstanceProfile_Challenge struct {
func (x *InstanceProfile_Challenge) Reset() {
*x = InstanceProfile_Challenge{}
- mi := &file_api_instance_service_proto_msgTypes[10]
+ mi := &file_api_instance_service_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1025,7 +1510,7 @@ func (x *InstanceProfile_Challenge) String() string {
func (*InstanceProfile_Challenge) ProtoMessage() {}
func (x *InstanceProfile_Challenge) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[10]
+ mi := &file_api_instance_service_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1082,7 +1567,7 @@ type InstanceSetting_GeneralSetting struct {
func (x *InstanceSetting_GeneralSetting) Reset() {
*x = InstanceSetting_GeneralSetting{}
- mi := &file_api_instance_service_proto_msgTypes[11]
+ mi := &file_api_instance_service_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1094,7 +1579,7 @@ func (x *InstanceSetting_GeneralSetting) String() string {
func (*InstanceSetting_GeneralSetting) ProtoMessage() {}
func (x *InstanceSetting_GeneralSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[11]
+ mi := &file_api_instance_service_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1176,7 +1661,7 @@ type InstanceSetting_StorageSetting struct {
// The template of attachment file paths.
// Default is assets/{timestamp}_{uuid}_{filename}.
FilepathTemplate string `protobuf:"bytes,3,opt,name=filepath_template,json=filepathTemplate,proto3" json:"filepath_template,omitempty"`
- // The maximum upload size in megabytes. Default is 30.
+ // The maximum upload size in megabytes. Default is 32.
UploadSizeLimitMb int64 `protobuf:"varint,4,opt,name=upload_size_limit_mb,json=uploadSizeLimitMb,proto3" json:"upload_size_limit_mb,omitempty"`
// Legacy compatibility field. New clients use default_storage_id.
StorageType InstanceSetting_StorageSetting_StorageType `protobuf:"varint,5,opt,name=storage_type,json=storageType,proto3,enum=memos.api.InstanceSetting_StorageSetting_StorageType" json:"storage_type,omitempty"`
@@ -1188,7 +1673,7 @@ type InstanceSetting_StorageSetting struct {
func (x *InstanceSetting_StorageSetting) Reset() {
*x = InstanceSetting_StorageSetting{}
- mi := &file_api_instance_service_proto_msgTypes[12]
+ mi := &file_api_instance_service_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1200,7 +1685,7 @@ func (x *InstanceSetting_StorageSetting) String() string {
func (*InstanceSetting_StorageSetting) ProtoMessage() {}
func (x *InstanceSetting_StorageSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[12]
+ mi := &file_api_instance_service_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1279,7 +1764,7 @@ type InstanceSetting_Storage struct {
func (x *InstanceSetting_Storage) Reset() {
*x = InstanceSetting_Storage{}
- mi := &file_api_instance_service_proto_msgTypes[13]
+ mi := &file_api_instance_service_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1291,7 +1776,7 @@ func (x *InstanceSetting_Storage) String() string {
func (*InstanceSetting_Storage) ProtoMessage() {}
func (x *InstanceSetting_Storage) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[13]
+ mi := &file_api_instance_service_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1370,7 +1855,7 @@ type InstanceSetting_MemoRelatedSetting struct {
func (x *InstanceSetting_MemoRelatedSetting) Reset() {
*x = InstanceSetting_MemoRelatedSetting{}
- mi := &file_api_instance_service_proto_msgTypes[14]
+ mi := &file_api_instance_service_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1382,7 +1867,7 @@ func (x *InstanceSetting_MemoRelatedSetting) String() string {
func (*InstanceSetting_MemoRelatedSetting) ProtoMessage() {}
func (x *InstanceSetting_MemoRelatedSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[14]
+ mi := &file_api_instance_service_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1434,7 +1919,7 @@ type InstanceSetting_TagsSetting struct {
func (x *InstanceSetting_TagsSetting) Reset() {
*x = InstanceSetting_TagsSetting{}
- mi := &file_api_instance_service_proto_msgTypes[15]
+ mi := &file_api_instance_service_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1446,7 +1931,7 @@ func (x *InstanceSetting_TagsSetting) String() string {
func (*InstanceSetting_TagsSetting) ProtoMessage() {}
func (x *InstanceSetting_TagsSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[15]
+ mi := &file_api_instance_service_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1482,7 +1967,7 @@ type InstanceSetting_TagMetadata struct {
func (x *InstanceSetting_TagMetadata) Reset() {
*x = InstanceSetting_TagMetadata{}
- mi := &file_api_instance_service_proto_msgTypes[16]
+ mi := &file_api_instance_service_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1494,7 +1979,7 @@ func (x *InstanceSetting_TagMetadata) String() string {
func (*InstanceSetting_TagMetadata) ProtoMessage() {}
func (x *InstanceSetting_TagMetadata) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[16]
+ mi := &file_api_instance_service_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1535,7 +2020,7 @@ type InstanceSetting_NotificationSetting struct {
func (x *InstanceSetting_NotificationSetting) Reset() {
*x = InstanceSetting_NotificationSetting{}
- mi := &file_api_instance_service_proto_msgTypes[17]
+ mi := &file_api_instance_service_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1547,7 +2032,7 @@ func (x *InstanceSetting_NotificationSetting) String() string {
func (*InstanceSetting_NotificationSetting) ProtoMessage() {}
func (x *InstanceSetting_NotificationSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[17]
+ mi := &file_api_instance_service_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1585,7 +2070,7 @@ type InstanceSetting_AISetting struct {
func (x *InstanceSetting_AISetting) Reset() {
*x = InstanceSetting_AISetting{}
- mi := &file_api_instance_service_proto_msgTypes[18]
+ mi := &file_api_instance_service_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1597,7 +2082,7 @@ func (x *InstanceSetting_AISetting) String() string {
func (*InstanceSetting_AISetting) ProtoMessage() {}
func (x *InstanceSetting_AISetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[18]
+ mi := &file_api_instance_service_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1650,7 +2135,7 @@ type InstanceSetting_AIProviderConfig struct {
func (x *InstanceSetting_AIProviderConfig) Reset() {
*x = InstanceSetting_AIProviderConfig{}
- mi := &file_api_instance_service_proto_msgTypes[19]
+ mi := &file_api_instance_service_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1662,7 +2147,7 @@ func (x *InstanceSetting_AIProviderConfig) String() string {
func (*InstanceSetting_AIProviderConfig) ProtoMessage() {}
func (x *InstanceSetting_AIProviderConfig) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[19]
+ mi := &file_api_instance_service_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1747,7 +2232,7 @@ type InstanceSetting_TranscriptionConfig struct {
func (x *InstanceSetting_TranscriptionConfig) Reset() {
*x = InstanceSetting_TranscriptionConfig{}
- mi := &file_api_instance_service_proto_msgTypes[20]
+ mi := &file_api_instance_service_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1759,7 +2244,7 @@ func (x *InstanceSetting_TranscriptionConfig) String() string {
func (*InstanceSetting_TranscriptionConfig) ProtoMessage() {}
func (x *InstanceSetting_TranscriptionConfig) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[20]
+ mi := &file_api_instance_service_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1814,7 +2299,7 @@ type InstanceSetting_AccessSetting struct {
func (x *InstanceSetting_AccessSetting) Reset() {
*x = InstanceSetting_AccessSetting{}
- mi := &file_api_instance_service_proto_msgTypes[21]
+ mi := &file_api_instance_service_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1826,7 +2311,7 @@ func (x *InstanceSetting_AccessSetting) String() string {
func (*InstanceSetting_AccessSetting) ProtoMessage() {}
func (x *InstanceSetting_AccessSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[21]
+ mi := &file_api_instance_service_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1864,7 +2349,7 @@ type InstanceSetting_GeneralSetting_CustomProfile struct {
func (x *InstanceSetting_GeneralSetting_CustomProfile) Reset() {
*x = InstanceSetting_GeneralSetting_CustomProfile{}
- mi := &file_api_instance_service_proto_msgTypes[22]
+ mi := &file_api_instance_service_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1876,7 +2361,7 @@ func (x *InstanceSetting_GeneralSetting_CustomProfile) String() string {
func (*InstanceSetting_GeneralSetting_CustomProfile) ProtoMessage() {}
func (x *InstanceSetting_GeneralSetting_CustomProfile) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[22]
+ mi := &file_api_instance_service_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1939,7 +2424,7 @@ type InstanceSetting_StorageSetting_S3Config struct {
func (x *InstanceSetting_StorageSetting_S3Config) Reset() {
*x = InstanceSetting_StorageSetting_S3Config{}
- mi := &file_api_instance_service_proto_msgTypes[23]
+ mi := &file_api_instance_service_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1951,7 +2436,7 @@ func (x *InstanceSetting_StorageSetting_S3Config) String() string {
func (*InstanceSetting_StorageSetting_S3Config) ProtoMessage() {}
func (x *InstanceSetting_StorageSetting_S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[23]
+ mi := &file_api_instance_service_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2042,7 +2527,7 @@ type InstanceSetting_Storage_S3Config struct {
func (x *InstanceSetting_Storage_S3Config) Reset() {
*x = InstanceSetting_Storage_S3Config{}
- mi := &file_api_instance_service_proto_msgTypes[24]
+ mi := &file_api_instance_service_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2054,7 +2539,7 @@ func (x *InstanceSetting_Storage_S3Config) String() string {
func (*InstanceSetting_Storage_S3Config) ProtoMessage() {}
func (x *InstanceSetting_Storage_S3Config) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[24]
+ mi := &file_api_instance_service_proto_msgTypes[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2149,7 +2634,7 @@ type InstanceSetting_NotificationSetting_EmailSetting struct {
func (x *InstanceSetting_NotificationSetting_EmailSetting) Reset() {
*x = InstanceSetting_NotificationSetting_EmailSetting{}
- mi := &file_api_instance_service_proto_msgTypes[26]
+ mi := &file_api_instance_service_proto_msgTypes[33]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2161,7 +2646,7 @@ func (x *InstanceSetting_NotificationSetting_EmailSetting) String() string {
func (*InstanceSetting_NotificationSetting_EmailSetting) ProtoMessage() {}
func (x *InstanceSetting_NotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[26]
+ mi := &file_api_instance_service_proto_msgTypes[33]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2260,7 +2745,7 @@ type InstanceStats_DatabaseStats struct {
func (x *InstanceStats_DatabaseStats) Reset() {
*x = InstanceStats_DatabaseStats{}
- mi := &file_api_instance_service_proto_msgTypes[27]
+ mi := &file_api_instance_service_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2272,7 +2757,7 @@ func (x *InstanceStats_DatabaseStats) String() string {
func (*InstanceStats_DatabaseStats) ProtoMessage() {}
func (x *InstanceStats_DatabaseStats) ProtoReflect() protoreflect.Message {
- mi := &file_api_instance_service_proto_msgTypes[27]
+ mi := &file_api_instance_service_proto_msgTypes[34]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2473,18 +2958,64 @@ const file_api_instance_service_proto_rawDesc = "" +
"\x06driver\x18\x01 \x01(\tR\x06driver\x12\x1d\n" +
"\n" +
"size_bytes\x18\x02 \x01(\x03R\tsizeBytes\"\x19\n" +
- "\x17GetInstanceStatsRequest*}\n" +
+ "\x17GetInstanceStatsRequest\"\xd2\x03\n" +
+ "\n" +
+ "UsageLimit\x12\x17\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12<\n" +
+ "\x06metric\x18\x02 \x01(\x0e2\x1c.memos.api.UsageLimit.MetricB\x06\xe0A\x02\xe0A\x05R\x06metric\x12-\n" +
+ "\x04user\x18\x03 \x01(\tB\x19\xe0A\x01\xe0A\x05\xfaA\x10\n" +
+ "\x0ememos.api/UserR\x04user\x12\x19\n" +
+ "\x05value\x18\x04 \x01(\x03B\x03\xe0A\x02R\x05value\x12@\n" +
+ "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
+ "createTime\x12@\n" +
+ "\vupdate_time\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
+ "updateTime\"P\n" +
+ "\x06Metric\x12\x16\n" +
+ "\x12METRIC_UNSPECIFIED\x10\x00\x12\t\n" +
+ "\x05MEMOS\x10\x01\x12\x11\n" +
+ "\rSTORAGE_BYTES\x10\x02\x12\x10\n" +
+ "\fUPLOAD_BYTES\x10\x03:M\xeaAJ\n" +
+ "\x14memos.api/UsageLimit\x12\x19usageLimits/{usage_limit}*\vusageLimits2\n" +
+ "usageLimit\"{\n" +
+ "\x16ListUsageLimitsRequest\x12 \n" +
+ "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
+ "\n" +
+ "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" +
+ "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\"{\n" +
+ "\x17ListUsageLimitsResponse\x128\n" +
+ "\fusage_limits\x18\x01 \x03(\v2\x15.memos.api.UsageLimitR\vusageLimits\x12&\n" +
+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"H\n" +
+ "\x14GetUsageLimitRequest\x120\n" +
+ "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
+ "\x14memos.api/UsageLimitR\x04name\"\x81\x01\n" +
+ "\x17CreateUsageLimitRequest\x12;\n" +
+ "\vusage_limit\x18\x01 \x01(\v2\x15.memos.api.UsageLimitB\x03\xe0A\x02R\n" +
+ "usageLimit\x12)\n" +
+ "\x0eusage_limit_id\x18\x02 \x01(\tB\x03\xe0A\x01R\fusageLimitId\"\x98\x01\n" +
+ "\x17UpdateUsageLimitRequest\x12;\n" +
+ "\vusage_limit\x18\x01 \x01(\v2\x15.memos.api.UsageLimitB\x03\xe0A\x02R\n" +
+ "usageLimit\x12@\n" +
+ "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\n" +
+ "updateMask\"K\n" +
+ "\x17DeleteUsageLimitRequest\x120\n" +
+ "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
+ "\x14memos.api/UsageLimitR\x04name*}\n" +
"\x12InstanceAccessMode\x12$\n" +
" INSTANCE_ACCESS_MODE_UNSPECIFIED\x10\x00\x12 \n" +
"\x1cINSTANCE_ACCESS_MODE_PRIVATE\x10\x01\x12\x1f\n" +
- "\x1bINSTANCE_ACCESS_MODE_PUBLIC\x10\x022\x87\a\n" +
+ "\x1bINSTANCE_ACCESS_MODE_PUBLIC\x10\x022\xa2\f\n" +
"\x0fInstanceService\x12u\n" +
"\x12GetInstanceProfile\x12$.memos.api.GetInstanceProfileRequest\x1a\x1a.memos.api.InstanceProfile\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/api/instance/profile\x12\x86\x01\n" +
"\x12GetInstanceSetting\x12$.memos.api.GetInstanceSettingRequest\x1a\x1a.memos.api.InstanceSetting\".\xdaA\x04name\x82\xd3\xe4\x93\x02!\x12\x1f/api/{name=instance/settings/*}\x12\x9f\x01\n" +
"\x18BatchGetInstanceSettings\x12*.memos.api.BatchGetInstanceSettingsRequest\x1a+.memos.api.BatchGetInstanceSettingsResponse\"*\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/api/instance/settings:batchGet\x12\xc7\x01\n" +
"\x15UpdateInstanceSetting\x12'.memos.api.UpdateInstanceSettingRequest\x1a\x1a.memos.api.InstanceSetting\"i\xdaA\x1cinstance_setting,update_mask\x82\xd3\xe4\x93\x02D:\x10instance_setting20/api/{instance_setting.name=instance/settings/*}\x12\x98\x01\n" +
"\x18TestInstanceEmailSetting\x12*.memos.api.TestInstanceEmailSettingRequest\x1a\x16.google.protobuf.Empty\"8\x82\xd3\xe4\x93\x022:\x01*\"-/api/instance/settings/notification:testEmail\x12m\n" +
- "\x10GetInstanceStats\x12\".memos.api.GetInstanceStatsRequest\x1a\x18.memos.api.InstanceStats\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/instance/statsB\x93\x01\n" +
+ "\x10GetInstanceStats\x12\".memos.api.GetInstanceStatsRequest\x1a\x18.memos.api.InstanceStats\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/api/instance/stats\x12r\n" +
+ "\x0fListUsageLimits\x12!.memos.api.ListUsageLimitsRequest\x1a\".memos.api.ListUsageLimitsResponse\"\x18\x82\xd3\xe4\x93\x02\x12\x12\x10/api/usageLimits\x12q\n" +
+ "\rGetUsageLimit\x12\x1f.memos.api.GetUsageLimitRequest\x1a\x15.memos.api.UsageLimit\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/{name=usageLimits/*}\x12\x91\x01\n" +
+ "\x10CreateUsageLimit\x12\".memos.api.CreateUsageLimitRequest\x1a\x15.memos.api.UsageLimit\"B\xdaA\x1ausage_limit,usage_limit_id\x82\xd3\xe4\x93\x02\x1f:\vusage_limit\"\x10/api/usageLimits\x12\xa3\x01\n" +
+ "\x10UpdateUsageLimit\x12\".memos.api.UpdateUsageLimitRequest\x1a\x15.memos.api.UsageLimit\"T\xdaA\x17usage_limit,update_mask\x82\xd3\xe4\x93\x024:\vusage_limit2%/api/{usage_limit.name=usageLimits/*}\x12x\n" +
+ "\x10DeleteUsageLimit\x12\".memos.api.DeleteUsageLimitRequest\x1a\x16.google.protobuf.Empty\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b*\x19/api/{name=usageLimits/*}B\x93\x01\n" +
"\rcom.memos.apiB\x14InstanceServiceProtoP\x01Z'github.com/usememos/memos/proto/gen/api\xa2\x02\x03MAX\xaa\x02\tMemos.Api\xca\x02\tMemos\\Api\xe2\x02\x15Memos\\Api\\GPBMetadata\xea\x02\n" +
"Memos::Apib\x06proto3"
@@ -2500,96 +3031,121 @@ func file_api_instance_service_proto_rawDescGZIP() []byte {
return file_api_instance_service_proto_rawDescData
}
-var file_api_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
-var file_api_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 28)
+var file_api_instance_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
+var file_api_instance_service_proto_msgTypes = make([]protoimpl.MessageInfo, 35)
var file_api_instance_service_proto_goTypes = []any{
(InstanceAccessMode)(0), // 0: memos.api.InstanceAccessMode
(InstanceSetting_Key)(0), // 1: memos.api.InstanceSetting.Key
(InstanceSetting_StorageType)(0), // 2: memos.api.InstanceSetting.StorageType
(InstanceSetting_AIProviderType)(0), // 3: memos.api.InstanceSetting.AIProviderType
(InstanceSetting_StorageSetting_StorageType)(0), // 4: memos.api.InstanceSetting.StorageSetting.StorageType
- (*InstanceProfile)(nil), // 5: memos.api.InstanceProfile
- (*GetInstanceProfileRequest)(nil), // 6: memos.api.GetInstanceProfileRequest
- (*InstanceSetting)(nil), // 7: memos.api.InstanceSetting
- (*GetInstanceSettingRequest)(nil), // 8: memos.api.GetInstanceSettingRequest
- (*BatchGetInstanceSettingsRequest)(nil), // 9: memos.api.BatchGetInstanceSettingsRequest
- (*BatchGetInstanceSettingsResponse)(nil), // 10: memos.api.BatchGetInstanceSettingsResponse
- (*UpdateInstanceSettingRequest)(nil), // 11: memos.api.UpdateInstanceSettingRequest
- (*TestInstanceEmailSettingRequest)(nil), // 12: memos.api.TestInstanceEmailSettingRequest
- (*InstanceStats)(nil), // 13: memos.api.InstanceStats
- (*GetInstanceStatsRequest)(nil), // 14: memos.api.GetInstanceStatsRequest
- (*InstanceProfile_Challenge)(nil), // 15: memos.api.InstanceProfile.Challenge
- (*InstanceSetting_GeneralSetting)(nil), // 16: memos.api.InstanceSetting.GeneralSetting
- (*InstanceSetting_StorageSetting)(nil), // 17: memos.api.InstanceSetting.StorageSetting
- (*InstanceSetting_Storage)(nil), // 18: memos.api.InstanceSetting.Storage
- (*InstanceSetting_MemoRelatedSetting)(nil), // 19: memos.api.InstanceSetting.MemoRelatedSetting
- (*InstanceSetting_TagsSetting)(nil), // 20: memos.api.InstanceSetting.TagsSetting
- (*InstanceSetting_TagMetadata)(nil), // 21: memos.api.InstanceSetting.TagMetadata
- (*InstanceSetting_NotificationSetting)(nil), // 22: memos.api.InstanceSetting.NotificationSetting
- (*InstanceSetting_AISetting)(nil), // 23: memos.api.InstanceSetting.AISetting
- (*InstanceSetting_AIProviderConfig)(nil), // 24: memos.api.InstanceSetting.AIProviderConfig
- (*InstanceSetting_TranscriptionConfig)(nil), // 25: memos.api.InstanceSetting.TranscriptionConfig
- (*InstanceSetting_AccessSetting)(nil), // 26: memos.api.InstanceSetting.AccessSetting
- (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 27: memos.api.InstanceSetting.GeneralSetting.CustomProfile
- (*InstanceSetting_StorageSetting_S3Config)(nil), // 28: memos.api.InstanceSetting.StorageSetting.S3Config
- (*InstanceSetting_Storage_S3Config)(nil), // 29: memos.api.InstanceSetting.Storage.S3Config
- nil, // 30: memos.api.InstanceSetting.TagsSetting.TagsEntry
- (*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 31: memos.api.InstanceSetting.NotificationSetting.EmailSetting
- (*InstanceStats_DatabaseStats)(nil), // 32: memos.api.InstanceStats.DatabaseStats
- (*User)(nil), // 33: memos.api.User
- (*fieldmaskpb.FieldMask)(nil), // 34: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 35: google.protobuf.Timestamp
- (*color.Color)(nil), // 36: google.type.Color
- (*emptypb.Empty)(nil), // 37: google.protobuf.Empty
+ (UsageLimit_Metric)(0), // 5: memos.api.UsageLimit.Metric
+ (*InstanceProfile)(nil), // 6: memos.api.InstanceProfile
+ (*GetInstanceProfileRequest)(nil), // 7: memos.api.GetInstanceProfileRequest
+ (*InstanceSetting)(nil), // 8: memos.api.InstanceSetting
+ (*GetInstanceSettingRequest)(nil), // 9: memos.api.GetInstanceSettingRequest
+ (*BatchGetInstanceSettingsRequest)(nil), // 10: memos.api.BatchGetInstanceSettingsRequest
+ (*BatchGetInstanceSettingsResponse)(nil), // 11: memos.api.BatchGetInstanceSettingsResponse
+ (*UpdateInstanceSettingRequest)(nil), // 12: memos.api.UpdateInstanceSettingRequest
+ (*TestInstanceEmailSettingRequest)(nil), // 13: memos.api.TestInstanceEmailSettingRequest
+ (*InstanceStats)(nil), // 14: memos.api.InstanceStats
+ (*GetInstanceStatsRequest)(nil), // 15: memos.api.GetInstanceStatsRequest
+ (*UsageLimit)(nil), // 16: memos.api.UsageLimit
+ (*ListUsageLimitsRequest)(nil), // 17: memos.api.ListUsageLimitsRequest
+ (*ListUsageLimitsResponse)(nil), // 18: memos.api.ListUsageLimitsResponse
+ (*GetUsageLimitRequest)(nil), // 19: memos.api.GetUsageLimitRequest
+ (*CreateUsageLimitRequest)(nil), // 20: memos.api.CreateUsageLimitRequest
+ (*UpdateUsageLimitRequest)(nil), // 21: memos.api.UpdateUsageLimitRequest
+ (*DeleteUsageLimitRequest)(nil), // 22: memos.api.DeleteUsageLimitRequest
+ (*InstanceProfile_Challenge)(nil), // 23: memos.api.InstanceProfile.Challenge
+ (*InstanceSetting_GeneralSetting)(nil), // 24: memos.api.InstanceSetting.GeneralSetting
+ (*InstanceSetting_StorageSetting)(nil), // 25: memos.api.InstanceSetting.StorageSetting
+ (*InstanceSetting_Storage)(nil), // 26: memos.api.InstanceSetting.Storage
+ (*InstanceSetting_MemoRelatedSetting)(nil), // 27: memos.api.InstanceSetting.MemoRelatedSetting
+ (*InstanceSetting_TagsSetting)(nil), // 28: memos.api.InstanceSetting.TagsSetting
+ (*InstanceSetting_TagMetadata)(nil), // 29: memos.api.InstanceSetting.TagMetadata
+ (*InstanceSetting_NotificationSetting)(nil), // 30: memos.api.InstanceSetting.NotificationSetting
+ (*InstanceSetting_AISetting)(nil), // 31: memos.api.InstanceSetting.AISetting
+ (*InstanceSetting_AIProviderConfig)(nil), // 32: memos.api.InstanceSetting.AIProviderConfig
+ (*InstanceSetting_TranscriptionConfig)(nil), // 33: memos.api.InstanceSetting.TranscriptionConfig
+ (*InstanceSetting_AccessSetting)(nil), // 34: memos.api.InstanceSetting.AccessSetting
+ (*InstanceSetting_GeneralSetting_CustomProfile)(nil), // 35: memos.api.InstanceSetting.GeneralSetting.CustomProfile
+ (*InstanceSetting_StorageSetting_S3Config)(nil), // 36: memos.api.InstanceSetting.StorageSetting.S3Config
+ (*InstanceSetting_Storage_S3Config)(nil), // 37: memos.api.InstanceSetting.Storage.S3Config
+ nil, // 38: memos.api.InstanceSetting.TagsSetting.TagsEntry
+ (*InstanceSetting_NotificationSetting_EmailSetting)(nil), // 39: memos.api.InstanceSetting.NotificationSetting.EmailSetting
+ (*InstanceStats_DatabaseStats)(nil), // 40: memos.api.InstanceStats.DatabaseStats
+ (*User)(nil), // 41: memos.api.User
+ (*fieldmaskpb.FieldMask)(nil), // 42: google.protobuf.FieldMask
+ (*timestamppb.Timestamp)(nil), // 43: google.protobuf.Timestamp
+ (*color.Color)(nil), // 44: google.type.Color
+ (*emptypb.Empty)(nil), // 45: google.protobuf.Empty
}
var file_api_instance_service_proto_depIdxs = []int32{
0, // 0: memos.api.InstanceProfile.access_mode:type_name -> memos.api.InstanceAccessMode
- 33, // 1: memos.api.InstanceProfile.admin:type_name -> memos.api.User
- 15, // 2: memos.api.InstanceProfile.challenge:type_name -> memos.api.InstanceProfile.Challenge
- 16, // 3: memos.api.InstanceSetting.general_setting:type_name -> memos.api.InstanceSetting.GeneralSetting
- 17, // 4: memos.api.InstanceSetting.storage_setting:type_name -> memos.api.InstanceSetting.StorageSetting
- 19, // 5: memos.api.InstanceSetting.memo_related_setting:type_name -> memos.api.InstanceSetting.MemoRelatedSetting
- 20, // 6: memos.api.InstanceSetting.tags_setting:type_name -> memos.api.InstanceSetting.TagsSetting
- 22, // 7: memos.api.InstanceSetting.notification_setting:type_name -> memos.api.InstanceSetting.NotificationSetting
- 23, // 8: memos.api.InstanceSetting.ai_setting:type_name -> memos.api.InstanceSetting.AISetting
- 26, // 9: memos.api.InstanceSetting.access_setting:type_name -> memos.api.InstanceSetting.AccessSetting
- 7, // 10: memos.api.BatchGetInstanceSettingsResponse.instance_settings:type_name -> memos.api.InstanceSetting
- 7, // 11: memos.api.UpdateInstanceSettingRequest.instance_setting:type_name -> memos.api.InstanceSetting
- 34, // 12: memos.api.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
- 31, // 13: memos.api.TestInstanceEmailSettingRequest.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
- 32, // 14: memos.api.InstanceStats.database:type_name -> memos.api.InstanceStats.DatabaseStats
- 35, // 15: memos.api.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp
- 27, // 16: memos.api.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.InstanceSetting.GeneralSetting.CustomProfile
- 18, // 17: memos.api.InstanceSetting.StorageSetting.storages:type_name -> memos.api.InstanceSetting.Storage
- 4, // 18: memos.api.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.InstanceSetting.StorageSetting.StorageType
- 28, // 19: memos.api.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.InstanceSetting.StorageSetting.S3Config
- 2, // 20: memos.api.InstanceSetting.Storage.type:type_name -> memos.api.InstanceSetting.StorageType
- 29, // 21: memos.api.InstanceSetting.Storage.s3_config:type_name -> memos.api.InstanceSetting.Storage.S3Config
- 30, // 22: memos.api.InstanceSetting.TagsSetting.tags:type_name -> memos.api.InstanceSetting.TagsSetting.TagsEntry
- 36, // 23: memos.api.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color
- 31, // 24: memos.api.InstanceSetting.NotificationSetting.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
- 24, // 25: memos.api.InstanceSetting.AISetting.providers:type_name -> memos.api.InstanceSetting.AIProviderConfig
- 25, // 26: memos.api.InstanceSetting.AISetting.transcription:type_name -> memos.api.InstanceSetting.TranscriptionConfig
- 3, // 27: memos.api.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.InstanceSetting.AIProviderType
- 0, // 28: memos.api.InstanceSetting.AccessSetting.access_mode:type_name -> memos.api.InstanceAccessMode
- 21, // 29: memos.api.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.InstanceSetting.TagMetadata
- 6, // 30: memos.api.InstanceService.GetInstanceProfile:input_type -> memos.api.GetInstanceProfileRequest
- 8, // 31: memos.api.InstanceService.GetInstanceSetting:input_type -> memos.api.GetInstanceSettingRequest
- 9, // 32: memos.api.InstanceService.BatchGetInstanceSettings:input_type -> memos.api.BatchGetInstanceSettingsRequest
- 11, // 33: memos.api.InstanceService.UpdateInstanceSetting:input_type -> memos.api.UpdateInstanceSettingRequest
- 12, // 34: memos.api.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.TestInstanceEmailSettingRequest
- 14, // 35: memos.api.InstanceService.GetInstanceStats:input_type -> memos.api.GetInstanceStatsRequest
- 5, // 36: memos.api.InstanceService.GetInstanceProfile:output_type -> memos.api.InstanceProfile
- 7, // 37: memos.api.InstanceService.GetInstanceSetting:output_type -> memos.api.InstanceSetting
- 10, // 38: memos.api.InstanceService.BatchGetInstanceSettings:output_type -> memos.api.BatchGetInstanceSettingsResponse
- 7, // 39: memos.api.InstanceService.UpdateInstanceSetting:output_type -> memos.api.InstanceSetting
- 37, // 40: memos.api.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty
- 13, // 41: memos.api.InstanceService.GetInstanceStats:output_type -> memos.api.InstanceStats
- 36, // [36:42] is the sub-list for method output_type
- 30, // [30:36] is the sub-list for method input_type
- 30, // [30:30] is the sub-list for extension type_name
- 30, // [30:30] is the sub-list for extension extendee
- 0, // [0:30] is the sub-list for field type_name
+ 41, // 1: memos.api.InstanceProfile.admin:type_name -> memos.api.User
+ 23, // 2: memos.api.InstanceProfile.challenge:type_name -> memos.api.InstanceProfile.Challenge
+ 24, // 3: memos.api.InstanceSetting.general_setting:type_name -> memos.api.InstanceSetting.GeneralSetting
+ 25, // 4: memos.api.InstanceSetting.storage_setting:type_name -> memos.api.InstanceSetting.StorageSetting
+ 27, // 5: memos.api.InstanceSetting.memo_related_setting:type_name -> memos.api.InstanceSetting.MemoRelatedSetting
+ 28, // 6: memos.api.InstanceSetting.tags_setting:type_name -> memos.api.InstanceSetting.TagsSetting
+ 30, // 7: memos.api.InstanceSetting.notification_setting:type_name -> memos.api.InstanceSetting.NotificationSetting
+ 31, // 8: memos.api.InstanceSetting.ai_setting:type_name -> memos.api.InstanceSetting.AISetting
+ 34, // 9: memos.api.InstanceSetting.access_setting:type_name -> memos.api.InstanceSetting.AccessSetting
+ 8, // 10: memos.api.BatchGetInstanceSettingsResponse.instance_settings:type_name -> memos.api.InstanceSetting
+ 8, // 11: memos.api.UpdateInstanceSettingRequest.instance_setting:type_name -> memos.api.InstanceSetting
+ 42, // 12: memos.api.UpdateInstanceSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 39, // 13: memos.api.TestInstanceEmailSettingRequest.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
+ 40, // 14: memos.api.InstanceStats.database:type_name -> memos.api.InstanceStats.DatabaseStats
+ 43, // 15: memos.api.InstanceStats.generated_time:type_name -> google.protobuf.Timestamp
+ 5, // 16: memos.api.UsageLimit.metric:type_name -> memos.api.UsageLimit.Metric
+ 43, // 17: memos.api.UsageLimit.create_time:type_name -> google.protobuf.Timestamp
+ 43, // 18: memos.api.UsageLimit.update_time:type_name -> google.protobuf.Timestamp
+ 16, // 19: memos.api.ListUsageLimitsResponse.usage_limits:type_name -> memos.api.UsageLimit
+ 16, // 20: memos.api.CreateUsageLimitRequest.usage_limit:type_name -> memos.api.UsageLimit
+ 16, // 21: memos.api.UpdateUsageLimitRequest.usage_limit:type_name -> memos.api.UsageLimit
+ 42, // 22: memos.api.UpdateUsageLimitRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 35, // 23: memos.api.InstanceSetting.GeneralSetting.custom_profile:type_name -> memos.api.InstanceSetting.GeneralSetting.CustomProfile
+ 26, // 24: memos.api.InstanceSetting.StorageSetting.storages:type_name -> memos.api.InstanceSetting.Storage
+ 4, // 25: memos.api.InstanceSetting.StorageSetting.storage_type:type_name -> memos.api.InstanceSetting.StorageSetting.StorageType
+ 36, // 26: memos.api.InstanceSetting.StorageSetting.s3_config:type_name -> memos.api.InstanceSetting.StorageSetting.S3Config
+ 2, // 27: memos.api.InstanceSetting.Storage.type:type_name -> memos.api.InstanceSetting.StorageType
+ 37, // 28: memos.api.InstanceSetting.Storage.s3_config:type_name -> memos.api.InstanceSetting.Storage.S3Config
+ 38, // 29: memos.api.InstanceSetting.TagsSetting.tags:type_name -> memos.api.InstanceSetting.TagsSetting.TagsEntry
+ 44, // 30: memos.api.InstanceSetting.TagMetadata.background_color:type_name -> google.type.Color
+ 39, // 31: memos.api.InstanceSetting.NotificationSetting.email:type_name -> memos.api.InstanceSetting.NotificationSetting.EmailSetting
+ 32, // 32: memos.api.InstanceSetting.AISetting.providers:type_name -> memos.api.InstanceSetting.AIProviderConfig
+ 33, // 33: memos.api.InstanceSetting.AISetting.transcription:type_name -> memos.api.InstanceSetting.TranscriptionConfig
+ 3, // 34: memos.api.InstanceSetting.AIProviderConfig.type:type_name -> memos.api.InstanceSetting.AIProviderType
+ 0, // 35: memos.api.InstanceSetting.AccessSetting.access_mode:type_name -> memos.api.InstanceAccessMode
+ 29, // 36: memos.api.InstanceSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.InstanceSetting.TagMetadata
+ 7, // 37: memos.api.InstanceService.GetInstanceProfile:input_type -> memos.api.GetInstanceProfileRequest
+ 9, // 38: memos.api.InstanceService.GetInstanceSetting:input_type -> memos.api.GetInstanceSettingRequest
+ 10, // 39: memos.api.InstanceService.BatchGetInstanceSettings:input_type -> memos.api.BatchGetInstanceSettingsRequest
+ 12, // 40: memos.api.InstanceService.UpdateInstanceSetting:input_type -> memos.api.UpdateInstanceSettingRequest
+ 13, // 41: memos.api.InstanceService.TestInstanceEmailSetting:input_type -> memos.api.TestInstanceEmailSettingRequest
+ 15, // 42: memos.api.InstanceService.GetInstanceStats:input_type -> memos.api.GetInstanceStatsRequest
+ 17, // 43: memos.api.InstanceService.ListUsageLimits:input_type -> memos.api.ListUsageLimitsRequest
+ 19, // 44: memos.api.InstanceService.GetUsageLimit:input_type -> memos.api.GetUsageLimitRequest
+ 20, // 45: memos.api.InstanceService.CreateUsageLimit:input_type -> memos.api.CreateUsageLimitRequest
+ 21, // 46: memos.api.InstanceService.UpdateUsageLimit:input_type -> memos.api.UpdateUsageLimitRequest
+ 22, // 47: memos.api.InstanceService.DeleteUsageLimit:input_type -> memos.api.DeleteUsageLimitRequest
+ 6, // 48: memos.api.InstanceService.GetInstanceProfile:output_type -> memos.api.InstanceProfile
+ 8, // 49: memos.api.InstanceService.GetInstanceSetting:output_type -> memos.api.InstanceSetting
+ 11, // 50: memos.api.InstanceService.BatchGetInstanceSettings:output_type -> memos.api.BatchGetInstanceSettingsResponse
+ 8, // 51: memos.api.InstanceService.UpdateInstanceSetting:output_type -> memos.api.InstanceSetting
+ 45, // 52: memos.api.InstanceService.TestInstanceEmailSetting:output_type -> google.protobuf.Empty
+ 14, // 53: memos.api.InstanceService.GetInstanceStats:output_type -> memos.api.InstanceStats
+ 18, // 54: memos.api.InstanceService.ListUsageLimits:output_type -> memos.api.ListUsageLimitsResponse
+ 16, // 55: memos.api.InstanceService.GetUsageLimit:output_type -> memos.api.UsageLimit
+ 16, // 56: memos.api.InstanceService.CreateUsageLimit:output_type -> memos.api.UsageLimit
+ 16, // 57: memos.api.InstanceService.UpdateUsageLimit:output_type -> memos.api.UsageLimit
+ 45, // 58: memos.api.InstanceService.DeleteUsageLimit:output_type -> google.protobuf.Empty
+ 48, // [48:59] is the sub-list for method output_type
+ 37, // [37:48] is the sub-list for method input_type
+ 37, // [37:37] is the sub-list for extension type_name
+ 37, // [37:37] is the sub-list for extension extendee
+ 0, // [0:37] is the sub-list for field type_name
}
func init() { file_api_instance_service_proto_init() }
@@ -2607,7 +3163,7 @@ func file_api_instance_service_proto_init() {
(*InstanceSetting_AiSetting)(nil),
(*InstanceSetting_AccessSetting_)(nil),
}
- file_api_instance_service_proto_msgTypes[13].OneofWrappers = []any{
+ file_api_instance_service_proto_msgTypes[20].OneofWrappers = []any{
(*InstanceSetting_Storage_S3Config_)(nil),
}
type x struct{}
@@ -2615,8 +3171,8 @@ func file_api_instance_service_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_instance_service_proto_rawDesc), len(file_api_instance_service_proto_rawDesc)),
- NumEnums: 5,
- NumMessages: 28,
+ NumEnums: 6,
+ NumMessages: 35,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/instance_service.pb.gw.go b/proto/gen/api/instance_service.pb.gw.go
index cdc9000b8..7db2273ba 100644
--- a/proto/gen/api/instance_service.pb.gw.go
+++ b/proto/gen/api/instance_service.pb.gw.go
@@ -251,6 +251,241 @@ func local_request_InstanceService_GetInstanceStats_0(ctx context.Context, marsh
return msg, metadata, err
}
+var filter_InstanceService_ListUsageLimits_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+
+func request_InstanceService_ListUsageLimits_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListUsageLimitsRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_ListUsageLimits_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.ListUsageLimits(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_InstanceService_ListUsageLimits_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListUsageLimitsRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_ListUsageLimits_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.ListUsageLimits(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_InstanceService_GetUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq GetUsageLimitRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.GetUsageLimit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_InstanceService_GetUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq GetUsageLimitRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := server.GetUsageLimit(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+var filter_InstanceService_CreateUsageLimit_0 = &utilities.DoubleArray{Encoding: map[string]int{"usage_limit": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
+
+func request_InstanceService_CreateUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq CreateUsageLimitRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.UsageLimit); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_CreateUsageLimit_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.CreateUsageLimit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_InstanceService_CreateUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq CreateUsageLimitRequest
+ metadata runtime.ServerMetadata
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.UsageLimit); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_CreateUsageLimit_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.CreateUsageLimit(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+var filter_InstanceService_UpdateUsageLimit_0 = &utilities.DoubleArray{Encoding: map[string]int{"usage_limit": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
+
+func request_InstanceService_UpdateUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq UpdateUsageLimitRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.UsageLimit); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.UsageLimit); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ } else {
+ protoReq.UpdateMask = fieldMask
+ }
+ }
+ val, ok := pathParams["usage_limit.name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "usage_limit.name")
+ }
+ err = runtime.PopulateFieldFromPath(&protoReq, "usage_limit.name", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "usage_limit.name", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_UpdateUsageLimit_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.UpdateUsageLimit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_InstanceService_UpdateUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq UpdateUsageLimitRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.UsageLimit); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 {
+ if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.UsageLimit); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ } else {
+ protoReq.UpdateMask = fieldMask
+ }
+ }
+ val, ok := pathParams["usage_limit.name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "usage_limit.name")
+ }
+ err = runtime.PopulateFieldFromPath(&protoReq, "usage_limit.name", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "usage_limit.name", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InstanceService_UpdateUsageLimit_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.UpdateUsageLimit(ctx, &protoReq)
+ return msg, metadata, err
+}
+
+func request_InstanceService_DeleteUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, client InstanceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq DeleteUsageLimitRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.DeleteUsageLimit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_InstanceService_DeleteUsageLimit_0(ctx context.Context, marshaler runtime.Marshaler, server InstanceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq DeleteUsageLimitRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := server.DeleteUsageLimit(ctx, &protoReq)
+ return msg, metadata, err
+}
+
// RegisterInstanceServiceHandlerServer registers the http handlers for service InstanceService to "mux".
// UnaryRPC :call InstanceServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -377,6 +612,106 @@ func RegisterInstanceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
}
forward_InstanceService_GetInstanceStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_InstanceService_ListUsageLimits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/ListUsageLimits", runtime.WithHTTPPathPattern("/api/usageLimits"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_InstanceService_ListUsageLimits_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_ListUsageLimits_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodGet, pattern_InstanceService_GetUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/GetUsageLimit", runtime.WithHTTPPathPattern("/api/{name=usageLimits/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_InstanceService_GetUsageLimit_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_GetUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_InstanceService_CreateUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/CreateUsageLimit", runtime.WithHTTPPathPattern("/api/usageLimits"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_InstanceService_CreateUsageLimit_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_CreateUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPatch, pattern_InstanceService_UpdateUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/UpdateUsageLimit", runtime.WithHTTPPathPattern("/api/{usage_limit.name=usageLimits/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_InstanceService_UpdateUsageLimit_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_UpdateUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodDelete, pattern_InstanceService_DeleteUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.InstanceService/DeleteUsageLimit", runtime.WithHTTPPathPattern("/api/{name=usageLimits/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_InstanceService_DeleteUsageLimit_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_DeleteUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -519,6 +854,91 @@ func RegisterInstanceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
}
forward_InstanceService_GetInstanceStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_InstanceService_ListUsageLimits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/ListUsageLimits", runtime.WithHTTPPathPattern("/api/usageLimits"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_InstanceService_ListUsageLimits_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_ListUsageLimits_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodGet, pattern_InstanceService_GetUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/GetUsageLimit", runtime.WithHTTPPathPattern("/api/{name=usageLimits/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_InstanceService_GetUsageLimit_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_GetUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPost, pattern_InstanceService_CreateUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/CreateUsageLimit", runtime.WithHTTPPathPattern("/api/usageLimits"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_InstanceService_CreateUsageLimit_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_CreateUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodPatch, pattern_InstanceService_UpdateUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/UpdateUsageLimit", runtime.WithHTTPPathPattern("/api/{usage_limit.name=usageLimits/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_InstanceService_UpdateUsageLimit_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_UpdateUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
+ mux.Handle(http.MethodDelete, pattern_InstanceService_DeleteUsageLimit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.InstanceService/DeleteUsageLimit", runtime.WithHTTPPathPattern("/api/{name=usageLimits/*}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_InstanceService_DeleteUsageLimit_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_InstanceService_DeleteUsageLimit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -529,6 +949,11 @@ var (
pattern_InstanceService_UpdateInstanceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 3, 5, 3}, []string{"api", "instance", "settings", "instance_setting.name"}, ""))
pattern_InstanceService_TestInstanceEmailSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "instance", "settings", "notification"}, "testEmail"))
pattern_InstanceService_GetInstanceStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "instance", "stats"}, ""))
+ pattern_InstanceService_ListUsageLimits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "usageLimits"}, ""))
+ pattern_InstanceService_GetUsageLimit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "usageLimits", "name"}, ""))
+ pattern_InstanceService_CreateUsageLimit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "usageLimits"}, ""))
+ pattern_InstanceService_UpdateUsageLimit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "usageLimits", "usage_limit.name"}, ""))
+ pattern_InstanceService_DeleteUsageLimit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "usageLimits", "name"}, ""))
)
var (
@@ -538,4 +963,9 @@ var (
forward_InstanceService_UpdateInstanceSetting_0 = runtime.ForwardResponseMessage
forward_InstanceService_TestInstanceEmailSetting_0 = runtime.ForwardResponseMessage
forward_InstanceService_GetInstanceStats_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_ListUsageLimits_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_GetUsageLimit_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_CreateUsageLimit_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_UpdateUsageLimit_0 = runtime.ForwardResponseMessage
+ forward_InstanceService_DeleteUsageLimit_0 = runtime.ForwardResponseMessage
)
diff --git a/proto/gen/api/instance_service_grpc.pb.go b/proto/gen/api/instance_service_grpc.pb.go
index 7ed219ead..619b5d527 100644
--- a/proto/gen/api/instance_service_grpc.pb.go
+++ b/proto/gen/api/instance_service_grpc.pb.go
@@ -26,6 +26,11 @@ const (
InstanceService_UpdateInstanceSetting_FullMethodName = "/memos.api.InstanceService/UpdateInstanceSetting"
InstanceService_TestInstanceEmailSetting_FullMethodName = "/memos.api.InstanceService/TestInstanceEmailSetting"
InstanceService_GetInstanceStats_FullMethodName = "/memos.api.InstanceService/GetInstanceStats"
+ InstanceService_ListUsageLimits_FullMethodName = "/memos.api.InstanceService/ListUsageLimits"
+ InstanceService_GetUsageLimit_FullMethodName = "/memos.api.InstanceService/GetUsageLimit"
+ InstanceService_CreateUsageLimit_FullMethodName = "/memos.api.InstanceService/CreateUsageLimit"
+ InstanceService_UpdateUsageLimit_FullMethodName = "/memos.api.InstanceService/UpdateUsageLimit"
+ InstanceService_DeleteUsageLimit_FullMethodName = "/memos.api.InstanceService/DeleteUsageLimit"
)
// InstanceServiceClient is the client API for InstanceService service.
@@ -49,6 +54,22 @@ type InstanceServiceClient interface {
TestInstanceEmailSetting(ctx context.Context, in *TestInstanceEmailSettingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds.
GetInstanceStats(ctx context.Context, in *GetInstanceStatsRequest, opts ...grpc.CallOption) (*InstanceStats, error)
+ // ListUsageLimits lists the usage limits: the defaults for every user and the
+ // limits for single users. Admin only.
+ ListUsageLimits(ctx context.Context, in *ListUsageLimitsRequest, opts ...grpc.CallOption) (*ListUsageLimitsResponse, error)
+ // GetUsageLimit gets a usage limit. Admin only.
+ GetUsageLimit(ctx context.Context, in *GetUsageLimitRequest, opts ...grpc.CallOption) (*UsageLimit, error)
+ // CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ // limit per metric and user, and one default per metric. Fails with
+ // FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ CreateUsageLimit(ctx context.Context, in *CreateUsageLimitRequest, opts ...grpc.CallOption) (*UsageLimit, error)
+ // UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ // and user cannot change.
+ UpdateUsageLimit(ctx context.Context, in *UpdateUsageLimitRequest, opts ...grpc.CallOption) (*UsageLimit, error)
+ // DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ // returns the user to the default; deleting a default makes the metric
+ // unlimited for users without their own limit.
+ DeleteUsageLimit(ctx context.Context, in *DeleteUsageLimitRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type instanceServiceClient struct {
@@ -119,6 +140,56 @@ func (c *instanceServiceClient) GetInstanceStats(ctx context.Context, in *GetIns
return out, nil
}
+func (c *instanceServiceClient) ListUsageLimits(ctx context.Context, in *ListUsageLimitsRequest, opts ...grpc.CallOption) (*ListUsageLimitsResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(ListUsageLimitsResponse)
+ err := c.cc.Invoke(ctx, InstanceService_ListUsageLimits_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *instanceServiceClient) GetUsageLimit(ctx context.Context, in *GetUsageLimitRequest, opts ...grpc.CallOption) (*UsageLimit, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UsageLimit)
+ err := c.cc.Invoke(ctx, InstanceService_GetUsageLimit_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *instanceServiceClient) CreateUsageLimit(ctx context.Context, in *CreateUsageLimitRequest, opts ...grpc.CallOption) (*UsageLimit, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UsageLimit)
+ err := c.cc.Invoke(ctx, InstanceService_CreateUsageLimit_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *instanceServiceClient) UpdateUsageLimit(ctx context.Context, in *UpdateUsageLimitRequest, opts ...grpc.CallOption) (*UsageLimit, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UsageLimit)
+ err := c.cc.Invoke(ctx, InstanceService_UpdateUsageLimit_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *instanceServiceClient) DeleteUsageLimit(ctx context.Context, in *DeleteUsageLimitRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, InstanceService_DeleteUsageLimit_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// InstanceServiceServer is the server API for InstanceService service.
// All implementations must embed UnimplementedInstanceServiceServer
// for forward compatibility.
@@ -140,6 +211,22 @@ type InstanceServiceServer interface {
TestInstanceEmailSetting(context.Context, *TestInstanceEmailSettingRequest) (*emptypb.Empty, error)
// GetInstanceStats gets resource usage statistics for the instance. Admin only. Results are cached for 60 seconds.
GetInstanceStats(context.Context, *GetInstanceStatsRequest) (*InstanceStats, error)
+ // ListUsageLimits lists the usage limits: the defaults for every user and the
+ // limits for single users. Admin only.
+ ListUsageLimits(context.Context, *ListUsageLimitsRequest) (*ListUsageLimitsResponse, error)
+ // GetUsageLimit gets a usage limit. Admin only.
+ GetUsageLimit(context.Context, *GetUsageLimitRequest) (*UsageLimit, error)
+ // CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ // limit per metric and user, and one default per metric. Fails with
+ // FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ CreateUsageLimit(context.Context, *CreateUsageLimitRequest) (*UsageLimit, error)
+ // UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ // and user cannot change.
+ UpdateUsageLimit(context.Context, *UpdateUsageLimitRequest) (*UsageLimit, error)
+ // DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ // returns the user to the default; deleting a default makes the metric
+ // unlimited for users without their own limit.
+ DeleteUsageLimit(context.Context, *DeleteUsageLimitRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedInstanceServiceServer()
}
@@ -168,6 +255,21 @@ func (UnimplementedInstanceServiceServer) TestInstanceEmailSetting(context.Conte
func (UnimplementedInstanceServiceServer) GetInstanceStats(context.Context, *GetInstanceStatsRequest) (*InstanceStats, error) {
return nil, status.Error(codes.Unimplemented, "method GetInstanceStats not implemented")
}
+func (UnimplementedInstanceServiceServer) ListUsageLimits(context.Context, *ListUsageLimitsRequest) (*ListUsageLimitsResponse, error) {
+ return nil, status.Error(codes.Unimplemented, "method ListUsageLimits not implemented")
+}
+func (UnimplementedInstanceServiceServer) GetUsageLimit(context.Context, *GetUsageLimitRequest) (*UsageLimit, error) {
+ return nil, status.Error(codes.Unimplemented, "method GetUsageLimit not implemented")
+}
+func (UnimplementedInstanceServiceServer) CreateUsageLimit(context.Context, *CreateUsageLimitRequest) (*UsageLimit, error) {
+ return nil, status.Error(codes.Unimplemented, "method CreateUsageLimit not implemented")
+}
+func (UnimplementedInstanceServiceServer) UpdateUsageLimit(context.Context, *UpdateUsageLimitRequest) (*UsageLimit, error) {
+ return nil, status.Error(codes.Unimplemented, "method UpdateUsageLimit not implemented")
+}
+func (UnimplementedInstanceServiceServer) DeleteUsageLimit(context.Context, *DeleteUsageLimitRequest) (*emptypb.Empty, error) {
+ return nil, status.Error(codes.Unimplemented, "method DeleteUsageLimit not implemented")
+}
func (UnimplementedInstanceServiceServer) mustEmbedUnimplementedInstanceServiceServer() {}
func (UnimplementedInstanceServiceServer) testEmbeddedByValue() {}
@@ -297,6 +399,96 @@ func _InstanceService_GetInstanceStats_Handler(srv interface{}, ctx context.Cont
return interceptor(ctx, in, info, handler)
}
+func _InstanceService_ListUsageLimits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ListUsageLimitsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).ListUsageLimits(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_ListUsageLimits_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).ListUsageLimits(ctx, req.(*ListUsageLimitsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _InstanceService_GetUsageLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetUsageLimitRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).GetUsageLimit(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_GetUsageLimit_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).GetUsageLimit(ctx, req.(*GetUsageLimitRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _InstanceService_CreateUsageLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateUsageLimitRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).CreateUsageLimit(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_CreateUsageLimit_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).CreateUsageLimit(ctx, req.(*CreateUsageLimitRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _InstanceService_UpdateUsageLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateUsageLimitRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).UpdateUsageLimit(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_UpdateUsageLimit_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).UpdateUsageLimit(ctx, req.(*UpdateUsageLimitRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _InstanceService_DeleteUsageLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteUsageLimitRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(InstanceServiceServer).DeleteUsageLimit(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: InstanceService_DeleteUsageLimit_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(InstanceServiceServer).DeleteUsageLimit(ctx, req.(*DeleteUsageLimitRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// InstanceService_ServiceDesc is the grpc.ServiceDesc for InstanceService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -328,6 +520,26 @@ var InstanceService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetInstanceStats",
Handler: _InstanceService_GetInstanceStats_Handler,
},
+ {
+ MethodName: "ListUsageLimits",
+ Handler: _InstanceService_ListUsageLimits_Handler,
+ },
+ {
+ MethodName: "GetUsageLimit",
+ Handler: _InstanceService_GetUsageLimit_Handler,
+ },
+ {
+ MethodName: "CreateUsageLimit",
+ Handler: _InstanceService_CreateUsageLimit_Handler,
+ },
+ {
+ MethodName: "UpdateUsageLimit",
+ Handler: _InstanceService_UpdateUsageLimit_Handler,
+ },
+ {
+ MethodName: "DeleteUsageLimit",
+ Handler: _InstanceService_DeleteUsageLimit_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "api/instance_service.proto",
diff --git a/proto/gen/api/user_service.pb.go b/proto/gen/api/user_service.pb.go
index 7c7bb8071..700fd5df6 100644
--- a/proto/gen/api/user_service.pb.go
+++ b/proto/gen/api/user_service.pb.go
@@ -184,7 +184,7 @@ func (x UserNotification_Status) Number() protoreflect.EnumNumber {
// Deprecated: Use UserNotification_Status.Descriptor instead.
func (UserNotification_Status) EnumDescriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25, 0}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27, 0}
}
// Type is the kind of event a notification reports.
@@ -240,7 +240,7 @@ func (x UserNotification_Type) Number() protoreflect.EnumNumber {
// Deprecated: Use UserNotification_Type.Descriptor instead.
func (UserNotification_Type) EnumDescriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25, 1}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27, 1}
}
// InvitationState is the receiver's progress on the invitation.
@@ -292,7 +292,7 @@ func (x UserNotification_SpaceInvitationPayload_InvitationState) Number() protor
// Deprecated: Use UserNotification_SpaceInvitationPayload_InvitationState.Descriptor instead.
func (UserNotification_SpaceInvitationPayload_InvitationState) EnumDescriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25, 2, 0}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27, 2, 0}
}
// ConflictPolicy says what the importer does with a memo whose UID the user
@@ -349,7 +349,7 @@ func (x ImportMemosRequest_ConflictPolicy) Number() protoreflect.EnumNumber {
// Deprecated: Use ImportMemosRequest_ConflictPolicy.Descriptor instead.
func (ImportMemosRequest_ConflictPolicy) EnumDescriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{51, 0}
+ return file_api_user_service_proto_rawDescGZIP(), []int{53, 0}
}
// User is an account on the instance.
@@ -1603,6 +1603,148 @@ func (x *GetUserStatsRequest) GetFilter() string {
return ""
}
+// UserUsage is a user's usage and the usage limits in effect for the user.
+type UserUsage struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Identifier. The resource name of the user usage singleton.
+ // Format: users/{user}/usage
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The number of memos the user created, including comments, archived
+ // memos, and memos in Spaces.
+ MemoCount int64 `protobuf:"varint,2,opt,name=memo_count,json=memoCount,proto3" json:"memo_count,omitempty"`
+ // The total size in bytes of the user's uploads, including uploads not
+ // attached to a memo. External links do not count.
+ StorageBytes int64 `protobuf:"varint,3,opt,name=storage_bytes,json=storageBytes,proto3" json:"storage_bytes,omitempty"`
+ // The limit on memo_count.
+ MemosLimit *UserUsage_EffectiveLimit `protobuf:"bytes,4,opt,name=memos_limit,json=memosLimit,proto3" json:"memos_limit,omitempty"`
+ // The limit on storage_bytes.
+ StorageBytesLimit *UserUsage_EffectiveLimit `protobuf:"bytes,5,opt,name=storage_bytes_limit,json=storageBytesLimit,proto3" json:"storage_bytes_limit,omitempty"`
+ // The limit on the size of one uploaded file. It applies only when it is
+ // lower than the instance upload limit.
+ UploadBytesLimit *UserUsage_EffectiveLimit `protobuf:"bytes,6,opt,name=upload_bytes_limit,json=uploadBytesLimit,proto3" json:"upload_bytes_limit,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserUsage) Reset() {
+ *x = UserUsage{}
+ mi := &file_api_user_service_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserUsage) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserUsage) ProtoMessage() {}
+
+func (x *UserUsage) ProtoReflect() protoreflect.Message {
+ mi := &file_api_user_service_proto_msgTypes[18]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserUsage.ProtoReflect.Descriptor instead.
+func (*UserUsage) Descriptor() ([]byte, []int) {
+ return file_api_user_service_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *UserUsage) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *UserUsage) GetMemoCount() int64 {
+ if x != nil {
+ return x.MemoCount
+ }
+ return 0
+}
+
+func (x *UserUsage) GetStorageBytes() int64 {
+ if x != nil {
+ return x.StorageBytes
+ }
+ return 0
+}
+
+func (x *UserUsage) GetMemosLimit() *UserUsage_EffectiveLimit {
+ if x != nil {
+ return x.MemosLimit
+ }
+ return nil
+}
+
+func (x *UserUsage) GetStorageBytesLimit() *UserUsage_EffectiveLimit {
+ if x != nil {
+ return x.StorageBytesLimit
+ }
+ return nil
+}
+
+func (x *UserUsage) GetUploadBytesLimit() *UserUsage_EffectiveLimit {
+ if x != nil {
+ return x.UploadBytesLimit
+ }
+ return nil
+}
+
+// Request message for UserService.GetUserUsage.
+type GetUserUsageRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Required. The resource name of the user usage.
+ // Format: users/{user}/usage
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GetUserUsageRequest) Reset() {
+ *x = GetUserUsageRequest{}
+ mi := &file_api_user_service_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GetUserUsageRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetUserUsageRequest) ProtoMessage() {}
+
+func (x *GetUserUsageRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_user_service_proto_msgTypes[19]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetUserUsageRequest.ProtoReflect.Descriptor instead.
+func (*GetUserUsageRequest) Descriptor() ([]byte, []int) {
+ return file_api_user_service_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *GetUserUsageRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
// MemoView is a user's saved memo filter.
type MemoView struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -1624,7 +1766,7 @@ type MemoView struct {
func (x *MemoView) Reset() {
*x = MemoView{}
- mi := &file_api_user_service_proto_msgTypes[18]
+ mi := &file_api_user_service_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1636,7 +1778,7 @@ func (x *MemoView) String() string {
func (*MemoView) ProtoMessage() {}
func (x *MemoView) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[18]
+ mi := &file_api_user_service_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1649,7 +1791,7 @@ func (x *MemoView) ProtoReflect() protoreflect.Message {
// Deprecated: Use MemoView.ProtoReflect.Descriptor instead.
func (*MemoView) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{18}
+ return file_api_user_service_proto_rawDescGZIP(), []int{20}
}
func (x *MemoView) GetName() string {
@@ -1692,7 +1834,7 @@ type ListMemoViewsRequest struct {
func (x *ListMemoViewsRequest) Reset() {
*x = ListMemoViewsRequest{}
- mi := &file_api_user_service_proto_msgTypes[19]
+ mi := &file_api_user_service_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1704,7 +1846,7 @@ func (x *ListMemoViewsRequest) String() string {
func (*ListMemoViewsRequest) ProtoMessage() {}
func (x *ListMemoViewsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[19]
+ mi := &file_api_user_service_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1717,7 +1859,7 @@ func (x *ListMemoViewsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListMemoViewsRequest.ProtoReflect.Descriptor instead.
func (*ListMemoViewsRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{19}
+ return file_api_user_service_proto_rawDescGZIP(), []int{21}
}
func (x *ListMemoViewsRequest) GetParent() string {
@@ -1738,7 +1880,7 @@ type ListMemoViewsResponse struct {
func (x *ListMemoViewsResponse) Reset() {
*x = ListMemoViewsResponse{}
- mi := &file_api_user_service_proto_msgTypes[20]
+ mi := &file_api_user_service_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1750,7 +1892,7 @@ func (x *ListMemoViewsResponse) String() string {
func (*ListMemoViewsResponse) ProtoMessage() {}
func (x *ListMemoViewsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[20]
+ mi := &file_api_user_service_proto_msgTypes[22]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1763,7 +1905,7 @@ func (x *ListMemoViewsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListMemoViewsResponse.ProtoReflect.Descriptor instead.
func (*ListMemoViewsResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{20}
+ return file_api_user_service_proto_rawDescGZIP(), []int{22}
}
func (x *ListMemoViewsResponse) GetMemoViews() []*MemoView {
@@ -1785,7 +1927,7 @@ type GetMemoViewRequest struct {
func (x *GetMemoViewRequest) Reset() {
*x = GetMemoViewRequest{}
- mi := &file_api_user_service_proto_msgTypes[21]
+ mi := &file_api_user_service_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1797,7 +1939,7 @@ func (x *GetMemoViewRequest) String() string {
func (*GetMemoViewRequest) ProtoMessage() {}
func (x *GetMemoViewRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[21]
+ mi := &file_api_user_service_proto_msgTypes[23]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1810,7 +1952,7 @@ func (x *GetMemoViewRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetMemoViewRequest.ProtoReflect.Descriptor instead.
func (*GetMemoViewRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{21}
+ return file_api_user_service_proto_rawDescGZIP(), []int{23}
}
func (x *GetMemoViewRequest) GetName() string {
@@ -1836,7 +1978,7 @@ type CreateMemoViewRequest struct {
func (x *CreateMemoViewRequest) Reset() {
*x = CreateMemoViewRequest{}
- mi := &file_api_user_service_proto_msgTypes[22]
+ mi := &file_api_user_service_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1848,7 +1990,7 @@ func (x *CreateMemoViewRequest) String() string {
func (*CreateMemoViewRequest) ProtoMessage() {}
func (x *CreateMemoViewRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[22]
+ mi := &file_api_user_service_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1861,7 +2003,7 @@ func (x *CreateMemoViewRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateMemoViewRequest.ProtoReflect.Descriptor instead.
func (*CreateMemoViewRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{22}
+ return file_api_user_service_proto_rawDescGZIP(), []int{24}
}
func (x *CreateMemoViewRequest) GetParent() string {
@@ -1899,7 +2041,7 @@ type UpdateMemoViewRequest struct {
func (x *UpdateMemoViewRequest) Reset() {
*x = UpdateMemoViewRequest{}
- mi := &file_api_user_service_proto_msgTypes[23]
+ mi := &file_api_user_service_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1911,7 +2053,7 @@ func (x *UpdateMemoViewRequest) String() string {
func (*UpdateMemoViewRequest) ProtoMessage() {}
func (x *UpdateMemoViewRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[23]
+ mi := &file_api_user_service_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1924,7 +2066,7 @@ func (x *UpdateMemoViewRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateMemoViewRequest.ProtoReflect.Descriptor instead.
func (*UpdateMemoViewRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{23}
+ return file_api_user_service_proto_rawDescGZIP(), []int{25}
}
func (x *UpdateMemoViewRequest) GetMemoView() *MemoView {
@@ -1953,7 +2095,7 @@ type DeleteMemoViewRequest struct {
func (x *DeleteMemoViewRequest) Reset() {
*x = DeleteMemoViewRequest{}
- mi := &file_api_user_service_proto_msgTypes[24]
+ mi := &file_api_user_service_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1965,7 +2107,7 @@ func (x *DeleteMemoViewRequest) String() string {
func (*DeleteMemoViewRequest) ProtoMessage() {}
func (x *DeleteMemoViewRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[24]
+ mi := &file_api_user_service_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1978,7 +2120,7 @@ func (x *DeleteMemoViewRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteMemoViewRequest.ProtoReflect.Descriptor instead.
func (*DeleteMemoViewRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{24}
+ return file_api_user_service_proto_rawDescGZIP(), []int{26}
}
func (x *DeleteMemoViewRequest) GetName() string {
@@ -2019,7 +2161,7 @@ type UserNotification struct {
func (x *UserNotification) Reset() {
*x = UserNotification{}
- mi := &file_api_user_service_proto_msgTypes[25]
+ mi := &file_api_user_service_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2031,7 +2173,7 @@ func (x *UserNotification) String() string {
func (*UserNotification) ProtoMessage() {}
func (x *UserNotification) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[25]
+ mi := &file_api_user_service_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2044,7 +2186,7 @@ func (x *UserNotification) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserNotification.ProtoReflect.Descriptor instead.
func (*UserNotification) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27}
}
func (x *UserNotification) GetName() string {
@@ -2169,7 +2311,7 @@ type ListUserNotificationsRequest struct {
func (x *ListUserNotificationsRequest) Reset() {
*x = ListUserNotificationsRequest{}
- mi := &file_api_user_service_proto_msgTypes[26]
+ mi := &file_api_user_service_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2181,7 +2323,7 @@ func (x *ListUserNotificationsRequest) String() string {
func (*ListUserNotificationsRequest) ProtoMessage() {}
func (x *ListUserNotificationsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[26]
+ mi := &file_api_user_service_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2194,7 +2336,7 @@ func (x *ListUserNotificationsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUserNotificationsRequest.ProtoReflect.Descriptor instead.
func (*ListUserNotificationsRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{26}
+ return file_api_user_service_proto_rawDescGZIP(), []int{28}
}
func (x *ListUserNotificationsRequest) GetParent() string {
@@ -2238,7 +2380,7 @@ type ListUserNotificationsResponse struct {
func (x *ListUserNotificationsResponse) Reset() {
*x = ListUserNotificationsResponse{}
- mi := &file_api_user_service_proto_msgTypes[27]
+ mi := &file_api_user_service_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2250,7 +2392,7 @@ func (x *ListUserNotificationsResponse) String() string {
func (*ListUserNotificationsResponse) ProtoMessage() {}
func (x *ListUserNotificationsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[27]
+ mi := &file_api_user_service_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2263,7 +2405,7 @@ func (x *ListUserNotificationsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUserNotificationsResponse.ProtoReflect.Descriptor instead.
func (*ListUserNotificationsResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{27}
+ return file_api_user_service_proto_rawDescGZIP(), []int{29}
}
func (x *ListUserNotificationsResponse) GetNotifications() []*UserNotification {
@@ -2294,7 +2436,7 @@ type UpdateUserNotificationRequest struct {
func (x *UpdateUserNotificationRequest) Reset() {
*x = UpdateUserNotificationRequest{}
- mi := &file_api_user_service_proto_msgTypes[28]
+ mi := &file_api_user_service_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2306,7 +2448,7 @@ func (x *UpdateUserNotificationRequest) String() string {
func (*UpdateUserNotificationRequest) ProtoMessage() {}
func (x *UpdateUserNotificationRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[28]
+ mi := &file_api_user_service_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2319,7 +2461,7 @@ func (x *UpdateUserNotificationRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserNotificationRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserNotificationRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{28}
+ return file_api_user_service_proto_rawDescGZIP(), []int{30}
}
func (x *UpdateUserNotificationRequest) GetNotification() *UserNotification {
@@ -2348,7 +2490,7 @@ type DeleteUserNotificationRequest struct {
func (x *DeleteUserNotificationRequest) Reset() {
*x = DeleteUserNotificationRequest{}
- mi := &file_api_user_service_proto_msgTypes[29]
+ mi := &file_api_user_service_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2360,7 +2502,7 @@ func (x *DeleteUserNotificationRequest) String() string {
func (*DeleteUserNotificationRequest) ProtoMessage() {}
func (x *DeleteUserNotificationRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[29]
+ mi := &file_api_user_service_proto_msgTypes[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2373,7 +2515,7 @@ func (x *DeleteUserNotificationRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserNotificationRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserNotificationRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{29}
+ return file_api_user_service_proto_rawDescGZIP(), []int{31}
}
func (x *DeleteUserNotificationRequest) GetName() string {
@@ -2408,7 +2550,7 @@ type UserWebhook struct {
func (x *UserWebhook) Reset() {
*x = UserWebhook{}
- mi := &file_api_user_service_proto_msgTypes[30]
+ mi := &file_api_user_service_proto_msgTypes[32]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2420,7 +2562,7 @@ func (x *UserWebhook) String() string {
func (*UserWebhook) ProtoMessage() {}
func (x *UserWebhook) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[30]
+ mi := &file_api_user_service_proto_msgTypes[32]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2433,7 +2575,7 @@ func (x *UserWebhook) ProtoReflect() protoreflect.Message {
// Deprecated: Use UserWebhook.ProtoReflect.Descriptor instead.
func (*UserWebhook) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{30}
+ return file_api_user_service_proto_rawDescGZIP(), []int{32}
}
func (x *UserWebhook) GetName() string {
@@ -2497,7 +2639,7 @@ type ListUserWebhooksRequest struct {
func (x *ListUserWebhooksRequest) Reset() {
*x = ListUserWebhooksRequest{}
- mi := &file_api_user_service_proto_msgTypes[31]
+ mi := &file_api_user_service_proto_msgTypes[33]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2509,7 +2651,7 @@ func (x *ListUserWebhooksRequest) String() string {
func (*ListUserWebhooksRequest) ProtoMessage() {}
func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[31]
+ mi := &file_api_user_service_proto_msgTypes[33]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2522,7 +2664,7 @@ func (x *ListUserWebhooksRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUserWebhooksRequest.ProtoReflect.Descriptor instead.
func (*ListUserWebhooksRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{31}
+ return file_api_user_service_proto_rawDescGZIP(), []int{33}
}
func (x *ListUserWebhooksRequest) GetParent() string {
@@ -2543,7 +2685,7 @@ type ListUserWebhooksResponse struct {
func (x *ListUserWebhooksResponse) Reset() {
*x = ListUserWebhooksResponse{}
- mi := &file_api_user_service_proto_msgTypes[32]
+ mi := &file_api_user_service_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2555,7 +2697,7 @@ func (x *ListUserWebhooksResponse) String() string {
func (*ListUserWebhooksResponse) ProtoMessage() {}
func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[32]
+ mi := &file_api_user_service_proto_msgTypes[34]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2568,7 +2710,7 @@ func (x *ListUserWebhooksResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListUserWebhooksResponse.ProtoReflect.Descriptor instead.
func (*ListUserWebhooksResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{32}
+ return file_api_user_service_proto_rawDescGZIP(), []int{34}
}
func (x *ListUserWebhooksResponse) GetWebhooks() []*UserWebhook {
@@ -2592,7 +2734,7 @@ type CreateUserWebhookRequest struct {
func (x *CreateUserWebhookRequest) Reset() {
*x = CreateUserWebhookRequest{}
- mi := &file_api_user_service_proto_msgTypes[33]
+ mi := &file_api_user_service_proto_msgTypes[35]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2604,7 +2746,7 @@ func (x *CreateUserWebhookRequest) String() string {
func (*CreateUserWebhookRequest) ProtoMessage() {}
func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[33]
+ mi := &file_api_user_service_proto_msgTypes[35]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2617,7 +2759,7 @@ func (x *CreateUserWebhookRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateUserWebhookRequest.ProtoReflect.Descriptor instead.
func (*CreateUserWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{33}
+ return file_api_user_service_proto_rawDescGZIP(), []int{35}
}
func (x *CreateUserWebhookRequest) GetParent() string {
@@ -2649,7 +2791,7 @@ type UpdateUserWebhookRequest struct {
func (x *UpdateUserWebhookRequest) Reset() {
*x = UpdateUserWebhookRequest{}
- mi := &file_api_user_service_proto_msgTypes[34]
+ mi := &file_api_user_service_proto_msgTypes[36]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2661,7 +2803,7 @@ func (x *UpdateUserWebhookRequest) String() string {
func (*UpdateUserWebhookRequest) ProtoMessage() {}
func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[34]
+ mi := &file_api_user_service_proto_msgTypes[36]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2674,7 +2816,7 @@ func (x *UpdateUserWebhookRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateUserWebhookRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{34}
+ return file_api_user_service_proto_rawDescGZIP(), []int{36}
}
func (x *UpdateUserWebhookRequest) GetWebhook() *UserWebhook {
@@ -2703,7 +2845,7 @@ type DeleteUserWebhookRequest struct {
func (x *DeleteUserWebhookRequest) Reset() {
*x = DeleteUserWebhookRequest{}
- mi := &file_api_user_service_proto_msgTypes[35]
+ mi := &file_api_user_service_proto_msgTypes[37]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2715,7 +2857,7 @@ func (x *DeleteUserWebhookRequest) String() string {
func (*DeleteUserWebhookRequest) ProtoMessage() {}
func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[35]
+ mi := &file_api_user_service_proto_msgTypes[37]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2728,7 +2870,7 @@ func (x *DeleteUserWebhookRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteUserWebhookRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserWebhookRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{35}
+ return file_api_user_service_proto_rawDescGZIP(), []int{37}
}
func (x *DeleteUserWebhookRequest) GetName() string {
@@ -2750,7 +2892,7 @@ type GetUserWebhookSigningSecretRequest struct {
func (x *GetUserWebhookSigningSecretRequest) Reset() {
*x = GetUserWebhookSigningSecretRequest{}
- mi := &file_api_user_service_proto_msgTypes[36]
+ mi := &file_api_user_service_proto_msgTypes[38]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2762,7 +2904,7 @@ func (x *GetUserWebhookSigningSecretRequest) String() string {
func (*GetUserWebhookSigningSecretRequest) ProtoMessage() {}
func (x *GetUserWebhookSigningSecretRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[36]
+ mi := &file_api_user_service_proto_msgTypes[38]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2775,7 +2917,7 @@ func (x *GetUserWebhookSigningSecretRequest) ProtoReflect() protoreflect.Message
// Deprecated: Use GetUserWebhookSigningSecretRequest.ProtoReflect.Descriptor instead.
func (*GetUserWebhookSigningSecretRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{36}
+ return file_api_user_service_proto_rawDescGZIP(), []int{38}
}
func (x *GetUserWebhookSigningSecretRequest) GetName() string {
@@ -2796,7 +2938,7 @@ type GetUserWebhookSigningSecretResponse struct {
func (x *GetUserWebhookSigningSecretResponse) Reset() {
*x = GetUserWebhookSigningSecretResponse{}
- mi := &file_api_user_service_proto_msgTypes[37]
+ mi := &file_api_user_service_proto_msgTypes[39]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2808,7 +2950,7 @@ func (x *GetUserWebhookSigningSecretResponse) String() string {
func (*GetUserWebhookSigningSecretResponse) ProtoMessage() {}
func (x *GetUserWebhookSigningSecretResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[37]
+ mi := &file_api_user_service_proto_msgTypes[39]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2821,7 +2963,7 @@ func (x *GetUserWebhookSigningSecretResponse) ProtoReflect() protoreflect.Messag
// Deprecated: Use GetUserWebhookSigningSecretResponse.ProtoReflect.Descriptor instead.
func (*GetUserWebhookSigningSecretResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{37}
+ return file_api_user_service_proto_rawDescGZIP(), []int{39}
}
func (x *GetUserWebhookSigningSecretResponse) GetSigningSecret() string {
@@ -2849,7 +2991,7 @@ type LinkedIdentity struct {
func (x *LinkedIdentity) Reset() {
*x = LinkedIdentity{}
- mi := &file_api_user_service_proto_msgTypes[38]
+ mi := &file_api_user_service_proto_msgTypes[40]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2861,7 +3003,7 @@ func (x *LinkedIdentity) String() string {
func (*LinkedIdentity) ProtoMessage() {}
func (x *LinkedIdentity) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[38]
+ mi := &file_api_user_service_proto_msgTypes[40]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2874,7 +3016,7 @@ func (x *LinkedIdentity) ProtoReflect() protoreflect.Message {
// Deprecated: Use LinkedIdentity.ProtoReflect.Descriptor instead.
func (*LinkedIdentity) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{38}
+ return file_api_user_service_proto_rawDescGZIP(), []int{40}
}
func (x *LinkedIdentity) GetName() string {
@@ -2910,7 +3052,7 @@ type ListLinkedIdentitiesRequest struct {
func (x *ListLinkedIdentitiesRequest) Reset() {
*x = ListLinkedIdentitiesRequest{}
- mi := &file_api_user_service_proto_msgTypes[39]
+ mi := &file_api_user_service_proto_msgTypes[41]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2922,7 +3064,7 @@ func (x *ListLinkedIdentitiesRequest) String() string {
func (*ListLinkedIdentitiesRequest) ProtoMessage() {}
func (x *ListLinkedIdentitiesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[39]
+ mi := &file_api_user_service_proto_msgTypes[41]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2935,7 +3077,7 @@ func (x *ListLinkedIdentitiesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListLinkedIdentitiesRequest.ProtoReflect.Descriptor instead.
func (*ListLinkedIdentitiesRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{39}
+ return file_api_user_service_proto_rawDescGZIP(), []int{41}
}
func (x *ListLinkedIdentitiesRequest) GetParent() string {
@@ -2956,7 +3098,7 @@ type ListLinkedIdentitiesResponse struct {
func (x *ListLinkedIdentitiesResponse) Reset() {
*x = ListLinkedIdentitiesResponse{}
- mi := &file_api_user_service_proto_msgTypes[40]
+ mi := &file_api_user_service_proto_msgTypes[42]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2968,7 +3110,7 @@ func (x *ListLinkedIdentitiesResponse) String() string {
func (*ListLinkedIdentitiesResponse) ProtoMessage() {}
func (x *ListLinkedIdentitiesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[40]
+ mi := &file_api_user_service_proto_msgTypes[42]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2981,7 +3123,7 @@ func (x *ListLinkedIdentitiesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListLinkedIdentitiesResponse.ProtoReflect.Descriptor instead.
func (*ListLinkedIdentitiesResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{40}
+ return file_api_user_service_proto_rawDescGZIP(), []int{42}
}
func (x *ListLinkedIdentitiesResponse) GetLinkedIdentities() []*LinkedIdentity {
@@ -3003,7 +3145,7 @@ type GetLinkedIdentityRequest struct {
func (x *GetLinkedIdentityRequest) Reset() {
*x = GetLinkedIdentityRequest{}
- mi := &file_api_user_service_proto_msgTypes[41]
+ mi := &file_api_user_service_proto_msgTypes[43]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3015,7 +3157,7 @@ func (x *GetLinkedIdentityRequest) String() string {
func (*GetLinkedIdentityRequest) ProtoMessage() {}
func (x *GetLinkedIdentityRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[41]
+ mi := &file_api_user_service_proto_msgTypes[43]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3028,7 +3170,7 @@ func (x *GetLinkedIdentityRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetLinkedIdentityRequest.ProtoReflect.Descriptor instead.
func (*GetLinkedIdentityRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{41}
+ return file_api_user_service_proto_rawDescGZIP(), []int{43}
}
func (x *GetLinkedIdentityRequest) GetName() string {
@@ -3059,7 +3201,7 @@ type CreateLinkedIdentityRequest struct {
func (x *CreateLinkedIdentityRequest) Reset() {
*x = CreateLinkedIdentityRequest{}
- mi := &file_api_user_service_proto_msgTypes[42]
+ mi := &file_api_user_service_proto_msgTypes[44]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3071,7 +3213,7 @@ func (x *CreateLinkedIdentityRequest) String() string {
func (*CreateLinkedIdentityRequest) ProtoMessage() {}
func (x *CreateLinkedIdentityRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[42]
+ mi := &file_api_user_service_proto_msgTypes[44]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3084,7 +3226,7 @@ func (x *CreateLinkedIdentityRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreateLinkedIdentityRequest.ProtoReflect.Descriptor instead.
func (*CreateLinkedIdentityRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{42}
+ return file_api_user_service_proto_rawDescGZIP(), []int{44}
}
func (x *CreateLinkedIdentityRequest) GetParent() string {
@@ -3134,7 +3276,7 @@ type DeleteLinkedIdentityRequest struct {
func (x *DeleteLinkedIdentityRequest) Reset() {
*x = DeleteLinkedIdentityRequest{}
- mi := &file_api_user_service_proto_msgTypes[43]
+ mi := &file_api_user_service_proto_msgTypes[45]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3146,7 +3288,7 @@ func (x *DeleteLinkedIdentityRequest) String() string {
func (*DeleteLinkedIdentityRequest) ProtoMessage() {}
func (x *DeleteLinkedIdentityRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[43]
+ mi := &file_api_user_service_proto_msgTypes[45]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3159,7 +3301,7 @@ func (x *DeleteLinkedIdentityRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteLinkedIdentityRequest.ProtoReflect.Descriptor instead.
func (*DeleteLinkedIdentityRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{43}
+ return file_api_user_service_proto_rawDescGZIP(), []int{45}
}
func (x *DeleteLinkedIdentityRequest) GetName() string {
@@ -3191,7 +3333,7 @@ type PersonalAccessToken struct {
func (x *PersonalAccessToken) Reset() {
*x = PersonalAccessToken{}
- mi := &file_api_user_service_proto_msgTypes[44]
+ mi := &file_api_user_service_proto_msgTypes[46]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3203,7 +3345,7 @@ func (x *PersonalAccessToken) String() string {
func (*PersonalAccessToken) ProtoMessage() {}
func (x *PersonalAccessToken) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[44]
+ mi := &file_api_user_service_proto_msgTypes[46]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3216,7 +3358,7 @@ func (x *PersonalAccessToken) ProtoReflect() protoreflect.Message {
// Deprecated: Use PersonalAccessToken.ProtoReflect.Descriptor instead.
func (*PersonalAccessToken) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{44}
+ return file_api_user_service_proto_rawDescGZIP(), []int{46}
}
func (x *PersonalAccessToken) GetName() string {
@@ -3272,7 +3414,7 @@ type ListPersonalAccessTokensRequest struct {
func (x *ListPersonalAccessTokensRequest) Reset() {
*x = ListPersonalAccessTokensRequest{}
- mi := &file_api_user_service_proto_msgTypes[45]
+ mi := &file_api_user_service_proto_msgTypes[47]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3284,7 +3426,7 @@ func (x *ListPersonalAccessTokensRequest) String() string {
func (*ListPersonalAccessTokensRequest) ProtoMessage() {}
func (x *ListPersonalAccessTokensRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[45]
+ mi := &file_api_user_service_proto_msgTypes[47]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3297,7 +3439,7 @@ func (x *ListPersonalAccessTokensRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListPersonalAccessTokensRequest.ProtoReflect.Descriptor instead.
func (*ListPersonalAccessTokensRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{45}
+ return file_api_user_service_proto_rawDescGZIP(), []int{47}
}
func (x *ListPersonalAccessTokensRequest) GetParent() string {
@@ -3334,7 +3476,7 @@ type ListPersonalAccessTokensResponse struct {
func (x *ListPersonalAccessTokensResponse) Reset() {
*x = ListPersonalAccessTokensResponse{}
- mi := &file_api_user_service_proto_msgTypes[46]
+ mi := &file_api_user_service_proto_msgTypes[48]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3346,7 +3488,7 @@ func (x *ListPersonalAccessTokensResponse) String() string {
func (*ListPersonalAccessTokensResponse) ProtoMessage() {}
func (x *ListPersonalAccessTokensResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[46]
+ mi := &file_api_user_service_proto_msgTypes[48]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3359,7 +3501,7 @@ func (x *ListPersonalAccessTokensResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListPersonalAccessTokensResponse.ProtoReflect.Descriptor instead.
func (*ListPersonalAccessTokensResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{46}
+ return file_api_user_service_proto_rawDescGZIP(), []int{48}
}
func (x *ListPersonalAccessTokensResponse) GetPersonalAccessTokens() []*PersonalAccessToken {
@@ -3393,7 +3535,7 @@ type CreatePersonalAccessTokenRequest struct {
func (x *CreatePersonalAccessTokenRequest) Reset() {
*x = CreatePersonalAccessTokenRequest{}
- mi := &file_api_user_service_proto_msgTypes[47]
+ mi := &file_api_user_service_proto_msgTypes[49]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3405,7 +3547,7 @@ func (x *CreatePersonalAccessTokenRequest) String() string {
func (*CreatePersonalAccessTokenRequest) ProtoMessage() {}
func (x *CreatePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[47]
+ mi := &file_api_user_service_proto_msgTypes[49]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3418,7 +3560,7 @@ func (x *CreatePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CreatePersonalAccessTokenRequest.ProtoReflect.Descriptor instead.
func (*CreatePersonalAccessTokenRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{47}
+ return file_api_user_service_proto_rawDescGZIP(), []int{49}
}
func (x *CreatePersonalAccessTokenRequest) GetParent() string {
@@ -3455,7 +3597,7 @@ type CreatePersonalAccessTokenResponse struct {
func (x *CreatePersonalAccessTokenResponse) Reset() {
*x = CreatePersonalAccessTokenResponse{}
- mi := &file_api_user_service_proto_msgTypes[48]
+ mi := &file_api_user_service_proto_msgTypes[50]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3467,7 +3609,7 @@ func (x *CreatePersonalAccessTokenResponse) String() string {
func (*CreatePersonalAccessTokenResponse) ProtoMessage() {}
func (x *CreatePersonalAccessTokenResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[48]
+ mi := &file_api_user_service_proto_msgTypes[50]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3480,7 +3622,7 @@ func (x *CreatePersonalAccessTokenResponse) ProtoReflect() protoreflect.Message
// Deprecated: Use CreatePersonalAccessTokenResponse.ProtoReflect.Descriptor instead.
func (*CreatePersonalAccessTokenResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{48}
+ return file_api_user_service_proto_rawDescGZIP(), []int{50}
}
func (x *CreatePersonalAccessTokenResponse) GetPersonalAccessToken() *PersonalAccessToken {
@@ -3509,7 +3651,7 @@ type DeletePersonalAccessTokenRequest struct {
func (x *DeletePersonalAccessTokenRequest) Reset() {
*x = DeletePersonalAccessTokenRequest{}
- mi := &file_api_user_service_proto_msgTypes[49]
+ mi := &file_api_user_service_proto_msgTypes[51]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3521,7 +3663,7 @@ func (x *DeletePersonalAccessTokenRequest) String() string {
func (*DeletePersonalAccessTokenRequest) ProtoMessage() {}
func (x *DeletePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[49]
+ mi := &file_api_user_service_proto_msgTypes[51]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3534,7 +3676,7 @@ func (x *DeletePersonalAccessTokenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeletePersonalAccessTokenRequest.ProtoReflect.Descriptor instead.
func (*DeletePersonalAccessTokenRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{49}
+ return file_api_user_service_proto_rawDescGZIP(), []int{51}
}
func (x *DeletePersonalAccessTokenRequest) GetName() string {
@@ -3556,7 +3698,7 @@ type ExportMemosRequest struct {
func (x *ExportMemosRequest) Reset() {
*x = ExportMemosRequest{}
- mi := &file_api_user_service_proto_msgTypes[50]
+ mi := &file_api_user_service_proto_msgTypes[52]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3568,7 +3710,7 @@ func (x *ExportMemosRequest) String() string {
func (*ExportMemosRequest) ProtoMessage() {}
func (x *ExportMemosRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[50]
+ mi := &file_api_user_service_proto_msgTypes[52]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3581,7 +3723,7 @@ func (x *ExportMemosRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ExportMemosRequest.ProtoReflect.Descriptor instead.
func (*ExportMemosRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{50}
+ return file_api_user_service_proto_rawDescGZIP(), []int{52}
}
func (x *ExportMemosRequest) GetName() string {
@@ -3629,7 +3771,7 @@ type ImportMemosRequest struct {
func (x *ImportMemosRequest) Reset() {
*x = ImportMemosRequest{}
- mi := &file_api_user_service_proto_msgTypes[51]
+ mi := &file_api_user_service_proto_msgTypes[53]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3641,7 +3783,7 @@ func (x *ImportMemosRequest) String() string {
func (*ImportMemosRequest) ProtoMessage() {}
func (x *ImportMemosRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[51]
+ mi := &file_api_user_service_proto_msgTypes[53]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3654,7 +3796,7 @@ func (x *ImportMemosRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImportMemosRequest.ProtoReflect.Descriptor instead.
func (*ImportMemosRequest) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{51}
+ return file_api_user_service_proto_rawDescGZIP(), []int{53}
}
func (x *ImportMemosRequest) GetName() string {
@@ -3764,7 +3906,7 @@ type ImportMemosResponse struct {
func (x *ImportMemosResponse) Reset() {
*x = ImportMemosResponse{}
- mi := &file_api_user_service_proto_msgTypes[52]
+ mi := &file_api_user_service_proto_msgTypes[54]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3776,7 +3918,7 @@ func (x *ImportMemosResponse) String() string {
func (*ImportMemosResponse) ProtoMessage() {}
func (x *ImportMemosResponse) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[52]
+ mi := &file_api_user_service_proto_msgTypes[54]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3789,7 +3931,7 @@ func (x *ImportMemosResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImportMemosResponse.ProtoReflect.Descriptor instead.
func (*ImportMemosResponse) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{52}
+ return file_api_user_service_proto_rawDescGZIP(), []int{54}
}
func (x *ImportMemosResponse) GetUploadId() string {
@@ -3867,7 +4009,7 @@ type ImportMemosSpec struct {
func (x *ImportMemosSpec) Reset() {
*x = ImportMemosSpec{}
- mi := &file_api_user_service_proto_msgTypes[53]
+ mi := &file_api_user_service_proto_msgTypes[55]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3879,7 +4021,7 @@ func (x *ImportMemosSpec) String() string {
func (*ImportMemosSpec) ProtoMessage() {}
func (x *ImportMemosSpec) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[53]
+ mi := &file_api_user_service_proto_msgTypes[55]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3892,7 +4034,7 @@ func (x *ImportMemosSpec) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImportMemosSpec.ProtoReflect.Descriptor instead.
func (*ImportMemosSpec) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{53}
+ return file_api_user_service_proto_rawDescGZIP(), []int{55}
}
func (x *ImportMemosSpec) GetTotalSize() int64 {
@@ -3929,7 +4071,7 @@ type ImportMemosPlan struct {
func (x *ImportMemosPlan) Reset() {
*x = ImportMemosPlan{}
- mi := &file_api_user_service_proto_msgTypes[54]
+ mi := &file_api_user_service_proto_msgTypes[56]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -3941,7 +4083,7 @@ func (x *ImportMemosPlan) String() string {
func (*ImportMemosPlan) ProtoMessage() {}
func (x *ImportMemosPlan) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[54]
+ mi := &file_api_user_service_proto_msgTypes[56]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -3954,7 +4096,7 @@ func (x *ImportMemosPlan) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImportMemosPlan.ProtoReflect.Descriptor instead.
func (*ImportMemosPlan) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{54}
+ return file_api_user_service_proto_rawDescGZIP(), []int{56}
}
func (x *ImportMemosPlan) GetExportTime() *timestamppb.Timestamp {
@@ -4041,7 +4183,7 @@ type ImportMemosReport struct {
func (x *ImportMemosReport) Reset() {
*x = ImportMemosReport{}
- mi := &file_api_user_service_proto_msgTypes[55]
+ mi := &file_api_user_service_proto_msgTypes[57]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4053,7 +4195,7 @@ func (x *ImportMemosReport) String() string {
func (*ImportMemosReport) ProtoMessage() {}
func (x *ImportMemosReport) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[55]
+ mi := &file_api_user_service_proto_msgTypes[57]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4066,7 +4208,7 @@ func (x *ImportMemosReport) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImportMemosReport.ProtoReflect.Descriptor instead.
func (*ImportMemosReport) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{55}
+ return file_api_user_service_proto_rawDescGZIP(), []int{57}
}
func (x *ImportMemosReport) GetCreated() int32 {
@@ -4125,7 +4267,7 @@ type ImportMemosIssue struct {
func (x *ImportMemosIssue) Reset() {
*x = ImportMemosIssue{}
- mi := &file_api_user_service_proto_msgTypes[56]
+ mi := &file_api_user_service_proto_msgTypes[58]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4137,7 +4279,7 @@ func (x *ImportMemosIssue) String() string {
func (*ImportMemosIssue) ProtoMessage() {}
func (x *ImportMemosIssue) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[56]
+ mi := &file_api_user_service_proto_msgTypes[58]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4150,7 +4292,7 @@ func (x *ImportMemosIssue) ProtoReflect() protoreflect.Message {
// Deprecated: Use ImportMemosIssue.ProtoReflect.Descriptor instead.
func (*ImportMemosIssue) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{56}
+ return file_api_user_service_proto_rawDescGZIP(), []int{58}
}
func (x *ImportMemosIssue) GetMemoUid() string {
@@ -4187,7 +4329,7 @@ type UserSetting_GeneralSetting struct {
func (x *UserSetting_GeneralSetting) Reset() {
*x = UserSetting_GeneralSetting{}
- mi := &file_api_user_service_proto_msgTypes[57]
+ mi := &file_api_user_service_proto_msgTypes[59]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4199,7 +4341,7 @@ func (x *UserSetting_GeneralSetting) String() string {
func (*UserSetting_GeneralSetting) ProtoMessage() {}
func (x *UserSetting_GeneralSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[57]
+ mi := &file_api_user_service_proto_msgTypes[59]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4254,7 +4396,7 @@ type UserSetting_WebhooksSetting struct {
func (x *UserSetting_WebhooksSetting) Reset() {
*x = UserSetting_WebhooksSetting{}
- mi := &file_api_user_service_proto_msgTypes[58]
+ mi := &file_api_user_service_proto_msgTypes[60]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4266,7 +4408,7 @@ func (x *UserSetting_WebhooksSetting) String() string {
func (*UserSetting_WebhooksSetting) ProtoMessage() {}
func (x *UserSetting_WebhooksSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[58]
+ mi := &file_api_user_service_proto_msgTypes[60]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4301,7 +4443,7 @@ type UserSetting_TagsSetting struct {
func (x *UserSetting_TagsSetting) Reset() {
*x = UserSetting_TagsSetting{}
- mi := &file_api_user_service_proto_msgTypes[59]
+ mi := &file_api_user_service_proto_msgTypes[61]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4313,7 +4455,7 @@ func (x *UserSetting_TagsSetting) String() string {
func (*UserSetting_TagsSetting) ProtoMessage() {}
func (x *UserSetting_TagsSetting) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[59]
+ mi := &file_api_user_service_proto_msgTypes[61]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4350,7 +4492,7 @@ type UserSetting_TagMetadata struct {
func (x *UserSetting_TagMetadata) Reset() {
*x = UserSetting_TagMetadata{}
- mi := &file_api_user_service_proto_msgTypes[60]
+ mi := &file_api_user_service_proto_msgTypes[62]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4362,7 +4504,7 @@ func (x *UserSetting_TagMetadata) String() string {
func (*UserSetting_TagMetadata) ProtoMessage() {}
func (x *UserSetting_TagMetadata) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[60]
+ mi := &file_api_user_service_proto_msgTypes[62]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4409,7 +4551,7 @@ type UserStats_MemoTypeStats struct {
func (x *UserStats_MemoTypeStats) Reset() {
*x = UserStats_MemoTypeStats{}
- mi := &file_api_user_service_proto_msgTypes[63]
+ mi := &file_api_user_service_proto_msgTypes[65]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4421,7 +4563,7 @@ func (x *UserStats_MemoTypeStats) String() string {
func (*UserStats_MemoTypeStats) ProtoMessage() {}
func (x *UserStats_MemoTypeStats) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[63]
+ mi := &file_api_user_service_proto_msgTypes[65]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4465,6 +4607,64 @@ func (x *UserStats_MemoTypeStats) GetUndoCount() int32 {
return 0
}
+// EffectiveLimit is the limit in effect for one metric, and where it comes
+// from.
+type UserUsage_EffectiveLimit struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The limit. 0 means unlimited, or no extra limit for upload_bytes_limit.
+ Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
+ // The usage limit the value comes from: the user's own limit, or else the
+ // default. Empty when no usage limit applies.
+ // Format: usageLimits/{usage_limit}
+ UsageLimit string `protobuf:"bytes,2,opt,name=usage_limit,json=usageLimit,proto3" json:"usage_limit,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *UserUsage_EffectiveLimit) Reset() {
+ *x = UserUsage_EffectiveLimit{}
+ mi := &file_api_user_service_proto_msgTypes[66]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *UserUsage_EffectiveLimit) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserUsage_EffectiveLimit) ProtoMessage() {}
+
+func (x *UserUsage_EffectiveLimit) ProtoReflect() protoreflect.Message {
+ mi := &file_api_user_service_proto_msgTypes[66]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserUsage_EffectiveLimit.ProtoReflect.Descriptor instead.
+func (*UserUsage_EffectiveLimit) Descriptor() ([]byte, []int) {
+ return file_api_user_service_proto_rawDescGZIP(), []int{18, 0}
+}
+
+func (x *UserUsage_EffectiveLimit) GetValue() int64 {
+ if x != nil {
+ return x.Value
+ }
+ return 0
+}
+
+func (x *UserUsage_EffectiveLimit) GetUsageLimit() string {
+ if x != nil {
+ return x.UsageLimit
+ }
+ return ""
+}
+
// Icon is the display icon of a memo view.
type MemoView_Icon struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -4481,7 +4681,7 @@ type MemoView_Icon struct {
func (x *MemoView_Icon) Reset() {
*x = MemoView_Icon{}
- mi := &file_api_user_service_proto_msgTypes[64]
+ mi := &file_api_user_service_proto_msgTypes[67]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4493,7 +4693,7 @@ func (x *MemoView_Icon) String() string {
func (*MemoView_Icon) ProtoMessage() {}
func (x *MemoView_Icon) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[64]
+ mi := &file_api_user_service_proto_msgTypes[67]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4506,7 +4706,7 @@ func (x *MemoView_Icon) ProtoReflect() protoreflect.Message {
// Deprecated: Use MemoView_Icon.ProtoReflect.Descriptor instead.
func (*MemoView_Icon) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{18, 0}
+ return file_api_user_service_proto_rawDescGZIP(), []int{20, 0}
}
func (x *MemoView_Icon) GetValue() isMemoView_Icon_Value {
@@ -4571,7 +4771,7 @@ type UserNotification_MemoCommentPayload struct {
func (x *UserNotification_MemoCommentPayload) Reset() {
*x = UserNotification_MemoCommentPayload{}
- mi := &file_api_user_service_proto_msgTypes[65]
+ mi := &file_api_user_service_proto_msgTypes[68]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4583,7 +4783,7 @@ func (x *UserNotification_MemoCommentPayload) String() string {
func (*UserNotification_MemoCommentPayload) ProtoMessage() {}
func (x *UserNotification_MemoCommentPayload) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[65]
+ mi := &file_api_user_service_proto_msgTypes[68]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4596,7 +4796,7 @@ func (x *UserNotification_MemoCommentPayload) ProtoReflect() protoreflect.Messag
// Deprecated: Use UserNotification_MemoCommentPayload.ProtoReflect.Descriptor instead.
func (*UserNotification_MemoCommentPayload) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25, 0}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27, 0}
}
func (x *UserNotification_MemoCommentPayload) GetMemo() string {
@@ -4646,7 +4846,7 @@ type UserNotification_MemoMentionPayload struct {
func (x *UserNotification_MemoMentionPayload) Reset() {
*x = UserNotification_MemoMentionPayload{}
- mi := &file_api_user_service_proto_msgTypes[66]
+ mi := &file_api_user_service_proto_msgTypes[69]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4658,7 +4858,7 @@ func (x *UserNotification_MemoMentionPayload) String() string {
func (*UserNotification_MemoMentionPayload) ProtoMessage() {}
func (x *UserNotification_MemoMentionPayload) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[66]
+ mi := &file_api_user_service_proto_msgTypes[69]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4671,7 +4871,7 @@ func (x *UserNotification_MemoMentionPayload) ProtoReflect() protoreflect.Messag
// Deprecated: Use UserNotification_MemoMentionPayload.ProtoReflect.Descriptor instead.
func (*UserNotification_MemoMentionPayload) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25, 1}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27, 1}
}
func (x *UserNotification_MemoMentionPayload) GetMemo() string {
@@ -4721,7 +4921,7 @@ type UserNotification_SpaceInvitationPayload struct {
func (x *UserNotification_SpaceInvitationPayload) Reset() {
*x = UserNotification_SpaceInvitationPayload{}
- mi := &file_api_user_service_proto_msgTypes[67]
+ mi := &file_api_user_service_proto_msgTypes[70]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -4733,7 +4933,7 @@ func (x *UserNotification_SpaceInvitationPayload) String() string {
func (*UserNotification_SpaceInvitationPayload) ProtoMessage() {}
func (x *UserNotification_SpaceInvitationPayload) ProtoReflect() protoreflect.Message {
- mi := &file_api_user_service_proto_msgTypes[67]
+ mi := &file_api_user_service_proto_msgTypes[70]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -4746,7 +4946,7 @@ func (x *UserNotification_SpaceInvitationPayload) ProtoReflect() protoreflect.Me
// Deprecated: Use UserNotification_SpaceInvitationPayload.ProtoReflect.Descriptor instead.
func (*UserNotification_SpaceInvitationPayload) Descriptor() ([]byte, []int) {
- return file_api_user_service_proto_rawDescGZIP(), []int{25, 2}
+ return file_api_user_service_proto_rawDescGZIP(), []int{27, 2}
}
func (x *UserNotification_SpaceInvitationPayload) GetSpaceInvitation() string {
@@ -4914,7 +5114,26 @@ const file_api_user_service_proto_rawDesc = "" +
"\x13GetUserStatsRequest\x12*\n" +
"\x04name\x18\x01 \x01(\tB\x16\xe0A\x02\xfaA\x10\n" +
"\x0ememos.api/UserR\x04name\x12\x1b\n" +
- "\x06filter\x18\x02 \x01(\tB\x03\xe0A\x01R\x06filter\"\x9a\x02\n" +
+ "\x06filter\x18\x02 \x01(\tB\x03\xe0A\x01R\x06filter\"\xff\x03\n" +
+ "\tUserUsage\x12\x17\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x1d\n" +
+ "\n" +
+ "memo_count\x18\x02 \x01(\x03R\tmemoCount\x12#\n" +
+ "\rstorage_bytes\x18\x03 \x01(\x03R\fstorageBytes\x12D\n" +
+ "\vmemos_limit\x18\x04 \x01(\v2#.memos.api.UserUsage.EffectiveLimitR\n" +
+ "memosLimit\x12S\n" +
+ "\x13storage_bytes_limit\x18\x05 \x01(\v2#.memos.api.UserUsage.EffectiveLimitR\x11storageBytesLimit\x12Q\n" +
+ "\x12upload_bytes_limit\x18\x06 \x01(\v2#.memos.api.UserUsage.EffectiveLimitR\x10uploadBytesLimit\x1ab\n" +
+ "\x0eEffectiveLimit\x12\x14\n" +
+ "\x05value\x18\x01 \x01(\x03R\x05value\x12:\n" +
+ "\vusage_limit\x18\x02 \x01(\tB\x19\xfaA\x16\n" +
+ "\x14memos.api/UsageLimitR\n" +
+ "usageLimit:C\xeaA@\n" +
+ "\x13memos.api/UserUsage\x12\x12users/{user}/usage*\n" +
+ "userUsages2\tuserUsage\"F\n" +
+ "\x13GetUserUsageRequest\x12/\n" +
+ "\x04name\x18\x01 \x01(\tB\x1b\xe0A\x02\xfaA\x15\n" +
+ "\x13memos.api/UserUsageR\x04name\"\x9a\x02\n" +
"\bMemoView\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x19\n" +
"\x05title\x18\x02 \x01(\tB\x03\xe0A\x02R\x05title\x12\x1b\n" +
@@ -5140,7 +5359,7 @@ const file_api_user_service_proto_rawDesc = "" +
"\bfailures\x18\x06 \x03(\v2\x1b.memos.api.ImportMemosIssueR\bfailures\"G\n" +
"\x10ImportMemosIssue\x12\x19\n" +
"\bmemo_uid\x18\x01 \x01(\tR\amemoUid\x12\x18\n" +
- "\amessage\x18\x02 \x01(\tR\amessage2\x9a$\n" +
+ "\amessage\x18\x02 \x01(\tR\amessage2\x8a%\n" +
"\vUserService\x12Z\n" +
"\tListUsers\x12\x1b.memos.api.ListUsersRequest\x1a\x1c.memos.api.ListUsersResponse\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" +
"/api/users\x12Y\n" +
@@ -5157,7 +5376,8 @@ const file_api_user_service_proto_rawDesc = "" +
"\x0eGetUserSetting\x12 .memos.api.GetUserSettingRequest\x1a\x16.memos.api.UserSetting\"-\xdaA\x04name\x82\xd3\xe4\x93\x02 \x12\x1e/api/{name=users/*/settings/*}\x12\xae\x01\n" +
"\x11UpdateUserSetting\x12#.memos.api.UpdateUserSettingRequest\x1a\x16.memos.api.UserSetting\"\\\xdaA\x18user_setting,update_mask\x82\xd3\xe4\x93\x02;:\fuser_setting2+/api/{user_setting.name=users/*/settings/*}\x12\x80\x01\n" +
"\rListUserStats\x12\x1f.memos.api.ListUserStatsRequest\x1a .memos.api.ListUserStatsResponse\",\xdaA\x06parent\x82\xd3\xe4\x93\x02\x1d\x12\x1b/api/{parent=users/*}/stats\x12q\n" +
- "\fGetUserStats\x12\x1e.memos.api.GetUserStatsRequest\x1a\x14.memos.api.UserStats\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/{name=users/*}:getStats\x12\x80\x01\n" +
+ "\fGetUserStats\x12\x1e.memos.api.GetUserStatsRequest\x1a\x14.memos.api.UserStats\"+\xdaA\x04name\x82\xd3\xe4\x93\x02\x1e\x12\x1c/api/{name=users/*}:getStats\x12n\n" +
+ "\fGetUserUsage\x12\x1e.memos.api.GetUserUsageRequest\x1a\x14.memos.api.UserUsage\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/{name=users/*/usage}\x12\x80\x01\n" +
"\rListMemoViews\x12\x1f.memos.api.ListMemoViewsRequest\x1a .memos.api.ListMemoViewsResponse\",\xdaA\x06parent\x82\xd3\xe4\x93\x02\x1d\x12\x1b/api/{parent=users/*}/views\x12m\n" +
"\vGetMemoView\x12\x1d.memos.api.GetMemoViewRequest\x1a\x13.memos.api.MemoView\"*\xdaA\x04name\x82\xd3\xe4\x93\x02\x1d\x12\x1b/api/{name=users/*/views/*}\x12\x8a\x01\n" +
"\x0eCreateMemoView\x12 .memos.api.CreateMemoViewRequest\x1a\x13.memos.api.MemoView\"A\xdaA\x10parent,memo_view\x82\xd3\xe4\x93\x02(:\tmemo_view\"\x1b/api/{parent=users/*}/views\x12\x99\x01\n" +
@@ -5196,7 +5416,7 @@ func file_api_user_service_proto_rawDescGZIP() []byte {
}
var file_api_user_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
-var file_api_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 68)
+var file_api_user_service_proto_msgTypes = make([]protoimpl.MessageInfo, 71)
var file_api_user_service_proto_goTypes = []any{
(User_Role)(0), // 0: memos.api.User.Role
(UserSetting_Key)(0), // 1: memos.api.UserSetting.Key
@@ -5222,201 +5442,209 @@ var file_api_user_service_proto_goTypes = []any{
(*ListUserStatsRequest)(nil), // 21: memos.api.ListUserStatsRequest
(*ListUserStatsResponse)(nil), // 22: memos.api.ListUserStatsResponse
(*GetUserStatsRequest)(nil), // 23: memos.api.GetUserStatsRequest
- (*MemoView)(nil), // 24: memos.api.MemoView
- (*ListMemoViewsRequest)(nil), // 25: memos.api.ListMemoViewsRequest
- (*ListMemoViewsResponse)(nil), // 26: memos.api.ListMemoViewsResponse
- (*GetMemoViewRequest)(nil), // 27: memos.api.GetMemoViewRequest
- (*CreateMemoViewRequest)(nil), // 28: memos.api.CreateMemoViewRequest
- (*UpdateMemoViewRequest)(nil), // 29: memos.api.UpdateMemoViewRequest
- (*DeleteMemoViewRequest)(nil), // 30: memos.api.DeleteMemoViewRequest
- (*UserNotification)(nil), // 31: memos.api.UserNotification
- (*ListUserNotificationsRequest)(nil), // 32: memos.api.ListUserNotificationsRequest
- (*ListUserNotificationsResponse)(nil), // 33: memos.api.ListUserNotificationsResponse
- (*UpdateUserNotificationRequest)(nil), // 34: memos.api.UpdateUserNotificationRequest
- (*DeleteUserNotificationRequest)(nil), // 35: memos.api.DeleteUserNotificationRequest
- (*UserWebhook)(nil), // 36: memos.api.UserWebhook
- (*ListUserWebhooksRequest)(nil), // 37: memos.api.ListUserWebhooksRequest
- (*ListUserWebhooksResponse)(nil), // 38: memos.api.ListUserWebhooksResponse
- (*CreateUserWebhookRequest)(nil), // 39: memos.api.CreateUserWebhookRequest
- (*UpdateUserWebhookRequest)(nil), // 40: memos.api.UpdateUserWebhookRequest
- (*DeleteUserWebhookRequest)(nil), // 41: memos.api.DeleteUserWebhookRequest
- (*GetUserWebhookSigningSecretRequest)(nil), // 42: memos.api.GetUserWebhookSigningSecretRequest
- (*GetUserWebhookSigningSecretResponse)(nil), // 43: memos.api.GetUserWebhookSigningSecretResponse
- (*LinkedIdentity)(nil), // 44: memos.api.LinkedIdentity
- (*ListLinkedIdentitiesRequest)(nil), // 45: memos.api.ListLinkedIdentitiesRequest
- (*ListLinkedIdentitiesResponse)(nil), // 46: memos.api.ListLinkedIdentitiesResponse
- (*GetLinkedIdentityRequest)(nil), // 47: memos.api.GetLinkedIdentityRequest
- (*CreateLinkedIdentityRequest)(nil), // 48: memos.api.CreateLinkedIdentityRequest
- (*DeleteLinkedIdentityRequest)(nil), // 49: memos.api.DeleteLinkedIdentityRequest
- (*PersonalAccessToken)(nil), // 50: memos.api.PersonalAccessToken
- (*ListPersonalAccessTokensRequest)(nil), // 51: memos.api.ListPersonalAccessTokensRequest
- (*ListPersonalAccessTokensResponse)(nil), // 52: memos.api.ListPersonalAccessTokensResponse
- (*CreatePersonalAccessTokenRequest)(nil), // 53: memos.api.CreatePersonalAccessTokenRequest
- (*CreatePersonalAccessTokenResponse)(nil), // 54: memos.api.CreatePersonalAccessTokenResponse
- (*DeletePersonalAccessTokenRequest)(nil), // 55: memos.api.DeletePersonalAccessTokenRequest
- (*ExportMemosRequest)(nil), // 56: memos.api.ExportMemosRequest
- (*ImportMemosRequest)(nil), // 57: memos.api.ImportMemosRequest
- (*ImportMemosResponse)(nil), // 58: memos.api.ImportMemosResponse
- (*ImportMemosSpec)(nil), // 59: memos.api.ImportMemosSpec
- (*ImportMemosPlan)(nil), // 60: memos.api.ImportMemosPlan
- (*ImportMemosReport)(nil), // 61: memos.api.ImportMemosReport
- (*ImportMemosIssue)(nil), // 62: memos.api.ImportMemosIssue
- (*UserSetting_GeneralSetting)(nil), // 63: memos.api.UserSetting.GeneralSetting
- (*UserSetting_WebhooksSetting)(nil), // 64: memos.api.UserSetting.WebhooksSetting
- (*UserSetting_TagsSetting)(nil), // 65: memos.api.UserSetting.TagsSetting
- (*UserSetting_TagMetadata)(nil), // 66: memos.api.UserSetting.TagMetadata
- nil, // 67: memos.api.UserSetting.TagsSetting.TagsEntry
- nil, // 68: memos.api.UserStats.TagCountsEntry
- (*UserStats_MemoTypeStats)(nil), // 69: memos.api.UserStats.MemoTypeStats
- (*MemoView_Icon)(nil), // 70: memos.api.MemoView.Icon
- (*UserNotification_MemoCommentPayload)(nil), // 71: memos.api.UserNotification.MemoCommentPayload
- (*UserNotification_MemoMentionPayload)(nil), // 72: memos.api.UserNotification.MemoMentionPayload
- (*UserNotification_SpaceInvitationPayload)(nil), // 73: memos.api.UserNotification.SpaceInvitationPayload
- (State)(0), // 74: memos.api.State
- (*timestamppb.Timestamp)(nil), // 75: google.protobuf.Timestamp
- (*fieldmaskpb.FieldMask)(nil), // 76: google.protobuf.FieldMask
- (*color.Color)(nil), // 77: google.type.Color
- (*Space)(nil), // 78: memos.api.Space
- (SpaceMember_Role)(0), // 79: memos.api.SpaceMember.Role
- (*emptypb.Empty)(nil), // 80: google.protobuf.Empty
- (*httpbody.HttpBody)(nil), // 81: google.api.HttpBody
+ (*UserUsage)(nil), // 24: memos.api.UserUsage
+ (*GetUserUsageRequest)(nil), // 25: memos.api.GetUserUsageRequest
+ (*MemoView)(nil), // 26: memos.api.MemoView
+ (*ListMemoViewsRequest)(nil), // 27: memos.api.ListMemoViewsRequest
+ (*ListMemoViewsResponse)(nil), // 28: memos.api.ListMemoViewsResponse
+ (*GetMemoViewRequest)(nil), // 29: memos.api.GetMemoViewRequest
+ (*CreateMemoViewRequest)(nil), // 30: memos.api.CreateMemoViewRequest
+ (*UpdateMemoViewRequest)(nil), // 31: memos.api.UpdateMemoViewRequest
+ (*DeleteMemoViewRequest)(nil), // 32: memos.api.DeleteMemoViewRequest
+ (*UserNotification)(nil), // 33: memos.api.UserNotification
+ (*ListUserNotificationsRequest)(nil), // 34: memos.api.ListUserNotificationsRequest
+ (*ListUserNotificationsResponse)(nil), // 35: memos.api.ListUserNotificationsResponse
+ (*UpdateUserNotificationRequest)(nil), // 36: memos.api.UpdateUserNotificationRequest
+ (*DeleteUserNotificationRequest)(nil), // 37: memos.api.DeleteUserNotificationRequest
+ (*UserWebhook)(nil), // 38: memos.api.UserWebhook
+ (*ListUserWebhooksRequest)(nil), // 39: memos.api.ListUserWebhooksRequest
+ (*ListUserWebhooksResponse)(nil), // 40: memos.api.ListUserWebhooksResponse
+ (*CreateUserWebhookRequest)(nil), // 41: memos.api.CreateUserWebhookRequest
+ (*UpdateUserWebhookRequest)(nil), // 42: memos.api.UpdateUserWebhookRequest
+ (*DeleteUserWebhookRequest)(nil), // 43: memos.api.DeleteUserWebhookRequest
+ (*GetUserWebhookSigningSecretRequest)(nil), // 44: memos.api.GetUserWebhookSigningSecretRequest
+ (*GetUserWebhookSigningSecretResponse)(nil), // 45: memos.api.GetUserWebhookSigningSecretResponse
+ (*LinkedIdentity)(nil), // 46: memos.api.LinkedIdentity
+ (*ListLinkedIdentitiesRequest)(nil), // 47: memos.api.ListLinkedIdentitiesRequest
+ (*ListLinkedIdentitiesResponse)(nil), // 48: memos.api.ListLinkedIdentitiesResponse
+ (*GetLinkedIdentityRequest)(nil), // 49: memos.api.GetLinkedIdentityRequest
+ (*CreateLinkedIdentityRequest)(nil), // 50: memos.api.CreateLinkedIdentityRequest
+ (*DeleteLinkedIdentityRequest)(nil), // 51: memos.api.DeleteLinkedIdentityRequest
+ (*PersonalAccessToken)(nil), // 52: memos.api.PersonalAccessToken
+ (*ListPersonalAccessTokensRequest)(nil), // 53: memos.api.ListPersonalAccessTokensRequest
+ (*ListPersonalAccessTokensResponse)(nil), // 54: memos.api.ListPersonalAccessTokensResponse
+ (*CreatePersonalAccessTokenRequest)(nil), // 55: memos.api.CreatePersonalAccessTokenRequest
+ (*CreatePersonalAccessTokenResponse)(nil), // 56: memos.api.CreatePersonalAccessTokenResponse
+ (*DeletePersonalAccessTokenRequest)(nil), // 57: memos.api.DeletePersonalAccessTokenRequest
+ (*ExportMemosRequest)(nil), // 58: memos.api.ExportMemosRequest
+ (*ImportMemosRequest)(nil), // 59: memos.api.ImportMemosRequest
+ (*ImportMemosResponse)(nil), // 60: memos.api.ImportMemosResponse
+ (*ImportMemosSpec)(nil), // 61: memos.api.ImportMemosSpec
+ (*ImportMemosPlan)(nil), // 62: memos.api.ImportMemosPlan
+ (*ImportMemosReport)(nil), // 63: memos.api.ImportMemosReport
+ (*ImportMemosIssue)(nil), // 64: memos.api.ImportMemosIssue
+ (*UserSetting_GeneralSetting)(nil), // 65: memos.api.UserSetting.GeneralSetting
+ (*UserSetting_WebhooksSetting)(nil), // 66: memos.api.UserSetting.WebhooksSetting
+ (*UserSetting_TagsSetting)(nil), // 67: memos.api.UserSetting.TagsSetting
+ (*UserSetting_TagMetadata)(nil), // 68: memos.api.UserSetting.TagMetadata
+ nil, // 69: memos.api.UserSetting.TagsSetting.TagsEntry
+ nil, // 70: memos.api.UserStats.TagCountsEntry
+ (*UserStats_MemoTypeStats)(nil), // 71: memos.api.UserStats.MemoTypeStats
+ (*UserUsage_EffectiveLimit)(nil), // 72: memos.api.UserUsage.EffectiveLimit
+ (*MemoView_Icon)(nil), // 73: memos.api.MemoView.Icon
+ (*UserNotification_MemoCommentPayload)(nil), // 74: memos.api.UserNotification.MemoCommentPayload
+ (*UserNotification_MemoMentionPayload)(nil), // 75: memos.api.UserNotification.MemoMentionPayload
+ (*UserNotification_SpaceInvitationPayload)(nil), // 76: memos.api.UserNotification.SpaceInvitationPayload
+ (State)(0), // 77: memos.api.State
+ (*timestamppb.Timestamp)(nil), // 78: google.protobuf.Timestamp
+ (*fieldmaskpb.FieldMask)(nil), // 79: google.protobuf.FieldMask
+ (*color.Color)(nil), // 80: google.type.Color
+ (*Space)(nil), // 81: memos.api.Space
+ (SpaceMember_Role)(0), // 82: memos.api.SpaceMember.Role
+ (*emptypb.Empty)(nil), // 83: google.protobuf.Empty
+ (*httpbody.HttpBody)(nil), // 84: google.api.HttpBody
}
var file_api_user_service_proto_depIdxs = []int32{
- 0, // 0: memos.api.User.role:type_name -> memos.api.User.Role
- 74, // 1: memos.api.User.state:type_name -> memos.api.State
- 75, // 2: memos.api.User.create_time:type_name -> google.protobuf.Timestamp
- 75, // 3: memos.api.User.update_time:type_name -> google.protobuf.Timestamp
- 6, // 4: memos.api.ListUsersResponse.users:type_name -> memos.api.User
- 76, // 5: memos.api.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask
- 6, // 6: memos.api.BatchGetUsersResponse.users:type_name -> memos.api.User
- 6, // 7: memos.api.CreateUserRequest.user:type_name -> memos.api.User
- 6, // 8: memos.api.UpdateUserRequest.user:type_name -> memos.api.User
- 76, // 9: memos.api.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
- 63, // 10: memos.api.UserSetting.general_setting:type_name -> memos.api.UserSetting.GeneralSetting
- 64, // 11: memos.api.UserSetting.webhooks_setting:type_name -> memos.api.UserSetting.WebhooksSetting
- 65, // 12: memos.api.UserSetting.tags_setting:type_name -> memos.api.UserSetting.TagsSetting
- 15, // 13: memos.api.ListUserSettingsResponse.user_settings:type_name -> memos.api.UserSetting
- 15, // 14: memos.api.UpdateUserSettingRequest.user_setting:type_name -> memos.api.UserSetting
- 76, // 15: memos.api.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
- 69, // 16: memos.api.UserStats.memo_type_stats:type_name -> memos.api.UserStats.MemoTypeStats
- 68, // 17: memos.api.UserStats.tag_counts:type_name -> memos.api.UserStats.TagCountsEntry
- 75, // 18: memos.api.UserStats.memo_created_timestamps:type_name -> google.protobuf.Timestamp
- 75, // 19: memos.api.UserStats.memo_updated_timestamps:type_name -> google.protobuf.Timestamp
- 74, // 20: memos.api.ListUserStatsRequest.state:type_name -> memos.api.State
- 20, // 21: memos.api.ListUserStatsResponse.user_stats:type_name -> memos.api.UserStats
- 70, // 22: memos.api.MemoView.icon:type_name -> memos.api.MemoView.Icon
- 24, // 23: memos.api.ListMemoViewsResponse.memo_views:type_name -> memos.api.MemoView
- 24, // 24: memos.api.CreateMemoViewRequest.memo_view:type_name -> memos.api.MemoView
- 24, // 25: memos.api.UpdateMemoViewRequest.memo_view:type_name -> memos.api.MemoView
- 76, // 26: memos.api.UpdateMemoViewRequest.update_mask:type_name -> google.protobuf.FieldMask
- 6, // 27: memos.api.UserNotification.sender_user:type_name -> memos.api.User
- 3, // 28: memos.api.UserNotification.type:type_name -> memos.api.UserNotification.Type
- 71, // 29: memos.api.UserNotification.memo_comment:type_name -> memos.api.UserNotification.MemoCommentPayload
- 72, // 30: memos.api.UserNotification.memo_mention:type_name -> memos.api.UserNotification.MemoMentionPayload
- 73, // 31: memos.api.UserNotification.space_invitation:type_name -> memos.api.UserNotification.SpaceInvitationPayload
- 2, // 32: memos.api.UserNotification.status:type_name -> memos.api.UserNotification.Status
- 75, // 33: memos.api.UserNotification.create_time:type_name -> google.protobuf.Timestamp
- 31, // 34: memos.api.ListUserNotificationsResponse.notifications:type_name -> memos.api.UserNotification
- 31, // 35: memos.api.UpdateUserNotificationRequest.notification:type_name -> memos.api.UserNotification
- 76, // 36: memos.api.UpdateUserNotificationRequest.update_mask:type_name -> google.protobuf.FieldMask
- 75, // 37: memos.api.UserWebhook.create_time:type_name -> google.protobuf.Timestamp
- 75, // 38: memos.api.UserWebhook.update_time:type_name -> google.protobuf.Timestamp
- 36, // 39: memos.api.ListUserWebhooksResponse.webhooks:type_name -> memos.api.UserWebhook
- 36, // 40: memos.api.CreateUserWebhookRequest.webhook:type_name -> memos.api.UserWebhook
- 36, // 41: memos.api.UpdateUserWebhookRequest.webhook:type_name -> memos.api.UserWebhook
- 76, // 42: memos.api.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask
- 44, // 43: memos.api.ListLinkedIdentitiesResponse.linked_identities:type_name -> memos.api.LinkedIdentity
- 75, // 44: memos.api.PersonalAccessToken.create_time:type_name -> google.protobuf.Timestamp
- 75, // 45: memos.api.PersonalAccessToken.expire_time:type_name -> google.protobuf.Timestamp
- 75, // 46: memos.api.PersonalAccessToken.last_use_time:type_name -> google.protobuf.Timestamp
- 50, // 47: memos.api.ListPersonalAccessTokensResponse.personal_access_tokens:type_name -> memos.api.PersonalAccessToken
- 50, // 48: memos.api.CreatePersonalAccessTokenResponse.personal_access_token:type_name -> memos.api.PersonalAccessToken
- 59, // 49: memos.api.ImportMemosRequest.spec:type_name -> memos.api.ImportMemosSpec
- 5, // 50: memos.api.ImportMemosRequest.conflict_policy:type_name -> memos.api.ImportMemosRequest.ConflictPolicy
- 60, // 51: memos.api.ImportMemosResponse.plan:type_name -> memos.api.ImportMemosPlan
- 61, // 52: memos.api.ImportMemosResponse.report:type_name -> memos.api.ImportMemosReport
- 75, // 53: memos.api.ImportMemosPlan.export_time:type_name -> google.protobuf.Timestamp
- 62, // 54: memos.api.ImportMemosPlan.warnings:type_name -> memos.api.ImportMemosIssue
- 62, // 55: memos.api.ImportMemosReport.warnings:type_name -> memos.api.ImportMemosIssue
- 62, // 56: memos.api.ImportMemosReport.failures:type_name -> memos.api.ImportMemosIssue
- 36, // 57: memos.api.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.UserWebhook
- 67, // 58: memos.api.UserSetting.TagsSetting.tags:type_name -> memos.api.UserSetting.TagsSetting.TagsEntry
- 77, // 59: memos.api.UserSetting.TagMetadata.background_color:type_name -> google.type.Color
- 66, // 60: memos.api.UserSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.UserSetting.TagMetadata
- 78, // 61: memos.api.UserNotification.SpaceInvitationPayload.space:type_name -> memos.api.Space
- 79, // 62: memos.api.UserNotification.SpaceInvitationPayload.role:type_name -> memos.api.SpaceMember.Role
- 4, // 63: memos.api.UserNotification.SpaceInvitationPayload.state:type_name -> memos.api.UserNotification.SpaceInvitationPayload.InvitationState
- 7, // 64: memos.api.UserService.ListUsers:input_type -> memos.api.ListUsersRequest
- 9, // 65: memos.api.UserService.GetUser:input_type -> memos.api.GetUserRequest
- 10, // 66: memos.api.UserService.BatchGetUsers:input_type -> memos.api.BatchGetUsersRequest
- 12, // 67: memos.api.UserService.CreateUser:input_type -> memos.api.CreateUserRequest
- 13, // 68: memos.api.UserService.UpdateUser:input_type -> memos.api.UpdateUserRequest
- 14, // 69: memos.api.UserService.DeleteUser:input_type -> memos.api.DeleteUserRequest
- 16, // 70: memos.api.UserService.ListUserSettings:input_type -> memos.api.ListUserSettingsRequest
- 18, // 71: memos.api.UserService.GetUserSetting:input_type -> memos.api.GetUserSettingRequest
- 19, // 72: memos.api.UserService.UpdateUserSetting:input_type -> memos.api.UpdateUserSettingRequest
- 21, // 73: memos.api.UserService.ListUserStats:input_type -> memos.api.ListUserStatsRequest
- 23, // 74: memos.api.UserService.GetUserStats:input_type -> memos.api.GetUserStatsRequest
- 25, // 75: memos.api.UserService.ListMemoViews:input_type -> memos.api.ListMemoViewsRequest
- 27, // 76: memos.api.UserService.GetMemoView:input_type -> memos.api.GetMemoViewRequest
- 28, // 77: memos.api.UserService.CreateMemoView:input_type -> memos.api.CreateMemoViewRequest
- 29, // 78: memos.api.UserService.UpdateMemoView:input_type -> memos.api.UpdateMemoViewRequest
- 30, // 79: memos.api.UserService.DeleteMemoView:input_type -> memos.api.DeleteMemoViewRequest
- 32, // 80: memos.api.UserService.ListUserNotifications:input_type -> memos.api.ListUserNotificationsRequest
- 34, // 81: memos.api.UserService.UpdateUserNotification:input_type -> memos.api.UpdateUserNotificationRequest
- 35, // 82: memos.api.UserService.DeleteUserNotification:input_type -> memos.api.DeleteUserNotificationRequest
- 37, // 83: memos.api.UserService.ListUserWebhooks:input_type -> memos.api.ListUserWebhooksRequest
- 39, // 84: memos.api.UserService.CreateUserWebhook:input_type -> memos.api.CreateUserWebhookRequest
- 40, // 85: memos.api.UserService.UpdateUserWebhook:input_type -> memos.api.UpdateUserWebhookRequest
- 41, // 86: memos.api.UserService.DeleteUserWebhook:input_type -> memos.api.DeleteUserWebhookRequest
- 42, // 87: memos.api.UserService.GetUserWebhookSigningSecret:input_type -> memos.api.GetUserWebhookSigningSecretRequest
- 45, // 88: memos.api.UserService.ListLinkedIdentities:input_type -> memos.api.ListLinkedIdentitiesRequest
- 47, // 89: memos.api.UserService.GetLinkedIdentity:input_type -> memos.api.GetLinkedIdentityRequest
- 48, // 90: memos.api.UserService.CreateLinkedIdentity:input_type -> memos.api.CreateLinkedIdentityRequest
- 49, // 91: memos.api.UserService.DeleteLinkedIdentity:input_type -> memos.api.DeleteLinkedIdentityRequest
- 51, // 92: memos.api.UserService.ListPersonalAccessTokens:input_type -> memos.api.ListPersonalAccessTokensRequest
- 53, // 93: memos.api.UserService.CreatePersonalAccessToken:input_type -> memos.api.CreatePersonalAccessTokenRequest
- 55, // 94: memos.api.UserService.DeletePersonalAccessToken:input_type -> memos.api.DeletePersonalAccessTokenRequest
- 56, // 95: memos.api.UserService.ExportMemos:input_type -> memos.api.ExportMemosRequest
- 57, // 96: memos.api.UserService.ImportMemos:input_type -> memos.api.ImportMemosRequest
- 8, // 97: memos.api.UserService.ListUsers:output_type -> memos.api.ListUsersResponse
- 6, // 98: memos.api.UserService.GetUser:output_type -> memos.api.User
- 11, // 99: memos.api.UserService.BatchGetUsers:output_type -> memos.api.BatchGetUsersResponse
- 6, // 100: memos.api.UserService.CreateUser:output_type -> memos.api.User
- 6, // 101: memos.api.UserService.UpdateUser:output_type -> memos.api.User
- 80, // 102: memos.api.UserService.DeleteUser:output_type -> google.protobuf.Empty
- 17, // 103: memos.api.UserService.ListUserSettings:output_type -> memos.api.ListUserSettingsResponse
- 15, // 104: memos.api.UserService.GetUserSetting:output_type -> memos.api.UserSetting
- 15, // 105: memos.api.UserService.UpdateUserSetting:output_type -> memos.api.UserSetting
- 22, // 106: memos.api.UserService.ListUserStats:output_type -> memos.api.ListUserStatsResponse
- 20, // 107: memos.api.UserService.GetUserStats:output_type -> memos.api.UserStats
- 26, // 108: memos.api.UserService.ListMemoViews:output_type -> memos.api.ListMemoViewsResponse
- 24, // 109: memos.api.UserService.GetMemoView:output_type -> memos.api.MemoView
- 24, // 110: memos.api.UserService.CreateMemoView:output_type -> memos.api.MemoView
- 24, // 111: memos.api.UserService.UpdateMemoView:output_type -> memos.api.MemoView
- 80, // 112: memos.api.UserService.DeleteMemoView:output_type -> google.protobuf.Empty
- 33, // 113: memos.api.UserService.ListUserNotifications:output_type -> memos.api.ListUserNotificationsResponse
- 31, // 114: memos.api.UserService.UpdateUserNotification:output_type -> memos.api.UserNotification
- 80, // 115: memos.api.UserService.DeleteUserNotification:output_type -> google.protobuf.Empty
- 38, // 116: memos.api.UserService.ListUserWebhooks:output_type -> memos.api.ListUserWebhooksResponse
- 36, // 117: memos.api.UserService.CreateUserWebhook:output_type -> memos.api.UserWebhook
- 36, // 118: memos.api.UserService.UpdateUserWebhook:output_type -> memos.api.UserWebhook
- 80, // 119: memos.api.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty
- 43, // 120: memos.api.UserService.GetUserWebhookSigningSecret:output_type -> memos.api.GetUserWebhookSigningSecretResponse
- 46, // 121: memos.api.UserService.ListLinkedIdentities:output_type -> memos.api.ListLinkedIdentitiesResponse
- 44, // 122: memos.api.UserService.GetLinkedIdentity:output_type -> memos.api.LinkedIdentity
- 44, // 123: memos.api.UserService.CreateLinkedIdentity:output_type -> memos.api.LinkedIdentity
- 80, // 124: memos.api.UserService.DeleteLinkedIdentity:output_type -> google.protobuf.Empty
- 52, // 125: memos.api.UserService.ListPersonalAccessTokens:output_type -> memos.api.ListPersonalAccessTokensResponse
- 54, // 126: memos.api.UserService.CreatePersonalAccessToken:output_type -> memos.api.CreatePersonalAccessTokenResponse
- 80, // 127: memos.api.UserService.DeletePersonalAccessToken:output_type -> google.protobuf.Empty
- 81, // 128: memos.api.UserService.ExportMemos:output_type -> google.api.HttpBody
- 58, // 129: memos.api.UserService.ImportMemos:output_type -> memos.api.ImportMemosResponse
- 97, // [97:130] is the sub-list for method output_type
- 64, // [64:97] is the sub-list for method input_type
- 64, // [64:64] is the sub-list for extension type_name
- 64, // [64:64] is the sub-list for extension extendee
- 0, // [0:64] is the sub-list for field type_name
+ 0, // 0: memos.api.User.role:type_name -> memos.api.User.Role
+ 77, // 1: memos.api.User.state:type_name -> memos.api.State
+ 78, // 2: memos.api.User.create_time:type_name -> google.protobuf.Timestamp
+ 78, // 3: memos.api.User.update_time:type_name -> google.protobuf.Timestamp
+ 6, // 4: memos.api.ListUsersResponse.users:type_name -> memos.api.User
+ 79, // 5: memos.api.GetUserRequest.read_mask:type_name -> google.protobuf.FieldMask
+ 6, // 6: memos.api.BatchGetUsersResponse.users:type_name -> memos.api.User
+ 6, // 7: memos.api.CreateUserRequest.user:type_name -> memos.api.User
+ 6, // 8: memos.api.UpdateUserRequest.user:type_name -> memos.api.User
+ 79, // 9: memos.api.UpdateUserRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 65, // 10: memos.api.UserSetting.general_setting:type_name -> memos.api.UserSetting.GeneralSetting
+ 66, // 11: memos.api.UserSetting.webhooks_setting:type_name -> memos.api.UserSetting.WebhooksSetting
+ 67, // 12: memos.api.UserSetting.tags_setting:type_name -> memos.api.UserSetting.TagsSetting
+ 15, // 13: memos.api.ListUserSettingsResponse.user_settings:type_name -> memos.api.UserSetting
+ 15, // 14: memos.api.UpdateUserSettingRequest.user_setting:type_name -> memos.api.UserSetting
+ 79, // 15: memos.api.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 71, // 16: memos.api.UserStats.memo_type_stats:type_name -> memos.api.UserStats.MemoTypeStats
+ 70, // 17: memos.api.UserStats.tag_counts:type_name -> memos.api.UserStats.TagCountsEntry
+ 78, // 18: memos.api.UserStats.memo_created_timestamps:type_name -> google.protobuf.Timestamp
+ 78, // 19: memos.api.UserStats.memo_updated_timestamps:type_name -> google.protobuf.Timestamp
+ 77, // 20: memos.api.ListUserStatsRequest.state:type_name -> memos.api.State
+ 20, // 21: memos.api.ListUserStatsResponse.user_stats:type_name -> memos.api.UserStats
+ 72, // 22: memos.api.UserUsage.memos_limit:type_name -> memos.api.UserUsage.EffectiveLimit
+ 72, // 23: memos.api.UserUsage.storage_bytes_limit:type_name -> memos.api.UserUsage.EffectiveLimit
+ 72, // 24: memos.api.UserUsage.upload_bytes_limit:type_name -> memos.api.UserUsage.EffectiveLimit
+ 73, // 25: memos.api.MemoView.icon:type_name -> memos.api.MemoView.Icon
+ 26, // 26: memos.api.ListMemoViewsResponse.memo_views:type_name -> memos.api.MemoView
+ 26, // 27: memos.api.CreateMemoViewRequest.memo_view:type_name -> memos.api.MemoView
+ 26, // 28: memos.api.UpdateMemoViewRequest.memo_view:type_name -> memos.api.MemoView
+ 79, // 29: memos.api.UpdateMemoViewRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 6, // 30: memos.api.UserNotification.sender_user:type_name -> memos.api.User
+ 3, // 31: memos.api.UserNotification.type:type_name -> memos.api.UserNotification.Type
+ 74, // 32: memos.api.UserNotification.memo_comment:type_name -> memos.api.UserNotification.MemoCommentPayload
+ 75, // 33: memos.api.UserNotification.memo_mention:type_name -> memos.api.UserNotification.MemoMentionPayload
+ 76, // 34: memos.api.UserNotification.space_invitation:type_name -> memos.api.UserNotification.SpaceInvitationPayload
+ 2, // 35: memos.api.UserNotification.status:type_name -> memos.api.UserNotification.Status
+ 78, // 36: memos.api.UserNotification.create_time:type_name -> google.protobuf.Timestamp
+ 33, // 37: memos.api.ListUserNotificationsResponse.notifications:type_name -> memos.api.UserNotification
+ 33, // 38: memos.api.UpdateUserNotificationRequest.notification:type_name -> memos.api.UserNotification
+ 79, // 39: memos.api.UpdateUserNotificationRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 78, // 40: memos.api.UserWebhook.create_time:type_name -> google.protobuf.Timestamp
+ 78, // 41: memos.api.UserWebhook.update_time:type_name -> google.protobuf.Timestamp
+ 38, // 42: memos.api.ListUserWebhooksResponse.webhooks:type_name -> memos.api.UserWebhook
+ 38, // 43: memos.api.CreateUserWebhookRequest.webhook:type_name -> memos.api.UserWebhook
+ 38, // 44: memos.api.UpdateUserWebhookRequest.webhook:type_name -> memos.api.UserWebhook
+ 79, // 45: memos.api.UpdateUserWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 46, // 46: memos.api.ListLinkedIdentitiesResponse.linked_identities:type_name -> memos.api.LinkedIdentity
+ 78, // 47: memos.api.PersonalAccessToken.create_time:type_name -> google.protobuf.Timestamp
+ 78, // 48: memos.api.PersonalAccessToken.expire_time:type_name -> google.protobuf.Timestamp
+ 78, // 49: memos.api.PersonalAccessToken.last_use_time:type_name -> google.protobuf.Timestamp
+ 52, // 50: memos.api.ListPersonalAccessTokensResponse.personal_access_tokens:type_name -> memos.api.PersonalAccessToken
+ 52, // 51: memos.api.CreatePersonalAccessTokenResponse.personal_access_token:type_name -> memos.api.PersonalAccessToken
+ 61, // 52: memos.api.ImportMemosRequest.spec:type_name -> memos.api.ImportMemosSpec
+ 5, // 53: memos.api.ImportMemosRequest.conflict_policy:type_name -> memos.api.ImportMemosRequest.ConflictPolicy
+ 62, // 54: memos.api.ImportMemosResponse.plan:type_name -> memos.api.ImportMemosPlan
+ 63, // 55: memos.api.ImportMemosResponse.report:type_name -> memos.api.ImportMemosReport
+ 78, // 56: memos.api.ImportMemosPlan.export_time:type_name -> google.protobuf.Timestamp
+ 64, // 57: memos.api.ImportMemosPlan.warnings:type_name -> memos.api.ImportMemosIssue
+ 64, // 58: memos.api.ImportMemosReport.warnings:type_name -> memos.api.ImportMemosIssue
+ 64, // 59: memos.api.ImportMemosReport.failures:type_name -> memos.api.ImportMemosIssue
+ 38, // 60: memos.api.UserSetting.WebhooksSetting.webhooks:type_name -> memos.api.UserWebhook
+ 69, // 61: memos.api.UserSetting.TagsSetting.tags:type_name -> memos.api.UserSetting.TagsSetting.TagsEntry
+ 80, // 62: memos.api.UserSetting.TagMetadata.background_color:type_name -> google.type.Color
+ 68, // 63: memos.api.UserSetting.TagsSetting.TagsEntry.value:type_name -> memos.api.UserSetting.TagMetadata
+ 81, // 64: memos.api.UserNotification.SpaceInvitationPayload.space:type_name -> memos.api.Space
+ 82, // 65: memos.api.UserNotification.SpaceInvitationPayload.role:type_name -> memos.api.SpaceMember.Role
+ 4, // 66: memos.api.UserNotification.SpaceInvitationPayload.state:type_name -> memos.api.UserNotification.SpaceInvitationPayload.InvitationState
+ 7, // 67: memos.api.UserService.ListUsers:input_type -> memos.api.ListUsersRequest
+ 9, // 68: memos.api.UserService.GetUser:input_type -> memos.api.GetUserRequest
+ 10, // 69: memos.api.UserService.BatchGetUsers:input_type -> memos.api.BatchGetUsersRequest
+ 12, // 70: memos.api.UserService.CreateUser:input_type -> memos.api.CreateUserRequest
+ 13, // 71: memos.api.UserService.UpdateUser:input_type -> memos.api.UpdateUserRequest
+ 14, // 72: memos.api.UserService.DeleteUser:input_type -> memos.api.DeleteUserRequest
+ 16, // 73: memos.api.UserService.ListUserSettings:input_type -> memos.api.ListUserSettingsRequest
+ 18, // 74: memos.api.UserService.GetUserSetting:input_type -> memos.api.GetUserSettingRequest
+ 19, // 75: memos.api.UserService.UpdateUserSetting:input_type -> memos.api.UpdateUserSettingRequest
+ 21, // 76: memos.api.UserService.ListUserStats:input_type -> memos.api.ListUserStatsRequest
+ 23, // 77: memos.api.UserService.GetUserStats:input_type -> memos.api.GetUserStatsRequest
+ 25, // 78: memos.api.UserService.GetUserUsage:input_type -> memos.api.GetUserUsageRequest
+ 27, // 79: memos.api.UserService.ListMemoViews:input_type -> memos.api.ListMemoViewsRequest
+ 29, // 80: memos.api.UserService.GetMemoView:input_type -> memos.api.GetMemoViewRequest
+ 30, // 81: memos.api.UserService.CreateMemoView:input_type -> memos.api.CreateMemoViewRequest
+ 31, // 82: memos.api.UserService.UpdateMemoView:input_type -> memos.api.UpdateMemoViewRequest
+ 32, // 83: memos.api.UserService.DeleteMemoView:input_type -> memos.api.DeleteMemoViewRequest
+ 34, // 84: memos.api.UserService.ListUserNotifications:input_type -> memos.api.ListUserNotificationsRequest
+ 36, // 85: memos.api.UserService.UpdateUserNotification:input_type -> memos.api.UpdateUserNotificationRequest
+ 37, // 86: memos.api.UserService.DeleteUserNotification:input_type -> memos.api.DeleteUserNotificationRequest
+ 39, // 87: memos.api.UserService.ListUserWebhooks:input_type -> memos.api.ListUserWebhooksRequest
+ 41, // 88: memos.api.UserService.CreateUserWebhook:input_type -> memos.api.CreateUserWebhookRequest
+ 42, // 89: memos.api.UserService.UpdateUserWebhook:input_type -> memos.api.UpdateUserWebhookRequest
+ 43, // 90: memos.api.UserService.DeleteUserWebhook:input_type -> memos.api.DeleteUserWebhookRequest
+ 44, // 91: memos.api.UserService.GetUserWebhookSigningSecret:input_type -> memos.api.GetUserWebhookSigningSecretRequest
+ 47, // 92: memos.api.UserService.ListLinkedIdentities:input_type -> memos.api.ListLinkedIdentitiesRequest
+ 49, // 93: memos.api.UserService.GetLinkedIdentity:input_type -> memos.api.GetLinkedIdentityRequest
+ 50, // 94: memos.api.UserService.CreateLinkedIdentity:input_type -> memos.api.CreateLinkedIdentityRequest
+ 51, // 95: memos.api.UserService.DeleteLinkedIdentity:input_type -> memos.api.DeleteLinkedIdentityRequest
+ 53, // 96: memos.api.UserService.ListPersonalAccessTokens:input_type -> memos.api.ListPersonalAccessTokensRequest
+ 55, // 97: memos.api.UserService.CreatePersonalAccessToken:input_type -> memos.api.CreatePersonalAccessTokenRequest
+ 57, // 98: memos.api.UserService.DeletePersonalAccessToken:input_type -> memos.api.DeletePersonalAccessTokenRequest
+ 58, // 99: memos.api.UserService.ExportMemos:input_type -> memos.api.ExportMemosRequest
+ 59, // 100: memos.api.UserService.ImportMemos:input_type -> memos.api.ImportMemosRequest
+ 8, // 101: memos.api.UserService.ListUsers:output_type -> memos.api.ListUsersResponse
+ 6, // 102: memos.api.UserService.GetUser:output_type -> memos.api.User
+ 11, // 103: memos.api.UserService.BatchGetUsers:output_type -> memos.api.BatchGetUsersResponse
+ 6, // 104: memos.api.UserService.CreateUser:output_type -> memos.api.User
+ 6, // 105: memos.api.UserService.UpdateUser:output_type -> memos.api.User
+ 83, // 106: memos.api.UserService.DeleteUser:output_type -> google.protobuf.Empty
+ 17, // 107: memos.api.UserService.ListUserSettings:output_type -> memos.api.ListUserSettingsResponse
+ 15, // 108: memos.api.UserService.GetUserSetting:output_type -> memos.api.UserSetting
+ 15, // 109: memos.api.UserService.UpdateUserSetting:output_type -> memos.api.UserSetting
+ 22, // 110: memos.api.UserService.ListUserStats:output_type -> memos.api.ListUserStatsResponse
+ 20, // 111: memos.api.UserService.GetUserStats:output_type -> memos.api.UserStats
+ 24, // 112: memos.api.UserService.GetUserUsage:output_type -> memos.api.UserUsage
+ 28, // 113: memos.api.UserService.ListMemoViews:output_type -> memos.api.ListMemoViewsResponse
+ 26, // 114: memos.api.UserService.GetMemoView:output_type -> memos.api.MemoView
+ 26, // 115: memos.api.UserService.CreateMemoView:output_type -> memos.api.MemoView
+ 26, // 116: memos.api.UserService.UpdateMemoView:output_type -> memos.api.MemoView
+ 83, // 117: memos.api.UserService.DeleteMemoView:output_type -> google.protobuf.Empty
+ 35, // 118: memos.api.UserService.ListUserNotifications:output_type -> memos.api.ListUserNotificationsResponse
+ 33, // 119: memos.api.UserService.UpdateUserNotification:output_type -> memos.api.UserNotification
+ 83, // 120: memos.api.UserService.DeleteUserNotification:output_type -> google.protobuf.Empty
+ 40, // 121: memos.api.UserService.ListUserWebhooks:output_type -> memos.api.ListUserWebhooksResponse
+ 38, // 122: memos.api.UserService.CreateUserWebhook:output_type -> memos.api.UserWebhook
+ 38, // 123: memos.api.UserService.UpdateUserWebhook:output_type -> memos.api.UserWebhook
+ 83, // 124: memos.api.UserService.DeleteUserWebhook:output_type -> google.protobuf.Empty
+ 45, // 125: memos.api.UserService.GetUserWebhookSigningSecret:output_type -> memos.api.GetUserWebhookSigningSecretResponse
+ 48, // 126: memos.api.UserService.ListLinkedIdentities:output_type -> memos.api.ListLinkedIdentitiesResponse
+ 46, // 127: memos.api.UserService.GetLinkedIdentity:output_type -> memos.api.LinkedIdentity
+ 46, // 128: memos.api.UserService.CreateLinkedIdentity:output_type -> memos.api.LinkedIdentity
+ 83, // 129: memos.api.UserService.DeleteLinkedIdentity:output_type -> google.protobuf.Empty
+ 54, // 130: memos.api.UserService.ListPersonalAccessTokens:output_type -> memos.api.ListPersonalAccessTokensResponse
+ 56, // 131: memos.api.UserService.CreatePersonalAccessToken:output_type -> memos.api.CreatePersonalAccessTokenResponse
+ 83, // 132: memos.api.UserService.DeletePersonalAccessToken:output_type -> google.protobuf.Empty
+ 84, // 133: memos.api.UserService.ExportMemos:output_type -> google.api.HttpBody
+ 60, // 134: memos.api.UserService.ImportMemos:output_type -> memos.api.ImportMemosResponse
+ 101, // [101:135] is the sub-list for method output_type
+ 67, // [67:101] is the sub-list for method input_type
+ 67, // [67:67] is the sub-list for extension type_name
+ 67, // [67:67] is the sub-list for extension extendee
+ 0, // [0:67] is the sub-list for field type_name
}
func init() { file_api_user_service_proto_init() }
@@ -5432,20 +5660,20 @@ func file_api_user_service_proto_init() {
(*UserSetting_TagsSetting_)(nil),
}
file_api_user_service_proto_msgTypes[14].OneofWrappers = []any{}
- file_api_user_service_proto_msgTypes[25].OneofWrappers = []any{
+ file_api_user_service_proto_msgTypes[27].OneofWrappers = []any{
(*UserNotification_MemoComment)(nil),
(*UserNotification_MemoMention)(nil),
(*UserNotification_SpaceInvitation)(nil),
}
- file_api_user_service_proto_msgTypes[51].OneofWrappers = []any{
+ file_api_user_service_proto_msgTypes[53].OneofWrappers = []any{
(*ImportMemosRequest_Spec)(nil),
(*ImportMemosRequest_UploadId)(nil),
}
- file_api_user_service_proto_msgTypes[52].OneofWrappers = []any{
+ file_api_user_service_proto_msgTypes[54].OneofWrappers = []any{
(*ImportMemosResponse_Plan)(nil),
(*ImportMemosResponse_Report)(nil),
}
- file_api_user_service_proto_msgTypes[64].OneofWrappers = []any{
+ file_api_user_service_proto_msgTypes[67].OneofWrappers = []any{
(*MemoView_Icon_Emoji)(nil),
(*MemoView_Icon_Lucide)(nil),
}
@@ -5455,7 +5683,7 @@ func file_api_user_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_user_service_proto_rawDesc), len(file_api_user_service_proto_rawDesc)),
NumEnums: 6,
- NumMessages: 68,
+ NumMessages: 71,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/user_service.pb.gw.go b/proto/gen/api/user_service.pb.gw.go
index 73da06cf5..7b67843e0 100644
--- a/proto/gen/api/user_service.pb.gw.go
+++ b/proto/gen/api/user_service.pb.gw.go
@@ -604,6 +604,45 @@ func local_request_UserService_GetUserStats_0(ctx context.Context, marshaler run
return msg, metadata, err
}
+func request_UserService_GetUserUsage_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq GetUserUsageRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ msg, err := client.GetUserUsage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_UserService_GetUserUsage_0(ctx context.Context, marshaler runtime.Marshaler, server UserServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq GetUserUsageRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["name"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
+ }
+ protoReq.Name, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
+ }
+ msg, err := server.GetUserUsage(ctx, &protoReq)
+ return msg, metadata, err
+}
+
func request_UserService_ListMemoViews_0(ctx context.Context, marshaler runtime.Marshaler, client UserServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq ListMemoViewsRequest
@@ -1886,6 +1925,26 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_GetUserUsage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.UserService/GetUserUsage", runtime.WithHTTPPathPattern("/api/{name=users/*/usage}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_UserService_GetUserUsage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_GetUserUsage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_UserService_ListMemoViews_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -2553,6 +2612,23 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
}
forward_UserService_GetUserStats_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_UserService_GetUserUsage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.UserService/GetUserUsage", runtime.WithHTTPPathPattern("/api/{name=users/*/usage}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_UserService_GetUserUsage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_UserService_GetUserUsage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodGet, pattern_UserService_ListMemoViews_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -2942,6 +3018,7 @@ var (
pattern_UserService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "settings", "user_setting.name"}, ""))
pattern_UserService_ListUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "stats"}, ""))
pattern_UserService_GetUserStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"api", "users", "name"}, "getStats"))
+ pattern_UserService_GetUserUsage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 4, 3, 5, 3}, []string{"api", "users", "usage", "name"}, ""))
pattern_UserService_ListMemoViews_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "views"}, ""))
pattern_UserService_GetMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"api", "users", "views", "name"}, ""))
pattern_UserService_CreateMemoView_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"api", "users", "parent", "views"}, ""))
@@ -2978,6 +3055,7 @@ var (
forward_UserService_UpdateUserSetting_0 = runtime.ForwardResponseMessage
forward_UserService_ListUserStats_0 = runtime.ForwardResponseMessage
forward_UserService_GetUserStats_0 = runtime.ForwardResponseMessage
+ forward_UserService_GetUserUsage_0 = runtime.ForwardResponseMessage
forward_UserService_ListMemoViews_0 = runtime.ForwardResponseMessage
forward_UserService_GetMemoView_0 = runtime.ForwardResponseMessage
forward_UserService_CreateMemoView_0 = runtime.ForwardResponseMessage
diff --git a/proto/gen/api/user_service_grpc.pb.go b/proto/gen/api/user_service_grpc.pb.go
index 28a17f456..ba193ee96 100644
--- a/proto/gen/api/user_service_grpc.pb.go
+++ b/proto/gen/api/user_service_grpc.pb.go
@@ -32,6 +32,7 @@ const (
UserService_UpdateUserSetting_FullMethodName = "/memos.api.UserService/UpdateUserSetting"
UserService_ListUserStats_FullMethodName = "/memos.api.UserService/ListUserStats"
UserService_GetUserStats_FullMethodName = "/memos.api.UserService/GetUserStats"
+ UserService_GetUserUsage_FullMethodName = "/memos.api.UserService/GetUserUsage"
UserService_ListMemoViews_FullMethodName = "/memos.api.UserService/ListMemoViews"
UserService_GetMemoView_FullMethodName = "/memos.api.UserService/GetMemoView"
UserService_CreateMemoView_FullMethodName = "/memos.api.UserService/CreateMemoView"
@@ -97,6 +98,9 @@ type UserServiceClient interface {
// GetUserStats returns memo statistics for one user, counting the user's
// memos that the caller can read.
GetUserStats(ctx context.Context, in *GetUserStatsRequest, opts ...grpc.CallOption) (*UserStats, error)
+ // GetUserUsage returns a user's usage and the usage limits in effect for the
+ // user. Only the user or an admin may call it.
+ GetUserUsage(ctx context.Context, in *GetUserUsageRequest, opts ...grpc.CallOption) (*UserUsage, error)
// ListMemoViews lists a user's memo views. Each view is a named, reusable
// CEL filter (see MemoView.filter); pass its filter string directly to the
// ListMemos `filter` argument. Only the user may call it.
@@ -289,6 +293,16 @@ func (c *userServiceClient) GetUserStats(ctx context.Context, in *GetUserStatsRe
return out, nil
}
+func (c *userServiceClient) GetUserUsage(ctx context.Context, in *GetUserUsageRequest, opts ...grpc.CallOption) (*UserUsage, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UserUsage)
+ err := c.cc.Invoke(ctx, UserService_GetUserUsage_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *userServiceClient) ListMemoViews(ctx context.Context, in *ListMemoViewsRequest, opts ...grpc.CallOption) (*ListMemoViewsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListMemoViewsResponse)
@@ -550,6 +564,9 @@ type UserServiceServer interface {
// GetUserStats returns memo statistics for one user, counting the user's
// memos that the caller can read.
GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error)
+ // GetUserUsage returns a user's usage and the usage limits in effect for the
+ // user. Only the user or an admin may call it.
+ GetUserUsage(context.Context, *GetUserUsageRequest) (*UserUsage, error)
// ListMemoViews lists a user's memo views. Each view is a named, reusable
// CEL filter (see MemoView.filter); pass its filter string directly to the
// ListMemos `filter` argument. Only the user may call it.
@@ -665,6 +682,9 @@ func (UnimplementedUserServiceServer) ListUserStats(context.Context, *ListUserSt
func (UnimplementedUserServiceServer) GetUserStats(context.Context, *GetUserStatsRequest) (*UserStats, error) {
return nil, status.Error(codes.Unimplemented, "method GetUserStats not implemented")
}
+func (UnimplementedUserServiceServer) GetUserUsage(context.Context, *GetUserUsageRequest) (*UserUsage, error) {
+ return nil, status.Error(codes.Unimplemented, "method GetUserUsage not implemented")
+}
func (UnimplementedUserServiceServer) ListMemoViews(context.Context, *ListMemoViewsRequest) (*ListMemoViewsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListMemoViews not implemented")
}
@@ -950,6 +970,24 @@ func _UserService_GetUserStats_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
+func _UserService_GetUserUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetUserUsageRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServiceServer).GetUserUsage(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserService_GetUserUsage_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServiceServer).GetUserUsage(ctx, req.(*GetUserUsageRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _UserService_ListMemoViews_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListMemoViewsRequest)
if err := dec(in); err != nil {
@@ -1397,6 +1435,10 @@ var UserService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetUserStats",
Handler: _UserService_GetUserStats_Handler,
},
+ {
+ MethodName: "GetUserUsage",
+ Handler: _UserService_GetUserUsage_Handler,
+ },
{
MethodName: "ListMemoViews",
Handler: _UserService_ListMemoViews_Handler,
diff --git a/proto/gen/openapi.yaml b/proto/gen/openapi.yaml
index 28ca5a4c3..41eedf540 100644
--- a/proto/gen/openapi.yaml
+++ b/proto/gen/openapi.yaml
@@ -1927,6 +1927,180 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
+ /api/usageLimits:
+ get:
+ tags:
+ - InstanceService
+ description: |-
+ ListUsageLimits lists the usage limits: the defaults for every user and the
+ limits for single users. Admin only.
+ operationId: InstanceService_ListUsageLimits
+ parameters:
+ - name: pageSize
+ in: query
+ description: |-
+ Optional. The maximum number of usage limits to return. If unspecified, at
+ most 50 are returned. The maximum value is 1000; values above 1000 are
+ coerced to 1000.
+ schema:
+ type: integer
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ Optional. A page token from a previous call. Provide it to retrieve the
+ next page.
+ schema:
+ type: string
+ - name: filter
+ in: query
+ description: |-
+ Optional. A CEL filter on `user` and `metric`, combined with `&&`.
+ `user == ""` selects the defaults for every user.
+ Example: "user == 'users/steven' && metric == 'STORAGE_BYTES'"
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ListUsageLimitsResponse'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ post:
+ tags:
+ - InstanceService
+ description: |-
+ CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ limit per metric and user, and one default per metric. Fails with
+ FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ operationId: InstanceService_CreateUsageLimit
+ parameters:
+ - name: usageLimitId
+ in: query
+ description: |-
+ Optional. The ID to use for the usage limit, which becomes the final
+ segment of its name. Lowercase letters, digits and hyphens, at most 32
+ characters, starting with a letter. Generated when empty.
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UsageLimit'
+ required: true
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UsageLimit'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ /api/usageLimits/{usageLimit}:
+ get:
+ tags:
+ - InstanceService
+ description: GetUsageLimit gets a usage limit. Admin only.
+ operationId: InstanceService_GetUsageLimit
+ parameters:
+ - name: usageLimit
+ in: path
+ description: The usageLimit id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UsageLimit'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ delete:
+ tags:
+ - InstanceService
+ description: |-
+ DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ returns the user to the default; deleting a default makes the metric
+ unlimited for users without their own limit.
+ operationId: InstanceService_DeleteUsageLimit
+ parameters:
+ - name: usageLimit
+ in: path
+ description: The usageLimit id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content: {}
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
+ patch:
+ tags:
+ - InstanceService
+ description: |-
+ UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ and user cannot change.
+ operationId: InstanceService_UpdateUsageLimit
+ parameters:
+ - name: usageLimit
+ in: path
+ description: The usageLimit id.
+ required: true
+ schema:
+ type: string
+ - name: updateMask
+ in: query
+ description: |-
+ Optional. The fields to update. Only `value` is supported, which is also
+ the default.
+ schema:
+ type: string
+ format: field-mask
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UsageLimit'
+ required: true
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UsageLimit'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
/api/users:
get:
tags:
@@ -2704,6 +2878,34 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Status'
+ /api/users/{user}/usage:
+ get:
+ tags:
+ - UserService
+ description: |-
+ GetUserUsage returns a user's usage and the usage limits in effect for the
+ user. Only the user or an admin may call it.
+ operationId: UserService_GetUserUsage
+ parameters:
+ - name: user
+ in: path
+ description: The user id.
+ required: true
+ schema:
+ type: string
+ responses:
+ "200":
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UserUsage'
+ default:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Status'
/api/users/{user}/views:
get:
tags:
@@ -4051,7 +4253,7 @@ components:
Default is assets/{timestamp}_{uuid}_{filename}.
uploadSizeLimitMb:
type: string
- description: The maximum upload size in megabytes. Default is 30.
+ description: The maximum upload size in megabytes. Default is 32.
storageType:
enum:
- STORAGE_TYPE_UNSPECIFIED
@@ -4331,6 +4533,18 @@ components:
type: string
description: A token to retrieve the next page. Empty when there are no more pages.
description: Response message for SpaceService.ListSpaces.
+ ListUsageLimitsResponse:
+ type: object
+ properties:
+ usageLimits:
+ type: array
+ items:
+ $ref: '#/components/schemas/UsageLimit'
+ description: The usage limits, defaults first, then by user and metric.
+ nextPageToken:
+ type: string
+ description: A token to retrieve the next page. Empty when there are no more pages.
+ description: Response message for InstanceService.ListUsageLimits.
ListUserNotificationsResponse:
type: object
properties:
@@ -5334,6 +5548,49 @@ components:
- $ref: '#/components/schemas/Reaction'
description: Required. The reaction to upsert. Only reaction_type is used.
description: Request message for MemoService.UpsertMemoReaction.
+ UsageLimit:
+ required:
+ - metric
+ - value
+ type: object
+ properties:
+ name:
+ type: string
+ description: |-
+ Identifier. The resource name of the usage limit.
+ Format: usageLimits/{usage_limit}
+ metric:
+ enum:
+ - METRIC_UNSPECIFIED
+ - MEMOS
+ - STORAGE_BYTES
+ - UPLOAD_BYTES
+ type: string
+ description: Required. Immutable. What is limited.
+ format: enum
+ user:
+ type: string
+ description: |-
+ Optional. Immutable. The user the limit applies to. Empty means every user.
+ Format: users/{user}
+ value:
+ type: string
+ description: |-
+ Required. The limit. Must not be negative. 0 means unlimited for MEMOS and
+ STORAGE_BYTES, and no extra limit for UPLOAD_BYTES.
+ createTime:
+ readOnly: true
+ type: string
+ description: Output only. The creation time.
+ format: date-time
+ updateTime:
+ readOnly: true
+ type: string
+ description: Output only. The last update time.
+ format: date-time
+ description: |-
+ UsageLimit sets one limit for every user, or for one user. When both exist
+ for the same metric, the limit for the user applies to that user.
User:
required:
- username
@@ -5678,6 +5935,54 @@ components:
description: The number of memos that contain incomplete tasks.
format: int32
description: MemoTypeStats counts memos by the kind of content they contain.
+ UserUsage:
+ type: object
+ properties:
+ name:
+ type: string
+ description: |-
+ Identifier. The resource name of the user usage singleton.
+ Format: users/{user}/usage
+ memoCount:
+ type: string
+ description: |-
+ The number of memos the user created, including comments, archived
+ memos, and memos in Spaces.
+ storageBytes:
+ type: string
+ description: |-
+ The total size in bytes of the user's uploads, including uploads not
+ attached to a memo. External links do not count.
+ memosLimit:
+ allOf:
+ - $ref: '#/components/schemas/UserUsage_EffectiveLimit'
+ description: The limit on memo_count.
+ storageBytesLimit:
+ allOf:
+ - $ref: '#/components/schemas/UserUsage_EffectiveLimit'
+ description: The limit on storage_bytes.
+ uploadBytesLimit:
+ allOf:
+ - $ref: '#/components/schemas/UserUsage_EffectiveLimit'
+ description: |-
+ The limit on the size of one uploaded file. It applies only when it is
+ lower than the instance upload limit.
+ description: UserUsage is a user's usage and the usage limits in effect for the user.
+ UserUsage_EffectiveLimit:
+ type: object
+ properties:
+ value:
+ type: string
+ description: The limit. 0 means unlimited, or no extra limit for upload_bytes_limit.
+ usageLimit:
+ type: string
+ description: |-
+ The usage limit the value comes from: the user's own limit, or else the
+ default. Empty when no usage limit applies.
+ Format: usageLimits/{usage_limit}
+ description: |-
+ EffectiveLimit is the limit in effect for one metric, and where it comes
+ from.
UserWebhook:
type: object
properties:
diff --git a/proto/gen/store/instance_setting.pb.go b/proto/gen/store/instance_setting.pb.go
index 150e14836..ba8ccc26d 100644
--- a/proto/gen/store/instance_setting.pb.go
+++ b/proto/gen/store/instance_setting.pb.go
@@ -10,6 +10,7 @@ import (
color "google.golang.org/genproto/googleapis/type/color"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
unsafe "unsafe"
@@ -42,6 +43,9 @@ const (
InstanceSettingKey_AI InstanceSettingKey = 7
// ACCESS is the key for instance access policy settings.
InstanceSettingKey_ACCESS InstanceSettingKey = 8
+ // USAGE_LIMITS is the key for per-user usage limits. Store only; exposed
+ // through the usageLimits API, never through the instance settings API.
+ InstanceSettingKey_USAGE_LIMITS InstanceSettingKey = 9
)
// Enum value maps for InstanceSettingKey.
@@ -56,6 +60,7 @@ var (
6: "NOTIFICATION",
7: "AI",
8: "ACCESS",
+ 9: "USAGE_LIMITS",
}
InstanceSettingKey_value = map[string]int32{
"INSTANCE_SETTING_KEY_UNSPECIFIED": 0,
@@ -67,6 +72,7 @@ var (
"NOTIFICATION": 6,
"AI": 7,
"ACCESS": 8,
+ "USAGE_LIMITS": 9,
}
)
@@ -306,6 +312,63 @@ func (InstanceStorageSetting_StorageType) EnumDescriptor() ([]byte, []int) {
return file_store_instance_setting_proto_rawDescGZIP(), []int{5, 0}
}
+type InstanceUsageLimitsSetting_Metric int32
+
+const (
+ InstanceUsageLimitsSetting_METRIC_UNSPECIFIED InstanceUsageLimitsSetting_Metric = 0
+ // MEMOS limits the number of memos a user created, comments included.
+ InstanceUsageLimitsSetting_MEMOS InstanceUsageLimitsSetting_Metric = 1
+ // STORAGE_BYTES limits the total size of a user's uploads. External links
+ // do not count.
+ InstanceUsageLimitsSetting_STORAGE_BYTES InstanceUsageLimitsSetting_Metric = 2
+ // UPLOAD_BYTES limits the size of one uploaded file. It can only lower the
+ // instance upload limit.
+ InstanceUsageLimitsSetting_UPLOAD_BYTES InstanceUsageLimitsSetting_Metric = 3
+)
+
+// Enum value maps for InstanceUsageLimitsSetting_Metric.
+var (
+ InstanceUsageLimitsSetting_Metric_name = map[int32]string{
+ 0: "METRIC_UNSPECIFIED",
+ 1: "MEMOS",
+ 2: "STORAGE_BYTES",
+ 3: "UPLOAD_BYTES",
+ }
+ InstanceUsageLimitsSetting_Metric_value = map[string]int32{
+ "METRIC_UNSPECIFIED": 0,
+ "MEMOS": 1,
+ "STORAGE_BYTES": 2,
+ "UPLOAD_BYTES": 3,
+ }
+)
+
+func (x InstanceUsageLimitsSetting_Metric) Enum() *InstanceUsageLimitsSetting_Metric {
+ p := new(InstanceUsageLimitsSetting_Metric)
+ *p = x
+ return p
+}
+
+func (x InstanceUsageLimitsSetting_Metric) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (InstanceUsageLimitsSetting_Metric) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_instance_setting_proto_enumTypes[5].Descriptor()
+}
+
+func (InstanceUsageLimitsSetting_Metric) Type() protoreflect.EnumType {
+ return &file_store_instance_setting_proto_enumTypes[5]
+}
+
+func (x InstanceUsageLimitsSetting_Metric) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use InstanceUsageLimitsSetting_Metric.Descriptor instead.
+func (InstanceUsageLimitsSetting_Metric) EnumDescriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{15, 0}
+}
+
type InstanceSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key InstanceSettingKey `protobuf:"varint,1,opt,name=key,proto3,enum=memos.store.InstanceSettingKey" json:"key,omitempty"`
@@ -319,6 +382,7 @@ type InstanceSetting struct {
// *InstanceSetting_NotificationSetting
// *InstanceSetting_AiSetting
// *InstanceSetting_AccessSetting
+ // *InstanceSetting_UsageLimitsSetting
Value isInstanceSetting_Value `protobuf_oneof:"value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -440,6 +504,15 @@ func (x *InstanceSetting) GetAccessSetting() *InstanceAccessSetting {
return nil
}
+func (x *InstanceSetting) GetUsageLimitsSetting() *InstanceUsageLimitsSetting {
+ if x != nil {
+ if x, ok := x.Value.(*InstanceSetting_UsageLimitsSetting); ok {
+ return x.UsageLimitsSetting
+ }
+ }
+ return nil
+}
+
type isInstanceSetting_Value interface {
isInstanceSetting_Value()
}
@@ -476,6 +549,10 @@ type InstanceSetting_AccessSetting struct {
AccessSetting *InstanceAccessSetting `protobuf:"bytes,9,opt,name=access_setting,json=accessSetting,proto3,oneof"`
}
+type InstanceSetting_UsageLimitsSetting struct {
+ UsageLimitsSetting *InstanceUsageLimitsSetting `protobuf:"bytes,10,opt,name=usage_limits_setting,json=usageLimitsSetting,proto3,oneof"`
+}
+
func (*InstanceSetting_BasicSetting) isInstanceSetting_Value() {}
func (*InstanceSetting_GeneralSetting) isInstanceSetting_Value() {}
@@ -492,6 +569,8 @@ func (*InstanceSetting_AiSetting) isInstanceSetting_Value() {}
func (*InstanceSetting_AccessSetting) isInstanceSetting_Value() {}
+func (*InstanceSetting_UsageLimitsSetting) isInstanceSetting_Value() {}
+
type InstanceBasicSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The secret key for instance. Mainly used for session management.
@@ -1472,6 +1551,53 @@ func (x *InstanceAccessSetting) GetAccessMode() InstanceAccessMode {
return InstanceAccessMode_INSTANCE_ACCESS_MODE_UNSPECIFIED
}
+// InstanceUsageLimitsSetting holds every usage limit of the instance. A limit
+// applies to one user, or to every user when user_id is 0. For each metric, a
+// user's own limit replaces the default.
+type InstanceUsageLimitsSetting struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Limits []*InstanceUsageLimitsSetting_UsageLimit `protobuf:"bytes,1,rep,name=limits,proto3" json:"limits,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceUsageLimitsSetting) Reset() {
+ *x = InstanceUsageLimitsSetting{}
+ mi := &file_store_instance_setting_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceUsageLimitsSetting) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceUsageLimitsSetting) ProtoMessage() {}
+
+func (x *InstanceUsageLimitsSetting) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[15]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceUsageLimitsSetting.ProtoReflect.Descriptor instead.
+func (*InstanceUsageLimitsSetting) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *InstanceUsageLimitsSetting) GetLimits() []*InstanceUsageLimitsSetting_UsageLimit {
+ if x != nil {
+ return x.Limits
+ }
+ return nil
+}
+
type InstanceNotificationSetting_EmailSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
@@ -1490,7 +1616,7 @@ type InstanceNotificationSetting_EmailSetting struct {
func (x *InstanceNotificationSetting_EmailSetting) Reset() {
*x = InstanceNotificationSetting_EmailSetting{}
- mi := &file_store_instance_setting_proto_msgTypes[16]
+ mi := &file_store_instance_setting_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1502,7 +1628,7 @@ func (x *InstanceNotificationSetting_EmailSetting) String() string {
func (*InstanceNotificationSetting_EmailSetting) ProtoMessage() {}
func (x *InstanceNotificationSetting_EmailSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_instance_setting_proto_msgTypes[16]
+ mi := &file_store_instance_setting_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1588,11 +1714,98 @@ func (x *InstanceNotificationSetting_EmailSetting) GetUseSsl() bool {
return false
}
+type InstanceUsageLimitsSetting_UsageLimit struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // uid is the {usage_limit} segment of the usageLimits/{usage_limit} name.
+ Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
+ Metric InstanceUsageLimitsSetting_Metric `protobuf:"varint,2,opt,name=metric,proto3,enum=memos.store.InstanceUsageLimitsSetting_Metric" json:"metric,omitempty"`
+ // user_id is the user the limit applies to. 0 means every user.
+ UserId int32 `protobuf:"varint,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ // value is the limit. 0 means unlimited.
+ Value int64 `protobuf:"varint,4,opt,name=value,proto3" json:"value,omitempty"`
+ CreateTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
+ UpdateTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) Reset() {
+ *x = InstanceUsageLimitsSetting_UsageLimit{}
+ mi := &file_store_instance_setting_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*InstanceUsageLimitsSetting_UsageLimit) ProtoMessage() {}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) ProtoReflect() protoreflect.Message {
+ mi := &file_store_instance_setting_proto_msgTypes[18]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use InstanceUsageLimitsSetting_UsageLimit.ProtoReflect.Descriptor instead.
+func (*InstanceUsageLimitsSetting_UsageLimit) Descriptor() ([]byte, []int) {
+ return file_store_instance_setting_proto_rawDescGZIP(), []int{15, 0}
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) GetUid() string {
+ if x != nil {
+ return x.Uid
+ }
+ return ""
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) GetMetric() InstanceUsageLimitsSetting_Metric {
+ if x != nil {
+ return x.Metric
+ }
+ return InstanceUsageLimitsSetting_METRIC_UNSPECIFIED
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) GetUserId() int32 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) GetValue() int64 {
+ if x != nil {
+ return x.Value
+ }
+ return 0
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) GetCreateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.CreateTime
+ }
+ return nil
+}
+
+func (x *InstanceUsageLimitsSetting_UsageLimit) GetUpdateTime() *timestamppb.Timestamp {
+ if x != nil {
+ return x.UpdateTime
+ }
+ return nil
+}
+
var File_store_instance_setting_proto protoreflect.FileDescriptor
const file_store_instance_setting_proto_rawDesc = "" +
"\n" +
- "\x1cstore/instance_setting.proto\x12\vmemos.store\x1a\x17google/type/color.proto\"\xc8\x05\n" +
+ "\x1cstore/instance_setting.proto\x12\vmemos.store\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/color.proto\"\xa5\x06\n" +
"\x0fInstanceSetting\x121\n" +
"\x03key\x18\x01 \x01(\x0e2\x1f.memos.store.InstanceSettingKeyR\x03key\x12H\n" +
"\rbasic_setting\x18\x02 \x01(\v2!.memos.store.InstanceBasicSettingH\x00R\fbasicSetting\x12N\n" +
@@ -1603,7 +1816,9 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\x14notification_setting\x18\a \x01(\v2(.memos.store.InstanceNotificationSettingH\x00R\x13notificationSetting\x12?\n" +
"\n" +
"ai_setting\x18\b \x01(\v2\x1e.memos.store.InstanceAISettingH\x00R\taiSetting\x12K\n" +
- "\x0eaccess_setting\x18\t \x01(\v2\".memos.store.InstanceAccessSettingH\x00R\raccessSettingB\a\n" +
+ "\x0eaccess_setting\x18\t \x01(\v2\".memos.store.InstanceAccessSettingH\x00R\raccessSetting\x12[\n" +
+ "\x14usage_limits_setting\x18\n" +
+ " \x01(\v2'.memos.store.InstanceUsageLimitsSettingH\x00R\x12usageLimitsSettingB\a\n" +
"\x05value\"\\\n" +
"\x14InstanceBasicSetting\x12\x1d\n" +
"\n" +
@@ -1693,7 +1908,24 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\x06prompt\x18\x04 \x01(\tR\x06prompt\"Y\n" +
"\x15InstanceAccessSetting\x12@\n" +
"\vaccess_mode\x18\x01 \x01(\x0e2\x1f.memos.store.InstanceAccessModeR\n" +
- "accessMode*\xa1\x01\n" +
+ "accessMode\"\xcc\x03\n" +
+ "\x1aInstanceUsageLimitsSetting\x12J\n" +
+ "\x06limits\x18\x01 \x03(\v22.memos.store.InstanceUsageLimitsSetting.UsageLimitR\x06limits\x1a\x8f\x02\n" +
+ "\n" +
+ "UsageLimit\x12\x10\n" +
+ "\x03uid\x18\x01 \x01(\tR\x03uid\x12F\n" +
+ "\x06metric\x18\x02 \x01(\x0e2..memos.store.InstanceUsageLimitsSetting.MetricR\x06metric\x12\x17\n" +
+ "\auser_id\x18\x03 \x01(\x05R\x06userId\x12\x14\n" +
+ "\x05value\x18\x04 \x01(\x03R\x05value\x12;\n" +
+ "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\n" +
+ "createTime\x12;\n" +
+ "\vupdate_time\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\n" +
+ "updateTime\"P\n" +
+ "\x06Metric\x12\x16\n" +
+ "\x12METRIC_UNSPECIFIED\x10\x00\x12\t\n" +
+ "\x05MEMOS\x10\x01\x12\x11\n" +
+ "\rSTORAGE_BYTES\x10\x02\x12\x10\n" +
+ "\fUPLOAD_BYTES\x10\x03*\xb3\x01\n" +
"\x12InstanceSettingKey\x12$\n" +
" INSTANCE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05BASIC\x10\x01\x12\v\n" +
@@ -1704,7 +1936,8 @@ const file_store_instance_setting_proto_rawDesc = "" +
"\fNOTIFICATION\x10\x06\x12\x06\n" +
"\x02AI\x10\a\x12\n" +
"\n" +
- "\x06ACCESS\x10\b*s\n" +
+ "\x06ACCESS\x10\b\x12\x10\n" +
+ "\fUSAGE_LIMITS\x10\t*s\n" +
"\vStorageType\x12\x1c\n" +
"\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\x19\n" +
"\x15STORAGE_TYPE_DATABASE\x10\x01\x12\x16\n" +
@@ -1734,62 +1967,71 @@ func file_store_instance_setting_proto_rawDescGZIP() []byte {
return file_store_instance_setting_proto_rawDescData
}
-var file_store_instance_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 5)
-var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
+var file_store_instance_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
+var file_store_instance_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
var file_store_instance_setting_proto_goTypes = []any{
(InstanceSettingKey)(0), // 0: memos.store.InstanceSettingKey
(StorageType)(0), // 1: memos.store.StorageType
(AIProviderType)(0), // 2: memos.store.AIProviderType
(InstanceAccessMode)(0), // 3: memos.store.InstanceAccessMode
(InstanceStorageSetting_StorageType)(0), // 4: memos.store.InstanceStorageSetting.StorageType
- (*InstanceSetting)(nil), // 5: memos.store.InstanceSetting
- (*InstanceBasicSetting)(nil), // 6: memos.store.InstanceBasicSetting
- (*InstanceGeneralSetting)(nil), // 7: memos.store.InstanceGeneralSetting
- (*InstanceCustomProfile)(nil), // 8: memos.store.InstanceCustomProfile
- (*Storage)(nil), // 9: memos.store.Storage
- (*InstanceStorageSetting)(nil), // 10: memos.store.InstanceStorageSetting
- (*StorageS3Config)(nil), // 11: memos.store.StorageS3Config
- (*InstanceMemoRelatedSetting)(nil), // 12: memos.store.InstanceMemoRelatedSetting
- (*InstanceTagMetadata)(nil), // 13: memos.store.InstanceTagMetadata
- (*InstanceTagsSetting)(nil), // 14: memos.store.InstanceTagsSetting
- (*InstanceNotificationSetting)(nil), // 15: memos.store.InstanceNotificationSetting
- (*InstanceAISetting)(nil), // 16: memos.store.InstanceAISetting
- (*AIProviderConfig)(nil), // 17: memos.store.AIProviderConfig
- (*TranscriptionConfig)(nil), // 18: memos.store.TranscriptionConfig
- (*InstanceAccessSetting)(nil), // 19: memos.store.InstanceAccessSetting
- nil, // 20: memos.store.InstanceTagsSetting.TagsEntry
- (*InstanceNotificationSetting_EmailSetting)(nil), // 21: memos.store.InstanceNotificationSetting.EmailSetting
- (*color.Color)(nil), // 22: google.type.Color
+ (InstanceUsageLimitsSetting_Metric)(0), // 5: memos.store.InstanceUsageLimitsSetting.Metric
+ (*InstanceSetting)(nil), // 6: memos.store.InstanceSetting
+ (*InstanceBasicSetting)(nil), // 7: memos.store.InstanceBasicSetting
+ (*InstanceGeneralSetting)(nil), // 8: memos.store.InstanceGeneralSetting
+ (*InstanceCustomProfile)(nil), // 9: memos.store.InstanceCustomProfile
+ (*Storage)(nil), // 10: memos.store.Storage
+ (*InstanceStorageSetting)(nil), // 11: memos.store.InstanceStorageSetting
+ (*StorageS3Config)(nil), // 12: memos.store.StorageS3Config
+ (*InstanceMemoRelatedSetting)(nil), // 13: memos.store.InstanceMemoRelatedSetting
+ (*InstanceTagMetadata)(nil), // 14: memos.store.InstanceTagMetadata
+ (*InstanceTagsSetting)(nil), // 15: memos.store.InstanceTagsSetting
+ (*InstanceNotificationSetting)(nil), // 16: memos.store.InstanceNotificationSetting
+ (*InstanceAISetting)(nil), // 17: memos.store.InstanceAISetting
+ (*AIProviderConfig)(nil), // 18: memos.store.AIProviderConfig
+ (*TranscriptionConfig)(nil), // 19: memos.store.TranscriptionConfig
+ (*InstanceAccessSetting)(nil), // 20: memos.store.InstanceAccessSetting
+ (*InstanceUsageLimitsSetting)(nil), // 21: memos.store.InstanceUsageLimitsSetting
+ nil, // 22: memos.store.InstanceTagsSetting.TagsEntry
+ (*InstanceNotificationSetting_EmailSetting)(nil), // 23: memos.store.InstanceNotificationSetting.EmailSetting
+ (*InstanceUsageLimitsSetting_UsageLimit)(nil), // 24: memos.store.InstanceUsageLimitsSetting.UsageLimit
+ (*color.Color)(nil), // 25: google.type.Color
+ (*timestamppb.Timestamp)(nil), // 26: google.protobuf.Timestamp
}
var file_store_instance_setting_proto_depIdxs = []int32{
0, // 0: memos.store.InstanceSetting.key:type_name -> memos.store.InstanceSettingKey
- 6, // 1: memos.store.InstanceSetting.basic_setting:type_name -> memos.store.InstanceBasicSetting
- 7, // 2: memos.store.InstanceSetting.general_setting:type_name -> memos.store.InstanceGeneralSetting
- 10, // 3: memos.store.InstanceSetting.storage_setting:type_name -> memos.store.InstanceStorageSetting
- 12, // 4: memos.store.InstanceSetting.memo_related_setting:type_name -> memos.store.InstanceMemoRelatedSetting
- 14, // 5: memos.store.InstanceSetting.tags_setting:type_name -> memos.store.InstanceTagsSetting
- 15, // 6: memos.store.InstanceSetting.notification_setting:type_name -> memos.store.InstanceNotificationSetting
- 16, // 7: memos.store.InstanceSetting.ai_setting:type_name -> memos.store.InstanceAISetting
- 19, // 8: memos.store.InstanceSetting.access_setting:type_name -> memos.store.InstanceAccessSetting
- 8, // 9: memos.store.InstanceGeneralSetting.custom_profile:type_name -> memos.store.InstanceCustomProfile
- 1, // 10: memos.store.Storage.type:type_name -> memos.store.StorageType
- 11, // 11: memos.store.Storage.s3_config:type_name -> memos.store.StorageS3Config
- 4, // 12: memos.store.InstanceStorageSetting.storage_type:type_name -> memos.store.InstanceStorageSetting.StorageType
- 11, // 13: memos.store.InstanceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
- 9, // 14: memos.store.InstanceStorageSetting.storages:type_name -> memos.store.Storage
- 22, // 15: memos.store.InstanceTagMetadata.background_color:type_name -> google.type.Color
- 20, // 16: memos.store.InstanceTagsSetting.tags:type_name -> memos.store.InstanceTagsSetting.TagsEntry
- 21, // 17: memos.store.InstanceNotificationSetting.email:type_name -> memos.store.InstanceNotificationSetting.EmailSetting
- 17, // 18: memos.store.InstanceAISetting.providers:type_name -> memos.store.AIProviderConfig
- 18, // 19: memos.store.InstanceAISetting.transcription:type_name -> memos.store.TranscriptionConfig
- 2, // 20: memos.store.AIProviderConfig.type:type_name -> memos.store.AIProviderType
- 3, // 21: memos.store.InstanceAccessSetting.access_mode:type_name -> memos.store.InstanceAccessMode
- 13, // 22: memos.store.InstanceTagsSetting.TagsEntry.value:type_name -> memos.store.InstanceTagMetadata
- 23, // [23:23] is the sub-list for method output_type
- 23, // [23:23] is the sub-list for method input_type
- 23, // [23:23] is the sub-list for extension type_name
- 23, // [23:23] is the sub-list for extension extendee
- 0, // [0:23] is the sub-list for field type_name
+ 7, // 1: memos.store.InstanceSetting.basic_setting:type_name -> memos.store.InstanceBasicSetting
+ 8, // 2: memos.store.InstanceSetting.general_setting:type_name -> memos.store.InstanceGeneralSetting
+ 11, // 3: memos.store.InstanceSetting.storage_setting:type_name -> memos.store.InstanceStorageSetting
+ 13, // 4: memos.store.InstanceSetting.memo_related_setting:type_name -> memos.store.InstanceMemoRelatedSetting
+ 15, // 5: memos.store.InstanceSetting.tags_setting:type_name -> memos.store.InstanceTagsSetting
+ 16, // 6: memos.store.InstanceSetting.notification_setting:type_name -> memos.store.InstanceNotificationSetting
+ 17, // 7: memos.store.InstanceSetting.ai_setting:type_name -> memos.store.InstanceAISetting
+ 20, // 8: memos.store.InstanceSetting.access_setting:type_name -> memos.store.InstanceAccessSetting
+ 21, // 9: memos.store.InstanceSetting.usage_limits_setting:type_name -> memos.store.InstanceUsageLimitsSetting
+ 9, // 10: memos.store.InstanceGeneralSetting.custom_profile:type_name -> memos.store.InstanceCustomProfile
+ 1, // 11: memos.store.Storage.type:type_name -> memos.store.StorageType
+ 12, // 12: memos.store.Storage.s3_config:type_name -> memos.store.StorageS3Config
+ 4, // 13: memos.store.InstanceStorageSetting.storage_type:type_name -> memos.store.InstanceStorageSetting.StorageType
+ 12, // 14: memos.store.InstanceStorageSetting.s3_config:type_name -> memos.store.StorageS3Config
+ 10, // 15: memos.store.InstanceStorageSetting.storages:type_name -> memos.store.Storage
+ 25, // 16: memos.store.InstanceTagMetadata.background_color:type_name -> google.type.Color
+ 22, // 17: memos.store.InstanceTagsSetting.tags:type_name -> memos.store.InstanceTagsSetting.TagsEntry
+ 23, // 18: memos.store.InstanceNotificationSetting.email:type_name -> memos.store.InstanceNotificationSetting.EmailSetting
+ 18, // 19: memos.store.InstanceAISetting.providers:type_name -> memos.store.AIProviderConfig
+ 19, // 20: memos.store.InstanceAISetting.transcription:type_name -> memos.store.TranscriptionConfig
+ 2, // 21: memos.store.AIProviderConfig.type:type_name -> memos.store.AIProviderType
+ 3, // 22: memos.store.InstanceAccessSetting.access_mode:type_name -> memos.store.InstanceAccessMode
+ 24, // 23: memos.store.InstanceUsageLimitsSetting.limits:type_name -> memos.store.InstanceUsageLimitsSetting.UsageLimit
+ 14, // 24: memos.store.InstanceTagsSetting.TagsEntry.value:type_name -> memos.store.InstanceTagMetadata
+ 5, // 25: memos.store.InstanceUsageLimitsSetting.UsageLimit.metric:type_name -> memos.store.InstanceUsageLimitsSetting.Metric
+ 26, // 26: memos.store.InstanceUsageLimitsSetting.UsageLimit.create_time:type_name -> google.protobuf.Timestamp
+ 26, // 27: memos.store.InstanceUsageLimitsSetting.UsageLimit.update_time:type_name -> google.protobuf.Timestamp
+ 28, // [28:28] is the sub-list for method output_type
+ 28, // [28:28] is the sub-list for method input_type
+ 28, // [28:28] is the sub-list for extension type_name
+ 28, // [28:28] is the sub-list for extension extendee
+ 0, // [0:28] is the sub-list for field type_name
}
func init() { file_store_instance_setting_proto_init() }
@@ -1806,6 +2048,7 @@ func file_store_instance_setting_proto_init() {
(*InstanceSetting_NotificationSetting)(nil),
(*InstanceSetting_AiSetting)(nil),
(*InstanceSetting_AccessSetting)(nil),
+ (*InstanceSetting_UsageLimitsSetting)(nil),
}
file_store_instance_setting_proto_msgTypes[4].OneofWrappers = []any{
(*Storage_S3Config)(nil),
@@ -1815,8 +2058,8 @@ func file_store_instance_setting_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_instance_setting_proto_rawDesc), len(file_store_instance_setting_proto_rawDesc)),
- NumEnums: 5,
- NumMessages: 17,
+ NumEnums: 6,
+ NumMessages: 19,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/proto/store/instance_setting.proto b/proto/store/instance_setting.proto
index d7d9874dc..0b13a4306 100644
--- a/proto/store/instance_setting.proto
+++ b/proto/store/instance_setting.proto
@@ -2,6 +2,7 @@ syntax = "proto3";
package memos.store;
+import "google/protobuf/timestamp.proto";
import "google/type/color.proto";
option go_package = "gen/store";
@@ -24,6 +25,9 @@ enum InstanceSettingKey {
AI = 7;
// ACCESS is the key for instance access policy settings.
ACCESS = 8;
+ // USAGE_LIMITS is the key for per-user usage limits. Store only; exposed
+ // through the usageLimits API, never through the instance settings API.
+ USAGE_LIMITS = 9;
}
message InstanceSetting {
@@ -37,6 +41,7 @@ message InstanceSetting {
InstanceNotificationSetting notification_setting = 7;
InstanceAISetting ai_setting = 8;
InstanceAccessSetting access_setting = 9;
+ InstanceUsageLimitsSetting usage_limits_setting = 10;
}
}
@@ -245,3 +250,34 @@ enum InstanceAccessMode {
message InstanceAccessSetting {
InstanceAccessMode access_mode = 1;
}
+
+// InstanceUsageLimitsSetting holds every usage limit of the instance. A limit
+// applies to one user, or to every user when user_id is 0. For each metric, a
+// user's own limit replaces the default.
+message InstanceUsageLimitsSetting {
+ repeated UsageLimit limits = 1;
+
+ message UsageLimit {
+ // uid is the {usage_limit} segment of the usageLimits/{usage_limit} name.
+ string uid = 1;
+ Metric metric = 2;
+ // user_id is the user the limit applies to. 0 means every user.
+ int32 user_id = 3;
+ // value is the limit. 0 means unlimited.
+ int64 value = 4;
+ google.protobuf.Timestamp create_time = 5;
+ google.protobuf.Timestamp update_time = 6;
+ }
+
+ enum Metric {
+ METRIC_UNSPECIFIED = 0;
+ // MEMOS limits the number of memos a user created, comments included.
+ MEMOS = 1;
+ // STORAGE_BYTES limits the total size of a user's uploads. External links
+ // do not count.
+ STORAGE_BYTES = 2;
+ // UPLOAD_BYTES limits the size of one uploaded file. It can only lower the
+ // instance upload limit.
+ UPLOAD_BYTES = 3;
+ }
+}
diff --git a/server/api/attachment_service.go b/server/api/attachment_service.go
index e4908ff62..70fc9c26c 100644
--- a/server/api/attachment_service.go
+++ b/server/api/attachment_service.go
@@ -179,6 +179,9 @@ func (s *APIService) CreateAttachment(ctx context.Context, request *apipb.Create
if err := checkUploadSize(instanceStorageSetting, int64(len(content))); err != nil {
return nil, err
}
+ if err := s.checkUploadQuota(ctx, create.CreatorID, int64(len(content)), instanceStorageSetting); err != nil {
+ return nil, err
+ }
create.Size = int64(len(content))
return s.processAndSaveAttachment(ctx, create, instanceStorageSetting, bytes.NewReader(content))
}
@@ -191,8 +194,8 @@ func attachmentUploadLimit(setting *storepb.InstanceStorageSetting) int64 {
}
func checkUploadSize(setting *storepb.InstanceStorageSetting, size int64) error {
- if size > attachmentUploadLimit(setting) {
- return status.Errorf(codes.ResourceExhausted, "file size exceeds the limit")
+ if limit := attachmentUploadLimit(setting); size > limit {
+ return newFileTooLargeError(limit, size)
}
return nil
}
diff --git a/server/api/attachment_upload.go b/server/api/attachment_upload.go
index 374c87bd3..0e19b10b2 100644
--- a/server/api/attachment_upload.go
+++ b/server/api/attachment_upload.go
@@ -86,6 +86,11 @@ func (s *APIService) UploadAttachment(ctx context.Context, request *apipb.Upload
if err == nil {
upload.complete = true
os.Remove(upload.path)
+ } else if isQuotaExceeded(err) {
+ // A refused upload cannot succeed by retrying the finish: drop its
+ // bytes and revoke it, so nothing of it stays stored.
+ os.Remove(upload.path)
+ upload.expireTime = time.Time{}
}
}
if err != nil {
@@ -123,6 +128,9 @@ func (s *APIService) startAttachmentUpload(ctx context.Context, request *apipb.U
if err := checkUploadSize(setting, spec.TotalSize); err != nil {
return "", nil, err
}
+ if err := s.checkUploadQuota(ctx, ownerID, spec.TotalSize, setting); err != nil {
+ return "", nil, err
+ }
// Validate before allocating a temporary file. Keep the original MIME type
// so an omitted type can be sniffed from real bytes at finalization.
metadata := proto.CloneOf(spec.Attachment)
@@ -161,6 +169,11 @@ func (s *APIService) finishAttachmentUpload(ctx context.Context, upload *attachm
if err := checkUploadSize(setting, upload.totalSize); err != nil {
return nil, err
}
+ // Check again at finish: other uploads of the same user may have finished
+ // since this one started.
+ if err := s.checkUploadQuota(ctx, upload.ownerID, upload.totalSize, setting); err != nil {
+ return nil, err
+ }
file, err := os.Open(upload.path)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to open upload file: %v", err)
diff --git a/server/api/connect_services.go b/server/api/connect_services.go
index 06fcdb259..66b7599ae 100644
--- a/server/api/connect_services.go
+++ b/server/api/connect_services.go
@@ -64,6 +64,46 @@ func (s *ConnectServiceHandler) GetInstanceStats(ctx context.Context, req *conne
return connect.NewResponse(resp), nil
}
+func (s *ConnectServiceHandler) ListUsageLimits(ctx context.Context, req *connect.Request[apipb.ListUsageLimitsRequest]) (*connect.Response[apipb.ListUsageLimitsResponse], error) {
+ resp, err := s.APIService.ListUsageLimits(ctx, req.Msg)
+ if err != nil {
+ return nil, convertGRPCError(err)
+ }
+ return connect.NewResponse(resp), nil
+}
+
+func (s *ConnectServiceHandler) GetUsageLimit(ctx context.Context, req *connect.Request[apipb.GetUsageLimitRequest]) (*connect.Response[apipb.UsageLimit], error) {
+ resp, err := s.APIService.GetUsageLimit(ctx, req.Msg)
+ if err != nil {
+ return nil, convertGRPCError(err)
+ }
+ return connect.NewResponse(resp), nil
+}
+
+func (s *ConnectServiceHandler) CreateUsageLimit(ctx context.Context, req *connect.Request[apipb.CreateUsageLimitRequest]) (*connect.Response[apipb.UsageLimit], error) {
+ resp, err := s.APIService.CreateUsageLimit(ctx, req.Msg)
+ if err != nil {
+ return nil, convertGRPCError(err)
+ }
+ return connect.NewResponse(resp), nil
+}
+
+func (s *ConnectServiceHandler) UpdateUsageLimit(ctx context.Context, req *connect.Request[apipb.UpdateUsageLimitRequest]) (*connect.Response[apipb.UsageLimit], error) {
+ resp, err := s.APIService.UpdateUsageLimit(ctx, req.Msg)
+ if err != nil {
+ return nil, convertGRPCError(err)
+ }
+ return connect.NewResponse(resp), nil
+}
+
+func (s *ConnectServiceHandler) DeleteUsageLimit(ctx context.Context, req *connect.Request[apipb.DeleteUsageLimitRequest]) (*connect.Response[emptypb.Empty], error) {
+ resp, err := s.APIService.DeleteUsageLimit(ctx, req.Msg)
+ if err != nil {
+ return nil, convertGRPCError(err)
+ }
+ return connect.NewResponse(resp), nil
+}
+
// AuthService
//
// Auth service methods need special handling for response headers (cookies).
@@ -158,6 +198,14 @@ func (s *ConnectServiceHandler) GetUserStats(ctx context.Context, req *connect.R
return connect.NewResponse(resp), nil
}
+func (s *ConnectServiceHandler) GetUserUsage(ctx context.Context, req *connect.Request[apipb.GetUserUsageRequest]) (*connect.Response[apipb.UserUsage], error) {
+ resp, err := s.APIService.GetUserUsage(ctx, req.Msg)
+ if err != nil {
+ return nil, convertGRPCError(err)
+ }
+ return connect.NewResponse(resp), nil
+}
+
func (s *ConnectServiceHandler) ExportMemos(ctx context.Context, req *connect.Request[apipb.ExportMemosRequest]) (*connect.Response[httpbody.HttpBody], error) {
resp, err := s.APIService.ExportMemos(ctx, req.Msg)
if err != nil {
diff --git a/server/api/instance_service.go b/server/api/instance_service.go
index 21e948db5..3dc8702aa 100644
--- a/server/api/instance_service.go
+++ b/server/api/instance_service.go
@@ -207,6 +207,10 @@ func (s *APIService) UpdateInstanceSetting(ctx context.Context, request *apipb.U
return nil, status.Errorf(codes.InvalidArgument, "invalid instance setting name: %v", err)
}
settingKey := storepb.InstanceSettingKey(storepb.InstanceSettingKey_value[settingKeyString])
+ if settingKey == storepb.InstanceSettingKey_USAGE_LIMITS {
+ // Usage limits are store only; the usageLimits RPCs are their only API.
+ return nil, status.Errorf(codes.InvalidArgument, "unsupported instance setting key: %v", settingKey)
+ }
if s.Store.IsInstanceSettingDeploymentConfigured(settingKey) {
return nil, status.Errorf(codes.FailedPrecondition, "instance setting %q is configured by the deployment", settingKeyString)
}
diff --git a/server/api/memo_create_helpers.go b/server/api/memo_create_helpers.go
index a7109a2cc..e9d2ff015 100644
--- a/server/api/memo_create_helpers.go
+++ b/server/api/memo_create_helpers.go
@@ -67,7 +67,7 @@ func (s *APIService) prepareMemoCreate(ctx context.Context, user *store.User, in
return nil, status.Error(codes.Internal, "failed to get content length limit")
}
if len(memo.Content) > contentLengthLimit {
- return nil, status.Errorf(codes.InvalidArgument, "content too long (max %d characters)", contentLengthLimit)
+ return nil, status.Errorf(codes.InvalidArgument, "content too long (max %d bytes)", contentLengthLimit)
}
if err := memopayload.RebuildMemoPayload(ctx, memo, s.MarkdownService); err != nil {
return nil, status.Errorf(codes.Internal, "failed to rebuild memo payload: %v", err)
diff --git a/server/api/memo_service.go b/server/api/memo_service.go
index 80a7a8f9b..2ddb822b1 100644
--- a/server/api/memo_service.go
+++ b/server/api/memo_service.go
@@ -46,6 +46,9 @@ func (s *APIService) CreateMemo(ctx context.Context, request *apipb.CreateMemoRe
if err != nil {
return nil, err
}
+ if err := s.checkMemoQuota(ctx, user); err != nil {
+ return nil, err
+ }
if err := s.createMemoWithMutation(ctx, user, prepared.memo, nil, prepared.attachments, prepared.requiredAttachmentIDs, prepared.referenceRelations); err != nil {
return nil, mapMemoCreateError(err, memoUID, "failed to create memo")
@@ -387,7 +390,7 @@ func (s *APIService) UpdateMemo(ctx context.Context, request *apipb.UpdateMemoRe
return nil, status.Errorf(codes.Internal, "failed to get content length limit")
}
if len(request.Memo.Content) > contentLengthLimit {
- return nil, status.Errorf(codes.InvalidArgument, "content too long (max %d characters)", contentLengthLimit)
+ return nil, status.Errorf(codes.InvalidArgument, "content too long (max %d bytes)", contentLengthLimit)
}
nextMemo.Content = request.Memo.Content
if err := memopayload.RebuildMemoPayload(ctx, &nextMemo, s.MarkdownService); err != nil {
diff --git a/server/api/memo_service_comments.go b/server/api/memo_service_comments.go
index a5025832b..eff40b421 100644
--- a/server/api/memo_service_comments.go
+++ b/server/api/memo_service_comments.go
@@ -61,6 +61,10 @@ func (s *APIService) CreateMemoComment(ctx context.Context, request *apipb.Creat
if err != nil {
return nil, err
}
+ // A comment is a memo row, so it counts against the memo limit too.
+ if err := s.checkMemoQuota(ctx, user); err != nil {
+ return nil, err
+ }
if err := s.createMemoWithMutation(ctx, user, prepared.memo, &relatedMemo.ID, prepared.attachments, prepared.requiredAttachmentIDs, prepared.referenceRelations); err != nil {
return nil, mapMemoCreateError(err, memoUID, "failed to create memo comment")
}
diff --git a/server/api/ratelimit.go b/server/api/ratelimit.go
index bc8c732e5..13bed8d54 100644
--- a/server/api/ratelimit.go
+++ b/server/api/ratelimit.go
@@ -15,6 +15,7 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/durationpb"
+ "github.com/usememos/memos/core/usagelimit"
"github.com/usememos/memos/internal/clientip"
"github.com/usememos/memos/internal/identifier"
"github.com/usememos/memos/internal/ratelimit"
@@ -28,12 +29,19 @@ const (
// type ("memos.api/Memo"), so reasons and resources share one name.
errorInfoDomain = "memos.api"
// reasonRateLimited marks a refusal that recovers on its own after the
- // advertised delay. Metering will use QUOTA_EXCEEDED for refusals that do not.
+ // advertised delay.
reasonRateLimited = "RATE_LIMITED"
+ // reasonQuotaExceeded marks a refusal by a usage limit. It does not recover
+ // with time: the user must free space or an admin must raise the limit.
+ reasonQuotaExceeded = "QUOTA_EXCEEDED"
+ // reasonFileTooLarge marks a file larger than the instance upload limit,
+ // which applies to every user.
+ reasonFileTooLarge = "FILE_TOO_LARGE"
// reasonChallengeRequired marks a request that must carry a valid challenge token.
reasonChallengeRequired = "CHALLENGE_REQUIRED"
- rateLimitMessage = "too many requests, try again later"
+ rateLimitMessage = "too many requests, try again later"
+ quotaExceededMessage = "quota exceeded"
// challengeTokenHeader carries the proof-of-humanity token on the wire; both
// transports forward it to metadata under challengeTokenMetadataKey.
@@ -67,6 +75,83 @@ func newRateLimitError(scope ratelimit.Scope, decision ratelimit.Decision) error
return detailed.Err()
}
+// newQuotaExceededError builds the refusal for an action that would exceed a
+// usage limit: RESOURCE_EXHAUSTED with an ErrorInfo carrying the metric, the
+// limit, the usage and the usage limit that applied, and a QuotaFailure naming
+// the user. It carries no RetryInfo, because waiting does not help.
+func newQuotaExceededError(username string, refusal *usagelimit.Refusal) error {
+ st := status.New(codes.ResourceExhausted, quotaExceededMessage)
+ detailed, err := st.WithDetails(
+ &errdetails.ErrorInfo{
+ Reason: reasonQuotaExceeded,
+ Domain: errorInfoDomain,
+ Metadata: map[string]string{
+ "metric": refusal.Metric.String(),
+ "limit": strconv.FormatInt(refusal.Limit, 10),
+ "usage": strconv.FormatInt(refusal.Usage, 10),
+ "usage_limit": UsageLimitNamePrefix + refusal.Source,
+ },
+ },
+ &errdetails.QuotaFailure{
+ Violations: []*errdetails.QuotaFailure_Violation{{
+ Subject: BuildUserName(username),
+ Description: quotaExceededDescription(refusal),
+ }},
+ },
+ )
+ if err != nil {
+ return st.Err()
+ }
+ return detailed.Err()
+}
+
+// newFileTooLargeError builds the refusal for a file larger than the instance
+// upload limit: RESOURCE_EXHAUSTED with an ErrorInfo carrying the limit and
+// the file size in bytes. It carries no RetryInfo, because waiting does not
+// make the file fit.
+func newFileTooLargeError(limit, size int64) error {
+ st := status.New(codes.ResourceExhausted, "file size exceeds the limit")
+ detailed, err := st.WithDetails(&errdetails.ErrorInfo{
+ Reason: reasonFileTooLarge,
+ Domain: errorInfoDomain,
+ Metadata: map[string]string{
+ "limit": strconv.FormatInt(limit, 10),
+ "size": strconv.FormatInt(size, 10),
+ },
+ })
+ if err != nil {
+ return st.Err()
+ }
+ return detailed.Err()
+}
+
+func quotaExceededDescription(refusal *usagelimit.Refusal) string {
+ switch refusal.Metric {
+ case usagelimit.MetricMemos:
+ return "You have reached the limit of " + strconv.FormatInt(refusal.Limit, 10) + " memos."
+ case usagelimit.MetricStorageBytes:
+ return "This upload would exceed your storage limit of " + strconv.FormatInt(refusal.Limit, 10) + " bytes."
+ case usagelimit.MetricUploadBytes:
+ return "The file is larger than the limit of " + strconv.FormatInt(refusal.Limit, 10) + " bytes per file."
+ default:
+ return "A usage limit was reached."
+ }
+}
+
+// isQuotaExceeded reports whether err is a usage limit refusal.
+func isQuotaExceeded(err error) bool {
+ st, ok := status.FromError(err)
+ if !ok || st.Code() != codes.ResourceExhausted {
+ return false
+ }
+ for _, detail := range st.Details() {
+ if info, ok := detail.(*errdetails.ErrorInfo); ok && info.GetReason() == reasonQuotaExceeded {
+ return true
+ }
+ }
+ return false
+}
+
// newChallengeRequiredError builds the refusal for a missing or failed challenge
// token. It uses a different code from rate limiting so a client renders the
// widget instead of waiting.
diff --git a/server/api/resource_name.go b/server/api/resource_name.go
index 21dce301e..aa369a97d 100644
--- a/server/api/resource_name.go
+++ b/server/api/resource_name.go
@@ -27,6 +27,7 @@ const (
SpaceNamePrefix = "spaces/"
SpaceMemberNamePrefix = "members/"
SpaceInvitationNamePrefix = "invitations/"
+ UsageLimitNamePrefix = "usageLimits/"
)
// GetNameParentTokens returns the tokens from a resource name.
@@ -171,6 +172,16 @@ func ExtractIdentityProviderUIDFromName(name string) (string, error) {
return tokens[0], nil
}
+// ExtractUsageLimitIDFromName returns the usage limit ID from a resource name.
+// e.g., "usageLimits/default-memos" -> "default-memos".
+func ExtractUsageLimitIDFromName(name string) (string, error) {
+ tokens, err := GetNameParentTokens(name, UsageLimitNamePrefix)
+ if err != nil {
+ return "", err
+ }
+ return tokens[0], nil
+}
+
// ValidateAndGenerateUID validates a user-provided UID or generates a new one.
// If provided is empty, a new shortuuid is generated.
// If provided is non-empty, it is validated against identifier.UIDMatcher.
diff --git a/server/api/test/configuration_provisioning_test.go b/server/api/test/configuration_provisioning_test.go
index 0619e7241..1b0c6f275 100644
--- a/server/api/test/configuration_provisioning_test.go
+++ b/server/api/test/configuration_provisioning_test.go
@@ -49,7 +49,7 @@ func TestDeploymentConfiguredResourcesRejectMutations(t *testing.T) {
require.Equal(t, int32(1), setting.GetGeneralSetting().WeekStartDayOffset)
storageSetting, err := ts.Service.GetInstanceSetting(adminCtx, &apipb.GetInstanceSettingRequest{Name: "instance/settings/STORAGE"})
require.NoError(t, err)
- require.Equal(t, int64(30), storageSetting.GetStorageSetting().UploadSizeLimitMb)
+ require.Equal(t, int64(32), storageSetting.GetStorageSetting().UploadSizeLimitMb)
require.Equal(t, "assets/{timestamp}_{uuid}_{filename}", storageSetting.GetStorageSetting().FilepathTemplate)
_, err = ts.Service.CreateIdentityProvider(adminCtx, &apipb.CreateIdentityProviderRequest{
diff --git a/server/api/test/usage_limit_service_test.go b/server/api/test/usage_limit_service_test.go
new file mode 100644
index 000000000..673ce1d3f
--- /dev/null
+++ b/server/api/test/usage_limit_service_test.go
@@ -0,0 +1,444 @@
+package test
+
+import (
+ "context"
+ "os"
+ "path/filepath"
+ "strconv"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+ "google.golang.org/genproto/googleapis/rpc/errdetails"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/types/known/fieldmaskpb"
+
+ apipb "github.com/usememos/memos/proto/gen/api"
+ storepb "github.com/usememos/memos/proto/gen/store"
+ "github.com/usememos/memos/server/api"
+ "github.com/usememos/memos/store"
+)
+
+func createUsageLimit(ctx context.Context, t *testing.T, ts *TestService, id string, metric apipb.UsageLimit_Metric, user string, value int64) *apipb.UsageLimit {
+ t.Helper()
+ limit, err := ts.Service.CreateUsageLimit(ctx, &apipb.CreateUsageLimitRequest{
+ UsageLimitId: id,
+ UsageLimit: &apipb.UsageLimit{Metric: metric, User: user, Value: value},
+ })
+ require.NoError(t, err)
+ return limit
+}
+
+// requireQuotaExceeded checks the usage limit error contract and returns the
+// ErrorInfo metadata.
+func requireQuotaExceeded(t *testing.T, err error, metric, subject string) map[string]string {
+ t.Helper()
+ st := status.Convert(err)
+ require.Equal(t, codes.ResourceExhausted, st.Code(), "got %v", err)
+ require.Equal(t, "quota exceeded", st.Message())
+ var info *errdetails.ErrorInfo
+ var failure *errdetails.QuotaFailure
+ for _, detail := range st.Details() {
+ switch d := detail.(type) {
+ case *errdetails.ErrorInfo:
+ info = d
+ case *errdetails.QuotaFailure:
+ failure = d
+ case *errdetails.RetryInfo:
+ t.Fatal("a usage limit refusal must not carry RetryInfo")
+ default:
+ }
+ }
+ require.NotNil(t, info)
+ require.Equal(t, "QUOTA_EXCEEDED", info.Reason)
+ require.Equal(t, "memos.api", info.Domain)
+ require.Equal(t, metric, info.Metadata["metric"])
+ require.NotNil(t, failure)
+ require.Len(t, failure.Violations, 1)
+ require.Equal(t, subject, failure.Violations[0].Subject)
+ require.NotEmpty(t, failure.Violations[0].Description)
+ return info.Metadata
+}
+
+func TestUsageLimitServicePermissions(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+ admin, err := ts.CreateHostUser(ctx, "limits-admin")
+ require.NoError(t, err)
+ user, err := ts.CreateRegularUser(ctx, "limits-user")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, admin.ID)
+ limit := createUsageLimit(adminCtx, t, ts, "default-memos", apipb.UsageLimit_MEMOS, "", 10)
+
+ for _, caller := range []struct {
+ ctx context.Context
+ code codes.Code
+ }{
+ {ctx: ts.CreateUserContext(ctx, user.ID), code: codes.PermissionDenied},
+ {ctx: ctx, code: codes.Unauthenticated},
+ } {
+ _, err := ts.Service.ListUsageLimits(caller.ctx, &apipb.ListUsageLimitsRequest{})
+ require.Equal(t, caller.code, status.Code(err))
+ _, err = ts.Service.GetUsageLimit(caller.ctx, &apipb.GetUsageLimitRequest{Name: limit.Name})
+ require.Equal(t, caller.code, status.Code(err))
+ _, err = ts.Service.CreateUsageLimit(caller.ctx, &apipb.CreateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_STORAGE_BYTES, Value: 1}})
+ require.Equal(t, caller.code, status.Code(err))
+ _, err = ts.Service.UpdateUsageLimit(caller.ctx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: limit.Name, Value: 1}})
+ require.Equal(t, caller.code, status.Code(err))
+ _, err = ts.Service.DeleteUsageLimit(caller.ctx, &apipb.DeleteUsageLimitRequest{Name: limit.Name})
+ require.Equal(t, caller.code, status.Code(err))
+ }
+
+ // The row never leaks through the instance settings API.
+ _, err = ts.Service.GetInstanceSetting(adminCtx, &apipb.GetInstanceSettingRequest{Name: "instance/settings/USAGE_LIMITS"})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ _, err = ts.Service.UpdateInstanceSetting(adminCtx, &apipb.UpdateInstanceSettingRequest{InstanceSetting: &apipb.InstanceSetting{Name: "instance/settings/USAGE_LIMITS"}})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ got, err := ts.Service.GetUsageLimit(adminCtx, &apipb.GetUsageLimitRequest{Name: limit.Name})
+ require.NoError(t, err)
+ require.Equal(t, int64(10), got.Value, "a refused settings update leaves the limits unchanged")
+}
+
+func TestUsageLimitServiceCRUD(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+ admin, err := ts.CreateHostUser(ctx, "crud-admin")
+ require.NoError(t, err)
+ alice, err := ts.CreateRegularUser(ctx, "crud-alice")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, admin.ID)
+ aliceName := api.BuildUserName(alice.Username)
+
+ defaultStorage := createUsageLimit(adminCtx, t, ts, "default-storage", apipb.UsageLimit_STORAGE_BYTES, "", 1<<30)
+ require.Equal(t, "usageLimits/default-storage", defaultStorage.Name)
+ require.Empty(t, defaultStorage.User)
+ require.NotNil(t, defaultStorage.CreateTime)
+ aliceStorage := createUsageLimit(adminCtx, t, ts, "", apipb.UsageLimit_STORAGE_BYTES, aliceName, 5<<30)
+ require.Regexp(t, `^usageLimits/limit-[a-z2-7]{12}$`, aliceStorage.Name, "an ID is generated when none is given")
+ require.Equal(t, aliceName, aliceStorage.User)
+ createUsageLimit(adminCtx, t, ts, "default-memos", apipb.UsageLimit_MEMOS, "", 1000)
+
+ for name, request := range map[string]*apipb.CreateUsageLimitRequest{
+ "negative value": {UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_MEMOS, User: aliceName, Value: -1}},
+ "no metric": {UsageLimit: &apipb.UsageLimit{User: aliceName, Value: 1}},
+ "bad user name": {UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_MEMOS, User: "people/alice", Value: 1}},
+ "bad ID": {UsageLimitId: "Alice_Memos", UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_MEMOS, Value: 1}},
+ "long ID": {UsageLimitId: "a-very-long-usage-limit-identifier-x", UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_MEMOS, Value: 1}},
+ "missing limit": {},
+ } {
+ _, err := ts.Service.CreateUsageLimit(adminCtx, request)
+ require.Equal(t, codes.InvalidArgument, status.Code(err), name)
+ }
+ _, err = ts.Service.CreateUsageLimit(adminCtx, &apipb.CreateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_MEMOS, User: "users/nobody", Value: 1}})
+ require.Equal(t, codes.NotFound, status.Code(err))
+ _, err = ts.Service.CreateUsageLimit(adminCtx, &apipb.CreateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_STORAGE_BYTES, User: aliceName, Value: 1}})
+ require.Equal(t, codes.AlreadyExists, status.Code(err), "one limit per metric and user")
+ _, err = ts.Service.CreateUsageLimit(adminCtx, &apipb.CreateUsageLimitRequest{UsageLimitId: "default-storage", UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_UPLOAD_BYTES, Value: 1}})
+ require.Equal(t, codes.AlreadyExists, status.Code(err), "IDs are unique")
+
+ // Update: only value changes; metric and user are immutable.
+ updated, err := ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{
+ UsageLimit: &apipb.UsageLimit{Name: aliceStorage.Name, Value: 6 << 30, Metric: apipb.UsageLimit_STORAGE_BYTES, User: aliceName},
+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"value"}},
+ })
+ require.NoError(t, err)
+ require.Equal(t, int64(6<<30), updated.Value)
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: aliceStorage.Name, Value: 1, Metric: apipb.UsageLimit_MEMOS}})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: defaultStorage.Name, Value: 1, User: aliceName}})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{
+ UsageLimit: &apipb.UsageLimit{Name: defaultStorage.Name, Value: 1},
+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"metric"}},
+ })
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: defaultStorage.Name, Value: -1}})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: "usageLimits/missing", Value: 1}})
+ require.Equal(t, codes.NotFound, status.Code(err))
+
+ // List, filter and page. Defaults come first.
+ list, err := ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{})
+ require.NoError(t, err)
+ require.Len(t, list.UsageLimits, 3)
+ require.Empty(t, list.UsageLimits[0].User)
+ require.Empty(t, list.UsageLimits[1].User)
+ require.Equal(t, aliceName, list.UsageLimits[2].User)
+ filtered, err := ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{Filter: `user == "` + aliceName + `"`})
+ require.NoError(t, err)
+ require.Len(t, filtered.UsageLimits, 1)
+ filtered, err = ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{Filter: `user == "" && metric == "STORAGE_BYTES"`})
+ require.NoError(t, err)
+ require.Len(t, filtered.UsageLimits, 1)
+ require.Equal(t, defaultStorage.Name, filtered.UsageLimits[0].Name)
+ _, err = ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{Filter: `metric == "PLANS"`})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ _, err = ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{Filter: `user != ""`})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+ page, err := ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{PageSize: 2})
+ require.NoError(t, err)
+ require.Len(t, page.UsageLimits, 2)
+ require.NotEmpty(t, page.NextPageToken)
+ page, err = ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{PageToken: page.NextPageToken})
+ require.NoError(t, err)
+ require.Len(t, page.UsageLimits, 1)
+ require.Empty(t, page.NextPageToken)
+
+ // Renaming a user keeps their limits; deleting the user removes them.
+ renamed := "crud-alice-renamed"
+ _, err = ts.Store.UpdateUser(ctx, &store.UpdateUser{ID: alice.ID, Username: &renamed})
+ require.NoError(t, err)
+ got, err := ts.Service.GetUsageLimit(adminCtx, &apipb.GetUsageLimitRequest{Name: aliceStorage.Name})
+ require.NoError(t, err)
+ require.Equal(t, api.BuildUserName(renamed), got.User)
+ _, err = ts.Store.DeleteUser(ctx, &store.DeleteUser{ID: alice.ID})
+ require.NoError(t, err)
+ _, err = ts.Service.GetUsageLimit(adminCtx, &apipb.GetUsageLimitRequest{Name: aliceStorage.Name})
+ require.Equal(t, codes.NotFound, status.Code(err))
+
+ _, err = ts.Service.DeleteUsageLimit(adminCtx, &apipb.DeleteUsageLimitRequest{Name: defaultStorage.Name})
+ require.NoError(t, err)
+ _, err = ts.Service.DeleteUsageLimit(adminCtx, &apipb.DeleteUsageLimitRequest{Name: defaultStorage.Name})
+ require.Equal(t, codes.NotFound, status.Code(err))
+ list, err = ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{})
+ require.NoError(t, err)
+ require.Len(t, list.UsageLimits, 1)
+}
+
+func TestUsageLimitServiceDeploymentFile(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+ admin, err := ts.CreateHostUser(ctx, "file-admin")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, admin.ID)
+
+ dir := t.TempDir()
+ require.NoError(t, os.WriteFile(filepath.Join(dir, "memos-instance-setting-usage-limits.json"),
+ []byte(`{"key":"USAGE_LIMITS","usageLimitsSetting":{"limits":[{"uid":"default-memos","metric":"MEMOS","value":"1"}]}}`), 0o600))
+ require.NoError(t, ts.Store.LoadDeploymentConfigurationDir(ctx, dir))
+
+ list, err := ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{})
+ require.NoError(t, err)
+ require.Len(t, list.UsageLimits, 1)
+ _, err = ts.Service.CreateUsageLimit(adminCtx, &apipb.CreateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Metric: apipb.UsageLimit_STORAGE_BYTES, Value: 1}})
+ require.Equal(t, codes.FailedPrecondition, status.Code(err))
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: "usageLimits/default-memos", Value: 5}})
+ require.Equal(t, codes.FailedPrecondition, status.Code(err))
+ _, err = ts.Service.DeleteUsageLimit(adminCtx, &apipb.DeleteUsageLimitRequest{Name: "usageLimits/default-memos"})
+ require.Equal(t, codes.FailedPrecondition, status.Code(err))
+
+ // The file-provided limit is enforced.
+ _, err = ts.Service.CreateMemo(adminCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "first", Visibility: apipb.Visibility_PRIVATE}})
+ require.NoError(t, err)
+ _, err = ts.Service.CreateMemo(adminCtx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: "second", Visibility: apipb.Visibility_PRIVATE}})
+ requireQuotaExceeded(t, err, "MEMOS", api.BuildUserName(admin.Username))
+}
+
+func TestMemoLimitEnforcement(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+ admin, err := ts.CreateHostUser(ctx, "memo-admin")
+ require.NoError(t, err)
+ user, err := ts.CreateRegularUser(ctx, "memo-user")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, admin.ID)
+ userCtx := ts.CreateUserContext(ctx, user.ID)
+ createMemo := func(ctx context.Context, content string) (*apipb.Memo, error) {
+ return ts.Service.CreateMemo(ctx, &apipb.CreateMemoRequest{Memo: &apipb.Memo{Content: content, Visibility: apipb.Visibility_PUBLIC}})
+ }
+
+ // With no limits, nothing changes.
+ first, err := createMemo(userCtx, "first")
+ require.NoError(t, err)
+ usage, err := ts.Service.GetUserUsage(userCtx, &apipb.GetUserUsageRequest{Name: api.BuildUserName(user.Username) + "/usage"})
+ require.NoError(t, err)
+ require.Equal(t, int64(1), usage.MemoCount)
+ require.Zero(t, usage.MemosLimit.Value)
+ require.Empty(t, usage.MemosLimit.UsageLimit)
+
+ createUsageLimit(adminCtx, t, ts, "default-memos", apipb.UsageLimit_MEMOS, "", 2)
+ second, err := createMemo(userCtx, "second")
+ require.NoError(t, err)
+ _, err = createMemo(userCtx, "third")
+ metadata := requireQuotaExceeded(t, err, "MEMOS", api.BuildUserName(user.Username))
+ require.Equal(t, map[string]string{"metric": "MEMOS", "limit": "2", "usage": "2", "usage_limit": "usageLimits/default-memos"}, metadata)
+ count, err := ts.Store.CountUserMemos(ctx, user.ID)
+ require.NoError(t, err)
+ require.Equal(t, int64(2), count, "a refused create writes no memo")
+
+ // A comment is a memo row: it is refused at the limit and writes nothing.
+ _, err = ts.Service.CreateMemoComment(userCtx, &apipb.CreateMemoCommentRequest{Parent: first.Name, Comment: &apipb.Memo{Content: "a comment", Visibility: apipb.Visibility_PUBLIC}})
+ requireQuotaExceeded(t, err, "MEMOS", api.BuildUserName(user.Username))
+ count, err = ts.Store.CountUserMemos(ctx, user.ID)
+ require.NoError(t, err)
+ require.Equal(t, int64(2), count)
+
+ // Archiving keeps the slot; deleting frees it.
+ _, err = ts.Service.UpdateMemo(userCtx, &apipb.UpdateMemoRequest{
+ Memo: &apipb.Memo{Name: second.Name, State: apipb.State_ARCHIVED}, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"state"}},
+ })
+ require.NoError(t, err)
+ _, err = createMemo(userCtx, "still refused")
+ require.Equal(t, codes.ResourceExhausted, status.Code(err))
+ _, err = ts.Service.DeleteMemo(userCtx, &apipb.DeleteMemoRequest{Name: second.Name})
+ require.NoError(t, err)
+ _, err = createMemo(userCtx, "fits again")
+ require.NoError(t, err)
+
+ // A user's own limit replaces the default, and admins are limited too.
+ createUsageLimit(adminCtx, t, ts, "user-memos", apipb.UsageLimit_MEMOS, api.BuildUserName(user.Username), 0)
+ _, err = createMemo(userCtx, "unlimited now")
+ require.NoError(t, err)
+ _, err = createMemo(adminCtx, "admin one")
+ require.NoError(t, err)
+ _, err = createMemo(adminCtx, "admin two")
+ require.NoError(t, err)
+ _, err = createMemo(adminCtx, "admin three")
+ requireQuotaExceeded(t, err, "MEMOS", api.BuildUserName(admin.Username))
+
+ usage, err = ts.Service.GetUserUsage(userCtx, &apipb.GetUserUsageRequest{Name: api.BuildUserName(user.Username) + "/usage"})
+ require.NoError(t, err)
+ require.Equal(t, "usageLimits/user-memos", usage.MemosLimit.UsageLimit)
+ require.Zero(t, usage.MemosLimit.Value)
+
+ // Deleting every limit restores the previous behavior.
+ limits, err := ts.Service.ListUsageLimits(adminCtx, &apipb.ListUsageLimitsRequest{})
+ require.NoError(t, err)
+ for _, limit := range limits.UsageLimits {
+ _, err := ts.Service.DeleteUsageLimit(adminCtx, &apipb.DeleteUsageLimitRequest{Name: limit.Name})
+ require.NoError(t, err)
+ }
+ _, err = createMemo(adminCtx, "admin three")
+ require.NoError(t, err)
+}
+
+func TestUploadLimitEnforcement(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+ defer ts.Service.CloseUploads()
+ admin, err := ts.CreateHostUser(ctx, "upload-admin")
+ require.NoError(t, err)
+ user, err := ts.CreateRegularUser(ctx, "upload-user")
+ require.NoError(t, err)
+ adminCtx := ts.CreateUserContext(ctx, admin.ID)
+ userCtx := ts.CreateUserContext(ctx, user.ID)
+ subject := api.BuildUserName(user.Username)
+ attachmentCount := func() int {
+ t.Helper()
+ attachments, err := ts.Store.ListAttachments(ctx, &store.FindAttachment{CreatorID: &user.ID})
+ require.NoError(t, err)
+ return len(attachments)
+ }
+ uploadFiles := func() []string {
+ t.Helper()
+ paths, err := filepath.Glob(filepath.Join(ts.Profile.Data, ".memos-rpc-upload-*"))
+ require.NoError(t, err)
+ return paths
+ }
+ create := func(size int) error {
+ _, err := ts.Service.CreateAttachment(userCtx, &apipb.CreateAttachmentRequest{
+ Attachment: &apipb.Attachment{Filename: "file.bin", Type: "application/octet-stream", Content: make([]byte, size)},
+ })
+ return err
+ }
+
+ createUsageLimit(adminCtx, t, ts, "default-storage", apipb.UsageLimit_STORAGE_BYTES, "", 100)
+ createUsageLimit(adminCtx, t, ts, "default-upload", apipb.UsageLimit_UPLOAD_BYTES, "", 60)
+
+ require.NoError(t, create(60))
+ metadata := requireQuotaExceeded(t, create(61), "UPLOAD_BYTES", subject)
+ require.Equal(t, "61", metadata["usage"])
+ metadata = requireQuotaExceeded(t, create(41), "STORAGE_BYTES", subject)
+ require.Equal(t, "60", metadata["usage"])
+ require.Equal(t, "100", metadata["limit"])
+ require.Equal(t, 1, attachmentCount(), "a refused upload stores nothing")
+ require.NoError(t, create(40), "exactly reaching the storage limit is allowed")
+
+ // External links do not count toward storage.
+ _, err = ts.Store.CreateAttachment(ctx, &store.Attachment{
+ UID: "upload-external", CreatorID: user.ID, Filename: "link", Size: 1 << 20, StorageType: storepb.AttachmentStorageType_EXTERNAL, Reference: "https://example.com/a",
+ })
+ require.NoError(t, err)
+ usage, err := ts.Service.GetUserUsage(userCtx, &apipb.GetUserUsageRequest{Name: subject + "/usage"})
+ require.NoError(t, err)
+ require.Equal(t, int64(100), usage.StorageBytes)
+ require.Equal(t, "usageLimits/default-storage", usage.StorageBytesLimit.UsageLimit)
+ require.Equal(t, int64(60), usage.UploadBytesLimit.Value)
+
+ // A chunked upload is refused at start before any session or file exists.
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: "usageLimits/default-storage", Value: 200}})
+ require.NoError(t, err)
+ _, err = ts.Service.UploadAttachment(userCtx, &apipb.UploadAttachmentRequest{Upload: &apipb.UploadAttachmentRequest_Spec{Spec: &apipb.UploadAttachmentSpec{
+ Attachment: &apipb.Attachment{Filename: "big.bin", Type: "application/octet-stream"}, TotalSize: 120,
+ }}})
+ requireQuotaExceeded(t, err, "UPLOAD_BYTES", subject)
+ require.Empty(t, uploadFiles())
+
+ // At finish, the check runs again: another upload filled the storage in between.
+ started, err := ts.Service.UploadAttachment(userCtx, &apipb.UploadAttachmentRequest{Upload: &apipb.UploadAttachmentRequest_Spec{Spec: &apipb.UploadAttachmentSpec{
+ Attachment: &apipb.Attachment{Filename: "late.bin", Type: "application/octet-stream"}, TotalSize: 50,
+ }}})
+ require.NoError(t, err)
+ require.Len(t, uploadFiles(), 1)
+ require.NoError(t, create(60))
+ _, err = ts.Service.UploadAttachment(userCtx, &apipb.UploadAttachmentRequest{
+ Upload: &apipb.UploadAttachmentRequest_UploadId{UploadId: started.UploadId}, Data: make([]byte, 50), FinishWrite: true,
+ })
+ requireQuotaExceeded(t, err, "STORAGE_BYTES", subject)
+ require.Empty(t, uploadFiles(), "a refusal at finish removes the temporary file")
+ require.Equal(t, 4, attachmentCount(), "a refusal at finish stores nothing")
+ _, err = ts.Service.UploadAttachment(userCtx, &apipb.UploadAttachmentRequest{
+ Upload: &apipb.UploadAttachmentRequest_UploadId{UploadId: started.UploadId}, FinishWrite: true,
+ })
+ require.Equal(t, codes.NotFound, status.Code(err), "a refused upload is revoked")
+
+ // A per-file limit above the instance upload limit has no effect: the
+ // instance error applies unchanged.
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: "usageLimits/default-upload", Value: 1 << 40}})
+ require.NoError(t, err)
+ _, err = ts.Service.UpdateUsageLimit(adminCtx, &apipb.UpdateUsageLimitRequest{UsageLimit: &apipb.UsageLimit{Name: "usageLimits/default-storage", Value: 0}})
+ require.NoError(t, err)
+ err = create(33 << 20)
+ st := status.Convert(err)
+ require.Equal(t, codes.ResourceExhausted, st.Code())
+ require.Equal(t, "file size exceeds the limit", st.Message())
+ require.Len(t, st.Details(), 1)
+ info, ok := st.Details()[0].(*errdetails.ErrorInfo)
+ require.True(t, ok, "the instance limit refusal carries an ErrorInfo")
+ require.Equal(t, "FILE_TOO_LARGE", info.Reason)
+ require.Equal(t, map[string]string{"limit": strconv.Itoa(32 << 20), "size": strconv.Itoa(33 << 20)}, info.Metadata)
+}
+
+func TestGetUserUsagePermissions(t *testing.T) {
+ ctx := context.Background()
+ ts := NewTestService(t)
+ defer ts.Cleanup()
+ admin, err := ts.CreateHostUser(ctx, "usage-admin")
+ require.NoError(t, err)
+ alice, err := ts.CreateRegularUser(ctx, "usage-alice")
+ require.NoError(t, err)
+ bob, err := ts.CreateRegularUser(ctx, "usage-bob")
+ require.NoError(t, err)
+ aliceUsage := api.BuildUserName(alice.Username) + "/usage"
+
+ _, err = ts.Service.GetUserUsage(ts.CreateUserContext(ctx, alice.ID), &apipb.GetUserUsageRequest{Name: aliceUsage})
+ require.NoError(t, err)
+ usage, err := ts.Service.GetUserUsage(ts.CreateUserContext(ctx, admin.ID), &apipb.GetUserUsageRequest{Name: aliceUsage})
+ require.NoError(t, err)
+ require.Equal(t, aliceUsage, usage.Name)
+ _, err = ts.Service.GetUserUsage(ts.CreateUserContext(ctx, bob.ID), &apipb.GetUserUsageRequest{Name: aliceUsage})
+ require.Equal(t, codes.PermissionDenied, status.Code(err))
+ _, err = ts.Service.GetUserUsage(ts.CreateUserContext(ctx, bob.ID), &apipb.GetUserUsageRequest{Name: "users/nobody/usage"})
+ require.Equal(t, codes.PermissionDenied, status.Code(err), "non-admins cannot probe for usernames")
+ _, err = ts.Service.GetUserUsage(ts.CreateUserContext(ctx, admin.ID), &apipb.GetUserUsageRequest{Name: "users/nobody/usage"})
+ require.Equal(t, codes.NotFound, status.Code(err))
+ _, err = ts.Service.GetUserUsage(ctx, &apipb.GetUserUsageRequest{Name: aliceUsage})
+ require.Equal(t, codes.Unauthenticated, status.Code(err))
+ _, err = ts.Service.GetUserUsage(ts.CreateUserContext(ctx, alice.ID), &apipb.GetUserUsageRequest{Name: api.BuildUserName(alice.Username)})
+ require.Equal(t, codes.InvalidArgument, status.Code(err))
+}
diff --git a/server/api/usage_limit_service.go b/server/api/usage_limit_service.go
new file mode 100644
index 000000000..c3f6e9127
--- /dev/null
+++ b/server/api/usage_limit_service.go
@@ -0,0 +1,416 @@
+package api
+
+import (
+ "context"
+ "crypto/rand"
+ "slices"
+ "strings"
+
+ "github.com/google/cel-go/cel"
+ "github.com/google/cel-go/common/ast"
+ "github.com/pkg/errors"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/types/known/emptypb"
+
+ "github.com/usememos/memos/core/usagelimit"
+ apipb "github.com/usememos/memos/proto/gen/api"
+ storepb "github.com/usememos/memos/proto/gen/store"
+ "github.com/usememos/memos/store"
+)
+
+// ListUsageLimits lists the usage limits. Admin only.
+func (s *APIService) ListUsageLimits(ctx context.Context, request *apipb.ListUsageLimitsRequest) (*apipb.ListUsageLimitsResponse, error) {
+ if _, err := s.requireUsageLimitAdmin(ctx); err != nil {
+ return nil, err
+ }
+ filter, err := parseUsageLimitFilter(request.Filter)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid filter: %v", err)
+ }
+ if filter.username != nil && *filter.username != "" {
+ user, err := s.Store.GetUser(ctx, &store.FindUser{Username: filter.username})
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
+ }
+ if user == nil {
+ return &apipb.ListUsageLimitsResponse{}, nil
+ }
+ filter.userID = &user.ID
+ } else if filter.username != nil {
+ everyUser := int32(0)
+ filter.userID = &everyUser
+ }
+
+ var limit, offset int
+ if request.PageToken != "" {
+ var pageToken apipb.PageToken
+ if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err)
+ }
+ limit = normalizePageSize(pageToken.Limit)
+ offset = max(int(pageToken.Offset), 0)
+ } else {
+ limit = normalizePageSize(request.PageSize)
+ }
+
+ limits, usernames, err := s.listVisibleUsageLimits(ctx)
+ if err != nil {
+ return nil, err
+ }
+ limits = slices.DeleteFunc(limits, func(limit *storepb.InstanceUsageLimitsSetting_UsageLimit) bool {
+ return (filter.userID != nil && limit.UserId != *filter.userID) || (filter.metric != nil && limit.Metric != *filter.metric)
+ })
+ // Defaults first, then by user and metric, so pages are stable.
+ slices.SortStableFunc(limits, func(a, b *storepb.InstanceUsageLimitsSetting_UsageLimit) int {
+ if a.UserId != b.UserId {
+ if a.UserId == 0 || b.UserId == 0 {
+ return int(min(a.UserId, 1)) - int(min(b.UserId, 1))
+ }
+ return strings.Compare(usernames[a.UserId], usernames[b.UserId])
+ }
+ return int(a.Metric) - int(b.Metric)
+ })
+
+ response := &apipb.ListUsageLimitsResponse{}
+ if offset < len(limits) {
+ end := min(offset+limit, len(limits))
+ for _, item := range limits[offset:end] {
+ response.UsageLimits = append(response.UsageLimits, convertUsageLimitFromStore(item, usernames[item.UserId]))
+ }
+ if end < len(limits) {
+ response.NextPageToken, err = getPageToken(limit, end)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get next page token: %v", err)
+ }
+ }
+ }
+ return response, nil
+}
+
+// GetUsageLimit gets a usage limit. Admin only.
+func (s *APIService) GetUsageLimit(ctx context.Context, request *apipb.GetUsageLimitRequest) (*apipb.UsageLimit, error) {
+ if _, err := s.requireUsageLimitAdmin(ctx); err != nil {
+ return nil, err
+ }
+ uid, err := ExtractUsageLimitIDFromName(request.Name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid usage limit name: %v", err)
+ }
+ limits, usernames, err := s.listVisibleUsageLimits(ctx)
+ if err != nil {
+ return nil, err
+ }
+ for _, limit := range limits {
+ if limit.Uid == uid {
+ return convertUsageLimitFromStore(limit, usernames[limit.UserId]), nil
+ }
+ }
+ return nil, status.Errorf(codes.NotFound, "usage limit not found")
+}
+
+// CreateUsageLimit creates a usage limit. Admin only.
+func (s *APIService) CreateUsageLimit(ctx context.Context, request *apipb.CreateUsageLimitRequest) (*apipb.UsageLimit, error) {
+ if _, err := s.requireUsageLimitAdmin(ctx); err != nil {
+ return nil, err
+ }
+ if request.UsageLimit == nil {
+ return nil, status.Errorf(codes.InvalidArgument, "usage_limit is required")
+ }
+ uid, err := validateAndGenerateUsageLimitID(request.UsageLimitId)
+ if err != nil {
+ return nil, err
+ }
+ metric := storepb.InstanceUsageLimitsSetting_Metric(request.UsageLimit.Metric)
+ if !store.IsValidUsageLimitMetric(metric) {
+ return nil, status.Errorf(codes.InvalidArgument, "metric must be MEMOS, STORAGE_BYTES, or UPLOAD_BYTES")
+ }
+ if request.UsageLimit.Value < 0 {
+ return nil, status.Errorf(codes.InvalidArgument, "value must not be negative")
+ }
+ var user *store.User
+ if request.UsageLimit.User != "" {
+ user, err = s.resolveUsageLimitUser(ctx, request.UsageLimit.User)
+ if err != nil {
+ return nil, err
+ }
+ }
+ create := &storepb.InstanceUsageLimitsSetting_UsageLimit{
+ Uid: uid,
+ Metric: metric,
+ Value: request.UsageLimit.Value,
+ }
+ username := ""
+ if user != nil {
+ create.UserId = user.ID
+ username = user.Username
+ }
+ created, err := s.Store.CreateUsageLimit(ctx, create)
+ if err != nil {
+ return nil, usageLimitStoreError(err)
+ }
+ return convertUsageLimitFromStore(created, username), nil
+}
+
+// UpdateUsageLimit updates the value of a usage limit. Admin only.
+func (s *APIService) UpdateUsageLimit(ctx context.Context, request *apipb.UpdateUsageLimitRequest) (*apipb.UsageLimit, error) {
+ if _, err := s.requireUsageLimitAdmin(ctx); err != nil {
+ return nil, err
+ }
+ if request.UsageLimit == nil {
+ return nil, status.Errorf(codes.InvalidArgument, "usage_limit is required")
+ }
+ uid, err := ExtractUsageLimitIDFromName(request.UsageLimit.Name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid usage limit name: %v", err)
+ }
+ for _, path := range request.UpdateMask.GetPaths() {
+ if path != "value" {
+ return nil, status.Errorf(codes.InvalidArgument, "only value can be updated; %q is immutable or unknown", path)
+ }
+ }
+ if request.UsageLimit.Value < 0 {
+ return nil, status.Errorf(codes.InvalidArgument, "value must not be negative")
+ }
+ limits, usernames, err := s.listVisibleUsageLimits(ctx)
+ if err != nil {
+ return nil, err
+ }
+ index := slices.IndexFunc(limits, func(limit *storepb.InstanceUsageLimitsSetting_UsageLimit) bool { return limit.Uid == uid })
+ if index < 0 {
+ return nil, status.Errorf(codes.NotFound, "usage limit not found")
+ }
+ // metric and user are immutable. A request may echo them back unchanged.
+ current := limits[index]
+ if request.UsageLimit.Metric != apipb.UsageLimit_METRIC_UNSPECIFIED && storepb.InstanceUsageLimitsSetting_Metric(request.UsageLimit.Metric) != current.Metric {
+ return nil, status.Errorf(codes.InvalidArgument, "metric is immutable")
+ }
+ if request.UsageLimit.User != "" && request.UsageLimit.User != usageLimitUserName(usernames[current.UserId]) {
+ return nil, status.Errorf(codes.InvalidArgument, "user is immutable")
+ }
+ updated, err := s.Store.UpdateUsageLimit(ctx, uid, request.UsageLimit.Value)
+ if err != nil {
+ return nil, usageLimitStoreError(err)
+ }
+ return convertUsageLimitFromStore(updated, usernames[updated.UserId]), nil
+}
+
+// DeleteUsageLimit deletes a usage limit. Admin only.
+func (s *APIService) DeleteUsageLimit(ctx context.Context, request *apipb.DeleteUsageLimitRequest) (*emptypb.Empty, error) {
+ if _, err := s.requireUsageLimitAdmin(ctx); err != nil {
+ return nil, err
+ }
+ uid, err := ExtractUsageLimitIDFromName(request.Name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid usage limit name: %v", err)
+ }
+ if err := s.Store.DeleteUsageLimit(ctx, uid); err != nil {
+ return nil, usageLimitStoreError(err)
+ }
+ return &emptypb.Empty{}, nil
+}
+
+func (s *APIService) requireUsageLimitAdmin(ctx context.Context) (*store.User, error) {
+ user, err := s.fetchCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+ if user == nil {
+ return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
+ }
+ if user.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+ return user, nil
+}
+
+// listVisibleUsageLimits returns the stored usage limits, without those of
+// users that no longer exist, and the usernames of the users they name.
+func (s *APIService) listVisibleUsageLimits(ctx context.Context) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, map[int32]string, error) {
+ setting, err := s.Store.GetInstanceUsageLimitsSetting(ctx)
+ if err != nil {
+ return nil, nil, status.Errorf(codes.Internal, "failed to get usage limits: %v", err)
+ }
+ userIDs := []int32{}
+ for _, limit := range setting.GetLimits() {
+ if limit.UserId != 0 && !slices.Contains(userIDs, limit.UserId) {
+ userIDs = append(userIDs, limit.UserId)
+ }
+ }
+ usernames := map[int32]string{}
+ if len(userIDs) > 0 {
+ users, err := s.Store.ListUsers(ctx, &store.FindUser{IDList: userIDs})
+ if err != nil {
+ return nil, nil, status.Errorf(codes.Internal, "failed to list users: %v", err)
+ }
+ for _, user := range users {
+ usernames[user.ID] = user.Username
+ }
+ }
+ limits := make([]*storepb.InstanceUsageLimitsSetting_UsageLimit, 0, len(setting.GetLimits()))
+ for _, limit := range setting.GetLimits() {
+ if _, ok := usernames[limit.UserId]; limit.UserId != 0 && !ok {
+ continue
+ }
+ limits = append(limits, limit)
+ }
+ return limits, usernames, nil
+}
+
+func (s *APIService) resolveUsageLimitUser(ctx context.Context, name string) (*store.User, error) {
+ username, err := parseUsernameFromName(name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)
+ }
+ user, err := s.Store.GetUser(ctx, &store.FindUser{Username: &username})
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
+ }
+ if user == nil {
+ return nil, status.Errorf(codes.NotFound, "user not found")
+ }
+ return user, nil
+}
+
+func usageLimitStoreError(err error) error {
+ switch {
+ case errors.Is(err, store.ErrUsageLimitNotFound):
+ return status.Errorf(codes.NotFound, "usage limit not found")
+ case errors.Is(err, store.ErrUsageLimitAlreadyExists):
+ return status.Error(codes.AlreadyExists, err.Error())
+ case errors.Is(err, store.ErrUsageLimitsDeploymentConfigured):
+ return status.Errorf(codes.FailedPrecondition, "usage limits are configured by the deployment")
+ case errors.Is(err, store.ErrUsageLimitWriteConflict):
+ return status.Errorf(codes.Aborted, "usage limits changed concurrently; retry")
+ case errors.Is(err, store.ErrInvalidUsageLimit):
+ return status.Error(codes.InvalidArgument, err.Error())
+ default:
+ return status.Errorf(codes.Internal, "failed to write usage limits: %v", err)
+ }
+}
+
+// validateAndGenerateUsageLimitID validates a client-chosen usage limit ID,
+// or generates one.
+func validateAndGenerateUsageLimitID(provided string) (string, error) {
+ if provided == "" {
+ return "limit-" + strings.ToLower(rand.Text()[:12]), nil
+ }
+ if len(provided) > 32 || !store.UsageLimitUIDMatcher.MatchString(provided) {
+ return "", status.Errorf(codes.InvalidArgument, "usage_limit_id must be lowercase kebab case, start with a letter, and have at most 32 characters")
+ }
+ return provided, nil
+}
+
+// checkMemoQuota refuses a new memo when the user has reached the memo limit.
+func (s *APIService) checkMemoQuota(ctx context.Context, user *store.User) error {
+ return usageLimitCheckError(user.Username, usagelimit.CheckMemoCreate(ctx, s.Store, user.ID))
+}
+
+// checkUploadQuota refuses an upload of size bytes that would break the
+// per-file or storage limit of the user. Call it after checkUploadSize.
+func (s *APIService) checkUploadQuota(ctx context.Context, userID int32, size int64, setting *storepb.InstanceStorageSetting) error {
+ err := usagelimit.CheckUpload(ctx, s.Store, userID, size, attachmentUploadLimit(setting))
+ if err == nil {
+ return nil
+ }
+ username := ""
+ if usagelimit.AsRefusal(err) != nil {
+ user, userErr := s.Store.GetUser(ctx, &store.FindUser{ID: &userID})
+ if userErr == nil && user != nil {
+ username = user.Username
+ }
+ }
+ return usageLimitCheckError(username, err)
+}
+
+// usageLimitCheckError maps a usage limit check result to a service error.
+// A failed check refuses the request: failing open would let a database
+// problem switch the limits off.
+func usageLimitCheckError(username string, err error) error {
+ if err == nil {
+ return nil
+ }
+ if refusal := usagelimit.AsRefusal(err); refusal != nil {
+ return newQuotaExceededError(username, refusal)
+ }
+ return status.Errorf(codes.Internal, "failed to check usage limits: %v", err)
+}
+
+// usageLimitFilter is a parsed ListUsageLimits filter. A nil field matches
+// every value.
+type usageLimitFilter struct {
+ // username is "" for the defaults for every user.
+ username *string
+ userID *int32
+ metric *storepb.InstanceUsageLimitsSetting_Metric
+}
+
+// parseUsageLimitFilter parses `user == "users/{user}"`, `user == ""`, and
+// `metric == "STORAGE_BYTES"` comparisons joined by `&&`.
+func parseUsageLimitFilter(filter string) (*usageLimitFilter, error) {
+ result := &usageLimitFilter{}
+ filter = strings.TrimSpace(filter)
+ if filter == "" {
+ return result, nil
+ }
+ env, err := cel.NewEnv(cel.Variable("user", cel.StringType), cel.Variable("metric", cel.StringType))
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to create CEL environment")
+ }
+ compiled, issues := env.Compile(filter)
+ if issues != nil && issues.Err() != nil {
+ return nil, errors.Wrapf(issues.Err(), "invalid filter expression: %s", filter)
+ }
+ if err := result.add(compiled.NativeRep().Expr()); err != nil {
+ return nil, err
+ }
+ return result, nil
+}
+
+func (f *usageLimitFilter) add(expr ast.Expr) error {
+ if expr.Kind() != ast.CallKind {
+ return errors.New("filter must compare user or metric with a string")
+ }
+ call := expr.AsCall()
+ args := call.Args()
+ switch call.FunctionName() {
+ case "_&&_":
+ for _, arg := range args {
+ if err := f.add(arg); err != nil {
+ return err
+ }
+ }
+ return nil
+ case "_==_":
+ default:
+ return errors.Errorf("unsupported operator %s; use == and &&", call.FunctionName())
+ }
+ if len(args) != 2 || args[0].Kind() != ast.IdentKind || args[1].Kind() != ast.LiteralKind {
+ return errors.New("filter must compare user or metric with a string")
+ }
+ value, ok := args[1].AsLiteral().Value().(string)
+ if !ok {
+ return errors.New("filter must compare user or metric with a string")
+ }
+ switch args[0].AsIdent() {
+ case "user":
+ username := ""
+ if value != "" {
+ parsed, err := parseUsernameFromName(value)
+ if err != nil {
+ return errors.Wrap(err, "invalid user")
+ }
+ username = parsed
+ }
+ f.username = &username
+ case "metric":
+ metric := storepb.InstanceUsageLimitsSetting_Metric(storepb.InstanceUsageLimitsSetting_Metric_value[value])
+ if !store.IsValidUsageLimitMetric(metric) {
+ return errors.Errorf("unknown metric %q", value)
+ }
+ f.metric = &metric
+ default:
+ return errors.Errorf("unknown field %q", args[0].AsIdent())
+ }
+ return nil
+}
diff --git a/server/api/usage_limit_service_converters.go b/server/api/usage_limit_service_converters.go
new file mode 100644
index 000000000..37e02a6d6
--- /dev/null
+++ b/server/api/usage_limit_service_converters.go
@@ -0,0 +1,37 @@
+package api
+
+import (
+ "github.com/usememos/memos/core/usagelimit"
+ apipb "github.com/usememos/memos/proto/gen/api"
+ storepb "github.com/usememos/memos/proto/gen/store"
+)
+
+// convertUsageLimitFromStore converts a stored usage limit. username is the
+// name of the user the limit applies to, or empty for a default.
+func convertUsageLimitFromStore(limit *storepb.InstanceUsageLimitsSetting_UsageLimit, username string) *apipb.UsageLimit {
+ return &apipb.UsageLimit{
+ Name: UsageLimitNamePrefix + limit.Uid,
+ Metric: apipb.UsageLimit_Metric(limit.Metric),
+ User: usageLimitUserName(username),
+ Value: limit.Value,
+ CreateTime: limit.CreateTime,
+ UpdateTime: limit.UpdateTime,
+ }
+}
+
+// usageLimitUserName returns the user field of a usage limit: the user's
+// resource name, or empty for a default.
+func usageLimitUserName(username string) string {
+ if username == "" {
+ return ""
+ }
+ return BuildUserName(username)
+}
+
+func convertEffectiveLimitToProto(limit usagelimit.Limit) *apipb.UserUsage_EffectiveLimit {
+ effective := &apipb.UserUsage_EffectiveLimit{Value: limit.Value}
+ if limit.Source != "" {
+ effective.UsageLimit = UsageLimitNamePrefix + limit.Source
+ }
+ return effective
+}
diff --git a/server/api/user_service_memo_import.go b/server/api/user_service_memo_import.go
index 61e4f3a41..f24e8a0ba 100644
--- a/server/api/user_service_memo_import.go
+++ b/server/api/user_service_memo_import.go
@@ -198,7 +198,7 @@ func (i *memoImporter) importMemo(record *memoexport.Memo) error {
return err
}
if len(content) > i.contentLengthLimit {
- return errors.Errorf("content too long (max %d characters)", i.contentLengthLimit)
+ return errors.Errorf("content too long (max %d bytes)", i.contentLengthLimit)
}
targetUID := record.UID
if existing := i.existing[record.UID]; existing != nil {
diff --git a/server/api/user_service_usage.go b/server/api/user_service_usage.go
new file mode 100644
index 000000000..00bc5f4e8
--- /dev/null
+++ b/server/api/user_service_usage.go
@@ -0,0 +1,59 @@
+package api
+
+import (
+ "context"
+ "strings"
+
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+
+ "github.com/usememos/memos/core/usagelimit"
+ apipb "github.com/usememos/memos/proto/gen/api"
+ "github.com/usememos/memos/store"
+)
+
+// GetUserUsage returns a user's usage and the usage limits in effect for the
+// user. Only the user or an admin may call it.
+func (s *APIService) GetUserUsage(ctx context.Context, request *apipb.GetUserUsageRequest) (*apipb.UserUsage, error) {
+ parent, ok := strings.CutSuffix(request.Name, "/usage")
+ if !ok {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid user usage name %q", request.Name)
+ }
+ currentUser, err := s.fetchCurrentUser(ctx)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
+ }
+ if currentUser == nil {
+ return nil, status.Errorf(codes.Unauthenticated, "user not authenticated")
+ }
+ username, err := parseUsernameFromName(parent)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, "invalid user name: %v", err)
+ }
+ user, err := s.Store.GetUser(ctx, &store.FindUser{Username: &username})
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
+ }
+ if user == nil {
+ if currentUser.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+ return nil, status.Errorf(codes.NotFound, "user not found")
+ }
+ if user.ID != currentUser.ID && currentUser.Role != store.RoleAdmin {
+ return nil, status.Errorf(codes.PermissionDenied, "permission denied")
+ }
+
+ usage, err := usagelimit.UsageFor(ctx, s.Store, user.ID)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get usage: %v", err)
+ }
+ return &apipb.UserUsage{
+ Name: BuildUserName(user.Username) + "/usage",
+ MemoCount: usage.MemoCount,
+ StorageBytes: usage.StorageBytes,
+ MemosLimit: convertEffectiveLimitToProto(usage.Limits.Memos),
+ StorageBytesLimit: convertEffectiveLimitToProto(usage.Limits.StorageBytes),
+ UploadBytesLimit: convertEffectiveLimitToProto(usage.Limits.UploadBytes),
+ }, nil
+}
diff --git a/server/test/usage_limit_test.go b/server/test/usage_limit_test.go
new file mode 100644
index 000000000..37562457f
--- /dev/null
+++ b/server/test/usage_limit_test.go
@@ -0,0 +1,148 @@
+package test
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "net/http"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+// TestUsageLimitRefusalOnBothTransports proves the quota refusal contract on
+// the wire: HTTP 429 with an ErrorInfo of reason QUOTA_EXCEEDED and a
+// QuotaFailure, and no Retry-After or RateLimit fields, because waiting does
+// not lift a usage limit. It also proves that the usageLimits and user usage
+// routes reach their handlers. Admins are limited like everyone else, so the
+// first user is enough.
+func TestUsageLimitRefusalOnBothTransports(t *testing.T) {
+ ctx := context.Background()
+ inst := bootInstance(ctx, t, instanceOptions{instanceURL: "http://127.0.0.1"})
+ inst.createAdmin(t)
+ token := inst.signIn(t)
+
+ send := func(method, path string, body any, headers map[string]string) *http.Response {
+ t.Helper()
+ encoded, err := json.Marshal(body)
+ require.NoError(t, err)
+ req, err := http.NewRequestWithContext(ctx, method, inst.baseURL+path, bytes.NewReader(encoded))
+ require.NoError(t, err)
+ req.Header.Set("Content-Type", "application/json")
+ req.Header.Set("Authorization", "Bearer "+token)
+ for key, value := range headers {
+ req.Header.Set(key, value)
+ }
+ resp, err := inst.client.Do(req)
+ require.NoError(t, err)
+ return resp
+ }
+
+ status, body := inst.do(t, http.MethodPost, "/api/usageLimits?usageLimitId=default-memos", token, map[string]any{
+ "metric": "MEMOS",
+ "value": "1",
+ })
+ require.Equal(t, http.StatusOK, status, "creating a usage limit should succeed: %s", body)
+
+ status, body = inst.do(t, http.MethodGet, "/api/usageLimits", token, nil)
+ require.Equal(t, http.StatusOK, status, "%s", body)
+ var listed struct {
+ UsageLimits []struct {
+ Name string `json:"name"`
+ Metric string `json:"metric"`
+ Value string `json:"value"`
+ } `json:"usageLimits"`
+ }
+ require.NoError(t, json.Unmarshal(body, &listed))
+ require.Len(t, listed.UsageLimits, 1)
+ require.Equal(t, "usageLimits/default-memos", listed.UsageLimits[0].Name)
+
+ inst.createMemo(t, token, "first", "the only memo the limit allows")
+
+ userName := "users/" + testAdminUsername
+ status, body = inst.do(t, http.MethodGet, "/api/"+userName+"/usage", token, nil)
+ require.Equal(t, http.StatusOK, status, "%s", body)
+ var usage struct {
+ Name string `json:"name"`
+ MemoCount string `json:"memoCount"`
+ MemosLimit struct {
+ Value string `json:"value"`
+ UsageLimit string `json:"usageLimit"`
+ } `json:"memosLimit"`
+ }
+ require.NoError(t, json.Unmarshal(body, &usage))
+ require.Equal(t, userName+"/usage", usage.Name)
+ require.Equal(t, "1", usage.MemoCount)
+ require.Equal(t, "1", usage.MemosLimit.Value)
+ require.Equal(t, "usageLimits/default-memos", usage.MemosLimit.UsageLimit)
+
+ requireNoWaitHeaders := func(resp *http.Response) {
+ t.Helper()
+ require.Empty(t, resp.Header.Get("Retry-After"))
+ require.Empty(t, resp.Header.Get("RateLimit"))
+ require.Empty(t, resp.Header.Get("RateLimit-Policy"))
+ }
+ memo := map[string]any{"content": "over the limit", "visibility": "PRIVATE"}
+
+ refused := send(http.MethodPost, "/api/memos", memo, nil)
+ defer refused.Body.Close()
+ require.Equal(t, http.StatusTooManyRequests, refused.StatusCode)
+ requireNoWaitHeaders(refused)
+ var gatewayError struct {
+ Code int `json:"code"`
+ Message string `json:"message"`
+ Details []struct {
+ Type string `json:"@type"`
+ Reason string `json:"reason"`
+ Domain string `json:"domain"`
+ Metadata map[string]string `json:"metadata"`
+ Violations []struct {
+ Subject string `json:"subject"`
+ } `json:"violations"`
+ } `json:"details"`
+ }
+ require.NoError(t, json.NewDecoder(refused.Body).Decode(&gatewayError))
+ require.Equal(t, 8, gatewayError.Code, "RESOURCE_EXHAUSTED")
+ require.Equal(t, "quota exceeded", gatewayError.Message)
+ types := []string{}
+ for _, detail := range gatewayError.Details {
+ types = append(types, detail.Type)
+ switch detail.Type {
+ case "type.googleapis.com/google.rpc.ErrorInfo":
+ require.Equal(t, "QUOTA_EXCEEDED", detail.Reason)
+ require.Equal(t, "memos.api", detail.Domain)
+ require.Equal(t, map[string]string{"metric": "MEMOS", "limit": "1", "usage": "1", "usage_limit": "usageLimits/default-memos"}, detail.Metadata)
+ case "type.googleapis.com/google.rpc.QuotaFailure":
+ require.Len(t, detail.Violations, 1)
+ require.Equal(t, userName, detail.Violations[0].Subject)
+ default:
+ t.Fatalf("unexpected error detail %s", detail.Type)
+ }
+ }
+ require.ElementsMatch(t, []string{"type.googleapis.com/google.rpc.ErrorInfo", "type.googleapis.com/google.rpc.QuotaFailure"}, types)
+
+ connectResp := send(http.MethodPost, "/memos.api.MemoService/CreateMemo", map[string]any{"memo": memo}, map[string]string{"Connect-Protocol-Version": "1"})
+ defer connectResp.Body.Close()
+ require.Equal(t, http.StatusTooManyRequests, connectResp.StatusCode)
+ requireNoWaitHeaders(connectResp)
+ var connectError struct {
+ Code string `json:"code"`
+ Message string `json:"message"`
+ Details []struct {
+ Type string `json:"type"`
+ } `json:"details"`
+ }
+ require.NoError(t, json.NewDecoder(connectResp.Body).Decode(&connectError))
+ require.Equal(t, "resource_exhausted", connectError.Code)
+ require.Equal(t, "quota exceeded", connectError.Message)
+ connectTypes := []string{}
+ for _, detail := range connectError.Details {
+ connectTypes = append(connectTypes, detail.Type)
+ }
+ require.ElementsMatch(t, []string{"google.rpc.ErrorInfo", "google.rpc.QuotaFailure"}, connectTypes)
+
+ // Deleting the limit lifts the refusal at once: checks skip the cache.
+ status, body = inst.do(t, http.MethodDelete, "/api/usageLimits/default-memos", token, nil)
+ require.Equal(t, http.StatusOK, status, "%s", body)
+ inst.createMemo(t, token, "second", "allowed again")
+}
diff --git a/store/attachment.go b/store/attachment.go
index 271a9dca4..16555717a 100644
--- a/store/attachment.go
+++ b/store/attachment.go
@@ -414,7 +414,8 @@ func shouldFailCreateAttachmentPostCommit(ctx context.Context) bool {
return ok && failpoint
}
-// GetAttachmentStorageUsage returns the total persisted attachment size for a creator in bytes.
+// GetAttachmentStorageUsage returns the total persisted attachment size for a
+// creator in bytes. External links are not counted.
func (s *Store) GetAttachmentStorageUsage(ctx context.Context, creatorID int32) (int64, error) {
return s.driver.GetAttachmentStorageUsage(ctx, creatorID)
}
diff --git a/store/db/mysql/attachment.go b/store/db/mysql/attachment.go
index ff121371a..7e9013ca6 100644
--- a/store/db/mysql/attachment.go
+++ b/store/db/mysql/attachment.go
@@ -349,7 +349,7 @@ func listMySQLAttachmentsByIDs(ctx context.Context, tx *sql.Tx, attachmentIDs []
// GetAttachmentStorageUsage returns the total persisted attachment size for a creator in bytes.
func (d *DB) GetAttachmentStorageUsage(ctx context.Context, creatorID int32) (int64, error) {
var size int64
- if err := d.db.QueryRowContext(ctx, "SELECT COALESCE(SUM(size), 0) FROM attachment WHERE creator_id = ?", creatorID).Scan(&size); err != nil {
+ if err := d.db.QueryRowContext(ctx, "SELECT COALESCE(SUM(size), 0) FROM attachment WHERE creator_id = ? AND storage_type <> 'EXTERNAL'", creatorID).Scan(&size); err != nil {
return 0, errors.Wrap(err, "failed to sum attachment sizes")
}
return size, nil
diff --git a/store/db/mysql/instance_setting.go b/store/db/mysql/instance_setting.go
index 1fd8ab8d5..2601fb277 100644
--- a/store/db/mysql/instance_setting.go
+++ b/store/db/mysql/instance_setting.go
@@ -24,6 +24,35 @@ func (d *DB) CreateInstanceSettingIfNotExists(ctx context.Context, create *store
return rowsAffected == 1, nil
}
+// UpdateInstanceSettingIfUnchanged replaces the setting value only when the
+// stored value still equals oldValue, and reports whether it did.
+func (d *DB) UpdateInstanceSettingIfUnchanged(ctx context.Context, name, oldValue, newValue string) (bool, error) {
+ // MySQL reports zero affected rows when the new value equals the stored
+ // one, which would read as a conflict. An unchanged write is a no-op.
+ if oldValue == newValue {
+ return d.instanceSettingHasValue(ctx, name, oldValue)
+ }
+ // A binary comparison is exact; the column collation may ignore case
+ // and trailing spaces.
+ result, err := d.db.ExecContext(ctx, "UPDATE `system_setting` SET `value` = ? WHERE `name` = ? AND `value` = CAST(? AS BINARY)", newValue, name, oldValue)
+ if err != nil {
+ return false, errors.Wrap(err, "failed to conditionally update instance setting")
+ }
+ rowsAffected, err := result.RowsAffected()
+ if err != nil {
+ return false, errors.Wrap(err, "failed to inspect conditional instance setting update")
+ }
+ return rowsAffected == 1, nil
+}
+
+func (d *DB) instanceSettingHasValue(ctx context.Context, name, value string) (bool, error) {
+ var count int
+ if err := d.db.QueryRowContext(ctx, "SELECT COUNT(*) FROM `system_setting` WHERE `name` = ? AND `value` = CAST(? AS BINARY)", name, value).Scan(&count); err != nil {
+ return false, errors.Wrap(err, "failed to read instance setting")
+ }
+ return count == 1, nil
+}
+
func (d *DB) UpsertInstanceSetting(ctx context.Context, upsert *store.InstanceSetting) (*store.InstanceSetting, error) {
if err := upsertInstanceSetting(ctx, d.db, upsert); err != nil {
return nil, err
diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.go
index 96ed09e83..7927a6cbb 100644
--- a/store/db/mysql/memo.go
+++ b/store/db/mysql/memo.go
@@ -305,6 +305,17 @@ func (d *DB) GetMemo(ctx context.Context, find *store.FindMemo) (*store.Memo, er
return memo, nil
}
+// CountUserMemos counts the memos a user created, comments included, in every
+// row status and Space.
+func (d *DB) CountUserMemos(ctx context.Context, creatorID int32) (int64, error) {
+ stmt := "SELECT COUNT(*) FROM `memo` WHERE `creator_id` = ?"
+ var count int64
+ if err := d.db.QueryRowContext(ctx, stmt, creatorID).Scan(&count); err != nil {
+ return 0, errors.Wrap(err, "failed to count user memos")
+ }
+ return count, nil
+}
+
func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error {
if update.Policy == nil {
return applyMemoUpdate(ctx, d.db, update)
diff --git a/store/db/postgres/attachment.go b/store/db/postgres/attachment.go
index 2869e28f4..a3520a408 100644
--- a/store/db/postgres/attachment.go
+++ b/store/db/postgres/attachment.go
@@ -326,7 +326,7 @@ func (d *DB) DeleteAttachments(ctx context.Context, deletes []*store.DeleteAttac
// GetAttachmentStorageUsage returns the total persisted attachment size for a creator in bytes.
func (d *DB) GetAttachmentStorageUsage(ctx context.Context, creatorID int32) (int64, error) {
var size int64
- if err := d.db.QueryRowContext(ctx, "SELECT COALESCE(SUM(size), 0) FROM attachment WHERE creator_id = $1", creatorID).Scan(&size); err != nil {
+ if err := d.db.QueryRowContext(ctx, "SELECT COALESCE(SUM(size), 0) FROM attachment WHERE creator_id = $1 AND storage_type <> 'EXTERNAL'", creatorID).Scan(&size); err != nil {
return 0, errors.Wrap(err, "failed to sum attachment sizes")
}
return size, nil
diff --git a/store/db/postgres/instance_setting.go b/store/db/postgres/instance_setting.go
index 34d03fc03..c40de42c6 100644
--- a/store/db/postgres/instance_setting.go
+++ b/store/db/postgres/instance_setting.go
@@ -30,6 +30,20 @@ func (d *DB) CreateInstanceSettingIfNotExists(ctx context.Context, create *store
return rowsAffected == 1, nil
}
+// UpdateInstanceSettingIfUnchanged replaces the setting value only when the
+// stored value still equals oldValue, and reports whether it did.
+func (d *DB) UpdateInstanceSettingIfUnchanged(ctx context.Context, name, oldValue, newValue string) (bool, error) {
+ result, err := d.db.ExecContext(ctx, "UPDATE system_setting SET value = $1 WHERE name = $2 AND value = $3", newValue, name, oldValue)
+ if err != nil {
+ return false, errors.Wrap(err, "failed to conditionally update instance setting")
+ }
+ rowsAffected, err := result.RowsAffected()
+ if err != nil {
+ return false, errors.Wrap(err, "failed to inspect conditional instance setting update")
+ }
+ return rowsAffected == 1, nil
+}
+
func (d *DB) UpsertInstanceSetting(ctx context.Context, upsert *store.InstanceSetting) (*store.InstanceSetting, error) {
if err := upsertInstanceSetting(ctx, d.db, upsert); err != nil {
return nil, err
diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.go
index ecb03cc4d..8cf1b760f 100644
--- a/store/db/postgres/memo.go
+++ b/store/db/postgres/memo.go
@@ -284,6 +284,17 @@ func (d *DB) GetMemo(ctx context.Context, find *store.FindMemo) (*store.Memo, er
return memo, nil
}
+// CountUserMemos counts the memos a user created, comments included, in every
+// row status and Space.
+func (d *DB) CountUserMemos(ctx context.Context, creatorID int32) (int64, error) {
+ stmt := `SELECT COUNT(*) FROM memo WHERE creator_id = $1`
+ var count int64
+ if err := d.db.QueryRowContext(ctx, stmt, creatorID).Scan(&count); err != nil {
+ return 0, errors.Wrap(err, "failed to count user memos")
+ }
+ return count, nil
+}
+
func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error {
if update.Policy == nil {
return applyMemoUpdate(ctx, d.db, update)
diff --git a/store/db/sqlite/attachment.go b/store/db/sqlite/attachment.go
index 231ababe4..a7e8736c5 100644
--- a/store/db/sqlite/attachment.go
+++ b/store/db/sqlite/attachment.go
@@ -311,7 +311,7 @@ func (d *DB) DeleteAttachments(ctx context.Context, deletes []*store.DeleteAttac
// GetAttachmentStorageUsage returns the total persisted attachment size for a creator in bytes.
func (d *DB) GetAttachmentStorageUsage(ctx context.Context, creatorID int32) (int64, error) {
var size int64
- if err := d.db.QueryRowContext(ctx, "SELECT COALESCE(SUM(size), 0) FROM attachment WHERE creator_id = ?", creatorID).Scan(&size); err != nil {
+ if err := d.db.QueryRowContext(ctx, "SELECT COALESCE(SUM(size), 0) FROM attachment WHERE creator_id = ? AND storage_type <> 'EXTERNAL'", creatorID).Scan(&size); err != nil {
return 0, errors.Wrap(err, "failed to sum attachment sizes")
}
return size, nil
diff --git a/store/db/sqlite/instance_setting.go b/store/db/sqlite/instance_setting.go
index 4dc5c94ca..b76c07d44 100644
--- a/store/db/sqlite/instance_setting.go
+++ b/store/db/sqlite/instance_setting.go
@@ -30,6 +30,20 @@ func (d *DB) CreateInstanceSettingIfNotExists(ctx context.Context, create *store
return rowsAffected == 1, nil
}
+// UpdateInstanceSettingIfUnchanged replaces the setting value only when the
+// stored value still equals oldValue, and reports whether it did.
+func (d *DB) UpdateInstanceSettingIfUnchanged(ctx context.Context, name, oldValue, newValue string) (bool, error) {
+ result, err := d.db.ExecContext(ctx, "UPDATE system_setting SET value = ? WHERE name = ? AND value = ?", newValue, name, oldValue)
+ if err != nil {
+ return false, errors.Wrap(err, "failed to conditionally update instance setting")
+ }
+ rowsAffected, err := result.RowsAffected()
+ if err != nil {
+ return false, errors.Wrap(err, "failed to inspect conditional instance setting update")
+ }
+ return rowsAffected == 1, nil
+}
+
func (d *DB) UpsertInstanceSetting(ctx context.Context, upsert *store.InstanceSetting) (*store.InstanceSetting, error) {
if err := upsertInstanceSetting(ctx, d.db, upsert); err != nil {
return nil, err
diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.go
index 411bfe94a..321eb6d7b 100644
--- a/store/db/sqlite/memo.go
+++ b/store/db/sqlite/memo.go
@@ -275,6 +275,17 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
return list, nil
}
+// CountUserMemos counts the memos a user created, comments included, in every
+// row status and Space.
+func (d *DB) CountUserMemos(ctx context.Context, creatorID int32) (int64, error) {
+ stmt := `SELECT COUNT(*) FROM memo WHERE creator_id = ?`
+ var count int64
+ if err := d.db.QueryRowContext(ctx, stmt, creatorID).Scan(&count); err != nil {
+ return 0, errors.Wrap(err, "failed to count user memos")
+ }
+ return count, nil
+}
+
func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error {
if update.Policy == nil {
return applyMemoUpdate(ctx, d.db, update)
diff --git a/store/deployment_config.go b/store/deployment_config.go
index 61d32c98f..77b797f0a 100644
--- a/store/deployment_config.go
+++ b/store/deployment_config.go
@@ -292,6 +292,14 @@ func validateAndNormalizeDeploymentInstanceSetting(setting *storepb.InstanceSett
default:
return errors.New("accessSetting.accessMode must be PRIVATE or PUBLIC")
}
+ case storepb.InstanceSettingKey_USAGE_LIMITS:
+ usageLimits := setting.GetUsageLimitsSetting()
+ if usageLimits == nil {
+ return errors.New("usageLimitsSetting must be populated for key USAGE_LIMITS")
+ }
+ if err := ValidateInstanceUsageLimitsSetting(usageLimits); err != nil {
+ return errors.Wrap(err, "usageLimitsSetting")
+ }
case storepb.InstanceSettingKey_BASIC, storepb.InstanceSettingKey_TAGS:
return errors.Errorf("key %s cannot be deployment configured", setting.Key)
default:
diff --git a/store/driver.go b/store/driver.go
index 78b3f865d..9c07d4a3b 100644
--- a/store/driver.go
+++ b/store/driver.go
@@ -34,6 +34,8 @@ type Driver interface {
UpdateMemo(ctx context.Context, update *UpdateMemo) error
DeleteMemo(ctx context.Context, delete *DeleteMemo) error
DeleteMemoWithPolicy(ctx context.Context, delete *DeleteMemoWithPolicy) (*DeleteMemoWithPolicyResult, error)
+ // CountUserMemos counts the memos a user created, comments included, in every row status and Space.
+ CountUserMemos(ctx context.Context, creatorID int32) (int64, error)
// Space model related methods.
CreateSpace(ctx context.Context, create *Space, creatorID int32) (*Space, error)
@@ -57,6 +59,8 @@ type Driver interface {
// InstanceSetting model related methods.
// CreateInstanceSettingIfNotExists atomically creates the setting when its name is absent and reports whether it inserted the row.
CreateInstanceSettingIfNotExists(ctx context.Context, create *InstanceSetting) (bool, error)
+ // UpdateInstanceSettingIfUnchanged replaces the value only when the stored value still equals oldValue, and reports whether it did.
+ UpdateInstanceSettingIfUnchanged(ctx context.Context, name, oldValue, newValue string) (bool, error)
UpsertInstanceSetting(ctx context.Context, upsert *InstanceSetting) (*InstanceSetting, error)
// UpsertInstanceSettingTx writes the setting within tx, for callers that must commit it together with other statements.
UpsertInstanceSettingTx(ctx context.Context, tx *sql.Tx, upsert *InstanceSetting) error
diff --git a/store/instance_setting.go b/store/instance_setting.go
index 11a1b1e26..c678ff25e 100644
--- a/store/instance_setting.go
+++ b/store/instance_setting.go
@@ -377,7 +377,7 @@ func (s *Store) GetInstanceAISetting(ctx context.Context) (*storepb.InstanceAISe
const (
defaultInstanceStorageType = storepb.InstanceStorageSetting_LOCAL
- defaultInstanceUploadSizeLimitMb = 30
+ defaultInstanceUploadSizeLimitMb = 32
defaultInstanceFilepathTemplate = "assets/{timestamp}_{uuid}_{filename}"
)
@@ -470,6 +470,12 @@ func convertInstanceSettingFromRaw(instanceSettingRaw *InstanceSetting) (*storep
return nil, err
}
instanceSetting.Value = &storepb.InstanceSetting_AccessSetting{AccessSetting: accessSetting}
+ case storepb.InstanceSettingKey_USAGE_LIMITS.String():
+ usageLimitsSetting := &storepb.InstanceUsageLimitsSetting{}
+ if err := protojsonUnmarshaler.Unmarshal([]byte(instanceSettingRaw.Value), usageLimitsSetting); err != nil {
+ return nil, err
+ }
+ instanceSetting.Value = &storepb.InstanceSetting_UsageLimitsSetting{UsageLimitsSetting: usageLimitsSetting}
default:
// Skip unsupported instance setting key.
return nil, nil
diff --git a/store/memo.go b/store/memo.go
index 59311f371..313de9639 100644
--- a/store/memo.go
+++ b/store/memo.go
@@ -229,6 +229,12 @@ func (s *Store) ListMemos(ctx context.Context, find *FindMemo) ([]*Memo, error)
return s.driver.ListMemos(ctx, find)
}
+// CountUserMemos counts the memos a user created, comments included, in every
+// row status and Space.
+func (s *Store) CountUserMemos(ctx context.Context, creatorID int32) (int64, error) {
+ return s.driver.CountUserMemos(ctx, creatorID)
+}
+
func (s *Store) GetMemo(ctx context.Context, find *FindMemo) (*Memo, error) {
list, err := s.ListMemos(ctx, find)
if err != nil {
diff --git a/store/migration/mysql/26.10/00__add_creator_indexes.sql b/store/migration/mysql/26.10/00__add_creator_indexes.sql
new file mode 100644
index 000000000..96a0df3ab
--- /dev/null
+++ b/store/migration/mysql/26.10/00__add_creator_indexes.sql
@@ -0,0 +1,2 @@
+CREATE INDEX `idx_memo_creator_id` ON `memo`(`creator_id`);
+CREATE INDEX `idx_attachment_creator_id` ON `attachment`(`creator_id`);
diff --git a/store/migration/mysql/LATEST.sql b/store/migration/mysql/LATEST.sql
index 77d9e3aba..7c763c895 100644
--- a/store/migration/mysql/LATEST.sql
+++ b/store/migration/mysql/LATEST.sql
@@ -66,6 +66,7 @@ CREATE TABLE `memo` (
);
CREATE INDEX `idx_memo_space_id` ON `memo`(`space_id`, `row_status`, `created_ts`, `id`);
+CREATE INDEX `idx_memo_creator_id` ON `memo`(`creator_id`);
-- memo_relation
CREATE TABLE `memo_relation` (
@@ -95,6 +96,8 @@ CREATE TABLE `attachment` (
`payload` TEXT NOT NULL
);
+CREATE INDEX `idx_attachment_creator_id` ON `attachment`(`creator_id`);
+
-- idp
CREATE TABLE `idp` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
diff --git a/store/migration/postgres/26.10/00__add_creator_indexes.sql b/store/migration/postgres/26.10/00__add_creator_indexes.sql
new file mode 100644
index 000000000..bd9061cb9
--- /dev/null
+++ b/store/migration/postgres/26.10/00__add_creator_indexes.sql
@@ -0,0 +1,2 @@
+CREATE INDEX IF NOT EXISTS idx_memo_creator_id ON memo(creator_id);
+CREATE INDEX IF NOT EXISTS idx_attachment_creator_id ON attachment(creator_id);
diff --git a/store/migration/postgres/LATEST.sql b/store/migration/postgres/LATEST.sql
index ee86d5c15..f557c5bd1 100644
--- a/store/migration/postgres/LATEST.sql
+++ b/store/migration/postgres/LATEST.sql
@@ -66,6 +66,7 @@ CREATE TABLE memo (
);
CREATE INDEX idx_memo_space_id ON memo(space_id, row_status, created_ts DESC, id DESC);
+CREATE INDEX idx_memo_creator_id ON memo(creator_id);
-- memo_relation
CREATE TABLE memo_relation (
@@ -95,6 +96,8 @@ CREATE TABLE attachment (
payload TEXT NOT NULL DEFAULT '{}'
);
+CREATE INDEX idx_attachment_creator_id ON attachment(creator_id);
+
-- idp
CREATE TABLE idp (
id SERIAL PRIMARY KEY,
diff --git a/store/migration/sqlite/26.10/00__add_creator_indexes.sql b/store/migration/sqlite/26.10/00__add_creator_indexes.sql
new file mode 100644
index 000000000..6f53f343a
--- /dev/null
+++ b/store/migration/sqlite/26.10/00__add_creator_indexes.sql
@@ -0,0 +1,2 @@
+-- memo already has idx_memo_creator_id on SQLite.
+CREATE INDEX IF NOT EXISTS idx_attachment_creator_id ON attachment(creator_id);
diff --git a/store/migration/sqlite/LATEST.sql b/store/migration/sqlite/LATEST.sql
index 7b1217c30..b512fff85 100644
--- a/store/migration/sqlite/LATEST.sql
+++ b/store/migration/sqlite/LATEST.sql
@@ -97,6 +97,8 @@ CREATE TABLE attachment (
payload TEXT NOT NULL DEFAULT '{}'
);
+CREATE INDEX idx_attachment_creator_id ON attachment(creator_id);
+
-- idp
CREATE TABLE idp (
id INTEGER PRIMARY KEY AUTOINCREMENT,
diff --git a/store/test/README.md b/store/test/README.md
index 8adee757f..a19cf9d33 100644
--- a/store/test/README.md
+++ b/store/test/README.md
@@ -22,4 +22,4 @@ all three drivers before release.
the account, memo, saved View, and access mode, post-upgrade writes, and reopening the database after upgrade.
- From CalVer: `TestUpgradeFromCalendarRelease` uses local store fixtures for month changes, point releases, RC promotion,
and year changes. It checks the same preservation and restart behavior. These are fixtures, not published CalVer binaries;
- application versions advance while the current database schema remains `0.31.8`.
+ application versions advance while the database schema changes only with migrations.
diff --git a/store/test/attachment_test.go b/store/test/attachment_test.go
index c675bf008..b494808b7 100644
--- a/store/test/attachment_test.go
+++ b/store/test/attachment_test.go
@@ -733,9 +733,14 @@ func TestAttachmentStorageUsage(t *testing.T) {
}
_, err = ts.CreateAttachment(ctx, &store.Attachment{UID: shortuuid.New(), CreatorID: 102, Filename: "other", Size: 123})
require.NoError(t, err)
+ // External links store no bytes, even when an import declared a size.
+ _, err = ts.CreateAttachment(ctx, &store.Attachment{
+ UID: shortuuid.New(), CreatorID: creator.ID, Filename: "link", Size: 456, StorageType: storepb.AttachmentStorageType_EXTERNAL, Reference: "https://example.com/file",
+ })
+ require.NoError(t, err)
size, err = ts.GetAttachmentStorageUsage(ctx, creator.ID)
require.NoError(t, err)
- require.Equal(t, expected, size)
+ require.Equal(t, expected, size, "external links do not count")
memo, err := ts.CreateMemo(ctx, &store.Memo{UID: shortuuid.New(), CreatorID: creator.ID, Content: "memo", Visibility: store.Private})
require.NoError(t, err)
diff --git a/store/test/instance_setting_test.go b/store/test/instance_setting_test.go
index d85dfdc0e..634a1898f 100644
--- a/store/test/instance_setting_test.go
+++ b/store/test/instance_setting_test.go
@@ -285,7 +285,7 @@ func TestInstanceSettingStorageSetting(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, storageSetting)
require.Equal(t, storepb.InstanceStorageSetting_LOCAL, storageSetting.StorageType)
- require.Equal(t, int64(30), storageSetting.UploadSizeLimitMb)
+ require.Equal(t, int64(32), storageSetting.UploadSizeLimitMb)
require.Equal(t, "assets/{timestamp}_{uuid}_{filename}", storageSetting.FilepathTemplate)
// Set custom storage setting
diff --git a/store/test/migrator_guardrail_test.go b/store/test/migrator_guardrail_test.go
index dea067393..1f05ab6f0 100644
--- a/store/test/migrator_guardrail_test.go
+++ b/store/test/migrator_guardrail_test.go
@@ -45,7 +45,7 @@ func TestMigrationRejectsUnsupportedSchema(t *testing.T) {
{name: "zero", schema: "0.0.0", message: "First upgrade to v0.25.3"},
{name: "missing-basic", missingBasic: true, message: "First upgrade to v0.25.3"},
{name: "invalid-month", schema: "26.13.1", message: "invalid database schema version"},
- {name: "calver-newer", schema: "26.9.1", message: "cannot downgrade schema version"},
+ {name: "calver-newer", schema: "26.10.2", message: "cannot downgrade schema version"},
{name: "invalid", schema: "unknown", message: "invalid database schema version"},
{name: "incomplete", schema: "0.31", message: "invalid database schema version"},
{name: "prerelease", schema: "0.31.8-rc.1", message: "invalid database schema version"},
diff --git a/store/test/migrator_test.go b/store/test/migrator_test.go
index 7b0e07308..d3bd52686 100644
--- a/store/test/migrator_test.go
+++ b/store/test/migrator_test.go
@@ -47,7 +47,7 @@ func TestFreshInstall(t *testing.T) {
// Verify migration completed successfully
currentSchemaVersion, err := ts.GetCurrentSchemaVersion()
require.NoError(t, err)
- require.Equal(t, "0.31.8", currentSchemaVersion, "fresh install should start at the retained baseline")
+ require.Equal(t, "26.10.1", currentSchemaVersion, "fresh install should record the latest migration")
// Verify we can read instance settings (basic sanity check)
instanceSetting, err := ts.GetInstanceBasicSetting(ctx)
@@ -82,12 +82,28 @@ func TestFreshInstall(t *testing.T) {
requireQueryError(ctx, t, ts.GetDriver().GetDB(), "SELECT parent_memo_id, root_memo_id FROM memo LIMIT 0", "fresh memo schema must not contain canonical-root columns")
requireQueryError(ctx, t, ts.GetDriver().GetDB(), "SELECT row_status FROM space LIMIT 0", "fresh Space schema has no archived state")
- if driver == "sqlite" {
- var indexName string
- require.NoError(t, ts.GetDriver().GetDB().QueryRowContext(ctx,
- "SELECT name FROM sqlite_master WHERE type = 'index' AND name = 'idx_memo_creator_id'",
- ).Scan(&indexName))
- require.Equal(t, "idx_memo_creator_id", indexName)
+ requireCreatorIndexes(ctx, t, ts, driver)
+}
+
+// requireCreatorIndexes checks the indexes that usage limit checks rely on to
+// count a user's memos and sum a user's attachment sizes.
+func requireCreatorIndexes(ctx context.Context, t *testing.T, ts *store.Store, driver string) {
+ t.Helper()
+ for _, indexName := range []string{"idx_memo_creator_id", "idx_attachment_creator_id"} {
+ var query string
+ switch driver {
+ case "sqlite":
+ query = "SELECT COUNT(*) FROM sqlite_master WHERE type = 'index' AND name = ?"
+ case "mysql":
+ query = "SELECT COUNT(DISTINCT INDEX_NAME) FROM information_schema.STATISTICS WHERE TABLE_SCHEMA = DATABASE() AND INDEX_NAME = ?"
+ case "postgres":
+ query = "SELECT COUNT(*) FROM pg_indexes WHERE schemaname = current_schema() AND indexname = $1"
+ default:
+ t.Fatalf("unsupported driver: %s", driver)
+ }
+ var count int
+ require.NoError(t, ts.GetDriver().GetDB().QueryRowContext(ctx, query, indexName).Scan(&count))
+ require.Equal(t, 1, count, "index %s must exist", indexName)
}
}
diff --git a/store/test/migrator_upgrade_test.go b/store/test/migrator_upgrade_test.go
index b6af04fd7..1c1d04b7e 100644
--- a/store/test/migrator_upgrade_test.go
+++ b/store/test/migrator_upgrade_test.go
@@ -48,7 +48,7 @@ func TestUpgradeFromBaselineRelease(t *testing.T) {
// TestUpgradeFromCalendarRelease uses local store fixtures until a published
// CalVer release is available. Application versions do not advance the schema:
-// the first CalVer releases retain v0.31.0's schema unless migrations are added.
+// only migrations do.
func TestUpgradeFromCalendarRelease(t *testing.T) {
for _, tc := range []struct{ previous, candidate string }{
{previous: "26.09", candidate: "26.10"},
@@ -68,7 +68,9 @@ func TestUpgradeFromCalendarRelease(t *testing.T) {
require.NoError(t, previous.Migrate(ctx))
baseline, err := previous.GetInstanceBasicSetting(ctx)
require.NoError(t, err)
- require.Equal(t, "0.31.8", baseline.SchemaVersion, "application CalVer must not become the database schema version")
+ currentSchema, err := previous.GetCurrentSchemaVersion()
+ require.NoError(t, err)
+ require.Equal(t, currentSchema, baseline.SchemaVersion, "application CalVer must not become the database schema version")
candidateProfile := *previousProfile
candidateProfile.Version = tc.candidate
@@ -124,6 +126,7 @@ func requireUpgradePreservesData(ctx context.Context, t *testing.T, previous *st
preservedAccess, err := candidate.GetInstanceAccessSetting(ctx)
require.NoError(t, err)
require.True(t, proto.Equal(access.GetAccessSetting(), preservedAccess), "explicit access mode must not be reset")
+ requireCreatorIndexes(ctx, t, candidate, candidateProfile.Driver)
}
driver, err := storedb.NewDBDriver(candidateProfile)
diff --git a/store/test/usage_limit_test.go b/store/test/usage_limit_test.go
new file mode 100644
index 000000000..b4342769a
--- /dev/null
+++ b/store/test/usage_limit_test.go
@@ -0,0 +1,350 @@
+package test
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "os"
+ "path/filepath"
+ "sync"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ storepb "github.com/usememos/memos/proto/gen/store"
+ "github.com/usememos/memos/store"
+ storedb "github.com/usememos/memos/store/db"
+)
+
+func usageLimit(uid string, metric storepb.InstanceUsageLimitsSetting_Metric, userID int32, value int64) *storepb.InstanceUsageLimitsSetting_UsageLimit {
+ return &storepb.InstanceUsageLimitsSetting_UsageLimit{Uid: uid, Metric: metric, UserId: userID, Value: value}
+}
+
+func storedUsageLimitUIDs(ctx context.Context, t *testing.T, ts *store.Store) []string {
+ t.Helper()
+ setting, err := ts.GetInstanceUsageLimitsSetting(ctx)
+ require.NoError(t, err)
+ uids := []string{}
+ for _, limit := range setting.Limits {
+ uids = append(uids, limit.Uid)
+ }
+ return uids
+}
+
+func TestCountUserMemos(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+
+ owner, err := ts.CreateUser(ctx, &store.User{Username: "count-owner", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+ other, err := ts.CreateUser(ctx, &store.User{Username: "count-other", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+
+ count, err := ts.CountUserMemos(ctx, owner.ID)
+ require.NoError(t, err)
+ require.Zero(t, count)
+
+ root, err := ts.CreateMemo(ctx, &store.Memo{UID: "count-root", CreatorID: owner.ID, Content: "root", Visibility: store.Public})
+ require.NoError(t, err)
+ archived, err := ts.CreateMemo(ctx, &store.Memo{UID: "count-archived", CreatorID: owner.ID, Content: "archived", Visibility: store.Private})
+ require.NoError(t, err)
+ archivedStatus := store.Archived
+ require.NoError(t, ts.UpdateMemo(ctx, &store.UpdateMemo{ID: archived.ID, RowStatus: &archivedStatus}))
+ space, err := ts.CreateSpace(ctx, &store.Space{UID: "count-space", Title: "Count"}, owner.ID)
+ require.NoError(t, err)
+ _, err = ts.CreateMemo(ctx, &store.Memo{UID: "count-space-memo", CreatorID: owner.ID, Content: "space", Visibility: store.SpaceAudience, SpaceID: &space.ID})
+ require.NoError(t, err)
+ _, err = ts.CreateMemoComment(ctx, &store.Memo{UID: "count-comment", CreatorID: owner.ID, Content: "comment", Visibility: store.Public}, root.ID, owner.ID)
+ require.NoError(t, err)
+ _, err = ts.CreateMemo(ctx, &store.Memo{UID: "count-other-memo", CreatorID: other.ID, Content: "other", Visibility: store.Public})
+ require.NoError(t, err)
+
+ count, err = ts.CountUserMemos(ctx, owner.ID)
+ require.NoError(t, err)
+ require.Equal(t, int64(4), count, "archived memos, Space memos, and comments count; other users' memos do not")
+
+ require.NoError(t, ts.DeleteMemo(ctx, &store.DeleteMemo{ID: archived.ID}))
+ count, err = ts.CountUserMemos(ctx, owner.ID)
+ require.NoError(t, err)
+ require.Equal(t, int64(3), count, "deleting a memo frees a slot")
+}
+
+func TestUpdateInstanceSettingIfUnchanged(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+ driver := ts.GetDriver()
+
+ updated, err := driver.UpdateInstanceSettingIfUnchanged(ctx, "CONDITIONAL_TEST", "", "first")
+ require.NoError(t, err)
+ require.False(t, updated, "a missing row is never updated")
+
+ created, err := driver.CreateInstanceSettingIfNotExists(ctx, &store.InstanceSetting{Name: "CONDITIONAL_TEST", Value: "first"})
+ require.NoError(t, err)
+ require.True(t, created)
+
+ updated, err = driver.UpdateInstanceSettingIfUnchanged(ctx, "CONDITIONAL_TEST", "stale", "second")
+ require.NoError(t, err)
+ require.False(t, updated, "a stale old value must not overwrite")
+ updated, err = driver.UpdateInstanceSettingIfUnchanged(ctx, "CONDITIONAL_TEST", "FIRST", "second")
+ require.NoError(t, err)
+ require.False(t, updated, "the comparison is exact, including case")
+
+ updated, err = driver.UpdateInstanceSettingIfUnchanged(ctx, "CONDITIONAL_TEST", "first", "second")
+ require.NoError(t, err)
+ require.True(t, updated)
+ updated, err = driver.UpdateInstanceSettingIfUnchanged(ctx, "CONDITIONAL_TEST", "second", "second")
+ require.NoError(t, err)
+ require.True(t, updated, "writing the stored value again succeeds")
+
+ settings, err := driver.ListInstanceSettings(ctx, &store.FindInstanceSetting{Name: "CONDITIONAL_TEST"})
+ require.NoError(t, err)
+ require.Len(t, settings, 1)
+ require.Equal(t, "second", settings[0].Value)
+}
+
+func TestUsageLimitLifecycle(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+ alice, err := ts.CreateUser(ctx, &store.User{Username: "limit-alice", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+
+ setting, err := ts.GetInstanceUsageLimitsSetting(ctx)
+ require.NoError(t, err)
+ require.Empty(t, setting.Limits, "an instance starts with no usage limits")
+
+ created, err := ts.CreateUsageLimit(ctx, usageLimit("default-memos", storepb.InstanceUsageLimitsSetting_MEMOS, 0, 1000))
+ require.NoError(t, err)
+ require.NotNil(t, created.CreateTime)
+ require.Equal(t, created.CreateTime.AsTime(), created.UpdateTime.AsTime())
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("alice-storage", storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, alice.ID, 5<<30))
+ require.NoError(t, err)
+ require.Equal(t, []string{"default-memos", "alice-storage"}, storedUsageLimitUIDs(ctx, t, ts))
+
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("default-memos", storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, 0, 1))
+ require.ErrorIs(t, err, store.ErrUsageLimitAlreadyExists, "IDs are unique")
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("other-memos", storepb.InstanceUsageLimitsSetting_MEMOS, 0, 1))
+ require.ErrorIs(t, err, store.ErrUsageLimitAlreadyExists, "one default per metric")
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("alice-storage-2", storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, alice.ID, 1))
+ require.ErrorIs(t, err, store.ErrUsageLimitAlreadyExists, "one limit per metric and user")
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("negative", storepb.InstanceUsageLimitsSetting_UPLOAD_BYTES, 0, -1))
+ require.ErrorIs(t, err, store.ErrInvalidUsageLimit)
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("Bad_ID", storepb.InstanceUsageLimitsSetting_UPLOAD_BYTES, 0, 1))
+ require.ErrorIs(t, err, store.ErrInvalidUsageLimit)
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("no-metric", storepb.InstanceUsageLimitsSetting_METRIC_UNSPECIFIED, 0, 1))
+ require.ErrorIs(t, err, store.ErrInvalidUsageLimit)
+
+ updated, err := ts.UpdateUsageLimit(ctx, "default-memos", 2000)
+ require.NoError(t, err)
+ require.Equal(t, int64(2000), updated.Value)
+ require.False(t, updated.UpdateTime.AsTime().Before(updated.CreateTime.AsTime()))
+ _, err = ts.UpdateUsageLimit(ctx, "missing", 1)
+ require.ErrorIs(t, err, store.ErrUsageLimitNotFound)
+
+ require.NoError(t, ts.DeleteUsageLimit(ctx, "alice-storage"))
+ require.ErrorIs(t, ts.DeleteUsageLimit(ctx, "alice-storage"), store.ErrUsageLimitNotFound)
+ require.Equal(t, []string{"default-memos"}, storedUsageLimitUIDs(ctx, t, ts))
+
+ // The row is store only: the generic setting reads see it, but its key has
+ // no API counterpart, and it round-trips through the raw conversion.
+ stored, err := ts.GetStoredInstanceSetting(ctx, &store.FindInstanceSetting{Name: storepb.InstanceSettingKey_USAGE_LIMITS.String()})
+ require.NoError(t, err)
+ require.Equal(t, int64(2000), stored.GetUsageLimitsSetting().Limits[0].Value)
+}
+
+func TestUsageLimitCap(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+
+ limits := make([]*storepb.InstanceUsageLimitsSetting_UsageLimit, 0, store.MaxUsageLimits)
+ for i := range store.MaxUsageLimits {
+ // Writes prune limits of missing users, so the cap is checked on the
+ // validator that every write runs.
+ limits = append(limits, usageLimit(fmt.Sprintf("limit-%d", i), storepb.InstanceUsageLimitsSetting_MEMOS, int32(i), 1))
+ }
+ require.NoError(t, store.ValidateInstanceUsageLimitsSetting(&storepb.InstanceUsageLimitsSetting{Limits: limits}))
+ limits = append(limits, usageLimit("one-too-many", storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, 0, 1))
+ require.ErrorIs(t, store.ValidateInstanceUsageLimitsSetting(&storepb.InstanceUsageLimitsSetting{Limits: limits}), store.ErrInvalidUsageLimit)
+}
+
+func TestDeleteUserRemovesUsageLimits(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+ alice, err := ts.CreateUser(ctx, &store.User{Username: "delete-alice", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+ bob, err := ts.CreateUser(ctx, &store.User{Username: "delete-bob", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+ for _, limit := range []*storepb.InstanceUsageLimitsSetting_UsageLimit{
+ usageLimit("default-storage", storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, 0, 1<<30),
+ usageLimit("alice-storage", storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, alice.ID, 5<<30),
+ usageLimit("alice-memos", storepb.InstanceUsageLimitsSetting_MEMOS, alice.ID, 10),
+ usageLimit("bob-memos", storepb.InstanceUsageLimitsSetting_MEMOS, bob.ID, 20),
+ } {
+ _, err := ts.CreateUsageLimit(ctx, limit)
+ require.NoError(t, err)
+ }
+
+ _, err = ts.DeleteUser(ctx, &store.DeleteUser{ID: alice.ID})
+ require.NoError(t, err)
+ require.Equal(t, []string{"default-storage", "bob-memos"}, storedUsageLimitUIDs(ctx, t, ts))
+}
+
+func TestUsageLimitWritesPruneMissingUsers(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+ alice, err := ts.CreateUser(ctx, &store.User{Username: "prune-alice", Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+
+ // An entry for a user that no longer exists, as a failed cleanup would leave.
+ _, err = ts.GetDriver().UpsertInstanceSetting(ctx, &store.InstanceSetting{
+ Name: storepb.InstanceSettingKey_USAGE_LIMITS.String(),
+ Value: `{"limits":[{"uid":"ghost-memos","metric":"MEMOS","userId":99999,"value":"1"}]}`,
+ })
+ require.NoError(t, err)
+
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("alice-memos", storepb.InstanceUsageLimitsSetting_MEMOS, alice.ID, 5))
+ require.NoError(t, err)
+ require.Equal(t, []string{"alice-memos"}, storedUsageLimitUIDs(ctx, t, ts))
+}
+
+func TestUsageLimitsDeploymentFile(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ ts := NewTestingStore(ctx, t)
+ defer ts.Close()
+ _, err := ts.CreateUsageLimit(ctx, usageLimit("stored-memos", storepb.InstanceUsageLimitsSetting_MEMOS, 0, 10))
+ require.NoError(t, err)
+
+ dir := t.TempDir()
+ path := filepath.Join(dir, "memos-instance-setting-usage-limits.json")
+ require.NoError(t, os.WriteFile(path, []byte(`{"key":"USAGE_LIMITS","usageLimitsSetting":{"limits":[
+ {"uid":"default-storage","metric":"STORAGE_BYTES","value":"1073741824"},
+ {"uid":"alice-storage","metric":"STORAGE_BYTES","userId":7,"value":"5368709120"}
+ ]}}`), 0o600))
+ require.NoError(t, ts.LoadDeploymentConfigurationDir(ctx, dir))
+
+ require.Equal(t, []string{"default-storage", "alice-storage"}, storedUsageLimitUIDs(ctx, t, ts), "the file shadows the stored row")
+ _, err = ts.CreateUsageLimit(ctx, usageLimit("new-memos", storepb.InstanceUsageLimitsSetting_UPLOAD_BYTES, 0, 1))
+ require.ErrorIs(t, err, store.ErrUsageLimitsDeploymentConfigured)
+ require.ErrorIs(t, ts.DeleteUsageLimit(ctx, "default-storage"), store.ErrUsageLimitsDeploymentConfigured)
+ require.NoError(t, ts.DeleteUsageLimitsForUser(ctx, 7), "user deletion cleanup skips file-provided limits")
+
+ stored, err := ts.GetStoredInstanceSetting(ctx, &store.FindInstanceSetting{Name: storepb.InstanceSettingKey_USAGE_LIMITS.String()})
+ require.NoError(t, err)
+ require.Equal(t, "stored-memos", stored.GetUsageLimitsSetting().Limits[0].Uid, "the stored row is unchanged")
+
+ for name, content := range map[string]string{
+ "missing value": `{"key":"USAGE_LIMITS"}`,
+ "negative value": `{"key":"USAGE_LIMITS","usageLimitsSetting":{"limits":[{"uid":"bad","metric":"MEMOS","value":"-1"}]}}`,
+ "duplicate pair": `{"key":"USAGE_LIMITS","usageLimitsSetting":{"limits":[{"uid":"a","metric":"MEMOS","value":"1"},{"uid":"b","metric":"MEMOS","value":"2"}]}}`,
+ "unknown field": `{"key":"USAGE_LIMITS","usageLimitsSetting":{"limits":[{"uid":"a","metric":"MEMOS","value":"1","plan":"pro"}]}}`,
+ } {
+ invalidDir := t.TempDir()
+ require.NoError(t, os.WriteFile(filepath.Join(invalidDir, "memos-instance-setting-usage-limits.json"), []byte(content), 0o600))
+ require.Error(t, ts.LoadDeploymentConfigurationDir(ctx, invalidDir), name)
+ }
+}
+
+// TestUsageLimitsAcrossReplicas runs two stores on one database, as two
+// server replicas do. A change through one is read by the other at once, and
+// concurrent writes never lose an update or break uniqueness.
+func TestUsageLimitsAcrossReplicas(t *testing.T) {
+ t.Parallel()
+ ctx := context.Background()
+ profile := getTestingProfileForDriver(t, getDriverFromEnv())
+ openReplica := func() *store.Store {
+ driver, err := storedb.NewDBDriver(profile)
+ require.NoError(t, err)
+ replica := store.New(driver, profile)
+ t.Cleanup(func() { _ = replica.Close() })
+ require.NoError(t, replica.Migrate(ctx))
+ return replica
+ }
+ first := openReplica()
+ second := openReplica()
+
+ // Warm the second replica's settings cache; usage limit reads must bypass it.
+ _, err := second.GetInstanceUsageLimitsSetting(ctx)
+ require.NoError(t, err)
+ _, err = first.CreateUsageLimit(ctx, usageLimit("default-memos", storepb.InstanceUsageLimitsSetting_MEMOS, 0, 3))
+ require.NoError(t, err)
+ require.Equal(t, []string{"default-memos"}, storedUsageLimitUIDs(ctx, t, second))
+
+ users := make([]*store.User, 6)
+ for i := range users {
+ users[i], err = first.CreateUser(ctx, &store.User{Username: fmt.Sprintf("replica-user-%d", i), Role: store.RoleUser, PasswordHash: "hash"})
+ require.NoError(t, err)
+ }
+
+ // Concurrent creates for the same metric and user leave exactly one limit.
+ var wg sync.WaitGroup
+ var mu sync.Mutex
+ succeeded := 0
+ for i := range 6 {
+ replica := first
+ if i%2 == 1 {
+ replica = second
+ }
+ wg.Go(func() {
+ _, err := replica.CreateUsageLimit(ctx, usageLimit(fmt.Sprintf("same-target-%d", i), storepb.InstanceUsageLimitsSetting_STORAGE_BYTES, users[0].ID, int64(i+1)))
+ if err == nil {
+ mu.Lock()
+ succeeded++
+ mu.Unlock()
+ return
+ }
+ if !isExpectedUsageLimitRace(err) {
+ t.Errorf("unexpected error: %v", err)
+ }
+ })
+ }
+ wg.Wait()
+ require.Equal(t, 1, succeeded)
+
+ // Concurrent creates for different users never lose an update: every
+ // create that reports success is stored.
+ created := []string{}
+ for i, user := range users {
+ replica := first
+ if i%2 == 1 {
+ replica = second
+ }
+ uid := fmt.Sprintf("memos-user-%d", i)
+ wg.Go(func() {
+ _, err := replica.CreateUsageLimit(ctx, usageLimit(uid, storepb.InstanceUsageLimitsSetting_MEMOS, user.ID, 5))
+ if err == nil {
+ mu.Lock()
+ created = append(created, uid)
+ mu.Unlock()
+ return
+ }
+ if !isExpectedUsageLimitRace(err) {
+ t.Errorf("unexpected error: %v", err)
+ }
+ })
+ }
+ wg.Wait()
+ require.NotEmpty(t, created)
+ stored := storedUsageLimitUIDs(ctx, t, first)
+ for _, uid := range created {
+ require.Contains(t, stored, uid)
+ }
+ require.Len(t, stored, 2+len(created))
+}
+
+// isExpectedUsageLimitRace reports the errors a losing concurrent writer may
+// see: the pair is taken, or the retries ran out.
+func isExpectedUsageLimitRace(err error) bool {
+ return errors.Is(err, store.ErrUsageLimitAlreadyExists) || errors.Is(err, store.ErrUsageLimitWriteConflict)
+}
diff --git a/store/usage_limit.go b/store/usage_limit.go
new file mode 100644
index 000000000..3c3bd5ca8
--- /dev/null
+++ b/store/usage_limit.go
@@ -0,0 +1,288 @@
+package store
+
+import (
+ "context"
+ "log/slog"
+ "regexp"
+ "slices"
+
+ "github.com/pkg/errors"
+ "google.golang.org/protobuf/encoding/protojson"
+ "google.golang.org/protobuf/proto"
+ "google.golang.org/protobuf/types/known/timestamppb"
+
+ storepb "github.com/usememos/memos/proto/gen/store"
+)
+
+// MaxUsageLimits is the most usage limits an instance can hold. All limits
+// share one system_setting row, so the cap also bounds that row's size.
+const MaxUsageLimits = 1000
+
+// usageLimitWriteAttempts bounds the read, modify, and conditional write cycle
+// when other writers keep changing the usage limits row.
+const usageLimitWriteAttempts = 5
+
+// UsageLimitUIDMatcher matches a usage limit ID: lowercase kebab case that
+// starts with a letter, at most 32 characters.
+var UsageLimitUIDMatcher = regexp.MustCompile(`^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$`)
+
+const maxUsageLimitUIDLength = 32
+
+var (
+ // ErrUsageLimitNotFound indicates that no usage limit has the given ID.
+ ErrUsageLimitNotFound = errors.New("usage limit not found")
+ // ErrUsageLimitAlreadyExists indicates that the ID, or the metric and user
+ // pair, is already taken by another usage limit.
+ ErrUsageLimitAlreadyExists = errors.New("usage limit already exists")
+ // ErrUsageLimitsDeploymentConfigured indicates that the usage limits come
+ // from a deployment file and cannot be changed at runtime.
+ ErrUsageLimitsDeploymentConfigured = errors.New("usage limits are configured by the deployment")
+ // ErrUsageLimitWriteConflict indicates that other writers changed the usage
+ // limits on every attempt.
+ ErrUsageLimitWriteConflict = errors.New("usage limits changed concurrently; retry")
+ // ErrInvalidUsageLimit indicates a usage limit that breaks a validation rule.
+ ErrInvalidUsageLimit = errors.New("invalid usage limit")
+)
+
+// ValidateInstanceUsageLimitsSetting checks the rules every stored list of
+// usage limits meets, whether it comes from the API or from a deployment file:
+// at most MaxUsageLimits entries, valid and unique IDs, known metrics,
+// non-negative values and user IDs, and at most one limit per metric and user.
+func ValidateInstanceUsageLimitsSetting(setting *storepb.InstanceUsageLimitsSetting) error {
+ limits := setting.GetLimits()
+ if len(limits) > MaxUsageLimits {
+ return errors.Wrapf(ErrInvalidUsageLimit, "at most %d usage limits are allowed", MaxUsageLimits)
+ }
+ type target struct {
+ metric storepb.InstanceUsageLimitsSetting_Metric
+ userID int32
+ }
+ uids := make(map[string]struct{}, len(limits))
+ targets := make(map[target]struct{}, len(limits))
+ for i, limit := range limits {
+ if limit == nil {
+ return errors.Wrapf(ErrInvalidUsageLimit, "limits[%d] must not be null", i)
+ }
+ if len(limit.Uid) > maxUsageLimitUIDLength || !UsageLimitUIDMatcher.MatchString(limit.Uid) {
+ return errors.Wrapf(ErrInvalidUsageLimit, "limits[%d].uid %q must be lowercase kebab case, start with a letter, and have at most %d characters", i, limit.Uid, maxUsageLimitUIDLength)
+ }
+ if !IsValidUsageLimitMetric(limit.Metric) {
+ return errors.Wrapf(ErrInvalidUsageLimit, "limits[%d].metric must be MEMOS, STORAGE_BYTES, or UPLOAD_BYTES", i)
+ }
+ if limit.UserId < 0 {
+ return errors.Wrapf(ErrInvalidUsageLimit, "limits[%d].userId must not be negative", i)
+ }
+ if limit.Value < 0 {
+ return errors.Wrapf(ErrInvalidUsageLimit, "limits[%d].value must not be negative", i)
+ }
+ if _, ok := uids[limit.Uid]; ok {
+ return errors.Wrapf(ErrUsageLimitAlreadyExists, "usage limit ID %q is used more than once", limit.Uid)
+ }
+ uids[limit.Uid] = struct{}{}
+ key := target{metric: limit.Metric, userID: limit.UserId}
+ if _, ok := targets[key]; ok {
+ return errors.Wrapf(ErrUsageLimitAlreadyExists, "more than one %s limit for user ID %d", limit.Metric, limit.UserId)
+ }
+ targets[key] = struct{}{}
+ }
+ return nil
+}
+
+// IsValidUsageLimitMetric reports whether metric is one that limits can be set for.
+func IsValidUsageLimitMetric(metric storepb.InstanceUsageLimitsSetting_Metric) bool {
+ switch metric {
+ case storepb.InstanceUsageLimitsSetting_MEMOS,
+ storepb.InstanceUsageLimitsSetting_STORAGE_BYTES,
+ storepb.InstanceUsageLimitsSetting_UPLOAD_BYTES:
+ return true
+ default:
+ return false
+ }
+}
+
+// GetInstanceUsageLimitsSetting returns every usage limit. A deployment file
+// takes precedence over the database. The database row is read directly,
+// without the instance setting cache, so a change made through any replica
+// applies at the next check on every replica.
+func (s *Store) GetInstanceUsageLimitsSetting(ctx context.Context) (*storepb.InstanceUsageLimitsSetting, error) {
+ instanceSetting := s.getDeploymentInstanceSetting(storepb.InstanceSettingKey_USAGE_LIMITS)
+ if instanceSetting == nil {
+ var err error
+ instanceSetting, err = s.getRawInstanceSetting(ctx, storepb.InstanceSettingKey_USAGE_LIMITS.String())
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to get usage limits setting")
+ }
+ }
+ if setting := instanceSetting.GetUsageLimitsSetting(); setting != nil {
+ return setting, nil
+ }
+ return &storepb.InstanceUsageLimitsSetting{}, nil
+}
+
+// CreateUsageLimit adds a usage limit. create.Uid, Metric, UserId, and Value
+// must be set; the create and update times are set here.
+func (s *Store) CreateUsageLimit(ctx context.Context, create *storepb.InstanceUsageLimitsSetting_UsageLimit) (*storepb.InstanceUsageLimitsSetting_UsageLimit, error) {
+ var created *storepb.InstanceUsageLimitsSetting_UsageLimit
+ err := s.mutateUsageLimits(ctx, func(limits []*storepb.InstanceUsageLimitsSetting_UsageLimit) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, bool, error) {
+ for _, limit := range limits {
+ if limit.Uid == create.Uid {
+ return nil, false, errors.Wrapf(ErrUsageLimitAlreadyExists, "usage limit ID %q already exists", create.Uid)
+ }
+ if limit.Metric == create.Metric && limit.UserId == create.UserId {
+ return nil, false, errors.Wrapf(ErrUsageLimitAlreadyExists, "usage limit %q already sets %s for this user", limit.Uid, limit.Metric)
+ }
+ }
+ now := timestamppb.Now()
+ created = proto.CloneOf(create)
+ created.CreateTime = now
+ created.UpdateTime = now
+ return append(limits, created), true, nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return created, nil
+}
+
+// UpdateUsageLimit sets the value of the usage limit uid.
+func (s *Store) UpdateUsageLimit(ctx context.Context, uid string, value int64) (*storepb.InstanceUsageLimitsSetting_UsageLimit, error) {
+ var updated *storepb.InstanceUsageLimitsSetting_UsageLimit
+ err := s.mutateUsageLimits(ctx, func(limits []*storepb.InstanceUsageLimitsSetting_UsageLimit) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, bool, error) {
+ index := slices.IndexFunc(limits, func(limit *storepb.InstanceUsageLimitsSetting_UsageLimit) bool { return limit.Uid == uid })
+ if index < 0 {
+ return nil, false, ErrUsageLimitNotFound
+ }
+ updated = limits[index]
+ if updated.Value == value {
+ return limits, false, nil
+ }
+ updated.Value = value
+ updated.UpdateTime = timestamppb.Now()
+ return limits, true, nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return updated, nil
+}
+
+// DeleteUsageLimit removes the usage limit uid.
+func (s *Store) DeleteUsageLimit(ctx context.Context, uid string) error {
+ return s.mutateUsageLimits(ctx, func(limits []*storepb.InstanceUsageLimitsSetting_UsageLimit) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, bool, error) {
+ next := slices.DeleteFunc(limits, func(limit *storepb.InstanceUsageLimitsSetting_UsageLimit) bool { return limit.Uid == uid })
+ if len(next) == len(limits) {
+ return nil, false, ErrUsageLimitNotFound
+ }
+ return next, true, nil
+ })
+}
+
+// DeleteUsageLimitsForUser removes every usage limit of userID. It does
+// nothing when the limits come from a deployment file, because the store
+// cannot change them; entries for a missing user are ignored at evaluation.
+func (s *Store) DeleteUsageLimitsForUser(ctx context.Context, userID int32) error {
+ if userID == 0 || s.IsInstanceSettingDeploymentConfigured(storepb.InstanceSettingKey_USAGE_LIMITS) {
+ return nil
+ }
+ return s.mutateUsageLimits(ctx, func(limits []*storepb.InstanceUsageLimitsSetting_UsageLimit) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, bool, error) {
+ before := len(limits)
+ next := slices.DeleteFunc(limits, func(limit *storepb.InstanceUsageLimitsSetting_UsageLimit) bool { return limit.UserId == userID })
+ return next, len(next) != before, nil
+ })
+}
+
+// usageLimitsMutation receives a private copy of the stored limits and returns
+// the new list and whether it changed. Returning an error aborts the write.
+type usageLimitsMutation func(limits []*storepb.InstanceUsageLimitsSetting_UsageLimit) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, bool, error)
+
+// mutateUsageLimits applies mutate as a read, modify, and conditional write of
+// the USAGE_LIMITS row. The write succeeds only if the row is unchanged since
+// it was read; otherwise the whole step runs again, so concurrent writers on
+// any replica never overwrite each other. Uniqueness and the cap are checked
+// on the list that is written, which makes them safe across replicas.
+func (s *Store) mutateUsageLimits(ctx context.Context, mutate usageLimitsMutation) error {
+ if s.IsInstanceSettingDeploymentConfigured(storepb.InstanceSettingKey_USAGE_LIMITS) {
+ return ErrUsageLimitsDeploymentConfigured
+ }
+ name := storepb.InstanceSettingKey_USAGE_LIMITS.String()
+ for range usageLimitWriteAttempts {
+ list, err := s.driver.ListInstanceSettings(ctx, &FindInstanceSetting{Name: name})
+ if err != nil {
+ return errors.Wrap(err, "failed to read usage limits")
+ }
+ current := &storepb.InstanceUsageLimitsSetting{}
+ var oldValue string
+ exists := len(list) > 0
+ if exists {
+ oldValue = list[0].Value
+ if err := protojsonUnmarshaler.Unmarshal([]byte(oldValue), current); err != nil {
+ return errors.Wrap(err, "failed to parse stored usage limits")
+ }
+ }
+
+ next, changed, err := mutate(current.Limits)
+ if err != nil {
+ return err
+ }
+ pruned, err := s.pruneUsageLimitsOfMissingUsers(ctx, next)
+ if err != nil {
+ return err
+ }
+ if !changed && len(pruned) == len(next) {
+ return nil
+ }
+ setting := &storepb.InstanceUsageLimitsSetting{Limits: pruned}
+ if err := ValidateInstanceUsageLimitsSetting(setting); err != nil {
+ return err
+ }
+ valueBytes, err := protojson.Marshal(setting)
+ if err != nil {
+ return errors.Wrap(err, "failed to marshal usage limits")
+ }
+
+ var written bool
+ if exists {
+ written, err = s.driver.UpdateInstanceSettingIfUnchanged(ctx, name, oldValue, string(valueBytes))
+ } else {
+ written, err = s.driver.CreateInstanceSettingIfNotExists(ctx, &InstanceSetting{Name: name, Value: string(valueBytes)})
+ }
+ if err != nil {
+ return errors.Wrap(err, "failed to write usage limits")
+ }
+ if written {
+ s.instanceSettingCache.Delete(ctx, name)
+ return nil
+ }
+ slog.Debug("usage limits changed concurrently; retrying")
+ }
+ return ErrUsageLimitWriteConflict
+}
+
+// pruneUsageLimitsOfMissingUsers drops limits whose user no longer exists, so
+// entries left behind by a failed cleanup do not count toward the cap forever.
+func (s *Store) pruneUsageLimitsOfMissingUsers(ctx context.Context, limits []*storepb.InstanceUsageLimitsSetting_UsageLimit) ([]*storepb.InstanceUsageLimitsSetting_UsageLimit, error) {
+ userIDs := []int32{}
+ for _, limit := range limits {
+ if limit.UserId != 0 && !slices.Contains(userIDs, limit.UserId) {
+ userIDs = append(userIDs, limit.UserId)
+ }
+ }
+ if len(userIDs) == 0 {
+ return limits, nil
+ }
+ users, err := s.driver.ListUsers(ctx, &FindUser{IDList: userIDs})
+ if err != nil {
+ return nil, errors.Wrap(err, "failed to list users of usage limits")
+ }
+ existing := make(map[int32]struct{}, len(users))
+ for _, user := range users {
+ existing[user.ID] = struct{}{}
+ }
+ return slices.DeleteFunc(limits, func(limit *storepb.InstanceUsageLimitsSetting_UsageLimit) bool {
+ if limit.UserId == 0 {
+ return false
+ }
+ _, ok := existing[limit.UserId]
+ return !ok
+ }), nil
+}
diff --git a/store/user.go b/store/user.go
index 007a65fdb..eaf5abf97 100644
--- a/store/user.go
+++ b/store/user.go
@@ -3,6 +3,7 @@ package store
import (
"context"
stderrors "errors"
+ "log/slog"
"strconv"
"strings"
@@ -242,5 +243,10 @@ func (s *Store) DeleteUser(ctx context.Context, delete *DeleteUser) (*DeleteUser
return nil, errors.New("unexpected nil delete user result")
}
s.deleteUserCache(ctx, delete.ID, result)
+ // The user is already gone, so a failure here only leaves limits that are
+ // ignored at evaluation and pruned by the next usage limit write.
+ if err := s.DeleteUsageLimitsForUser(ctx, delete.ID); err != nil {
+ slog.Warn("failed to delete usage limits of deleted user", slog.Int("userID", int(delete.ID)), slog.String("error", err.Error()))
+ }
return result, nil
}
diff --git a/web/src/components/MemoEditor/hooks/useMemoSave.ts b/web/src/components/MemoEditor/hooks/useMemoSave.ts
index 165a50d68..2e9f4fb2a 100644
--- a/web/src/components/MemoEditor/hooks/useMemoSave.ts
+++ b/web/src/components/MemoEditor/hooks/useMemoSave.ts
@@ -6,6 +6,7 @@ import { attachmentKeys } from "@/hooks/useAttachmentQueries";
import { memoKeys } from "@/hooks/useMemoQueries";
import { userKeys } from "@/hooks/useUserQueries";
import { handleError } from "@/lib/error";
+import type { Attachment } from "@/types/proto/api/attachment_service_pb";
import type { Visibility } from "@/types/proto/api/memo_service_pb";
import { useTranslate } from "@/utils/i18n";
import { errorService, memoService, validationService } from "../services";
@@ -58,8 +59,31 @@ export function useMemoSave({
dispatch(actions.setLoading("saving", true));
+ // Files that finished uploading, keyed by preview URL. If the save fails
+ // after they uploaded, they move onto the draft as attachments so that a
+ // retry does not upload them again (a refused create would otherwise leak
+ // one copy per attempt into the user's storage).
+ const uploaded = new Map<string, Attachment>();
+ const keepUploadedFiles = () => {
+ if (uploaded.size === 0) return;
+ const current = getState();
+ const moved = current.localFiles.filter((file) => uploaded.has(file.previewUrl));
+ if (moved.length === 0) return;
+ dispatch(
+ actions.setMetadata({
+ attachments: [...current.metadata.attachments, ...moved.map((file) => uploaded.get(file.previewUrl) as Attachment)],
+ }),
+ );
+ dispatch(actions.setLocalFiles(current.localFiles.filter((file) => !uploaded.has(file.previewUrl))));
+ };
+
try {
- const result = await memoService.save(state, { memoName, parentMemoName, space: defaultSpace });
+ const result = await memoService.save(state, {
+ memoName,
+ parentMemoName,
+ space: defaultSpace,
+ onFileUploaded: (file, attachment) => uploaded.set(file.previewUrl, attachment),
+ });
if (!result.hasChanges) {
toast.error(t("editor.no-changes-detected"));
@@ -113,6 +137,12 @@ export function useMemoSave({
}
onConfirm?.(result.memoName);
} catch (error) {
+ keepUploadedFiles();
+ if (uploaded.size > 0) {
+ // The uploads landed even though the save did not.
+ void queryClient.invalidateQueries({ queryKey: attachmentKeys.lists() });
+ void queryClient.invalidateQueries({ queryKey: userKeys.stats() });
+ }
handleError(error, toast.error, {
context: "Failed to save memo",
fallbackMessage: errorService.getErrorMessage(error),
diff --git a/web/src/components/MemoEditor/services/errorService.ts b/web/src/components/MemoEditor/services/errorService.ts
index 7913fd881..6921288b8 100644
--- a/web/src/components/MemoEditor/services/errorService.ts
+++ b/web/src/components/MemoEditor/services/errorService.ts
@@ -1,5 +1,12 @@
+import { getLimitErrorMessage } from "@/lib/error";
+
export const errorService = {
getErrorMessage(error: unknown): string {
+ const limitMessage = getLimitErrorMessage(error);
+ if (limitMessage !== undefined) {
+ return limitMessage;
+ }
+
if (error && typeof error === "object" && "rawMessage" in error) {
return (error as { rawMessage?: string }).rawMessage || "An error occurred";
}
diff --git a/web/src/components/MemoEditor/services/memoService.ts b/web/src/components/MemoEditor/services/memoService.ts
index 7509eea9f..56dd3eea1 100644
--- a/web/src/components/MemoEditor/services/memoService.ts
+++ b/web/src/components/MemoEditor/services/memoService.ts
@@ -8,6 +8,7 @@ import { AttachmentSchema } from "@/types/proto/api/attachment_service_pb";
import type { Memo } from "@/types/proto/api/memo_service_pb";
import { MemoSchema } from "@/types/proto/api/memo_service_pb";
import type { EditorState } from "../state";
+import type { LocalFile } from "../types/attachment";
import { uploadService } from "./uploadService";
/**
@@ -91,10 +92,12 @@ export const memoService = {
memoName?: string;
parentMemoName?: string;
space?: string;
+ /** Runs as each local file finishes uploading, before the memo is saved. */
+ onFileUploaded?: (localFile: LocalFile, attachment: Attachment) => void;
},
): Promise<{ memoName: string; hasChanges: boolean; moved?: boolean }> {
// 1. Upload local files first
- const newAttachments = await uploadService.uploadFiles(state.localFiles);
+ const newAttachments = await uploadService.uploadFiles(state.localFiles, options.onFileUploaded);
const allAttachments = [...state.metadata.attachments, ...newAttachments];
// 2. Update existing memo
diff --git a/web/src/components/MemoEditor/services/uploadService.ts b/web/src/components/MemoEditor/services/uploadService.ts
index 7b9735d18..34f82a150 100644
--- a/web/src/components/MemoEditor/services/uploadService.ts
+++ b/web/src/components/MemoEditor/services/uploadService.ts
@@ -60,12 +60,18 @@ export const uploadService = {
}
},
- async uploadFiles(localFiles: LocalFile[]): Promise<Attachment[]> {
+ /**
+ * Uploads the files in parallel and returns their attachments in input order.
+ * onUploaded runs as each file finishes, so a caller can keep the files that
+ * did upload when another upload, or a later step, fails.
+ */
+ async uploadFiles(localFiles: LocalFile[], onUploaded?: (localFile: LocalFile, attachment: Attachment) => void): Promise<Attachment[]> {
const attachments: Attachment[] = new Array(localFiles.length);
let next = 0;
const worker = async () => {
for (let index = next++; index < localFiles.length; index = next++) {
attachments[index] = await this.uploadFile(localFiles[index]);
+ onUploaded?.(localFiles[index], attachments[index]);
}
};
await Promise.all(Array.from({ length: Math.min(MAX_CONCURRENT_UPLOADS, localFiles.length) }, worker));
diff --git a/web/src/components/Settings/MyAccountSection.tsx b/web/src/components/Settings/MyAccountSection.tsx
index b90a3c9a6..e215c1779 100644
--- a/web/src/components/Settings/MyAccountSection.tsx
+++ b/web/src/components/Settings/MyAccountSection.tsx
@@ -17,6 +17,7 @@ import UserAvatar from "../UserAvatar";
import LinkedIdentitySection from "./LinkedIdentitySection";
import SettingGroup from "./SettingGroup";
import SettingSection from "./SettingSection";
+import UsageSection from "./UsageSection";
import UserStatsSection from "./UserStatsSection";
const MyAccountSection = () => {
@@ -70,6 +71,8 @@ const MyAccountSection = () => {
<UserStatsSection />
+ <UsageSection />
+
<LinkedIdentitySection />
<SettingGroup showSeparator title={t("setting.account.danger-area")} description={t("setting.account.danger-area-description")}>
diff --git a/web/src/components/Settings/UsageLimitDialog.tsx b/web/src/components/Settings/UsageLimitDialog.tsx
new file mode 100644
index 000000000..77f153b4f
--- /dev/null
+++ b/web/src/components/Settings/UsageLimitDialog.tsx
@@ -0,0 +1,189 @@
+import { useEffect, useMemo, useState } from "react";
+import { toast } from "react-hot-toast";
+import { Button } from "@/components/ui/button";
+import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
+import { Input } from "@/components/ui/input";
+import { Label } from "@/components/ui/label";
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import { findUsageLimit, USAGE_LIMIT_METRICS, useSetUsageLimit, useUsageLimits } from "@/hooks/useUsageLimitQueries";
+import { handleError } from "@/lib/error";
+import { UsageLimit_Metric } from "@/types/proto/api/instance_service_pb";
+import type { User } from "@/types/proto/api/user_service_pb";
+import { useTranslate } from "@/utils/i18n";
+import { isFileSizeLimitIneffective, parseLimitInput, toLimitInput } from "./usageLimitValues";
+
+type Inputs = Record<UsageLimit_Metric, string>;
+
+/** Which row the dialog edits: the limits for all users, one user's limits, or a user still to pick. */
+export type UsageLimitDialogTarget = { kind: "all" } | { kind: "user"; user: User } | { kind: "add" };
+
+interface Props {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ target: UsageLimitDialogTarget;
+ /** The users that can be added, which are those without limits of their own. */
+ candidates: User[];
+ /** The instance upload limit in MiB, for the file size warning. */
+ uploadLimitMiB: number;
+}
+
+const userLabel = (user: User) => (user.displayName ? `${user.displayName} (@${user.username})` : `@${user.username}`);
+
+/**
+ * Edits one row of the usage limits table. For all users, an empty field
+ * means no limit. For one user, an empty field means the all-users limit
+ * applies, and 0 means no limit for that user.
+ */
+function UsageLimitDialog({ open, onOpenChange, target, candidates, uploadLimitMiB }: Props) {
+ const t = useTranslate();
+ const { data: limits } = useUsageLimits({ enabled: open });
+ const [pickedName, setPickedName] = useState("");
+ const setUsageLimit = useSetUsageLimit();
+
+ useEffect(() => {
+ if (open) setPickedName("");
+ }, [open]);
+
+ const forAll = target.kind === "all";
+ const user = target.kind === "user" ? target.user : candidates.find((candidate) => candidate.name === pickedName);
+ // The user the limits belong to: empty for all users, undefined until a user is picked.
+ const owner = forAll ? "" : user?.name;
+
+ const savedInputs = useMemo(
+ () =>
+ Object.fromEntries(
+ USAGE_LIMIT_METRICS.map((metric) => {
+ const value = owner === undefined ? undefined : findUsageLimit(limits, metric, owner)?.value;
+ // For a user, empty means "use the all-users limit", so a user limit of 0 (no limit) shows as 0.
+ return [metric, !forAll && value === 0n ? "0" : toLimitInput(metric, value)];
+ }),
+ ) as Inputs,
+ [limits, owner, forAll],
+ );
+ const [inputs, setInputs] = useState<Inputs>(savedInputs);
+ useEffect(() => setInputs(savedInputs), [savedInputs]);
+
+ /** The value to save: undefined removes the limit. */
+ const savedValue = (metric: UsageLimit_Metric): bigint | undefined => {
+ const value = parseLimitInput(metric, inputs[metric]);
+ // A limit of 0 for all users is the same as none, so it is removed.
+ if (forAll) return value ? value : undefined;
+ return inputs[metric].trim() === "" ? undefined : value;
+ };
+ const isInvalid = (metric: UsageLimit_Metric) => parseLimitInput(metric, inputs[metric]) === undefined;
+ const placeholder = (metric: UsageLimit_Metric) => {
+ if (forAll) return t("setting.usage-limits.unlimited");
+ const value = findUsageLimit(limits, metric)?.value;
+ return t("setting.usage-limits.all-users-placeholder", {
+ value: value ? toLimitInput(metric, value) : t("setting.usage-limits.unlimited"),
+ });
+ };
+ const warning = (metric: UsageLimit_Metric) => {
+ if (isInvalid(metric)) return t("setting.usage-limits.invalid");
+ if (metric === UsageLimit_Metric.UPLOAD_BYTES && isFileSizeLimitIneffective(inputs[metric], uploadLimitMiB)) {
+ return t("setting.usage-limits.file-size-warning", { limit: uploadLimitMiB });
+ }
+ return undefined;
+ };
+
+ const hasChanges = USAGE_LIMIT_METRICS.some((metric) => inputs[metric] !== savedInputs[metric]);
+ const isValid = USAGE_LIMIT_METRICS.every((metric) => !isInvalid(metric));
+
+ const handleSave = async () => {
+ if (owner === undefined) return;
+ try {
+ for (const metric of USAGE_LIMIT_METRICS) {
+ if (inputs[metric] === savedInputs[metric]) continue;
+ await setUsageLimit.mutateAsync({
+ metric,
+ user: owner,
+ value: savedValue(metric),
+ existing: findUsageLimit(limits, metric, owner),
+ });
+ }
+ toast.success(t("setting.usage-limits.saved"));
+ onOpenChange(false);
+ } catch (error) {
+ handleError(error, toast.error, { context: "Update usage limits" });
+ }
+ };
+
+ const fields = [
+ { metric: UsageLimit_Metric.MEMOS, label: t("setting.usage-limits.memos"), help: t("setting.usage-limits.memos-description") },
+ {
+ metric: UsageLimit_Metric.STORAGE_BYTES,
+ label: t("setting.usage-limits.storage"),
+ help: t("setting.usage-limits.storage-description"),
+ },
+ { metric: UsageLimit_Metric.UPLOAD_BYTES, label: t("setting.usage-limits.file-size"), help: undefined },
+ ];
+ const userItems = candidates.map((candidate) => ({ value: candidate.name, label: userLabel(candidate) }));
+ const title =
+ target.kind === "all"
+ ? t("setting.usage-limits.all-users-title")
+ : target.kind === "user"
+ ? t("setting.usage-limits.user-title", { user: target.user.displayName || target.user.username })
+ : t("setting.usage-limits.add-user");
+
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent className="max-w-md">
+ <DialogHeader>
+ <DialogTitle>{title}</DialogTitle>
+ </DialogHeader>
+ <div className="flex flex-col gap-4">
+ {target.kind === "add" && (
+ <div className="grid gap-2">
+ <Label>{t("setting.usage-limits.user")}</Label>
+ <Select value={pickedName} items={userItems} onValueChange={setPickedName}>
+ <SelectTrigger className="w-full" aria-label={t("setting.usage-limits.user")}>
+ <SelectValue placeholder={t("setting.usage-limits.select-user")} />
+ </SelectTrigger>
+ <SelectContent>
+ {userItems.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ {userItems.length === 0 && <p className="text-xs text-muted-foreground">{t("setting.usage-limits.no-candidates")}</p>}
+ </div>
+ )}
+ {fields.map(({ metric, label, help }) => {
+ const message = warning(metric) ?? help;
+ return (
+ <div key={metric} className="grid gap-2">
+ <Label htmlFor={`usage-limit-${metric}`}>{label}</Label>
+ <Input
+ id={`usage-limit-${metric}`}
+ className="font-mono"
+ inputMode="decimal"
+ disabled={owner === undefined}
+ placeholder={placeholder(metric)}
+ value={inputs[metric]}
+ aria-invalid={isInvalid(metric)}
+ onChange={(event) => setInputs((current) => ({ ...current, [metric]: event.target.value }))}
+ />
+ {message && <p className="text-xs text-muted-foreground">{message}</p>}
+ </div>
+ );
+ })}
+ <p className="text-xs text-muted-foreground">
+ {forAll ? t("setting.usage-limits.all-users-hint") : t("setting.usage-limits.user-hint")}
+ </p>
+ </div>
+ <DialogFooter>
+ <Button variant="ghost" onClick={() => onOpenChange(false)}>
+ {t("common.cancel")}
+ </Button>
+ <Button disabled={owner === undefined || !hasChanges || !isValid || setUsageLimit.isPending} onClick={handleSave}>
+ {t("common.save")}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+export default UsageLimitDialog;
diff --git a/web/src/components/Settings/UsageLimitsSection.tsx b/web/src/components/Settings/UsageLimitsSection.tsx
new file mode 100644
index 000000000..f4c3b8545
--- /dev/null
+++ b/web/src/components/Settings/UsageLimitsSection.tsx
@@ -0,0 +1,204 @@
+import { sortBy } from "lodash-es";
+import { MoreVerticalIcon, PlusIcon, UsersIcon } from "lucide-react";
+import { useMemo, useState } from "react";
+import { toast } from "react-hot-toast";
+import ConfirmDialog from "@/components/ConfirmDialog";
+import UserAvatar from "@/components/UserAvatar";
+import { Button } from "@/components/ui/button";
+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
+import { useInstanceSetting } from "@/hooks/useInstanceQueries";
+import { findUsageLimit, USAGE_LIMIT_METRICS, useSetUsageLimit, useUsageLimits } from "@/hooks/useUsageLimitQueries";
+import { useListUsers } from "@/hooks/useUserQueries";
+import { handleError } from "@/lib/error";
+import { cn } from "@/lib/utils";
+import { InstanceSetting_Key, UsageLimit_Metric } from "@/types/proto/api/instance_service_pb";
+import { User } from "@/types/proto/api/user_service_pb";
+import { useTranslate } from "@/utils/i18n";
+import SettingSection from "./SettingSection";
+import SettingTable from "./SettingTable";
+import UsageLimitDialog, { type UsageLimitDialogTarget } from "./UsageLimitDialog";
+import { formatLimitValue } from "./usageLimitValues";
+
+// The store applies 32 MiB when the instance upload limit is unset.
+const DEFAULT_UPLOAD_LIMIT_MIB = 32;
+
+/**
+ * A table row: name is empty for the all-users row, otherwise users/{user}.
+ * The user is missing when the user list has not loaded.
+ */
+type LimitRow = { name: string; user?: User } & Record<string, unknown>;
+
+/**
+ * Edits the usage limits as one table. The first row holds the limits for all
+ * users; each further row holds one user's own limits, which replace them.
+ */
+const UsageLimitsSection = () => {
+ const t = useTranslate();
+ const { data: limits, isLoading } = useUsageLimits();
+ const { data: users = [] } = useListUsers();
+ const { data: storageSetting } = useInstanceSetting(InstanceSetting_Key.STORAGE);
+ const setUsageLimit = useSetUsageLimit();
+ const [dialog, setDialog] = useState<{ open: boolean; target: UsageLimitDialogTarget }>({ open: false, target: { kind: "all" } });
+ const [removeTarget, setRemoveTarget] = useState<LimitRow | undefined>();
+
+ const userRows = useMemo<LimitRow[]>(() => {
+ const names = [...new Set((limits ?? []).filter((limit) => limit.user).map((limit) => limit.user))];
+ return sortBy(
+ names.map((name) => ({ name, user: users.find((user) => user.name === name) })),
+ (row) => row.user?.username ?? row.name,
+ );
+ }, [limits, users]);
+ const candidates = useMemo(
+ () =>
+ sortBy(
+ users.filter((user) => !userRows.some((row) => row.name === user.name)),
+ "username",
+ ),
+ [users, userRows],
+ );
+
+ const uploadLimitMiB =
+ (storageSetting?.value.case === "storageSetting" ? Number(storageSetting.value.value.uploadSizeLimitMb) : 0) ||
+ DEFAULT_UPLOAD_LIMIT_MIB;
+
+ const openDialog = (target: UsageLimitDialogTarget) => setDialog({ open: true, target });
+
+ const handleRemove = async () => {
+ if (!removeTarget) return;
+ try {
+ for (const metric of USAGE_LIMIT_METRICS) {
+ const existing = findUsageLimit(limits, metric, removeTarget.name);
+ if (existing) await setUsageLimit.mutateAsync({ metric, user: removeTarget.name, value: undefined, existing });
+ }
+ toast.success(t("setting.usage-limits.removed"));
+ } catch (error) {
+ handleError(error, toast.error, { context: "Remove usage limits" });
+ }
+ setRemoveTarget(undefined);
+ };
+
+ const usernameOf = (row: LimitRow) => row.user?.username ?? row.name.replace(/^users\//, "");
+
+ // A user row shows its own limit, or the all-users limit in gray when it has none.
+ const renderLimit = (metric: UsageLimit_Metric) => (_: unknown, row: LimitRow) => {
+ const own = findUsageLimit(limits, metric, row.name);
+ const value = (own ?? findUsageLimit(limits, metric))?.value ?? 0n;
+ const inherited = row.name !== "" && !own;
+ return (
+ <span className={cn(inherited ? "text-muted-foreground/70" : "text-foreground")}>
+ {value > 0n ? formatLimitValue(metric, value) : t("setting.usage-limits.unlimited")}
+ </span>
+ );
+ };
+
+ const rows: LimitRow[] = [{ name: "" }, ...userRows];
+
+ return (
+ <SettingSection
+ title={t("setting.usage-limits.title")}
+ description={t("setting.usage-limits.description")}
+ actions={
+ <Button disabled={isLoading} onClick={() => openDialog({ kind: "add" })}>
+ <PlusIcon className="w-4 h-4 mr-2" />
+ {t("setting.usage-limits.add-user")}
+ </Button>
+ }
+ >
+ <SettingTable
+ columns={[
+ {
+ key: "user",
+ header: t("setting.usage-limits.user"),
+ render: (_, row: LimitRow) =>
+ row.name === "" ? (
+ <div className="flex items-center gap-3">
+ <div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted">
+ <UsersIcon className="h-4 w-4 text-muted-foreground" />
+ </div>
+ <div className="flex min-w-0 flex-col">
+ <span className="text-sm font-medium text-foreground">{t("setting.usage-limits.all-users")}</span>
+ <span className="text-xs text-muted-foreground">{t("setting.usage-limits.all-users-description")}</span>
+ </div>
+ </div>
+ ) : (
+ <div className="flex items-center gap-3">
+ <UserAvatar
+ className="h-8 w-8 shrink-0"
+ avatarUrl={row.user?.avatarUrl}
+ name={row.user?.displayName || usernameOf(row)}
+ />
+ <div className="flex min-w-0 flex-col">
+ <span className="text-sm font-medium text-foreground">{row.user?.displayName || usernameOf(row)}</span>
+ <span className="text-xs text-muted-foreground">@{usernameOf(row)}</span>
+ </div>
+ </div>
+ ),
+ },
+ { key: "memos", header: t("setting.usage-limits.memos"), render: renderLimit(UsageLimit_Metric.MEMOS) },
+ { key: "storage", header: t("setting.usage-limits.storage-column"), render: renderLimit(UsageLimit_Metric.STORAGE_BYTES) },
+ { key: "fileSize", header: t("setting.usage-limits.file-size-column"), render: renderLimit(UsageLimit_Metric.UPLOAD_BYTES) },
+ {
+ key: "actions",
+ header: "",
+ className: "w-px text-right",
+ render: (_, row: LimitRow) => {
+ const name = row.name === "" ? t("setting.usage-limits.all-users") : usernameOf(row);
+ const user = row.user;
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={isLoading}
+ aria-label={t("setting.usage-limits.row-actions", { name })}
+ />
+ }
+ >
+ <MoreVerticalIcon className="w-4 h-auto" />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" sideOffset={2}>
+ {row.name === "" ? (
+ <DropdownMenuItem onClick={() => openDialog({ kind: "all" })}>{t("common.edit")}</DropdownMenuItem>
+ ) : (
+ <>
+ {user && <DropdownMenuItem onClick={() => openDialog({ kind: "user", user })}>{t("common.edit")}</DropdownMenuItem>}
+ <DropdownMenuItem onClick={() => setRemoveTarget(row)} className="text-destructive focus:text-destructive">
+ {t("setting.usage-limits.remove")}
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+ },
+ },
+ ]}
+ data={rows}
+ getRowKey={(row) => row.name || "all-users"}
+ />
+
+ <UsageLimitDialog
+ open={dialog.open}
+ onOpenChange={(open) => setDialog((current) => ({ ...current, open }))}
+ target={dialog.target}
+ candidates={candidates}
+ uploadLimitMiB={uploadLimitMiB}
+ />
+
+ <ConfirmDialog
+ open={!!removeTarget}
+ onOpenChange={(open) => !open && setRemoveTarget(undefined)}
+ title={removeTarget ? t("setting.usage-limits.remove-title", { username: usernameOf(removeTarget) }) : ""}
+ description={t("setting.usage-limits.remove-description")}
+ confirmLabel={t("setting.usage-limits.remove")}
+ cancelLabel={t("common.cancel")}
+ onConfirm={handleRemove}
+ confirmVariant="destructive"
+ />
+ </SettingSection>
+ );
+};
+
+export default UsageLimitsSection;
diff --git a/web/src/components/Settings/UsageSection.tsx b/web/src/components/Settings/UsageSection.tsx
new file mode 100644
index 000000000..8b5659e75
--- /dev/null
+++ b/web/src/components/Settings/UsageSection.tsx
@@ -0,0 +1,43 @@
+import useCurrentUser from "@/hooks/useCurrentUser";
+import { useUserUsage } from "@/hooks/useUserQueries";
+import { UsageLimit_Metric } from "@/types/proto/api/instance_service_pb";
+import { useTranslate } from "@/utils/i18n";
+import SettingGroup from "./SettingGroup";
+import { SettingList, StatRow } from "./SettingList";
+import { formatLimitValue } from "./usageLimitValues";
+
+/**
+ * Shows the current user's usage against their usage limits. It renders
+ * nothing when no limit applies, so instances without limits look as before.
+ */
+const UsageSection = () => {
+ const t = useTranslate();
+ const user = useCurrentUser();
+ const { data: usage } = useUserUsage(user?.name);
+
+ if (!usage) return null;
+
+ const memosLimit = usage.memosLimit?.value ?? 0n;
+ const storageLimit = usage.storageBytesLimit?.value ?? 0n;
+ const fileSizeLimit = usage.uploadBytesLimit?.value ?? 0n;
+ if (memosLimit === 0n && storageLimit === 0n && fileSizeLimit === 0n) return null;
+
+ const of = (metric: UsageLimit_Metric, used: bigint, limit: bigint) =>
+ limit === 0n
+ ? formatLimitValue(metric, used)
+ : t("setting.account.usage-of", { usage: formatLimitValue(metric, used), limit: formatLimitValue(metric, limit) });
+
+ return (
+ <SettingGroup showSeparator title={t("setting.account.usage-title")} description={t("setting.account.usage-description")}>
+ <SettingList>
+ <StatRow label={t("setting.account.usage-memos")} value={of(UsageLimit_Metric.MEMOS, usage.memoCount, memosLimit)} />
+ <StatRow label={t("setting.account.usage-storage")} value={of(UsageLimit_Metric.STORAGE_BYTES, usage.storageBytes, storageLimit)} />
+ {fileSizeLimit > 0n && (
+ <StatRow label={t("setting.account.usage-file-size")} value={formatLimitValue(UsageLimit_Metric.UPLOAD_BYTES, fileSizeLimit)} />
+ )}
+ </SettingList>
+ </SettingGroup>
+ );
+};
+
+export default UsageSection;
diff --git a/web/src/components/Settings/settingSections.ts b/web/src/components/Settings/settingSections.ts
index 897135dbd..f07f6f6e2 100644
--- a/web/src/components/Settings/settingSections.ts
+++ b/web/src/components/Settings/settingSections.ts
@@ -4,6 +4,7 @@ import {
BarChart3Icon,
CogIcon,
DatabaseIcon,
+ GaugeIcon,
HeartHandshakeIcon,
KeyIcon,
KeyRoundIcon,
@@ -31,6 +32,7 @@ import SpacesSection from "@/components/Settings/SpacesSection";
import SSOSection from "@/components/Settings/SSOSection";
import StorageSection from "@/components/Settings/StorageSection";
import TagsSection from "@/components/Settings/TagsSection";
+import UsageLimitsSection from "@/components/Settings/UsageLimitsSection";
import WebhookSection from "@/components/Settings/WebhookSection";
import { InstanceSetting_Key } from "@/types/proto/api/instance_service_pb";
@@ -45,6 +47,7 @@ export type SettingSectionKey =
| "system"
| "memo"
| "storage"
+ | "usage-limits"
| "notification"
| "sso"
| "tags"
@@ -141,6 +144,14 @@ export const SETTINGS_SECTIONS: SettingSectionDefinition[] = [
component: StorageSection,
preloadSettingKeys: [InstanceSetting_Key.STORAGE],
},
+ {
+ key: "usage-limits",
+ scope: "admin",
+ labelKey: "setting.usage-limits.label",
+ icon: GaugeIcon,
+ component: UsageLimitsSection,
+ preloadSettingKeys: [InstanceSetting_Key.STORAGE],
+ },
{
key: "notification",
scope: "admin",
diff --git a/web/src/components/Settings/usageLimitValues.ts b/web/src/components/Settings/usageLimitValues.ts
new file mode 100644
index 000000000..383f1c6d9
--- /dev/null
+++ b/web/src/components/Settings/usageLimitValues.ts
@@ -0,0 +1,40 @@
+import { UsageLimit_Metric } from "@/types/proto/api/instance_service_pb";
+import { formatFileSize } from "@/utils/format";
+
+const MIB = 1024 * 1024;
+
+/** Whether the metric counts bytes. Forms enter byte limits in MiB. */
+export const isByteMetric = (metric: UsageLimit_Metric) => metric !== UsageLimit_Metric.MEMOS;
+
+/** Formats a limit for a form field: memos as a count, bytes in MiB. Unlimited is empty. */
+export function toLimitInput(metric: UsageLimit_Metric, value: bigint | undefined): string {
+ if (value === undefined || value === 0n) return "";
+ if (!isByteMetric(metric)) return value.toString();
+ const mebibytes = Number(value) / MIB;
+ return Number.isInteger(mebibytes) ? String(mebibytes) : String(Number(mebibytes.toFixed(2)));
+}
+
+/**
+ * Parses a form field into a limit value. An empty field is 0, which means
+ * unlimited. Returns undefined when the input is not a valid limit.
+ */
+export function parseLimitInput(metric: UsageLimit_Metric, input: string): bigint | undefined {
+ const text = input.trim();
+ if (text === "") return 0n;
+ if (!isByteMetric(metric)) {
+ return /^\d+$/.test(text) ? BigInt(text) : undefined;
+ }
+ if (!/^\d+(\.\d+)?$/.test(text)) return undefined;
+ return BigInt(Math.round(Number(text) * MIB));
+}
+
+/** Formats a limit or a usage figure for display. */
+export function formatLimitValue(metric: UsageLimit_Metric, value: bigint): string {
+ return isByteMetric(metric) ? formatFileSize(Number(value)) : value.toLocaleString();
+}
+
+/** Whether a file size limit, entered in MiB, is not below the instance upload limit and so has no effect. */
+export function isFileSizeLimitIneffective(input: string, instanceUploadLimitMiB: number): boolean {
+ const value = parseLimitInput(UsageLimit_Metric.UPLOAD_BYTES, input);
+ return value !== undefined && value > 0n && value >= BigInt(instanceUploadLimitMiB) * BigInt(MIB);
+}
diff --git a/web/src/hooks/useUsageLimitQueries.ts b/web/src/hooks/useUsageLimitQueries.ts
new file mode 100644
index 000000000..76e8c2818
--- /dev/null
+++ b/web/src/hooks/useUsageLimitQueries.ts
@@ -0,0 +1,80 @@
+import { create } from "@bufbuild/protobuf";
+import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { instanceServiceClient } from "@/connect";
+import { userKeys } from "@/hooks/useUserQueries";
+import { type UsageLimit, UsageLimit_Metric, UsageLimitSchema } from "@/types/proto/api/instance_service_pb";
+
+export const usageLimitKeys = {
+ all: ["usageLimits"] as const,
+ list: () => [...usageLimitKeys.all, "list"] as const,
+};
+
+/** The metrics an admin can limit, in display order. */
+export const USAGE_LIMIT_METRICS = [UsageLimit_Metric.MEMOS, UsageLimit_Metric.STORAGE_BYTES, UsageLimit_Metric.UPLOAD_BYTES] as const;
+
+/** Lists every usage limit. Admin only on the server side. */
+export function useUsageLimits(options?: { enabled?: boolean }) {
+ return useQuery({
+ queryKey: usageLimitKeys.list(),
+ queryFn: async () => {
+ const limits: UsageLimit[] = [];
+ let pageToken = "";
+ do {
+ const response = await instanceServiceClient.listUsageLimits({ pageSize: 1000, pageToken });
+ limits.push(...response.usageLimits);
+ pageToken = response.nextPageToken;
+ } while (pageToken);
+ return limits;
+ },
+ enabled: options?.enabled ?? true,
+ });
+}
+
+/** Finds the limit for metric that applies to user, or the default when user is empty. */
+export function findUsageLimit(limits: UsageLimit[] | undefined, metric: UsageLimit_Metric, user = ""): UsageLimit | undefined {
+ return limits?.find((limit) => limit.metric === metric && limit.user === user);
+}
+
+export interface SetUsageLimitRequest {
+ metric: UsageLimit_Metric;
+ /** The user, as users/{user}. Empty sets the default for every user. */
+ user?: string;
+ /** The new value, 0 for unlimited, or undefined to remove the limit. */
+ value: bigint | undefined;
+ /** The limit that exists now for this metric and user, if any. */
+ existing?: UsageLimit;
+}
+
+/**
+ * Creates, updates, or deletes the one usage limit for a metric and user, so
+ * that forms can treat each metric as a single value.
+ */
+export function useSetUsageLimit() {
+ const queryClient = useQueryClient();
+ return useMutation({
+ mutationFn: async ({ metric, user = "", value, existing }: SetUsageLimitRequest) => {
+ if (value === undefined) {
+ if (existing) {
+ await instanceServiceClient.deleteUsageLimit({ name: existing.name });
+ }
+ return;
+ }
+ if (existing) {
+ if (existing.value === value) return;
+ await instanceServiceClient.updateUsageLimit({
+ usageLimit: create(UsageLimitSchema, { name: existing.name, value }),
+ updateMask: create(FieldMaskSchema, { paths: ["value"] }),
+ });
+ return;
+ }
+ await instanceServiceClient.createUsageLimit({ usageLimit: create(UsageLimitSchema, { metric, user, value }) });
+ },
+ onSettled: async () => {
+ await Promise.all([
+ queryClient.invalidateQueries({ queryKey: usageLimitKeys.all }),
+ queryClient.invalidateQueries({ queryKey: userKeys.stats() }),
+ ]);
+ },
+ });
+}
diff --git a/web/src/hooks/useUserQueries.ts b/web/src/hooks/useUserQueries.ts
index 449ada30d..d68b3399b 100644
--- a/web/src/hooks/useUserQueries.ts
+++ b/web/src/hooks/useUserQueries.ts
@@ -33,6 +33,9 @@ export const userKeys = {
userStats: (name: string, filter?: string) =>
filter ? ([...userKeys.stats(), name, filter] as const) : ([...userKeys.stats(), name] as const),
allUserStats: (request: Partial<ListUserStatsQuery>) => [...userKeys.stats(), "all", request] as const,
+ // Usage sits under stats so that every change that refreshes stats (memo
+ // saves, deletes, attachment changes) refreshes usage too.
+ usage: (name: string) => [...userKeys.stats(), "usage", name] as const,
currentUser: () => [...userKeys.all, "current"] as const,
memoViews: (parent?: string) => [...userKeys.all, "memoViews", parent] as const,
notifications: () => [...userKeys.all, "notifications"] as const,
@@ -68,6 +71,20 @@ export function useUserStats(username?: string, options?: { enabled?: boolean; f
});
}
+/** A user's memo count and stored bytes, and the usage limits in effect for the user. */
+export function useUserUsage(username?: string, options?: { enabled?: boolean }) {
+ return useQuery({
+ queryKey: username ? userKeys.usage(username) : userKeys.stats(),
+ queryFn: async () => {
+ if (!username) {
+ throw new Error("Username is required");
+ }
+ return userServiceClient.getUserUsage({ name: `${username}/usage` });
+ },
+ enabled: !!username && (options?.enabled ?? true),
+ });
+}
+
export function useAllUserStats(request: Partial<ListUserStatsQuery> = {}, options?: { enabled?: boolean }) {
return useQuery({
queryKey: userKeys.allUserStats(request),
diff --git a/web/src/lib/error.ts b/web/src/lib/error.ts
index 4e9a1b3ed..5ac260b36 100644
--- a/web/src/lib/error.ts
+++ b/web/src/lib/error.ts
@@ -1,5 +1,6 @@
import { BinaryReader } from "@bufbuild/protobuf/wire";
import { type Code, ConnectError } from "@connectrpc/connect";
+import { formatFileSize } from "@/utils/format";
/** google.rpc.ErrorInfo, the mandatory detail on every server error (AIP-193). */
export interface ErrorInfo {
@@ -10,6 +11,8 @@ export interface ErrorInfo {
export const ERROR_REASON_RATE_LIMITED = "RATE_LIMITED";
export const ERROR_REASON_CHALLENGE_REQUIRED = "CHALLENGE_REQUIRED";
+export const ERROR_REASON_QUOTA_EXCEEDED = "QUOTA_EXCEEDED";
+export const ERROR_REASON_FILE_TOO_LARGE = "FILE_TOO_LARGE";
const ERROR_INFO_TYPE = "google.rpc.ErrorInfo";
@@ -78,6 +81,47 @@ export function getRetryAfterSeconds(error: unknown): number | undefined {
return Number.isFinite(seconds) && seconds > 0 ? seconds : undefined;
}
+/**
+ * Describes a QUOTA_EXCEEDED refusal in words, or returns undefined for any
+ * other error. A usage limit does not lift with time, so unlike a rate limit
+ * the message says what to change instead of when to retry.
+ */
+export function getQuotaExceededMessage(error: unknown): string | undefined {
+ const info = getErrorInfo(error);
+ if (info?.reason !== ERROR_REASON_QUOTA_EXCEEDED) {
+ return undefined;
+ }
+ const limit = Number(info.metadata.limit ?? "");
+ const usage = Number(info.metadata.usage ?? "");
+ switch (info.metadata.metric) {
+ case "MEMOS":
+ return `You have reached your limit of ${limit} memos. Delete memos to create new ones.`;
+ case "STORAGE_BYTES":
+ return `This upload would exceed your storage limit of ${formatFileSize(limit)}. You are using ${formatFileSize(usage)}.`;
+ case "UPLOAD_BYTES":
+ return `This file is larger than your limit of ${formatFileSize(limit)} per file.`;
+ default:
+ return "You have reached a usage limit.";
+ }
+}
+
+/**
+ * Describes a refusal by a size or usage limit in words: QUOTA_EXCEEDED, or
+ * FILE_TOO_LARGE for the instance upload limit. Returns undefined for any
+ * other error.
+ */
+export function getLimitErrorMessage(error: unknown): string | undefined {
+ const quotaMessage = getQuotaExceededMessage(error);
+ if (quotaMessage !== undefined) {
+ return quotaMessage;
+ }
+ const info = getErrorInfo(error);
+ if (info?.reason !== ERROR_REASON_FILE_TOO_LARGE) {
+ return undefined;
+ }
+ return `This file is larger than the upload limit of ${formatFileSize(Number(info.metadata.limit ?? ""))}.`;
+}
+
function formatWait(seconds: number): string {
if (seconds < 60) return `${seconds}s`;
const minutes = Math.ceil(seconds / 60);
@@ -97,6 +141,10 @@ export function getErrorMessage(error: unknown, fallback = "Unknown error"): str
if (hasErrorReason(error, ERROR_REASON_CHALLENGE_REQUIRED)) {
return "Complete the verification challenge and try again.";
}
+ const limitMessage = getLimitErrorMessage(error);
+ if (limitMessage !== undefined) {
+ return limitMessage;
+ }
return error.rawMessage || fallback;
}
diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json
index e24d4cc2f..6fc0a353a 100644
--- a/web/src/locales/ar.json
+++ b/web/src/locales/ar.json
@@ -548,6 +548,12 @@
"update-information": "تحديث المعلومات",
"username-note": "تستخدم لتسجيل الدخول",
"attachment-storage": "تخزين الكائنات الحالي",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "مساحة تخزين المرفقات غير متاحة.",
"danger-area": "منطقة خطرة",
"danger-area-description": "توجد هنا إجراءات حساب لا رجعة فيها. راجعها بعناية قبل المتابعة.",
@@ -591,6 +597,38 @@
"reactions-description": "حدد خيارات التفاعل التي يمكن للمستخدمين تطبيقها على المذكرات.",
"remove-reaction": "إزالة التفاعل"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "اسم سهل التذكر",
diff --git a/web/src/locales/az.json b/web/src/locales/az.json
index 1bcbd54fe..7aacfb387 100644
--- a/web/src/locales/az.json
+++ b/web/src/locales/az.json
@@ -493,6 +493,12 @@
},
"account": {
"attachment-storage": "Qoşmaların tutduğu yer",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Qoşmalarınızın tutduğu yer haqqında məlumat əlçatan deyil.",
"change-password": "Parolu dəyiş",
"danger-area": "Təhlükəli sahə",
@@ -906,6 +912,38 @@
"max-upload-size-hint": "Tövsiyə olunan dəyər 32 MiB-dir.",
"server-name": "Server adı"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Yadda saxlaması asan bir ad",
diff --git a/web/src/locales/bg.json b/web/src/locales/bg.json
index 18b2e8ee4..0d365adfb 100644
--- a/web/src/locales/bg.json
+++ b/web/src/locales/bg.json
@@ -430,6 +430,12 @@
"update-information": "Актуализиране на информация",
"username-note": "Използва се за влизане",
"attachment-storage": "Съхранение на прикачени файлове",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Вашето хранилище за прикачени файлове не е налично.",
"email-in-use": "Този имейл вече се използва от друг акаунт."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Препоръчителната стойност е 32 MiB.",
"server-name": "Име на сървъра"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Лесно запомнящо се име",
diff --git a/web/src/locales/ca.json b/web/src/locales/ca.json
index f5bcf9b12..910ab4713 100644
--- a/web/src/locales/ca.json
+++ b/web/src/locales/ca.json
@@ -392,6 +392,12 @@
"delete-account": "Suprimeix el compte",
"delete-account-description": "Suprimeix permanentment aquest compte i tot l'accés associat d'aquesta instància. Aquesta acció no es pot desfer.",
"attachment-storage": "Emmagatzematge d'objectes actual",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "El vostre emmagatzematge de fitxers adjunts no està disponible.",
"email-in-use": "Aquest correu electrònic ja l'utilitza un altre compte."
},
@@ -596,6 +602,38 @@
"custom-code-description": "CSS i JavaScript opcionals per a tota la instància aplicats a la interfície.",
"custom-code-title": "Codi personalitzat"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Un nom fàcil de recordar",
diff --git a/web/src/locales/cs.json b/web/src/locales/cs.json
index 1182552f6..3b66e4381 100644
--- a/web/src/locales/cs.json
+++ b/web/src/locales/cs.json
@@ -392,6 +392,12 @@
"delete-account": "Smazat účet",
"delete-account-description": "Trvale odebrat tento účet a veškerý související přístup z této instance. Tuto akci nelze vrátit zpět.",
"attachment-storage": "Aktuální úložiště objektů",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Vaše úložiště příloh není k dispozici.",
"email-in-use": "Tento e-mail je již používán jiným účtem."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Volitelné CSS a JavaScript pro celou instanci použité na frontend.",
"custom-code-title": "Vlastní kód"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Snadno zapamatovatelný název",
diff --git a/web/src/locales/da.json b/web/src/locales/da.json
index cf02f2549..9e4448bb0 100644
--- a/web/src/locales/da.json
+++ b/web/src/locales/da.json
@@ -430,6 +430,12 @@
"update-information": "Opdater oplysninger",
"username-note": "Bruges til at logge ind",
"attachment-storage": "Opbevaring af bilag",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Din lagerplads for vedhæftede filer er ikke tilgængelig.",
"email-in-use": "Denne e-mail bruges allerede af en anden konto."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Den anbefalede værdi er 32 MiB.",
"server-name": "Servernavn"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Et navn, der er let at huske",
diff --git a/web/src/locales/de.json b/web/src/locales/de.json
index 37460a4a3..66922e8a7 100644
--- a/web/src/locales/de.json
+++ b/web/src/locales/de.json
@@ -392,6 +392,12 @@
"delete-account": "Konto löschen",
"delete-account-description": "Entfernen Sie dieses Konto und alle damit verbundenen Zugriffe dauerhaft von dieser Instanz. Diese Aktion kann nicht rückgängig gemacht werden.",
"attachment-storage": "Aktueller Objektspeicher",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Ihr Speicher für Anhänge ist nicht verfügbar.",
"email-in-use": "Diese E-Mail-Adresse wird bereits von einem anderen Konto verwendet."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Optionales instanzweites CSS und JavaScript, das auf das Frontend angewendet wird.",
"custom-code-title": "Benutzerdefinierter Code"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Einprägsamer Name",
diff --git a/web/src/locales/el.json b/web/src/locales/el.json
index 157941b4c..e362b9160 100644
--- a/web/src/locales/el.json
+++ b/web/src/locales/el.json
@@ -430,6 +430,12 @@
"update-information": "Ενημέρωση πληροφοριών",
"username-note": "Χρησιμοποιείται για είσοδο",
"attachment-storage": "Αποθήκευση εξαρτημάτων",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Ο χώρος αποθήκευσης των συνημμένων σας δεν είναι διαθέσιμος.",
"email-in-use": "Αυτό το email χρησιμοποιείται ήδη από άλλον λογαριασμό."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Η συνιστώμενη τιμή είναι 32 MiB.",
"server-name": "Όνομα διακομιστή"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Ένα όνομα που θυμάται εύκολα",
diff --git a/web/src/locales/en-GB.json b/web/src/locales/en-GB.json
index 628fc8ffc..09652f3e4 100644
--- a/web/src/locales/en-GB.json
+++ b/web/src/locales/en-GB.json
@@ -392,6 +392,12 @@
"delete-account": "Delete account",
"delete-account-description": "Permanently remove this account and all associated access from this instance. This action cannot be undone.",
"attachment-storage": "Attachment storage",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Your attachment storage is unavailable.",
"email-in-use": "This email is already used by another account."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Optional instance-wide CSS and JavaScript applied to the frontend.",
"custom-code-title": "Custom code"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "An easy-to-remember name",
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index 85af9e0a4..eb69170f6 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -493,6 +493,12 @@
},
"account": {
"attachment-storage": "Attachment storage",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Your attachment storage is unavailable.",
"change-password": "Change password",
"danger-area": "Danger area",
@@ -906,6 +912,38 @@
"max-upload-size-hint": "Recommended value is 32 MiB.",
"server-name": "Server Name"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "An easy-to-remember name",
diff --git a/web/src/locales/es.json b/web/src/locales/es.json
index a002aba74..4d0ad824b 100644
--- a/web/src/locales/es.json
+++ b/web/src/locales/es.json
@@ -392,6 +392,12 @@
"delete-account": "Eliminar cuenta",
"delete-account-description": "Elimina permanentemente esta cuenta y todos los accesos asociados de esta instancia. Esta acción no se puede deshacer.",
"attachment-storage": "Almacenamiento de objetos actual",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "El almacenamiento de archivos adjuntos no está disponible.",
"email-in-use": "Este correo electrónico ya está siendo utilizado por otra cuenta."
},
@@ -596,6 +602,38 @@
"custom-code-description": "CSS y JavaScript opcionales para toda la instancia aplicados a la interfaz.",
"custom-code-title": "código personalizado"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Un nombre fácil de recordar",
diff --git a/web/src/locales/et.json b/web/src/locales/et.json
index 8e56861f4..d16e505db 100644
--- a/web/src/locales/et.json
+++ b/web/src/locales/et.json
@@ -430,6 +430,12 @@
"update-information": "Värskenda teavet",
"username-note": "Kasutatud sisselogimiseks",
"attachment-storage": "Manuste hoidla",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Teie manuste salvestusruum pole saadaval.",
"email-in-use": "Seda e-posti aadressi kasutab juba teine ​​konto."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Soovitatav väärtus on 32 MiB.",
"server-name": "Serveri nimi"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Kergesti meeldejääv nimi",
diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json
index 155bf070d..8580c181b 100644
--- a/web/src/locales/fa.json
+++ b/web/src/locales/fa.json
@@ -548,6 +548,12 @@
"update-information": "بروزرسانی اطلاعات",
"username-note": "برای ورود استفاده می‌شود",
"attachment-storage": "ذخیره‌سازی فعلی اشیاء",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "فضای ذخیره‌سازی پیوست شما در دسترس نیست.",
"danger-area": "منطقه خطر",
"danger-area-description": "اقدامات برگشت‌ناپذیر حساب کاربری در اینجا قرار دارند. قبل از ادامه، آنها را با دقت بررسی کنید.",
@@ -591,6 +597,38 @@
"reactions-description": "گزینه‌های واکنشی را که کاربران می‌توانند برای یادداشت‌ها اعمال کنند، تعریف کنید.",
"remove-reaction": "حذف واکنش"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "نامی آسان برای به خاطر سپردن",
diff --git a/web/src/locales/fi.json b/web/src/locales/fi.json
index 25e0dd503..335c29dc3 100644
--- a/web/src/locales/fi.json
+++ b/web/src/locales/fi.json
@@ -430,6 +430,12 @@
"update-information": "Päivitä tiedot",
"username-note": "Käytettiin kirjautumiseen",
"attachment-storage": "Lisävarusteiden säilytys",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Liitetiedostojen tallennustila ei ole käytettävissä.",
"email-in-use": "Tätä sähköpostiosoitetta käyttää jo toinen tili."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Suositeltu arvo on 32 MiB.",
"server-name": "Palvelimen nimi"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Helposti muistettava nimi",
diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json
index fdde2cea9..0510ee111 100644
--- a/web/src/locales/fr.json
+++ b/web/src/locales/fr.json
@@ -392,6 +392,12 @@
"delete-account": "Supprimer le compte",
"delete-account-description": "Supprimez définitivement ce compte et tous les accès associés de cette instance. Cette action ne peut pas être annulée.",
"attachment-storage": "Stockage d'objets actuel",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Votre espace de stockage de pièces jointes est indisponible.",
"email-in-use": "Ce compte de messagerie est déjà utilisé."
},
@@ -596,6 +602,38 @@
"custom-code-description": "CSS et JavaScript facultatifs à l’échelle de l’instance appliqués au frontend.",
"custom-code-title": "Code personnalisé"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Un nom facile à retenir",
diff --git a/web/src/locales/gl.json b/web/src/locales/gl.json
index a5f3486d4..237769ef5 100644
--- a/web/src/locales/gl.json
+++ b/web/src/locales/gl.json
@@ -392,6 +392,12 @@
"delete-account": "Eliminar conta",
"delete-account-description": "Elimina permanentemente esta conta e todos os accesos asociados desta instancia. Esta acción non se pode desfacer.",
"attachment-storage": "Almacenaxe actual de obxetos",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "O teu almacenamento de anexos non está dispoñible.",
"email-in-use": "Este correo electrónico xa o usa outra conta."
},
@@ -596,6 +602,38 @@
"custom-code-description": "CSS e JavaScript opcionales para toda a instancia aplicados ao frontend.",
"custom-code-title": "Código personalizado"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Un nome doado de lembrar",
diff --git a/web/src/locales/he.json b/web/src/locales/he.json
index 2cff12d35..780f0ecc0 100644
--- a/web/src/locales/he.json
+++ b/web/src/locales/he.json
@@ -463,6 +463,12 @@
"update-information": "עדכון פרטים",
"username-note": "משמש להתחברות",
"attachment-storage": "אחסון האובייקטים הנוכחי",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "אחסון הקבצים המצורפים שלך אינו זמין.",
"email-in-use": "כתובת דוא\"ל זו כבר נמצאת בשימוש על ידי חשבון אחר."
},
@@ -745,6 +751,38 @@
"max-upload-size-hint": "הערך המומלץ הוא 32 MiB.",
"server-name": "שם השרת"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "שם שקל לזכור",
diff --git a/web/src/locales/hi.json b/web/src/locales/hi.json
index 913ce544a..06f10a3ec 100644
--- a/web/src/locales/hi.json
+++ b/web/src/locales/hi.json
@@ -548,6 +548,12 @@
"update-information": "जानकारी अपडेट करें",
"username-note": "साइन इन के लिए उपयोग किया जाता है",
"attachment-storage": "वर्तमान ऑब्जेक्ट स्टोरेज",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "आपका अटैचमेंट स्टोरेज उपलब्ध नहीं है.",
"danger-area": "डेंजर एरिया",
"danger-area-description": "इर्रिवर्सिबल अकाउंट एक्शन यहां रहते हैं. जारी रखने से पहले उन्हें ध्यान से रिव्यू करें.",
@@ -591,6 +597,38 @@
"reactions-description": "उन रिएक्शन ऑप्शन को डिफाइन करें जिन्हें यूज़र्स मेमो पर अप्लाई कर सकते हैं।",
"remove-reaction": "रिएक्शन हटाएँ"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "आसान नाम",
diff --git a/web/src/locales/hr.json b/web/src/locales/hr.json
index 9db823d36..8c47d48f0 100644
--- a/web/src/locales/hr.json
+++ b/web/src/locales/hr.json
@@ -392,6 +392,12 @@
"delete-account": "Izbriši račun",
"delete-account-description": "Trajno uklonite ovaj račun i sav pridruženi pristup iz ove instance. Ova se radnja ne može poništiti.",
"attachment-storage": "Trenutno skladište objekata",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Pohrana vaših privitaka nije dostupna.",
"email-in-use": "Ovu e-poštu već koristi drugi račun."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Izborni CSS i JavaScript za cijelu instancu primijenjeni na sučelje.",
"custom-code-title": "Prilagođeni kod"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Jednostavno ime za pamćenje",
diff --git a/web/src/locales/hu.json b/web/src/locales/hu.json
index aeb69c76f..08850a8cf 100644
--- a/web/src/locales/hu.json
+++ b/web/src/locales/hu.json
@@ -392,6 +392,12 @@
"delete-account": "Fiók törlése",
"delete-account-description": "Véglegesen távolítsa el ezt a fiókot és az összes kapcsolódó hozzáférést ebből a példányból. Ez a művelet nem vonható vissza.",
"attachment-storage": "Jelenlegi objektumtár",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "A mellékletek tárhelye nem érhető el.",
"email-in-use": "Ezt az e-mail címet már egy másik fiók használja."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Választható példány-szerte CSS és JavaScript alkalmazva a frontendre.",
"custom-code-title": "Egyedi kód"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Könnyen megjegyezhető név",
diff --git a/web/src/locales/id.json b/web/src/locales/id.json
index fd91e5b97..cb9c7c839 100644
--- a/web/src/locales/id.json
+++ b/web/src/locales/id.json
@@ -548,6 +548,12 @@
"update-information": "Perbarui Informasi",
"username-note": "Digunakan untuk masuk",
"attachment-storage": "Penyimpanan objek saat ini",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Penyimpanan lampiran Anda tidak tersedia.",
"danger-area": "Area berbahaya",
"danger-area-description": "Tindakan akun yang tidak dapat dibatalkan ada di sini. Tinjau dengan saksama sebelum melanjutkan.",
@@ -591,6 +597,38 @@
"reactions-description": "Tentukan opsi reaksi yang dapat diterapkan pengguna pada memo.",
"remove-reaction": "Hapus reaksi"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Nama yang mudah diingat",
diff --git a/web/src/locales/it.json b/web/src/locales/it.json
index 5e2973174..3f1eca885 100644
--- a/web/src/locales/it.json
+++ b/web/src/locales/it.json
@@ -392,6 +392,12 @@
"delete-account": "Elimina account",
"delete-account-description": "Rimuovi definitivamente questo account e tutti gli accessi associati da questa istanza. Questa azione non può essere annullata.",
"attachment-storage": "Archiviazione corrente",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Lo spazio di archiviazione degli allegati non è disponibile.",
"email-in-use": "Questa email è già in uso da un altro account."
},
@@ -596,6 +602,38 @@
"custom-code-description": "CSS e JavaScript opzionali a livello di istanza applicati al frontend.",
"custom-code-title": "Codice personalizzato"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Nome facile da ricordare",
diff --git a/web/src/locales/ja.json b/web/src/locales/ja.json
index fc0867569..cdedce44f 100644
--- a/web/src/locales/ja.json
+++ b/web/src/locales/ja.json
@@ -392,6 +392,12 @@
"delete-account": "アカウントを削除する",
"delete-account-description": "このアカウントと関連するすべてのアクセスをこのインスタンスから完全に削除します。 この操作は元に戻すことができません。",
"attachment-storage": "現在のオブジェクトストレージ",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "添付ファイルストレージが利用できません。",
"email-in-use": "このメールアドレスは既に別のアカウントで使用されています。"
},
@@ -596,6 +602,38 @@
"custom-code-description": "フロントエンドに適用されるオプションのインスタンス全体の CSS および JavaScript。",
"custom-code-title": "カスタムコード"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "覚えやすい名前",
diff --git a/web/src/locales/ka-GE.json b/web/src/locales/ka-GE.json
index 2f8ac0aca..1e92bab55 100644
--- a/web/src/locales/ka-GE.json
+++ b/web/src/locales/ka-GE.json
@@ -392,6 +392,12 @@
"delete-account": "ანგარიშის წაშლა",
"delete-account-description": "სამუდამოდ წაშალეთ ეს ანგარიში და ყველა დაკავშირებული წვდომა ამ მაგალითიდან. ამ მოქმედების გაუქმება შეუძლებელია.",
"attachment-storage": "მიმდინარე ობიექტის შენახვა",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "თქვენი დანართის საცავი მიუწვდომელია.",
"email-in-use": "ეს ელ. ფოსტა უკვე გამოიყენება სხვა ანგარიშის მიერ."
},
@@ -596,6 +602,38 @@
"custom-code-description": "სურვილისამებრ, მაგალითზე CSS და JavaScript გამოიყენება წინა მხარეს.",
"custom-code-title": "მორგებული კოდი"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "მარტივად დასამახსოვრებელი სახელი",
diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json
index fb510e9b2..0d368dc58 100644
--- a/web/src/locales/ko.json
+++ b/web/src/locales/ko.json
@@ -548,6 +548,12 @@
"update-information": "정보 변경",
"username-note": "로그인하는 데 사용됨",
"attachment-storage": "사용 중인 저장소",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "첨부 파일 저장 공간을 사용할 수 없습니다.",
"danger-area": "위험 영역",
"danger-area-description": "되돌릴 수 없는 계정 작업이 여기에 있습니다. 계속하기 전에 주의 깊게 검토하십시오.",
@@ -591,6 +597,38 @@
"reactions-description": "사용자가 메모에 적용할 수 있는 반응 옵션을 정의합니다.",
"remove-reaction": "반응 제거"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "기억하기 쉬운 이름",
diff --git a/web/src/locales/lt.json b/web/src/locales/lt.json
index d78dbc61c..7985a2708 100644
--- a/web/src/locales/lt.json
+++ b/web/src/locales/lt.json
@@ -430,6 +430,12 @@
"update-information": "Atnaujinti informaciją",
"username-note": "Naudojamas prisijungimui",
"attachment-storage": "Priedų saugykla",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Jūsų priedų saugykla nepasiekiama.",
"email-in-use": "Šį el. pašto adresą jau naudoja kita paskyra."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Rekomenduojama vertė yra 32 MiB.",
"server-name": "Serverio pavadinimas"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Lengvai įsimenamas vardas",
diff --git a/web/src/locales/lv.json b/web/src/locales/lv.json
index 5ba230cb4..3fdcad816 100644
--- a/web/src/locales/lv.json
+++ b/web/src/locales/lv.json
@@ -430,6 +430,12 @@
"update-information": "Atjaunināt informāciju",
"username-note": "Izmanto, lai pierakstītos",
"attachment-storage": "Pielikumu krātuve",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Jūsu pielikumu krātuve nav pieejama.",
"email-in-use": "Šo e-pastu jau izmanto cits konts."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Ieteicamā vērtība ir 32 MiB.",
"server-name": "Servera nosaukums"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Viegli iegaumējams nosaukums",
diff --git a/web/src/locales/mr.json b/web/src/locales/mr.json
index fcca833ba..ea9695914 100644
--- a/web/src/locales/mr.json
+++ b/web/src/locales/mr.json
@@ -548,6 +548,12 @@
"update-information": "माहिती अपडेट करा",
"username-note": "साइन इन करण्यासाठी वापरले जाते",
"attachment-storage": "वर्तमान ऑब्जेक्ट स्टोरेज",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "तुमचे अटॅचमेंट स्टोरेज अनुपलब्ध आहे.",
"danger-area": "धोकादायक क्षेत्र",
"danger-area-description": "येथे अपरिवर्तनीय खाते क्रिया आहेत. पुढे जाण्यापूर्वी त्यांचे काळजीपूर्वक पुनरावलोकन करा.",
@@ -591,6 +597,38 @@
"reactions-description": "वापरकर्ते मेमोंवर लागू करू शकतील असे प्रतिक्रिया पर्याय परिभाषित करा.",
"remove-reaction": "प्रतिक्रिया काढून टाका"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "स्मरणात राहणारे नाव",
diff --git a/web/src/locales/nb.json b/web/src/locales/nb.json
index 7e1a9bb3f..bc4f82590 100644
--- a/web/src/locales/nb.json
+++ b/web/src/locales/nb.json
@@ -392,6 +392,12 @@
"delete-account": "Slett konto",
"delete-account-description": "Fjern denne kontoen og all tilknyttet tilgang fra denne forekomsten permanent. Denne handlingen kan ikke angres.",
"attachment-storage": "Nåværende lagring av objekter",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Vedleggslagringen din er ikke tilgjengelig.",
"email-in-use": "Denne e-postadressen brukes allerede av en annen konto."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Valgfrie forekomstomfattende CSS og JavaScript brukes på frontend.",
"custom-code-title": "Egendefinert kode"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Et lett å huske navn",
diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json
index 43ee8ad5e..529462856 100644
--- a/web/src/locales/nl.json
+++ b/web/src/locales/nl.json
@@ -392,6 +392,12 @@
"delete-account": "Account verwijderen",
"delete-account-description": "Verwijder dit account en alle bijbehorende toegang definitief van deze instantie. Deze actie kan niet ongedaan worden gemaakt.",
"attachment-storage": "Huidige objectopslag",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Uw bijlageopslag is niet beschikbaar.",
"email-in-use": "Dit e-mailadres wordt al door een ander account gebruikt."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Optioneel exemplaar-brede CSS en JavaScript toegepast op de frontend.",
"custom-code-title": "Aangepaste code"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Een makkelijk te onthouden naam",
diff --git a/web/src/locales/nn.json b/web/src/locales/nn.json
index 61f1caf5b..56acb3f15 100644
--- a/web/src/locales/nn.json
+++ b/web/src/locales/nn.json
@@ -493,6 +493,12 @@
},
"account": {
"attachment-storage": "Vedleggslagring",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"change-password": "Endre passord",
"danger-area": "Faresone",
"danger-area-description": "Her finn du kontohandlingar som ikkje kan gjerast om. Sjå nøye gjennom dei før du held fram.",
@@ -941,6 +947,38 @@
"title": "Emneknaggmetadata",
"used-count": "{{count}} notat"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Eit namn som er lett å hugse",
diff --git a/web/src/locales/pl.json b/web/src/locales/pl.json
index 83dc7f1e3..8be690d39 100644
--- a/web/src/locales/pl.json
+++ b/web/src/locales/pl.json
@@ -392,6 +392,12 @@
"delete-account": "Usuń konto",
"delete-account-description": "Usuń trwale to konto i cały powiązany z nim dostęp z tej instancji. Tej akcji nie można cofnąć.",
"attachment-storage": "Aktualny magazyn obiektów",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Twoja pamięć na załączniki jest niedostępna.",
"email-in-use": "Ten adres e-mail jest już używany przez inne konto."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Opcjonalne CSS i JavaScript obejmujące całą instancję zastosowane w interfejsie użytkownika.",
"custom-code-title": "Kod niestandardowy"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Łatwa do zapamiętania nazwa",
diff --git a/web/src/locales/pt-BR.json b/web/src/locales/pt-BR.json
index 9cb700995..4bf620e41 100644
--- a/web/src/locales/pt-BR.json
+++ b/web/src/locales/pt-BR.json
@@ -548,6 +548,12 @@
"update-information": "Atualizar informações",
"username-note": "Usado para entrar",
"attachment-storage": "Armazenamento de objetos atual",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Seu armazenamento de anexos está indisponível.",
"danger-area": "Área de perigo",
"danger-area-description": "Ações irreversíveis da conta estão aqui. Analise-as cuidadosamente antes de continuar.",
@@ -591,6 +597,38 @@
"reactions-description": "Definir as opções de reação que os usuários podem aplicar aos memorandos.",
"remove-reaction": "Remover reação"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Um nome fácil de lembrar",
diff --git a/web/src/locales/pt-PT.json b/web/src/locales/pt-PT.json
index a5c60e5e2..2eedf1cfa 100644
--- a/web/src/locales/pt-PT.json
+++ b/web/src/locales/pt-PT.json
@@ -392,6 +392,12 @@
"delete-account": "Excluir conta",
"delete-account-description": "Remova permanentemente esta conta e todos os acessos associados desta instância. Esta ação não pode ser desfeita.",
"attachment-storage": "Armazenamento de objetos atual",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "O seu armazenamento de anexos está indisponível.",
"email-in-use": "Este e-mail já está a ser utilizado por outra conta."
},
@@ -596,6 +602,38 @@
"custom-code-description": "CSS e JavaScript opcionais em toda a instância aplicados ao front-end.",
"custom-code-title": "Código personalizado"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Um nome fácil de lembrar",
diff --git a/web/src/locales/ro.json b/web/src/locales/ro.json
index 72d54893b..165e1092c 100644
--- a/web/src/locales/ro.json
+++ b/web/src/locales/ro.json
@@ -430,6 +430,12 @@
"update-information": "Actualizați informații",
"username-note": "Folosit pentru a vă conecta",
"attachment-storage": "Depozitarea atașamentelor",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Spațiul de stocare pentru atașamente nu este disponibil.",
"email-in-use": "Această adresă de e-mail este deja utilizată de un alt cont."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Valoarea recomandată este 32 MiB.",
"server-name": "Nume server"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Un nume ușor de reținut",
diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json
index 260fe51b0..16f227cbe 100644
--- a/web/src/locales/ru.json
+++ b/web/src/locales/ru.json
@@ -392,6 +392,12 @@
"delete-account": "Удалить аккаунт",
"delete-account-description": "Навсегда удалите эту учетную запись и весь связанный с ней доступ из этого экземпляра. Это действие невозможно отменить.",
"attachment-storage": "Текущее объектное хранилище",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Ваше хранилище вложений недоступно.",
"email-in-use": "Этот адрес электронной почты уже используется другой учетной записью."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Дополнительные CSS и JavaScript для всего экземпляра применяются к интерфейсу.",
"custom-code-title": "Пользовательский код"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Название, которое легко запомнить",
diff --git a/web/src/locales/sk.json b/web/src/locales/sk.json
index 39624ceaa..8f5b8eeb6 100644
--- a/web/src/locales/sk.json
+++ b/web/src/locales/sk.json
@@ -430,6 +430,12 @@
"update-information": "Aktualizovať informácie",
"username-note": "Používa sa na prihlásenie",
"attachment-storage": "Ukladanie príloh",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Vaše úložisko príloh nie je k dispozícii.",
"email-in-use": "Tento e-mail už používa iný účet."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Odporúčaná hodnota je 32 MiB.",
"server-name": "Názov servera"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Ľahko zapamätateľné meno",
diff --git a/web/src/locales/sl.json b/web/src/locales/sl.json
index e352be992..9b8f3a7ce 100644
--- a/web/src/locales/sl.json
+++ b/web/src/locales/sl.json
@@ -392,6 +392,12 @@
"delete-account": "Izbriši račun",
"delete-account-description": "Trajno odstranite ta račun in ves povezan dostop iz tega primerka. Tega dejanja ni mogoče razveljaviti.",
"attachment-storage": "Trenutna shramba predmetov",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Shramba za priloge ni na voljo.",
"email-in-use": "Ta e-poštni naslov že uporablja drug račun."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Izbirna CSS in JavaScript za celotno instanco, ki se uporabljata za sprednji del.",
"custom-code-title": "Koda po meri"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Ime, ki si ga lahko zapomniš",
diff --git a/web/src/locales/sr.json b/web/src/locales/sr.json
index 506fdefae..fc2ffe097 100644
--- a/web/src/locales/sr.json
+++ b/web/src/locales/sr.json
@@ -430,6 +430,12 @@
"update-information": "Упдате Информатион",
"username-note": "Користи се за пријављивање",
"attachment-storage": "Складиштење прилога",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Складиште ваших прилога није доступно.",
"email-in-use": "Ову имејл адресу већ користи други налог."
},
@@ -712,6 +718,38 @@
"max-upload-size-hint": "Препоручена вредност је 32 MiB.",
"server-name": "Име сервера"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Име које се лако памти",
diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json
index b9fb11f0e..7c51570cf 100644
--- a/web/src/locales/sv.json
+++ b/web/src/locales/sv.json
@@ -392,6 +392,12 @@
"delete-account": "Ta bort konto",
"delete-account-description": "Ta bort det här kontot och all tillhörande åtkomst permanent från den här instansen. Denna åtgärd kan inte ångras.",
"attachment-storage": "Nuvarande objektlagring",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Din lagring av bilagor är inte tillgänglig.",
"email-in-use": "Denna e-postadress används redan av ett annat konto."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Valfria instansomfattande CSS och JavaScript tillämpas på frontend.",
"custom-code-title": "Anpassad kod"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Ett lättnamn",
diff --git a/web/src/locales/th.json b/web/src/locales/th.json
index cabef847f..458c96a29 100644
--- a/web/src/locales/th.json
+++ b/web/src/locales/th.json
@@ -548,6 +548,12 @@
"update-information": "อัปเดทข้อมูล",
"username-note": "ใช้เพื่อเข้าสู่ระบบ",
"attachment-storage": "พื้นที่ object storage ปัจจุบัน",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "พื้นที่จัดเก็บไฟล์แนบของคุณไม่พร้อมใช้งาน",
"danger-area": "พื้นที่อันตราย",
"danger-area-description": "การดำเนินการบัญชีที่ไม่สามารถย้อนกลับได้อยู่ที่นี่ โปรดตรวจสอบอย่างละเอียดก่อนดำเนินการต่อ",
@@ -591,6 +597,38 @@
"reactions-description": "กำหนดตัวเลือกการตอบสนองที่ผู้ใช้สามารถใช้กับบันทึกช่วยจำ",
"remove-reaction": "ลบการตอบสนอง"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "ชื่อที่จำง่าย",
diff --git a/web/src/locales/tr.json b/web/src/locales/tr.json
index 28a95cfbd..1bced6acd 100644
--- a/web/src/locales/tr.json
+++ b/web/src/locales/tr.json
@@ -422,6 +422,12 @@
},
"account": {
"attachment-storage": "Ek depolama alanı",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Ek depolama bilginiz alınamıyor.",
"change-password": "Şifre değiştir",
"email-note": "İsteğe bağlı",
@@ -757,6 +763,38 @@
"custom-code-description": "Ön uca uygulanan isteğe bağlı bulut sunucusu çapında CSS ve JavaScript.",
"custom-code-title": "Özel kod"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Hatırlaması kolay bir isim",
diff --git a/web/src/locales/uk.json b/web/src/locales/uk.json
index c1dacb0bf..478c08d44 100644
--- a/web/src/locales/uk.json
+++ b/web/src/locales/uk.json
@@ -392,6 +392,12 @@
"delete-account": "Видалити акаунт",
"delete-account-description": "Назавжди видалити цей обліковий запис і весь пов’язаний доступ із цього екземпляра. Цю дію не можна скасувати.",
"attachment-storage": "Поточне сховище об'єктів",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Ваше сховище вкладень недоступне.",
"email-in-use": "Ця електронна адреса вже використовується іншим обліковим записом."
},
@@ -596,6 +602,38 @@
"custom-code-description": "Додаткові CSS і JavaScript для всього екземпляра, застосовані до інтерфейсу.",
"custom-code-title": "Спеціальний код"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Легке для запам'ятовування ім'я",
diff --git a/web/src/locales/vi.json b/web/src/locales/vi.json
index 2e3b1ae59..80850e6eb 100644
--- a/web/src/locales/vi.json
+++ b/web/src/locales/vi.json
@@ -548,6 +548,12 @@
"update-information": "Cập nhật thông tin",
"username-note": "Dùng để đăng nhập",
"attachment-storage": "Kho lưu trữ đối tượng hiện tại",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "Kho lưu trữ tệp đính kèm của bạn không khả dụng.",
"danger-area": "Khu vực nguy hiểm",
"danger-area-description": "Các hành động tài khoản không thể đảo ngược nằm ở đây. Hãy xem xét kỹ trước khi tiếp tục.",
@@ -591,6 +597,38 @@
"reactions-description": "Xác định các tùy chọn biểu tượng cảm xúc mà người dùng có thể áp dụng cho ghi chú.",
"remove-reaction": "Xóa phản ứng"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "Tên dễ nhớ",
diff --git a/web/src/locales/zh-Hans.json b/web/src/locales/zh-Hans.json
index bf465c1e5..01b8decd4 100644
--- a/web/src/locales/zh-Hans.json
+++ b/web/src/locales/zh-Hans.json
@@ -616,6 +616,12 @@
},
"account": {
"attachment-storage": "附件占用空间",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "暂时无法获取你的附件占用空间。",
"change-password": "修改密码",
"danger-area": "危险操作区",
@@ -665,6 +671,38 @@
"content-length-limit-error": "内容长度限制必须为介于 {{min}} 和 {{max}} 字节之间的整数。",
"content-length-limit-minimum": "最小值:{{min}} 字节"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "请输入一个容易记住的标题",
diff --git a/web/src/locales/zh-Hant.json b/web/src/locales/zh-Hant.json
index fcba2bf8c..17352ccb0 100644
--- a/web/src/locales/zh-Hant.json
+++ b/web/src/locales/zh-Hant.json
@@ -461,6 +461,12 @@
},
"account": {
"attachment-storage": "附件佔用空間",
+ "usage-description": "Limits set by the admin of this instance. Comments and archived memos count as memos.",
+ "usage-file-size": "Largest file",
+ "usage-memos": "Memos",
+ "usage-of": "{{usage}} of {{limit}}",
+ "usage-storage": "Storage",
+ "usage-title": "Usage limits",
"storage-usage-error": "暫時無法取得你的附件佔用空間。",
"change-password": "變更密碼",
"danger-area": "危險區域",
@@ -834,6 +840,38 @@
"max-upload-size-hint": "建議值為 32 MiB。",
"server-name": "伺服器名稱"
},
+ "usage-limits": {
+ "add-user": "Add user limit",
+ "all-users": "All users",
+ "all-users-description": "Everyone, admins included",
+ "all-users-hint": "Leave a field empty for no limit.",
+ "all-users-placeholder": "All users: {{value}}",
+ "all-users-title": "Limits for all users",
+ "description": "Keep this instance fast and reliable by capping what each user can store. All users applies to everyone, and a user's own limits replace it. Gray values come from All users.",
+ "file-size": "Largest file (MiB)",
+ "file-size-column": "Largest file",
+ "file-size-warning": "Not below the instance upload limit of {{limit}} MiB, so it has no effect.",
+ "invalid": "Enter a whole number of memos, or a size in MiB.",
+ "label": "Usage limits",
+ "memos": "Memos",
+ "memos-description": "Includes comments and archived memos.",
+ "no-candidates": "Every user already has their own limits.",
+ "remove": "Remove",
+ "remove-description": "The All users limits will apply to this user again.",
+ "remove-title": "Remove the limits for {{username}}?",
+ "removed": "Limits removed",
+ "row-actions": "Actions for {{name}}",
+ "saved": "Usage limits saved",
+ "select-user": "Select a user",
+ "storage": "Storage (MiB)",
+ "storage-column": "Storage",
+ "storage-description": "The total size of uploads. External links do not count.",
+ "title": "Usage limits",
+ "unlimited": "Unlimited",
+ "user": "User",
+ "user-hint": "Leave a field empty to use the All users limit. Enter 0 for no limit.",
+ "user-title": "Limits for {{user}}"
+ },
"webhook": {
"create-dialog": {
"an-easy-to-remember-name": "一個容易記住的名稱",
diff --git a/web/src/types/proto/api/instance_service_pb.ts b/web/src/types/proto/api/instance_service_pb.ts
index 64c17bf7f..81ee62b01 100644
--- a/web/src/types/proto/api/instance_service_pb.ts
+++ b/web/src/types/proto/api/instance_service_pb.ts
@@ -20,7 +20,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file api/instance_service.proto.
*/
export const file_api_instance_service: GenFile = /*@__PURE__*/
- fileDesc("ChphcGkvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIJbWVtb3MuYXBpIqkCCg9JbnN0YW5jZVByb2ZpbGUSDwoHdmVyc2lvbhgBIAEoCRIOCgZjb21taXQYAiABKAkSDAoEZGVtbxgDIAEoCBIUCgxpbnN0YW5jZV91cmwYBCABKAkSMgoLYWNjZXNzX21vZGUYBSABKA4yHS5tZW1vcy5hcGkuSW5zdGFuY2VBY2Nlc3NNb2RlEhMKC25lZWRzX3NldHVwGAYgASgIEh4KBWFkbWluGAcgASgLMg8ubWVtb3MuYXBpLlVzZXISNwoJY2hhbGxlbmdlGAggASgLMiQubWVtb3MuYXBpLkluc3RhbmNlUHJvZmlsZS5DaGFsbGVuZ2UaLwoJQ2hhbGxlbmdlEhAKCHByb3ZpZGVyGAEgASgJEhAKCHNpdGVfa2V5GAIgASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QisRoKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRAoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMikubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkQKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIpLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJNChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzItLm1lbW9zLmFwaS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAASPgoMdGFnc19zZXR0aW5nGAUgASgLMiYubWVtb3MuYXBpLkluc3RhbmNlU2V0dG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2V0SW5zdGFuY2VTdGF0c1JlcXVlc3QaGC5tZW1vcy5hcGkuSW5zdGFuY2VTdGF0cyIbgtPkkwIVEhMvYXBpL2luc3RhbmNlL3N0YXRzQpMBCg1jb20ubWVtb3MuYXBpQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWidnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGmiAgNNQViqAglNZW1vcy5BcGnKAglNZW1vc1xBcGniAhVNZW1vc1xBcGlcR1BCTWV0YWRhdGHqAgpNZW1vczo6QXBpYgZwcm90bzM", [file_api_user_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);
+ fileDesc("ChphcGkvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIJbWVtb3MuYXBpIqkCCg9JbnN0YW5jZVByb2ZpbGUSDwoHdmVyc2lvbhgBIAEoCRIOCgZjb21taXQYAiABKAkSDAoEZGVtbxgDIAEoCBIUCgxpbnN0YW5jZV91cmwYBCABKAkSMgoLYWNjZXNzX21vZGUYBSABKA4yHS5tZW1vcy5hcGkuSW5zdGFuY2VBY2Nlc3NNb2RlEhMKC25lZWRzX3NldHVwGAYgASgIEh4KBWFkbWluGAcgASgLMg8ubWVtb3MuYXBpLlVzZXISNwoJY2hhbGxlbmdlGAggASgLMiQubWVtb3MuYXBpLkluc3RhbmNlUHJvZmlsZS5DaGFsbGVuZ2UaLwoJQ2hhbGxlbmdlEhAKCHByb3ZpZGVyGAEgASgJEhAKCHNpdGVfa2V5GAIgASgJIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QisRoKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRAoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMikubWVtb3MuYXBpLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkQKD3N0b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CJC2kEadXNhZ2VfbGltaXQsdXNhZ2VfbGltaXRfaWSC0+STAh86C3VzYWdlX2xpbWl0IhAvYXBpL3VzYWdlTGltaXRzEqMBChBVcGRhdGVVc2FnZUxpbWl0EiIubWVtb3MuYXBpLlVwZGF0ZVVzYWdlTGltaXRSZXF1ZXN0GhUubWVtb3MuYXBpLlVzYWdlTGltaXQiVNpBF3VzYWdlX2xpbWl0LHVwZGF0ZV9tYXNrgtPkkwI0Ogt1c2FnZV9saW1pdDIlL2FwaS97dXNhZ2VfbGltaXQubmFtZT11c2FnZUxpbWl0cy8qfRJ4ChBEZWxldGVVc2FnZUxpbWl0EiIubWVtb3MuYXBpLkRlbGV0ZVVzYWdlTGltaXRSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IijaQQRuYW1lgtPkkwIbKhkvYXBpL3tuYW1lPXVzYWdlTGltaXRzLyp9QpMBCg1jb20ubWVtb3MuYXBpQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWidnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGmiAgNNQViqAglNZW1vcy5BcGnKAglNZW1vc1xBcGniAhVNZW1vc1xBcGlcR1BCTWV0YWRhdGHqAgpNZW1vczo6QXBpYgZwcm90bzM", [file_api_user_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);
/**
* InstanceProfile is the basic information about the instance.
@@ -361,7 +361,7 @@ export type InstanceSetting_StorageSetting = Message<"memos.api.InstanceSetting.
filepathTemplate: string;
/**
- * The maximum upload size in megabytes. Default is 30.
+ * The maximum upload size in megabytes. Default is 32.
*
* @generated from field: int64 upload_size_limit_mb = 4;
*/
@@ -1301,6 +1301,279 @@ export type GetInstanceStatsRequest = Message<"memos.api.GetInstanceStatsRequest
export const GetInstanceStatsRequestSchema: GenMessage<GetInstanceStatsRequest> = /*@__PURE__*/
messageDesc(file_api_instance_service, 9);
+/**
+ * UsageLimit sets one limit for every user, or for one user. When both exist
+ * for the same metric, the limit for the user applies to that user.
+ *
+ * @generated from message memos.api.UsageLimit
+ */
+export type UsageLimit = Message<"memos.api.UsageLimit"> & {
+ /**
+ * Identifier. The resource name of the usage limit.
+ * Format: usageLimits/{usage_limit}
+ *
+ * @generated from field: string name = 1;
+ */
+ name: string;
+
+ /**
+ * Required. Immutable. What is limited.
+ *
+ * @generated from field: memos.api.UsageLimit.Metric metric = 2;
+ */
+ metric: UsageLimit_Metric;
+
+ /**
+ * Optional. Immutable. The user the limit applies to. Empty means every user.
+ * Format: users/{user}
+ *
+ * @generated from field: string user = 3;
+ */
+ user: string;
+
+ /**
+ * Required. The limit. Must not be negative. 0 means unlimited for MEMOS and
+ * STORAGE_BYTES, and no extra limit for UPLOAD_BYTES.
+ *
+ * @generated from field: int64 value = 4;
+ */
+ value: bigint;
+
+ /**
+ * Output only. The creation time.
+ *
+ * @generated from field: google.protobuf.Timestamp create_time = 5;
+ */
+ createTime?: Timestamp | undefined;
+
+ /**
+ * Output only. The last update time.
+ *
+ * @generated from field: google.protobuf.Timestamp update_time = 6;
+ */
+ updateTime?: Timestamp | undefined;
+};
+
+/**
+ * Describes the message memos.api.UsageLimit.
+ * Use `create(UsageLimitSchema)` to create a new message.
+ */
+export const UsageLimitSchema: GenMessage<UsageLimit> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 10);
+
+/**
+ * Metric is what a usage limit counts.
+ *
+ * @generated from enum memos.api.UsageLimit.Metric
+ */
+export enum UsageLimit_Metric {
+ /**
+ * @generated from enum value: METRIC_UNSPECIFIED = 0;
+ */
+ METRIC_UNSPECIFIED = 0,
+
+ /**
+ * The number of memos the user created, including comments, archived
+ * memos, and memos in Spaces.
+ *
+ * @generated from enum value: MEMOS = 1;
+ */
+ MEMOS = 1,
+
+ /**
+ * The total size in bytes of the user's uploads, including uploads not
+ * attached to a memo. External links do not count.
+ *
+ * @generated from enum value: STORAGE_BYTES = 2;
+ */
+ STORAGE_BYTES = 2,
+
+ /**
+ * The size in bytes of one uploaded file. It can only lower the instance
+ * upload limit, never raise it.
+ *
+ * @generated from enum value: UPLOAD_BYTES = 3;
+ */
+ UPLOAD_BYTES = 3,
+}
+
+/**
+ * Describes the enum memos.api.UsageLimit.Metric.
+ */
+export const UsageLimit_MetricSchema: GenEnum<UsageLimit_Metric> = /*@__PURE__*/
+ enumDesc(file_api_instance_service, 10, 0);
+
+/**
+ * Request message for InstanceService.ListUsageLimits.
+ *
+ * @generated from message memos.api.ListUsageLimitsRequest
+ */
+export type ListUsageLimitsRequest = Message<"memos.api.ListUsageLimitsRequest"> & {
+ /**
+ * Optional. The maximum number of usage limits to return. If unspecified, at
+ * most 50 are returned. The maximum value is 1000; values above 1000 are
+ * coerced to 1000.
+ *
+ * @generated from field: int32 page_size = 1;
+ */
+ pageSize: number;
+
+ /**
+ * Optional. A page token from a previous call. Provide it to retrieve the
+ * next page.
+ *
+ * @generated from field: string page_token = 2;
+ */
+ pageToken: string;
+
+ /**
+ * Optional. A CEL filter on `user` and `metric`, combined with `&&`.
+ * `user == ""` selects the defaults for every user.
+ * Example: "user == 'users/steven' && metric == 'STORAGE_BYTES'"
+ *
+ * @generated from field: string filter = 3;
+ */
+ filter: string;
+};
+
+/**
+ * Describes the message memos.api.ListUsageLimitsRequest.
+ * Use `create(ListUsageLimitsRequestSchema)` to create a new message.
+ */
+export const ListUsageLimitsRequestSchema: GenMessage<ListUsageLimitsRequest> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 11);
+
+/**
+ * Response message for InstanceService.ListUsageLimits.
+ *
+ * @generated from message memos.api.ListUsageLimitsResponse
+ */
+export type ListUsageLimitsResponse = Message<"memos.api.ListUsageLimitsResponse"> & {
+ /**
+ * The usage limits, defaults first, then by user and metric.
+ *
+ * @generated from field: repeated memos.api.UsageLimit usage_limits = 1;
+ */
+ usageLimits: UsageLimit[];
+
+ /**
+ * A token to retrieve the next page. Empty when there are no more pages.
+ *
+ * @generated from field: string next_page_token = 2;
+ */
+ nextPageToken: string;
+};
+
+/**
+ * Describes the message memos.api.ListUsageLimitsResponse.
+ * Use `create(ListUsageLimitsResponseSchema)` to create a new message.
+ */
+export const ListUsageLimitsResponseSchema: GenMessage<ListUsageLimitsResponse> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 12);
+
+/**
+ * Request message for InstanceService.GetUsageLimit.
+ *
+ * @generated from message memos.api.GetUsageLimitRequest
+ */
+export type GetUsageLimitRequest = Message<"memos.api.GetUsageLimitRequest"> & {
+ /**
+ * Required. The resource name of the usage limit.
+ * Format: usageLimits/{usage_limit}
+ *
+ * @generated from field: string name = 1;
+ */
+ name: string;
+};
+
+/**
+ * Describes the message memos.api.GetUsageLimitRequest.
+ * Use `create(GetUsageLimitRequestSchema)` to create a new message.
+ */
+export const GetUsageLimitRequestSchema: GenMessage<GetUsageLimitRequest> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 13);
+
+/**
+ * Request message for InstanceService.CreateUsageLimit.
+ *
+ * @generated from message memos.api.CreateUsageLimitRequest
+ */
+export type CreateUsageLimitRequest = Message<"memos.api.CreateUsageLimitRequest"> & {
+ /**
+ * Required. The usage limit to create.
+ *
+ * @generated from field: memos.api.UsageLimit usage_limit = 1;
+ */
+ usageLimit?: UsageLimit | undefined;
+
+ /**
+ * Optional. The ID to use for the usage limit, which becomes the final
+ * segment of its name. Lowercase letters, digits and hyphens, at most 32
+ * characters, starting with a letter. Generated when empty.
+ *
+ * @generated from field: string usage_limit_id = 2;
+ */
+ usageLimitId: string;
+};
+
+/**
+ * Describes the message memos.api.CreateUsageLimitRequest.
+ * Use `create(CreateUsageLimitRequestSchema)` to create a new message.
+ */
+export const CreateUsageLimitRequestSchema: GenMessage<CreateUsageLimitRequest> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 14);
+
+/**
+ * Request message for InstanceService.UpdateUsageLimit.
+ *
+ * @generated from message memos.api.UpdateUsageLimitRequest
+ */
+export type UpdateUsageLimitRequest = Message<"memos.api.UpdateUsageLimitRequest"> & {
+ /**
+ * Required. The usage limit with its new value.
+ *
+ * @generated from field: memos.api.UsageLimit usage_limit = 1;
+ */
+ usageLimit?: UsageLimit | undefined;
+
+ /**
+ * Optional. The fields to update. Only `value` is supported, which is also
+ * the default.
+ *
+ * @generated from field: google.protobuf.FieldMask update_mask = 2;
+ */
+ updateMask?: FieldMask | undefined;
+};
+
+/**
+ * Describes the message memos.api.UpdateUsageLimitRequest.
+ * Use `create(UpdateUsageLimitRequestSchema)` to create a new message.
+ */
+export const UpdateUsageLimitRequestSchema: GenMessage<UpdateUsageLimitRequest> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 15);
+
+/**
+ * Request message for InstanceService.DeleteUsageLimit.
+ *
+ * @generated from message memos.api.DeleteUsageLimitRequest
+ */
+export type DeleteUsageLimitRequest = Message<"memos.api.DeleteUsageLimitRequest"> & {
+ /**
+ * Required. The resource name of the usage limit.
+ * Format: usageLimits/{usage_limit}
+ *
+ * @generated from field: string name = 1;
+ */
+ name: string;
+};
+
+/**
+ * Describes the message memos.api.DeleteUsageLimitRequest.
+ * Use `create(DeleteUsageLimitRequestSchema)` to create a new message.
+ */
+export const DeleteUsageLimitRequestSchema: GenMessage<DeleteUsageLimitRequest> = /*@__PURE__*/
+ messageDesc(file_api_instance_service, 16);
+
/**
* InstanceAccessMode controls whether unauthenticated users may access instance content.
*
@@ -1403,6 +1676,62 @@ export const InstanceService: GenService<{
input: typeof GetInstanceStatsRequestSchema;
output: typeof InstanceStatsSchema;
},
+ /**
+ * ListUsageLimits lists the usage limits: the defaults for every user and the
+ * limits for single users. Admin only.
+ *
+ * @generated from rpc memos.api.InstanceService.ListUsageLimits
+ */
+ listUsageLimits: {
+ methodKind: "unary";
+ input: typeof ListUsageLimitsRequestSchema;
+ output: typeof ListUsageLimitsResponseSchema;
+ },
+ /**
+ * GetUsageLimit gets a usage limit. Admin only.
+ *
+ * @generated from rpc memos.api.InstanceService.GetUsageLimit
+ */
+ getUsageLimit: {
+ methodKind: "unary";
+ input: typeof GetUsageLimitRequestSchema;
+ output: typeof UsageLimitSchema;
+ },
+ /**
+ * CreateUsageLimit creates a usage limit. Admin only. There is at most one
+ * limit per metric and user, and one default per metric. Fails with
+ * FAILED_PRECONDITION when the usage limits are configured by the deployment.
+ *
+ * @generated from rpc memos.api.InstanceService.CreateUsageLimit
+ */
+ createUsageLimit: {
+ methodKind: "unary";
+ input: typeof CreateUsageLimitRequestSchema;
+ output: typeof UsageLimitSchema;
+ },
+ /**
+ * UpdateUsageLimit updates the value of a usage limit. Admin only. The metric
+ * and user cannot change.
+ *
+ * @generated from rpc memos.api.InstanceService.UpdateUsageLimit
+ */
+ updateUsageLimit: {
+ methodKind: "unary";
+ input: typeof UpdateUsageLimitRequestSchema;
+ output: typeof UsageLimitSchema;
+ },
+ /**
+ * DeleteUsageLimit deletes a usage limit. Admin only. Deleting a user's limit
+ * returns the user to the default; deleting a default makes the metric
+ * unlimited for users without their own limit.
+ *
+ * @generated from rpc memos.api.InstanceService.DeleteUsageLimit
+ */
+ deleteUsageLimit: {
+ methodKind: "unary";
+ input: typeof DeleteUsageLimitRequestSchema;
+ output: typeof EmptySchema;
+ },
}> = /*@__PURE__*/
serviceDesc(file_api_instance_service, 0);
diff --git a/web/src/types/proto/api/user_service_pb.ts b/web/src/types/proto/api/user_service_pb.ts
index 702e2fb33..abb2c6db7 100644
--- a/web/src/types/proto/api/user_service_pb.ts
+++ b/web/src/types/proto/api/user_service_pb.ts
@@ -24,7 +24,7 @@ import type { Message } from "@bufbuild/protobuf";
* Describes the file api/user_service.proto.
*/
export const file_api_user_service: GenFile = /*@__PURE__*/
- fileDesc("ChZhcGkvdXNlcl9zZXJ2aWNlLnByb3RvEgltZW1vcy5hcGkixwMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEhUKCHVzZXJuYW1lGAIgASgJQgPgQQISGQoMZGlzcGxheV9uYW1lGAMgASgJQgPgQQ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ogIDTUFYqgIJTWVtb3MuQXBpygIJTWVtb3NcQXBp4gIVTWVtb3NcQXBpXEdQQk1ldGFkYXRh6gIKTWVtb3M6OkFwaWIGcHJvdG8z", [file_api_common, file_api_space_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_httpbody, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);
+ fileDesc("ChZhcGkvdXNlcl9zZXJ2aWNlLnByb3RvEgltZW1vcy5hcGkixwMKBFVzZXISEQoEbmFtZRgBIAEoCUID4EEIEhUKCHVzZXJuYW1lGAIgASgJQgPgQQISGQoMZGlzcGxheV9uYW1lGAMgASgJQgPgQQESEgoFZW1haWwYBCABKAlCA+BBARIXCgphdmF0YXJfdXJsGAUgASgJQgPgQQESGAoLZGVzY3JpcHRpb24YBiABKAlCA+BBARIVCghwYXNzd29yZBgHIAEoCUID4EEEEicKBHJvbGUYCCABKA4yFC5tZW1vcy5hcGkuVXNlci5Sb2xlQgPgQQISJAoFc3RhdGUYCSABKA4yEC5tZW1vcy5hcGkuU3RhdGVCA+BBAhI0CgtjcmVhdGVfdGltZRgKIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAxI0Cgt1cGRhdGVfdGltZRgLIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCA+BBAyIxCgRSb2xlEhQKEFJPTEVfVU5TUEVDSUZJRUQQABIJCgVBRE1JThACEggKBFVTRVIQAzou6kErCg5tZW1vcy5hcGkvVXNlchIMdXNlcnMve3VzZXJ9KgV1c2VyczIEdXNlciJzChBMaXN0VXNlcnNSZXF1ZXN0EhYKCXBhZ2Vfc2l6ZRgBIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YAiABKAlCA+BBARITCgZmaWx0ZXIYAyABKAlCA+BBARIZCgxzaG93X2RlbGV0ZWQYBCABKAhCA+BBASJMChFMaXN0VXNlcnNSZXNwb25zZR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UiKoLT5JMCJDoBKiIfL2FwaS97bmFtZT11c2Vycy8qfTppbXBvcnRNZW1vc0KPAQoNY29tLm1lbW9zLmFwaUIQVXNlclNlcnZpY2VQcm90b1ABWidnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGmiAgNNQViqAglNZW1vcy5BcGnKAglNZW1vc1xBcGniAhVNZW1vc1xBcGlcR1BCTWV0YWRhdGHqAgpNZW1vczo6QXBpYgZwcm90bzM", [file_api_common, file_api_space_service, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_httpbody, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_google_type_color]);
/**
* User is an account on the instance.
@@ -951,6 +951,119 @@ export type GetUserStatsRequest = Message<"memos.api.GetUserStatsRequest"> & {
export const GetUserStatsRequestSchema: GenMessage<GetUserStatsRequest> = /*@__PURE__*/
messageDesc(file_api_user_service, 17);
+/**
+ * UserUsage is a user's usage and the usage limits in effect for the user.
+ *
+ * @generated from message memos.api.UserUsage
+ */
+export type UserUsage = Message<"memos.api.UserUsage"> & {
+ /**
+ * Identifier. The resource name of the user usage singleton.
+ * Format: users/{user}/usage
+ *
+ * @generated from field: string name = 1;
+ */
+ name: string;
+
+ /**
+ * The number of memos the user created, including comments, archived
+ * memos, and memos in Spaces.
+ *
+ * @generated from field: int64 memo_count = 2;
+ */
+ memoCount: bigint;
+
+ /**
+ * The total size in bytes of the user's uploads, including uploads not
+ * attached to a memo. External links do not count.
+ *
+ * @generated from field: int64 storage_bytes = 3;
+ */
+ storageBytes: bigint;
+
+ /**
+ * The limit on memo_count.
+ *
+ * @generated from field: memos.api.UserUsage.EffectiveLimit memos_limit = 4;
+ */
+ memosLimit?: UserUsage_EffectiveLimit | undefined;
+
+ /**
+ * The limit on storage_bytes.
+ *
+ * @generated from field: memos.api.UserUsage.EffectiveLimit storage_bytes_limit = 5;
+ */
+ storageBytesLimit?: UserUsage_EffectiveLimit | undefined;
+
+ /**
+ * The limit on the size of one uploaded file. It applies only when it is
+ * lower than the instance upload limit.
+ *
+ * @generated from field: memos.api.UserUsage.EffectiveLimit upload_bytes_limit = 6;
+ */
+ uploadBytesLimit?: UserUsage_EffectiveLimit | undefined;
+};
+
+/**
+ * Describes the message memos.api.UserUsage.
+ * Use `create(UserUsageSchema)` to create a new message.
+ */
+export const UserUsageSchema: GenMessage<UserUsage> = /*@__PURE__*/
+ messageDesc(file_api_user_service, 18);
+
+/**
+ * EffectiveLimit is the limit in effect for one metric, and where it comes
+ * from.
+ *
+ * @generated from message memos.api.UserUsage.EffectiveLimit
+ */
+export type UserUsage_EffectiveLimit = Message<"memos.api.UserUsage.EffectiveLimit"> & {
+ /**
+ * The limit. 0 means unlimited, or no extra limit for upload_bytes_limit.
+ *
+ * @generated from field: int64 value = 1;
+ */
+ value: bigint;
+
+ /**
+ * The usage limit the value comes from: the user's own limit, or else the
+ * default. Empty when no usage limit applies.
+ * Format: usageLimits/{usage_limit}
+ *
+ * @generated from field: string usage_limit = 2;
+ */
+ usageLimit: string;
+};
+
+/**
+ * Describes the message memos.api.UserUsage.EffectiveLimit.
+ * Use `create(UserUsage_EffectiveLimitSchema)` to create a new message.
+ */
+export const UserUsage_EffectiveLimitSchema: GenMessage<UserUsage_EffectiveLimit> = /*@__PURE__*/
+ messageDesc(file_api_user_service, 18, 0);
+
+/**
+ * Request message for UserService.GetUserUsage.
+ *
+ * @generated from message memos.api.GetUserUsageRequest
+ */
+export type GetUserUsageRequest = Message<"memos.api.GetUserUsageRequest"> & {
+ /**
+ * Required. The resource name of the user usage.
+ * Format: users/{user}/usage
+ *
+ * @generated from field: string name = 1;
+ */
+ name: string;
+};
+
+/**
+ * Describes the message memos.api.GetUserUsageRequest.
+ * Use `create(GetUserUsageRequestSchema)` to create a new message.
+ */
+export const GetUserUsageRequestSchema: GenMessage<GetUserUsageRequest> = /*@__PURE__*/
+ messageDesc(file_api_user_service, 19);
+
/**
* MemoView is a user's saved memo filter.
*
@@ -995,7 +1108,7 @@ export type MemoView = Message<"memos.api.MemoView"> & {
* Use `create(MemoViewSchema)` to create a new message.
*/
export const MemoViewSchema: GenMessage<MemoView> = /*@__PURE__*/
- messageDesc(file_api_user_service, 18);
+ messageDesc(file_api_user_service, 20);
/**
* Icon is the display icon of a memo view.
@@ -1032,7 +1145,7 @@ export type MemoView_Icon = Message<"memos.api.MemoView.Icon"> & {
* Use `create(MemoView_IconSchema)` to create a new message.
*/
export const MemoView_IconSchema: GenMessage<MemoView_Icon> = /*@__PURE__*/
- messageDesc(file_api_user_service, 18, 0);
+ messageDesc(file_api_user_service, 20, 0);
/**
* Request message for UserService.ListMemoViews.
@@ -1054,7 +1167,7 @@ export type ListMemoViewsRequest = Message<"memos.api.ListMemoViewsRequest"> & {
* Use `create(ListMemoViewsRequestSchema)` to create a new message.
*/
export const ListMemoViewsRequestSchema: GenMessage<ListMemoViewsRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 19);
+ messageDesc(file_api_user_service, 21);
/**
* Response message for UserService.ListMemoViews.
@@ -1075,7 +1188,7 @@ export type ListMemoViewsResponse = Message<"memos.api.ListMemoViewsResponse"> &
* Use `create(ListMemoViewsResponseSchema)` to create a new message.
*/
export const ListMemoViewsResponseSchema: GenMessage<ListMemoViewsResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 20);
+ messageDesc(file_api_user_service, 22);
/**
* Request message for UserService.GetMemoView.
@@ -1097,7 +1210,7 @@ export type GetMemoViewRequest = Message<"memos.api.GetMemoViewRequest"> & {
* Use `create(GetMemoViewRequestSchema)` to create a new message.
*/
export const GetMemoViewRequestSchema: GenMessage<GetMemoViewRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 21);
+ messageDesc(file_api_user_service, 23);
/**
* Request message for UserService.CreateMemoView.
@@ -1133,7 +1246,7 @@ export type CreateMemoViewRequest = Message<"memos.api.CreateMemoViewRequest"> &
* Use `create(CreateMemoViewRequestSchema)` to create a new message.
*/
export const CreateMemoViewRequestSchema: GenMessage<CreateMemoViewRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 22);
+ messageDesc(file_api_user_service, 24);
/**
* Request message for UserService.UpdateMemoView.
@@ -1162,7 +1275,7 @@ export type UpdateMemoViewRequest = Message<"memos.api.UpdateMemoViewRequest"> &
* Use `create(UpdateMemoViewRequestSchema)` to create a new message.
*/
export const UpdateMemoViewRequestSchema: GenMessage<UpdateMemoViewRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 23);
+ messageDesc(file_api_user_service, 25);
/**
* Request message for UserService.DeleteMemoView.
@@ -1184,7 +1297,7 @@ export type DeleteMemoViewRequest = Message<"memos.api.DeleteMemoViewRequest"> &
* Use `create(DeleteMemoViewRequestSchema)` to create a new message.
*/
export const DeleteMemoViewRequestSchema: GenMessage<DeleteMemoViewRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 24);
+ messageDesc(file_api_user_service, 26);
/**
* UserNotification is a notification delivered to a user.
@@ -1273,7 +1386,7 @@ export type UserNotification = Message<"memos.api.UserNotification"> & {
* Use `create(UserNotificationSchema)` to create a new message.
*/
export const UserNotificationSchema: GenMessage<UserNotification> = /*@__PURE__*/
- messageDesc(file_api_user_service, 25);
+ messageDesc(file_api_user_service, 27);
/**
* MemoCommentPayload holds the details of a MEMO_COMMENT notification.
@@ -1317,7 +1430,7 @@ export type UserNotification_MemoCommentPayload = Message<"memos.api.UserNotific
* Use `create(UserNotification_MemoCommentPayloadSchema)` to create a new message.
*/
export const UserNotification_MemoCommentPayloadSchema: GenMessage<UserNotification_MemoCommentPayload> = /*@__PURE__*/
- messageDesc(file_api_user_service, 25, 0);
+ messageDesc(file_api_user_service, 27, 0);
/**
* MemoMentionPayload holds the details of a MEMO_MENTION notification.
@@ -1361,7 +1474,7 @@ export type UserNotification_MemoMentionPayload = Message<"memos.api.UserNotific
* Use `create(UserNotification_MemoMentionPayloadSchema)` to create a new message.
*/
export const UserNotification_MemoMentionPayloadSchema: GenMessage<UserNotification_MemoMentionPayload> = /*@__PURE__*/
- messageDesc(file_api_user_service, 25, 1);
+ messageDesc(file_api_user_service, 27, 1);
/**
* SpaceInvitationPayload holds the details of a SPACE_INVITATION
@@ -1405,7 +1518,7 @@ export type UserNotification_SpaceInvitationPayload = Message<"memos.api.UserNot
* Use `create(UserNotification_SpaceInvitationPayloadSchema)` to create a new message.
*/
export const UserNotification_SpaceInvitationPayloadSchema: GenMessage<UserNotification_SpaceInvitationPayload> = /*@__PURE__*/
- messageDesc(file_api_user_service, 25, 2);
+ messageDesc(file_api_user_service, 27, 2);
/**
* InvitationState is the receiver's progress on the invitation.
@@ -1437,7 +1550,7 @@ export enum UserNotification_SpaceInvitationPayload_InvitationState {
* Describes the enum memos.api.UserNotification.SpaceInvitationPayload.InvitationState.
*/
export const UserNotification_SpaceInvitationPayload_InvitationStateSchema: GenEnum<UserNotification_SpaceInvitationPayload_InvitationState> = /*@__PURE__*/
- enumDesc(file_api_user_service, 25, 2, 0);
+ enumDesc(file_api_user_service, 27, 2, 0);
/**
* Status is the receiver's handling state of a notification.
@@ -1469,7 +1582,7 @@ export enum UserNotification_Status {
* Describes the enum memos.api.UserNotification.Status.
*/
export const UserNotification_StatusSchema: GenEnum<UserNotification_Status> = /*@__PURE__*/
- enumDesc(file_api_user_service, 25, 0);
+ enumDesc(file_api_user_service, 27, 0);
/**
* Type is the kind of event a notification reports.
@@ -1508,7 +1621,7 @@ export enum UserNotification_Type {
* Describes the enum memos.api.UserNotification.Type.
*/
export const UserNotification_TypeSchema: GenEnum<UserNotification_Type> = /*@__PURE__*/
- enumDesc(file_api_user_service, 25, 1);
+ enumDesc(file_api_user_service, 27, 1);
/**
* Request message for UserService.ListUserNotifications.
@@ -1554,7 +1667,7 @@ export type ListUserNotificationsRequest = Message<"memos.api.ListUserNotificati
* Use `create(ListUserNotificationsRequestSchema)` to create a new message.
*/
export const ListUserNotificationsRequestSchema: GenMessage<ListUserNotificationsRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 26);
+ messageDesc(file_api_user_service, 28);
/**
* Response message for UserService.ListUserNotifications.
@@ -1582,7 +1695,7 @@ export type ListUserNotificationsResponse = Message<"memos.api.ListUserNotificat
* Use `create(ListUserNotificationsResponseSchema)` to create a new message.
*/
export const ListUserNotificationsResponseSchema: GenMessage<ListUserNotificationsResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 27);
+ messageDesc(file_api_user_service, 29);
/**
* Request message for UserService.UpdateUserNotification.
@@ -1611,7 +1724,7 @@ export type UpdateUserNotificationRequest = Message<"memos.api.UpdateUserNotific
* Use `create(UpdateUserNotificationRequestSchema)` to create a new message.
*/
export const UpdateUserNotificationRequestSchema: GenMessage<UpdateUserNotificationRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 28);
+ messageDesc(file_api_user_service, 30);
/**
* Request message for UserService.DeleteUserNotification.
@@ -1633,7 +1746,7 @@ export type DeleteUserNotificationRequest = Message<"memos.api.DeleteUserNotific
* Use `create(DeleteUserNotificationRequestSchema)` to create a new message.
*/
export const DeleteUserNotificationRequestSchema: GenMessage<DeleteUserNotificationRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 29);
+ messageDesc(file_api_user_service, 31);
/**
* UserWebhook is a webhook owned by a user.
@@ -1698,7 +1811,7 @@ export type UserWebhook = Message<"memos.api.UserWebhook"> & {
* Use `create(UserWebhookSchema)` to create a new message.
*/
export const UserWebhookSchema: GenMessage<UserWebhook> = /*@__PURE__*/
- messageDesc(file_api_user_service, 30);
+ messageDesc(file_api_user_service, 32);
/**
* Request message for UserService.ListUserWebhooks.
@@ -1720,7 +1833,7 @@ export type ListUserWebhooksRequest = Message<"memos.api.ListUserWebhooksRequest
* Use `create(ListUserWebhooksRequestSchema)` to create a new message.
*/
export const ListUserWebhooksRequestSchema: GenMessage<ListUserWebhooksRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 31);
+ messageDesc(file_api_user_service, 33);
/**
* Response message for UserService.ListUserWebhooks.
@@ -1741,7 +1854,7 @@ export type ListUserWebhooksResponse = Message<"memos.api.ListUserWebhooksRespon
* Use `create(ListUserWebhooksResponseSchema)` to create a new message.
*/
export const ListUserWebhooksResponseSchema: GenMessage<ListUserWebhooksResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 32);
+ messageDesc(file_api_user_service, 34);
/**
* Request message for UserService.CreateUserWebhook.
@@ -1770,7 +1883,7 @@ export type CreateUserWebhookRequest = Message<"memos.api.CreateUserWebhookReque
* Use `create(CreateUserWebhookRequestSchema)` to create a new message.
*/
export const CreateUserWebhookRequestSchema: GenMessage<CreateUserWebhookRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 33);
+ messageDesc(file_api_user_service, 35);
/**
* Request message for UserService.UpdateUserWebhook.
@@ -1800,7 +1913,7 @@ export type UpdateUserWebhookRequest = Message<"memos.api.UpdateUserWebhookReque
* Use `create(UpdateUserWebhookRequestSchema)` to create a new message.
*/
export const UpdateUserWebhookRequestSchema: GenMessage<UpdateUserWebhookRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 34);
+ messageDesc(file_api_user_service, 36);
/**
* Request message for UserService.DeleteUserWebhook.
@@ -1822,7 +1935,7 @@ export type DeleteUserWebhookRequest = Message<"memos.api.DeleteUserWebhookReque
* Use `create(DeleteUserWebhookRequestSchema)` to create a new message.
*/
export const DeleteUserWebhookRequestSchema: GenMessage<DeleteUserWebhookRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 35);
+ messageDesc(file_api_user_service, 37);
/**
* Request message for UserService.GetUserWebhookSigningSecret.
@@ -1844,7 +1957,7 @@ export type GetUserWebhookSigningSecretRequest = Message<"memos.api.GetUserWebho
* Use `create(GetUserWebhookSigningSecretRequestSchema)` to create a new message.
*/
export const GetUserWebhookSigningSecretRequestSchema: GenMessage<GetUserWebhookSigningSecretRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 36);
+ messageDesc(file_api_user_service, 38);
/**
* Response message for UserService.GetUserWebhookSigningSecret.
@@ -1865,7 +1978,7 @@ export type GetUserWebhookSigningSecretResponse = Message<"memos.api.GetUserWebh
* Use `create(GetUserWebhookSigningSecretResponseSchema)` to create a new message.
*/
export const GetUserWebhookSigningSecretResponseSchema: GenMessage<GetUserWebhookSigningSecretResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 37);
+ messageDesc(file_api_user_service, 39);
/**
* LinkedIdentity is an SSO identity linked to a user account.
@@ -1903,7 +2016,7 @@ export type LinkedIdentity = Message<"memos.api.LinkedIdentity"> & {
* Use `create(LinkedIdentitySchema)` to create a new message.
*/
export const LinkedIdentitySchema: GenMessage<LinkedIdentity> = /*@__PURE__*/
- messageDesc(file_api_user_service, 38);
+ messageDesc(file_api_user_service, 40);
/**
* Request message for UserService.ListLinkedIdentities.
@@ -1925,7 +2038,7 @@ export type ListLinkedIdentitiesRequest = Message<"memos.api.ListLinkedIdentitie
* Use `create(ListLinkedIdentitiesRequestSchema)` to create a new message.
*/
export const ListLinkedIdentitiesRequestSchema: GenMessage<ListLinkedIdentitiesRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 39);
+ messageDesc(file_api_user_service, 41);
/**
* Response message for UserService.ListLinkedIdentities.
@@ -1946,7 +2059,7 @@ export type ListLinkedIdentitiesResponse = Message<"memos.api.ListLinkedIdentiti
* Use `create(ListLinkedIdentitiesResponseSchema)` to create a new message.
*/
export const ListLinkedIdentitiesResponseSchema: GenMessage<ListLinkedIdentitiesResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 40);
+ messageDesc(file_api_user_service, 42);
/**
* Request message for UserService.GetLinkedIdentity.
@@ -1968,7 +2081,7 @@ export type GetLinkedIdentityRequest = Message<"memos.api.GetLinkedIdentityReque
* Use `create(GetLinkedIdentityRequestSchema)` to create a new message.
*/
export const GetLinkedIdentityRequestSchema: GenMessage<GetLinkedIdentityRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 41);
+ messageDesc(file_api_user_service, 43);
/**
* Request message for UserService.CreateLinkedIdentity.
@@ -2019,7 +2132,7 @@ export type CreateLinkedIdentityRequest = Message<"memos.api.CreateLinkedIdentit
* Use `create(CreateLinkedIdentityRequestSchema)` to create a new message.
*/
export const CreateLinkedIdentityRequestSchema: GenMessage<CreateLinkedIdentityRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 42);
+ messageDesc(file_api_user_service, 44);
/**
* Request message for UserService.DeleteLinkedIdentity.
@@ -2041,7 +2154,7 @@ export type DeleteLinkedIdentityRequest = Message<"memos.api.DeleteLinkedIdentit
* Use `create(DeleteLinkedIdentityRequestSchema)` to create a new message.
*/
export const DeleteLinkedIdentityRequestSchema: GenMessage<DeleteLinkedIdentityRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 43);
+ messageDesc(file_api_user_service, 45);
/**
* PersonalAccessToken is a long-lived token for API and script access.
@@ -2093,7 +2206,7 @@ export type PersonalAccessToken = Message<"memos.api.PersonalAccessToken"> & {
* Use `create(PersonalAccessTokenSchema)` to create a new message.
*/
export const PersonalAccessTokenSchema: GenMessage<PersonalAccessToken> = /*@__PURE__*/
- messageDesc(file_api_user_service, 44);
+ messageDesc(file_api_user_service, 46);
/**
* Request message for UserService.ListPersonalAccessTokens.
@@ -2131,7 +2244,7 @@ export type ListPersonalAccessTokensRequest = Message<"memos.api.ListPersonalAcc
* Use `create(ListPersonalAccessTokensRequestSchema)` to create a new message.
*/
export const ListPersonalAccessTokensRequestSchema: GenMessage<ListPersonalAccessTokensRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 45);
+ messageDesc(file_api_user_service, 47);
/**
* Response message for UserService.ListPersonalAccessTokens.
@@ -2159,7 +2272,7 @@ export type ListPersonalAccessTokensResponse = Message<"memos.api.ListPersonalAc
* Use `create(ListPersonalAccessTokensResponseSchema)` to create a new message.
*/
export const ListPersonalAccessTokensResponseSchema: GenMessage<ListPersonalAccessTokensResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 46);
+ messageDesc(file_api_user_service, 48);
/**
* Request message for UserService.CreatePersonalAccessToken.
@@ -2196,7 +2309,7 @@ export type CreatePersonalAccessTokenRequest = Message<"memos.api.CreatePersonal
* Use `create(CreatePersonalAccessTokenRequestSchema)` to create a new message.
*/
export const CreatePersonalAccessTokenRequestSchema: GenMessage<CreatePersonalAccessTokenRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 47);
+ messageDesc(file_api_user_service, 49);
/**
* Response message for UserService.CreatePersonalAccessToken.
@@ -2224,7 +2337,7 @@ export type CreatePersonalAccessTokenResponse = Message<"memos.api.CreatePersona
* Use `create(CreatePersonalAccessTokenResponseSchema)` to create a new message.
*/
export const CreatePersonalAccessTokenResponseSchema: GenMessage<CreatePersonalAccessTokenResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 48);
+ messageDesc(file_api_user_service, 50);
/**
* Request message for UserService.DeletePersonalAccessToken.
@@ -2246,7 +2359,7 @@ export type DeletePersonalAccessTokenRequest = Message<"memos.api.DeletePersonal
* Use `create(DeletePersonalAccessTokenRequestSchema)` to create a new message.
*/
export const DeletePersonalAccessTokenRequestSchema: GenMessage<DeletePersonalAccessTokenRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 49);
+ messageDesc(file_api_user_service, 51);
/**
* Request message for UserService.ExportMemos.
@@ -2268,7 +2381,7 @@ export type ExportMemosRequest = Message<"memos.api.ExportMemosRequest"> & {
* Use `create(ExportMemosRequestSchema)` to create a new message.
*/
export const ExportMemosRequestSchema: GenMessage<ExportMemosRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 50);
+ messageDesc(file_api_user_service, 52);
/**
* Request message for UserService.ImportMemos.
@@ -2357,7 +2470,7 @@ export type ImportMemosRequest = Message<"memos.api.ImportMemosRequest"> & {
* Use `create(ImportMemosRequestSchema)` to create a new message.
*/
export const ImportMemosRequestSchema: GenMessage<ImportMemosRequest> = /*@__PURE__*/
- messageDesc(file_api_user_service, 51);
+ messageDesc(file_api_user_service, 53);
/**
* ConflictPolicy says what the importer does with a memo whose UID the user
@@ -2397,7 +2510,7 @@ export enum ImportMemosRequest_ConflictPolicy {
* Describes the enum memos.api.ImportMemosRequest.ConflictPolicy.
*/
export const ImportMemosRequest_ConflictPolicySchema: GenEnum<ImportMemosRequest_ConflictPolicy> = /*@__PURE__*/
- enumDesc(file_api_user_service, 51, 0);
+ enumDesc(file_api_user_service, 53, 0);
/**
* Response message for UserService.ImportMemos.
@@ -2455,7 +2568,7 @@ export type ImportMemosResponse = Message<"memos.api.ImportMemosResponse"> & {
* Use `create(ImportMemosResponseSchema)` to create a new message.
*/
export const ImportMemosResponseSchema: GenMessage<ImportMemosResponse> = /*@__PURE__*/
- messageDesc(file_api_user_service, 52);
+ messageDesc(file_api_user_service, 54);
/**
* ImportMemosSpec describes a new memo import upload.
@@ -2476,7 +2589,7 @@ export type ImportMemosSpec = Message<"memos.api.ImportMemosSpec"> & {
* Use `create(ImportMemosSpecSchema)` to create a new message.
*/
export const ImportMemosSpecSchema: GenMessage<ImportMemosSpec> = /*@__PURE__*/
- messageDesc(file_api_user_service, 53);
+ messageDesc(file_api_user_service, 55);
/**
* ImportMemosPlan describes what importing a staged archive would do.
@@ -2553,7 +2666,7 @@ export type ImportMemosPlan = Message<"memos.api.ImportMemosPlan"> & {
* Use `create(ImportMemosPlanSchema)` to create a new message.
*/
export const ImportMemosPlanSchema: GenMessage<ImportMemosPlan> = /*@__PURE__*/
- messageDesc(file_api_user_service, 54);
+ messageDesc(file_api_user_service, 56);
/**
* ImportMemosReport is the outcome of an import.
@@ -2609,7 +2722,7 @@ export type ImportMemosReport = Message<"memos.api.ImportMemosReport"> & {
* Use `create(ImportMemosReportSchema)` to create a new message.
*/
export const ImportMemosReportSchema: GenMessage<ImportMemosReport> = /*@__PURE__*/
- messageDesc(file_api_user_service, 55);
+ messageDesc(file_api_user_service, 57);
/**
* ImportMemosIssue is one warning or failure of an import, tied to the memo
@@ -2638,7 +2751,7 @@ export type ImportMemosIssue = Message<"memos.api.ImportMemosIssue"> & {
* Use `create(ImportMemosIssueSchema)` to create a new message.
*/
export const ImportMemosIssueSchema: GenMessage<ImportMemosIssue> = /*@__PURE__*/
- messageDesc(file_api_user_service, 56);
+ messageDesc(file_api_user_service, 58);
/**
* UserService manages users and the resources they own: settings, statistics,
@@ -2769,6 +2882,17 @@ export const UserService: GenService<{
input: typeof GetUserStatsRequestSchema;
output: typeof UserStatsSchema;
},
+ /**
+ * GetUserUsage returns a user's usage and the usage limits in effect for the
+ * user. Only the user or an admin may call it.
+ *
+ * @generated from rpc memos.api.UserService.GetUserUsage
+ */
+ getUserUsage: {
+ methodKind: "unary";
+ input: typeof GetUserUsageRequestSchema;
+ output: typeof UserUsageSchema;
+ },
/**
* ListMemoViews lists a user's memo views. Each view is a named, reusable
* CEL filter (see MemoView.filter); pass its filter string directly to the
diff --git a/web/tests/memo-editor-upload-retry.test.tsx b/web/tests/memo-editor-upload-retry.test.tsx
new file mode 100644
index 000000000..9e75c3612
--- /dev/null
+++ b/web/tests/memo-editor-upload-retry.test.tsx
@@ -0,0 +1,129 @@
+import { create } from "@bufbuild/protobuf";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { act, renderHook } from "@testing-library/react";
+import type { PropsWithChildren } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { useMemoSave } from "@/components/MemoEditor/hooks/useMemoSave";
+import { memoService } from "@/components/MemoEditor/services/memoService";
+import type { EditorState } from "@/components/MemoEditor/state";
+import { createInitialState } from "@/components/MemoEditor/state/types";
+import type { LocalFile } from "@/components/MemoEditor/types/attachment";
+import { type Attachment, AttachmentSchema } from "@/types/proto/api/attachment_service_pb";
+
+const mocks = vi.hoisted(() => ({
+ createMemo: vi.fn(),
+ uploadAttachment: vi.fn(),
+ save: vi.fn(),
+ state: undefined as unknown as EditorState,
+}));
+
+vi.mock("@/connect", () => ({
+ memoServiceClient: { createMemo: mocks.createMemo },
+ attachmentServiceClient: { uploadAttachment: mocks.uploadAttachment },
+}));
+
+vi.mock("react-hot-toast", () => ({ toast: { error: vi.fn(), success: vi.fn() } }));
+vi.mock("@/contexts/NewMemoContext", () => ({ useNewMemo: () => ({ markNewMemo: vi.fn() }) }));
+vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));
+
+// The hook test drives a small stand-in for the editor reducer, so that what
+// the hook dispatches after a failure is what the next save reads.
+vi.mock("@/components/MemoEditor/state", () => ({
+ useEditorContext: () => ({
+ actions: {
+ reset: () => ({ type: "reset" }),
+ setLoading: () => ({ type: "noop" }),
+ setJustSaved: () => ({ type: "noop" }),
+ setMetadata: (metadata: Partial<EditorState["metadata"]>) => ({ type: "set-metadata", metadata }),
+ setLocalFiles: (localFiles: LocalFile[]) => ({ type: "set-local-files", localFiles }),
+ setTimestamps: () => ({ type: "noop" }),
+ },
+ dispatch: (action: { type: string; metadata?: Partial<EditorState["metadata"]>; localFiles?: LocalFile[] }) => {
+ if (action.type === "set-metadata") mocks.state = { ...mocks.state, metadata: { ...mocks.state.metadata, ...action.metadata } };
+ if (action.type === "set-local-files") mocks.state = { ...mocks.state, localFiles: action.localFiles ?? [] };
+ },
+ getState: () => mocks.state,
+ }),
+}));
+
+const localFile = (name: string): LocalFile => ({ file: new File(["data"], name, { type: "text/plain" }), previewUrl: `blob:${name}` });
+
+const editorState = (localFiles: LocalFile[], attachments: Attachment[] = []): EditorState => {
+ const state = createInitialState();
+ return { ...state, content: "hello", localFiles, metadata: { ...state.metadata, attachments } };
+};
+
+const uploadedAttachment = (name: string) => create(AttachmentSchema, { name: `attachments/${name}`, filename: name });
+
+describe("memoService.save", () => {
+ beforeEach(() => {
+ mocks.createMemo.mockReset();
+ mocks.uploadAttachment.mockReset();
+ mocks.uploadAttachment.mockImplementation(async (request: { upload: { case: string }; finishWrite?: boolean }) =>
+ request.upload.case === "spec"
+ ? { uploadId: "u1", committedSize: 0n, maxChunkSize: 1024 }
+ : { committedSize: 4n, attachment: uploadedAttachment("a.txt") },
+ );
+ });
+
+ it("reports each upload before the memo create can fail", async () => {
+ mocks.createMemo.mockRejectedValue(new Error("quota exceeded"));
+ const file = localFile("a.txt");
+ const onFileUploaded = vi.fn();
+
+ await expect(memoService.save(editorState([file]), { onFileUploaded })).rejects.toThrow("quota exceeded");
+
+ expect(onFileUploaded).toHaveBeenCalledOnce();
+ expect(onFileUploaded).toHaveBeenCalledWith(file, expect.objectContaining({ name: "attachments/a.txt" }));
+ });
+});
+
+describe("useMemoSave after a failed save", () => {
+ beforeEach(() => {
+ mocks.save.mockReset();
+ vi.spyOn(memoService, "save").mockImplementation(mocks.save);
+ });
+
+ it("keeps uploaded files on the draft so a retry does not upload them again", async () => {
+ const uploaded = localFile("a.txt");
+ const pending = localFile("b.txt");
+ const attachment = uploadedAttachment("a.txt");
+ mocks.state = editorState([uploaded, pending]);
+ // The first save uploads one file, then the memo create is refused.
+ mocks.save.mockImplementationOnce(async (_state, options) => {
+ options.onFileUploaded(uploaded, attachment);
+ throw new Error("quota exceeded");
+ });
+ mocks.save.mockResolvedValueOnce({ hasChanges: true, memoName: "memos/new" });
+
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ const wrapper = ({ children }: PropsWithChildren) => <QueryClientProvider client={client}>{children}</QueryClientProvider>;
+ const { result } = renderHook(() => useMemoSave({ discardDraft: vi.fn() }), { wrapper });
+
+ await act(async () => result.current());
+
+ expect(mocks.state.metadata.attachments).toEqual([attachment]);
+ expect(mocks.state.localFiles).toEqual([pending]);
+
+ await act(async () => result.current());
+
+ const retried = mocks.save.mock.calls[1][0] as EditorState;
+ expect(retried.localFiles).toEqual([pending]);
+ expect(retried.metadata.attachments).toEqual([attachment]);
+ });
+
+ it("leaves the draft alone when nothing uploaded", async () => {
+ const file = localFile("a.txt");
+ mocks.state = editorState([file]);
+ mocks.save.mockRejectedValueOnce(new Error("offline"));
+
+ const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+ const wrapper = ({ children }: PropsWithChildren) => <QueryClientProvider client={client}>{children}</QueryClientProvider>;
+ const { result } = renderHook(() => useMemoSave({ discardDraft: vi.fn() }), { wrapper });
+
+ await act(async () => result.current());
+
+ expect(mocks.state.localFiles).toEqual([file]);
+ expect(mocks.state.metadata.attachments).toEqual([]);
+ });
+});
diff --git a/web/tests/usage-limit-errors.test.ts b/web/tests/usage-limit-errors.test.ts
new file mode 100644
index 000000000..4518c7bf1
--- /dev/null
+++ b/web/tests/usage-limit-errors.test.ts
@@ -0,0 +1,53 @@
+import { BinaryWriter } from "@bufbuild/protobuf/wire";
+import { Code, ConnectError } from "@connectrpc/connect";
+import { describe, expect, it } from "vitest";
+import { errorService } from "@/components/MemoEditor/services/errorService";
+import { ERROR_REASON_FILE_TOO_LARGE, ERROR_REASON_QUOTA_EXCEEDED, getErrorMessage, getRetryAfterSeconds } from "@/lib/error";
+
+function quotaError(metadata: Record<string, string>, reason = ERROR_REASON_QUOTA_EXCEEDED): ConnectError {
+ const writer = new BinaryWriter();
+ writer.tag(1, 2).string(reason);
+ writer.tag(2, 2).string("memos.api");
+ for (const [key, value] of Object.entries(metadata)) {
+ const entry = new BinaryWriter();
+ entry.tag(1, 2).string(key);
+ entry.tag(2, 2).string(value);
+ writer.tag(3, 2).bytes(entry.finish());
+ }
+ const error = new ConnectError("quota exceeded", Code.ResourceExhausted);
+ error.details.push({ type: "google.rpc.ErrorInfo", value: writer.finish() });
+ return error;
+}
+
+describe("usage limit refusals", () => {
+ it("names the memo limit", () => {
+ const error = quotaError({ metric: "MEMOS", limit: "1000", usage: "1000", usage_limit: "usageLimits/default-memos" });
+ expect(getErrorMessage(error)).toBe("You have reached your limit of 1000 memos. Delete memos to create new ones.");
+ });
+
+ it("names the storage limit and the current usage", () => {
+ const error = quotaError({ metric: "STORAGE_BYTES", limit: String(1024 ** 3), usage: String(1000 * 1024 ** 2) });
+ expect(getErrorMessage(error)).toBe("This upload would exceed your storage limit of 1.0 GB. You are using 1000.0 MB.");
+ });
+
+ it("names the per-file limit", () => {
+ const error = quotaError({ metric: "UPLOAD_BYTES", limit: String(10 * 1024 ** 2), usage: String(20 * 1024 ** 2) });
+ expect(getErrorMessage(error)).toBe("This file is larger than your limit of 10.0 MB per file.");
+ });
+
+ it("is not a rate limit, so it carries no wait", () => {
+ const error = quotaError({ metric: "MEMOS", limit: "1", usage: "1" });
+ expect(getRetryAfterSeconds(error)).toBeUndefined();
+ });
+
+ it("names the instance upload limit", () => {
+ const error = quotaError({ limit: String(32 * 1024 ** 2), size: String(40 * 1024 ** 2) }, ERROR_REASON_FILE_TOO_LARGE);
+ expect(getErrorMessage(error)).toBe("This file is larger than the upload limit of 32.0 MB.");
+ expect(errorService.getErrorMessage(error)).toBe("This file is larger than the upload limit of 32.0 MB.");
+ });
+
+ it("reaches the editor's own error messages", () => {
+ const error = quotaError({ metric: "UPLOAD_BYTES", limit: String(1024 ** 2), usage: String(2 * 1024 ** 2) });
+ expect(errorService.getErrorMessage(error)).toBe("This file is larger than your limit of 1.0 MB per file.");
+ });
+});
diff --git a/web/tests/usage-limits-settings.test.tsx b/web/tests/usage-limits-settings.test.tsx
new file mode 100644
index 000000000..49f401db9
--- /dev/null
+++ b/web/tests/usage-limits-settings.test.tsx
@@ -0,0 +1,255 @@
+import { create } from "@bufbuild/protobuf";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import type { PropsWithChildren } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import UsageLimitDialog from "@/components/Settings/UsageLimitDialog";
+import UsageLimitsSection from "@/components/Settings/UsageLimitsSection";
+import UsageSection from "@/components/Settings/UsageSection";
+import { UsageLimit_Metric, UsageLimitSchema } from "@/types/proto/api/instance_service_pb";
+import { UserSchema, UserUsage_EffectiveLimitSchema, UserUsageSchema } from "@/types/proto/api/user_service_pb";
+import english from "../src/locales/en.json";
+
+const MIB = 1024n * 1024n;
+
+const mocks = vi.hoisted(() => ({
+ getUserUsage: vi.fn(),
+ listUsers: vi.fn(),
+ listUsageLimits: vi.fn(),
+ createUsageLimit: vi.fn(),
+ updateUsageLimit: vi.fn(),
+ deleteUsageLimit: vi.fn(),
+ getInstanceSetting: vi.fn(),
+}));
+
+vi.mock("@/connect", () => ({
+ userServiceClient: { getUserUsage: mocks.getUserUsage, listUsers: mocks.listUsers },
+ instanceServiceClient: {
+ listUsageLimits: mocks.listUsageLimits,
+ createUsageLimit: mocks.createUsageLimit,
+ updateUsageLimit: mocks.updateUsageLimit,
+ deleteUsageLimit: mocks.deleteUsageLimit,
+ getInstanceSetting: mocks.getInstanceSetting,
+ },
+}));
+vi.mock("@/hooks/useCurrentUser", () => ({ default: () => ({ name: "users/alice" }) }));
+vi.mock("react-hot-toast", () => ({ toast: { error: vi.fn(), success: vi.fn() } }));
+// Render the English copy, so the assertions read like the screen.
+vi.mock("@/utils/i18n", () => ({
+ useTranslate: () => (key: string, params?: Record<string, unknown>) => {
+ const text = key.split(".").reduce<unknown>((node, part) => (node as Record<string, unknown>)?.[part], english);
+ return typeof text === "string" ? text.replace(/\{\{(\w+)\}\}/g, (_, name) => String(params?.[name])) : key;
+ },
+}));
+
+const wrapper = ({ children }: PropsWithChildren) => (
+ <QueryClientProvider client={new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } })}>
+ {children}
+ </QueryClientProvider>
+);
+
+const limit = (id: string, metric: UsageLimit_Metric, value: bigint, user = "") =>
+ create(UsageLimitSchema, { name: `usageLimits/${id}`, metric, value, user });
+
+const alice = create(UserSchema, { name: "users/alice", username: "alice", displayName: "Alice" });
+const bob = create(UserSchema, { name: "users/bob", username: "bob" });
+const carol = create(UserSchema, { name: "users/carol", username: "carol" });
+
+const effective = (value: bigint, usageLimit = "") => create(UserUsage_EffectiveLimitSchema, { value, usageLimit });
+
+beforeEach(() => {
+ for (const mock of Object.values(mocks)) mock.mockReset();
+ mocks.getInstanceSetting.mockResolvedValue({ value: { case: "storageSetting", value: { uploadSizeLimitMb: 30n } } });
+ mocks.createUsageLimit.mockResolvedValue({});
+ mocks.updateUsageLimit.mockResolvedValue({});
+ mocks.deleteUsageLimit.mockResolvedValue({});
+ mocks.listUsers.mockResolvedValue({ users: [alice, bob, carol], nextPageToken: "" });
+});
+
+describe("UsageSection", () => {
+ it("is hidden when no limit applies", async () => {
+ mocks.getUserUsage.mockResolvedValue(
+ create(UserUsageSchema, {
+ memoCount: 5n,
+ memosLimit: effective(0n),
+ storageBytesLimit: effective(0n),
+ uploadBytesLimit: effective(0n),
+ }),
+ );
+ const { container } = render(<UsageSection />, { wrapper });
+ await waitFor(() => expect(mocks.getUserUsage).toHaveBeenCalledWith({ name: "users/alice/usage" }));
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it("shows usage against the limits in effect", async () => {
+ mocks.getUserUsage.mockResolvedValue(
+ create(UserUsageSchema, {
+ memoCount: 12n,
+ storageBytes: 512n * MIB,
+ memosLimit: effective(1000n, "usageLimits/default-memos"),
+ storageBytesLimit: effective(1024n * MIB, "usageLimits/alice-storage"),
+ uploadBytesLimit: effective(0n),
+ }),
+ );
+ render(<UsageSection />, { wrapper });
+ expect(await screen.findByText("Usage limits")).toBeInTheDocument();
+ expect(screen.getByText("12 of 1,000")).toBeInTheDocument();
+ expect(screen.getByText("512.0 MB of 1.0 GB")).toBeInTheDocument();
+ expect(screen.queryByText("Largest file")).not.toBeInTheDocument();
+ });
+});
+
+// Closed select popups can stay mounted, so pick the option from the list the trigger controls.
+const chooseOption = async (select: string, option: string) => {
+ const trigger = screen.getByRole("combobox", { name: select });
+ fireEvent.click(trigger);
+ const list = await waitFor(() => {
+ const element = document.getElementById(trigger.getAttribute("aria-controls") ?? "");
+ expect(element).not.toBeNull();
+ return element as HTMLElement;
+ });
+ const item = within(list).getByRole("option", { name: option });
+ fireEvent.pointerDown(item, { pointerType: "mouse" });
+ fireEvent.click(item, { pointerType: "mouse" });
+};
+
+const openRowMenu = async (name: string, item: string) => {
+ fireEvent.click(await screen.findByRole("button", { name: `Actions for ${name}` }));
+ fireEvent.click(await screen.findByRole("menuitem", { name: item }));
+};
+
+describe("UsageLimitsSection", () => {
+ it("shows one table: all users first, then users with their own limits", async () => {
+ mocks.listUsageLimits.mockResolvedValue({
+ usageLimits: [
+ limit("default-memos", UsageLimit_Metric.MEMOS, 100n),
+ limit("bob-memos", UsageLimit_Metric.MEMOS, 0n, "users/bob"),
+ limit("bob-storage", UsageLimit_Metric.STORAGE_BYTES, 5n * 1024n * MIB, "users/bob"),
+ ],
+ nextPageToken: "",
+ });
+ render(<UsageLimitsSection />, { wrapper });
+
+ const bobCell = await screen.findByText("@bob");
+ const rows = screen.getAllByRole("row").slice(1);
+ const text = (row: HTMLElement) =>
+ within(row)
+ .getAllByRole("cell")
+ .map((cell) => cell.textContent);
+ expect(rows).toHaveLength(2);
+ expect(text(rows[0])).toEqual(["All usersEveryone, admins included", "100", "Unlimited", "Unlimited", ""]);
+ expect(text(rows[1])).toEqual(["bob@bob", "Unlimited", "5.0 GB", "Unlimited", ""]);
+ expect(bobCell.closest("tr")).toBe(rows[1]);
+ // Users without their own limits get no row.
+ expect(screen.queryByText("Alice")).not.toBeInTheDocument();
+ });
+
+ it("removes all of a user's own limits", async () => {
+ mocks.listUsageLimits.mockResolvedValue({
+ usageLimits: [
+ limit("bob-memos", UsageLimit_Metric.MEMOS, 0n, "users/bob"),
+ limit("bob-storage", UsageLimit_Metric.STORAGE_BYTES, 5n * 1024n * MIB, "users/bob"),
+ ],
+ nextPageToken: "",
+ });
+ render(<UsageLimitsSection />, { wrapper });
+ await screen.findByText("@bob");
+
+ await openRowMenu("bob", "Remove");
+ expect(await screen.findByText("Remove the limits for bob?")).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Remove" }));
+
+ await waitFor(() => expect(mocks.deleteUsageLimit).toHaveBeenCalledTimes(2));
+ expect(mocks.deleteUsageLimit).toHaveBeenCalledWith({ name: "usageLimits/bob-memos" });
+ expect(mocks.deleteUsageLimit).toHaveBeenCalledWith({ name: "usageLimits/bob-storage" });
+ });
+});
+
+describe("UsageLimitDialog", () => {
+ it("creates, updates and removes the limits for all users", async () => {
+ mocks.listUsageLimits.mockResolvedValue({
+ usageLimits: [
+ limit("default-memos", UsageLimit_Metric.MEMOS, 100n),
+ limit("default-storage", UsageLimit_Metric.STORAGE_BYTES, 1024n * MIB),
+ ],
+ nextPageToken: "",
+ });
+ render(<UsageLimitDialog open onOpenChange={vi.fn()} target={{ kind: "all" }} candidates={[]} uploadLimitMiB={32} />, { wrapper });
+
+ expect(await screen.findByText("Limits for all users")).toBeInTheDocument();
+ const memos = screen.getByRole("textbox", { name: "Memos" });
+ await waitFor(() => expect(memos).toHaveValue("100"));
+ expect(screen.getByRole("textbox", { name: "Storage (MiB)" })).toHaveValue("1024");
+ expect(screen.getByRole("textbox", { name: "Largest file (MiB)" })).toHaveAttribute("placeholder", "Unlimited");
+
+ fireEvent.change(memos, { target: { value: "200" } });
+ fireEvent.change(screen.getByRole("textbox", { name: "Storage (MiB)" }), { target: { value: "" } });
+ fireEvent.change(screen.getByRole("textbox", { name: "Largest file (MiB)" }), { target: { value: "10" } });
+ fireEvent.click(screen.getByRole("button", { name: "Save" }));
+
+ await waitFor(() => expect(mocks.createUsageLimit).toHaveBeenCalled());
+ expect(mocks.updateUsageLimit).toHaveBeenCalledWith(
+ expect.objectContaining({ usageLimit: expect.objectContaining({ name: "usageLimits/default-memos", value: 200n }) }),
+ );
+ expect(mocks.deleteUsageLimit).toHaveBeenCalledWith({ name: "usageLimits/default-storage" });
+ expect(mocks.createUsageLimit).toHaveBeenCalledWith({
+ usageLimit: expect.objectContaining({ metric: UsageLimit_Metric.UPLOAD_BYTES, user: "", value: 10n * MIB }),
+ });
+ });
+
+ it("edits a user's own limits, with the all-users limits as placeholders", async () => {
+ mocks.listUsageLimits.mockResolvedValue({
+ usageLimits: [
+ limit("default-memos", UsageLimit_Metric.MEMOS, 100n),
+ limit("bob-storage", UsageLimit_Metric.STORAGE_BYTES, 5n * 1024n * MIB, "users/bob"),
+ limit("bob-file-size", UsageLimit_Metric.UPLOAD_BYTES, 0n, "users/bob"),
+ ],
+ nextPageToken: "",
+ });
+ render(<UsageLimitDialog open onOpenChange={vi.fn()} target={{ kind: "user", user: bob }} candidates={[]} uploadLimitMiB={32} />, {
+ wrapper,
+ });
+
+ expect(await screen.findByText("Limits for bob")).toBeInTheDocument();
+ const memos = screen.getByRole("textbox", { name: "Memos" });
+ const storage = screen.getByRole("textbox", { name: "Storage (MiB)" });
+ await waitFor(() => expect(storage).toHaveValue("5120"));
+ expect(memos).toHaveValue("");
+ expect(memos).toHaveAttribute("placeholder", "All users: 100");
+ // No limit for bob shows as 0, because empty means the all-users limit.
+ expect(screen.getByRole("textbox", { name: "Largest file (MiB)" })).toHaveValue("0");
+
+ fireEvent.change(storage, { target: { value: "" } });
+ fireEvent.change(memos, { target: { value: "50" } });
+ fireEvent.click(screen.getByRole("button", { name: "Save" }));
+
+ await waitFor(() => expect(mocks.deleteUsageLimit).toHaveBeenCalledWith({ name: "usageLimits/bob-storage" }));
+ expect(mocks.createUsageLimit).toHaveBeenCalledWith({
+ usageLimit: expect.objectContaining({ metric: UsageLimit_Metric.MEMOS, user: "users/bob", value: 50n }),
+ });
+ expect(mocks.updateUsageLimit).not.toHaveBeenCalled();
+ });
+
+ it("adds limits for a picked user", async () => {
+ mocks.listUsageLimits.mockResolvedValue({ usageLimits: [], nextPageToken: "" });
+ render(<UsageLimitDialog open onOpenChange={vi.fn()} target={{ kind: "add" }} candidates={[carol]} uploadLimitMiB={32} />, { wrapper });
+
+ expect(await screen.findByRole("heading", { name: "Add user limit" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Save" })).toBeDisabled();
+
+ await chooseOption("User", "@carol");
+ const fileSize = screen.getByRole("textbox", { name: "Largest file (MiB)" });
+ await waitFor(() => expect(fileSize).toBeEnabled());
+ fireEvent.change(fileSize, { target: { value: "32" } });
+ expect(await screen.findByText("Not below the instance upload limit of 32 MiB, so it has no effect.")).toBeInTheDocument();
+ fireEvent.change(fileSize, { target: { value: "10" } });
+ fireEvent.click(screen.getByRole("button", { name: "Save" }));
+
+ await waitFor(() =>
+ expect(mocks.createUsageLimit).toHaveBeenCalledWith({
+ usageLimit: expect.objectContaining({ metric: UsageLimit_Metric.UPLOAD_BYTES, user: "users/carol", value: 10n * MIB }),
+ }),
+ );
+ expect(mocks.createUsageLimit).toHaveBeenCalledTimes(1);
+ });
+});