This commit is contained in:
tobi 2025-04-25 12:01:02 +02:00
commit 4aca71d4eb
29 changed files with 30 additions and 36 deletions

View file

@ -434,7 +434,7 @@ The following open source libraries, frameworks, and tools are used by GoToSocia
- [stretchr/testify](https://github.com/stretchr/testify); test framework. [MIT License](https://spdx.org/licenses/MIT.html). - [stretchr/testify](https://github.com/stretchr/testify); test framework. [MIT License](https://spdx.org/licenses/MIT.html).
- superseriousbusiness: - superseriousbusiness:
- [superseriousbusiness/activity](https://codeberg.org/superseriousbusiness/activity) forked from [go-fed/activity](https://github.com/go-fed/activity); Golang ActivityPub/ActivityStreams library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html). - [superseriousbusiness/activity](https://codeberg.org/superseriousbusiness/activity) forked from [go-fed/activity](https://github.com/go-fed/activity); Golang ActivityPub/ActivityStreams library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
- [superseriousbusiness/exif-terminator](https://codeberg.org/superseriousbusiness/exif-terminator); EXIF data removal. [GNU AGPL v3 LICENSE](https://spdx.org/licenses/AGPL-3.0-or-later.html). - [superseriousbusiness/exif-terminator](https://code.superseriousbusiness.org/exif-terminator); EXIF data removal. [GNU AGPL v3 LICENSE](https://spdx.org/licenses/AGPL-3.0-or-later.html).
- [superseriousbusiness/httpsig](https://code.superseriousbusiness.org/httpsig) forked from [go-fed/httpsig](https://github.com/go-fed/httpsig); secure HTTP signature library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html). - [superseriousbusiness/httpsig](https://code.superseriousbusiness.org/httpsig) forked from [go-fed/httpsig](https://github.com/go-fed/httpsig); secure HTTP signature library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
- [superseriousbusiness/oauth2](https://codeberg.org/superseriousbusiness/oauth2) forked from [go-oauth2/oauth2](https://github.com/go-oauth2/oauth2); OAuth server framework and token handling. [MIT License](https://spdx.org/licenses/MIT.html). - [superseriousbusiness/oauth2](https://codeberg.org/superseriousbusiness/oauth2) forked from [go-oauth2/oauth2](https://github.com/go-oauth2/oauth2); OAuth server framework and token handling. [MIT License](https://spdx.org/licenses/MIT.html).
- [temoto/robotstxt](https://github.com/temoto/robotstxt); robots.txt parsing. [MIT License](https://spdx.org/licenses/MIT.html). - [temoto/robotstxt](https://github.com/temoto/robotstxt); robots.txt parsing. [MIT License](https://spdx.org/licenses/MIT.html).

6
go.mod
View file

@ -11,6 +11,7 @@ replace github.com/go-swagger/go-swagger => codeberg.org/superseriousbusiness/go
replace modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround replace modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround
require ( require (
code.superseriousbusiness.org/exif-terminator v0.11.0
code.superseriousbusiness.org/httpsig v1.4.0 code.superseriousbusiness.org/httpsig v1.4.0
codeberg.org/gruf/go-bytes v1.0.2 codeberg.org/gruf/go-bytes v1.0.2
codeberg.org/gruf/go-bytesize v1.0.3 codeberg.org/gruf/go-bytesize v1.0.3
@ -30,7 +31,6 @@ require (
codeberg.org/gruf/go-storage v0.2.0 codeberg.org/gruf/go-storage v0.2.0
codeberg.org/gruf/go-structr v0.9.6 codeberg.org/gruf/go-structr v0.9.6
codeberg.org/superseriousbusiness/activity v1.14.0 codeberg.org/superseriousbusiness/activity v1.14.0
codeberg.org/superseriousbusiness/exif-terminator v0.10.0
codeberg.org/superseriousbusiness/oauth2/v4 v4.7.0-SSB codeberg.org/superseriousbusiness/oauth2/v4 v4.7.0-SSB
github.com/DmitriyVTitov/size v1.5.0 github.com/DmitriyVTitov/size v1.5.0
github.com/KimMachineGun/automemlimit v0.7.1 github.com/KimMachineGun/automemlimit v0.7.1
@ -96,11 +96,11 @@ require (
) )
require ( require (
code.superseriousbusiness.org/go-jpeg-image-structure/v2 v2.3.0 // indirect
code.superseriousbusiness.org/go-png-image-structure/v2 v2.3.0 // indirect
codeberg.org/gruf/go-fastpath/v2 v2.0.0 // indirect codeberg.org/gruf/go-fastpath/v2 v2.0.0 // indirect
codeberg.org/gruf/go-mangler v1.4.4 // indirect codeberg.org/gruf/go-mangler v1.4.4 // indirect
codeberg.org/gruf/go-maps v1.0.4 // indirect codeberg.org/gruf/go-maps v1.0.4 // indirect
codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2 v2.1.0-SSB // indirect
codeberg.org/superseriousbusiness/go-png-image-structure/v2 v2.1.0-SSB // indirect
github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect

12
go.sum generated
View file

@ -1,3 +1,9 @@
code.superseriousbusiness.org/exif-terminator v0.11.0 h1:Hof0MCcsa+1fS17gf86fTTZ8AQnMY9h9kzcc+2C6mVg=
code.superseriousbusiness.org/exif-terminator v0.11.0/go.mod h1:9sutT1axa/kSdlPLlRFjCNKmyo/KNx8eX3XZvWBlAEY=
code.superseriousbusiness.org/go-jpeg-image-structure/v2 v2.3.0 h1:r9uq8StaSHYKJ8DklR9Xy+E9c40G1Z8yj5TRGi8L6+4=
code.superseriousbusiness.org/go-jpeg-image-structure/v2 v2.3.0/go.mod h1:IK1OlR6APjVB3E9tuYGvf0qXMrwP+TrzcHS5rf4wffQ=
code.superseriousbusiness.org/go-png-image-structure/v2 v2.3.0 h1:I512jiIeXDC4//2BeSPrRM2ZS4wpBKUaPeTPxakMNGA=
code.superseriousbusiness.org/go-png-image-structure/v2 v2.3.0/go.mod h1:SNHomXNW88o1pFfLHpD4KsCZLfcr4z5dm+xcX5SV10A=
code.superseriousbusiness.org/httpsig v1.4.0 h1:g9+KQMoTG0oR0II5gYb5pVVdNjbc7CiiuqK8vcZjeQg= code.superseriousbusiness.org/httpsig v1.4.0 h1:g9+KQMoTG0oR0II5gYb5pVVdNjbc7CiiuqK8vcZjeQg=
code.superseriousbusiness.org/httpsig v1.4.0/go.mod h1:i2AKpj/WbA/o/UTvia9TAREzt0jP1AH3T1Uxjyhdzlw= code.superseriousbusiness.org/httpsig v1.4.0/go.mod h1:i2AKpj/WbA/o/UTvia9TAREzt0jP1AH3T1Uxjyhdzlw=
codeberg.org/gruf/go-bytes v1.0.2 h1:malqE42Ni+h1nnYWBUAJaDDtEzF4aeN4uPN8DfMNNvo= codeberg.org/gruf/go-bytes v1.0.2 h1:malqE42Ni+h1nnYWBUAJaDDtEzF4aeN4uPN8DfMNNvo=
@ -44,12 +50,6 @@ codeberg.org/gruf/go-structr v0.9.6 h1:FSbJ1A0ubTQB82rC0K4o6qyiqrDGH1t9ivttm8Zy6
codeberg.org/gruf/go-structr v0.9.6/go.mod h1:9k5hYztZ4PsBS+m1v5hUTeFiVUBTLF5VA7d9cd1OEMs= codeberg.org/gruf/go-structr v0.9.6/go.mod h1:9k5hYztZ4PsBS+m1v5hUTeFiVUBTLF5VA7d9cd1OEMs=
codeberg.org/superseriousbusiness/activity v1.14.0 h1:z+jBjAIane9+Oqu6vO+tNvvNoji+OLU8KYDJ+R+ih+I= codeberg.org/superseriousbusiness/activity v1.14.0 h1:z+jBjAIane9+Oqu6vO+tNvvNoji+OLU8KYDJ+R+ih+I=
codeberg.org/superseriousbusiness/activity v1.14.0/go.mod h1:enxU1Lva4OcK6b/NBXscoHSEgEMsKJvdHrQFifQxp4o= codeberg.org/superseriousbusiness/activity v1.14.0/go.mod h1:enxU1Lva4OcK6b/NBXscoHSEgEMsKJvdHrQFifQxp4o=
codeberg.org/superseriousbusiness/exif-terminator v0.10.0 h1:FiLX/AK07tzceS36I+kOP2aEH+aytjPSIlFoYePMEyg=
codeberg.org/superseriousbusiness/exif-terminator v0.10.0/go.mod h1:c/mCytx/+fisOZeVXtjCpXld/SeZb3VsD1vj3oPAihA=
codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2 v2.1.0-SSB h1:v2shEkOPgydTL0n44EFPsDT9dsEP7KRG85aPnojCYkI=
codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2 v2.1.0-SSB/go.mod h1:Ba/VzIqzDHqqKk5jg+7uFpUsHmdDOsuWLodbamD80jU=
codeberg.org/superseriousbusiness/go-png-image-structure/v2 v2.1.0-SSB h1:Lqi70gvqNuHyik0gUNrBwElvFUP7A3W1FYLVV5lUmbQ=
codeberg.org/superseriousbusiness/go-png-image-structure/v2 v2.1.0-SSB/go.mod h1:99rP8gsZoCSUj+/lLdpV9+i86ujLdKSoUjvuxbgvN4M=
codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix h1:+JvBZqsQfdT+ROnk2DkvXsKQ9QBorKKKBk5fBqw62I8= codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix h1:+JvBZqsQfdT+ROnk2DkvXsKQ9QBorKKKBk5fBqw62I8=
codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix/go.mod h1:WSigRRWEig8zV6t6Sm8Y+EmUjlzA/HoaZJ5edupq7po= codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix/go.mod h1:WSigRRWEig8zV6t6Sm8Y+EmUjlzA/HoaZJ5edupq7po=
codeberg.org/superseriousbusiness/oauth2/v4 v4.7.0-SSB h1:UAFZKgUaeQEoHDmawh9DWXFopJnADfkiDo/CLAtWISc= codeberg.org/superseriousbusiness/oauth2/v4 v4.7.0-SSB h1:UAFZKgUaeQEoHDmawh9DWXFopJnADfkiDo/CLAtWISc=

View file

@ -22,7 +22,7 @@ import (
"os" "os"
"strings" "strings"
terminator "codeberg.org/superseriousbusiness/exif-terminator" terminator "code.superseriousbusiness.org/exif-terminator"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/log"
) )

View file

@ -66,7 +66,7 @@ import (
"io" "io"
"os" "os"
terminator "codeberg.org/superseriousbusiness/exif-terminator" terminator "code.superseriousbusiness.org/exif-terminator"
) )
func main() { func main() {
@ -77,14 +77,8 @@ func main() {
} }
defer sloth.Close() defer sloth.Close()
// get the length of the file
stat, err := sloth.Stat()
if err != nil {
panic(err)
}
// terminate! // terminate!
out, err := terminator.Terminate(sloth, int(stat.Size()), "jpeg") out, err := terminator.Terminate(sloth, "jpeg")
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -106,11 +100,11 @@ func main() {
### Libraries ### Libraries
`exif-terminator` borrows heavily from the two [`dsoprea`](https://github.com/dsoprea) libraries credited below. In fact, it's basically a hack on top of those libraries. Thanks `dsoprea`! `exif-terminator` borrows heavily from the [`dsoprea`](https://github.com/dsoprea) libraries credited below. In fact, it's basically a hack on top of those libraries. Thanks `dsoprea`!
- [superseriousbusiness/go-jpeg-image-structure](https://code.superseriousbusiness.org/go-jpeg-image-structure): jpeg structure parsing. [MIT License](https://spdx.org/licenses/MIT.html). Forked from [dsoprea/go-jpeg-image-structure](https://github.com/dsoprea/go-jpeg-image-structure): jpeg structure parsing. [MIT License](https://spdx.org/licenses/MIT.html).
- [superseriousbusiness/go-png-image-structure](https://code.superseriousbusiness.org/go-png-image-structure): png structure parsing. Forked from [dsoprea/go-png-image-structure](https://github.com/dsoprea/go-png-image-structure): png structure parsing. [MIT License](https://spdx.org/licenses/MIT.html).
- [dsoprea/go-exif](https://github.com/dsoprea/go-exif): exif header reconstruction. [MIT License](https://spdx.org/licenses/MIT.html). - [dsoprea/go-exif](https://github.com/dsoprea/go-exif): exif header reconstruction. [MIT License](https://spdx.org/licenses/MIT.html).
- [dsoprea/go-jpeg-image-structure](https://github.com/dsoprea/go-jpeg-image-structure): jpeg structure parsing. [MIT License](https://spdx.org/licenses/MIT.html).
- [dsoprea/go-png-image-structure](https://github.com/dsoprea/go-png-image-structure): png structure parsing. [MIT License](https://spdx.org/licenses/MIT.html).
- [stretchr/testify](https://github.com/stretchr/testify); test framework. [MIT License](https://spdx.org/licenses/MIT.html). - [stretchr/testify](https://github.com/stretchr/testify); test framework. [MIT License](https://spdx.org/licenses/MIT.html).
## License ## License
@ -119,4 +113,4 @@ func main() {
`exif-terminator` is free software, licensed under the [GNU AGPL v3 LICENSE](LICENSE). `exif-terminator` is free software, licensed under the [GNU AGPL v3 LICENSE](LICENSE).
Copyright (C) 2022-2024 SuperSeriousBusiness. Copyright (C) 2022-2025 SuperSeriousBusiness.

View file

@ -23,7 +23,7 @@ import (
"fmt" "fmt"
"io" "io"
jpegstructure "codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2" jpegstructure "code.superseriousbusiness.org/go-jpeg-image-structure/v2"
) )
var markerLen = map[byte]int{ var markerLen = map[byte]int{

View file

@ -21,7 +21,7 @@ package terminator
import ( import (
"io" "io"
pngstructure "codeberg.org/superseriousbusiness/go-png-image-structure/v2" pngstructure "code.superseriousbusiness.org/go-png-image-structure/v2"
) )
type pngVisitor struct { type pngVisitor struct {

View file

@ -25,8 +25,8 @@ import (
"fmt" "fmt"
"io" "io"
jpegstructure "codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2" jpegstructure "code.superseriousbusiness.org/go-jpeg-image-structure/v2"
pngstructure "codeberg.org/superseriousbusiness/go-png-image-structure/v2" pngstructure "code.superseriousbusiness.org/go-png-image-structure/v2"
) )
func Terminate(in io.Reader, mediaType string) (io.Reader, error) { func Terminate(in io.Reader, mediaType string) (io.Reader, error) {

18
vendor/modules.txt vendored
View file

@ -1,3 +1,12 @@
# code.superseriousbusiness.org/exif-terminator v0.11.0
## explicit; go 1.23
code.superseriousbusiness.org/exif-terminator
# code.superseriousbusiness.org/go-jpeg-image-structure/v2 v2.3.0
## explicit; go 1.17
code.superseriousbusiness.org/go-jpeg-image-structure/v2
# code.superseriousbusiness.org/go-png-image-structure/v2 v2.3.0
## explicit; go 1.12
code.superseriousbusiness.org/go-png-image-structure/v2
# code.superseriousbusiness.org/httpsig v1.4.0 # code.superseriousbusiness.org/httpsig v1.4.0
## explicit; go 1.21 ## explicit; go 1.21
code.superseriousbusiness.org/httpsig code.superseriousbusiness.org/httpsig
@ -266,15 +275,6 @@ codeberg.org/superseriousbusiness/activity/streams/values/rfc2045
codeberg.org/superseriousbusiness/activity/streams/values/rfc5988 codeberg.org/superseriousbusiness/activity/streams/values/rfc5988
codeberg.org/superseriousbusiness/activity/streams/values/string codeberg.org/superseriousbusiness/activity/streams/values/string
codeberg.org/superseriousbusiness/activity/streams/vocab codeberg.org/superseriousbusiness/activity/streams/vocab
# codeberg.org/superseriousbusiness/exif-terminator v0.10.0
## explicit; go 1.21
codeberg.org/superseriousbusiness/exif-terminator
# codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2 v2.1.0-SSB
## explicit; go 1.17
codeberg.org/superseriousbusiness/go-jpeg-image-structure/v2
# codeberg.org/superseriousbusiness/go-png-image-structure/v2 v2.1.0-SSB
## explicit; go 1.12
codeberg.org/superseriousbusiness/go-png-image-structure/v2
# codeberg.org/superseriousbusiness/oauth2/v4 v4.7.0-SSB # codeberg.org/superseriousbusiness/oauth2/v4 v4.7.0-SSB
## explicit; go 1.23.0 ## explicit; go 1.23.0
codeberg.org/superseriousbusiness/oauth2/v4 codeberg.org/superseriousbusiness/oauth2/v4