From f3c14a4ed6631bcd91bb5c9a252e4868dc10ec1d Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Mon, 18 Nov 2019 18:39:59 +0900 Subject: [PATCH] Moved server packages to a separate folder --- pages/amv/amv.go | 2 +- pages/anime/anime.go | 2 +- pages/animelist/animelist.go | 2 +- pages/character/character.go | 2 +- pages/company/company.go | 2 +- pages/company/edit.go | 2 +- pages/frontpage/frontpage.go | 2 +- pages/group/feed.go | 2 +- pages/group/info.go | 2 +- pages/group/members.go | 2 +- pages/post/post.go | 2 +- pages/profile/profile.go | 2 +- pages/quote/edit.go | 2 +- pages/quote/quote.go | 2 +- pages/soundtrack/edit.go | 2 +- pages/soundtrack/lyrics.go | 2 +- pages/soundtrack/soundtrack.go | 2 +- pages/thread/thread.go | 2 +- server/Main.go | 1 + server/New.go | 9 +++++---- {auth => server/auth}/Facebook.go | 0 {auth => server/auth}/Google.go | 0 {auth => server/auth}/Install.go | 0 {auth => server/auth}/Logout.go | 0 {auth => server/auth}/Twitter.go | 0 {graphql => server/graphql}/graphql.go | 0 {utils => server}/https/Configure.go | 0 {middleware => server/middleware}/HTTPSRedirect.go | 0 {middleware => server/middleware}/IPToHost.go | 0 {middleware => server/middleware}/Layout.go | 0 {middleware => server/middleware}/Log.go | 0 {middleware => server/middleware}/OpenGraph.go | 0 {middleware => server/middleware}/Recover.go | 0 {middleware => server/middleware}/Session.go | 0 {middleware => server/middleware}/UserInfo.go | 0 utils/README.md | 3 +++ utils/page/page.go | 2 +- 37 files changed, 28 insertions(+), 23 deletions(-) rename {auth => server/auth}/Facebook.go (100%) rename {auth => server/auth}/Google.go (100%) rename {auth => server/auth}/Install.go (100%) rename {auth => server/auth}/Logout.go (100%) rename {auth => server/auth}/Twitter.go (100%) rename {graphql => server/graphql}/graphql.go (100%) rename {utils => server}/https/Configure.go (100%) rename {middleware => server/middleware}/HTTPSRedirect.go (100%) rename {middleware => server/middleware}/IPToHost.go (100%) rename {middleware => server/middleware}/Layout.go (100%) rename {middleware => server/middleware}/Log.go (100%) rename {middleware => server/middleware}/OpenGraph.go (100%) rename {middleware => server/middleware}/Recover.go (100%) rename {middleware => server/middleware}/Session.go (100%) rename {middleware => server/middleware}/UserInfo.go (100%) create mode 100644 utils/README.md diff --git a/pages/amv/amv.go b/pages/amv/amv.go index ef6f74f5..d23a5488 100644 --- a/pages/amv/amv.go +++ b/pages/amv/amv.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get a single AMV. diff --git a/pages/anime/anime.go b/pages/anime/anime.go index d5bd9140..1498c6c8 100644 --- a/pages/anime/anime.go +++ b/pages/anime/anime.go @@ -8,7 +8,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) const ( diff --git a/pages/animelist/animelist.go b/pages/animelist/animelist.go index f9a98f9a..863506a9 100644 --- a/pages/animelist/animelist.go +++ b/pages/animelist/animelist.go @@ -8,7 +8,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils/infinitescroll" ) diff --git a/pages/character/character.go b/pages/character/character.go index 465357d8..c8a940dd 100644 --- a/pages/character/character.go +++ b/pages/character/character.go @@ -9,7 +9,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils" ) diff --git a/pages/company/company.go b/pages/company/company.go index e9271cae..90207301 100644 --- a/pages/company/company.go +++ b/pages/company/company.go @@ -8,7 +8,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils" ) diff --git a/pages/company/edit.go b/pages/company/edit.go index 09c9cf1a..b32e526f 100644 --- a/pages/company/edit.go +++ b/pages/company/edit.go @@ -7,7 +7,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils/editform" ) diff --git a/pages/frontpage/frontpage.go b/pages/frontpage/frontpage.go index 4b8d4a0c..18c36a13 100644 --- a/pages/frontpage/frontpage.go +++ b/pages/frontpage/frontpage.go @@ -5,7 +5,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get ... diff --git a/pages/group/feed.go b/pages/group/feed.go index a2ff6421..d7abe9ae 100644 --- a/pages/group/feed.go +++ b/pages/group/feed.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Feed shows the group front page. diff --git a/pages/group/info.go b/pages/group/info.go index 169244cc..099acebd 100644 --- a/pages/group/info.go +++ b/pages/group/info.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Info shows the group information page. diff --git a/pages/group/members.go b/pages/group/members.go index db91e593..bbe0f6e1 100644 --- a/pages/group/members.go +++ b/pages/group/members.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Members shows the group members. diff --git a/pages/post/post.go b/pages/post/post.go index 821688d7..77cec93d 100644 --- a/pages/post/post.go +++ b/pages/post/post.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get post. diff --git a/pages/profile/profile.go b/pages/profile/profile.go index 3efaffca..99a14cf8 100644 --- a/pages/profile/profile.go +++ b/pages/profile/profile.go @@ -8,7 +8,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils" ) diff --git a/pages/quote/edit.go b/pages/quote/edit.go index 5b57e465..0adfe204 100644 --- a/pages/quote/edit.go +++ b/pages/quote/edit.go @@ -3,7 +3,7 @@ package quote import ( "net/http" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" diff --git a/pages/quote/quote.go b/pages/quote/quote.go index a0f7d702..117912a5 100644 --- a/pages/quote/quote.go +++ b/pages/quote/quote.go @@ -7,7 +7,7 @@ import ( "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get quote. diff --git a/pages/soundtrack/edit.go b/pages/soundtrack/edit.go index 20f91e97..24b582da 100644 --- a/pages/soundtrack/edit.go +++ b/pages/soundtrack/edit.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils/editform" "github.com/aerogo/aero" diff --git a/pages/soundtrack/lyrics.go b/pages/soundtrack/lyrics.go index 000815ce..8113dfdf 100644 --- a/pages/soundtrack/lyrics.go +++ b/pages/soundtrack/lyrics.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils" ) diff --git a/pages/soundtrack/soundtrack.go b/pages/soundtrack/soundtrack.go index 216dcbdf..754d3d50 100644 --- a/pages/soundtrack/soundtrack.go +++ b/pages/soundtrack/soundtrack.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get track. diff --git a/pages/thread/thread.go b/pages/thread/thread.go index 04f11766..0aacf72d 100644 --- a/pages/thread/thread.go +++ b/pages/thread/thread.go @@ -6,7 +6,7 @@ import ( "github.com/aerogo/aero" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/components" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get thread. diff --git a/server/Main.go b/server/Main.go index 86f6b2b0..9969ded8 100644 --- a/server/Main.go +++ b/server/Main.go @@ -1,5 +1,6 @@ package server +// Main runs the main loop of the web server. func Main() { app := New() app.Run() diff --git a/server/New.go b/server/New.go index 664b2a79..abdbfd25 100644 --- a/server/New.go +++ b/server/New.go @@ -9,15 +9,16 @@ import ( "github.com/akyoto/color" "github.com/animenotifier/notify.moe/arn" "github.com/animenotifier/notify.moe/assets" - "github.com/animenotifier/notify.moe/auth" - "github.com/animenotifier/notify.moe/graphql" - "github.com/animenotifier/notify.moe/middleware" "github.com/animenotifier/notify.moe/pages" + "github.com/animenotifier/notify.moe/server/auth" + "github.com/animenotifier/notify.moe/server/graphql" + "github.com/animenotifier/notify.moe/server/https" + "github.com/animenotifier/notify.moe/server/middleware" "github.com/animenotifier/notify.moe/utils/htmlemail" - "github.com/animenotifier/notify.moe/utils/https" "github.com/animenotifier/notify.moe/utils/routetests" ) +// New creates a new web server. func New() *aero.Application { app := aero.New() diff --git a/auth/Facebook.go b/server/auth/Facebook.go similarity index 100% rename from auth/Facebook.go rename to server/auth/Facebook.go diff --git a/auth/Google.go b/server/auth/Google.go similarity index 100% rename from auth/Google.go rename to server/auth/Google.go diff --git a/auth/Install.go b/server/auth/Install.go similarity index 100% rename from auth/Install.go rename to server/auth/Install.go diff --git a/auth/Logout.go b/server/auth/Logout.go similarity index 100% rename from auth/Logout.go rename to server/auth/Logout.go diff --git a/auth/Twitter.go b/server/auth/Twitter.go similarity index 100% rename from auth/Twitter.go rename to server/auth/Twitter.go diff --git a/graphql/graphql.go b/server/graphql/graphql.go similarity index 100% rename from graphql/graphql.go rename to server/graphql/graphql.go diff --git a/utils/https/Configure.go b/server/https/Configure.go similarity index 100% rename from utils/https/Configure.go rename to server/https/Configure.go diff --git a/middleware/HTTPSRedirect.go b/server/middleware/HTTPSRedirect.go similarity index 100% rename from middleware/HTTPSRedirect.go rename to server/middleware/HTTPSRedirect.go diff --git a/middleware/IPToHost.go b/server/middleware/IPToHost.go similarity index 100% rename from middleware/IPToHost.go rename to server/middleware/IPToHost.go diff --git a/middleware/Layout.go b/server/middleware/Layout.go similarity index 100% rename from middleware/Layout.go rename to server/middleware/Layout.go diff --git a/middleware/Log.go b/server/middleware/Log.go similarity index 100% rename from middleware/Log.go rename to server/middleware/Log.go diff --git a/middleware/OpenGraph.go b/server/middleware/OpenGraph.go similarity index 100% rename from middleware/OpenGraph.go rename to server/middleware/OpenGraph.go diff --git a/middleware/Recover.go b/server/middleware/Recover.go similarity index 100% rename from middleware/Recover.go rename to server/middleware/Recover.go diff --git a/middleware/Session.go b/server/middleware/Session.go similarity index 100% rename from middleware/Session.go rename to server/middleware/Session.go diff --git a/middleware/UserInfo.go b/server/middleware/UserInfo.go similarity index 100% rename from middleware/UserInfo.go rename to server/middleware/UserInfo.go diff --git a/utils/README.md b/utils/README.md new file mode 100644 index 00000000..2f47c416 --- /dev/null +++ b/utils/README.md @@ -0,0 +1,3 @@ +# utils + +This folder should be deleted in future versions. diff --git a/utils/page/page.go b/utils/page/page.go index 60daf08e..ca1169b1 100644 --- a/utils/page/page.go +++ b/utils/page/page.go @@ -2,7 +2,7 @@ package page import ( "github.com/aerogo/aero" - "github.com/animenotifier/notify.moe/middleware" + "github.com/animenotifier/notify.moe/server/middleware" ) // Get registers a layout rendered route and a contents-only route.