Fully switch away from mattn sqlite to glebarez sqlite
This commit is contained in:
@@ -11,19 +11,19 @@ import (
|
||||
|
||||
// ListUserSenderNames swaggerdoc
|
||||
//
|
||||
// @Summary List sender-names (of allthe messages of this user)
|
||||
// @ID api-usersendernames-list
|
||||
// @Tags API-v2
|
||||
// @Summary List sender-names (of allthe messages of this user)
|
||||
// @ID api-usersendernames-list
|
||||
// @Tags API-v2
|
||||
//
|
||||
// @Param uid path string true "UserID"
|
||||
// @Param uid path string true "UserID"
|
||||
//
|
||||
// @Success 200 {object} handler.ListUserKeys.response
|
||||
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"
|
||||
// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions"
|
||||
// @Failure 404 {object} ginresp.apiError "message not found"
|
||||
// @Failure 500 {object} ginresp.apiError "internal server error"
|
||||
// @Success 200 {object} handler.ListUserKeys.response
|
||||
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"
|
||||
// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions"
|
||||
// @Failure 404 {object} ginresp.apiError "message not found"
|
||||
// @Failure 500 {object} ginresp.apiError "internal server error"
|
||||
//
|
||||
// @Router /api/v2/users/{uid}/keys [GET]
|
||||
// @Router /api/v2/users/{uid}/keys [GET]
|
||||
func (h APIHandler) ListUserSenderNames(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
type uri struct {
|
||||
UserID models.UserID `uri:"uid" binding:"entityid"`
|
||||
@@ -57,17 +57,17 @@ func (h APIHandler) ListUserSenderNames(pctx ginext.PreContext) ginext.HTTPRespo
|
||||
|
||||
// ListSenderNames swaggerdoc
|
||||
//
|
||||
// @Summary List sender-names (of all messages this user can view, eitehr own or foreign-subscribed)
|
||||
// @ID api-sendernames-list
|
||||
// @Tags API-v2
|
||||
// @Summary List sender-names (of all messages this user can view, eitehr own or foreign-subscribed)
|
||||
// @ID api-sendernames-list
|
||||
// @Tags API-v2
|
||||
//
|
||||
// @Success 200 {object} handler.ListSenderNames.response
|
||||
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"
|
||||
// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions"
|
||||
// @Failure 404 {object} ginresp.apiError "message not found"
|
||||
// @Failure 500 {object} ginresp.apiError "internal server error"
|
||||
// @Success 200 {object} handler.ListSenderNames.response
|
||||
// @Failure 400 {object} ginresp.apiError "supplied values/parameters cannot be parsed / are invalid"
|
||||
// @Failure 401 {object} ginresp.apiError "user is not authorized / has missing permissions"
|
||||
// @Failure 404 {object} ginresp.apiError "message not found"
|
||||
// @Failure 500 {object} ginresp.apiError "internal server error"
|
||||
//
|
||||
// @Router /api/v2/sender-names [GET]
|
||||
// @Router /api/v2/sender-names [GET]
|
||||
func (h APIHandler) ListSenderNames(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
type response struct {
|
||||
SenderNames []models.SenderNameStatistics `json:"sender_names"`
|
||||
|
@@ -9,7 +9,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/mattn/go-sqlite3"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/ginext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/timeext"
|
||||
@@ -91,10 +90,9 @@ func (h CommonHandler) Ping(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
// @Router /api/db-test [post]
|
||||
func (h CommonHandler) DatabaseTest(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
type response struct {
|
||||
Success bool `json:"success"`
|
||||
LibVersion string `json:"libVersion"`
|
||||
LibVersionNumber int `json:"libVersionNumber"`
|
||||
SourceID string `json:"sourceID"`
|
||||
Success bool `json:"success"`
|
||||
LibVersion string `json:"libVersion"`
|
||||
SourceID string `json:"sourceID"`
|
||||
}
|
||||
|
||||
ctx, g, errResp := pctx.Start()
|
||||
@@ -105,18 +103,20 @@ func (h CommonHandler) DatabaseTest(pctx ginext.PreContext) ginext.HTTPResponse
|
||||
|
||||
return h.app.DoRequest(ctx, g, models.TLockRead, func(ctx *logic.AppContext, finishSuccess func(r ginext.HTTPResponse) ginext.HTTPResponse) ginext.HTTPResponse {
|
||||
|
||||
libVersion, libVersionNumber, sourceID := sqlite3.Version()
|
||||
versionStr, sourceID, err := h.app.Database.Primary.Version(ctx)
|
||||
if err != nil {
|
||||
return ginresp.InternalError(err)
|
||||
}
|
||||
|
||||
err := h.app.Database.Ping(ctx)
|
||||
err = h.app.Database.Ping(ctx)
|
||||
if err != nil {
|
||||
return ginresp.InternalError(err)
|
||||
}
|
||||
|
||||
return ginext.JSON(http.StatusOK, response{
|
||||
Success: true,
|
||||
LibVersion: libVersion,
|
||||
LibVersionNumber: libVersionNumber,
|
||||
SourceID: sourceID,
|
||||
Success: true,
|
||||
LibVersion: versionStr,
|
||||
SourceID: sourceID,
|
||||
})
|
||||
|
||||
})
|
||||
@@ -145,12 +145,6 @@ func (h CommonHandler) Health(pctx ginext.PreContext) ginext.HTTPResponse {
|
||||
|
||||
return h.app.DoRequest(ctx, g, models.TLockReadWrite, func(ctx *logic.AppContext, finishSuccess func(r ginext.HTTPResponse) ginext.HTTPResponse) ginext.HTTPResponse {
|
||||
|
||||
_, libVersionNumber, _ := sqlite3.Version()
|
||||
|
||||
if libVersionNumber < 3039000 {
|
||||
return ginresp.InternalError(errors.New("sqlite version too low"))
|
||||
}
|
||||
|
||||
tctx := simplectx.CreateSimpleContext(ctx, nil)
|
||||
|
||||
err := h.app.Database.Ping(tctx)
|
||||
|
Reference in New Issue
Block a user