Experimental notifications + windows icon
This commit is contained in:
1
go.mod
1
go.mod
@@ -5,6 +5,7 @@ go 1.24.3
|
||||
require (
|
||||
fyne.io/fyne/v2 v2.7.1
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/k3a/html2text v1.2.1
|
||||
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f
|
||||
github.com/mattn/go-mastodon v0.0.10
|
||||
github.com/webview/webview_go v0.0.0-20240831120633-6173450d4dd6
|
||||
|
||||
15
go.sum
15
go.sum
@@ -37,6 +37,8 @@ github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8
|
||||
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/hack-pad/go-indexeddb v0.3.2 h1:DTqeJJYc1usa45Q5r52t01KhvlSN02+Oq+tQbSBI91A=
|
||||
@@ -47,6 +49,10 @@ github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade h1:FmusiCI1wH
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade/go.mod h1:ZDXo8KHryOWSIqnsb/CiDq7hQUYryCgdVnxbj8tDG7o=
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 h1:YLvr1eE6cdCqjOe972w/cYF+FjW34v27+9Vo5106B4M=
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/k3a/html2text v1.2.1 h1:nvnKgBvBR/myqrwfLuiqecUtaK1lB9hGziIJKatNFVY=
|
||||
github.com/k3a/html2text v1.2.1/go.mod h1:ieEXykM67iT8lTvEWBh6fhpH4B23kB9OMKPdIBmgUqA=
|
||||
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f h1:dKccXx7xA56UNqOcFIbuqFjAWPVtP688j5QMgmo6OHU=
|
||||
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f/go.mod h1:4rEELDSfUAlBSyUjPG0JnaNGjf13JySHFeRdD/3dLP0=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -65,6 +71,10 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rymdport/portal v0.4.2 h1:7jKRSemwlTyVHHrTGgQg7gmNPJs88xkbKcIL3NlcmSU=
|
||||
github.com/rymdport/portal v0.4.2/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE=
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c/go.mod h1:cNQ3dwVJtS5Hmnjxy6AgTPd0Inb3pW05ftPSX7NZO7Q=
|
||||
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef h1:Ch6Q+AZUxDBCVqdkI8FSpFyZDtCVBc2VmejdNrm5rRQ=
|
||||
@@ -77,14 +87,19 @@ github.com/webview/webview_go v0.0.0-20240831120633-6173450d4dd6 h1:VQpB2SpK88C6
|
||||
github.com/webview/webview_go v0.0.0-20240831120633-6173450d4dd6/go.mod h1:yE65LFCeWf4kyWD5re+h4XNvOHJEXOCOuJZ4v8l5sgk=
|
||||
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
||||
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
|
||||
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
||||
55
main.go
55
main.go
@@ -3,7 +3,9 @@ package main
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/app"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/storage"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
@@ -11,6 +13,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/kirsle/configdir"
|
||||
"github.com/mattn/go-mastodon"
|
||||
"github.com/k3a/html2text"
|
||||
webview "github.com/webview/webview_go"
|
||||
|
||||
"encoding/json"
|
||||
@@ -21,6 +24,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
_ "time"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -67,6 +71,9 @@ var ProfileSetupProfile *FederaleProfile
|
||||
var ProfileSelectionDone bool = false
|
||||
var ProfileSelectionProfile *FederaleProfile
|
||||
|
||||
// The visibility that the post is going to be posted with
|
||||
var PostVisibility string
|
||||
|
||||
// This function saves the config in memory to disk.
|
||||
func SaveConfigToDisk() error {
|
||||
ConfigPath := configdir.LocalConfig("federale") // Federale foler in the user's config directory
|
||||
@@ -380,18 +387,50 @@ func main() {
|
||||
ReplyIDLabel := widget.NewLabel("In reply to")
|
||||
ReplyBox := container.NewHBox(ReplyIDLabel, ReplyIDEntry)
|
||||
|
||||
Timeline := container.NewVBox(widget.NewLabel("Please Wait..."))
|
||||
Timeline := container.NewGridWithColumns(4)
|
||||
|
||||
VisibilitySelector := widget.NewSelect([]string{"public", "unlisted", "private", "direct"}, func(value string) {
|
||||
PostVisibility = value
|
||||
})
|
||||
|
||||
go func() {
|
||||
NewTimeline := container.NewVBox(widget.NewLabel("Posts"))
|
||||
//pg := new(mastodon.Pagination)
|
||||
///
|
||||
Timeline = NewTimeline
|
||||
pg := new(mastodon.Pagination)
|
||||
//NewTimeline := container.NewVBox(widget.NewLabel("Notifications"))
|
||||
notis, err := Client.GetNotifications(context.Background(), pg)
|
||||
if err != nil {
|
||||
Timeline.Objects[0] = widget.NewLabel(fmt.Sprintf("Error getting notifications: %s", err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range notis {
|
||||
timeb, err := v.CreatedAt.MarshalText()
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
timestring := string(timeb)
|
||||
label := widget.NewLabel(html2text.HTML2Text(v.Status.Content))
|
||||
label.Truncation = fyne.TextTruncateEllipsis
|
||||
avatar_uri := v.Account.AvatarStatic
|
||||
u, err := storage.ParseURI(avatar_uri)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
im := canvas.NewImageFromURI(u)
|
||||
im.FillMode = canvas.ImageFillContain
|
||||
Timeline.Add(im)
|
||||
Timeline.Add(widget.NewRichTextFromMarkdown(fmt.Sprintf("%s %s your post", v.Account.Username, v.Type)))
|
||||
Timeline.Add(label)
|
||||
Timeline.Add(widget.NewLabel(timestring))
|
||||
}
|
||||
//Timeline = NewTimeline
|
||||
}()
|
||||
|
||||
MainWindow.SetContent(container.NewHBox(container.NewVBox(TootEntry, ReplyBox, widget.NewButton("Post", func() {
|
||||
MainWindow.SetContent(container.NewHSplit(container.NewVBox(TootEntry, ReplyBox, VisibilitySelector, widget.NewButton("Post", func() {
|
||||
toot := mastodon.Toot{
|
||||
Status: TootEntry.Text,
|
||||
Visibility: "public",
|
||||
Visibility: PostVisibility,
|
||||
InReplyToID: mastodon.ID(ReplyIDEntry.Text),
|
||||
}
|
||||
|
||||
@@ -399,6 +438,6 @@ func main() {
|
||||
if err != nil {
|
||||
dialog.ShowError(err, MainWindow)
|
||||
}
|
||||
})), Timeline))
|
||||
})), container.NewVScroll(Timeline)))
|
||||
MainWindow.ShowAndRun()
|
||||
}
|
||||
|
||||
BIN
rsrc_windows_amd64.syso
Normal file
BIN
rsrc_windows_amd64.syso
Normal file
Binary file not shown.
Reference in New Issue
Block a user