changed url to uri
This commit is contained in:
parent
f7dd23bc55
commit
a3644cce8f
@ -15,7 +15,7 @@ func writePost(pool *pgxpool.Pool, reportpost ReportPost) {
|
|||||||
|
|
||||||
// Insert new account if new
|
// Insert new account if new
|
||||||
var accountid int
|
var accountid int
|
||||||
err = conn.QueryRow(context.Background(), "INSERT INTO accounts (acct, avatar, bot, created_at, display_name, url) VALUES($1, $2, $3, $4, $5, $6) ON CONFLICT(acct) DO UPDATE SET acct=EXCLUDED.acct RETURNING id", reportpost.Account.Acct, reportpost.Account.Avatar, reportpost.Account.Bot, reportpost.Account.Created_at, reportpost.Account.Display_name, reportpost.Account.Url).Scan(&accountid)
|
err = conn.QueryRow(context.Background(), "INSERT INTO accounts (acct, avatar, bot, created_at, display_name, uri) VALUES($1, $2, $3, $4, $5, $6) ON CONFLICT(acct) DO UPDATE SET acct=EXCLUDED.acct RETURNING id", reportpost.Account.Acct, reportpost.Account.Avatar, reportpost.Account.Bot, reportpost.Account.Created_at, reportpost.Account.Display_name, reportpost.Account.Url).Scan(&accountid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("First ", err)
|
log.Print("First ", err)
|
||||||
log.Print("--------------------------")
|
log.Print("--------------------------")
|
||||||
@ -33,7 +33,7 @@ func writePost(pool *pgxpool.Pool, reportpost ReportPost) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert new post if new
|
// Insert new post if new
|
||||||
_, err = conn.Exec(context.Background(), "INSERT INTO posts (url, content, created_at, normalized, account_id, posthash) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (posthash) DO NOTHING", reportpost.Url, reportpost.Content, reportpost.Created_at, reportpost.normalized, accountid, reportpost.posthash)
|
_, err = conn.Exec(context.Background(), "INSERT INTO posts (uri, content, created_at, normalized, account_id, posthash) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT (posthash) DO NOTHING", reportpost.Url, reportpost.Content, reportpost.Created_at, reportpost.normalized, accountid, reportpost.posthash)
|
||||||
if err != nil { // For now I want to know why this failed.
|
if err != nil { // For now I want to know why this failed.
|
||||||
log.Print("Second ", err)
|
log.Print("Second ", err)
|
||||||
log.Print("--------------------------")
|
log.Print("--------------------------")
|
||||||
|
@ -21,7 +21,7 @@ type ReportPost struct {
|
|||||||
|
|
||||||
// Retrieved values
|
// Retrieved values
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
Url string `json:"url"`
|
Url string `json:"uri"`
|
||||||
Account AccountType
|
Account AccountType
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
Created_at string `json:"created_at"`
|
Created_at string `json:"created_at"`
|
||||||
@ -37,7 +37,7 @@ type AccountType struct {
|
|||||||
Bot bool `json:"bot"`
|
Bot bool `json:"bot"`
|
||||||
Created_at string `json:"created_at"`
|
Created_at string `json:"created_at"`
|
||||||
Display_name string `json:"display_name"`
|
Display_name string `json:"display_name"`
|
||||||
Url string `json:"url"`
|
Url string `json:"uri"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instance's new min_id value
|
// Instance's new min_id value
|
||||||
|
@ -85,7 +85,7 @@ func PollMastodonPleroma(endpoint string, reportPostChan chan ReportPost) {
|
|||||||
m.Status = CLIENT_ISSUE
|
m.Status = CLIENT_ISSUE
|
||||||
runninginstances[endpoint] = m
|
runninginstances[endpoint] = m
|
||||||
ri_mutex.Unlock()
|
ri_mutex.Unlock()
|
||||||
log.Print("Failure here", err.Error())
|
log.Fatal("Failure here", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,10 +216,10 @@ func GetNodeInfo(endpoint string) (NodeInfo) {
|
|||||||
* Mastodon/Pleroma
|
* Mastodon/Pleroma
|
||||||
* Um..nothing else yet
|
* Um..nothing else yet
|
||||||
*/
|
*/
|
||||||
pleromastodon_nodeinfo_url := "https://" + endpoint + "/nodeinfo/2.0.json"
|
pleromastodon_nodeinfo_uri := "https://" + endpoint + "/nodeinfo/2.0.json"
|
||||||
//http_client := http.Client{Timeout: 10 * time.Second}
|
//http_client := http.Client{Timeout: 10 * time.Second}
|
||||||
http_client := http.Client{}
|
http_client := http.Client{}
|
||||||
pleromastodon_api_resp, err := http_client.Get(pleromastodon_nodeinfo_url)
|
pleromastodon_api_resp, err := http_client.Get(pleromastodon_nodeinfo_uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NodeInfo{}
|
return NodeInfo{}
|
||||||
} else {
|
} else {
|
||||||
@ -236,8 +236,8 @@ func GetNodeInfo(endpoint string) (NodeInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check the front page
|
// Check the front page
|
||||||
index_url := "https://" + endpoint + "/"
|
index_uri := "https://" + endpoint + "/"
|
||||||
resp_index, err := http_client.Get(index_url)
|
resp_index, err := http_client.Get(index_uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print("Unable to connect to " + endpoint + ", giving up")
|
log.Print("Unable to connect to " + endpoint + ", giving up")
|
||||||
return NodeInfo{}
|
return NodeInfo{}
|
||||||
|
@ -6,13 +6,13 @@ CREATE TABLE accounts (
|
|||||||
bot boolean,
|
bot boolean,
|
||||||
created_at timestamptz DEFAULT NOW(),
|
created_at timestamptz DEFAULT NOW(),
|
||||||
display_name VARCHAR(2000) NOT NULL,
|
display_name VARCHAR(2000) NOT NULL,
|
||||||
url VARCHAR(2083) NOT NULL
|
uri VARCHAR(2083) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE posts (
|
CREATE TABLE posts (
|
||||||
id serial NOT NULL PRIMARY KEY,
|
id serial NOT NULL PRIMARY KEY,
|
||||||
|
|
||||||
url VARCHAR(2083) NOT NULL,
|
uri VARCHAR(2083) NOT NULL,
|
||||||
content text,
|
content text,
|
||||||
created_at timestamptz DEFAULT NOW(),
|
created_at timestamptz DEFAULT NOW(),
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ func users_fedilogue(w http.ResponseWriter, r *http.Request) {
|
|||||||
userjsonmap["summary"] = ""
|
userjsonmap["summary"] = ""
|
||||||
userjsonmap["tag"] = tag
|
userjsonmap["tag"] = tag
|
||||||
userjsonmap["type"] = "Person"
|
userjsonmap["type"] = "Person"
|
||||||
userjsonmap["url"] = "https://" + host + "/users/fedilogue"
|
userjsonmap["uri"] = "https://" + host + "/users/fedilogue"
|
||||||
|
|
||||||
userjsonbin, err := json.Marshal(userjsonmap)
|
userjsonbin, err := json.Marshal(userjsonmap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user