Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ jobs:
- name: ⚙ go
uses: actions/setup-go@v5
with:
go-version-file: native/go.mod
cache-dependency-path: native/go.sum
go-version-file: src/WhatsBox.Native/go.mod
cache-dependency-path: src/WhatsBox.Native/go.sum

- name: 📦 pack rid
id: rid
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
- name: ⚙ go
uses: actions/setup-go@v5
with:
go-version-file: native/go.mod
cache-dependency-path: native/go.sum
go-version-file: src/WhatsBox.Native/go.mod
cache-dependency-path: src/WhatsBox.Native/go.sum

- name: 📦 pack
run: |
Expand Down Expand Up @@ -96,8 +96,8 @@ jobs:
- name: ⚙ go
uses: actions/setup-go@v5
with:
go-version-file: native/go.mod
cache-dependency-path: native/go.sum
go-version-file: src/WhatsBox.Native/go.mod
cache-dependency-path: src/WhatsBox.Native/go.sum

- name: 📦 whatsbox
run: |
Expand Down
9 changes: 6 additions & 3 deletions native/internal/app/app.go → src/WhatsBox.Native/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"runtime"
"strings"

"github.com/devlooped/whatsbox/internal/rpc"
"github.com/devlooped/whatsbox/internal/wa"
"github.com/devlooped/whatsbox/rpc"
"github.com/devlooped/whatsbox/wa"
)

const (
Expand Down Expand Up @@ -101,7 +101,10 @@ func mustAbs(p string) string {
return abs
}

func writeLine(w io.Writer, mu interface{ Lock(); Unlock() }, line []byte) error {
func writeLine(w io.Writer, mu interface {
Lock()
Unlock()
}, line []byte) error {
mu.Lock()
defer mu.Unlock()
if _, err := w.Write(line); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"sync"
"time"

"github.com/devlooped/whatsbox/internal/bus"
"github.com/devlooped/whatsbox/internal/dirstore"
"github.com/devlooped/whatsbox/internal/files"
"github.com/devlooped/whatsbox/internal/lock"
"github.com/devlooped/whatsbox/internal/rpc"
"github.com/devlooped/whatsbox/internal/sqliteutil"
"github.com/devlooped/whatsbox/internal/topic"
"github.com/devlooped/whatsbox/internal/wa"
"github.com/devlooped/whatsbox/bus"
"github.com/devlooped/whatsbox/dirstore"
"github.com/devlooped/whatsbox/files"
"github.com/devlooped/whatsbox/lock"
"github.com/devlooped/whatsbox/rpc"
"github.com/devlooped/whatsbox/sqliteutil"
"github.com/devlooped/whatsbox/topic"
"github.com/devlooped/whatsbox/wa"
)

type Options struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"strings"

"github.com/devlooped/whatsbox/internal/dirstore"
"github.com/devlooped/whatsbox/internal/files"
"github.com/devlooped/whatsbox/internal/topic"
"github.com/devlooped/whatsbox/internal/wa"
"github.com/devlooped/whatsbox/dirstore"
"github.com/devlooped/whatsbox/files"
"github.com/devlooped/whatsbox/topic"
"github.com/devlooped/whatsbox/wa"
)

func (d *Daemon) onWA(ev wa.Event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"path/filepath"
"strings"

"github.com/devlooped/whatsbox/internal/dirstore"
"github.com/devlooped/whatsbox/internal/files"
"github.com/devlooped/whatsbox/internal/rpc"
"github.com/devlooped/whatsbox/internal/topic"
"github.com/devlooped/whatsbox/internal/wa"
"github.com/devlooped/whatsbox/dirstore"
"github.com/devlooped/whatsbox/files"
"github.com/devlooped/whatsbox/rpc"
"github.com/devlooped/whatsbox/topic"
"github.com/devlooped/whatsbox/wa"
)

type topicsParams struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"testing"
"time"

"github.com/devlooped/whatsbox/internal/app"
"github.com/devlooped/whatsbox/internal/dirstore"
"github.com/devlooped/whatsbox/internal/rpc"
"github.com/devlooped/whatsbox/internal/wa"
"github.com/devlooped/whatsbox/app"
"github.com/devlooped/whatsbox/dirstore"
"github.com/devlooped/whatsbox/rpc"
"github.com/devlooped/whatsbox/wa"
)

// testClient drives the shipped NDJSON Run loop with a fake WhatsApp client.
Expand Down Expand Up @@ -1010,7 +1010,7 @@ func TestChatEventsDiscardOverflowSendRead(t *testing.T) {
t.Fatalf("empty send: %#v", err)
}
reac := c.mustCall("messages.send", map[string]any{
"to": "999@lid",
"to": "999@lid",
"contents": []map[string]any{{"type": "reaction", "target": "t1", "by": "999@lid", "emoji": ""}},
})
if reac["id"] == "" {
Expand All @@ -1025,14 +1025,14 @@ func TestChatEventsDiscardOverflowSendRead(t *testing.T) {
t.Fatal(err)
}
media := c.mustCall("messages.send", map[string]any{
"to": "999@lid",
"to": "999@lid",
"contents": []map[string]any{{"type": "image", "path": "out/photo.jpg"}},
})
if media["topic"] != "999@lid" {
t.Fatalf("path send=%v", media)
}
_, err = c.call("messages.send", map[string]any{
"to": "999@lid",
"to": "999@lid",
"contents": []map[string]any{{"type": "image", "path": "../secret.jpg"}},
})
if err == nil || err.Message != rpc.TokPathEscape {
Expand Down Expand Up @@ -1138,7 +1138,7 @@ func TestFilesRequiredOnSendPath(t *testing.T) {
c := startDaemon(t, fake, 0)
_ = c.mustInit(map[string]any{"connect": true})
_, err := c.call("messages.send", map[string]any{
"to": "999@lid",
"to": "999@lid",
"contents": []map[string]any{{"type": "image", "path": "out/a.jpg"}},
})
if err == nil || err.Message != rpc.TokFilesRequired {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"strings"

"github.com/devlooped/whatsbox/internal/rpc"
"github.com/devlooped/whatsbox/internal/topic"
"github.com/devlooped/whatsbox/internal/wa"
"github.com/devlooped/whatsbox/rpc"
"github.com/devlooped/whatsbox/topic"
"github.com/devlooped/whatsbox/wa"
)

func (d *Daemon) resolveTopic(ctx context.Context, raw string, allowSystem bool) (string, *rpc.Error) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

_ "modernc.org/sqlite"

"github.com/devlooped/whatsbox/internal/sqliteutil"
"github.com/devlooped/whatsbox/sqliteutil"
)

type Store struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"

"github.com/devlooped/whatsbox/internal/rpc"
"github.com/devlooped/whatsbox/internal/topic"
"github.com/devlooped/whatsbox/rpc"
"github.com/devlooped/whatsbox/topic"
)

type Dir struct {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"os"

"github.com/devlooped/whatsbox/internal/app"
"github.com/devlooped/whatsbox/app"
)

func main() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const (
)

type Parsed struct {
Raw string
Kind Kind
JID types.JID
Phone string
Raw string
Kind Kind
JID types.JID
Phone string
Canonical string
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
waLog "go.mau.fi/whatsmeow/util/log"
"google.golang.org/protobuf/proto"

"github.com/devlooped/whatsbox/internal/sqliteutil"
"github.com/devlooped/whatsbox/sqliteutil"

_ "modernc.org/sqlite"
)
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/WhatsBox/WhatsBox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<NoWarn>$(NoWarn);NU5128</NoWarn>
<NativeWhatsBoxName Condition="$([MSBuild]::IsOSPlatform('Windows'))">whatsbox.exe</NativeWhatsBoxName>
<NativeWhatsBoxName Condition="'$(NativeWhatsBoxName)' == ''">whatsbox</NativeWhatsBoxName>
<NativeWhatsBoxSourceRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\native'))</NativeWhatsBoxSourceRoot>
<NativeWhatsBoxSourceRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\WhatsBox.Native'))</NativeWhatsBoxSourceRoot>
<NativeWhatsBoxOutput>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)$(BaseIntermediateOutputPath)native\$(NativeWhatsBoxName)'))</NativeWhatsBoxOutput>
</PropertyGroup>

Expand Down Expand Up @@ -62,9 +62,9 @@
</Target>

<!-- Build the current-OS whatsbox next to this project so project-reference copy lands it in the consumer outdir. -->
<Target Name="BuildNativeWhatsBox" BeforeTargets="BeforeCompile;GetCopyToOutputDirectoryItems;AssignTargetPaths" Inputs="$(NativeWhatsBoxSourceRoot)\cmd\**\*.go;$(NativeWhatsBoxSourceRoot)\internal\**\*.go;$(NativeWhatsBoxSourceRoot)\go.mod;$(NativeWhatsBoxSourceRoot)\go.sum" Outputs="$(NativeWhatsBoxOutput)">
<Target Name="BuildNativeWhatsBox" BeforeTargets="BeforeCompile;GetCopyToOutputDirectoryItems;AssignTargetPaths" Inputs="$(NativeWhatsBoxSourceRoot)\**\*.go;$(NativeWhatsBoxSourceRoot)\go.mod;$(NativeWhatsBoxSourceRoot)\go.sum" Outputs="$(NativeWhatsBoxOutput)">
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(NativeWhatsBoxOutput)))" />
<Exec Command="go build -o &quot;$(NativeWhatsBoxOutput)&quot; ./cmd/whatsbox" WorkingDirectory="$(NativeWhatsBoxSourceRoot)" EnvironmentVariables="CGO_ENABLED=0" />
<Exec Command="go build -o &quot;$(NativeWhatsBoxOutput)&quot; ." WorkingDirectory="$(NativeWhatsBoxSourceRoot)" EnvironmentVariables="CGO_ENABLED=0" />
</Target>

<Target Name="IncludeNativeWhatsBox" AfterTargets="BuildNativeWhatsBox" BeforeTargets="GetCopyToOutputDirectoryItems;AssignTargetPaths">
Expand Down Expand Up @@ -109,12 +109,12 @@
</Target>

<Target Name="BuildWhatsBoxRidNative" Condition="'$(RuntimeIdentifier)' != ''"
Inputs="$(NativeWhatsBoxSourceRoot)\cmd\**\*.go;$(NativeWhatsBoxSourceRoot)\internal\**\*.go;$(NativeWhatsBoxSourceRoot)\go.mod;$(NativeWhatsBoxSourceRoot)\go.sum"
Inputs="$(NativeWhatsBoxSourceRoot)\**\*.go;$(NativeWhatsBoxSourceRoot)\go.mod;$(NativeWhatsBoxSourceRoot)\go.sum"
Outputs="$(_WhatsBoxRidNativeBinary)">
<Error Condition="'$(_WhatsBoxRidGoos)' == '' or '$(_WhatsBoxRidGoarch)' == ''"
Text="Unsupported RuntimeIdentifier '$(RuntimeIdentifier)'. Supported: $(RuntimeIdentifiers)." />
<MakeDir Directories="$(_WhatsBoxRidNativeDir)" />
<Exec Command="go build -o &quot;$(_WhatsBoxRidNativeBinary)&quot; ./cmd/whatsbox"
<Exec Command="go build -o &quot;$(_WhatsBoxRidNativeBinary)&quot; ."
WorkingDirectory="$(NativeWhatsBoxSourceRoot)"
EnvironmentVariables="CGO_ENABLED=0;GOOS=$(_WhatsBoxRidGoos);GOARCH=$(_WhatsBoxRidGoarch)" />
</Target>
Expand Down
Loading