Merge branch 'sipeed:main' into main
This commit is contained in:
commit
365f891dfe
4 changed files with 35 additions and 5 deletions
|
|
@ -27,6 +27,7 @@ builds:
|
|||
- windows
|
||||
- darwin
|
||||
- freebsd
|
||||
- netbsd
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
|
|
@ -44,6 +45,12 @@ builds:
|
|||
ignore:
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
- goos: netbsd
|
||||
goarch: s390x
|
||||
- goos: netbsd
|
||||
goarch: mips64
|
||||
- goos: netbsd
|
||||
goarch: arm
|
||||
|
||||
- id: picoclaw-launcher
|
||||
binary: picoclaw-launcher
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -181,6 +181,8 @@ build-all: generate
|
|||
GOOS=linux GOARCH=arm GOARM=7 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-armv7 ./$(CMD_DIR)
|
||||
GOOS=darwin GOARCH=arm64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./$(CMD_DIR)
|
||||
GOOS=windows GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./$(CMD_DIR)
|
||||
GOOS=netbsd GOARCH=amd64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-netbsd-amd64 ./$(CMD_DIR)
|
||||
GOOS=netbsd GOARCH=arm64 $(GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-netbsd-arm64 ./$(CMD_DIR)
|
||||
@echo "All builds complete"
|
||||
|
||||
## install: Install picoclaw to system and copy builtin skills
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ func MatchAllowed(sender bus.SenderInfo, allowed string) bool {
|
|||
}
|
||||
}
|
||||
|
||||
// Keep track of explicit username format
|
||||
isAtUsername := strings.HasPrefix(allowed, "@")
|
||||
|
||||
// Strip leading "@" for username matching
|
||||
trimmed := strings.TrimPrefix(allowed, "@")
|
||||
|
||||
|
|
@ -75,11 +78,9 @@ func MatchAllowed(sender bus.SenderInfo, allowed string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// Match against Username
|
||||
if sender.Username != "" {
|
||||
if sender.Username == trimmed || sender.Username == allowedUser {
|
||||
return true
|
||||
}
|
||||
// Match against Username only when explicitly requested via "@username"
|
||||
if isAtUsername && sender.Username != "" && sender.Username == trimmed {
|
||||
return true
|
||||
}
|
||||
|
||||
// Match compound sender format against allowed parts
|
||||
|
|
|
|||
|
|
@ -104,6 +104,16 @@ func TestMatchAllowed(t *testing.T) {
|
|||
allowed: "@alice",
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "plain entry does not match username",
|
||||
sender: bus.SenderInfo{
|
||||
Platform: "discord",
|
||||
PlatformID: "999999",
|
||||
Username: "123456",
|
||||
},
|
||||
allowed: "123456",
|
||||
want: false,
|
||||
},
|
||||
{
|
||||
name: "@username does not match",
|
||||
sender: telegramSender,
|
||||
|
|
@ -123,6 +133,16 @@ func TestMatchAllowed(t *testing.T) {
|
|||
allowed: "999|alice",
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "compound matches by ID when username differs",
|
||||
sender: bus.SenderInfo{
|
||||
Platform: "discord",
|
||||
PlatformID: "123456",
|
||||
Username: "not123456",
|
||||
},
|
||||
allowed: "123456|alice",
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "compound does not match",
|
||||
sender: telegramSender,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue