Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
refactor(frontend/backend): move and rename `FileEditorProvider` to improve consistency
johaven36b322fc370a
diff --git a/backend/src/applications/files/modules/file-editor-providers.interface.ts b/backend/src/applications/files/modules/file-editor-providers.interface.tsnew file mode 100644index 00000000..6b9f407d--- /dev/null+++ b/backend/src/applications/files/modules/file-editor-providers.interface.ts@@ -0,0 +1,4 @@+export interface FileEditorProviders {+ collabora: boolean+ onlyoffice: boolean+}diff --git a/backend/src/applications/links/interfaces/link-space.interface.ts b/backend/src/applications/links/interfaces/link-space.interface.tsindex aa361100..e52e322d 100644--- a/backend/src/applications/links/interfaces/link-space.interface.ts+++ b/backend/src/applications/links/interfaces/link-space.interface.ts@@ -1,4 +1,4 @@-import type { FileEditorProvider } from '../../../configuration/config.interfaces'+import type { FileEditorProviders } from '../../files/modules/file-editor-providers.interface'export interface SpaceLink {share?: {@@ -13,5 +13,5 @@ export interface SpaceLink {} | nullspace?: { name: string; alias: string } | nullowner?: { login?: string; fullName: string; avatar?: string } | null- fileEditors?: FileEditorProvider+ fileEditors?: FileEditorProviders}diff --git a/backend/src/configuration/config.interfaces.ts b/backend/src/configuration/config.interfaces.tsindex a2f778a0..6563d3c9 100644--- a/backend/src/configuration/config.interfaces.ts+++ b/backend/src/configuration/config.interfaces.ts@@ -1,10 +1,7 @@-export interface FileEditorProvider {- collabora: boolean- onlyoffice: boolean-}+import type { FileEditorProviders } from '../applications/files/modules/file-editor-providers.interface'export interface ServerConfig {twoFaEnabled: booleanmailServerEnabled: boolean- fileEditors: FileEditorProvider+ fileEditors: FileEditorProviders}diff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.tsindex b23a92f5..4c4e28d0 100644--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts@@ -2,7 +2,7 @@ import { Component, computed, inject, Input, model, OnDestroy, OnInit, signal }import { FaIconComponent } from '@fortawesome/angular-fontawesome'import { faEye, faPen } from '@fortawesome/free-solid-svg-icons'import { FILE_MODE } from '@sync-in-server/backend/src/applications/files/constants/operations'-import type { FileEditorProvider } from '@sync-in-server/backend/src/configuration/config.interfaces'+import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/modules/file-editor-providers.interface'import { L10nTranslateDirective } from 'angular-l10n'import { Subscription } from 'rxjs'import { LayoutService } from '../../../../layout/layout.service'@@ -36,7 +36,7 @@ export class FilesViewerDialogComponent implements OnInit, OnDestroy {@Input({ required: true }) mode: FILE_MODE@Input({ required: true }) isWriteable: boolean@Input({ required: true }) hookedShortMime: string- @Input({ required: true }) editorProvider: FileEditorProvider+ @Input({ required: true }) editorProvider: FileEditorProvidersmodalClosing = signal<boolean>(false)protected isReadonly = model<boolean>(true)protected currentHeight: numberdiff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-select-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-viewer-select-dialog.component.tsindex be15ad05..45b0c1ea 100644--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-select-dialog.component.ts+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-select-dialog.component.ts@@ -3,7 +3,7 @@ import { FormsModule } from '@angular/forms'import { FaIconComponent } from '@fortawesome/angular-fontawesome'import { faFile, faFileLines, faFileWord } from '@fortawesome/free-regular-svg-icons'import { faArrowRight } from '@fortawesome/free-solid-svg-icons'-import type { FileEditorProvider } from '@sync-in-server/backend/src/configuration/config.interfaces'+import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/modules/file-editor-providers.interface'import { L10N_LOCALE, L10nLocale, L10nTranslateDirective } from 'angular-l10n'import { LayoutService } from '../../../../layout/layout.service'import { UserService } from '../../../users/user.service'@@ -17,14 +17,14 @@ import { FileModel } from '../../models/file.model'})export class FilesViewerSelectDialog {@Input({ required: true }) file: FileModel = null- @Input({ required: true }) editorProvider: FileEditorProvider+ @Input({ required: true }) editorProvider: FileEditorProvidersprotected rememberChoice = falseprotected readonly icons = { faFile, faFileWord, faArrowRight, faFileLines }protected readonly locale = inject<L10nLocale>(L10N_LOCALE)protected layout = inject(LayoutService)private readonly userService = inject(UserService)- selectEditor(editor: keyof FileEditorProvider) {+ selectEditor(editor: keyof FileEditorProviders) {if (this.rememberChoice) {this.userService.setEditorProviderPreference(editor)}diff --git a/frontend/src/app/applications/files/models/file.model.ts b/frontend/src/app/applications/files/models/file.model.tsindex cfd9f15a..40bb01e4 100644--- a/frontend/src/app/applications/files/models/file.model.ts+++ b/frontend/src/app/applications/files/models/file.model.ts@@ -5,11 +5,11 @@ import {} from '@sync-in-server/backend/src/applications/files/constants/routes'import type { FileLockProps, FileProps } from '@sync-in-server/backend/src/applications/files/interfaces/file-props.interface'import { COLLABORA_ONLINE_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/modules/collabora-online/collabora-online.constants'+import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/modules/file-editor-providers.interface'import { ONLY_OFFICE_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/modules/only-office/only-office.constants'import type { File } from '@sync-in-server/backend/src/applications/files/schemas/file.interface'import { SPACE_OPERATION } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'import { currentTimeStamp, popFromObject } from '@sync-in-server/backend/src/common/shared'-import type { FileEditorProvider } from '@sync-in-server/backend/src/configuration/config.interfaces'import type { Observable } from 'rxjs'import { convertBytesToText, getNewly } from '../../../common/utils/functions'import { dJs } from '../../../common/utils/time'@@ -83,7 +83,7 @@ export class FileModel implements File {canBeReShared = falsehaveThumbnail = false- constructor(props: FileProps | File, basePath: string, inShare = false, editorConfig: FileEditorProvider) {+ constructor(props: FileProps | File, basePath: string, inShare = false, editorConfig: FileEditorProviders) {this.setShares(popFromObject('shares', props))Object.assign(this, props)this.path = `${basePath}/${this.path !== '.' ? `${this.path}/` : ''}${this.root?.alias || this.name}`@@ -143,7 +143,7 @@ export class FileModel implements File {return this.isDir ? (inShare ? mimeDirectoryShare : mimeDirectory) : mimeFile}- private getMime(mime: string, inShare: boolean, editorConfig: FileEditorProvider): string {+ private getMime(mime: string, inShare: boolean, editorConfig: FileEditorProviders): string {if (this.isDir) {this.isViewable = falsereturn this.getType(inShare)diff --git a/frontend/src/app/applications/files/services/files.service.ts b/frontend/src/app/applications/files/services/files.service.tsindex b68d72d1..caa17218 100644--- a/frontend/src/app/applications/files/services/files.service.ts+++ b/frontend/src/app/applications/files/services/files.service.ts@@ -24,13 +24,13 @@ import type { FileLockProps } from '@sync-in-server/backend/src/applications/filimport type { FileTree } from '@sync-in-server/backend/src/applications/files/interfaces/file-tree.interface'import type { FileTask } from '@sync-in-server/backend/src/applications/files/models/file-task'import { COLLABORA_ONLINE_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/modules/collabora-online/collabora-online.constants'+import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/modules/file-editor-providers.interface'import { ONLY_OFFICE_EXTENSIONS } from '@sync-in-server/backend/src/applications/files/modules/only-office/only-office.constants'import type { FileContent } from '@sync-in-server/backend/src/applications/files/schemas/file-content.interface'import type { FileRecent } from '@sync-in-server/backend/src/applications/files/schemas/file-recent.interface'import { API_SPACES_TREE } from '@sync-in-server/backend/src/applications/spaces/constants/routes'import { SPACE_OPERATION } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'import { forbiddenChars, isValidFileName } from '@sync-in-server/backend/src/common/shared'-import type { FileEditorProvider } from '@sync-in-server/backend/src/configuration/config.interfaces'import { BsModalRef } from 'ngx-bootstrap/modal'import { EMPTY, firstValueFrom, map, Observable, Subject } from 'rxjs'import { downloadWithAnchor } from '../../../common/utils/functions'@@ -270,7 +270,7 @@ export class FilesService {})}- async openSelectViewerDialog(file: FileModel, editorProvider: FileEditorProvider): Promise<void> {+ async openSelectViewerDialog(file: FileModel, editorProvider: FileEditorProviders): Promise<void> {const modalRef: BsModalRef<FilesViewerSelectDialog> = this.layout.openDialog(FilesViewerSelectDialog, null, {initialState: { file, editorProvider } as FilesViewerSelectDialog})@@ -305,7 +305,7 @@ export class FilesService {return}- const editorProvider: FileEditorProvider = { collabora: false, onlyoffice: false }+ const editorProvider: FileEditorProviders = { collabora: false, onlyoffice: false }if (hookedShortMime === SHORT_MIME.DOCUMENT) {if (this.store.server().fileEditors.collabora && this.store.server().fileEditors.onlyoffice) {// Case with multiple editorsdiff --git a/frontend/src/app/applications/users/components/user-account.component.ts b/frontend/src/app/applications/users/components/user-account.component.tsindex 6412a657..49a3695a 100644--- a/frontend/src/app/applications/users/components/user-account.component.ts+++ b/frontend/src/app/applications/users/components/user-account.component.ts@@ -5,13 +5,13 @@ import { FormsModule } from '@angular/forms'import { FaIconComponent } from '@fortawesome/angular-fontawesome'import { faCopy, faKey } from '@fortawesome/free-solid-svg-icons'import { COLLABORA_APP_LOCK } from '@sync-in-server/backend/src/applications/files/modules/collabora-online/collabora-online.constants'+import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/modules/file-editor-providers.interface'import { ONLY_OFFICE_APP_LOCK } from '@sync-in-server/backend/src/applications/files/modules/only-office/only-office.constants'import { USER_PASSWORD_MIN_LENGTH } from '@sync-in-server/backend/src/applications/users/constants/user'import { UserAppPassword } from '@sync-in-server/backend/src/applications/users/interfaces/user-secrets.interface'import { WEBDAV_BASE_PATH } from '@sync-in-server/backend/src/applications/webdav/constants/routes'import { TWO_FA_HEADER_CODE, TWO_FA_HEADER_PASSWORD } from '@sync-in-server/backend/src/authentication/constants/auth'import type { TwoFaSetup } from '@sync-in-server/backend/src/authentication/providers/two-fa/auth-two-fa.interfaces'-import type { FileEditorProvider } from '@sync-in-server/backend/src/configuration/config.interfaces'import { L10N_LOCALE, L10nLocale, L10nTranslateDirective, L10nTranslatePipe } from 'angular-l10n'import { BsModalRef } from 'ngx-bootstrap/modal'import { ClipboardService } from 'ngx-clipboard'@@ -59,7 +59,7 @@ export class UserAccountComponent implements OnDestroy {protected readonly allOnlineStatus = USER_ONLINE_STATUS_LISTprotected readonly passwordMinLength = USER_PASSWORD_MIN_LENGTHprotected readonly icons = { faCopy, faKey }- protected readonly editors: Record<string, keyof FileEditorProvider> = {+ protected readonly editors: Record<string, keyof FileEditorProviders> = {[COLLABORA_APP_LOCK]: 'collabora',[ONLY_OFFICE_APP_LOCK]: 'onlyoffice'}@@ -71,7 +71,7 @@ export class UserAccountComponent implements OnDestroy {protected newPassword: stringprotected readonly store = inject(StoreService)protected showEditorPreference = false- protected userEditorPreference: keyof FileEditorProvider+ protected userEditorPreference: keyof FileEditorProvidersprotected readonly originalOrderKeyValue = originalOrderKeyValueprivate readonly layout = inject(LayoutService)protected languages = this.layout.getLanguages(true)@@ -182,7 +182,7 @@ export class UserAccountComponent implements OnDestroy {this.layout.sendNotification('info', 'Link copied', this.webdavUrl)}- updateEditorPreference(preference: keyof FileEditorProvider | null) {+ updateEditorPreference(preference: keyof FileEditorProviders | null) {this.userService.setEditorProviderPreference(preference)}diff --git a/frontend/src/app/applications/users/user.service.ts b/frontend/src/app/applications/users/user.service.tsindex d4dda323..d98c5ebf 100644--- a/frontend/src/app/applications/users/user.service.ts+++ b/frontend/src/app/applications/users/user.service.ts@@ -1,5 +1,6 @@import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http'import { inject, Injectable } from '@angular/core'+import type { FileEditorProviders } from '@sync-in-server/backend/src/applications/files/modules/file-editor-providers.interface'import { NOTIFICATIONS_WS } from '@sync-in-server/backend/src/applications/notifications/constants/websocket'import { SPACE_OPERATION } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'import { SYNC_ROUTE } from '@sync-in-server/backend/src/applications/sync/constants/routes'@@ -50,7 +51,6 @@ import type {TwoFaSetup,TwoFaVerifyResult} from '@sync-in-server/backend/src/authentication/providers/two-fa/auth-two-fa.interfaces'-import type { FileEditorProvider } from '@sync-in-server/backend/src/configuration/config.interfaces'import { BsModalRef } from 'ngx-bootstrap/modal'import { Socket } from 'ngx-socket-io'import { catchError, map, Observable } from 'rxjs'@@ -284,11 +284,11 @@ export class UserService {})}- getEditorProviderPreference(): keyof FileEditorProvider {- return localStorage.getItem('editorPreference') as keyof FileEditorProvider+ getEditorProviderPreference(): keyof FileEditorProviders {+ return localStorage.getItem('editorPreference') as keyof FileEditorProviders}- setEditorProviderPreference(editorProvider: keyof FileEditorProvider) {+ setEditorProviderPreference(editorProvider: keyof FileEditorProviders) {if (editorProvider === null) {localStorage.removeItem('editorPreference')} else {