Fix #897 and shuffle directory around (#1054)

* Fix #897 and shuffle directory around

* Update find-lint

* goimports

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This commit is contained in:
Kegsay 2020-05-21 14:40:13 +01:00 committed by GitHub
parent 3fdb045116
commit 24d8df664c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
260 changed files with 901 additions and 901 deletions

View file

@ -25,7 +25,7 @@ import (
"path/filepath"
"strings"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/types"
log "github.com/sirupsen/logrus"
)

View file

@ -16,7 +16,7 @@ package mediaapi
import (
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
"github.com/matrix-org/dendrite/common/basecomponent"
"github.com/matrix-org/dendrite/internal/basecomponent"
"github.com/matrix-org/dendrite/mediaapi/routing"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/gomatrixserverlib"

View file

@ -29,7 +29,7 @@ import (
"sync"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/fileutils"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/thumbnailer"

View file

@ -22,8 +22,8 @@ import (
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
@ -59,7 +59,7 @@ func Setup(
}
// TODO: Add AS support
r0mux.Handle("/upload", common.MakeAuthAPI(
r0mux.Handle("/upload", internal.MakeAuthAPI(
"upload", authData,
func(req *http.Request, _ *authtypes.Device) util.JSONResponse {
return Upload(req, cfg, db, activeThumbnailGeneration)
@ -95,11 +95,11 @@ func makeDownloadAPI(
httpHandler := func(w http.ResponseWriter, req *http.Request) {
req = util.RequestWithLogging(req)
// Set common headers returned regardless of the outcome of the request
// Set internal headers returned regardless of the outcome of the request
util.SetCORSHeaders(w)
// Content-Type will be overridden in case of returning file data, else we respond with JSON-formatted errors
w.Header().Set("Content-Type", "application/json")
vars, _ := common.URLDecodeMapValues(mux.Vars(req))
vars, _ := internal.URLDecodeMapValues(mux.Vars(req))
Download(
w,
req,

View file

@ -24,7 +24,7 @@ import (
"strings"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/fileutils"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/thumbnailer"

View file

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// FIXME: This should be made common!
// FIXME: This should be made internal!
package postgres

View file

@ -21,7 +21,7 @@ import (
// Import the postgres database driver.
_ "github.com/lib/pq"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
@ -34,7 +34,7 @@ type Database struct {
}
// Open opens a postgres database.
func Open(dataSourceName string, dbProperties common.DbProperties) (*Database, error) {
func Open(dataSourceName string, dbProperties internal.DbProperties) (*Database, error) {
var d Database
var err error
if d.db, err = sqlutil.Open("postgres", dataSourceName, dbProperties); err != nil {

View file

@ -20,7 +20,7 @@ import (
"database/sql"
"time"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
@ -146,7 +146,7 @@ func (s *thumbnailStatements) selectThumbnails(
if err != nil {
return nil, err
}
defer common.CloseAndLogIfError(ctx, rows, "selectThumbnails: rows.close() failed")
defer internal.CloseAndLogIfError(ctx, rows, "selectThumbnails: rows.close() failed")
var thumbnails []*types.ThumbnailMetadata
for rows.Next() {

View file

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// FIXME: This should be made common!
// FIXME: This should be made internal!
package sqlite3

View file

@ -20,7 +20,7 @@ import (
"database/sql"
// Import the postgres database driver.
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
@ -37,7 +37,7 @@ type Database struct {
func Open(dataSourceName string) (*Database, error) {
var d Database
var err error
if d.db, err = sqlutil.Open(common.SQLiteDriverName(), dataSourceName, nil); err != nil {
if d.db, err = sqlutil.Open(internal.SQLiteDriverName(), dataSourceName, nil); err != nil {
return nil, err
}
if err = d.statements.prepare(d.db); err != nil {

View file

@ -20,7 +20,7 @@ import (
"database/sql"
"time"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
@ -136,7 +136,7 @@ func (s *thumbnailStatements) selectThumbnails(
if err != nil {
return nil, err
}
defer common.CloseAndLogIfError(ctx, rows, "selectThumbnails: rows.close() failed")
defer internal.CloseAndLogIfError(ctx, rows, "selectThumbnails: rows.close() failed")
var thumbnails []*types.ThumbnailMetadata
for rows.Next() {

View file

@ -19,13 +19,13 @@ package storage
import (
"net/url"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/mediaapi/storage/postgres"
"github.com/matrix-org/dendrite/mediaapi/storage/sqlite3"
)
// Open opens a postgres database.
func Open(dataSourceName string, dbProperties common.DbProperties) (Database, error) {
func Open(dataSourceName string, dbProperties internal.DbProperties) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {
return postgres.Open(dataSourceName, dbProperties)

View file

@ -18,14 +18,14 @@ import (
"fmt"
"net/url"
"github.com/matrix-org/dendrite/common"
"github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/mediaapi/storage/sqlite3"
)
// Open opens a postgres database.
func Open(
dataSourceName string,
dbProperties common.DbProperties, // nolint:unparam
dbProperties internal.DbProperties, // nolint:unparam
) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {

View file

@ -22,7 +22,7 @@ import (
"path/filepath"
"sync"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/types"
log "github.com/sirupsen/logrus"

View file

@ -21,7 +21,7 @@ import (
"os"
"time"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/types"
log "github.com/sirupsen/logrus"

View file

@ -30,7 +30,7 @@ import (
"os"
"time"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/mediaapi/storage"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/nfnt/resize"

View file

@ -17,7 +17,7 @@ package types
import (
"sync"
"github.com/matrix-org/dendrite/common/config"
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/gomatrixserverlib"
)