go fmt'ed
This commit is contained in:
parent
b2974b7501
commit
85e0735fa3
2
db.go
2
db.go
@ -3,8 +3,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"github.com/jackc/pgx/pgxpool"
|
"github.com/jackc/pgx/pgxpool"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getDbPool() *pgxpool.Pool {
|
func getDbPool() *pgxpool.Pool {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/jackc/pgx/pgxpool"
|
||||||
"github.com/microcosm-cc/bluemonday"
|
"github.com/microcosm-cc/bluemonday"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -8,7 +9,6 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"github.com/jackc/pgx/pgxpool"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Current instances
|
// Current instances
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
var p *bluemonday.Policy
|
var p *bluemonday.Policy
|
||||||
var spaceReg *regexp.Regexp
|
var spaceReg *regexp.Regexp
|
||||||
|
|
||||||
func GetRunner(endpoint string) (RunningInstance) {
|
func GetRunner(endpoint string) RunningInstance {
|
||||||
ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
o, exists := runninginstances[endpoint]
|
o, exists := runninginstances[endpoint]
|
||||||
if exists == false {
|
if exists == false {
|
||||||
@ -31,15 +31,13 @@ func GetRunner(endpoint string) (RunningInstance) {
|
|||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func UpdateRunner(endpoint string, o RunningInstance) {
|
func UpdateRunner(endpoint string, o RunningInstance) {
|
||||||
ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
runninginstances[endpoint] = o
|
runninginstances[endpoint] = o
|
||||||
ri_mutex.Unlock()
|
ri_mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetNodeInfo(endpoint string, o RunningInstance) RunningInstance {
|
||||||
func GetNodeInfo(endpoint string, o RunningInstance) (RunningInstance) {
|
|
||||||
/* Checking order
|
/* Checking order
|
||||||
* Mastodon/Pleroma
|
* Mastodon/Pleroma
|
||||||
* Um..nothing else yet
|
* Um..nothing else yet
|
||||||
|
4
oauth.go
4
oauth.go
@ -26,7 +26,7 @@ func (e *authError) Error() string {
|
|||||||
return e.msg
|
return e.msg
|
||||||
}
|
}
|
||||||
|
|
||||||
func register_client(endpoint string, o *RunningInstance) (error) {
|
func register_client(endpoint string, o *RunningInstance) error {
|
||||||
requestBodymap, _ := json.Marshal(map[string]string{
|
requestBodymap, _ := json.Marshal(map[string]string{
|
||||||
"client_name": "Tusky", // Hard-coded in for now...
|
"client_name": "Tusky", // Hard-coded in for now...
|
||||||
"scopes": "read write follow push",
|
"scopes": "read write follow push",
|
||||||
@ -91,7 +91,7 @@ func register_client(endpoint string, o *RunningInstance) (error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func get_client(endpoint string, o *RunningInstance) (error) {
|
func get_client(endpoint string, o *RunningInstance) error {
|
||||||
var err error
|
var err error
|
||||||
client_file := "clients/" + endpoint
|
client_file := "clients/" + endpoint
|
||||||
_, err = os.Stat(client_file)
|
_, err = os.Stat(client_file)
|
||||||
|
15
retrieve.go
15
retrieve.go
@ -2,14 +2,14 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"strings"
|
|
||||||
"log"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"html"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"html"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ImageType struct {
|
type ImageType struct {
|
||||||
@ -47,7 +47,6 @@ type PostJson struct {
|
|||||||
posthash []byte
|
posthash []byte
|
||||||
receivedAt time.Time `json:"created_at"`
|
receivedAt time.Time `json:"created_at"`
|
||||||
|
|
||||||
|
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
Conversation string `json:"conversation"`
|
Conversation string `json:"conversation"`
|
||||||
Published time.Time `json:"published"`
|
Published time.Time `json:"published"`
|
||||||
@ -63,7 +62,7 @@ type PostJson struct {
|
|||||||
instance string
|
instance string
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetHTTPSession(endpoint string) (RunningInstance) {
|
func GetHTTPSession(endpoint string) RunningInstance {
|
||||||
ri_mutex.Lock()
|
ri_mutex.Lock()
|
||||||
o, exist := runninginstances[endpoint]
|
o, exist := runninginstances[endpoint]
|
||||||
ri_mutex.Unlock()
|
ri_mutex.Unlock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user