feat: New one-click Home Server, now in Labs. Launch your own self-hosted server instance with just 1 click from the Preferences window. (#2645)

This commit is contained in:
Karol Sójko
2023-11-30 18:31:45 +01:00
committed by GitHub
parent a928bcf359
commit 17039cbb80
321 changed files with 3758 additions and 205 deletions

View File

@@ -1,8 +1,11 @@
import { DecryptedItemInterface } from '@standardnotes/models'
import { FeatureStatus } from './FeatureStatus'
import { SetOfflineFeaturesFunctionResponse } from './SetOfflineFeaturesFunctionResponse'
import { NativeFeatureIdentifier } from '@standardnotes/features'
import { RoleName, Uuid } from '@standardnotes/domain-core'
import { ClientDisplayableError } from '@standardnotes/responses'
import { FeatureStatus } from './FeatureStatus'
import { SetOfflineFeaturesFunctionResponse } from './SetOfflineFeaturesFunctionResponse'
import { OfflineSubscriptionEntitlements } from './OfflineSubscriptionEntitlements'
export interface FeaturesClientInterface {
getFeatureStatus(
@@ -12,6 +15,7 @@ export interface FeaturesClientInterface {
hasMinimumRole(role: string): boolean
hasRole(roleName: RoleName): boolean
hasFirstPartyOfflineSubscription(): boolean
parseOfflineEntitlementsCode(code: string): OfflineSubscriptionEntitlements | ClientDisplayableError
setOfflineFeaturesCode(code: string): Promise<SetOfflineFeaturesFunctionResponse>
hasOfflineRepo(): boolean
deleteOfflineFeatureRepo(): Promise<void>

View File

@@ -1,4 +1,5 @@
export type OfflineSubscriptionEntitlements = {
featuresUrl: string
extensionKey: string
subscriptionId: number
}

View File

@@ -4,7 +4,7 @@ export interface HomeServerManagerInterface {
getHomeServerConfiguration(): Promise<string | undefined>
setHomeServerDataLocation(location: string): Promise<void>
stopHomeServer(): Promise<string | undefined>
activatePremiumFeatures(username: string): Promise<string | undefined>
activatePremiumFeatures(username: string, subscriptionId: number): Promise<string | undefined>
getHomeServerLogs(): Promise<string[]>
isHomeServerRunning(): Promise<boolean>
getHomeServerUrl(): Promise<string | undefined>

View File

@@ -82,8 +82,8 @@ export class HomeServerService
return this.desktopDevice.isHomeServerRunning()
}
async activatePremiumFeatures(username: string): Promise<Result<string>> {
const result = await this.desktopDevice.activatePremiumFeatures(username)
async activatePremiumFeatures(username: string, subscriptionId: number): Promise<Result<string>> {
const result = await this.desktopDevice.activatePremiumFeatures(username, subscriptionId)
if (result !== undefined) {
return Result.fail(result)

View File

@@ -4,7 +4,7 @@ import { HomeServerEnvironmentConfiguration } from './HomeServerEnvironmentConfi
import { HomeServerStatus } from './HomeServerStatus'
export interface HomeServerServiceInterface {
activatePremiumFeatures(username: string): Promise<Result<string>>
activatePremiumFeatures(username: string, subscriptionId: number): Promise<Result<string>>
isHomeServerRunning(): Promise<boolean>
isHomeServerEnabled(): Promise<boolean>
getHomeServerDataLocation(): Promise<string | undefined>

View File

@@ -1,4 +1,3 @@
export enum InternalFeature {
Vaults = 'vaults',
HomeServer = 'home-server',
}

View File

@@ -48,7 +48,7 @@ export const API_MESSAGE_UNTRUSTED_EXTENSIONS_WARNING = `The extension you are a
export const API_MESSAGE_FAILED_DOWNLOADING_EXTENSION = `Error downloading package details. Please check the
extension link and try again.`
export const API_MESSAGE_FAILED_OFFLINE_ACTIVATION =
'An unknown issue occurred during offline activation. Please try again.'
'An unknown issue occurred during offline activation. Please download your activation code again and try once more.'
export const INVALID_EXTENSION_URL = 'Invalid extension URL.'