mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
style(backend): the code format and the imports in one or the other place a little polished.
This commit is contained in:
parent
f5c08ef4e5
commit
0154537fde
6 changed files with 15 additions and 13 deletions
|
@ -10,7 +10,7 @@ import (
|
|||
"threadule/backend/internal/config"
|
||||
"threadule/backend/internal/data"
|
||||
"threadule/backend/internal/logic"
|
||||
router "threadule/backend/internal/router"
|
||||
"threadule/backend/internal/router"
|
||||
"threadule/backend/internal/web"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,11 +7,13 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const defaultPasswordLength = 16
|
||||
const defaultPasswordCharSet = "abcdefghijklmnopqrstuvwxyz" +
|
||||
const (
|
||||
defaultPasswordLength = 16
|
||||
defaultPasswordCharSet = "abcdefghijklmnopqrstuvwxyz" +
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
||||
"0123456789" +
|
||||
"=!$%&+#-_.,;:"
|
||||
)
|
||||
|
||||
func (l *Logic) defaultPassword() string {
|
||||
builder := strings.Builder{}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"github.com/dghubble/go-twitter/twitter"
|
||||
"github.com/dghubble/oauth1"
|
||||
twitterOAuth "github.com/dghubble/oauth1/twitter"
|
||||
"net/url"
|
||||
"threadule/backend/internal/data/models"
|
||||
)
|
||||
import "github.com/dghubble/oauth1"
|
||||
import "github.com/dghubble/go-twitter/twitter"
|
||||
import twitterOAuth "github.com/dghubble/oauth1/twitter"
|
||||
|
||||
func (l *Logic) sendTweet(client *twitter.Client, tweet *models.Tweet, prevId int64) (int64, error) {
|
||||
status, _, err := client.Statuses.Update(
|
||||
|
|
|
@ -3,7 +3,7 @@ package router
|
|||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
. "threadule/backend/internal/presentation"
|
||||
"threadule/backend/internal/presentation"
|
||||
"threadule/backend/internal/web"
|
||||
)
|
||||
|
||||
|
@ -13,14 +13,14 @@ func authenticated(next web.Handler) web.Handler {
|
|||
return func(ctx *web.Context) {
|
||||
authHeader := ctx.Request.Header.Get("Authorization")
|
||||
if !strings.HasPrefix(authHeader, authPrefix) {
|
||||
StatusResponse(ctx, http.StatusBadRequest, "Authorization header missing or malformed")
|
||||
presentation.StatusResponse(ctx, http.StatusBadRequest, "Authorization header missing or malformed")
|
||||
return
|
||||
}
|
||||
authHeader = strings.TrimPrefix(authHeader, authPrefix)
|
||||
|
||||
user, err := ctx.AppCtx.Logic.AuthenticateSession(authHeader)
|
||||
if err != nil {
|
||||
StatusResponse(ctx, http.StatusUnauthorized, err.Error())
|
||||
presentation.StatusResponse(ctx, http.StatusUnauthorized, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@ import (
|
|||
)
|
||||
|
||||
func StartServer(ctx *app.Context, handler http.Handler) error {
|
||||
ctx.Log.Info("startinhg web server")
|
||||
ctx.Log.Info("starting web server")
|
||||
return http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", ctx.Config.Web.Port), handler)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue