Rename to uncensored-send
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"send/internal/config"
|
||||
"uncensored-send/internal/config"
|
||||
)
|
||||
|
||||
// tokenFilePerm is deliberately stricter than the rest of the data directory:
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"send/internal/config"
|
||||
"uncensored-send/internal/config"
|
||||
)
|
||||
|
||||
func defaults() *config.Config {
|
||||
|
||||
@@ -35,7 +35,7 @@ type Config struct {
|
||||
trustedProxyNets []*net.IPNet
|
||||
}
|
||||
|
||||
const EnvPrefix = "SEND_"
|
||||
const EnvPrefix = "UNCENSORED_SEND_"
|
||||
|
||||
// Register wires every option onto s. Short forms exist only for the options
|
||||
// reached often; everything else is long-only, by design.
|
||||
|
||||
@@ -86,7 +86,7 @@ func TestFormatRoundTrips(t *testing.T) {
|
||||
func TestHyphenConvention(t *testing.T) {
|
||||
newSet := func() (*Set, *string) {
|
||||
var listen string
|
||||
s := NewSet("test", "SEND_TEST_")
|
||||
s := NewSet("test", "UNCENSORED_SEND_TEST_")
|
||||
s.String(&listen, "listen", "l", "default", "ADDR", "listen address")
|
||||
return s, &listen
|
||||
}
|
||||
@@ -116,9 +116,9 @@ func TestHyphenConvention(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnvFallback(t *testing.T) {
|
||||
t.Setenv("SEND_TEST_MAX_SIZE", "4GiB")
|
||||
t.Setenv("UNCENSORED_SEND_TEST_MAX_SIZE", "4GiB")
|
||||
var size int64
|
||||
s := NewSet("test", "SEND_TEST_")
|
||||
s := NewSet("test", "UNCENSORED_SEND_TEST_")
|
||||
s.Size(&size, "max-size", "s", "2GiB", "cap")
|
||||
if err := s.Parse(nil); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -128,7 +128,7 @@ func TestEnvFallback(t *testing.T) {
|
||||
}
|
||||
|
||||
// An explicit flag still wins over the environment.
|
||||
s = NewSet("test", "SEND_TEST_")
|
||||
s = NewSet("test", "UNCENSORED_SEND_TEST_")
|
||||
s.Size(&size, "max-size", "s", "2GiB", "cap")
|
||||
if err := s.Parse([]string{"--max-size", "1GiB"}); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -52,7 +52,7 @@ func (s *Set) note(long, short string) {
|
||||
}
|
||||
}
|
||||
|
||||
// envName maps --max-size to SEND_MAX_SIZE.
|
||||
// envName maps --max-size to UNCENSORED_SEND_MAX_SIZE.
|
||||
func (s *Set) envName(long string) string {
|
||||
return s.envPrefix + strings.ToUpper(strings.ReplaceAll(long, "-", "_"))
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func (s *Set) checkConvention(args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// applyEnv seeds every option from its SEND_-prefixed environment variable.
|
||||
// applyEnv seeds every option from its UNCENSORED_SEND_-prefixed environment variable.
|
||||
// Called before parsing so an explicit command-line flag always wins.
|
||||
func (s *Set) applyEnv() error {
|
||||
for _, sp := range s.specs {
|
||||
@@ -214,7 +214,7 @@ func (s *Set) Parse(args []string) error {
|
||||
// Changed reports whether an option was given on the command line.
|
||||
//
|
||||
// Values picked up from the environment do not count: a command that acts only
|
||||
// on the options you actually typed must not quietly act on a SEND_ variable
|
||||
// on the options you actually typed must not quietly act on a UNCENSORED_SEND_ variable
|
||||
// exported for the server.
|
||||
func (s *Set) Changed(long string) bool {
|
||||
if s.fromEnv[long] {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"send/internal/config"
|
||||
"uncensored-send/internal/config"
|
||||
)
|
||||
|
||||
// adminPage is the one view that shows every object, regardless of who
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// reason to prefer it over localStorage, where any injected script could
|
||||
// exfiltrate the credential. The page never needs to see the value: the server
|
||||
// resolves it and renders who the caller is.
|
||||
const tokenCookie = "send_token"
|
||||
const tokenCookie = "uncensored_send_token"
|
||||
|
||||
// rememberFor is how long a persisted login survives. Tokens are revoked by
|
||||
// deleting them from the token file, so a long window costs nothing.
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"send/internal/auth"
|
||||
"send/internal/store"
|
||||
"uncensored-send/internal/auth"
|
||||
"uncensored-send/internal/store"
|
||||
)
|
||||
|
||||
// handleDelete removes an object early. Three credentials are accepted: the
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"send/internal/store"
|
||||
"uncensored-send/internal/store"
|
||||
)
|
||||
|
||||
// downloadCSP is as inert as a policy gets. Combined with the attachment
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"send/internal/config"
|
||||
"uncensored-send/internal/config"
|
||||
)
|
||||
|
||||
// loginPage backs both the form and its error redisplay.
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"send/internal/auth"
|
||||
"send/internal/config"
|
||||
"send/internal/store"
|
||||
"uncensored-send/internal/auth"
|
||||
"uncensored-send/internal/config"
|
||||
"uncensored-send/internal/store"
|
||||
)
|
||||
|
||||
func writeJSON(w http.ResponseWriter, status int, v any) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"send/internal/config"
|
||||
"uncensored-send/internal/config"
|
||||
)
|
||||
|
||||
// limiter is a per-key token bucket. It is deliberately small: there is no
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"send/internal/auth"
|
||||
"send/internal/config"
|
||||
"send/internal/store"
|
||||
"send/web"
|
||||
"uncensored-send/internal/auth"
|
||||
"uncensored-send/internal/config"
|
||||
"uncensored-send/internal/store"
|
||||
"uncensored-send/web"
|
||||
)
|
||||
|
||||
// Server holds everything the handlers need. It is safe for concurrent use.
|
||||
|
||||
@@ -19,9 +19,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"send/internal/auth"
|
||||
"send/internal/config"
|
||||
"send/internal/store"
|
||||
"uncensored-send/internal/auth"
|
||||
"uncensored-send/internal/config"
|
||||
"uncensored-send/internal/store"
|
||||
)
|
||||
|
||||
// clock is the fixed instant tests start from; s.now is swapped so expiry can
|
||||
@@ -42,7 +42,7 @@ func newHarness(t *testing.T, tweak func(*config.Config)) *harness {
|
||||
dir := t.TempDir()
|
||||
|
||||
cfg := config.Config{}
|
||||
fs := config.NewSet("test", "SEND_TEST_")
|
||||
fs := config.NewSet("test", "UNCENSORED_SEND_TEST_")
|
||||
cfg.Register(fs)
|
||||
if err := fs.Parse(nil); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"send/internal/auth"
|
||||
"send/internal/config"
|
||||
"send/internal/store"
|
||||
"uncensored-send/internal/auth"
|
||||
"uncensored-send/internal/config"
|
||||
"uncensored-send/internal/store"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user