Ensure public id for accept is an url
All checks were successful
/ docker (push) Successful in 4m22s
All checks were successful
/ docker (push) Successful in 4m22s
This commit is contained in:
parent
2c0a4c88d5
commit
b75db5676b
1 changed files with 9 additions and 1 deletions
|
@ -5,12 +5,14 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
webutils "git.mstar.dev/mstar/goutils/http"
|
webutils "git.mstar.dev/mstar/goutils/http"
|
||||||
"github.com/rs/zerolog/hlog"
|
"github.com/rs/zerolog/hlog"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"git.mstar.dev/mstar/linstrom/activitypub"
|
"git.mstar.dev/mstar/linstrom/activitypub"
|
||||||
|
"git.mstar.dev/mstar/linstrom/config"
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new"
|
"git.mstar.dev/mstar/linstrom/storage-new"
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
||||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||||
|
@ -66,8 +68,14 @@ func AcceptFromStorage(ctx context.Context, id string) (*ActivityAcceptOut, erro
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
var outId string
|
||||||
|
if strings.HasPrefix(id, "http") {
|
||||||
|
outId = id
|
||||||
|
} else {
|
||||||
|
outId = fmt.Sprintf("%s/api/activitypub/activity/accept/%s", config.GlobalConfig.General.GetFullPublicUrl(), id)
|
||||||
|
}
|
||||||
return &ActivityAcceptOut{
|
return &ActivityAcceptOut{
|
||||||
Id: id,
|
Id: outId,
|
||||||
Actor: follow.Object.(string),
|
Actor: follow.Object.(string),
|
||||||
Type: "Accept",
|
Type: "Accept",
|
||||||
Object: follow,
|
Object: follow,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue