use go 1.16 and don’t do this random patch
This commit is contained in:
parent
9907b85d6b
commit
c846546663
3 changed files with 45 additions and 106 deletions
41
config/services/dendrite.nix
Normal file
41
config/services/dendrite.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ config, ... }: {
|
||||
services.dendrite = {
|
||||
enable = true;
|
||||
environmentFile = config.sops.secrets."services/dendrite/secrets".path;
|
||||
settings = {
|
||||
global = {
|
||||
server_name = "chir.rs";
|
||||
trusted_third_party_id_servers = [
|
||||
"matrix.org"
|
||||
"vector.im"
|
||||
];
|
||||
presence = {
|
||||
enable_inbound = true;
|
||||
enable_outbound = true;
|
||||
};
|
||||
};
|
||||
app_service_api.database.connection_string = "postgresql://dendrite@localhost/dendrite_app_service";
|
||||
client_api = {
|
||||
registration_shared_secret = "$REGISTRATION_SHARED_SECRET";
|
||||
};
|
||||
federation_api = {
|
||||
database.connection_string = "postgresql://dendrite@localhost/dendrite_federation";
|
||||
};
|
||||
key_server.database.connection_string = "postgresql://dendrite@localhost/dendrite_keyserver";
|
||||
};
|
||||
};
|
||||
sops.secrets."services/dendrite/secrets" = { owner = "dendrite"; };
|
||||
services.postgresql.ensureDatabases = [
|
||||
"dendrite_app_service"
|
||||
"dendrite_federation"
|
||||
"dendrite_keyserver"
|
||||
];
|
||||
services.postgresql.ensureUsers = [{
|
||||
name = "dendrite";
|
||||
ensurePermissions = {
|
||||
"DATABASE dendrite_app_service" = "ALL PRIVILEGES";
|
||||
"DATABASE dendrite_federation" = "ALL PRIVILEGES";
|
||||
"DATABASE dendrite_keyserver" = "ALL PRIVILEGES";
|
||||
};
|
||||
}];
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
{ buildGoModule
|
||||
{ buildGo116Module
|
||||
, fetchFromGitHub
|
||||
, git
|
||||
}: buildGoModule rec {
|
||||
}: buildGo116Module rec {
|
||||
pname = "matrix-media-repo";
|
||||
version = "1.2.12";
|
||||
src = fetchFromGitHub {
|
||||
|
@ -10,13 +10,11 @@
|
|||
rev = "v${version}";
|
||||
sha256 = "1j6y7alr60mmj5h014qmpz9a5qjv8cm61andwdacb0dqjjbvsm0z";
|
||||
};
|
||||
vendorSha256 = "sha256-wRxzA5JQ/Sx06YZHEhFH0UGmPKM2GVjo022kM4Ponlo=";
|
||||
proxyVendor = true;
|
||||
vendorSha256 = "sha256-gb2inc/XlPAplVYQXmR77b3/5GsEZDg5v7D/FbZRQ7w=";
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
];
|
||||
patches = [
|
||||
./matrix-media-repo.patch
|
||||
];
|
||||
buildPhase = ''
|
||||
GOBIN=$PWD/bin go install -v ./cmd/compile_assets
|
||||
$PWD/bin/compile_assets
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||
index 52ea180..f90d810 100644
|
||||
--- a/CHANGELOG.md
|
||||
+++ b/CHANGELOG.md
|
||||
@@ -27,6 +27,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
* New (currently undocumented) binary `s3_consistency_check` to find objects in S3 which *might* not be referenced by
|
||||
the media repo database. Note that this can include uploads in progress.
|
||||
* Admin endpoint to GET users' usage statistics for a server.
|
||||
+* Fixed media being permanently lost when transferring to an (effectively) readonly S3 datastore.
|
||||
+* Purging non-existent files now won't cause errors.
|
||||
|
||||
### Removed
|
||||
|
||||
@@ -38,7 +40,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
|
||||
* Fixed media being permanently lost when transferring to an (effectively) readonly S3 datastore.
|
||||
* Purging non-existent files now won't cause errors.
|
||||
-* Fixed HEIF/HEIC thumbnailing. Note that this thumbnail type might cause increased memory usage.
|
||||
* Ensure endpoints register in a stable way, making them predictably available.
|
||||
* Reduced download hits to datastores when using Redis cache.
|
||||
|
||||
diff --git a/go.mod b/go.mod
|
||||
index fc0d45e..a041e16 100644
|
||||
--- a/go.mod
|
||||
+++ b/go.mod
|
||||
@@ -44,7 +44,6 @@ require (
|
||||
github.com/ipfs/go-ipfs-config v0.12.0
|
||||
github.com/ipfs/go-ipfs-files v0.0.8
|
||||
github.com/ipfs/interface-go-ipfs-core v0.4.0
|
||||
- github.com/jdeng/goheif v0.0.0-20200323230657-a0d6a8b3e68f
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
||||
github.com/k3a/html2text v1.0.7
|
||||
github.com/kettek/apng v0.0.0-20191108220231-414630eed80f
|
||||
diff --git a/go.sum b/go.sum
|
||||
index 1f9d94b..6c86f67 100644
|
||||
--- a/go.sum
|
||||
+++ b/go.sum
|
||||
@@ -675,8 +675,6 @@ github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr1
|
||||
github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
|
||||
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
|
||||
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
|
||||
-github.com/jdeng/goheif v0.0.0-20200323230657-a0d6a8b3e68f h1:jYkcRYsnnvPF07yn4XJx3k8duM4KDw3QYB3p8bUrk80=
|
||||
-github.com/jdeng/goheif v0.0.0-20200323230657-a0d6a8b3e68f/go.mod h1:G7IyA3/eR9IFmUIPdyP3c0l4ZaqEvXAk876WfaQ8plc=
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
|
||||
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
|
||||
diff --git a/thumbnailing/i/heif.go b/thumbnailing/i/heif.go
|
||||
index 66da380..9a088aa 100644
|
||||
--- a/thumbnailing/i/heif.go
|
||||
+++ b/thumbnailing/i/heif.go
|
||||
@@ -1,9 +1,6 @@
|
||||
package i
|
||||
|
||||
import (
|
||||
- "bytes"
|
||||
- "errors"
|
||||
- "github.com/jdeng/goheif"
|
||||
"github.com/turt2live/matrix-media-repo/common/rcontext"
|
||||
"github.com/turt2live/matrix-media-repo/thumbnailing/m"
|
||||
)
|
||||
@@ -24,23 +21,11 @@ func (d heifGenerator) matches(img []byte, contentType string) bool {
|
||||
}
|
||||
|
||||
func (d heifGenerator) GetOriginDimensions(b []byte, contentType string, ctx rcontext.RequestContext) (bool, int, int, error) {
|
||||
- i, err := goheif.DecodeConfig(bytes.NewBuffer(b))
|
||||
- if err != nil {
|
||||
- return false, 0, 0, err
|
||||
- }
|
||||
- return true, i.Width, i.Height, nil
|
||||
+ return pngGenerator{}.GetOriginDimensions(b, contentType, ctx)
|
||||
}
|
||||
|
||||
func (d heifGenerator) GenerateThumbnail(b []byte, contentType string, width int, height int, method string, animated bool, ctx rcontext.RequestContext) (*m.Thumbnail, error) {
|
||||
- // Use more memory, but prevent crashes
|
||||
- goheif.SafeEncoding = true
|
||||
-
|
||||
- src, err := goheif.Decode(bytes.NewBuffer(b))
|
||||
- if err != nil {
|
||||
- return nil, errors.New("heif: error decoding thumbnail: " + err.Error())
|
||||
- }
|
||||
-
|
||||
- return pngGenerator{}.GenerateThumbnailOf(src, width, height, method, ctx)
|
||||
+ return pngGenerator{}.GenerateThumbnail(b, "image/png", width, height, method, false, ctx)
|
||||
}
|
||||
|
||||
func init() {
|
||||
diff --git a/thumbnailing/thumbnail.go b/thumbnailing/thumbnail.go
|
||||
index 42bcaa0..0f54122 100644
|
||||
--- a/thumbnailing/thumbnail.go
|
||||
+++ b/thumbnailing/thumbnail.go
|
||||
@@ -47,8 +47,7 @@ func GenerateThumbnail(imgStream io.ReadCloser, contentType string, width int, h
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
- if dimensional && (w*h) >= ctx.Config.Thumbnails.MaxPixels {
|
||||
- ctx.Log.Warn("Image too large: too many pixels")
|
||||
+ if dimensional && (w * h) >= ctx.Config.Thumbnails.MaxPixels {
|
||||
return nil, common.ErrMediaTooLarge
|
||||
}
|
||||
|
Loading…
Reference in a new issue