You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

162 lines
4.6 KiB

package main
import (
"gotoot/ui"
)
func main () {
//ui.GtkStart( &ConfigType{Filename:ConfigFile} )
//return
ui.GtkStart ()
//ui.NewConnectionStartup ( cfg )
//fmt.Println ("Returned from NewConnection");
return
/*
if client == nil {
if cfg.Server == "" || cfg.ClientId == "" || cfg.ClientSecret == "" {
fmt.Printf("CONFIG: %+v\n\n", cfg)
cfg.Server = "toot.kif.rocks" // TODO: user input
cfg.ClientId, cfg.ClientSecret, err = CreateOAuth2Credentials ( cfg.Server )
if err != nil {
fmt.Printf ("Credential error: %+v\n", err )
}
cfg.Scopes = DefaultScopes
}
fmt.Println ("Trying to get OAuth2 Toundefinedken")
fmt.Println( AuthUrl ( cfg.Server, cfg.ClientId, cfg.ClientSecret, cfg.Scopes ) );
var code string;
if _, err := fmt.Scan(&code); err != nil {
log.Fatal(err)
}
client, tok, err = Connect (
cfg.Server,
cfg.ClientId,
cfg.ClientSecret,
cfg.Scopes,
code )
if err != nil {
fmt.Printf ("Conection error: %v", err)
panic("")
}
SetActiveConf ( cfg.Server, client, "/api/v1" )
_, err = VerifyCredentials()
if err != nil {
fmt.Printf ("Token error: %v", err)
panic("")
}
cfg.Token = *tok
err = cfg.Write ( ConfigFile )
if err != nil {
fmt.Printf ( "Config Write Error: %v\n", err )
}
}*/
/*if client == nil {
panic ("Cannot establish connection to server")
}
if err != nil {
fmt.Printf ("Error: %+v\n", err )
} else {
fmt.Printf("Client obj: %+v\n", client)
SetActiveConf ( cfg.Server, client, "/api/v1" )
acc2, err := VerifyCredentials()
if err != nil {
fmt.Printf ("error: %+v\n", err)
} else {
fmt.Printf("Account: %+v\n", acc2)
/*accs, err := acc2.Followers()
if err != nil {
fmt.Printf("Errs: %+v", err )
} else {
fmt.Printf("Followers: %+v\n", accs )
}*
}
}
/*var s *TootStatus
s, err = GetStatus ("102315364006090988")
if err != nil {
fmt.Println ("Toot get error:", err)
}
fmt.Printf ("Status: %+v\n", s)
att := s.MediaAttachments[0]
cache, err := NewCacherFromFile ( "cache.persist" )
cache.EmptyCache()
if err != nil {
fmt.Println ("Cacher Creation err: ", err )
}
_, err = cache.Get ( att.PreviewUrl )
fmt.Println ("Error", err)
_, err = cache.Get ( att.Url )
fmt.Println ("Error", err)
_, err = cache.Get ( att.TextUrl )
fmt.Println ("Error", err)
err = cache.Persist ( "cache.persist" )
if err != nil {
fmt.Println ("Persist: ", err )
}
/*var a TootAttachment
a.Description = "Ein Testbild, es gibt hier nichts zu sehen"
a.LocalUrl = "testmedia.png"
att, err := a.Post()
if err != nil {
fmt.Println ("Attachment post error: ", err )
os.Exit(-1)
}
fmt.Println ("Attachment: ", att )
var sta TootStatus = TootStatus{ Content: "Dies ist ein Test-Toot! #AppTest #GoToot", SpoilerText: "Test-Toot with attachment! #AppTest", MediaAttachments: []TootAttachment{*att} }
_, err = sta.PostStatus ( nil )
if err != nil {
fmt.Println ("Toot-Sending error: ", err )
} else {
fmt.Println ("Success!")
}
os.Exit(-1)
var s TootStatus = TootStatus{ Content: "Dies ist ein Test-Toot! #AppTest #GoToot", SpoilerText: "Test-Toot! #AppTest" }
st, err := s.PostStatus ( nil )
if err != nil {
fmt.Println ("Toot-Sending error: ", err )
} else {
fmt.Printf ("Status: %+v\n", st )
err = st.PostFavourite()
if err != nil {
fmt.Println ("Favourite-err: ", err )
}
err = st.PostReblog()
if err != nil {
fmt.Println ("Reblog-err: ", err )
}
err = st.PostPin()
if err != nil {
fmt.Println ("Pin-err: ", err )
}
err = st.PostUnfavourite()
if err != nil {
fmt.Println ("Favourite-err: ", err )
}
err = st.PostUnreblog()
if err != nil {
fmt.Println ("Reblog-err: ", err )
}
err = st.PostUnpin()
if err != nil {
fmt.Println ("Pin-err: ", err )
}
}*/
}