@@ -17,6 +17,7 @@ import (
1717 "strings"
1818)
1919
20+ // API constants for communicating with Write.as.
2021const (
2122 apiUrl = "https://write.as"
2223 hiddenApiUrl = "http://writeas7pm7rcdqg.onion"
@@ -25,14 +26,15 @@ const (
2526
2627// Application constants.
2728const (
28- VERSION = "0.4"
29+ version = "0.4"
2930)
3031
3132// Defaults for posts on Write.as.
3233const (
3334 defaultFont = PostFontMono
3435)
3536
37+ // Available flags for creating posts
3638var postFlags = []cli.Flag {
3739 cli.BoolFlag {
3840 Name : "tor, t" ,
@@ -60,7 +62,7 @@ func main() {
6062 // Run the app
6163 app := cli .NewApp ()
6264 app .Name = "writeas"
63- app .Version = VERSION
65+ app .Version = version
6466 app .Usage = "Simple text pasting and publishing"
6567 app .Authors = []cli.Author {
6668 {
@@ -436,7 +438,7 @@ func DoFetch(friendlyId string, tor bool) {
436438 urlStr , client := client (true , tor , path , "" )
437439
438440 r , _ := http .NewRequest ("GET" , urlStr , nil )
439- r .Header .Add ("User-Agent" , "writeas-cli v" + VERSION )
441+ r .Header .Add ("User-Agent" , "writeas-cli v" + version )
440442
441443 resp , err := client .Do (r )
442444 check (err )
@@ -464,7 +466,7 @@ func DoPost(post []byte, font string, encrypt, tor, code bool) error {
464466 urlStr , client := client (false , tor , "" , "" )
465467
466468 r , _ := http .NewRequest ("POST" , urlStr , bytes .NewBufferString (data .Encode ()))
467- r .Header .Add ("User-Agent" , "writeas-cli v" + VERSION )
469+ r .Header .Add ("User-Agent" , "writeas-cli v" + version )
468470 r .Header .Add ("Content-Type" , "application/x-www-form-urlencoded" )
469471 r .Header .Add ("Content-Length" , strconv .Itoa (len (data .Encode ())))
470472
@@ -517,7 +519,7 @@ func DoUpdate(post []byte, friendlyId, token, font string, tor, code bool) {
517519 }
518520
519521 r , _ := http .NewRequest ("POST" , urlStr , bytes .NewBufferString (data .Encode ()))
520- r .Header .Add ("User-Agent" , "writeas-cli v" + VERSION )
522+ r .Header .Add ("User-Agent" , "writeas-cli v" + version )
521523 r .Header .Add ("Content-Type" , "application/x-www-form-urlencoded" )
522524 r .Header .Add ("Content-Length" , strconv .Itoa (len (data .Encode ())))
523525
@@ -544,7 +546,7 @@ func DoDelete(friendlyId, token string, tor bool) {
544546 urlStr , client := client (false , tor , friendlyId , fmt .Sprintf ("t=%s" , token ))
545547
546548 r , _ := http .NewRequest ("DELETE" , urlStr , nil )
547- r .Header .Add ("User-Agent" , "writeas-cli v" + VERSION )
549+ r .Header .Add ("User-Agent" , "writeas-cli v" + version )
548550 r .Header .Add ("Content-Type" , "application/x-www-form-urlencoded" )
549551
550552 resp , err := client .Do (r )
0 commit comments