Skip to content

Commit

Permalink
first incomplete export source implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Mar 25, 2024
1 parent 6b82d2f commit 596da6f
Show file tree
Hide file tree
Showing 11 changed files with 696 additions and 88 deletions.
5 changes: 4 additions & 1 deletion cmd/slackdump/internal/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/golang/base"
"github.com/rusq/slackdump/v3/internal/chunk"
"github.com/rusq/slackdump/v3/internal/viewer"
"github.com/rusq/slackdump/v3/internal/viewer/source"
"github.com/rusq/slackdump/v3/logger"
)

Expand Down Expand Up @@ -53,7 +54,9 @@ func RunView(ctx context.Context, cmd *base.Command, args []string) error {
}
defer dir.Close()

v, err := viewer.New(ctx, viewer.NewChunkRetriever(dir), listenAddr)
src := source.NewChunkDir(dir)

v, err := viewer.New(ctx, listenAddr, src)
if err != nil {
base.SetExitStatus(base.SApplicationError)
return err
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/MercuryEngineering/CookieMonster v0.0.0-20180304172713-1584578b3403
github.com/charmbracelet/huh v0.3.0
github.com/davecgh/go-spew v1.1.1
github.com/enescakir/emoji v1.0.0
github.com/fatih/color v1.16.0
github.com/go-chi/chi/v5 v5.0.12
github.com/go-playground/locales v0.14.1
Expand All @@ -27,10 +28,10 @@ require (
github.com/yuin/goldmark v1.7.0
github.com/yuin/goldmark-emoji v1.0.2
go.uber.org/mock v0.4.0
golang.org/x/crypto v0.19.0
golang.org/x/crypto v0.21.0
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
golang.org/x/sync v0.6.0
golang.org/x/term v0.17.0
golang.org/x/term v0.18.0
golang.org/x/text v0.14.0
golang.org/x/time v0.5.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -47,7 +48,6 @@ require (
github.com/containerd/console v1.0.4 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/denisbrodbeck/machineid v1.0.1 // indirect
github.com/enescakir/emoji v1.0.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-stack/stack v1.8.1 // indirect
Expand All @@ -73,6 +73,6 @@ require (
github.com/ysmood/gson v0.7.3 // indirect
github.com/ysmood/leakless v0.8.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 h1:/RIbNt/Zr7rVhIkQhooTxCxFcdWLGIKnZA4IXNFSrvo=
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -172,11 +172,11 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
Expand Down
135 changes: 135 additions & 0 deletions internal/fixtures/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,138 @@ const TestChannels = `[
}
]
`

// TestChannelsNativeExport are from the real Slack workspace export.
const TestChannelsNativeExport = `[
{
"id": "CHM82GF99",
"name": "everything",
"created": 1555493779,
"creator": "UHSD97ZA5",
"is_archived": false,
"is_general": false,
"members": [
"UHSD97ZA5",
"ULLLZ6SAH"
],
"topic": {
"value": "",
"creator": "",
"last_set": 0
},
"purpose": {
"value": "",
"creator": "",
"last_set": 0
}
},
{
"id": "CHY5HUESG",
"name": "everyone",
"created": 1555493778,
"creator": "UHSD97ZA5",
"is_archived": false,
"is_general": true,
"members": [
"UHSD97ZA5",
"ULLLZ6SAH"
],
"topic": {
"value": "Company-wide announcements and work-based matters",
"creator": "UHSD97ZA5",
"last_set": 1555493778
},
"purpose": {
"value": "This channel is for workspace-wide communication and announcements. All members are in this channel.",
"creator": "UHSD97ZA5",
"last_set": 1555493778
}
},
{
"id": "CHYLGDP0D",
"name": "random",
"created": 1555493778,
"creator": "UHSD97ZA5",
"is_archived": false,
"is_general": false,
"members": [
"UHSD97ZA5",
"ULLLZ6SAH",
"U034HM0P7RB"
],
"topic": {
"value": "Non-work banter and water cooler conversation",
"creator": "UHSD97ZA5",
"last_set": 1555493778
},
"purpose": {
"value": "A place for non-work-related flimflam, faffing, hodge-podge or jibber-jabber you'd prefer to keep out of more focused work-related channels.",
"creator": "UHSD97ZA5",
"last_set": 1555493778
}
},
{
"id": "C011D885FP0",
"name": "wakatime",
"created": 1586035665,
"creator": "UHSD97ZA5",
"is_archived": false,
"is_general": false,
"members": [
"UHSD97ZA5"
],
"topic": {
"value": "",
"creator": "",
"last_set": 0
},
"purpose": {
"value": "Timesheet",
"creator": "UHSD97ZA5",
"last_set": 1586035666
}
},
{
"id": "C045TUGSSTW",
"name": "adapt_w_3dビューア",
"created": 1665307423,
"creator": "UHSD97ZA5",
"is_archived": false,
"is_general": false,
"members": [
"UHSD97ZA5"
],
"topic": {
"value": "",
"creator": "",
"last_set": 0
},
"purpose": {
"value": "Issue 44 test",
"creator": "UHSD97ZA5",
"last_set": 1665307423
}
},
{
"id": "C04BJATRQRL",
"name": "slackdump",
"created": 1668926667,
"creator": "UHSD97ZA5",
"is_archived": false,
"is_general": false,
"members": [
"UHSD97ZA5"
],
"topic": {
"value": "",
"creator": "",
"last_set": 0
},
"purpose": {
"value": "",
"creator": "",
"last_set": 0
}
}
]
`
Loading

0 comments on commit 596da6f

Please sign in to comment.