feat: remove batch manager
This commit is contained in:
@@ -9,7 +9,6 @@ SECRET_KEY_BASE=test
|
|||||||
APP_HOST=http://localhost:3001
|
APP_HOST=http://localhost:3001
|
||||||
|
|
||||||
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
||||||
BATCH_MANAGER_LOCATION=extensions/batch-manager/dist/index.min.html
|
|
||||||
SF_DEFAULT_SERVER=http://localhost:3000
|
SF_DEFAULT_SERVER=http://localhost:3000
|
||||||
SF_NEXT_VERSION_SERVER=http://localhost:3000
|
SF_NEXT_VERSION_SERVER=http://localhost:3000
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ SF_NEXT_VERSION_SERVER=http://localhost:3000
|
|||||||
DEV_DEFAULT_SYNC_SERVER=https://sync.standardnotes.org
|
DEV_DEFAULT_SYNC_SERVER=https://sync.standardnotes.org
|
||||||
DEV_NEXT_VERSION_SYNC_SERVER=https://api.standardnotes.com
|
DEV_NEXT_VERSION_SYNC_SERVER=https://api.standardnotes.com
|
||||||
DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html
|
DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html
|
||||||
DEV_BATCH_MANAGER_LOCATION=public/extensions/batch-manager/dist/index.min.html
|
|
||||||
|
|
||||||
# NewRelic (Optional)
|
# NewRelic (Optional)
|
||||||
NEW_RELIC_ENABLED=false
|
NEW_RELIC_ENABLED=false
|
||||||
|
|||||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -7,6 +7,4 @@
|
|||||||
[submodule "public/extensions/extensions-manager"]
|
[submodule "public/extensions/extensions-manager"]
|
||||||
path = public/extensions/extensions-manager
|
path = public/extensions/extensions-manager
|
||||||
url = https://github.com/sn-extensions/extensions-manager.git
|
url = https://github.com/sn-extensions/extensions-manager.git
|
||||||
[submodule "public/extensions/batch-manager"]
|
|
||||||
path = public/extensions/batch-manager
|
|
||||||
url = https://github.com/sn-extensions/batch-manager.git
|
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ The web app makes use of two optional native extensions, which, when running the
|
|||||||
1. Set the following environment variables in the .env file:
|
1. Set the following environment variables in the .env file:
|
||||||
```
|
```
|
||||||
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
||||||
BATCH_MANAGER_LOCATION=extensions/batch-manager/dist/index.min.html
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also set the `SF_DEFAULT_SERVER` and `SF_NEXT_VERSION_SERVER` environment variables to set the default servers for login and registration.
|
You can also set the `SF_DEFAULT_SERVER` and `SF_NEXT_VERSION_SERVER` environment variables to set the default servers for login and registration.
|
||||||
|
|||||||
@@ -8,15 +8,12 @@ import {
|
|||||||
FillItemContent,
|
FillItemContent,
|
||||||
ComponentMutator,
|
ComponentMutator,
|
||||||
Copy,
|
Copy,
|
||||||
dictToArray
|
PayloadContent,
|
||||||
, PayloadContent , ComponentPermission } from '@standardnotes/snjs';
|
ComponentPermission } from '@standardnotes/snjs';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** A class for handling installation of system extensions */
|
/** A class for handling installation of system extensions */
|
||||||
export class NativeExtManager extends ApplicationService {
|
export class NativeExtManager extends ApplicationService {
|
||||||
extManagerId = 'org.standardnotes.extensions-manager';
|
extManagerId = 'org.standardnotes.extensions-manager';
|
||||||
batchManagerId = 'org.standardnotes.batch-manager';
|
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
async onAppLaunch() {
|
async onAppLaunch() {
|
||||||
@@ -32,14 +29,6 @@ export class NativeExtManager extends ApplicationService {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
get batchManagerPred() {
|
|
||||||
const batchMgrId = 'org.standardnotes.batch-manager';
|
|
||||||
return SNPredicate.CompoundPredicate([
|
|
||||||
new SNPredicate('content_type', '=', ContentType.Component),
|
|
||||||
new SNPredicate('package_info.identifier', '=', batchMgrId)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
get extMgrUrl() {
|
get extMgrUrl() {
|
||||||
return (window as any)._extensions_manager_location;
|
return (window as any)._extensions_manager_location;
|
||||||
}
|
}
|
||||||
@@ -50,9 +39,7 @@ export class NativeExtManager extends ApplicationService {
|
|||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
this.application!.singletonManager!.registerPredicate(this.extManagerPred);
|
this.application!.singletonManager!.registerPredicate(this.extManagerPred);
|
||||||
this.application!.singletonManager!.registerPredicate(this.batchManagerPred);
|
|
||||||
this.resolveExtensionsManager();
|
this.resolveExtensionsManager();
|
||||||
this.resolveBatchManager();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async resolveExtensionsManager() {
|
async resolveExtensionsManager() {
|
||||||
@@ -132,75 +119,4 @@ export class NativeExtManager extends ApplicationService {
|
|||||||
}
|
}
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
async resolveBatchManager() {
|
|
||||||
const batchManager = (await this.application!.singletonManager!.findOrCreateSingleton(
|
|
||||||
this.batchManagerPred,
|
|
||||||
ContentType.Component,
|
|
||||||
this.batchManagerTemplateContent()
|
|
||||||
)) as SNComponent;
|
|
||||||
let needsSync = false;
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
if (!batchManager.local_url) {
|
|
||||||
await this.application!.changeItem(batchManager.uuid, (m) => {
|
|
||||||
const mutator = m as ComponentMutator;
|
|
||||||
mutator.local_url = this.batchMgrUrl;
|
|
||||||
});
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!batchManager.hosted_url) {
|
|
||||||
await this.application!.changeItem(batchManager.uuid, (m) => {
|
|
||||||
const mutator = m as ComponentMutator;
|
|
||||||
mutator.hosted_url = this.batchMgrUrl;
|
|
||||||
});
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle addition of SN|ExtensionRepo permission
|
|
||||||
const permissions = Copy(batchManager!.permissions) as ComponentPermission[];
|
|
||||||
const permission = permissions.find((p) => {
|
|
||||||
return p.name === ComponentAction.StreamItems;
|
|
||||||
});
|
|
||||||
if (permission && !permission.content_types!.includes(ContentType.ExtensionRepo)) {
|
|
||||||
permission.content_types!.push(ContentType.ExtensionRepo);
|
|
||||||
await this.application!.changeItem(batchManager.uuid, (m) => {
|
|
||||||
const mutator = m as ComponentMutator;
|
|
||||||
mutator.permissions = permissions;
|
|
||||||
});
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
if (needsSync) {
|
|
||||||
this.application!.saveItem(batchManager.uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
batchManagerTemplateContent() {
|
|
||||||
const url = this.batchMgrUrl;
|
|
||||||
if (!url) {
|
|
||||||
throw Error('window._batch_manager_location must be set.');
|
|
||||||
}
|
|
||||||
const packageInfo = {
|
|
||||||
name: 'Batch Manager',
|
|
||||||
identifier: this.batchManagerId
|
|
||||||
};
|
|
||||||
const allContentType = dictToArray(ContentType);
|
|
||||||
const content = FillItemContent({
|
|
||||||
name: packageInfo.name,
|
|
||||||
area: 'modal',
|
|
||||||
package_info: packageInfo,
|
|
||||||
permissions: [
|
|
||||||
{
|
|
||||||
name: ComponentAction.StreamItems,
|
|
||||||
content_types: allContentType
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
content.local_url = this.batchMgrUrl;
|
|
||||||
} else {
|
|
||||||
content.hosted_url = this.batchMgrUrl;
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,11 +213,6 @@ export class WebApplication extends SNApplication {
|
|||||||
|
|
||||||
async openModalComponent(component: SNComponent): Promise<void> {
|
async openModalComponent(component: SNComponent): Promise<void> {
|
||||||
switch (component.package_info?.identifier) {
|
switch (component.package_info?.identifier) {
|
||||||
case 'org.standardnotes.batch-manager':
|
|
||||||
if (!await this.authorizeBatchManagerAccess()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'org.standardnotes.cloudlink':
|
case 'org.standardnotes.cloudlink':
|
||||||
if (!await this.authorizeCloudLinkAccess()) {
|
if (!await this.authorizeCloudLinkAccess()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -32,14 +32,12 @@
|
|||||||
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
|
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
|
||||||
data-next-version-sync-server="<%= env.DEV_NEXT_VERSION_SYNC_SERVER %>"
|
data-next-version-sync-server="<%= env.DEV_NEXT_VERSION_SYNC_SERVER %>"
|
||||||
data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>"
|
data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>"
|
||||||
data-batch-manager-location="<%= env.DEV_BATCH_MANAGER_LOCATION %>"
|
|
||||||
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
|
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
|
||||||
>
|
>
|
||||||
<script>
|
<script>
|
||||||
window._default_sync_server = document.body.dataset.defaultSyncServer || "https://sync.standardnotes.org";
|
window._default_sync_server = document.body.dataset.defaultSyncServer || "https://sync.standardnotes.org";
|
||||||
window._next_version_sync_server = document.body.dataset.nextVersionSyncServer || "https://api.standardnotes.com";
|
window._next_version_sync_server = document.body.dataset.nextVersionSyncServer || "https://api.standardnotes.com";
|
||||||
window._extensions_manager_location = document.body.dataset.extensionsManagerLocation || "public/extensions/extensions-manager/dist/index.html";
|
window._extensions_manager_location = document.body.dataset.extensionsManagerLocation || "public/extensions/extensions-manager/dist/index.html";
|
||||||
window._batch_manager_location = document.body.dataset.batchManagerLocation || "public/extensions/batch-manager/dist/index.min.html";
|
|
||||||
window._bugsnag_api_key = document.body.dataset.bugsnagApiKey;
|
window._bugsnag_api_key = document.body.dataset.bugsnagApiKey;
|
||||||
</script>
|
</script>
|
||||||
<application-group-view />
|
<application-group-view />
|
||||||
|
|||||||
Submodule public/extensions/batch-manager deleted from 2d1ba6ac9f
Reference in New Issue
Block a user