Skip to content

Commit

Permalink
core: add support for system device creator
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Jul 9, 2024
1 parent e172b45 commit 91be95e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugins/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/core",
"version": "0.3.28",
"version": "0.3.29",
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
"author": "Scrypted",
"license": "Apache-2.0",
Expand Down
4 changes: 4 additions & 0 deletions plugins/core/src/aggregate-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export class AggregateCore extends ScryptedDeviceBase implements DeviceProvider,
constructor() {
super(AggregateCoreNativeId);

this.systemDevice = {
deviceCreator: 'Device Group',
};

for (const nativeId of deviceManager.getNativeIds()) {
if (nativeId?.startsWith('aggregate:')) {
const aggregate = createAggregateDevice(nativeId);
Expand Down
5 changes: 4 additions & 1 deletion plugins/core/src/automations-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export class AutomationCore extends ScryptedDeviceBase implements DeviceProvider
constructor() {
super(AutomationCoreNativeId);

this.systemDevice = {
deviceCreator: 'Automation',
};

for (const nativeId of deviceManager.getNativeIds()) {
if (nativeId?.startsWith('automation:')) {
const automation = new Automation(nativeId);
Expand All @@ -20,7 +24,6 @@ export class AutomationCore extends ScryptedDeviceBase implements DeviceProvider
}
}


(async () => {
const updatePluginsNativeId = 'automation:update-plugins'
let updatePlugins = this.automations.get(updatePluginsNativeId);
Expand Down
8 changes: 4 additions & 4 deletions plugins/core/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Dev
{
name: 'Scripts',
nativeId: ScriptCoreNativeId,
interfaces: [ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
interfaces: [ScryptedInterface.ScryptedSystemDevice, ScryptedInterface.ScryptedDeviceCreator, ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
type: ScryptedDeviceType.Builtin,
},
);
Expand Down Expand Up @@ -126,7 +126,7 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Dev
{
name: 'Automations',
nativeId: AutomationCoreNativeId,
interfaces: [ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
interfaces: [ScryptedInterface.ScryptedSystemDevice, ScryptedInterface.ScryptedDeviceCreator, ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
type: ScryptedDeviceType.Builtin,
},
);
Expand All @@ -148,7 +148,7 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Dev
{
name: 'Device Groups',
nativeId: AggregateCoreNativeId,
interfaces: [ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
interfaces: [ScryptedInterface.ScryptedSystemDevice, ScryptedInterface.ScryptedDeviceCreator, ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
type: ScryptedDeviceType.Builtin,
},
);
Expand All @@ -160,7 +160,7 @@ class ScryptedCore extends ScryptedDeviceBase implements HttpRequestHandler, Dev
{
name: 'Scrypted Users',
nativeId: UsersNativeId,
interfaces: [ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
interfaces: [ScryptedInterface.ScryptedSystemDevice, ScryptedInterface.ScryptedDeviceCreator, ScryptedInterface.DeviceProvider, ScryptedInterface.DeviceCreator, ScryptedInterface.Readme],
type: ScryptedDeviceType.Builtin,
},
);
Expand Down
4 changes: 4 additions & 0 deletions plugins/core/src/script-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export class ScriptCore extends ScryptedDeviceBase implements DeviceProvider, De

constructor() {
super(ScriptCoreNativeId);

this.systemDevice = {
deviceCreator: 'Script',
};
}

async getCreateDeviceSettings(): Promise<Setting[]> {
Expand Down
4 changes: 4 additions & 0 deletions plugins/core/src/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export class UsersCore extends ScryptedDeviceBase implements Readme, DeviceProvi
constructor() {
super(UsersNativeId);

this.systemDevice = {
deviceCreator: 'Scrypted User',
};

this.syncUsers();
}

Expand Down

0 comments on commit 91be95e

Please sign in to comment.