diff --git a/cmd/lucifer4-server/main.go b/cmd/lucifer4-server/main.go index 555f7a6..f9bcdd8 100644 --- a/cmd/lucifer4-server/main.go +++ b/cmd/lucifer4-server/main.go @@ -9,6 +9,8 @@ import ( "git.aiterp.net/lucifer3/server/services/hue" "git.aiterp.net/lucifer3/server/services/mysqldb" "git.aiterp.net/lucifer3/server/services/nanoleaf" + "git.aiterp.net/lucifer3/server/services/script" + "git.aiterp.net/lucifer3/server/services/tradfri" "git.aiterp.net/lucifer3/server/services/uistate" "log" "os" @@ -21,7 +23,7 @@ func main() { bus := lucifer3.EventBus{} resolver := services.NewResolver() - sceneMap := services.NewSceneMap(resolver) + variables := script.NewVariables() database, err := mysqldb.Connect( env("LUCIFER4_DB_HOST"), @@ -40,13 +42,15 @@ func main() { } bus.JoinPrivileged(resolver) - bus.JoinPrivileged(sceneMap) - bus.Join(effectenforcer.NewService(resolver, sceneMap)) + bus.Join(effectenforcer.NewService(resolver)) bus.Join(nanoleaf.NewService()) bus.Join(hue.NewService()) + bus.Join(tradfri.NewService()) bus.Join(uistate.NewService()) + bus.Join(script.NewService(resolver, variables)) bus.Join(database) bus.Join(httpAPI) + bus.Join(variables) bus.RunEvent(events.Started{}) diff --git a/device/interfaces.go b/device/interfaces.go index 15f640a..a5a018c 100644 --- a/device/interfaces.go +++ b/device/interfaces.go @@ -2,6 +2,7 @@ package device type Resolver interface { Resolve(pattern string) []Pointer + CompileMatcher(pattern string) PointerMatcher } type SceneMap interface { diff --git a/device/pointer.go b/device/pointer.go index 4209ac7..7396309 100644 --- a/device/pointer.go +++ b/device/pointer.go @@ -2,6 +2,7 @@ package device import ( "git.aiterp.net/lucifer3/server/internal/gentools" + "log" "strings" ) @@ -69,6 +70,12 @@ func (p *Pointer) Name() string { } func (p *Pointer) Matches(matcher PointerMatcher) bool { + defer func() { + if err := recover(); err != nil { + log.Println("[PANIC]", err) + } + }() + if matcher.Match(p.ID) { return true } diff --git a/frontend/.gitignore b/frontend/.gitignore index 6635cf5..3d5639f 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -8,3 +8,4 @@ node_modules !.env.example vite.config.js.timestamp-* vite.config.ts.timestamp-* +/*.blend1 \ No newline at end of file diff --git a/frontend/icons.blend b/frontend/icons.blend new file mode 100644 index 0000000..bcd4a2c Binary files /dev/null and b/frontend/icons.blend differ diff --git a/frontend/src/lib/components/Icon.svelte b/frontend/src/lib/components/Icon.svelte new file mode 100644 index 0000000..facc9bb --- /dev/null +++ b/frontend/src/lib/components/Icon.svelte @@ -0,0 +1,70 @@ + + + + +