mirror of
https://github.com/go-shiori/shiori.git
synced 2025-09-06 04:54:59 +08:00
Fix typos (#756)
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
This commit is contained in:
parent
013270acb3
commit
c64e858a23
13 changed files with 19 additions and 19 deletions
|
@ -45,7 +45,7 @@ Then, run the following command:
|
||||||
make styles
|
make styles
|
||||||
```
|
```
|
||||||
|
|
||||||
The `style.css`/`archive.css` will be updated and changes **needs to be commited** to the repository.
|
The `style.css`/`archive.css` will be updated and changes **needs to be committed** to the repository.
|
||||||
|
|
||||||
## Lint the code
|
## Lint the code
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ func TestGenerateEbook(t *testing.T) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
t.Run("specific ebook generate case", func(t *testing.T) {
|
t.Run("specific ebook generate case", func(t *testing.T) {
|
||||||
t.Run("unvalid bookmarkId that return Error", func(t *testing.T) {
|
t.Run("invalid bookmarkId that return Error", func(t *testing.T) {
|
||||||
tempDir := t.TempDir()
|
tempDir := t.TempDir()
|
||||||
mockRequest := core.ProcessRequest{
|
mockRequest := core.ProcessRequest{
|
||||||
Bookmark: model.Bookmark{
|
Bookmark: model.Bookmark{
|
||||||
|
|
|
@ -83,7 +83,7 @@ type DB interface {
|
||||||
// DeleteBookmarks removes all record with matching ids from database.
|
// DeleteBookmarks removes all record with matching ids from database.
|
||||||
DeleteBookmarks(ctx context.Context, ids ...int) error
|
DeleteBookmarks(ctx context.Context, ids ...int) error
|
||||||
|
|
||||||
// GetBookmark fetchs bookmark based on its ID or URL.
|
// GetBookmark fetches bookmark based on its ID or URL.
|
||||||
GetBookmark(ctx context.Context, id int, url string) (model.Bookmark, bool, error)
|
GetBookmark(ctx context.Context, id int, url string) (model.Bookmark, bool, error)
|
||||||
|
|
||||||
// SaveAccount saves new account in database
|
// SaveAccount saves new account in database
|
||||||
|
|
|
@ -23,7 +23,7 @@ func testDatabase(t *testing.T, dbFactory testDatabaseFactory) {
|
||||||
"testUpdateBookmark": testUpdateBookmark,
|
"testUpdateBookmark": testUpdateBookmark,
|
||||||
"testUpdateBookmarkWithContent": testUpdateBookmarkWithContent,
|
"testUpdateBookmarkWithContent": testUpdateBookmarkWithContent,
|
||||||
"testGetBookmark": testGetBookmark,
|
"testGetBookmark": testGetBookmark,
|
||||||
"testGetBookmarkNotExistant": testGetBookmarkNotExistant,
|
"testGetBookmarkNotExistent": testGetBookmarkNotExistent,
|
||||||
"testGetBookmarks": testGetBookmarks,
|
"testGetBookmarks": testGetBookmarks,
|
||||||
"testGetBookmarksWithSQLCharacters": testGetBookmarksWithSQLCharacters,
|
"testGetBookmarksWithSQLCharacters": testGetBookmarksWithSQLCharacters,
|
||||||
"testGetBookmarksCount": testGetBookmarksCount,
|
"testGetBookmarksCount": testGetBookmarksCount,
|
||||||
|
@ -231,7 +231,7 @@ func testGetBookmark(t *testing.T, db DB) {
|
||||||
assert.Equal(t, book.URL, savedBookmark.URL, "Retrieved bookmark should be the same")
|
assert.Equal(t, book.URL, savedBookmark.URL, "Retrieved bookmark should be the same")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGetBookmarkNotExistant(t *testing.T, db DB) {
|
func testGetBookmarkNotExistent(t *testing.T, db DB) {
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
|
||||||
savedBookmark, exists, err := db.GetBookmark(ctx, 1, "")
|
savedBookmark, exists, err := db.GetBookmark(ctx, 1, "")
|
||||||
|
|
|
@ -500,7 +500,7 @@ func (db *MySQLDatabase) DeleteBookmarks(ctx context.Context, ids ...int) (err e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBookmark fetchs bookmark based on its ID or URL.
|
// GetBookmark fetches bookmark based on its ID or URL.
|
||||||
// Returns the bookmark and boolean whether it's exist or not.
|
// Returns the bookmark and boolean whether it's exist or not.
|
||||||
func (db *MySQLDatabase) GetBookmark(ctx context.Context, id int, url string) (model.Bookmark, bool, error) {
|
func (db *MySQLDatabase) GetBookmark(ctx context.Context, id int, url string) (model.Bookmark, bool, error) {
|
||||||
args := []interface{}{id}
|
args := []interface{}{id}
|
||||||
|
|
|
@ -509,7 +509,7 @@ func (db *PGDatabase) DeleteBookmarks(ctx context.Context, ids ...int) (err erro
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBookmark fetchs bookmark based on its ID or URL.
|
// GetBookmark fetches bookmark based on its ID or URL.
|
||||||
// Returns the bookmark and boolean whether it's exist or not.
|
// Returns the bookmark and boolean whether it's exist or not.
|
||||||
func (db *PGDatabase) GetBookmark(ctx context.Context, id int, url string) (model.Bookmark, bool, error) {
|
func (db *PGDatabase) GetBookmark(ctx context.Context, id int, url string) (model.Bookmark, bool, error) {
|
||||||
args := []interface{}{id}
|
args := []interface{}{id}
|
||||||
|
|
|
@ -28,7 +28,7 @@ func (r *BookmarksAPIRoutes) Setup(g *gin.RouterGroup) model.Routes {
|
||||||
func (r *BookmarksAPIRoutes) listHandler(c *gin.Context) {
|
func (r *BookmarksAPIRoutes) listHandler(c *gin.Context) {
|
||||||
bookmarks, err := r.deps.Database.GetBookmarks(c, database.GetBookmarksOptions{})
|
bookmarks, err := r.deps.Database.GetBookmarks(c, database.GetBookmarksOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.logger.WithError(err).Error("error getting bookmakrs")
|
r.logger.WithError(err).Error("error getting bookmarks")
|
||||||
response.SendInternalServerError(c)
|
response.SendInternalServerError(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ func (s *HttpServer) Start(_ context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HttpServer) Stop(ctx context.Context) error {
|
func (s *HttpServer) Stop(ctx context.Context) error {
|
||||||
s.logger.WithField("addr", s.http.Addr).Info("stoppping http server")
|
s.logger.WithField("addr", s.http.Addr).Info("stopping http server")
|
||||||
return s.http.Shutdown(ctx)
|
return s.http.Shutdown(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
@header-height: 60px;
|
@header-height: 60px;
|
||||||
@screen-sm-max: 600px;
|
@screen-sm-max: 600px;
|
||||||
@screen-sm-header-hight: 50px;
|
@screen-sm-header-height: 50px;
|
||||||
|
|
||||||
#shiori-archive-header {
|
#shiori-archive-header {
|
||||||
top : 0;
|
top : 0;
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
@media (max-width: @screen-sm-max) {
|
@media (max-width: @screen-sm-max) {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
height : @screen-sm-header-hight;
|
height : @screen-sm-header-height;
|
||||||
|
|
||||||
#shiori-logo {
|
#shiori-logo {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
|
@ -81,6 +81,6 @@ body.shiori-archive-content {
|
||||||
margin-top: @header-height !important;
|
margin-top: @header-height !important;
|
||||||
|
|
||||||
@media (max-width: @screen-sm-max) {
|
@media (max-width: @screen-sm-max) {
|
||||||
margin-top: @screen-sm-header-hight !important;
|
margin-top: @screen-sm-header-height !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,7 +437,7 @@ func (h *Handler) ApiDownloadEbook(w http.ResponseWriter, r *http.Request, ps ht
|
||||||
ContentType: contentType,
|
ContentType: contentType,
|
||||||
}
|
}
|
||||||
|
|
||||||
// if file exist book return avilable file
|
// if file exist book return available file
|
||||||
strID := strconv.Itoa(book.ID)
|
strID := strconv.Itoa(book.ID)
|
||||||
ebookPath := fp.Join(request.DataDir, "ebook", strID+".epub")
|
ebookPath := fp.Join(request.DataDir, "ebook", strID+".epub")
|
||||||
_, err = os.Stat(ebookPath)
|
_, err = os.Stat(ebookPath)
|
||||||
|
|
|
@ -278,7 +278,7 @@ func (h *Handler) ServeBookmarkArchive(w http.ResponseWriter, r *http.Request, p
|
||||||
// Gzip it again and send to response writer
|
// Gzip it again and send to response writer
|
||||||
gzipWriter := gzip.NewWriter(w)
|
gzipWriter := gzip.NewWriter(w)
|
||||||
if _, err := gzipWriter.Write([]byte(outerHTML)); err != nil {
|
if _, err := gzipWriter.Write([]byte(outerHTML)); err != nil {
|
||||||
log.Printf("error writting gzip file: %s", err)
|
log.Printf("error writing gzip file: %s", err)
|
||||||
}
|
}
|
||||||
gzipWriter.Flush()
|
gzipWriter.Flush()
|
||||||
return
|
return
|
||||||
|
@ -286,7 +286,7 @@ func (h *Handler) ServeBookmarkArchive(w http.ResponseWriter, r *http.Request, p
|
||||||
|
|
||||||
// Serve content
|
// Serve content
|
||||||
if _, err := w.Write(content); err != nil {
|
if _, err := w.Write(content); err != nil {
|
||||||
log.Printf("error writting response: %s", err)
|
log.Printf("error writing response: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ type Handler struct {
|
||||||
ArchiveCache *cch.Cache
|
ArchiveCache *cch.Cache
|
||||||
Log bool
|
Log bool
|
||||||
|
|
||||||
depenencies *config.Dependencies
|
dependencies *config.Dependencies
|
||||||
|
|
||||||
templates map[string]*template.Template
|
templates map[string]*template.Template
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ func (h *Handler) validateSession(r *http.Request) error {
|
||||||
return fmt.Errorf("session has been expired")
|
return fmt.Errorf("session has been expired")
|
||||||
}
|
}
|
||||||
|
|
||||||
account, err := h.depenencies.Domains.Auth.CheckToken(r.Context(), authParts[1])
|
account, err := h.dependencies.Domains.Auth.CheckToken(r.Context(), authParts[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ func (h *Handler) validateSession(r *http.Request) error {
|
||||||
return fmt.Errorf("account level is not sufficient")
|
return fmt.Errorf("account level is not sufficient")
|
||||||
}
|
}
|
||||||
|
|
||||||
h.depenencies.Log.WithFields(logrus.Fields{
|
h.dependencies.Log.WithFields(logrus.Fields{
|
||||||
"username": account.Username,
|
"username": account.Username,
|
||||||
"method": r.Method,
|
"method": r.Method,
|
||||||
"path": r.URL.Path,
|
"path": r.URL.Path,
|
||||||
|
|
|
@ -27,6 +27,6 @@ func GetLegacyHandler(cfg Config, dependencies *config.Dependencies) *Handler {
|
||||||
ArchiveCache: cch.New(time.Minute, 5*time.Minute),
|
ArchiveCache: cch.New(time.Minute, 5*time.Minute),
|
||||||
RootPath: cfg.RootPath,
|
RootPath: cfg.RootPath,
|
||||||
Log: cfg.Log,
|
Log: cfg.Log,
|
||||||
depenencies: dependencies,
|
dependencies: dependencies,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue