feat: Markdown, Rich text, Code, and Checklist note types have been moved to the new Plugins preferences pane. Previous notes created using these types will not experience any disruption. To create new notes using these types, you can reinstall them from the Plugins preferences screen. It is recommended to use the Super note type in place of these replaced note types. (#2630)

This commit is contained in:
Mo
2023-11-29 10:18:55 -06:00
committed by GitHub
parent bd971d5473
commit c43b593c60
58 changed files with 1106 additions and 680 deletions

View File

@@ -18,16 +18,13 @@ import {
AlertService,
ApiServiceEvent,
API_MESSAGE_FAILED_OFFLINE_ACTIVATION,
API_MESSAGE_UNTRUSTED_EXTENSIONS_WARNING,
ApplicationStage,
ButtonType,
FeaturesClientInterface,
FeaturesEvent,
FeatureStatus,
InternalEventBusInterface,
InternalEventHandlerInterface,
InternalEventInterface,
INVALID_EXTENSION_URL,
MetaReceivedData,
OfflineSubscriptionEntitlements,
SetOfflineFeaturesFunctionResponse,
@@ -49,7 +46,6 @@ import {
WebSocketsService,
} from '@standardnotes/services'
import { DownloadRemoteThirdPartyFeatureUseCase } from './UseCase/DownloadRemoteThirdPartyFeature'
import { MigrateFeatureRepoToOfflineEntitlementsUseCase } from './UseCase/MigrateFeatureRepoToOfflineEntitlements'
import { GetFeatureStatusUseCase } from './UseCase/GetFeatureStatus'
import { SettingsClientInterface } from '../Settings/SettingsClientInterface'
@@ -66,16 +62,6 @@ export class FeaturesService
private getFeatureStatusUseCase = new GetFeatureStatusUseCase(this.items)
private readonly TRUSTED_FEATURE_HOSTS = [
'api.standardnotes.com',
'extensions.standardnotes.com',
'extensions.standardnotes.org',
'features.standardnotes.com',
'localhost',
]
private readonly TRUSTED_CUSTOM_EXTENSIONS_HOSTS = ['listed.to']
private readonly PROD_OFFLINE_FEATURES_URL = 'https://api.standardnotes.com/v1/offline/features'
constructor(
@@ -304,7 +290,6 @@ export class FeaturesService
private async downloadOfflineRoles(repo: SNFeatureRepo): Promise<SetOfflineFeaturesFunctionResponse> {
const result = await this.api.downloadOfflineFeaturesFromRepo({
repo,
trustedFeatureHosts: this.TRUSTED_FEATURE_HOSTS,
})
if (result instanceof ClientDisplayableError) {
@@ -449,41 +434,6 @@ export class FeaturesService
})
}
public async downloadRemoteThirdPartyFeature(urlOrCode: string): Promise<ComponentInterface | undefined> {
let url = urlOrCode
try {
url = this.crypto.base64Decode(urlOrCode)
} catch (err) {
void err
}
try {
const trustedCustomExtensionsUrls = [...this.TRUSTED_FEATURE_HOSTS, ...this.TRUSTED_CUSTOM_EXTENSIONS_HOSTS]
const { host } = new URL(url)
const usecase = new DownloadRemoteThirdPartyFeatureUseCase(this.api, this.items, this.alerts)
if (!trustedCustomExtensionsUrls.includes(host)) {
const didConfirm = await this.alerts.confirm(
API_MESSAGE_UNTRUSTED_EXTENSIONS_WARNING,
'Install extension from an untrusted source?',
'Proceed to install',
ButtonType.Danger,
'Cancel',
)
if (didConfirm) {
return usecase.execute(url)
}
} else {
return usecase.execute(url)
}
} catch (err) {
void this.alerts.alert(INVALID_EXTENSION_URL)
}
return undefined
}
override deinit(): void {
super.deinit()
;(this.onlineRoles as unknown) = undefined