mirror of
https://github.com/standardnotes/app.git
synced 2026-01-11 19:56:41 +00:00
feat: remove extensions manager (#696)
* feat: remove extensions manager * fix: remove unused code Co-authored-by: Aman Harwara <amanharwara@protonmail.com>
This commit is contained in:
parent
e79811afda
commit
8d9b192b81
17 changed files with 12 additions and 332 deletions
|
|
@ -9,12 +9,10 @@ SECRET_KEY_BASE=test
|
||||||
APP_HOST=http://localhost:3001
|
APP_HOST=http://localhost:3001
|
||||||
PURCHASE_URL=https://standardnotes.com/purchase
|
PURCHASE_URL=https://standardnotes.com/purchase
|
||||||
|
|
||||||
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
|
||||||
SF_DEFAULT_SERVER=http://localhost:3000
|
SF_DEFAULT_SERVER=http://localhost:3000
|
||||||
|
|
||||||
# Development options
|
# Development options
|
||||||
DEV_DEFAULT_SYNC_SERVER=https://api.standardnotes.com
|
DEV_DEFAULT_SYNC_SERVER=https://api.standardnotes.com
|
||||||
DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html
|
|
||||||
ENABLE_UNFINISHED_FEATURES=false
|
ENABLE_UNFINISHED_FEATURES=false
|
||||||
DEV_WEBSOCKET_URL=wss://sockets-dev.standardnotes.com
|
DEV_WEBSOCKET_URL=wss://sockets-dev.standardnotes.com
|
||||||
|
|
||||||
|
|
|
||||||
3
.github/workflows/beta.yml
vendored
3
.github/workflows/beta.yml
vendored
|
|
@ -31,9 +31,6 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Initiate submodules
|
|
||||||
run: git submodule update --init
|
|
||||||
|
|
||||||
- name: Publish to Registry
|
- name: Publish to Registry
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
uses: elgohr/Publish-Docker-Github-Action@master
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
3
.github/workflows/dev.yml
vendored
3
.github/workflows/dev.yml
vendored
|
|
@ -35,9 +35,6 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Initiate submodules
|
|
||||||
run: git submodule update --init
|
|
||||||
|
|
||||||
- name: Publish to Registry
|
- name: Publish to Registry
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
uses: elgohr/Publish-Docker-Github-Action@master
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
3
.github/workflows/prod.yml
vendored
3
.github/workflows/prod.yml
vendored
|
|
@ -35,9 +35,6 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Initiate submodules
|
|
||||||
run: git submodule update --init
|
|
||||||
|
|
||||||
- name: Publish to Registry
|
- name: Publish to Registry
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
uses: elgohr/Publish-Docker-Github-Action@master
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
10
.gitmodules
vendored
10
.gitmodules
vendored
|
|
@ -1,10 +0,0 @@
|
||||||
[submodule "vendor/extensions/extensions-manager"]
|
|
||||||
path = vendor/extensions/extensions-manager
|
|
||||||
url = https://github.com/sn-extensions/extensions-manager.git
|
|
||||||
[submodule "app/extensions/extensions-manager"]
|
|
||||||
path = app/extensions/extensions-manager
|
|
||||||
url = https://github.com/sn-extensions/extensions-manager.git
|
|
||||||
[submodule "public/extensions/extensions-manager"]
|
|
||||||
path = public/extensions/extensions-manager
|
|
||||||
url = https://github.com/sn-extensions/extensions-manager.git
|
|
||||||
|
|
||||||
|
|
@ -107,6 +107,8 @@ GEM
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.11.1-x64-mingw32)
|
nokogiri (1.11.1-x64-mingw32)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
|
nokogiri (1.11.1-x86_64-darwin)
|
||||||
|
racc (~> 1.4)
|
||||||
non-stupid-digest-assets (1.0.9)
|
non-stupid-digest-assets (1.0.9)
|
||||||
sprockets (>= 2.0)
|
sprockets (>= 2.0)
|
||||||
puma (4.3.5)
|
puma (4.3.5)
|
||||||
|
|
@ -200,6 +202,7 @@ GEM
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
x64-mingw32
|
x64-mingw32
|
||||||
|
x86_64-darwin-18
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
byebug
|
byebug
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -97,16 +97,6 @@ Then open your browser to `http://localhost:3001`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Extensions Manager and Batch Manager:**
|
|
||||||
|
|
||||||
The web app makes use of two optional native extensions, which, when running the app with Rails, can be configured to work as follows:
|
|
||||||
|
|
||||||
1. `git submodule update --init` (will load the submodules in the `public/extensions` folder)
|
|
||||||
1. Set the following environment variables in the .env file:
|
|
||||||
```
|
|
||||||
EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also set the `SF_DEFAULT_SERVER` environment variable to set the default server for login and registration.
|
You can also set the `SF_DEFAULT_SERVER` environment variable to set the default server for login and registration.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
||||||
import { isDesktopApplication } from '@/utils';
|
|
||||||
import {
|
|
||||||
SNPredicate,
|
|
||||||
ContentType,
|
|
||||||
SNComponent,
|
|
||||||
ApplicationService,
|
|
||||||
ComponentAction,
|
|
||||||
FillItemContent,
|
|
||||||
ComponentMutator,
|
|
||||||
Copy,
|
|
||||||
PayloadContent,
|
|
||||||
ComponentPermission } from '@standardnotes/snjs';
|
|
||||||
|
|
||||||
/** A class for handling installation of system extensions */
|
|
||||||
export class NativeExtManager extends ApplicationService {
|
|
||||||
extManagerId = 'org.standardnotes.extensions-manager';
|
|
||||||
|
|
||||||
/** @override */
|
|
||||||
async onAppLaunch() {
|
|
||||||
super.onAppLaunch();
|
|
||||||
this.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
get extManagerPred() {
|
|
||||||
const extManagerId = 'org.standardnotes.extensions-manager';
|
|
||||||
return SNPredicate.CompoundPredicate([
|
|
||||||
new SNPredicate('content_type', '=', ContentType.Component),
|
|
||||||
new SNPredicate('package_info.identifier', '=', extManagerId)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
get extMgrUrl() {
|
|
||||||
return (window as any)._extensions_manager_location;
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
this.application!.singletonManager!.registerPredicate(this.extManagerPred);
|
|
||||||
this.resolveExtensionsManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
async resolveExtensionsManager() {
|
|
||||||
const extensionsManager = (await this.application!.singletonManager!.findOrCreateSingleton(
|
|
||||||
this.extManagerPred,
|
|
||||||
ContentType.Component,
|
|
||||||
this.extensionsManagerTemplateContent()
|
|
||||||
)) as SNComponent;
|
|
||||||
let needsSync = false;
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
if (!extensionsManager.local_url) {
|
|
||||||
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
|
||||||
const mutator = m as ComponentMutator;
|
|
||||||
mutator.local_url = this.extMgrUrl;
|
|
||||||
});
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!extensionsManager.hosted_url) {
|
|
||||||
await this.application!.changeItem(extensionsManager.uuid, (m) => {
|
|
||||||
const mutator = m as ComponentMutator;
|
|
||||||
mutator.hosted_url = this.extMgrUrl;
|
|
||||||
});
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Handle addition of SN|ExtensionRepo permission
|
|
||||||
const permissions = Copy(extensionsManager!.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(extensionsManager.uuid, (m) => {
|
|
||||||
const mutator = m as ComponentMutator;
|
|
||||||
mutator.permissions = permissions;
|
|
||||||
});
|
|
||||||
needsSync = true;
|
|
||||||
}
|
|
||||||
if (needsSync) {
|
|
||||||
this.application!.saveItem(extensionsManager.uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extensionsManagerTemplateContent() {
|
|
||||||
const url = this.extMgrUrl;
|
|
||||||
if (!url) {
|
|
||||||
throw Error('this.extMgrUrl must be set.');
|
|
||||||
}
|
|
||||||
const packageInfo = {
|
|
||||||
name: 'Extensions',
|
|
||||||
identifier: this.extManagerId
|
|
||||||
};
|
|
||||||
const content = FillItemContent({
|
|
||||||
name: packageInfo.name,
|
|
||||||
area: 'rooms',
|
|
||||||
package_info: packageInfo,
|
|
||||||
permissions: [
|
|
||||||
{
|
|
||||||
name: ComponentAction.StreamItems,
|
|
||||||
content_types: [
|
|
||||||
ContentType.Component,
|
|
||||||
ContentType.Theme,
|
|
||||||
ContentType.ServerExtension,
|
|
||||||
ContentType.ActionsExtension,
|
|
||||||
ContentType.Mfa,
|
|
||||||
ContentType.Editor,
|
|
||||||
ContentType.ExtensionRepo
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}) as PayloadContent;
|
|
||||||
if (isDesktopApplication()) {
|
|
||||||
content.local_url = this.extMgrUrl;
|
|
||||||
} else {
|
|
||||||
content.hosted_url = this.extMgrUrl;
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -21,7 +21,6 @@ import { AutolockService } from '@/services/autolock_service';
|
||||||
import { ArchiveManager } from '@/services/archiveManager';
|
import { ArchiveManager } from '@/services/archiveManager';
|
||||||
import { DesktopManager } from '@/services/desktopManager';
|
import { DesktopManager } from '@/services/desktopManager';
|
||||||
import { IOService } from '@/services/ioService';
|
import { IOService } from '@/services/ioService';
|
||||||
import { NativeExtManager } from '@/services/nativeExtManager';
|
|
||||||
import { StatusManager } from '@/services/statusManager';
|
import { StatusManager } from '@/services/statusManager';
|
||||||
import { ThemeManager } from '@/services/themeManager';
|
import { ThemeManager } from '@/services/themeManager';
|
||||||
import { AppVersion } from '@/version';
|
import { AppVersion } from '@/version';
|
||||||
|
|
@ -32,7 +31,6 @@ type WebServices = {
|
||||||
desktopService: DesktopManager;
|
desktopService: DesktopManager;
|
||||||
autolockService: AutolockService;
|
autolockService: AutolockService;
|
||||||
archiveService: ArchiveManager;
|
archiveService: ArchiveManager;
|
||||||
nativeExtService: NativeExtManager;
|
|
||||||
statusManager: StatusManager;
|
statusManager: StatusManager;
|
||||||
themeService: ThemeManager;
|
themeService: ThemeManager;
|
||||||
io: IOService;
|
io: IOService;
|
||||||
|
|
@ -133,10 +131,6 @@ export class WebApplication extends SNApplication {
|
||||||
return this.webServices.archiveService;
|
return this.webServices.archiveService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNativeExtService() {
|
|
||||||
return this.webServices.nativeExtService;
|
|
||||||
}
|
|
||||||
|
|
||||||
getStatusManager() {
|
getStatusManager() {
|
||||||
return this.webServices.statusManager;
|
return this.webServices.statusManager;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import { DesktopManager } from '@/services/desktopManager';
|
||||||
import { IOService } from '@/services/ioService';
|
import { IOService } from '@/services/ioService';
|
||||||
import { AutolockService } from '@/services/autolock_service';
|
import { AutolockService } from '@/services/autolock_service';
|
||||||
import { StatusManager } from '@/services/statusManager';
|
import { StatusManager } from '@/services/statusManager';
|
||||||
import { NativeExtManager } from '@/services/nativeExtManager';
|
|
||||||
import { ThemeManager } from '@/services/themeManager';
|
import { ThemeManager } from '@/services/themeManager';
|
||||||
|
|
||||||
export class ApplicationGroup extends SNApplicationGroup {
|
export class ApplicationGroup extends SNApplicationGroup {
|
||||||
|
|
@ -85,7 +84,6 @@ export class ApplicationGroup extends SNApplicationGroup {
|
||||||
platform === Platform.MacWeb || platform === Platform.MacDesktop
|
platform === Platform.MacWeb || platform === Platform.MacDesktop
|
||||||
);
|
);
|
||||||
const autolockService = new AutolockService(application);
|
const autolockService = new AutolockService(application);
|
||||||
const nativeExtService = new NativeExtManager(application);
|
|
||||||
const statusManager = new StatusManager();
|
const statusManager = new StatusManager();
|
||||||
const themeService = new ThemeManager(application);
|
const themeService = new ThemeManager(application);
|
||||||
application.setWebServices({
|
application.setWebServices({
|
||||||
|
|
@ -94,7 +92,6 @@ export class ApplicationGroup extends SNApplicationGroup {
|
||||||
desktopService,
|
desktopService,
|
||||||
io,
|
io,
|
||||||
autolockService,
|
autolockService,
|
||||||
nativeExtService,
|
|
||||||
statusManager,
|
statusManager,
|
||||||
themeService,
|
themeService,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -39,23 +39,6 @@
|
||||||
app-state='ctrl.appState'
|
app-state='ctrl.appState'
|
||||||
application='ctrl.application'
|
application='ctrl.application'
|
||||||
ng-if='ctrl.showQuickSettingsMenu',)
|
ng-if='ctrl.showQuickSettingsMenu',)
|
||||||
.sk-app-bar-item
|
|
||||||
a.no-decoration.sk-label.title(
|
|
||||||
href='https://standardnotes.com/help',
|
|
||||||
rel='noopener',
|
|
||||||
target='_blank'
|
|
||||||
)
|
|
||||||
| Help
|
|
||||||
.sk-app-bar-item.border
|
|
||||||
.sk-app-bar-item(ng-repeat='room in ctrl.rooms track by room.uuid')
|
|
||||||
.sk-app-bar-item-column(ng-click='ctrl.selectRoom(room)')
|
|
||||||
.sk-label {{room.name}}
|
|
||||||
component-modal(
|
|
||||||
component-uuid='room.uuid',
|
|
||||||
ng-if='ctrl.roomShowState[room.uuid]',
|
|
||||||
on-dismiss='ctrl.onRoomDismiss(room)',
|
|
||||||
application='ctrl.application'
|
|
||||||
)
|
|
||||||
.sk-app-bar-item.border(ng-if="ctrl.state.showBetaWarning")
|
.sk-app-bar-item.border(ng-if="ctrl.state.showBetaWarning")
|
||||||
.sk-app-bar-item(ng-if="ctrl.state.showBetaWarning")
|
.sk-app-bar-item(ng-if="ctrl.state.showBetaWarning")
|
||||||
a.no-decoration.sk-label.title(
|
a.no-decoration.sk-label.title(
|
||||||
|
|
@ -89,21 +72,6 @@
|
||||||
)
|
)
|
||||||
.sk-app-bar-item(ng-if='ctrl.offline')
|
.sk-app-bar-item(ng-if='ctrl.offline')
|
||||||
.sk-label Offline
|
.sk-label Offline
|
||||||
.sk-app-bar-item.border(ng-if='ctrl.state.dockShortcuts.length > 0')
|
|
||||||
.sk-app-bar-item.dock-shortcut(ng-repeat='shortcut in ctrl.state.dockShortcuts')
|
|
||||||
.sk-app-bar-item-column(
|
|
||||||
ng-class="{'underline': shortcut.component.active}",
|
|
||||||
ng-click='ctrl.selectShortcut(shortcut)'
|
|
||||||
)
|
|
||||||
.div(ng-if="shortcut.icon.type == 'circle'" title='{{shortcut.name}}')
|
|
||||||
.sk-circle.small(
|
|
||||||
ng-style="{'background-color': shortcut.icon.background_color, 'border-color': shortcut.icon.border_color}"
|
|
||||||
)
|
|
||||||
.div(ng-if="shortcut.icon.type == 'svg'" title='{{shortcut.name}}')
|
|
||||||
.svg-item(
|
|
||||||
elem-ready='ctrl.initSvgForShortcut(shortcut)',
|
|
||||||
ng-attr-id='dock-svg-{{shortcut.component.uuid}}'
|
|
||||||
)
|
|
||||||
.sk-app-bar-item.border(ng-if='ctrl.state.hasAccountSwitcher')
|
.sk-app-bar-item.border(ng-if='ctrl.state.hasAccountSwitcher')
|
||||||
.sk-app-bar-item(
|
.sk-app-bar-item(
|
||||||
ng-if='ctrl.state.hasAccountSwitcher'
|
ng-if='ctrl.state.hasAccountSwitcher'
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { preventRefreshing } from '@/utils';
|
||||||
import {
|
import {
|
||||||
ApplicationEvent,
|
ApplicationEvent,
|
||||||
ContentType,
|
ContentType,
|
||||||
SNComponent,
|
|
||||||
SNTheme,
|
SNTheme,
|
||||||
ComponentArea,
|
ComponentArea,
|
||||||
CollectionSort,
|
CollectionSort,
|
||||||
|
|
@ -31,34 +30,21 @@ import { AccountMenuPane } from '@/components/AccountMenu';
|
||||||
const ACCOUNT_SWITCHER_ENABLED = false;
|
const ACCOUNT_SWITCHER_ENABLED = false;
|
||||||
const ACCOUNT_SWITCHER_FEATURE_KEY = 'account_switcher';
|
const ACCOUNT_SWITCHER_FEATURE_KEY = 'account_switcher';
|
||||||
|
|
||||||
type DockShortcut = {
|
|
||||||
name: string;
|
|
||||||
component: SNComponent;
|
|
||||||
icon: {
|
|
||||||
type: string;
|
|
||||||
background_color: string;
|
|
||||||
border_color: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
class FooterViewCtrl extends PureViewCtrl<
|
class FooterViewCtrl extends PureViewCtrl<
|
||||||
unknown,
|
unknown,
|
||||||
{
|
{
|
||||||
outOfSync: boolean;
|
outOfSync: boolean;
|
||||||
hasPasscode: boolean;
|
hasPasscode: boolean;
|
||||||
dataUpgradeAvailable: boolean;
|
dataUpgradeAvailable: boolean;
|
||||||
dockShortcuts: DockShortcut[];
|
|
||||||
hasAccountSwitcher: boolean;
|
hasAccountSwitcher: boolean;
|
||||||
showBetaWarning: boolean;
|
showBetaWarning: boolean;
|
||||||
showDataUpgrade: boolean;
|
showDataUpgrade: boolean;
|
||||||
}
|
}
|
||||||
> {
|
> {
|
||||||
private $rootScope: ng.IRootScopeService;
|
private $rootScope: ng.IRootScopeService;
|
||||||
private rooms: SNComponent[] = [];
|
|
||||||
private themesWithIcons: SNTheme[] = [];
|
private themesWithIcons: SNTheme[] = [];
|
||||||
private showSyncResolution = false;
|
private showSyncResolution = false;
|
||||||
private unregisterComponent: any;
|
private unregisterComponent: any;
|
||||||
private rootScopeListener1: any;
|
|
||||||
private rootScopeListener2: any;
|
private rootScopeListener2: any;
|
||||||
public arbitraryStatusMessage?: string;
|
public arbitraryStatusMessage?: string;
|
||||||
public user?: any;
|
public user?: any;
|
||||||
|
|
@ -66,12 +52,8 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
public showAccountMenu = false;
|
public showAccountMenu = false;
|
||||||
public showQuickSettingsMenu = false;
|
public showQuickSettingsMenu = false;
|
||||||
private didCheckForOffline = false;
|
private didCheckForOffline = false;
|
||||||
private queueExtReload = false;
|
|
||||||
private reloadInProgress = false;
|
|
||||||
public hasError = false;
|
public hasError = false;
|
||||||
public newUpdateAvailable = false;
|
public newUpdateAvailable = false;
|
||||||
public dockShortcuts: DockShortcut[] = [];
|
|
||||||
public roomShowState: Partial<Record<string, boolean>> = {};
|
|
||||||
private observerRemovers: Array<() => void> = [];
|
private observerRemovers: Array<() => void> = [];
|
||||||
private completedInitialSync = false;
|
private completedInitialSync = false;
|
||||||
private showingDownloadStatus = false;
|
private showingDownloadStatus = false;
|
||||||
|
|
@ -92,16 +74,13 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
deinit() {
|
deinit() {
|
||||||
for (const remove of this.observerRemovers) remove();
|
for (const remove of this.observerRemovers) remove();
|
||||||
this.observerRemovers.length = 0;
|
this.observerRemovers.length = 0;
|
||||||
this.rooms.length = 0;
|
|
||||||
this.themesWithIcons.length = 0;
|
this.themesWithIcons.length = 0;
|
||||||
this.unregisterComponent();
|
this.unregisterComponent();
|
||||||
this.unregisterComponent = undefined;
|
this.unregisterComponent = undefined;
|
||||||
this.rootScopeListener1();
|
|
||||||
this.rootScopeListener2();
|
this.rootScopeListener2();
|
||||||
this.rootScopeListener1 = undefined;
|
|
||||||
this.rootScopeListener2 = undefined;
|
this.rootScopeListener2 = undefined;
|
||||||
(this.closeAccountMenu as any) = undefined;
|
(this.closeAccountMenu as unknown) = undefined;
|
||||||
(this.toggleSyncResolutionMenu as any) = undefined;
|
(this.toggleSyncResolutionMenu as unknown) = undefined;
|
||||||
super.deinit();
|
super.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,7 +120,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
outOfSync: false,
|
outOfSync: false,
|
||||||
dataUpgradeAvailable: false,
|
dataUpgradeAvailable: false,
|
||||||
hasPasscode: false,
|
hasPasscode: false,
|
||||||
dockShortcuts: [],
|
|
||||||
descriptors: this.mainApplicationGroup.getDescriptors(),
|
descriptors: this.mainApplicationGroup.getDescriptors(),
|
||||||
hasAccountSwitcher: false,
|
hasAccountSwitcher: false,
|
||||||
showBetaWarning: false,
|
showBetaWarning: false,
|
||||||
|
|
@ -185,12 +163,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
}
|
}
|
||||||
|
|
||||||
addRootScopeListeners() {
|
addRootScopeListeners() {
|
||||||
this.rootScopeListener1 = this.$rootScope.$on(
|
|
||||||
RootScopeMessages.ReloadExtendedData,
|
|
||||||
() => {
|
|
||||||
this.reloadExtendedData();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.rootScopeListener2 = this.$rootScope.$on(
|
this.rootScopeListener2 = this.$rootScope.$on(
|
||||||
RootScopeMessages.NewUpdateAvailable,
|
RootScopeMessages.NewUpdateAvailable,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -207,7 +179,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
switch (eventName) {
|
switch (eventName) {
|
||||||
case AppStateEvent.EditorFocused:
|
case AppStateEvent.EditorFocused:
|
||||||
if (data.eventSource === EventSource.UserInteraction) {
|
if (data.eventSource === EventSource.UserInteraction) {
|
||||||
this.closeAllRooms();
|
|
||||||
this.closeAccountMenu();
|
this.closeAccountMenu();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -303,37 +274,21 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.observerRemovers.push(
|
|
||||||
this.application.streamItems(ContentType.Component, async () => {
|
|
||||||
const components = this.application.getItems(
|
|
||||||
ContentType.Component
|
|
||||||
) as SNComponent[];
|
|
||||||
this.rooms = components.filter((candidate) => {
|
|
||||||
return candidate.area === ComponentArea.Rooms && !candidate.deleted;
|
|
||||||
});
|
|
||||||
if (this.queueExtReload) {
|
|
||||||
this.queueExtReload = false;
|
|
||||||
this.reloadExtendedData();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
this.observerRemovers.push(
|
this.observerRemovers.push(
|
||||||
this.application.streamItems(ContentType.Theme, async () => {
|
this.application.streamItems(ContentType.Theme, async () => {
|
||||||
const themes = this.application.getDisplayableItems(
|
const themes = this.application.getDisplayableItems(
|
||||||
ContentType.Theme
|
ContentType.Theme
|
||||||
) as SNTheme[];
|
) as SNTheme[];
|
||||||
this.themesWithIcons = themes;
|
this.themesWithIcons = themes;
|
||||||
this.reloadDockShortcuts();
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
registerComponentHandler() {
|
registerComponentHandler() {
|
||||||
this.unregisterComponent =
|
this.unregisterComponent =
|
||||||
this.application.componentManager!.registerHandler({
|
this.application.componentManager.registerHandler({
|
||||||
identifier: 'room-bar',
|
identifier: 'room-bar',
|
||||||
areas: [ComponentArea.Rooms, ComponentArea.Modal],
|
areas: [ComponentArea.Modal],
|
||||||
focusHandler: (component, focused) => {
|
focusHandler: (component, focused) => {
|
||||||
if (component.isEditor() && focused) {
|
if (component.isEditor() && focused) {
|
||||||
if (
|
if (
|
||||||
|
|
@ -342,7 +297,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.closeAllRooms();
|
|
||||||
this.closeAccountMenu();
|
this.closeAccountMenu();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -351,7 +305,7 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
|
|
||||||
updateSyncStatus() {
|
updateSyncStatus() {
|
||||||
const statusManager = this.application.getStatusManager();
|
const statusManager = this.application.getStatusManager();
|
||||||
const syncStatus = this.application!.getSyncStatus();
|
const syncStatus = this.application.getSyncStatus();
|
||||||
const stats = syncStatus.getStats();
|
const stats = syncStatus.getStats();
|
||||||
if (syncStatus.hasError()) {
|
if (syncStatus.hasError()) {
|
||||||
statusManager.setMessage('Unable to Sync');
|
statusManager.setMessage('Unable to Sync');
|
||||||
|
|
@ -385,9 +339,9 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
|
|
||||||
updateLocalDataStatus() {
|
updateLocalDataStatus() {
|
||||||
const statusManager = this.application.getStatusManager();
|
const statusManager = this.application.getStatusManager();
|
||||||
const syncStatus = this.application!.getSyncStatus();
|
const syncStatus = this.application.getSyncStatus();
|
||||||
const stats = syncStatus.getStats();
|
const stats = syncStatus.getStats();
|
||||||
const encryption = this.application!.isEncryptionAvailable();
|
const encryption = this.application.isEncryptionAvailable();
|
||||||
if (stats.localDataDone) {
|
if (stats.localDataDone) {
|
||||||
statusManager.setMessage('');
|
statusManager.setMessage('');
|
||||||
return;
|
return;
|
||||||
|
|
@ -399,35 +353,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
statusManager.setMessage(loadingStatus);
|
statusManager.setMessage(loadingStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadExtendedData() {
|
|
||||||
if (this.reloadInProgress) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.reloadInProgress = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A reload consists of opening the extensions manager,
|
|
||||||
* then closing it after a short delay.
|
|
||||||
*/
|
|
||||||
const extWindow = this.rooms.find((room) => {
|
|
||||||
return (
|
|
||||||
room.package_info.identifier ===
|
|
||||||
this.application.getNativeExtService().extManagerId
|
|
||||||
);
|
|
||||||
});
|
|
||||||
if (!extWindow) {
|
|
||||||
this.queueExtReload = true;
|
|
||||||
this.reloadInProgress = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.selectRoom(extWindow);
|
|
||||||
this.$timeout(() => {
|
|
||||||
this.selectRoom(extWindow);
|
|
||||||
this.reloadInProgress = false;
|
|
||||||
this.$rootScope.$broadcast('ext-reload-complete');
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateOfflineStatus() {
|
updateOfflineStatus() {
|
||||||
this.offline = this.application.noAccount();
|
this.offline = this.application.noAccount();
|
||||||
}
|
}
|
||||||
|
|
@ -453,7 +378,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
accountMenuPressed() {
|
accountMenuPressed() {
|
||||||
this.appState.quickSettingsMenu.closeQuickSettingsMenu();
|
this.appState.quickSettingsMenu.closeQuickSettingsMenu();
|
||||||
this.appState.accountMenu.toggleShow();
|
this.appState.accountMenu.toggleShow();
|
||||||
this.closeAllRooms();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quickSettingsPressed() {
|
quickSettingsPressed() {
|
||||||
|
|
@ -463,7 +387,6 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
} else {
|
} else {
|
||||||
this.appState.preferences.openPreferences();
|
this.appState.preferences.openPreferences();
|
||||||
}
|
}
|
||||||
this.closeAllRooms();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSyncResolutionMenu() {
|
toggleSyncResolutionMenu() {
|
||||||
|
|
@ -485,56 +408,7 @@ class FooterViewCtrl extends PureViewCtrl<
|
||||||
|
|
||||||
clickedNewUpdateAnnouncement() {
|
clickedNewUpdateAnnouncement() {
|
||||||
this.newUpdateAvailable = false;
|
this.newUpdateAvailable = false;
|
||||||
this.application.alertService!.alert(STRING_NEW_UPDATE_READY);
|
this.application.alertService.alert(STRING_NEW_UPDATE_READY);
|
||||||
}
|
|
||||||
|
|
||||||
reloadDockShortcuts() {
|
|
||||||
const shortcuts: DockShortcut[] = [];
|
|
||||||
this.setState({
|
|
||||||
dockShortcuts: shortcuts.sort((a, b) => {
|
|
||||||
/** Circles first, then images */
|
|
||||||
const aType = a.icon.type;
|
|
||||||
const bType = b.icon.type;
|
|
||||||
if (aType === 'circle' && bType === 'svg') {
|
|
||||||
return -1;
|
|
||||||
} else if (bType === 'circle' && aType === 'svg') {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return a.name.localeCompare(b.name);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
initSvgForShortcut(shortcut: DockShortcut) {
|
|
||||||
const id = 'dock-svg-' + shortcut.component.uuid;
|
|
||||||
const element = document.getElementById(id)!;
|
|
||||||
const parser = new DOMParser();
|
|
||||||
const svg = shortcut.component.package_info.dock_icon?.source;
|
|
||||||
if (svg != undefined) {
|
|
||||||
const doc = parser.parseFromString(svg, 'image/svg+xml');
|
|
||||||
element.appendChild(doc.documentElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selectShortcut(shortcut: DockShortcut) {
|
|
||||||
this.application.toggleComponent(shortcut.component);
|
|
||||||
}
|
|
||||||
|
|
||||||
onRoomDismiss(room: SNComponent) {
|
|
||||||
this.roomShowState[room.uuid] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
closeAllRooms() {
|
|
||||||
for (const room of this.rooms) {
|
|
||||||
this.roomShowState[room.uuid] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async selectRoom(room: SNComponent) {
|
|
||||||
this.$timeout(() => {
|
|
||||||
this.roomShowState[room.uuid] = !this.roomShowState[room.uuid];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayBetaDialog() {
|
displayBetaDialog() {
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 81642c6e4ee0ae8232732b8763e9bed91badce23
|
|
||||||
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window._default_sync_server = "<%= ENV['SF_DEFAULT_SERVER'] %>";
|
window._default_sync_server = "<%= ENV['SF_DEFAULT_SERVER'] %>";
|
||||||
window._extensions_manager_location = "<%= ENV['EXTENSIONS_MANAGER_LOCATION'] %>";
|
|
||||||
window._batch_manager_location = "<%= ENV['BATCH_MANAGER_LOCATION'] %>";
|
|
||||||
window._bugsnag_api_key = "<%= ENV['BUGSNAG_API_KEY'] %>";
|
window._bugsnag_api_key = "<%= ENV['BUGSNAG_API_KEY'] %>";
|
||||||
window._enable_unfinished_features = "<%= ENV['ENABLE_UNFINISHED_FEATURES'] %>" === 'true';
|
window._enable_unfinished_features = "<%= ENV['ENABLE_UNFINISHED_FEATURES'] %>" === 'true';
|
||||||
window._websocket_url = "<%= ENV['WEBSOCKET_URL'] %>";
|
window._websocket_url = "<%= ENV['WEBSOCKET_URL'] %>";
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
<body
|
<body
|
||||||
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
|
data-default-sync-server="<%= env.DEV_DEFAULT_SYNC_SERVER %>"
|
||||||
data-extensions-manager-location="<%= env.DEV_EXTENSIONS_MANAGER_LOCATION %>"
|
|
||||||
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
|
data-bugsnag-api-key="<%= env.DEV_BUGSNAG_API_KEY %>"
|
||||||
data-enable-unfinished-features="<%= env.ENABLE_UNFINISHED_FEATURES %>"
|
data-enable-unfinished-features="<%= env.ENABLE_UNFINISHED_FEATURES %>"
|
||||||
data-web-socket-url="<%= env.DEV_WEBSOCKET_URL %>"
|
data-web-socket-url="<%= env.DEV_WEBSOCKET_URL %>"
|
||||||
|
|
@ -38,7 +37,6 @@
|
||||||
>
|
>
|
||||||
<script>
|
<script>
|
||||||
window._default_sync_server = document.body.dataset.defaultSyncServer || "https://api.standardnotes.com";
|
window._default_sync_server = document.body.dataset.defaultSyncServer || "https://api.standardnotes.com";
|
||||||
window._extensions_manager_location = document.body.dataset.extensionsManagerLocation || "public/extensions/extensions-manager/dist/index.html";
|
|
||||||
window._bugsnag_api_key = document.body.dataset.bugsnagApiKey;
|
window._bugsnag_api_key = document.body.dataset.bugsnagApiKey;
|
||||||
window._enable_unfinished_features = document.body.dataset.enableUnfinishedFeatures === 'true';
|
window._enable_unfinished_features = document.body.dataset.enableUnfinishedFeatures === 'true';
|
||||||
window._websocket_url = document.body.dataset.webSocketUrl;
|
window._websocket_url = document.body.dataset.webSocketUrl;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"url": "https://github.com/standardnotes/web"
|
"url": "https://github.com/standardnotes/web"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "yarn submodules && yarn install",
|
"setup": "yarn install",
|
||||||
"start": "webpack-dev-server --config webpack.dev.js",
|
"start": "webpack-dev-server --config webpack.dev.js",
|
||||||
"watch": "webpack -w --config webpack.dev.js",
|
"watch": "webpack -w --config webpack.dev.js",
|
||||||
"watch:desktop": "webpack -w --config webpack.dev.js --env.platform='desktop'",
|
"watch:desktop": "webpack -w --config webpack.dev.js --env.platform='desktop'",
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
"bundle:desktop": "webpack --config webpack.prod.js --env.platform='desktop'",
|
"bundle:desktop": "webpack --config webpack.prod.js --env.platform='desktop'",
|
||||||
"bundle:desktop:beta": "webpack --config webpack.prod.js --env.platform='desktop' --env.public_beta='true'",
|
"bundle:desktop:beta": "webpack --config webpack.prod.js --env.platform='desktop' --env.public_beta='true'",
|
||||||
"build": "bundle install && yarn install --frozen-lockfile && bundle exec rails assets:precompile && yarn bundle",
|
"build": "bundle install && yarn install --frozen-lockfile && bundle exec rails assets:precompile && yarn bundle",
|
||||||
"submodules": "git submodule update --init --force",
|
|
||||||
"lint": "eslint --fix app/assets/javascripts",
|
"lint": "eslint --fix app/assets/javascripts",
|
||||||
"tsc": "tsc --project app/assets/javascripts/tsconfig.json"
|
"tsc": "tsc --project app/assets/javascripts/tsconfig.json"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 81642c6e4ee0ae8232732b8763e9bed91badce23
|
|
||||||
Loading…
Add table
Reference in a new issue