mirror of
https://github.com/immich-app/immich.git
synced 2025-07-21 22:44:23 +02:00
feat(server): user and server license endpoints (#10682)
* feat: user license endpoints * feat: server license endpoints * chore: pr feedback * chore: add more test cases * chore: add prod license public keys * chore: open-api generation
This commit is contained in:
parent
4193b0dede
commit
3b37b70626
40 changed files with 1474 additions and 18 deletions
open-api
|
@ -4994,6 +4994,101 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/server/license": {
|
||||
"delete": {
|
||||
"operationId": "deleteServerLicense",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Server"
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"operationId": "getServerLicense",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Server"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "setServerLicense",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LicenseKeyDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LicenseResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Server"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/sessions": {
|
||||
"delete": {
|
||||
"operationId": "deleteAllSessions",
|
||||
|
@ -6594,6 +6689,101 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/users/me/license": {
|
||||
"delete": {
|
||||
"operationId": "deleteUserLicense",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Users"
|
||||
]
|
||||
},
|
||||
"get": {
|
||||
"operationId": "getUserLicense",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LicenseResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Users"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "setUserLicense",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LicenseKeyDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LicenseResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Users"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/users/me/preferences": {
|
||||
"get": {
|
||||
"operationId": "getMyPreferences",
|
||||
|
@ -8765,6 +8955,43 @@
|
|||
],
|
||||
"type": "object"
|
||||
},
|
||||
"LicenseKeyDto": {
|
||||
"properties": {
|
||||
"activationKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"licenseKey": {
|
||||
"pattern": "/IM(SV|CL)(-[\\dA-Za-z]{4}){8}/",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"activationKey",
|
||||
"licenseKey"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"LicenseResponseDto": {
|
||||
"properties": {
|
||||
"activatedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"activationKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"licenseKey": {
|
||||
"pattern": "/IM(SV|CL)(-[\\dA-Za-z]{4}){8}/",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"activatedAt",
|
||||
"activationKey",
|
||||
"licenseKey"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"LogLevel": {
|
||||
"enum": [
|
||||
"verbose",
|
||||
|
@ -9752,6 +9979,9 @@
|
|||
"libvips": {
|
||||
"type": "string"
|
||||
},
|
||||
"licensed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"nodejs": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -9778,6 +10008,7 @@
|
|||
}
|
||||
},
|
||||
"required": [
|
||||
"licensed",
|
||||
"version",
|
||||
"versionUrl"
|
||||
],
|
||||
|
@ -11330,6 +11561,14 @@
|
|||
"isAdmin": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"license": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/UserLicense"
|
||||
}
|
||||
],
|
||||
"nullable": true
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -11371,6 +11610,7 @@
|
|||
"email",
|
||||
"id",
|
||||
"isAdmin",
|
||||
"license",
|
||||
"name",
|
||||
"oauthId",
|
||||
"profileImagePath",
|
||||
|
@ -11425,6 +11665,26 @@
|
|||
],
|
||||
"type": "string"
|
||||
},
|
||||
"UserLicense": {
|
||||
"properties": {
|
||||
"activatedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"activationKey": {
|
||||
"type": "string"
|
||||
},
|
||||
"licenseKey": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"activatedAt",
|
||||
"activationKey",
|
||||
"licenseKey"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UserPreferencesResponseDto": {
|
||||
"properties": {
|
||||
"avatar": {
|
||||
|
|
|
@ -38,6 +38,11 @@ export type ActivityCreateDto = {
|
|||
export type ActivityStatisticsResponseDto = {
|
||||
comments: number;
|
||||
};
|
||||
export type UserLicense = {
|
||||
activatedAt: string;
|
||||
activationKey: string;
|
||||
licenseKey: string;
|
||||
};
|
||||
export type UserAdminResponseDto = {
|
||||
avatarColor: UserAvatarColor;
|
||||
createdAt: string;
|
||||
|
@ -45,6 +50,7 @@ export type UserAdminResponseDto = {
|
|||
email: string;
|
||||
id: string;
|
||||
isAdmin: boolean;
|
||||
license: (UserLicense) | null;
|
||||
name: string;
|
||||
oauthId: string;
|
||||
profileImagePath: string;
|
||||
|
@ -800,6 +806,7 @@ export type ServerAboutResponseDto = {
|
|||
ffmpeg?: string;
|
||||
imagemagick?: string;
|
||||
libvips?: string;
|
||||
licensed: boolean;
|
||||
nodejs?: string;
|
||||
repository?: string;
|
||||
repositoryUrl?: string;
|
||||
|
@ -873,6 +880,15 @@ export type ServerVersionResponseDto = {
|
|||
minor: number;
|
||||
patch: number;
|
||||
};
|
||||
export type LicenseKeyDto = {
|
||||
activationKey: string;
|
||||
licenseKey: string;
|
||||
};
|
||||
export type LicenseResponseDto = {
|
||||
activatedAt: string;
|
||||
activationKey: string;
|
||||
licenseKey: string;
|
||||
};
|
||||
export type SessionResponseDto = {
|
||||
createdAt: string;
|
||||
current: boolean;
|
||||
|
@ -2484,6 +2500,32 @@ export function getServerVersion(opts?: Oazapfts.RequestOpts) {
|
|||
...opts
|
||||
}));
|
||||
}
|
||||
export function deleteServerLicense(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/server/license", {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function getServerLicense(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: object;
|
||||
}>("/server/license", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function setServerLicense({ licenseKeyDto }: {
|
||||
licenseKeyDto: LicenseKeyDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: LicenseResponseDto;
|
||||
}>("/server/license", oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: licenseKeyDto
|
||||
})));
|
||||
}
|
||||
export function deleteAllSessions(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/sessions", {
|
||||
...opts,
|
||||
|
@ -2892,6 +2934,32 @@ export function updateMyUser({ userUpdateMeDto }: {
|
|||
body: userUpdateMeDto
|
||||
})));
|
||||
}
|
||||
export function deleteUserLicense(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/users/me/license", {
|
||||
...opts,
|
||||
method: "DELETE"
|
||||
}));
|
||||
}
|
||||
export function getUserLicense(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: LicenseResponseDto;
|
||||
}>("/users/me/license", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function setUserLicense({ licenseKeyDto }: {
|
||||
licenseKeyDto: LicenseKeyDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: LicenseResponseDto;
|
||||
}>("/users/me/license", oazapfts.json({
|
||||
...opts,
|
||||
method: "PUT",
|
||||
body: licenseKeyDto
|
||||
})));
|
||||
}
|
||||
export function getMyPreferences(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue