diff --git a/go.mod b/go.mod
index 20209345e..4feebda3d 100644
--- a/go.mod
+++ b/go.mod
@@ -3,6 +3,7 @@ module github.com/gotosocial/gotosocial
go 1.16
require (
+ github.com/gin-gonic/gin v1.6.3 // indirect
github.com/go-fed/activity v1.0.0
github.com/go-oauth2/oauth2/v4 v4.2.0 // indirect
github.com/go-pg/pg/extra/pgdebug v0.2.0
diff --git a/go.sum b/go.sum
index 29b54cfb6..07f8e9ad2 100644
--- a/go.sum
+++ b/go.sum
@@ -59,6 +59,10 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
+github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
+github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/go-fed/activity v1.0.0 h1:j7w3auHZnVCjUcgA1mE+UqSOjFBhvW2Z2res3vNol+o=
github.com/go-fed/activity v1.0.0/go.mod h1:v4QoPaAzjWZ8zN2VFVGL5ep9C02mst0hQYHUpQwso4Q=
github.com/go-fed/httpsig v0.1.1-0.20190914113940-c2de3672e5b5 h1:WLvFZqoXnuVTBKA6U/1FnEHNQ0Rq0QM0rGhY8Tx6R1g=
@@ -75,6 +79,13 @@ github.com/go-pg/pg/v10 v10.8.0 h1:7L1VmOwW/VMmPtz5K3TWWMdM68MDgRs8Yb3c3NTMNgI=
github.com/go-pg/pg/v10 v10.8.0/go.mod h1:0ZZA18+5xlUPvKjlDxoMyU79ZSuJtI+EeM2/GEd4RVo=
github.com/go-pg/zerochecker v0.2.0 h1:pp7f72c3DobMWOb2ErtZsnrPaSvHd2W4o9//8HtF4mU=
github.com/go-pg/zerochecker v0.2.0/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo=
+github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
+github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
+github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
+github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
+github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
+github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-session/session v3.1.2+incompatible h1:yStchEObKg4nk2F7JGE7KoFIrA/1Y078peagMWcrncg=
github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0=
github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg=
@@ -119,6 +130,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -143,6 +155,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
+github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
+github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
@@ -156,10 +170,17 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
+github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g=
github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
+github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
@@ -233,6 +254,10 @@ github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaym
github.com/tidwall/tinyqueue v0.1.1/go.mod h1:O/QNHwrnjqr6IHItYrzoHAKYhBkLI67Q096fQP5zMYw=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
+github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
+github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
+github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
+github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
@@ -551,6 +576,7 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
diff --git a/internal/client/route_statuses.go b/internal/api/route_statuses.go
similarity index 98%
rename from internal/client/route_statuses.go
rename to internal/api/route_statuses.go
index 47907b9a9..fe8aa9699 100644
--- a/internal/client/route_statuses.go
+++ b/internal/api/route_statuses.go
@@ -16,4 +16,4 @@
along with this program. If not, see .
*/
-package client
+package api
diff --git a/internal/api/server.go b/internal/api/server.go
new file mode 100644
index 000000000..a27178855
--- /dev/null
+++ b/internal/api/server.go
@@ -0,0 +1,72 @@
+/*
+ GoToSocial
+ Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package api
+
+import (
+ "net/http"
+
+ "github.com/gin-gonic/gin"
+ "github.com/gotosocial/gotosocial/internal/config"
+ "github.com/sirupsen/logrus"
+)
+
+type Server interface {
+ AttachHTTPHandler(method string, path string, handler http.HandlerFunc)
+ AttachGinHandler(method string, path string, handler gin.HandlerFunc)
+ // AttachMiddleware(handler gin.HandlerFunc)
+ GetAPIGroup() *gin.RouterGroup
+ Start()
+ Stop()
+}
+
+type server struct {
+ APIGroup *gin.RouterGroup
+ logger *logrus.Logger
+ engine *gin.Engine
+}
+
+func (s *server) GetAPIGroup() *gin.RouterGroup {
+ return s.APIGroup
+}
+
+func (s *server) Start() {
+ // todo: start gracefully
+ s.engine.Run()
+}
+
+func (s *server) Stop() {
+ // todo: shut down gracefully
+}
+
+func (s *server) AttachHTTPHandler(method string, path string, handler http.HandlerFunc) {
+ s.engine.Handle(method, path, gin.WrapH(handler))
+}
+
+func (s *server) AttachGinHandler(method string, path string, handler gin.HandlerFunc) {
+ s.engine.Handle(method, path, handler)
+}
+
+func New(config *config.Config, logger *logrus.Logger) Server {
+ engine := gin.New()
+ return &server{
+ APIGroup: engine.Group("/api").Group("/v1"),
+ logger: logger,
+ engine: engine,
+ }
+}
diff --git a/internal/client/client.go b/internal/client/client.go
deleted file mode 100644
index ce0f3e015..000000000
--- a/internal/client/client.go
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- GoToSocial
- Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-*/
-
-package client
-
-// API is the client API exposed to the outside world for access by front-ends; this is distinct from the federation API
-type API interface {
-}
-
-// api implements ClientAPI interface
-type api struct {
-}
diff --git a/internal/client/router.go b/internal/client/router.go
deleted file mode 100644
index 47907b9a9..000000000
--- a/internal/client/router.go
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- GoToSocial
- Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-*/
-
-package client
diff --git a/internal/db/postgres.go b/internal/db/postgres.go
index 61f894a86..0453b207b 100644
--- a/internal/db/postgres.go
+++ b/internal/db/postgres.go
@@ -35,7 +35,7 @@ import (
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"github.com/gotosocial/gotosocial/internal/config"
- "github.com/gotosocial/gotosocial/internal/model"
+ "github.com/gotosocial/gotosocial/internal/gtsmodel"
"github.com/gotosocial/gotosocial/internal/oauth"
"github.com/sirupsen/logrus"
)
@@ -316,8 +316,8 @@ func (ps *postgresService) Stop(ctx context.Context) error {
func (ps *postgresService) CreateSchema(ctx context.Context) error {
models := []interface{}{
- (*model.Account)(nil),
- (*model.Note)(nil),
+ (*gtsmodel.GTSAccount)(nil),
+ (*gtsmodel.GTSStatus)(nil),
}
ps.log.Info("creating db schema")
diff --git a/internal/gotosocial/gotosocial.go b/internal/gotosocial/gotosocial.go
index cf4305ee2..a43af65f9 100644
--- a/internal/gotosocial/gotosocial.go
+++ b/internal/gotosocial/gotosocial.go
@@ -23,7 +23,7 @@ import (
"github.com/go-fed/activity/pub"
"github.com/gotosocial/gotosocial/internal/cache"
- "github.com/gotosocial/gotosocial/internal/client"
+ "github.com/gotosocial/gotosocial/internal/api"
"github.com/gotosocial/gotosocial/internal/config"
"github.com/gotosocial/gotosocial/internal/db"
)
@@ -33,7 +33,7 @@ type Gotosocial interface {
Stop(context.Context) error
}
-func New(db db.DB, cache cache.Cache, clientAPI client.API, federationAPI pub.FederatingActor, config *config.Config) (Gotosocial, error) {
+func New(db db.DB, cache cache.Cache, clientAPI api.Server, federationAPI pub.FederatingActor, config *config.Config) (Gotosocial, error) {
return &gotosocial{
db: db,
cache: cache,
@@ -46,7 +46,7 @@ func New(db db.DB, cache cache.Cache, clientAPI client.API, federationAPI pub.Fe
type gotosocial struct {
db db.DB
cache cache.Cache
- clientAPI client.API
+ clientAPI api.Server
federationAPI pub.FederatingActor
config *config.Config
}
diff --git a/internal/gtsmodel/README.md b/internal/gtsmodel/README.md
new file mode 100644
index 000000000..12a05ddec
--- /dev/null
+++ b/internal/gtsmodel/README.md
@@ -0,0 +1,5 @@
+# gtsmodel
+
+This package contains types used *internally* by GoToSocial and added/removed/selected from the database. As such, they contain sensitive fields which should **never** be serialized or reach the API level. Use the [mastotypes](../../pkg/mastotypes) package for that.
+
+The annotation used on these structs is for handling them via the go-pg ORM. See [here](https://pg.uptrace.dev/models/).
diff --git a/internal/model/account.go b/internal/gtsmodel/account.go
similarity index 83%
rename from internal/model/account.go
rename to internal/gtsmodel/account.go
index 6d8d04954..7cd942ee8 100644
--- a/internal/model/account.go
+++ b/internal/gtsmodel/account.go
@@ -16,17 +16,20 @@
along with this program. If not, see .
*/
-package model
+// package gtsmodel contains types used *internally* by GoToSocial and added/removed/selected from the database.
+// These types should never be serialized and/or sent out via public APIs, as they contain sensitive information.
+// The annotation used on these structs is for handling them via the go-pg ORM. See here: https://pg.uptrace.dev/models/
+package gtsmodel
import (
"net/url"
"time"
)
-// Account represents a user account
-type Account struct {
- Avatar
- Header
+// GTSAccount represents a GoToSocial user account
+type GTSAccount struct {
+ GTSAvatar
+ GTSHeader
URI string
URL string
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull"`
@@ -63,7 +66,7 @@ type Account struct {
SuspensionOrigin int
}
-type Avatar struct {
+type GTSAvatar struct {
AvatarFileName string
AvatarContentType string
AvatarFileSize int
@@ -72,7 +75,7 @@ type Avatar struct {
AvatarStorageSchemaVersion int
}
-type Header struct {
+type GTSHeader struct {
HeaderFileName string
HeaderContentType string
HeaderFileSize int
@@ -80,13 +83,3 @@ type Header struct {
HeaderRemoteURL *url.URL `pg:"type:text"`
HeaderStorageSchemaVersion int
}
-
-func StubAccount() *Account {
- return &Account{
- Username: "some_user",
- Domain: "example.org",
- RemoteURL: "https://example.org/@someuser",
- CreatedAt: time.Now(),
- UpdatedAt: time.Now(),
- }
-}
diff --git a/internal/model/note.go b/internal/gtsmodel/status.go
similarity index 96%
rename from internal/model/note.go
rename to internal/gtsmodel/status.go
index 69242cfa7..cba8a6ba8 100644
--- a/internal/model/note.go
+++ b/internal/gtsmodel/status.go
@@ -16,11 +16,11 @@
along with this program. If not, see .
*/
-package model
+package gtsmodel
import "time"
-type Note struct {
+type GTSStatus struct {
ID string `pg:"type:uuid,default:gen_random_uuid(),pk,notnull"`
URI string
URL string
diff --git a/internal/oauth/README.md b/internal/oauth/README.md
new file mode 100644
index 000000000..5eaef673f
--- /dev/null
+++ b/internal/oauth/README.md
@@ -0,0 +1,3 @@
+# oauth
+
+This package provides uses [go-oauth2](https://github.com/go-oauth2/oauth2) to provide [oauth2](https://www.oauth.com/) server functionality to the GoToSocial APIs.
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go
index 11b1b57fd..ac833d1fc 100644
--- a/internal/oauth/oauth.go
+++ b/internal/oauth/oauth.go
@@ -19,42 +19,46 @@
package oauth
type Server struct {
- manager := manage.NewDefaultManager()
- // token memory store
- manager.MustTokenStorage(store.NewMemoryTokenStore())
- // client memory store
- clientStore := store.NewClientStore()
- clientStore.Set("000000", &models.Client{
- ID: "000000",
- Secret: "999999",
- Domain: "http://localhost",
- })
- manager.MapClientStorage(clientStore)
-
- srv := server.NewDefaultServer(manager)
- srv.SetAllowGetAccessRequest(true)
- srv.SetClientInfoHandler(server.ClientFormHandler)
-
- srv.SetInternalErrorHandler(func(err error) (re *errors.Response) {
- log.Println("Internal Error:", err.Error())
- return
- })
-
- srv.SetResponseErrorHandler(func(re *errors.Response) {
- log.Println("Response Error:", re.Error.Error())
- })
-
- http.HandleFunc("/authorize", func(w http.ResponseWriter, r *http.Request) {
- err := srv.HandleAuthorizeRequest(w, r)
- if err != nil {
- http.Error(w, err.Error(), http.StatusBadRequest)
- }
- })
-
- http.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) {
- srv.HandleTokenRequest(w, r)
- })
-
- log.Fatal(http.ListenAndServe(":9096", nil))
+}
+
+func main() {
+// manager := manage.NewDefaultManager()
+// // token memory store
+// manager.MustTokenStorage(store.NewMemoryTokenStore())
+
+// // client memory store
+// clientStore := store.NewClientStore()
+// clientStore.Set("000000", &models.Client{
+// ID: "000000",
+// Secret: "999999",
+// Domain: "http://localhost",
+// })
+// manager.MapClientStorage(clientStore)
+
+// srv := server.NewDefaultServer(manager)
+// srv.SetAllowGetAccessRequest(true)
+// srv.SetClientInfoHandler(server.ClientFormHandler)
+
+// srv.SetInternalErrorHandler(func(err error) (re *errors.Response) {
+// log.Println("Internal Error:", err.Error())
+// return
+// })
+
+// srv.SetResponseErrorHandler(func(re *errors.Response) {
+// log.Println("Response Error:", re.Error.Error())
+// })
+
+// http.HandleFunc("/authorize", func(w http.ResponseWriter, r *http.Request) {
+// err := srv.HandleAuthorizeRequest(w, r)
+// if err != nil {
+// http.Error(w, err.Error(), http.StatusBadRequest)
+// }
+// })
+
+// http.HandleFunc("/token", func(w http.ResponseWriter, r *http.Request) {
+// srv.HandleTokenRequest(w, r)
+// })
+
+// log.Fatal(http.ListenAndServe(":9096", nil))
}