Compare commits
No commits in common. "671d18d2ba7cbff404aea487ff7cb11705a39c35" and "fb95ee48cc933c0138f0953658aaf880c0fc6850" have entirely different histories.
671d18d2ba
...
fb95ee48cc
18 changed files with 23 additions and 267 deletions
|
@ -49,7 +49,6 @@ func main() {
|
|||
g.ApplyInterface(func(models.INotification) {}, models.Notification{})
|
||||
g.ApplyInterface(func(models.IUser) {}, models.User{})
|
||||
g.ApplyInterface(func(models.IAccessToken) {}, models.AccessToken{})
|
||||
g.ApplyInterface(func(models.INote) {}, models.Note{})
|
||||
|
||||
log.Info().Msg("Extra features applied, starting generation")
|
||||
g.Execute()
|
||||
|
|
|
@ -4,6 +4,6 @@ type Clonable interface {
|
|||
Clone() Clonable
|
||||
}
|
||||
|
||||
type Sanitisable interface {
|
||||
type Santisable interface {
|
||||
Sanitize()
|
||||
}
|
||||
|
|
|
@ -255,11 +255,6 @@ func newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -502,9 +497,6 @@ type noteTagBelongsToNote struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -255,11 +255,6 @@ func newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -510,9 +505,6 @@ type noteToAttachmentBelongsToNote struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -193,11 +193,6 @@ func newNoteToBoost(db *gorm.DB, opts ...gen.DOOption) noteToBoost {
|
|||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -517,9 +512,6 @@ type noteToBoostBelongsToNote struct {
|
|||
Creator struct {
|
||||
field.RelationField
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -255,11 +255,6 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -510,9 +505,6 @@ type noteToEmoteBelongsToNote struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -255,11 +255,6 @@ func newNoteToFeed(db *gorm.DB, opts ...gen.DOOption) noteToFeed {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -502,9 +497,6 @@ type noteToFeedBelongsToNote struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -255,11 +255,6 @@ func newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -510,9 +505,6 @@ type noteToPingBelongsToNote struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -6,7 +6,6 @@ package dbgen
|
|||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
|
@ -34,11 +33,11 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
_note.CreatorId = field.NewString(tableName, "creator_id")
|
||||
_note.Remote = field.NewBool(tableName, "remote")
|
||||
_note.RawContent = field.NewString(tableName, "raw_content")
|
||||
_note.ContentWarning = field.NewField(tableName, "content_warning")
|
||||
_note.RepliesTo = field.NewField(tableName, "replies_to")
|
||||
_note.Quotes = field.NewField(tableName, "quotes")
|
||||
_note.ContentWarning = field.NewString(tableName, "content_warning")
|
||||
_note.RepliesTo = field.NewString(tableName, "replies_to")
|
||||
_note.Quotes = field.NewString(tableName, "quotes")
|
||||
_note.AccessLevel = field.NewField(tableName, "access_level")
|
||||
_note.OriginId = field.NewUint(tableName, "origin_id")
|
||||
_note.OriginServer = field.NewString(tableName, "origin_server")
|
||||
_note.AttachmentRelations = noteHasManyAttachmentRelations{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
|
@ -117,9 +116,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
}
|
||||
|
@ -377,11 +373,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("AttachmentRelations.Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
|
@ -496,12 +487,6 @@ func newNote(db *gorm.DB, opts ...gen.DOOption) note {
|
|||
RelationField: field.NewRelation("Creator", "models.User"),
|
||||
}
|
||||
|
||||
_note.Origin = noteBelongsToOrigin{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Origin", "models.RemoteServer"),
|
||||
}
|
||||
|
||||
_note.fillFieldMap()
|
||||
|
||||
return _note
|
||||
|
@ -518,11 +503,11 @@ type note struct {
|
|||
CreatorId field.String
|
||||
Remote field.Bool
|
||||
RawContent field.String
|
||||
ContentWarning field.Field
|
||||
RepliesTo field.Field
|
||||
Quotes field.Field
|
||||
ContentWarning field.String
|
||||
RepliesTo field.String
|
||||
Quotes field.String
|
||||
AccessLevel field.Field
|
||||
OriginId field.Uint
|
||||
OriginServer field.String
|
||||
AttachmentRelations noteHasManyAttachmentRelations
|
||||
|
||||
EmoteRelations noteHasManyEmoteRelations
|
||||
|
@ -533,8 +518,6 @@ type note struct {
|
|||
|
||||
Creator noteBelongsToCreator
|
||||
|
||||
Origin noteBelongsToOrigin
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
|
@ -557,11 +540,11 @@ func (n *note) updateTableName(table string) *note {
|
|||
n.CreatorId = field.NewString(table, "creator_id")
|
||||
n.Remote = field.NewBool(table, "remote")
|
||||
n.RawContent = field.NewString(table, "raw_content")
|
||||
n.ContentWarning = field.NewField(table, "content_warning")
|
||||
n.RepliesTo = field.NewField(table, "replies_to")
|
||||
n.Quotes = field.NewField(table, "quotes")
|
||||
n.ContentWarning = field.NewString(table, "content_warning")
|
||||
n.RepliesTo = field.NewString(table, "replies_to")
|
||||
n.Quotes = field.NewString(table, "quotes")
|
||||
n.AccessLevel = field.NewField(table, "access_level")
|
||||
n.OriginId = field.NewUint(table, "origin_id")
|
||||
n.OriginServer = field.NewString(table, "origin_server")
|
||||
|
||||
n.fillFieldMap()
|
||||
|
||||
|
@ -578,7 +561,7 @@ func (n *note) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||
}
|
||||
|
||||
func (n *note) fillFieldMap() {
|
||||
n.fieldMap = make(map[string]field.Expr, 18)
|
||||
n.fieldMap = make(map[string]field.Expr, 17)
|
||||
n.fieldMap["id"] = n.ID
|
||||
n.fieldMap["created_at"] = n.CreatedAt
|
||||
n.fieldMap["updated_at"] = n.UpdatedAt
|
||||
|
@ -590,7 +573,7 @@ func (n *note) fillFieldMap() {
|
|||
n.fieldMap["replies_to"] = n.RepliesTo
|
||||
n.fieldMap["quotes"] = n.Quotes
|
||||
n.fieldMap["access_level"] = n.AccessLevel
|
||||
n.fieldMap["origin_id"] = n.OriginId
|
||||
n.fieldMap["origin_server"] = n.OriginServer
|
||||
|
||||
}
|
||||
|
||||
|
@ -683,9 +666,6 @@ type noteHasManyAttachmentRelations struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
}
|
||||
|
@ -1074,77 +1054,6 @@ func (a noteBelongsToCreatorTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteBelongsToOrigin struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
}
|
||||
|
||||
func (a noteBelongsToOrigin) Where(conds ...field.Expr) *noteBelongsToOrigin {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToOrigin) WithContext(ctx context.Context) *noteBelongsToOrigin {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToOrigin) Session(session *gorm.Session) *noteBelongsToOrigin {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteBelongsToOrigin) Model(m *models.Note) *noteBelongsToOriginTx {
|
||||
return ¬eBelongsToOriginTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type noteBelongsToOriginTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteBelongsToOriginTx) Find() (result *models.RemoteServer, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a noteBelongsToOriginTx) Append(values ...*models.RemoteServer) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToOriginTx) Replace(values ...*models.RemoteServer) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToOriginTx) Delete(values ...*models.RemoteServer) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteBelongsToOriginTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a noteBelongsToOriginTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteDo struct{ gen.DO }
|
||||
|
||||
type INoteDo interface {
|
||||
|
@ -1206,30 +1115,6 @@ type INoteDo interface {
|
|||
Returning(value interface{}, columns ...string) INoteDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
|
||||
GetNotesPaged(userId string, pageNr uint, accessLevel uint8) (result []models.Note, err error)
|
||||
}
|
||||
|
||||
// Get all notes by a user, paged, that are a specific access level.
|
||||
// Ordered by age, descending (newest first)
|
||||
//
|
||||
// SELECT * FROM @@table
|
||||
// WHERE creator_id = @userId AND access_level = @accessLevel
|
||||
// ORDER BY created_at DESC LIMIT 50 OFFSET @pageNr * 50
|
||||
func (n noteDo) GetNotesPaged(userId string, pageNr uint, accessLevel uint8) (result []models.Note, err error) {
|
||||
var params []interface{}
|
||||
|
||||
var generateSQL strings.Builder
|
||||
params = append(params, userId)
|
||||
params = append(params, accessLevel)
|
||||
params = append(params, pageNr)
|
||||
generateSQL.WriteString("SELECT * FROM notes WHERE creator_id = ? AND access_level = ? ORDER BY created_at DESC LIMIT 50 OFFSET ? * 50 ")
|
||||
|
||||
var executeSQL *gorm.DB
|
||||
executeSQL = n.UnderlyingDB().Raw(generateSQL.String(), params...).Find(&result) // ignore_security_alert
|
||||
err = executeSQL.Error
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (n noteDo) Debug() INoteDo {
|
||||
|
|
|
@ -199,11 +199,6 @@ func newNotification(db *gorm.DB, opts ...gen.DOOption) notification {
|
|||
}{
|
||||
RelationField: field.NewRelation("SourceNote.Creator", "models.User"),
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("SourceNote.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -546,9 +541,6 @@ type notificationBelongsToSourceNote struct {
|
|||
Creator struct {
|
||||
field.RelationField
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -259,11 +259,6 @@ func newReaction(db *gorm.DB, opts ...gen.DOOption) reaction {
|
|||
},
|
||||
},
|
||||
},
|
||||
Origin: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
@ -534,9 +529,6 @@ type reactionBelongsToNote struct {
|
|||
}
|
||||
}
|
||||
}
|
||||
Origin struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
@ -22,25 +21,14 @@ type Note struct {
|
|||
// Raw content of the note. So without additional formatting applied
|
||||
// Might already have formatting applied beforehand from the origin server
|
||||
RawContent string
|
||||
ContentWarning sql.NullString // Content warnings of the note, if it contains any
|
||||
RepliesTo sql.NullString // Url of the message this replies to
|
||||
Quotes sql.NullString // url of the message this note quotes
|
||||
ContentWarning *string // Content warnings of the note, if it contains any
|
||||
RepliesTo *string // Url of the message this replies to
|
||||
Quotes *string // url of the message this note quotes
|
||||
AccessLevel NoteAccessLevel // Where to send this message to (public, home, followers, dm)
|
||||
Origin RemoteServer
|
||||
OriginId uint
|
||||
OriginServer string // Url of the origin server. Also the primary key for those
|
||||
|
||||
AttachmentRelations []NoteToAttachment `gorm:"foreignKey:NoteId"` // Attachments added on to this note
|
||||
EmoteRelations []NoteToEmote `gorm:"foreignKey:NoteId"` // Emotes used in this note
|
||||
PingRelations []NoteToPing `gorm:"foreignKey:NoteId"` // Pings/mentions this note performs
|
||||
Tags []NoteTag `gorm:"foreignKey:NoteId"` // Tags this note contains
|
||||
}
|
||||
|
||||
type INote interface {
|
||||
// Get all notes by a user, paged, that are a specific access level.
|
||||
// Ordered by age, descending (newest first)
|
||||
//
|
||||
// SELECT * FROM @@table
|
||||
// WHERE creator_id = @userId AND access_level = @accessLevel
|
||||
// ORDER BY created_at DESC LIMIT 50 OFFSET @pageNr * 50
|
||||
GetNotesPaged(userId string, pageNr uint, accessLevel uint8) ([]Note, error)
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@ func (n *NoteAccessLevel) Value() (driver.Value, error) {
|
|||
}
|
||||
|
||||
func (ct *NoteAccessLevel) Scan(value any) error {
|
||||
*ct = NoteAccessLevel(value.(int64))
|
||||
*ct = NoteAccessLevel(value.(uint8))
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ type IUser interface {
|
|||
//
|
||||
// SELECT * FROM @@table WHERE username = @username AND deleted_at IS NULL LIMIT 1
|
||||
GetByUsername(username string) (*gen.T, error)
|
||||
|
||||
// Get all true public accounts (verified & no restricted follow & indexable)
|
||||
// in a paged manner, sorted by date saved
|
||||
//
|
||||
|
@ -97,7 +96,6 @@ type IUser interface {
|
|||
// LIMIT 50
|
||||
// OFFSET @pageNr * 50
|
||||
GetPagedTruePublic(pageNr uint) ([]gen.T, error)
|
||||
|
||||
// Get all deleted accounts in a paged manner, sorted by date saved
|
||||
//
|
||||
// SELECT * FROM @@table WHERE
|
||||
|
@ -106,7 +104,6 @@ type IUser interface {
|
|||
// LIMIT 50
|
||||
// OFFSET @pageNr * 50
|
||||
GetPagedAllDeleted(pageNr uint) ([]gen.T, error)
|
||||
|
||||
// Get all accounts that aren't deleted in a paged manner, sorted by date saved
|
||||
//
|
||||
// SELECT * FROM @@table WHERE
|
||||
|
@ -115,7 +112,6 @@ type IUser interface {
|
|||
// LIMIT 50
|
||||
// OFFSET @pageNr * 50
|
||||
GetPagedAllNonDeleted(pageNr uint) ([]gen.T, error)
|
||||
|
||||
// Gdpr deleted users
|
||||
//
|
||||
// DELETE FROM @@table WHERE deleted_at IS NOT NULL AND deleted_at + interval '30 days' < NOW()
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"git.mstar.dev/mstar/goutils/other"
|
||||
"github.com/google/uuid"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/config"
|
||||
|
@ -26,6 +27,7 @@ func InsertSelf() error {
|
|||
if err != nil {
|
||||
return other.Error("storage", "failed to save/update self server", err)
|
||||
}
|
||||
log.Debug().Any("server", server).Send()
|
||||
user, err := insertUser(server)
|
||||
if err != nil {
|
||||
return other.Error("storage", "failed to save/update self user", err)
|
||||
|
@ -33,9 +35,6 @@ func InsertSelf() error {
|
|||
if err = insertUserPronoun(user); err != nil {
|
||||
return other.Error("storage", "failed to save/update self user pronoun", err)
|
||||
}
|
||||
if err = attachUserToRole(user); err != nil {
|
||||
return other.Error("storage", "failed to save/update self user to full admin role", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -153,13 +152,3 @@ func insertUserPronoun(user *models.User) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func attachUserToRole(user *models.User) error {
|
||||
u2r := models.UserToRole{
|
||||
User: *user,
|
||||
UserId: user.ID,
|
||||
Role: models.FullAdminRole,
|
||||
RoleId: models.FullAdminRole.ID,
|
||||
}
|
||||
return dbgen.UserToRole.Save(&u2r)
|
||||
}
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
// Package webdebug provides a http server for local debugging.
|
||||
// The server is explicitly for localhost only as it offers
|
||||
// a lot more control and access than the public one.
|
||||
// Additionally, there is no guarantee for functional authentication
|
||||
// and authorisation of requests.
|
||||
// Using it can be considered a security risk.
|
||||
//
|
||||
// There is no guarantee for API stability. It might change drastically
|
||||
// across versions or even commits and doesn't need announcements
|
||||
package webdebug
|
||||
|
||||
import (
|
||||
|
@ -25,8 +16,6 @@ func New() *Server {
|
|||
handler.HandleFunc("GET /non-deleted", getNonDeletedUsers)
|
||||
handler.HandleFunc("POST /local-user", createLocalUser)
|
||||
handler.HandleFunc("GET /delete", deleteUser)
|
||||
handler.HandleFunc("POST /post-as", postAs)
|
||||
handler.HandleFunc("GET /notes-for", notesFrom)
|
||||
web := http.Server{
|
||||
Addr: DebugAddr,
|
||||
Handler: handler,
|
||||
|
|
|
@ -1,29 +1,3 @@
|
|||
// Package webpublic contains the public webserver
|
||||
// which provides the primary and only intended access point
|
||||
// for interacting with the system.
|
||||
//
|
||||
// # Sections
|
||||
//
|
||||
// - Frontend: Serves the various web frontend versions
|
||||
// - Main: The original Linstrom specific frontend
|
||||
// - NoJs: An entirely serverside rendered frontend, no JS included
|
||||
// - Custom: Custom frontend files will be served here
|
||||
//
|
||||
// - API: Endpoints for the actual interactions
|
||||
// - Frontend: The API used by the main frontend
|
||||
// - Masto: Mastodon compatible adapter for internal structures
|
||||
// - ActivityPub: For integration with the Fediverse via ActivityPub
|
||||
// - Linstrom-RPC: For Linstrom to Linstrom server communication
|
||||
//
|
||||
// # Guarantees
|
||||
//
|
||||
// - The Masto and ActivityPub API will remain stable
|
||||
// - Frontend API might change, but the intended consumer (Main frontend)
|
||||
// will always be up to date with the changes
|
||||
// - Linstrom-RPC API is versioned and will keep
|
||||
// a few versions of backwards compatibility
|
||||
//
|
||||
// TODO: Decide how long the Linstrom-RPC API will remain backwards compatible
|
||||
package webpublic
|
||||
|
||||
import "net/http"
|
||||
|
|
|
@ -39,7 +39,7 @@ type User struct {
|
|||
}
|
||||
|
||||
// Compiler assertations for interface implementations
|
||||
var _ shared.Sanitisable = &User{}
|
||||
var _ shared.Santisable = &User{}
|
||||
var _ shared.Clonable = &User{}
|
||||
|
||||
func (u *User) Sanitize() {
|
||||
|
|
Loading…
Reference in a new issue