mirror of
https://github.com/OutlineFoundation/outline-server.git
synced 2026-10-25 05:50:47 +00:00
* s/AccessKeyDataLimit/DefaultDataLimit/g for shadowbox * Implement per-key custom data limits in shadowbox * Shadowbox integration test * Fix the manager service test to maintain backwards compatibility with the GET /server response * Fix integration test for Travis * Fix lint errors * Implement removal of access key data limits * Persist custom data limits * Bump Shadowbox version number * Add a per key dat alimit count to the feature metrics endpoint This also involved modifying the schema of uproxysite:uproxy_metrics_dev.feature_metrics to include the new field. See https://cloud.google.com/bigquery/docs/managing-table-schemas#bq_1 for how this was accomplished Tested: yarn do metrics_server/test && yarn do metrics_server/test_integration * Collect usage metrics for per-key data limits * API documentation and cleanup * Respond to review comments * Respond to review comments * Don't encode the data limit in the access key url This should have been caught in the integration test, but the integration test was miswritten with "echo" instead of "fail", cause the test to mistakenly pass. Fixing this exposed other errors in the test, which were fixed. The test has been confirmed to both pass and fail successfully. * Fix the manager service unit test * Remove stray files * Split integration test into individual functions * Clarify comment in the AccessKey interface * Be more explicit about behavior when no data limits are set * Remove spuriosu import added by vscode * DOn't bump shadowbox version number yet * Rename to accessKeyToApiJson * Don't export AccessKeyJson and use "StorageJson" * Don't await data limit enforcement * Rename the defaultDataLimit getter * Make dataLimit in the accesskey model readonly * Use nullish coalescing operator
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
// Copyright 2019 The Outline Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
class OutlineError extends Error {
|
|
constructor(message: string) {
|
|
super(message);
|
|
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
}
|
|
}
|
|
|
|
export class InvalidPortNumber extends OutlineError {
|
|
// Since this is the error when a non-numeric value is passed to `port`, it takes type `string`.
|
|
constructor(public port: string) {
|
|
super(port);
|
|
}
|
|
}
|
|
|
|
export class PortUnavailable extends OutlineError {
|
|
constructor(public port: number) {
|
|
super(port.toString());
|
|
}
|
|
}
|
|
|
|
export class AccessKeyNotFound extends OutlineError {
|
|
constructor(accessKeyId?: string) {
|
|
super(`Access key "${accessKeyId}" not found`);
|
|
}
|
|
}
|