@fdm-monster/client-next 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.all-contributorsrc +57 -0
- package/.browserslistrc +4 -0
- package/.editorconfig +5 -0
- package/.env +1 -0
- package/.eslintrc-auto-import.json +73 -0
- package/.eslintrc.js +126 -0
- package/.github/FUNDING.yml +3 -0
- package/.github/workflows/release-client.yml +94 -0
- package/.github/workflows/vue-publish.yml +26 -0
- package/.prettierignore +15 -0
- package/.prettierrc.cjs +7 -0
- package/.whitesource +12 -0
- package/.yarn/releases/yarn-4.5.1.cjs +934 -0
- package/.yarnrc.yml +3 -0
- package/CODE_OF_CONDUCT.md +46 -0
- package/README.md +93 -0
- package/RELEASE_NOTES.MD +11 -0
- package/index.html +16 -0
- package/package.default.json +42 -0
- package/package.json +26 -0
- package/public/favicon.ico +0 -0
- package/public/img/DavidZwart.jpg +0 -0
- package/public/img/OIG.JYDC2RaWdz7g9.jpg +0 -0
- package/public/img/OIG.jpg +0 -0
- package/public/img/icons/android-chrome-192x192.png +0 -0
- package/public/img/icons/android-chrome-256x256.png +0 -0
- package/public/img/icons/android-chrome-384x384.png +0 -0
- package/public/img/icons/android-chrome-512x512.png +0 -0
- package/public/img/icons/favicon.svg +1 -0
- package/public/img/logo.png +0 -0
- package/public/img/logo.svg +1 -0
- package/public/img/manifest.webmanifest +33 -0
- package/public/img/octoprint-tentacle.svg +144 -0
- package/public/img/thumbail_unknown.jpg +0 -0
- package/public/img/vbanner.jpg +0 -0
- package/public/index.html +17 -0
- package/public/robots.txt +2 -0
- package/renovate.json +30 -0
- package/src/App.vue +60 -0
- package/src/AppLoader.vue +383 -0
- package/src/assets/adjectives.json +1468 -0
- package/src/assets/android-chrome-192x192.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/logo.svg +6 -0
- package/src/assets/nouns.json +4309 -0
- package/src/auto-imports.d.ts +139 -0
- package/src/backend/app.service.ts +39 -0
- package/src/backend/auth.service.ts +56 -0
- package/src/backend/base.service.ts +57 -0
- package/src/backend/batch.service.ts +37 -0
- package/src/backend/camera-stream.service.ts +33 -0
- package/src/backend/custom-gcode.service.ts +11 -0
- package/src/backend/dto/octoprint-settings.dto.ts +168 -0
- package/src/backend/first-time-setup.service.ts +17 -0
- package/src/backend/floor.service.ts +84 -0
- package/src/backend/index.ts +4 -0
- package/src/backend/print-completions.service.ts +11 -0
- package/src/backend/printer-file.service.ts +91 -0
- package/src/backend/printer-group.service.ts +62 -0
- package/src/backend/printer-job.service.ts +20 -0
- package/src/backend/printer-settings.service.ts +28 -0
- package/src/backend/printers.service.ts +136 -0
- package/src/backend/server-private.service.ts +55 -0
- package/src/backend/server.api.ts +132 -0
- package/src/backend/settings.service.ts +85 -0
- package/src/backend/user.service.ts +51 -0
- package/src/components/AboutHelp/AboutView.vue +164 -0
- package/src/components/CameraGrid/CameraGridView.vue +111 -0
- package/src/components/FirstTimeSetup/FirstTimeSetupView.vue +354 -0
- package/src/components/Generic/Actions/PrinterConnectionAction.vue +56 -0
- package/src/components/Generic/Actions/PrinterCreateAction.vue +22 -0
- package/src/components/Generic/Actions/PrinterDeleteAction.vue +29 -0
- package/src/components/Generic/Actions/PrinterQuickStopAction.vue +35 -0
- package/src/components/Generic/Actions/PrinterSettingsAction.vue +35 -0
- package/src/components/Generic/Actions/PrinterUrlAction.vue +24 -0
- package/src/components/Generic/Actions/RefreshFilesAction.vue +50 -0
- package/src/components/Generic/Actions/SyncPrinterNameAction.vue +36 -0
- package/src/components/Generic/Dialogs/AddOrUpdateCameraStreamDialog.vue +131 -0
- package/src/components/Generic/Dialogs/AddOrUpdateFloorDialog.vue +141 -0
- package/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue +303 -0
- package/src/components/Generic/Dialogs/BaseDialog.vue +81 -0
- package/src/components/Generic/Dialogs/BatchJsonCreateDialog.vue +109 -0
- package/src/components/Generic/Dialogs/BatchReprintDialog.vue +190 -0
- package/src/components/Generic/Dialogs/PrinterChecksPanel.vue +37 -0
- package/src/components/Generic/Dialogs/PrinterControlDialog.vue +202 -0
- package/src/components/Generic/Dialogs/PrinterMaintenanceDialog.vue +130 -0
- package/src/components/Generic/Dialogs/YamlImportExportDialog.vue +186 -0
- package/src/components/Generic/Dialogs/dialog.constants.ts +19 -0
- package/src/components/Generic/FileExplorerSideNav.vue +734 -0
- package/src/components/Generic/Loaders/GridLoader.vue +68 -0
- package/src/components/Generic/NavigationDrawer.vue +69 -0
- package/src/components/Generic/PrintJobsMenu.vue +148 -0
- package/src/components/Generic/Snackbars/AppErrorSnackbar.vue +64 -0
- package/src/components/Generic/Snackbars/AppInfoSnackbar.vue +63 -0
- package/src/components/Generic/Snackbars/AppProgressSnackbar.vue +158 -0
- package/src/components/Generic/Vuetify/TooltipButton.vue +47 -0
- package/src/components/HelpOverlay/HelpOverlay.vue +57 -0
- package/src/components/Login/LoginForm.vue +206 -0
- package/src/components/Login/LoginView.spec.ts +64 -0
- package/src/components/Login/LoginView.vue +65 -0
- package/src/components/Login/Logo.vue +13 -0
- package/src/components/Login/PermissionDenied.vue +109 -0
- package/src/components/Login/RegistrationForm.vue +207 -0
- package/src/components/Login/RegistrationView.vue +17 -0
- package/src/components/Login/__snapshots__/LoginView.spec.ts.snap +1051 -0
- package/src/components/NotFound/NotFoundView.vue +39 -0
- package/src/components/PrintStatistics/PrintStatistics.vue +168 -0
- package/src/components/PrintStatistics/PrintStatisticsView.vue +15 -0
- package/src/components/PrinterGrid/HomeToolbar.vue +90 -0
- package/src/components/PrinterGrid/PrinterGrid.vue +164 -0
- package/src/components/PrinterGrid/PrinterGridTile.vue +438 -0
- package/src/components/PrinterGrid/PrinterGridView.vue +210 -0
- package/src/components/PrinterList/FileControlList.vue +40 -0
- package/src/components/PrinterList/PrinterDetails.vue +91 -0
- package/src/components/PrinterList/PrintersView.vue +492 -0
- package/src/components/Settings/AccountSettings.vue +163 -0
- package/src/components/Settings/DiagnosticsSettings.vue +137 -0
- package/src/components/Settings/EmergencyCommands.vue +265 -0
- package/src/components/Settings/FloorSettings.vue +276 -0
- package/src/components/Settings/GridSettings.vue +127 -0
- package/src/components/Settings/OctoPrintSettings.vue +188 -0
- package/src/components/Settings/ServerProtectionSettings.vue +370 -0
- package/src/components/Settings/SettingsView.vue +73 -0
- package/src/components/Settings/SoftwareUpgradeSettings.vue +297 -0
- package/src/components/Settings/UserManagementSettings.vue +257 -0
- package/src/components/TopBar.vue +147 -0
- package/src/components.d.ts +70 -0
- package/src/directives/file-upload.directive.ts +117 -0
- package/src/directives/printer-drop-position.directive.ts +92 -0
- package/src/env.d.ts +6 -0
- package/src/main.ts +76 -0
- package/src/models/batch/reprint.dto.ts +79 -0
- package/src/models/batch.model.ts +11 -0
- package/src/models/camera-streams/camera-stream.ts +19 -0
- package/src/models/floors/floor.model.ts +30 -0
- package/src/models/octoprint/connection-options.model.ts +8 -0
- package/src/models/plugins/firmware-updates/prusa-firmware-release.model.ts +57 -0
- package/src/models/print-completions/print-completions.model.ts +49 -0
- package/src/models/printers/crud/create-printer.model.ts +26 -0
- package/src/models/printers/file-upload-commands.model.ts +4 -0
- package/src/models/printers/gcode/gcode-analysis.model.ts +30 -0
- package/src/models/printers/printer-current-job.model.ts +90 -0
- package/src/models/printers/printer-file.model.ts +48 -0
- package/src/models/printers/printer.model.ts +18 -0
- package/src/models/server/client-releases.model.ts +27 -0
- package/src/models/server/export-yaml.model.ts +11 -0
- package/src/models/server/features.model.ts +37 -0
- package/src/models/server/github-rate-limit.model.ts +21 -0
- package/src/models/server/version.model.ts +14 -0
- package/src/models/settings/printer-file-clean-settings.model.ts +5 -0
- package/src/models/settings/server-settings.dto.ts +19 -0
- package/src/models/settings/settings.model.ts +57 -0
- package/src/models/socketio-messages/socketio-message.model.ts +53 -0
- package/src/models/uploads/queued-upload.model.ts +12 -0
- package/src/models/user.model.ts +15 -0
- package/src/plugins/README.md +3 -0
- package/src/plugins/index.ts +17 -0
- package/src/plugins/vuetify.ts +53 -0
- package/src/router/index.ts +192 -0
- package/src/router/route-names.ts +14 -0
- package/src/router/utils.ts +23 -0
- package/src/shared/alert.events.ts +14 -0
- package/src/shared/app.constants.ts +23 -0
- package/src/shared/auth.constants.ts +34 -0
- package/src/shared/dialog.composable.ts +41 -0
- package/src/shared/drag.constants.ts +19 -0
- package/src/shared/experimental.constants.ts +1 -0
- package/src/shared/http-client.ts +162 -0
- package/src/shared/noun-adjectives.data.ts +24 -0
- package/src/shared/printer-grid.constants.ts +5 -0
- package/src/shared/printer-state.constants.ts +194 -0
- package/src/shared/snackbar.composable.ts +66 -0
- package/src/shared/socketio.service.ts +104 -0
- package/src/store/auth.store.ts +255 -0
- package/src/store/connection.store.ts +66 -0
- package/src/store/dialog.store.ts +114 -0
- package/src/store/features.store.ts +57 -0
- package/src/store/floor.store.ts +173 -0
- package/src/store/grid.store.ts +10 -0
- package/src/store/index.ts +4 -0
- package/src/store/printer-state.store.ts +246 -0
- package/src/store/printer.store.ts +236 -0
- package/src/store/profile.store.ts +25 -0
- package/src/store/settings.store.ts +64 -0
- package/src/store/test-printer.store.ts +70 -0
- package/src/store/uploads.store.ts +75 -0
- package/src/styles/README.md +3 -0
- package/src/styles/settings.scss +10 -0
- package/src/types/global.d.ts +15 -0
- package/src/utils/array.utils.ts +15 -0
- package/src/utils/date.utils.ts +5 -0
- package/src/utils/download-file.util.ts +25 -0
- package/src/utils/error.utils.ts +3 -0
- package/src/utils/file-size.util.ts +11 -0
- package/src/utils/id.type.ts +1 -0
- package/src/utils/sentry.util.ts +8 -0
- package/src/utils/test.util.ts +30 -0
- package/src/utils/time.utils.ts +2 -0
- package/src/utils/uploads-state.utils.ts +58 -0
- package/src/utils/validation.utils.ts +14 -0
- package/src/vite-env.d.ts +7 -0
- package/test/setup-axios-mock.ts +15 -0
- package/tsconfig.json +47 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.mts +106 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { BaseService } from '@/backend/base.service'
|
|
2
|
+
import { ServerApi } from '@/backend/server.api'
|
|
3
|
+
import { FileUploadCommands } from '@/models/printers/file-upload-commands.model'
|
|
4
|
+
import {
|
|
5
|
+
ClearedFilesResult,
|
|
6
|
+
FileDto
|
|
7
|
+
} from '@/models/printers/printer-file.model'
|
|
8
|
+
import { PrinterDto } from '@/models/printers/printer.model'
|
|
9
|
+
import { useSnackbar } from '@/shared/snackbar.composable'
|
|
10
|
+
import { IdType } from '@/utils/id.type'
|
|
11
|
+
|
|
12
|
+
export class PrinterFileService extends BaseService {
|
|
13
|
+
static async getFiles(printerId: IdType, recursive = false) {
|
|
14
|
+
const path = `${ServerApi.printerFilesRoute}/${printerId}/?recursive=${recursive}`
|
|
15
|
+
|
|
16
|
+
return (await this.get(path)) as FileDto[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A nice alternative for offline or disabled printers
|
|
21
|
+
* @param printerId
|
|
22
|
+
*/
|
|
23
|
+
static async getFileCache(printerId: IdType) {
|
|
24
|
+
const path = `${ServerApi.printerFilesCacheRoute(printerId)}`
|
|
25
|
+
|
|
26
|
+
return (await this.get(path)) as FileDto[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async selectAndPrintFile(
|
|
30
|
+
printerId: IdType,
|
|
31
|
+
filePath: string,
|
|
32
|
+
print = true
|
|
33
|
+
) {
|
|
34
|
+
const path = ServerApi.printerFilesSelectAndPrintRoute(printerId)
|
|
35
|
+
return await this.post(path, { filePath, print })
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static async uploadFile(
|
|
39
|
+
printer: PrinterDto,
|
|
40
|
+
file: File,
|
|
41
|
+
commands: FileUploadCommands = {
|
|
42
|
+
select: true,
|
|
43
|
+
print: true
|
|
44
|
+
}
|
|
45
|
+
) {
|
|
46
|
+
const path = ServerApi.printerFilesUploadRoute(printer.id)
|
|
47
|
+
|
|
48
|
+
const formData = new FormData()
|
|
49
|
+
if (commands.select) {
|
|
50
|
+
formData.append('select', 'true')
|
|
51
|
+
}
|
|
52
|
+
if (commands.print) {
|
|
53
|
+
formData.append('print', 'true')
|
|
54
|
+
}
|
|
55
|
+
formData.append('files[0]', file)
|
|
56
|
+
|
|
57
|
+
return this.postUpload(path, formData, {
|
|
58
|
+
onUploadProgress: (progress) => {
|
|
59
|
+
const snackbar = useSnackbar()
|
|
60
|
+
snackbar.openProgressMessage(
|
|
61
|
+
'single-file-upload',
|
|
62
|
+
`Uploading file ${file.name}`,
|
|
63
|
+
(100 * progress.loaded) / progress.total!,
|
|
64
|
+
false
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static async clearFiles(printerId: IdType) {
|
|
71
|
+
const path = `${ServerApi.printerFilesClearRoute(printerId)}`
|
|
72
|
+
|
|
73
|
+
return this.delete<ClearedFilesResult>(path)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static async purgeFiles() {
|
|
77
|
+
const path = `${ServerApi.printerFilesPurgeRoute}`
|
|
78
|
+
|
|
79
|
+
return this.post(path)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static async deleteFileOrFolder(printerId: IdType, path: string) {
|
|
83
|
+
const urlPath = `${ServerApi.printerFilesRoute}/${printerId}/?path=${path}`
|
|
84
|
+
|
|
85
|
+
return this.delete(urlPath)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static downloadFile(file: FileDto) {
|
|
89
|
+
window.location.href = file.refs.download
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BaseService } from '@/backend/base.service'
|
|
2
|
+
import { ServerApi } from '@/backend/server.api'
|
|
3
|
+
import { IdType } from '@/utils/id.type'
|
|
4
|
+
|
|
5
|
+
export interface PrinterGroupDto<KeyType = number> {
|
|
6
|
+
printerId: KeyType
|
|
7
|
+
groupId: KeyType
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface GroupDto<KeyType extends string | number = number> {
|
|
11
|
+
id: KeyType
|
|
12
|
+
name: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface GroupWithPrintersDto<KeyType extends string | number = number>
|
|
16
|
+
extends GroupDto<KeyType> {
|
|
17
|
+
printers: PrinterGroupDto<KeyType>[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class PrinterGroupService extends BaseService {
|
|
21
|
+
static async createGroup(name: string) {
|
|
22
|
+
const path = `${ServerApi.createGroupRoute}`
|
|
23
|
+
const body = {
|
|
24
|
+
name
|
|
25
|
+
}
|
|
26
|
+
return (await this.post(path, body)) as void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async deleteGroup(groupId: IdType) {
|
|
30
|
+
const path = `${ServerApi.deleteGroupRoute(groupId)}`
|
|
31
|
+
return (await this.delete(path)) as GroupWithPrintersDto<IdType>[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static async getGroupsWithPrinters() {
|
|
35
|
+
const path = `${ServerApi.printerGroupRoute}`
|
|
36
|
+
return (await this.get(path)) as GroupWithPrintersDto<IdType>[]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static async addPrinterToGroup(groupId: IdType, printerId: IdType) {
|
|
40
|
+
const path = `${ServerApi.addPrinterToGroupRoute(groupId)}`
|
|
41
|
+
const body = {
|
|
42
|
+
printerId
|
|
43
|
+
}
|
|
44
|
+
return (await this.post(path, body)) as GroupWithPrintersDto<IdType>[]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static async deletePrinterFromGroup(groupId: IdType, printerId: IdType) {
|
|
48
|
+
const path = `${ServerApi.deletePrinterFromGroupRoute(groupId)}`
|
|
49
|
+
const body = {
|
|
50
|
+
printerId
|
|
51
|
+
}
|
|
52
|
+
return (await this.delete(path, body)) as GroupWithPrintersDto<IdType>[]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static async updateGroupName(groupId: IdType, name: string) {
|
|
56
|
+
const path = `${ServerApi.updateGroupNameRoute(groupId)}`
|
|
57
|
+
const body = {
|
|
58
|
+
name
|
|
59
|
+
}
|
|
60
|
+
return (await this.patch(path, body)) as GroupWithPrintersDto<IdType>[]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ServerApi } from '@/backend/server.api'
|
|
2
|
+
import { BaseService } from '@/backend/base.service'
|
|
3
|
+
import { IdType } from '@/utils/id.type'
|
|
4
|
+
|
|
5
|
+
export class PrinterJobService extends BaseService {
|
|
6
|
+
static async stopPrintJob(printerId: IdType) {
|
|
7
|
+
const path = ServerApi.printerStopJobRoute(printerId)
|
|
8
|
+
return await this.post(path)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static async pausePrintJob(printerId: IdType) {
|
|
12
|
+
const path = ServerApi.printerPauseJobRoute(printerId)
|
|
13
|
+
return await this.post(path)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static async resumePrintJob(printerId: IdType) {
|
|
17
|
+
const path = ServerApi.printerResumeJobRoute(printerId)
|
|
18
|
+
return await this.post(path)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseService } from '@/backend/base.service'
|
|
2
|
+
import { ServerApi } from '@/backend/server.api'
|
|
3
|
+
import { IdType } from '@/utils/id.type'
|
|
4
|
+
|
|
5
|
+
export class PrinterSettingsService extends BaseService {
|
|
6
|
+
static async getSettings(printerId: IdType) {
|
|
7
|
+
const path = `${ServerApi.getPrinterSettingsRoute(printerId)}`
|
|
8
|
+
|
|
9
|
+
return await this.get(path)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Enabled: true => idle, enabled: false => disabled
|
|
14
|
+
* @param printerId
|
|
15
|
+
* @param enabled
|
|
16
|
+
*/
|
|
17
|
+
static async setGCodeAnalysis(printerId: IdType, enabled = false) {
|
|
18
|
+
const path = `${ServerApi.setPrinterSettingsGCodeAnalysisRoute(printerId)}`
|
|
19
|
+
|
|
20
|
+
return await this.post(path, { enabled })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static async syncPrinterName(printerId: IdType) {
|
|
24
|
+
const path = `${ServerApi.syncPrinterNameSettingRoute(printerId)}`
|
|
25
|
+
|
|
26
|
+
return await this.post(path)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ServerApi } from '@/backend/server.api'
|
|
2
|
+
import { BaseService } from '@/backend/base.service'
|
|
3
|
+
import { LoginDetails, PrinterDto } from '@/models/printers/printer.model'
|
|
4
|
+
import {
|
|
5
|
+
CreatePrinter,
|
|
6
|
+
getDefaultCreatePrinter,
|
|
7
|
+
PreCreatePrinter
|
|
8
|
+
} from '@/models/printers/crud/create-printer.model'
|
|
9
|
+
import { newRandomNamePair } from '@/shared/noun-adjectives.data'
|
|
10
|
+
import { IdType } from '@/utils/id.type'
|
|
11
|
+
|
|
12
|
+
export class PrintersService extends BaseService {
|
|
13
|
+
static applyLoginDetailsPatchForm(
|
|
14
|
+
patch: { printerURL: string; apiKey: string; name: string },
|
|
15
|
+
formData: PreCreatePrinter
|
|
16
|
+
) {
|
|
17
|
+
formData.name = patch.name || newRandomNamePair()
|
|
18
|
+
formData.apiKey = patch.apiKey
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static convertPrinterToCreateForm(printer: CreatePrinter) {
|
|
22
|
+
// Inverse transformation
|
|
23
|
+
const newFormData = getDefaultCreatePrinter()
|
|
24
|
+
|
|
25
|
+
newFormData.id = printer.id
|
|
26
|
+
newFormData.printerURL = printer.printerURL
|
|
27
|
+
newFormData.name = printer.name || newRandomNamePair()
|
|
28
|
+
newFormData.apiKey = printer.apiKey
|
|
29
|
+
newFormData.enabled = printer.enabled
|
|
30
|
+
return newFormData
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static openPrinterURL(printerURL: string) {
|
|
34
|
+
if (!printerURL) return
|
|
35
|
+
|
|
36
|
+
window.open(printerURL)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static async getPrinters() {
|
|
40
|
+
const path = ServerApi.printerRoute
|
|
41
|
+
|
|
42
|
+
return (await this.get<PrinterDto[]>(path)) as PrinterDto[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static async getPrinterLoginDetails(printerId: IdType) {
|
|
46
|
+
const path = ServerApi.getPrinterLoginDetailsRoute(printerId)
|
|
47
|
+
|
|
48
|
+
return (await this.get<LoginDetails>(path)) as LoginDetails
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static async restartOctoPrint(printerId: IdType) {
|
|
52
|
+
const path = `${ServerApi.restartOctoPrintRoute(printerId)}`
|
|
53
|
+
return (await this.post(path)) as any
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static async refreshSocket(printerId: IdType) {
|
|
57
|
+
const path = `${ServerApi.refreshSocketRoute(printerId)}`
|
|
58
|
+
return (await this.post(path)) as any
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static async sendPrinterConnectCommand(printerId: IdType) {
|
|
62
|
+
const path = ServerApi.printerSerialConnectRoute(printerId)
|
|
63
|
+
|
|
64
|
+
return await this.post(path)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static async sendPrinterDisconnectCommand(printerId: IdType) {
|
|
68
|
+
const path = ServerApi.printerSerialDisconnectRoute(printerId)
|
|
69
|
+
|
|
70
|
+
return await this.post(path)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static async sendPrinterJogCommand(
|
|
74
|
+
printerId: IdType,
|
|
75
|
+
amounts: { x?: number; y?: number; z?: number }
|
|
76
|
+
) {
|
|
77
|
+
const path = ServerApi.printerJogCommandRoute(printerId)
|
|
78
|
+
|
|
79
|
+
return await this.post(path, amounts)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static async sendPrinterHomeCommand(printerId: IdType, axes: string[]) {
|
|
83
|
+
const path = ServerApi.printerHomeCommandRoute(printerId)
|
|
84
|
+
|
|
85
|
+
return await this.post(path, axes)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static async createPrinter(printer: CreatePrinter, forceSave: boolean) {
|
|
89
|
+
const path = `${ServerApi.printerRoute}?forceSave=${forceSave}`
|
|
90
|
+
|
|
91
|
+
return (await this.post(path, printer)) as PrinterDto
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static async batchImportPrinters(printers: CreatePrinter[]) {
|
|
95
|
+
const path = ServerApi.printerBatchRoute
|
|
96
|
+
|
|
97
|
+
return (await this.post(path, printers)) as PrinterDto[]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static async deletePrinter(printerId: IdType) {
|
|
101
|
+
const path = ServerApi.getPrinterRoute(printerId)
|
|
102
|
+
|
|
103
|
+
return await this.delete(path)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static async updatePrinter(
|
|
107
|
+
printerId: IdType,
|
|
108
|
+
printer: CreatePrinter,
|
|
109
|
+
forceSave: boolean
|
|
110
|
+
) {
|
|
111
|
+
const path = ServerApi.getPrinterRoute(printerId)
|
|
112
|
+
const fullPath = `${path}?forceSave=${forceSave}`
|
|
113
|
+
return (await this.patch(fullPath, printer)) as PrinterDto
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static async updatePrinterMaintenance(
|
|
117
|
+
printerId: IdType,
|
|
118
|
+
disabledReason: string | null = null
|
|
119
|
+
) {
|
|
120
|
+
const path = ServerApi.postPrinterDisabledReasonRoute(printerId)
|
|
121
|
+
|
|
122
|
+
return (await this.patch(path, { disabledReason })) as PrinterDto
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
static async testConnection(printer: CreatePrinter) {
|
|
126
|
+
const path = ServerApi.printerTestConnectionRoute
|
|
127
|
+
|
|
128
|
+
return (await this.post(path, printer)) as PrinterDto
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static async toggleEnabled(printerId: IdType, enabled: boolean) {
|
|
132
|
+
const path = ServerApi.printerEnabledRoute(printerId)
|
|
133
|
+
|
|
134
|
+
return await this.patch(path, { enabled })
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseService } from '@/backend/base.service'
|
|
2
|
+
import { ServerApi } from '@/backend/server.api'
|
|
3
|
+
import { ExportYamlModel } from '@/models/server/export-yaml.model'
|
|
4
|
+
import { downloadFileByBlob } from '@/utils/download-file.util'
|
|
5
|
+
import { getHttpClient } from '@/shared/http-client'
|
|
6
|
+
|
|
7
|
+
export class ServerPrivateService extends BaseService {
|
|
8
|
+
public static async restartServer() {
|
|
9
|
+
const path = ServerApi.serverRestartCommandRoute
|
|
10
|
+
|
|
11
|
+
return await this.post(path)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public static async downloadYamlExport(input: ExportYamlModel) {
|
|
15
|
+
const client = await getHttpClient()
|
|
16
|
+
const response = await client.request<any>({
|
|
17
|
+
method: 'POST',
|
|
18
|
+
url: 'api/server/export-printers-floors-yaml',
|
|
19
|
+
data: input,
|
|
20
|
+
responseType: 'arraybuffer'
|
|
21
|
+
})
|
|
22
|
+
downloadFileByBlob(
|
|
23
|
+
response.data as ArrayBuffer,
|
|
24
|
+
'export-fdm-monster-' + Date.now() + '.yaml'
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static async uploadAndImportYaml(file: File) {
|
|
29
|
+
const formData = new FormData()
|
|
30
|
+
formData.append('file', file)
|
|
31
|
+
return await this.postUpload(
|
|
32
|
+
'api/server/import-printers-floors-yaml',
|
|
33
|
+
formData,
|
|
34
|
+
{}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static async downloadLogDump() {
|
|
39
|
+
const client = await getHttpClient()
|
|
40
|
+
const response = await client.request<any>({
|
|
41
|
+
method: 'POST',
|
|
42
|
+
url: `api/server/dump-fdm-monster-logs`,
|
|
43
|
+
responseType: 'arraybuffer'
|
|
44
|
+
})
|
|
45
|
+
downloadFileByBlob(
|
|
46
|
+
response.data as ArrayBuffer,
|
|
47
|
+
'logs-fdm-monster-' + Date.now() + '.zip'
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public static async clearLogFilesOlderThanWeek() {
|
|
52
|
+
const path = `api/server/clear-outdated-fdm-monster-logs`
|
|
53
|
+
return await this.delete(path)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { IdType } from '@/utils/id.type'
|
|
2
|
+
|
|
3
|
+
export class ServerApi {
|
|
4
|
+
static base = '/api'
|
|
5
|
+
|
|
6
|
+
static firstTimeSetupRoute = `${ServerApi.base}/first-time-setup`
|
|
7
|
+
static completeFirstTimeSetupRoute = `${ServerApi.firstTimeSetupRoute}/complete`
|
|
8
|
+
|
|
9
|
+
static printerRoute = `${ServerApi.base}/printer`
|
|
10
|
+
static printerBatchRoute = `${ServerApi.printerRoute}/batch`
|
|
11
|
+
static printerTestConnectionRoute = `${ServerApi.printerRoute}/test-connection`
|
|
12
|
+
|
|
13
|
+
static printerSettingsRoute = `${ServerApi.base}/printer-settings`
|
|
14
|
+
|
|
15
|
+
static floorRoute = `${ServerApi.base}/floor`
|
|
16
|
+
|
|
17
|
+
static batchRoute = `${ServerApi.base}/batch`
|
|
18
|
+
static batchGetLastPrintedFilesRoute = `${ServerApi.batchRoute}/reprint/list`
|
|
19
|
+
static batchReprintFilesRoute = `${ServerApi.batchRoute}/reprint/execute`
|
|
20
|
+
|
|
21
|
+
static printCompletionRoute = `${ServerApi.base}/print-completion`
|
|
22
|
+
|
|
23
|
+
static printerFilesRoute = `${ServerApi.base}/printer-files`
|
|
24
|
+
static printerFilesPurgeRoute = `${ServerApi.printerFilesRoute}/purge`
|
|
25
|
+
|
|
26
|
+
static printerGroupRoute = `${ServerApi.base}/printer-group`
|
|
27
|
+
static createGroupRoute = `${ServerApi.base}/printer-group`
|
|
28
|
+
static deleteGroupRoute = (id: IdType) =>
|
|
29
|
+
`${ServerApi.base}/printer-group/${id}`
|
|
30
|
+
static updateGroupNameRoute = (id: IdType) =>
|
|
31
|
+
`${ServerApi.base}/printer-group/${id}/name`
|
|
32
|
+
static addPrinterToGroupRoute = (id: IdType) =>
|
|
33
|
+
`${ServerApi.base}/printer-group/${id}/printer`
|
|
34
|
+
static deletePrinterFromGroupRoute = ServerApi.addPrinterToGroupRoute
|
|
35
|
+
|
|
36
|
+
static customGCodeRoute = `${ServerApi.base}/custom-gcode`
|
|
37
|
+
|
|
38
|
+
static userRoute = `${ServerApi.base}/user`
|
|
39
|
+
static rolesRoute = `${ServerApi.base}/user/roles`
|
|
40
|
+
static userProfileRoute = `${ServerApi.userRoute}/profile`
|
|
41
|
+
|
|
42
|
+
static settingsRoute = `${ServerApi.base}/settings`
|
|
43
|
+
static settingsSensitiveRoute = `${ServerApi.settingsRoute}/sensitive`
|
|
44
|
+
static updateLoginRequiredRoute = `${ServerApi.settingsRoute}/login-required`
|
|
45
|
+
static updateRegistrationEnabledRoute = `${ServerApi.settingsRoute}/registration-enabled`
|
|
46
|
+
static updateCredentialSettings = `${ServerApi.settingsRoute}/credential`
|
|
47
|
+
static serverSettingsRoute = `${ServerApi.settingsRoute}/server`
|
|
48
|
+
static fileCleanSettingsRoute = `${ServerApi.settingsRoute}/file-clean`
|
|
49
|
+
static updateFrontendSettingsRoute = `${ServerApi.settingsRoute}/frontend`
|
|
50
|
+
static updateServerWhitelistSettingRoute = `${ServerApi.settingsRoute}/whitelist`
|
|
51
|
+
static updateTimeoutSettingRoute = `${ServerApi.settingsRoute}/timeout`
|
|
52
|
+
static serverSentryDiagnosticsSettingRoute = `${ServerApi.settingsRoute}/sentry-diagnostics`
|
|
53
|
+
static updateExperimentalMoonrakerSupportRoute = `${ServerApi.settingsRoute}/experimental-moonraker-support`
|
|
54
|
+
|
|
55
|
+
static serverPrivateRoute = `${ServerApi.base}/server`
|
|
56
|
+
static serverRestartCommandRoute = `${ServerApi.serverPrivateRoute}/restart`
|
|
57
|
+
|
|
58
|
+
static pluginRoute = `${ServerApi.base}/plugin`
|
|
59
|
+
static pluginFirmwareUpdateRoute = `${ServerApi.pluginRoute}/firmware-update`
|
|
60
|
+
static pluginFirmwareReleasesRoute = `${ServerApi.pluginFirmwareUpdateRoute}/releases`
|
|
61
|
+
|
|
62
|
+
static getPrinterRoute = (id: IdType) => `${ServerApi.printerRoute}/${id}`
|
|
63
|
+
static postPrinterDisabledReasonRoute = (id: IdType) =>
|
|
64
|
+
`${ServerApi.printerRoute}/${id}/disabled-reason`
|
|
65
|
+
static getPrinterLoginDetailsRoute = (id: IdType) =>
|
|
66
|
+
`${ServerApi.getPrinterRoute(id)}/login-details`
|
|
67
|
+
static restartOctoPrintRoute = (id: IdType) =>
|
|
68
|
+
`${ServerApi.getPrinterRoute(id)}/restart-octoprint`
|
|
69
|
+
|
|
70
|
+
static refreshSocketRoute = (id: IdType) =>
|
|
71
|
+
`${ServerApi.getPrinterRoute(id)}/refresh-socket`
|
|
72
|
+
static getPrinterSettingsRoute = (id: IdType) =>
|
|
73
|
+
`${ServerApi.printerSettingsRoute}/${id}`
|
|
74
|
+
static setPrinterSettingsGCodeAnalysisRoute = (id: IdType) =>
|
|
75
|
+
`${ServerApi.getPrinterSettingsRoute(id)}/gcode-analysis`
|
|
76
|
+
static syncPrinterNameSettingRoute = (id: IdType) =>
|
|
77
|
+
`${ServerApi.getPrinterSettingsRoute(id)}/sync-printername`
|
|
78
|
+
static getFloorRoute = (id: IdType) => `${ServerApi.floorRoute}/${id}`
|
|
79
|
+
static setSelectedFloorRoute = (floorId: IdType) =>
|
|
80
|
+
`${ServerApi.floorRoute}/selected-floor/${floorId}`
|
|
81
|
+
static addOrRemovePrinterFromFloorRoute = (id: IdType) =>
|
|
82
|
+
`${ServerApi.getFloorRoute(id)}/printer`
|
|
83
|
+
static sendQuickStopM112Route = (id: IdType) =>
|
|
84
|
+
`${ServerApi.customGCodeRoute}/send-emergency-m112/${id}`
|
|
85
|
+
static installFirmwareUpdatePluginRoute = (id: IdType) =>
|
|
86
|
+
`${ServerApi.pluginFirmwareUpdateRoute}/${id}/install-firmware-update-plugin`
|
|
87
|
+
static configurePluginSettingsRoute = (id: IdType) =>
|
|
88
|
+
`${ServerApi.pluginFirmwareUpdateRoute}/${id}/configure-plugin-settings`
|
|
89
|
+
static flashFirmwareRoute = (id: IdType) =>
|
|
90
|
+
`${ServerApi.pluginFirmwareUpdateRoute}/${id}/flash-firmware`
|
|
91
|
+
static updatePrinterFloorNameRoute = (id: IdType) =>
|
|
92
|
+
`${ServerApi.getFloorRoute(id)}/name`
|
|
93
|
+
static updatePrinterFloorNumberRoute = (id: IdType) =>
|
|
94
|
+
`${ServerApi.getFloorRoute(id)}/floor-number`
|
|
95
|
+
static printerFilesClearRoute = (id: IdType) =>
|
|
96
|
+
`${ServerApi.printerFilesRoute}/${id}/clear`
|
|
97
|
+
static printerFilesSelectAndPrintRoute = (id: IdType) =>
|
|
98
|
+
`${ServerApi.printerFilesRoute}/${id}/select`
|
|
99
|
+
static printerFilesUploadRoute = (id: IdType) =>
|
|
100
|
+
`${ServerApi.printerFilesRoute}/${id}/upload`
|
|
101
|
+
static printerFilesCacheRoute = (id: IdType) =>
|
|
102
|
+
`${ServerApi.printerFilesRoute}/${id}/cache`
|
|
103
|
+
static printerEnabledRoute = (id: IdType) =>
|
|
104
|
+
`${ServerApi.getPrinterRoute(id)}/enabled`
|
|
105
|
+
static printerSerialConnectRoute = (id: IdType) =>
|
|
106
|
+
`${ServerApi.getPrinterRoute(id)}/serial-connect`
|
|
107
|
+
static printerJogCommandRoute = (id: IdType) =>
|
|
108
|
+
`${ServerApi.getPrinterRoute(id)}/jog`
|
|
109
|
+
static printerHomeCommandRoute = (id: IdType) =>
|
|
110
|
+
`${ServerApi.getPrinterRoute(id)}/home`
|
|
111
|
+
static printerSerialDisconnectRoute = (id: IdType) =>
|
|
112
|
+
`${ServerApi.getPrinterRoute(id)}/serial-disconnect`
|
|
113
|
+
|
|
114
|
+
static printerJobRoute = (id: IdType) =>
|
|
115
|
+
`${ServerApi.getPrinterRoute(id)}/job`
|
|
116
|
+
static printerStopJobRoute = (id: IdType) =>
|
|
117
|
+
`${ServerApi.printerJobRoute(id)}/stop`
|
|
118
|
+
static printerPauseJobRoute = (id: IdType) =>
|
|
119
|
+
`${ServerApi.printerJobRoute(id)}/pause`
|
|
120
|
+
static printerResumeJobRoute = (id: IdType) =>
|
|
121
|
+
`${ServerApi.printerJobRoute(id)}/resume`
|
|
122
|
+
|
|
123
|
+
static userChangeUsernameRoute = (id: IdType) =>
|
|
124
|
+
`${ServerApi.userRoute}/${id}/change-username`
|
|
125
|
+
static userChangePasswordRoute = (id: IdType) =>
|
|
126
|
+
`${ServerApi.userRoute}/${id}/change-password`
|
|
127
|
+
static userDeleteRoute = (id: IdType) => `${ServerApi.userRoute}/${id}`
|
|
128
|
+
static userSetVerifiedRoute = (id: IdType) =>
|
|
129
|
+
`${ServerApi.userRoute}/${id}/set-verified`
|
|
130
|
+
static userSetRootUserRoute = (id: IdType) =>
|
|
131
|
+
`${ServerApi.userRoute}/${id}/set-root-user`
|
|
132
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ServerApi } from '@/backend/server.api'
|
|
2
|
+
import { BaseService } from '@/backend/base.service'
|
|
3
|
+
import {
|
|
4
|
+
FrontendSettings,
|
|
5
|
+
SettingsDto,
|
|
6
|
+
TimeoutSettings,
|
|
7
|
+
SettingsSensitiveDto
|
|
8
|
+
} from '@/models/settings/settings.model'
|
|
9
|
+
import { FileCleanSettings } from '@/models/settings/printer-file-clean-settings.model'
|
|
10
|
+
import { WhitelistSettings } from '@/models/settings/server-settings.dto'
|
|
11
|
+
|
|
12
|
+
export class SettingsService extends BaseService {
|
|
13
|
+
static async getSettings() {
|
|
14
|
+
const path = ServerApi.settingsRoute
|
|
15
|
+
return (await this.get(path)) as SettingsDto
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static async getSettingsSensitive() {
|
|
19
|
+
const path = ServerApi.settingsSensitiveRoute
|
|
20
|
+
return (await this.get(path)) as SettingsSensitiveDto
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static async updateLoginRequiredSettings(loginRequired: boolean) {
|
|
24
|
+
const path = `${ServerApi.updateLoginRequiredRoute}`
|
|
25
|
+
|
|
26
|
+
return (await this.put(path, { loginRequired })) as SettingsDto
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async updateRegistrationEnabledSettings(registrationEnabled: boolean) {
|
|
30
|
+
const path = `${ServerApi.updateRegistrationEnabledRoute}`
|
|
31
|
+
|
|
32
|
+
return (await this.put(path, { registrationEnabled })) as SettingsDto
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static async updateCredentialSettings(
|
|
36
|
+
jwtExpiresIn: number,
|
|
37
|
+
refreshTokenAttempts: number,
|
|
38
|
+
refreshTokenExpiry: number
|
|
39
|
+
) {
|
|
40
|
+
const path = `${ServerApi.updateCredentialSettings}`
|
|
41
|
+
|
|
42
|
+
return await this.put(path, {
|
|
43
|
+
jwtExpiresIn,
|
|
44
|
+
refreshTokenAttempts,
|
|
45
|
+
refreshTokenExpiry
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static async updateFrontendSettings(frontendSettings: FrontendSettings) {
|
|
50
|
+
const path = `${ServerApi.updateFrontendSettingsRoute}`
|
|
51
|
+
|
|
52
|
+
return (await this.put(
|
|
53
|
+
path,
|
|
54
|
+
frontendSettings as FrontendSettings
|
|
55
|
+
)) as SettingsDto
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static async setSentryDiagnosticsSettings(enabled: boolean) {
|
|
59
|
+
const path = `${ServerApi.serverSentryDiagnosticsSettingRoute}`
|
|
60
|
+
return await this.patch(path, { enabled })
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static async setWhitelistSettings(subSettings: WhitelistSettings) {
|
|
64
|
+
const path = `${ServerApi.updateServerWhitelistSettingRoute}`
|
|
65
|
+
|
|
66
|
+
await this.put(path, subSettings as WhitelistSettings)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static async updateTimeoutSettings(subSettings: TimeoutSettings) {
|
|
70
|
+
const path = `${ServerApi.updateTimeoutSettingRoute}`
|
|
71
|
+
|
|
72
|
+
return (await this.put(path, subSettings as TimeoutSettings)) as SettingsDto
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static async setFileCleanSettings(subSettings: FileCleanSettings) {
|
|
76
|
+
const path = `${ServerApi.fileCleanSettingsRoute}`
|
|
77
|
+
|
|
78
|
+
return (await this.put(path, subSettings)) as SettingsDto
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static async updateExperimentalMoonrakerSupport(enabled: boolean) {
|
|
82
|
+
const path = ServerApi.updateExperimentalMoonrakerSupportRoute
|
|
83
|
+
return (await this.put(path, { enabled })) as SettingsDto // Assuming it returns SettingsDto
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ServerApi } from '@/backend/server.api'
|
|
2
|
+
import { BaseService } from '@/backend/base.service'
|
|
3
|
+
import { Role, User } from '@/models/user.model'
|
|
4
|
+
|
|
5
|
+
export class UserService extends BaseService {
|
|
6
|
+
static async listUsers() {
|
|
7
|
+
const path = ServerApi.userRoute
|
|
8
|
+
|
|
9
|
+
return await this.get<User[]>(path)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static async listRoles() {
|
|
13
|
+
const path = ServerApi.rolesRoute
|
|
14
|
+
|
|
15
|
+
return await this.get<Role[]>(path)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static async getProfile() {
|
|
19
|
+
const path = ServerApi.userProfileRoute
|
|
20
|
+
return await this.get<User>(path)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static async changePassword(
|
|
24
|
+
id: string,
|
|
25
|
+
oldPassword: string,
|
|
26
|
+
newPassword: string
|
|
27
|
+
) {
|
|
28
|
+
const path = ServerApi.userChangePasswordRoute(id)
|
|
29
|
+
return await this.post(path, { oldPassword, newPassword })
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static async changeUsername(id: string, username: string) {
|
|
33
|
+
const path = ServerApi.userChangeUsernameRoute(id)
|
|
34
|
+
return await this.post(path, { username })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static async deleteUser(id: string) {
|
|
38
|
+
const path = ServerApi.userDeleteRoute(id)
|
|
39
|
+
return await this.delete(path)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static async setUserVerified(id: string, isVerified: boolean) {
|
|
43
|
+
const path = ServerApi.userSetVerifiedRoute(id)
|
|
44
|
+
return await this.post(path, { isVerified })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static async setRootUser(id: string, isRootUser: boolean) {
|
|
48
|
+
const path = ServerApi.userSetRootUserRoute(id)
|
|
49
|
+
return await this.post(path, { isRootUser })
|
|
50
|
+
}
|
|
51
|
+
}
|