mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-05 01:00:11 -05:00
Compare commits
9
Commits
main
...
v2.0.3-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c0a4c30bb | ||
|
|
e4f00dcb2d | ||
|
|
d799101c13 | ||
|
|
84add75dd8 | ||
|
|
a38dcfb578 | ||
|
|
61d22cd055 | ||
|
|
6c98673b8f | ||
|
|
b7991244db | ||
|
|
47269ac51a |
No files matched your search
@@ -2,6 +2,29 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. For commit guidelines, please refer to [Standard Version](https://github.com/conventional-changelog/standard-version).
|
||||
|
||||
## v2.0.3
|
||||
|
||||
**Security**:
|
||||
- [High] Stored XSS via HTML preview: strip `<script>` from sanitized srcdoc, remove `allow-same-origin` from the preview iframe sandbox, set HttpOnly on the session cookie, and add a nonce-based `script-src` CSP on the SPA shell (GHSA-vvm6-jwrf-hgmg) -- thanks @qrn12580
|
||||
- [Moderate] Non-admin users could PATCH privileged fields on their own account (scopes, permissions, etc.), allowing privilege escalation; restores v1 non-admin field guard on PATCH /api/users (GHSA-p5cc-4p84-c4m2) -- thanks @Chri6s
|
||||
|
||||
**New Features**:
|
||||
- Added option to globally disable the "Install App" message via `frontend.disablePWAInstall`
|
||||
- PWA improvements for installed mobile apps: dedicated maskable icons (192/512), manifest and splash colors that follow the instance default theme, runtime `theme-color` sync on dark-mode toggle, and edge-to-edge safe-area layout for notched devices (#2625) (#2869) -- thanks @APatenaude
|
||||
|
||||
**Bugfixes**:
|
||||
- Fixed Fuji `.raf` thumbnail preview by extracting the camera-embedded JPEG from the RAF header (regression for files where TIFF-based raw extraction does not apply).
|
||||
- Image previews for unsupported decodable formats now return HTTP 415 immediately instead of attempting JPEG decode and returning HTTP 500.
|
||||
- OIDC: preserve the verified ID-token user identifier when falling back to the UserInfo endpoint for missing groups, so login no longer fails with HTTP 500 when UserInfo returns groups but omits the configured identifier.
|
||||
- LDAP: restore `memberOf` as the default `groupsClaim` when unset, fixing group-based admin and login authorization for existing LDAP configs after the v2.0.2 default changed to `groups`.
|
||||
- "Install app" message reappears after being cleared on device.
|
||||
- Restored upload chunk size `0` to disable chunking as documented ([#2202](https://github.com/gtsteffaniak/filebrowser/issues/2202)).
|
||||
- Fixed iOS 26 / WebKit multi-chunk upload stall by isolating chunk connections and returning partial chunk JSON responses ([#2734](https://github.com/gtsteffaniak/filebrowser/issues/2734)).
|
||||
- Sidebar folder links with custom names, icons, or styles no longer disappear after restart; multiple shortcuts to different folders on the same source are preserved ([#2809](https://github.com/gtsteffaniak/filebrowser/issues/2809)).
|
||||
- Adding a source to a user via scopes now auto-adds a matching sidebar link; removing a source keeps the link (shown disabled) so users can delete it manually.
|
||||
- A password reset via CLI returns user to a password method user.
|
||||
- Authentication login methods are consistently enforced without modifying existing account settings.
|
||||
|
||||
## v2.0.2
|
||||
|
||||
**Bugfixes**:
|
||||
|
||||
+4
-1
@@ -115,7 +115,7 @@ func setUser(username, password string, asAdmin bool) error {
|
||||
return nil
|
||||
}
|
||||
if user.LoginMethod != users.LoginMethodPassword {
|
||||
return fmt.Errorf("user %s is not allowed to login with password authentication, cannot set password", username)
|
||||
logger.Infof("Converting user %s from %s to password login method", username, user.LoginMethod)
|
||||
}
|
||||
user.TOTPSecret = ""
|
||||
user.TOTPNonce = ""
|
||||
@@ -139,6 +139,9 @@ func promoteUser(username string) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("user %s not found", username)
|
||||
}
|
||||
if user.LoginMethod != users.LoginMethodPassword {
|
||||
return fmt.Errorf("user %s cannot be promoted: only password-login users can be granted admin via CLI", username)
|
||||
}
|
||||
if user.Permissions.Admin {
|
||||
fmt.Printf("user %s is already an admin\n", username)
|
||||
return nil
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/app"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/state"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
)
|
||||
|
||||
func setupCLIUserTest(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Setenv("FILEBROWSER_ONLYOFFICE_SECRET", "")
|
||||
settings.InitializeCLI("../../../_docker/src/noauth/backend/config.yaml")
|
||||
settings.Env.IsPlaywright = true
|
||||
|
||||
dbPath := filepath.Join(t.TempDir(), "filebrowser.sqlite")
|
||||
store, _, err := state.Open(dbPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
app.MustWireServices(store)
|
||||
t.Cleanup(func() { _ = state.Close() })
|
||||
}
|
||||
|
||||
func TestSetUserConvertsOIDCToPassword(t *testing.T) {
|
||||
setupCLIUserTest(t)
|
||||
|
||||
oidcUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodOidc,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(oidcUser, ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := setUser("graham", "newpassword", false); err != nil {
|
||||
t.Fatalf("setUser: %v", err)
|
||||
}
|
||||
|
||||
loaded, err := state.GetUserByUsername("graham")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if loaded.LoginMethod != users.LoginMethodPassword {
|
||||
t.Fatalf("loginMethod = %q, want password", loaded.LoginMethod)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromoteUserRejectsNonPasswordLoginMethod(t *testing.T) {
|
||||
setupCLIUserTest(t)
|
||||
|
||||
oidcUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodOidc,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(oidcUser, ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err := promoteUser("graham")
|
||||
if err == nil {
|
||||
t.Fatal("promoteUser: expected error for oidc user")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "password-login") {
|
||||
t.Fatalf("promoteUser err = %q, want password-login restriction", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromoteUserAllowsPasswordLoginMethod(t *testing.T) {
|
||||
setupCLIUserTest(t)
|
||||
|
||||
passwordUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodPassword,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(passwordUser, "secret"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := promoteUser("graham"); err != nil {
|
||||
t.Fatalf("promoteUser: %v", err)
|
||||
}
|
||||
|
||||
loaded, err := state.GetUserByUsername("graham")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !loaded.Permissions.Admin {
|
||||
t.Fatal("expected admin after promote")
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -210,14 +210,14 @@ func runCLI() (keepGoing bool, dbExists bool) {
|
||||
switch {
|
||||
case cmd == "" || cmd == "run":
|
||||
requireExistingConfig(configPath)
|
||||
dbExists = initializeDatabase(configPath)
|
||||
dbExists = initializeDatabase(configPath, false)
|
||||
return true, dbExists
|
||||
case cmd == "version" || cmd == "setup":
|
||||
parser.FatalIfErrorf(ctx.Run(&rootCLI))
|
||||
return false, false
|
||||
case cmd == "set rule" || cmd == "set" || strings.HasPrefix(cmd, "user set") || strings.HasPrefix(cmd, "user promote"):
|
||||
requireExistingConfig(configPath)
|
||||
dbExists = initializeDatabase(configPath)
|
||||
dbExists = initializeDatabase(configPath, true)
|
||||
parser.FatalIfErrorf(ctx.Run(&rootCLI))
|
||||
return false, dbExists
|
||||
default:
|
||||
|
||||
+6
-2
@@ -29,8 +29,12 @@ import (
|
||||
|
||||
var runtimeApp *app.App
|
||||
|
||||
func initializeDatabase(configFile string) bool {
|
||||
settings.Initialize(configFile)
|
||||
func initializeDatabase(configFile string, cliMode bool) bool {
|
||||
if cliMode {
|
||||
settings.InitializeCLI(configFile)
|
||||
} else {
|
||||
settings.Initialize(configFile)
|
||||
}
|
||||
|
||||
if err := validateDatabasePaths(); err != nil {
|
||||
logger.Fatalf("%v", err)
|
||||
|
||||
+18
-25
@@ -81,7 +81,8 @@ func validateUserInfo(newDB bool) {
|
||||
logger.Info("Resetting admin user to default username and password.")
|
||||
user.Permissions = settings.AdminPerms()
|
||||
user.Password = settings.Config.Auth.AdminPassword
|
||||
changedFields = append(changedFields, "permissions", "password")
|
||||
user.LoginMethod = users.LoginMethodPassword
|
||||
changedFields = append(changedFields, "permissions", "password", "loginMethod")
|
||||
changePass = true
|
||||
}
|
||||
|
||||
@@ -233,35 +234,27 @@ func updatePreviewSettings(user *users.User) bool {
|
||||
|
||||
// updateSidebarLinks normalizes sidebar links and ensures scoped sources have sidebar entries.
|
||||
func updateSidebarLinks(user *users.User) bool {
|
||||
updated := false
|
||||
needsEnsure := usersidebar.NeedsSidebarLinksFromScopes(user.SidebarLinks, user.BackendScopes)
|
||||
validBefore := usersidebar.ValidSourceSidebarLinkCount(user.SidebarLinks)
|
||||
|
||||
if normalized, changed := usersidebar.NormalizeSidebarLinks(user.SidebarLinks); changed {
|
||||
user.SidebarLinks = normalized
|
||||
updated = true
|
||||
links, changed := usersidebar.PrepareSidebarLinksForPersist(user.SidebarLinks, user.BackendScopes)
|
||||
if !changed {
|
||||
return false
|
||||
}
|
||||
|
||||
if !usersidebar.NeedsSidebarLinksFromScopes(user.SidebarLinks, user.BackendScopes) {
|
||||
return updated
|
||||
user.SidebarLinks = links
|
||||
|
||||
if needsEnsure {
|
||||
if validBefore == 0 && len(user.SidebarLinks) > 0 {
|
||||
logger.Infof("User %s has stale source sidebar links, merging missing links from scopes", user.Username)
|
||||
} else if validBefore == 0 {
|
||||
logger.Infof("User %s has no source sidebar links, building from scopes", user.Username)
|
||||
} else {
|
||||
logger.Infof("User %s is missing sidebar links for some scoped sources, merging from scopes", user.Username)
|
||||
}
|
||||
}
|
||||
|
||||
if usersidebar.ValidSourceSidebarLinkCount(user.SidebarLinks) == 0 && len(user.SidebarLinks) > 0 {
|
||||
logger.Infof("User %s has stale source sidebar links, merging missing links from scopes", user.Username)
|
||||
} else if usersidebar.ValidSourceSidebarLinkCount(user.SidebarLinks) == 0 {
|
||||
logger.Infof("User %s has no source sidebar links, building from scopes", user.Username)
|
||||
} else {
|
||||
logger.Infof("User %s is missing sidebar links for some scoped sources, merging from scopes", user.Username)
|
||||
}
|
||||
|
||||
merged, changed := usersidebar.EnsureSidebarLinksFromScopes(user.SidebarLinks, user.BackendScopes)
|
||||
if changed {
|
||||
user.SidebarLinks = merged
|
||||
updated = true
|
||||
}
|
||||
if normalized, changed := usersidebar.NormalizeSidebarLinks(user.SidebarLinks); changed {
|
||||
user.SidebarLinks = normalized
|
||||
updated = true
|
||||
}
|
||||
return updated
|
||||
return true
|
||||
}
|
||||
|
||||
func updateTokens(user *users.User) bool {
|
||||
|
||||
@@ -131,10 +131,10 @@ func checkPermissionsImpl(opts utils.FileOptions, user *users.User, s *Service)
|
||||
return "", "", fmt.Errorf("user not provided")
|
||||
}
|
||||
if opts.Path == "" {
|
||||
return "", "", fmt.Errorf("path not provided")
|
||||
return "", "", fmt.Errorf("%w: path not provided", errors.ErrInvalidRequestParams)
|
||||
}
|
||||
if opts.Source == "" {
|
||||
return "", "", fmt.Errorf("source not provided")
|
||||
return "", "", fmt.Errorf("%w: source not provided", errors.ErrInvalidRequestParams)
|
||||
}
|
||||
|
||||
// Get index
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/ports"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/utils"
|
||||
"github.com/gtsteffaniak/go-logger/logger"
|
||||
)
|
||||
|
||||
// Service performs authentication using injected user reads. It never persists users.
|
||||
@@ -72,6 +73,7 @@ func (s *Service) AuthenticatePassword(r *http.Request, disableOtp bool) (*users
|
||||
}
|
||||
}
|
||||
if user.LoginMethod != users.LoginMethodPassword {
|
||||
logger.Debugf("login rejected: user %q attempted password login but account loginMethod is %q", username, user.LoginMethod)
|
||||
return nil, errors.ErrWrongLoginMethod
|
||||
}
|
||||
return &user, nil
|
||||
|
||||
@@ -25,6 +25,7 @@ var (
|
||||
ErrNotViewable = errors.New("directory or item is not viewable")
|
||||
ErrPathEscapesScope = errors.New("resolved path escapes scope")
|
||||
ErrWrongLoginMethod = errors.New("user attempted to login with wrong login method")
|
||||
ErrInvalidLoginMethod = errors.New("invalid login method")
|
||||
ErrDownloadNotAllowed = errors.New("downloads are not allowed for this share")
|
||||
ErrUseMediaStream = errors.New("use /media/stream for audio and video")
|
||||
ErrUploadNotAllowed = errors.New("upload permission not allowed for this share")
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -28,8 +30,9 @@ const (
|
||||
|
||||
// iconSize defines an icon size to generate
|
||||
type iconSize struct {
|
||||
size int
|
||||
name string
|
||||
size int
|
||||
name string
|
||||
maskable bool
|
||||
}
|
||||
|
||||
// determineSourceType determines which type of favicon source we have
|
||||
@@ -153,13 +156,16 @@ func handleRasterFavicon(faviconPath string) ([]byte, error) {
|
||||
func getIconSizesToGenerate() []iconSize {
|
||||
return []iconSize{
|
||||
// Browser favicon (32x32 PNG for Safari/older browsers)
|
||||
{32, "favicon-32x32.png"},
|
||||
{32, "favicon-32x32.png", false},
|
||||
// PWA icons (PNG required for Apple PWA compatibility)
|
||||
{192, "pwa-icon-192.png"},
|
||||
{256, "pwa-icon-256.png"}, // Also serves as Windows tile
|
||||
{512, "pwa-icon-512.png"},
|
||||
{192, "pwa-icon-192.png", false},
|
||||
{256, "pwa-icon-256.png", false}, // Also serves as Windows tile
|
||||
{512, "pwa-icon-512.png", false},
|
||||
// Maskable PWA icons: art inset into the Android adaptive-icon safe zone
|
||||
{192, "pwa-icon-maskable-192.png", true},
|
||||
{512, "pwa-icon-maskable-512.png", true},
|
||||
// Platform-specific icons
|
||||
{180, "apple-touch-icon.png"}, // iOS home screen (required for Apple)
|
||||
{180, "apple-touch-icon.png", false}, // iOS home screen (required for Apple)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,8 +199,55 @@ func generateIconSizes(sourceData []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// generateMaskableIcon insets the art into the safe zone on an opaque background, since launchers zoom maskable icons to fill the mask edge-to-edge
|
||||
func generateMaskableIcon(sourceData []byte, icon iconSize) error {
|
||||
img, err := imaging.Decode(bytes.NewReader(sourceData))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to decode source: %w", err)
|
||||
}
|
||||
|
||||
// Android adaptive-icon content ratio (72/108 ≈ 2/3) keeps square art inside every mask shape
|
||||
inner := icon.size * 2 / 3
|
||||
art := imaging.Fit(img, inner, inner, imaging.Lanczos)
|
||||
canvas := imaging.PasteCenter(imaging.New(icon.size, icon.size, maskableBackground(img)), art)
|
||||
|
||||
outputPath := filepath.Join(settings.PWAIconsCacheDir(), icon.name)
|
||||
outFile, err := os.Create(outputPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create file: %w", err)
|
||||
}
|
||||
defer outFile.Close()
|
||||
|
||||
if err := imaging.Encode(outFile, canvas, imaging.PNG); err != nil {
|
||||
os.Remove(outputPath)
|
||||
return fmt.Errorf("encode failed: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// maskableBackground samples the art's corners then edge midpoints for an opaque pad color, else white
|
||||
func maskableBackground(img image.Image) color.Color {
|
||||
b := img.Bounds()
|
||||
cx, cy := (b.Min.X+b.Max.X)/2, (b.Min.Y+b.Max.Y)/2
|
||||
points := []image.Point{
|
||||
{b.Min.X, b.Min.Y}, {b.Max.X - 1, b.Min.Y}, {b.Min.X, b.Max.Y - 1}, {b.Max.X - 1, b.Max.Y - 1},
|
||||
{cx, b.Min.Y}, {cx, b.Max.Y - 1}, {b.Min.X, cy}, {b.Max.X - 1, cy},
|
||||
}
|
||||
for _, p := range points {
|
||||
r, g, bl, a := img.At(p.X, p.Y).RGBA()
|
||||
if a == 0xffff {
|
||||
return color.NRGBA{R: uint8(r >> 8), G: uint8(g >> 8), B: uint8(bl >> 8), A: 255}
|
||||
}
|
||||
}
|
||||
return color.White
|
||||
}
|
||||
|
||||
// generateSingleIcon generates a single icon file at the specified size
|
||||
func generateSingleIcon(previewService *preview.Service, sourceData []byte, icon iconSize) error {
|
||||
if icon.maskable {
|
||||
return generateMaskableIcon(sourceData, icon)
|
||||
}
|
||||
|
||||
outputPath := filepath.Join(settings.PWAIconsCacheDir(), icon.name)
|
||||
|
||||
// Create output file
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package icons
|
||||
|
||||
import (
|
||||
"image"
|
||||
"image/color"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
)
|
||||
|
||||
func TestMaskableBackgroundOpaqueCorner(t *testing.T) {
|
||||
img := image.NewRGBA(image.Rect(0, 0, 12, 12))
|
||||
img.Set(0, 0, color.RGBA{R: 10, G: 20, B: 30, A: 255})
|
||||
|
||||
got := maskableBackground(img)
|
||||
want := color.NRGBA{R: 10, G: 20, B: 30, A: 255}
|
||||
if got != want {
|
||||
t.Fatalf("opaque corner: got %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMaskableBackgroundOpaqueEdge(t *testing.T) {
|
||||
img := image.NewRGBA(image.Rect(0, 0, 12, 12))
|
||||
img.Set(6, 0, color.RGBA{R: 200, G: 100, B: 50, A: 255})
|
||||
|
||||
got := maskableBackground(img)
|
||||
want := color.NRGBA{R: 200, G: 100, B: 50, A: 255}
|
||||
if got != want {
|
||||
t.Fatalf("opaque edge: got %#v, want %#v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMaskableBackgroundAllTransparent(t *testing.T) {
|
||||
img := image.NewRGBA(image.Rect(0, 0, 12, 12))
|
||||
if got := maskableBackground(img); got != color.White {
|
||||
t.Fatalf("all transparent: got %#v, want white", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultBackgroundColor(t *testing.T) {
|
||||
saved := settings.Config
|
||||
defer func() { settings.Config = saved }()
|
||||
|
||||
dark := true
|
||||
light := false
|
||||
|
||||
settings.Config.Frontend.Styling.DarkBackground = "#111111"
|
||||
settings.Config.Frontend.Styling.LightBackground = "#ffffff"
|
||||
|
||||
settings.Config.UserDefaults.UI.DarkMode = &dark
|
||||
if got := settings.DefaultBackgroundColor(); got != "#111111" {
|
||||
t.Fatalf("dark branch: got %q, want %q", got, "#111111")
|
||||
}
|
||||
|
||||
settings.Config.UserDefaults.UI.DarkMode = &light
|
||||
if got := settings.DefaultBackgroundColor(); got != "#ffffff" {
|
||||
t.Fatalf("light branch (dark disabled): got %q, want %q", got, "#ffffff")
|
||||
}
|
||||
|
||||
settings.Config.UserDefaults.UI.DarkMode = nil
|
||||
if got := settings.DefaultBackgroundColor(); got != "#ffffff" {
|
||||
t.Fatalf("light branch (unset): got %q, want %q", got, "#ffffff")
|
||||
}
|
||||
}
|
||||
@@ -44,14 +44,14 @@ func pwaManifestName(name string) string {
|
||||
}
|
||||
|
||||
// generatePWAManifest creates the PWA manifest structure
|
||||
func generatePWAManifest(name, description, baseURL, themeColor, pwaIcon192, pwaIcon256, pwaIcon512 string) PWAManifest {
|
||||
func generatePWAManifest(name, description, baseURL, themeColor, backgroundColor, pwaIcon192, pwaIcon256, pwaIcon512, pwaIconMaskable192, pwaIconMaskable512 string) PWAManifest {
|
||||
return PWAManifest{
|
||||
Name: pwaManifestName(name),
|
||||
ID: baseURL,
|
||||
Scope: baseURL,
|
||||
StartURL: baseURL,
|
||||
Display: "standalone",
|
||||
BackgroundColor: "#ffffff",
|
||||
BackgroundColor: backgroundColor,
|
||||
ThemeColor: themeColor,
|
||||
Description: description,
|
||||
Icons: []PWAIcon{
|
||||
@@ -65,7 +65,7 @@ func generatePWAManifest(name, description, baseURL, themeColor, pwaIcon192, pwa
|
||||
Src: pwaIcon256,
|
||||
Sizes: "256x256",
|
||||
Type: "image/png",
|
||||
Purpose: "any maskable",
|
||||
Purpose: "any",
|
||||
},
|
||||
{
|
||||
Src: pwaIcon512,
|
||||
@@ -73,6 +73,18 @@ func generatePWAManifest(name, description, baseURL, themeColor, pwaIcon192, pwa
|
||||
Type: "image/png",
|
||||
Purpose: "any",
|
||||
},
|
||||
{
|
||||
Src: pwaIconMaskable192,
|
||||
Sizes: "192x192",
|
||||
Type: "image/png",
|
||||
Purpose: "maskable",
|
||||
},
|
||||
{
|
||||
Src: pwaIconMaskable512,
|
||||
Sizes: "512x512",
|
||||
Type: "image/png",
|
||||
Purpose: "maskable",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -85,11 +97,13 @@ func InitializePWAManifest() {
|
||||
staticURL := config.Http.BaseURL + "public/static"
|
||||
title := config.Frontend.Name
|
||||
description := config.Frontend.Description
|
||||
defaultThemeColor := "#455a64"
|
||||
|
||||
pwaIcon192 := staticURL + "/icons/pwa-icon-192.png"
|
||||
pwaIcon256 := staticURL + "/icons/pwa-icon-256.png"
|
||||
pwaIcon512 := staticURL + "/icons/pwa-icon-512.png"
|
||||
pwaIconMaskable192 := staticURL + "/icons/pwa-icon-maskable-192.png"
|
||||
pwaIconMaskable512 := staticURL + "/icons/pwa-icon-maskable-512.png"
|
||||
|
||||
CachedManifest = generatePWAManifest(title, description, config.Http.BaseURL, defaultThemeColor, pwaIcon192, pwaIcon256, pwaIcon512)
|
||||
backgroundColor := settings.DefaultBackgroundColor()
|
||||
|
||||
CachedManifest = generatePWAManifest(title, description, config.Http.BaseURL, backgroundColor, backgroundColor, pwaIcon192, pwaIcon256, pwaIcon512, pwaIconMaskable192, pwaIconMaskable512)
|
||||
}
|
||||
@@ -56,6 +56,8 @@ func ExtractEmbeddedPreview(ctx context.Context, path string) ([]byte, error) {
|
||||
switch {
|
||||
case ext == ".cr3":
|
||||
data, err = extimagemeta.PreviewCR3(f)
|
||||
case ext == ".raf":
|
||||
data, err = extractRAFEmbeddedPreview(f)
|
||||
case isRawImageExtension(ext):
|
||||
data, err = extractTIFFEmbeddedPreview(f)
|
||||
case isHEICExtension(ext):
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//go:build !386 && !arm
|
||||
|
||||
package imagemeta
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
rafMagicLen = 16
|
||||
rafMagic = "FUJIFILMCCD-RAW "
|
||||
rafJPEGOffsetPos = 0x54
|
||||
rafJPEGLengthPos = 0x58
|
||||
rafHeaderMinBytes = 0x5C
|
||||
)
|
||||
|
||||
// extractRAFEmbeddedPreview reads the camera-embedded JPEG from a Fuji RAF file.
|
||||
// Offset and length are stored as big-endian uint32 at 0x54 and 0x58 in the RAF header directory.
|
||||
func extractRAFEmbeddedPreview(f *os.File) ([]byte, error) {
|
||||
info, err := f.Stat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if info.Size() < rafHeaderMinBytes {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
header := make([]byte, rafHeaderMinBytes)
|
||||
n, err := f.ReadAt(header, 0)
|
||||
if err != nil && err != io.EOF {
|
||||
return nil, err
|
||||
}
|
||||
if n < rafHeaderMinBytes {
|
||||
return nil, nil
|
||||
}
|
||||
if !isRAFMagic(header[:rafMagicLen]) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
offset := binary.BigEndian.Uint32(header[rafJPEGOffsetPos:rafJPEGLengthPos])
|
||||
length := binary.BigEndian.Uint32(header[rafJPEGLengthPos:rafHeaderMinBytes])
|
||||
if offset == 0 || length == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
if int64(offset)+int64(length) > info.Size() {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
data, err := readFileRange(f, offset, length)
|
||||
if err != nil || len(data) == 0 || !IsJPEG(data) {
|
||||
return nil, nil
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func isRAFMagic(b []byte) bool {
|
||||
if len(b) < len(rafMagic) {
|
||||
return false
|
||||
}
|
||||
for i := 0; i < len(rafMagic); i++ {
|
||||
if b[i] != rafMagic[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//go:build !386 && !arm
|
||||
|
||||
package imagemeta
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExtractRAFEmbeddedPreviewSynthetic(t *testing.T) {
|
||||
jpeg := []byte{0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0xff, 0xd9}
|
||||
const jpegOffset = uint32(0x94)
|
||||
|
||||
data := make([]byte, int(jpegOffset)+len(jpeg))
|
||||
copy(data[:rafMagicLen], []byte(rafMagic))
|
||||
binary.BigEndian.PutUint32(data[rafJPEGOffsetPos:rafJPEGLengthPos], jpegOffset)
|
||||
binary.BigEndian.PutUint32(data[rafJPEGLengthPos:rafHeaderMinBytes], uint32(len(jpeg)))
|
||||
copy(data[jpegOffset:], jpeg)
|
||||
|
||||
path := filepath.Join(t.TempDir(), "sample.raf")
|
||||
if err := os.WriteFile(path, data, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
got, err := ExtractEmbeddedPreview(context.Background(), path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !IsJPEG(got) {
|
||||
t.Fatalf("expected JPEG preview, got %d bytes", len(got))
|
||||
}
|
||||
if len(got) != len(jpeg) {
|
||||
t.Fatalf("preview size = %d, want %d", len(got), len(jpeg))
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractRAFEmbeddedPreviewIgnoresInvalidMagic(t *testing.T) {
|
||||
data := make([]byte, 256)
|
||||
copy(data[:rafMagicLen], []byte("FUJIFILMCCD-RAW!"))
|
||||
path := filepath.Join(t.TempDir(), "bad.raf")
|
||||
if err := os.WriteFile(path, data, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
got, err := ExtractEmbeddedPreview(context.Background(), path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != nil {
|
||||
t.Fatalf("ExtractEmbeddedPreview() = %v, want nil", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractRAFEmbeddedPreviewDSCF1276(t *testing.T) {
|
||||
path := "/Users/steffag/Downloads/DSCF1276.RAF"
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
t.Skip(path)
|
||||
}
|
||||
|
||||
got, err := ExtractEmbeddedPreview(context.Background(), path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !IsJPEG(got) {
|
||||
t.Fatalf("expected JPEG preview, got %d bytes", len(got))
|
||||
}
|
||||
if len(got) < 100 {
|
||||
t.Fatalf("preview size = %d, want >= 100", len(got))
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractRAFEmbeddedPreviewRejectsOutOfBoundsOffset(t *testing.T) {
|
||||
jpeg := []byte{0xff, 0xd8, 0xff, 0xd9}
|
||||
data := make([]byte, 256)
|
||||
copy(data[:rafMagicLen], []byte(rafMagic))
|
||||
binary.BigEndian.PutUint32(data[rafJPEGOffsetPos:rafJPEGLengthPos], 200)
|
||||
binary.BigEndian.PutUint32(data[rafJPEGLengthPos:rafHeaderMinBytes], uint32(len(jpeg)))
|
||||
|
||||
path := filepath.Join(t.TempDir(), "oob.raf")
|
||||
if err := os.WriteFile(path, data, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
got, err := ExtractEmbeddedPreview(context.Background(), path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got != nil {
|
||||
t.Fatalf("ExtractEmbeddedPreview() = %v, want nil", got)
|
||||
}
|
||||
}
|
||||
@@ -271,10 +271,17 @@ func (s *Service) generateRawPreview(ctx context.Context, file iteminfo.Extended
|
||||
|
||||
case previewTypeImage:
|
||||
ext := strings.ToLower(filepath.Ext(file.Name))
|
||||
if iteminfo.IsRawImage(ext) && s.ffmpegService != nil {
|
||||
if bytes, err := s.convertImageWithFFmpeg(ctx, file.RealPath, previewSize); err == nil && len(bytes) >= minPreviewSize {
|
||||
return bytes, nil
|
||||
if iteminfo.IsRawImage(ext) {
|
||||
if s.ffmpegService != nil {
|
||||
previewBytes, err := s.convertImageWithFFmpeg(ctx, file.RealPath, previewSize)
|
||||
if err == nil && len(previewBytes) >= minPreviewSize {
|
||||
return previewBytes, nil
|
||||
}
|
||||
if ctx.Err() != nil {
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
}
|
||||
return nil, ErrUnsupportedFormat
|
||||
}
|
||||
return s.generateImagePreview(ctx, file, previewSize)
|
||||
|
||||
@@ -370,6 +377,13 @@ func (s *Service) generateImagePreview(ctx context.Context, file iteminfo.Extend
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ext := strings.ToLower(filepath.Ext(file.Name))
|
||||
format, err := s.FormatFromExtension(ext)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
options.Format = format
|
||||
|
||||
imageBytes, err := s.CreatePreview(ctx, f, file.Size, options)
|
||||
if err != nil {
|
||||
if ctx.Err() != nil {
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package preview
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/indexing/iteminfo"
|
||||
)
|
||||
|
||||
func TestGenerateRawPreviewRawWithoutEmbeddedReturnsUnsupported(t *testing.T) {
|
||||
data := make([]byte, 256)
|
||||
copy(data[:16], []byte("FUJIFILMCCD-RAW "))
|
||||
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "empty.raf")
|
||||
if err := os.WriteFile(path, data, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
svc := NewPreviewGenerator(1, dir)
|
||||
file := iteminfo.ExtendedFileInfo{
|
||||
FileInfo: iteminfo.FileInfo{
|
||||
ItemInfo: iteminfo.ItemInfo{
|
||||
Name: "empty.raf",
|
||||
Size: int64(len(data)),
|
||||
ModTime: time.Now(),
|
||||
Type: "image/x-fuji-raf",
|
||||
},
|
||||
},
|
||||
RealPath: path,
|
||||
}
|
||||
|
||||
_, err := svc.generateRawPreview(context.Background(), file, "small", "", 0, "hash")
|
||||
if !errors.Is(err, ErrUnsupportedFormat) {
|
||||
t.Fatalf("generateRawPreview() err = %v, want ErrUnsupportedFormat", err)
|
||||
}
|
||||
if strings.Contains(err.Error(), "SOI") {
|
||||
t.Fatalf("generateRawPreview() should fail fast, got JPEG decode error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateImagePreviewUnsupportedExtensionReturnsUnsupported(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "clip.mov")
|
||||
// Must exceed maxSizeForOriginal (256KB) so we don't short-circuit to raw bytes.
|
||||
payload := make([]byte, 256*1024+1)
|
||||
copy(payload, []byte("not a video"))
|
||||
if err := os.WriteFile(path, payload, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
svc := NewPreviewGenerator(1, dir)
|
||||
file := iteminfo.ExtendedFileInfo{
|
||||
FileInfo: iteminfo.FileInfo{
|
||||
ItemInfo: iteminfo.ItemInfo{
|
||||
Name: "clip.mov",
|
||||
Size: int64(len(payload)),
|
||||
ModTime: time.Now(),
|
||||
Type: "video/quicktime",
|
||||
},
|
||||
},
|
||||
RealPath: path,
|
||||
}
|
||||
|
||||
_, err := svc.generateImagePreview(context.Background(), file, "small")
|
||||
if !errors.Is(err, ErrUnsupportedFormat) {
|
||||
t.Fatalf("generateImagePreview() err = %v, want ErrUnsupportedFormat", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateImagePreviewUsesPNGFormat(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
svc := NewPreviewGenerator(1, dir)
|
||||
|
||||
// 1x1 red PNG; pad past maxSizeForOriginal (256KB) so we exercise format selection.
|
||||
const maxSizeForOriginal = 256 * 1024
|
||||
pngBytes := []byte{
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
|
||||
0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
||||
0x08, 0x02, 0x00, 0x00, 0x00, 0x90, 0x77, 0x53,
|
||||
0xde, 0x00, 0x00, 0x00, 0x0c, 0x49, 0x44, 0x41,
|
||||
0x54, 0x08, 0xd7, 0x63, 0xf8, 0xcf, 0xc0, 0x00,
|
||||
0x00, 0x03, 0x01, 0x01, 0x00, 0x18, 0xdd, 0x8d,
|
||||
0xb4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
|
||||
0x44, 0xae, 0x42, 0x60, 0x82,
|
||||
}
|
||||
payload := make([]byte, maxSizeForOriginal+1)
|
||||
copy(payload, pngBytes)
|
||||
path := filepath.Join(dir, "pixel.png")
|
||||
if err := os.WriteFile(path, payload, 0o600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
file := iteminfo.ExtendedFileInfo{
|
||||
FileInfo: iteminfo.FileInfo{
|
||||
ItemInfo: iteminfo.ItemInfo{
|
||||
Name: "pixel.png",
|
||||
Size: int64(len(payload)),
|
||||
ModTime: time.Now(),
|
||||
Type: "image/png",
|
||||
},
|
||||
},
|
||||
RealPath: path,
|
||||
}
|
||||
|
||||
got, err := svc.generateImagePreview(context.Background(), file, "small")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(got) < 8 || string(got[:8]) != "\x89PNG\r\n\x1a\n" {
|
||||
t.Fatalf("expected PNG signature, got %x", got[:min(8, len(got))])
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,9 @@ func initialize(dbPath string) (bool, error) {
|
||||
defer sharesMux.Unlock()
|
||||
defer indexMux.Unlock()
|
||||
|
||||
logger.Info("Initializing state management system...")
|
||||
if !settings.Env.IsCLIMode {
|
||||
logger.Info("Initializing state management system...")
|
||||
}
|
||||
var existingDb bool
|
||||
var err error
|
||||
sqlDb, existingDb, err = sqldb.NewSQLStore(dbPath)
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/share"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/usersidebar"
|
||||
)
|
||||
|
||||
// User operations
|
||||
@@ -221,6 +222,10 @@ func CreateUser(user *users.User, plaintextPassword string) error {
|
||||
|
||||
users.SyncBackendSourcePermissionsMap(user)
|
||||
|
||||
if links, changed := usersidebar.PrepareSidebarLinksForPersist(user.SidebarLinks, user.BackendScopes); changed {
|
||||
user.SidebarLinks = links
|
||||
}
|
||||
|
||||
usersMux.Lock()
|
||||
defer usersMux.Unlock()
|
||||
|
||||
@@ -328,6 +333,19 @@ func UpdateUser(user *users.User, plaintextPassword string, fields ...string) er
|
||||
}
|
||||
}
|
||||
|
||||
if sidebarFieldsPatched(fields) {
|
||||
var links []users.SidebarLink
|
||||
var changed bool
|
||||
if fieldListRequiresScopeConversion(fields) {
|
||||
links, changed = usersidebar.PrepareSidebarLinksForPersist(existingUser.SidebarLinks, existingUser.BackendScopes)
|
||||
} else {
|
||||
links, changed = usersidebar.NormalizeSidebarLinks(existingUser.SidebarLinks)
|
||||
}
|
||||
if changed {
|
||||
existingUser.SidebarLinks = links
|
||||
}
|
||||
}
|
||||
|
||||
return commitUserUpdate(existingUser, storedSnapshot, sourceDefaults, sourceEnforced)
|
||||
}
|
||||
|
||||
@@ -390,6 +408,10 @@ func fieldListRequiresScopeConversion(fields []string) bool {
|
||||
return fieldListPatchesBackendScopes(fields) || fieldListPatchesAPISourcePermissions(fields)
|
||||
}
|
||||
|
||||
func sidebarFieldsPatched(fields []string) bool {
|
||||
return FieldListIncludes(fields, "sidebarLinks") || fieldListRequiresScopeConversion(fields)
|
||||
}
|
||||
|
||||
// applyScopesFromAPI converts API scopes (with nested permissions) into BackendScopes.
|
||||
// Legacy sourcePermissions map is merged into scopes when permissions are omitted per scope.
|
||||
func applyScopesFromAPI(user *users.User) error {
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
package state
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
)
|
||||
|
||||
func initSidebarLinkTestDB(t *testing.T) {
|
||||
t.Setenv("FILEBROWSER_ONLYOFFICE_SECRET", "")
|
||||
settings.Initialize("../../../_docker/src/noauth/backend/config.yaml")
|
||||
settings.Env.IsPlaywright = true
|
||||
|
||||
dbPath := filepath.Join(t.TempDir(), "filebrowser.sqlite")
|
||||
if _, err := Initialize(dbPath); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = Close() })
|
||||
}
|
||||
|
||||
func countSourceSidebarLinks(links []users.SidebarLink) int {
|
||||
n := 0
|
||||
for _, link := range links {
|
||||
if strings.HasPrefix(link.Category, "source") {
|
||||
n++
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func TestCreateUserAddsSidebarLinksForAllScopes(t *testing.T) {
|
||||
initSidebarLinkTestDB(t)
|
||||
|
||||
u := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "scope-user",
|
||||
FrontendScopes: []users.FrontendScope{
|
||||
{Name: "exclude", Scope: "/"},
|
||||
{Name: "include", Scope: "/"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := CreateUser(u, "password"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
loaded, err := GetUserByUsername("scope-user")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if count := countSourceSidebarLinks(loaded.SidebarLinks); count != 2 {
|
||||
t.Fatalf("source sidebar links = %d, want 2: %#v", count, loaded.SidebarLinks)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateUserScopesAddsMissingSidebarLink(t *testing.T) {
|
||||
initSidebarLinkTestDB(t)
|
||||
|
||||
u := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "patch-user",
|
||||
FrontendScopes: []users.FrontendScope{
|
||||
{Name: "exclude", Scope: "/"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := CreateUser(u, "password"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
patch := &users.User{
|
||||
ID: u.ID,
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "patch-user",
|
||||
FrontendScopes: []users.FrontendScope{
|
||||
{Name: "exclude", Scope: "/"},
|
||||
{Name: "include", Scope: "/"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := UpdateUser(patch, "", "scopes"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
loaded, err := GetUserByUsername("patch-user")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if count := countSourceSidebarLinks(loaded.SidebarLinks); count != 2 {
|
||||
t.Fatalf("source sidebar links = %d, want 2: %#v", count, loaded.SidebarLinks)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateUserScopesKeepsStaleSidebarLinks(t *testing.T) {
|
||||
initSidebarLinkTestDB(t)
|
||||
|
||||
u := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "stale-user",
|
||||
FrontendScopes: []users.FrontendScope{
|
||||
{Name: "exclude", Scope: "/"},
|
||||
{Name: "include", Scope: "/"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := CreateUser(u, "password"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
patch := &users.User{
|
||||
ID: u.ID,
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "stale-user",
|
||||
FrontendScopes: []users.FrontendScope{
|
||||
{Name: "exclude", Scope: "/"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := UpdateUser(patch, "", "scopes"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
loaded, err := GetUserByUsername("stale-user")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if count := countSourceSidebarLinks(loaded.SidebarLinks); count != 2 {
|
||||
t.Fatalf("expected stale include link kept, got %d links: %#v", count, loaded.SidebarLinks)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateUserSidebarLinksPreservesFolderShortcuts(t *testing.T) {
|
||||
initSidebarLinkTestDB(t)
|
||||
|
||||
u := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "folder-user",
|
||||
FrontendScopes: []users.FrontendScope{
|
||||
{Name: "exclude", Scope: "/"},
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := CreateUser(u, "password"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
links := []users.SidebarLink{
|
||||
{Name: "exclude", Category: "source", SourceName: "exclude", Target: "/"},
|
||||
{Name: "Photos", Category: string(users.SidebarLinkSourceMinimal), Icon: "photo", SourceName: "exclude", Target: "/photos"},
|
||||
{Name: "divider", Category: "divider", Target: "#"},
|
||||
}
|
||||
patch := &users.User{
|
||||
ID: u.ID,
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "folder-user",
|
||||
NonAdminEditable: users.NonAdminEditable{
|
||||
SidebarLinks: links,
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := UpdateUser(patch, "", "sidebarLinks"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
loaded, err := GetUserByUsername("folder-user")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(loaded.SidebarLinks) != 3 {
|
||||
t.Fatalf("len(sidebarLinks) = %d, want 3: %#v", len(loaded.SidebarLinks), loaded.SidebarLinks)
|
||||
}
|
||||
if loaded.SidebarLinks[1].Name != "Photos" || loaded.SidebarLinks[1].Icon != "photo" || loaded.SidebarLinks[1].Target != "/photos" {
|
||||
t.Fatalf("folder shortcut not preserved: %#v", loaded.SidebarLinks[1])
|
||||
}
|
||||
if !strings.Contains(loaded.SidebarLinks[0].SourceName, "playwright-files") {
|
||||
t.Fatalf("expected canonical path persisted, got SourceName=%q", loaded.SidebarLinks[0].SourceName)
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,10 @@ import (
|
||||
|
||||
// NormalizeSidebarLinks canonicalizes persisted sidebar links for storage.
|
||||
// Source links are resolved via ResolveSourceKey on SourceName, with Name as fallback.
|
||||
// SourceName is set to the canonical backend path; Name to the configured display name.
|
||||
// Unresolvable source links are dropped. Source links are deduped by canonical path
|
||||
// (first occurrence wins). Non-source links pass through; duplicate Tools links are deduped.
|
||||
// SourceName is set to the canonical backend path; custom Name, Icon, and Category are preserved.
|
||||
// Unresolvable source links are dropped. Source links are deduped by canonical path plus target
|
||||
// (first occurrence wins), so multiple folder shortcuts on one source are kept. Non-source links
|
||||
// pass through; duplicate Tools links are deduped.
|
||||
func NormalizeSidebarLinks(links []users.SidebarLink) ([]users.SidebarLink, bool) {
|
||||
if !users.SourceConfigLoaded() {
|
||||
return links, false
|
||||
@@ -19,7 +20,7 @@ func NormalizeSidebarLinks(links []users.SidebarLink) ([]users.SidebarLink, bool
|
||||
return links, false
|
||||
}
|
||||
|
||||
seenSourcePaths := make(map[string]struct{})
|
||||
seenSourceKeys := make(map[sourceLinkDedupeKey]struct{})
|
||||
hasTools := false
|
||||
out := make([]users.SidebarLink, 0, len(links))
|
||||
changed := false
|
||||
@@ -31,11 +32,6 @@ func NormalizeSidebarLinks(links []users.SidebarLink) ([]users.SidebarLink, bool
|
||||
changed = true
|
||||
continue
|
||||
}
|
||||
if _, dup := seenSourcePaths[source.Path]; dup {
|
||||
changed = true
|
||||
continue
|
||||
}
|
||||
seenSourcePaths[source.Path] = struct{}{}
|
||||
|
||||
normalized := link
|
||||
normalized.Category = users.NormalizeSidebarLinkCategory(normalized.Category)
|
||||
@@ -43,9 +39,15 @@ func NormalizeSidebarLinks(links []users.SidebarLink) ([]users.SidebarLink, bool
|
||||
if strings.TrimSpace(normalized.Name) == "" {
|
||||
normalized.Name = source.Name
|
||||
}
|
||||
if normalized.Target == "" {
|
||||
normalized.Target = "/"
|
||||
normalized.Target = normalizeSidebarTarget(normalized.Target)
|
||||
|
||||
key := sourceLinkDedupeKey{sourcePath: source.Path, target: normalized.Target}
|
||||
if _, dup := seenSourceKeys[key]; dup {
|
||||
changed = true
|
||||
continue
|
||||
}
|
||||
seenSourceKeys[key] = struct{}{}
|
||||
|
||||
if normalized != link {
|
||||
changed = true
|
||||
}
|
||||
@@ -77,3 +79,22 @@ func resolveSourceLink(link users.SidebarLink) (users.SourceInfo, bool) {
|
||||
}
|
||||
return users.SourceInfo{}, false
|
||||
}
|
||||
|
||||
func normalizeSidebarTarget(target string) string {
|
||||
t := strings.TrimSpace(target)
|
||||
if t == "" || t == "#" {
|
||||
return "/"
|
||||
}
|
||||
if !strings.HasPrefix(t, "/") {
|
||||
t = "/" + t
|
||||
}
|
||||
if t != "/" && strings.HasSuffix(t, "/") {
|
||||
t = strings.TrimSuffix(t, "/")
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
type sourceLinkDedupeKey struct {
|
||||
sourcePath string
|
||||
target string
|
||||
}
|
||||
@@ -164,6 +164,88 @@ func TestNormalizeSidebarLinks_dedupesToolsLink(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeSidebarLinks_preservesMultipleFolderShortcutsOnSameSource(t *testing.T) {
|
||||
testSourceConfig(t)
|
||||
|
||||
in := []users.SidebarLink{
|
||||
{Name: "docker", Category: "source", SourceName: ".", Target: "/"},
|
||||
{Name: "Photos", Category: string(users.SidebarLinkSourceMinimal), Icon: "photo", SourceName: ".", Target: "/photos"},
|
||||
{Name: "Docs", Category: string(users.SidebarLinkSourceAlt), Icon: "folder", SourceName: ".", Target: "/docs"},
|
||||
{Name: "divider", Category: "divider", Target: "#"},
|
||||
}
|
||||
|
||||
out, changed := NormalizeSidebarLinks(in)
|
||||
if changed {
|
||||
t.Fatal("expected canonical folder shortcuts unchanged")
|
||||
}
|
||||
if len(out) != 4 {
|
||||
t.Fatalf("len(out) = %d, want 4", len(out))
|
||||
}
|
||||
if out[1].Name != "Photos" || out[1].Icon != "photo" || out[1].Target != "/photos" {
|
||||
t.Fatalf("photos link = %#v", out[1])
|
||||
}
|
||||
if out[2].Category != string(users.SidebarLinkSourceAlt) {
|
||||
t.Fatalf("docs category = %q", out[2].Category)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeSidebarLinks_dedupesSameSourceAndTarget(t *testing.T) {
|
||||
testSourceConfig(t)
|
||||
|
||||
in := []users.SidebarLink{
|
||||
{Name: "docker", Category: "source", SourceName: ".", Target: "/"},
|
||||
{Name: "docker root", Category: "source-minimal", Icon: "home", SourceName: "docker", Target: "/"},
|
||||
}
|
||||
|
||||
out, changed := NormalizeSidebarLinks(in)
|
||||
if !changed {
|
||||
t.Fatal("expected changed=true")
|
||||
}
|
||||
if len(out) != 1 {
|
||||
t.Fatalf("len(out) = %d, want 1", len(out))
|
||||
}
|
||||
if out[0].Name != "docker" {
|
||||
t.Fatalf("first link wins: %#v", out[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeSidebarLinks_noCollisionOnPipeInPathOrTarget(t *testing.T) {
|
||||
had := users.SourceConfigLoaded()
|
||||
t.Cleanup(func() {
|
||||
if !had {
|
||||
users.SetSourceConfig(nil)
|
||||
}
|
||||
})
|
||||
users.SetSourceConfig(&users.SourceConfigProvider{
|
||||
GetSourceByPath: func(path string) (users.SourceInfo, bool) {
|
||||
switch path {
|
||||
case "a":
|
||||
return users.SourceInfo{Path: "a", Name: "src-a"}, true
|
||||
case "a|/b":
|
||||
return users.SourceInfo{Path: "a|/b", Name: "src-pipe"}, true
|
||||
default:
|
||||
return users.SourceInfo{}, false
|
||||
}
|
||||
},
|
||||
GetSourceByName: func(name string) (users.SourceInfo, bool) {
|
||||
return users.SourceInfo{}, false
|
||||
},
|
||||
})
|
||||
|
||||
in := []users.SidebarLink{
|
||||
{Name: "one", Category: "source", SourceName: "a", Target: "/b|/c"},
|
||||
{Name: "two", Category: "source", SourceName: "a|/b", Target: "/c"},
|
||||
}
|
||||
|
||||
out, changed := NormalizeSidebarLinks(in)
|
||||
if changed {
|
||||
t.Fatal("expected changed=false for distinct path/target pairs")
|
||||
}
|
||||
if len(out) != 2 {
|
||||
t.Fatalf("len(out) = %d, want 2 (no false dedupe)", len(out))
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeSidebarLinks_noConfigLoaded(t *testing.T) {
|
||||
had := users.SourceConfigLoaded()
|
||||
t.Cleanup(func() {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package usersidebar
|
||||
|
||||
import (
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
)
|
||||
|
||||
// PrepareSidebarLinksForPersist normalizes sidebar links and adds missing scoped source entries.
|
||||
// Inaccessible sources are not pruned; callers rely on the UI to gray out stale links.
|
||||
func PrepareSidebarLinksForPersist(links []users.SidebarLink, scopes []users.BackendScope) ([]users.SidebarLink, bool) {
|
||||
updated := false
|
||||
|
||||
if normalized, changed := NormalizeSidebarLinks(links); changed {
|
||||
links = normalized
|
||||
updated = true
|
||||
}
|
||||
|
||||
merged, changed := EnsureSidebarLinksFromScopes(links, scopes)
|
||||
if changed {
|
||||
links = merged
|
||||
updated = true
|
||||
if normalized, changed := NormalizeSidebarLinks(links); changed {
|
||||
links = normalized
|
||||
updated = true
|
||||
}
|
||||
}
|
||||
|
||||
return links, updated
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package usersidebar
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
)
|
||||
|
||||
func TestPrepareSidebarLinksForPersist_addsScopedSourcesAndPreservesFolders(t *testing.T) {
|
||||
testSourceConfig(t)
|
||||
|
||||
links := []users.SidebarLink{
|
||||
{Name: "docker", Category: "source", SourceName: ".", Target: "/"},
|
||||
{Name: "Photos", Category: string(users.SidebarLinkSourceMinimal), Icon: "photo", SourceName: ".", Target: "/photos"},
|
||||
}
|
||||
scopes := []users.BackendScope{
|
||||
{Path: "."},
|
||||
{Path: "../frontend/tests/playwright-files"},
|
||||
}
|
||||
|
||||
out, changed := PrepareSidebarLinksForPersist(links, scopes)
|
||||
if !changed {
|
||||
t.Fatal("expected changed=true")
|
||||
}
|
||||
if len(out) != 3 {
|
||||
t.Fatalf("len(out) = %d, want 3", len(out))
|
||||
}
|
||||
if out[1].Name != "Photos" || out[1].Icon != "photo" {
|
||||
t.Fatalf("folder shortcut lost: %#v", out[1])
|
||||
}
|
||||
if out[2].Name != "playwright + files" {
|
||||
t.Fatalf("added scope link = %#v", out[2])
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrepareSidebarLinksForPersist_keepsLinksWhenScopeRemoved(t *testing.T) {
|
||||
testSourceConfig(t)
|
||||
|
||||
links := []users.SidebarLink{
|
||||
{Name: "docker", Category: "source", SourceName: ".", Target: "/"},
|
||||
{Name: "Photos", Category: string(users.SidebarLinkSourceMinimal), Icon: "photo", SourceName: ".", Target: "/photos"},
|
||||
{Name: "playwright + files", Category: "source", SourceName: "../frontend/tests/playwright-files", Target: "/"},
|
||||
}
|
||||
scopes := []users.BackendScope{
|
||||
{Path: "."},
|
||||
}
|
||||
|
||||
out, changed := PrepareSidebarLinksForPersist(links, scopes)
|
||||
if changed {
|
||||
t.Fatal("expected changed=false when only pruning is not performed")
|
||||
}
|
||||
if len(out) != 3 {
|
||||
t.Fatalf("len(out) = %d, want 3 (stale scope link kept)", len(out))
|
||||
}
|
||||
}
|
||||
@@ -89,3 +89,22 @@ func CSPNonce() (string, error) {
|
||||
}
|
||||
return base64.StdEncoding.EncodeToString(b), nil
|
||||
}
|
||||
|
||||
// CSPNonceFromData returns an existing cspNonce from map template data, or generates
|
||||
// and stores one when data is a map[string]interface{}. For other data types it
|
||||
// generates a fresh nonce without modifying data.
|
||||
func CSPNonceFromData(data interface{}) (string, error) {
|
||||
m, ok := data.(map[string]interface{})
|
||||
if !ok {
|
||||
return CSPNonce()
|
||||
}
|
||||
if nonce, ok := m["cspNonce"].(string); ok && nonce != "" {
|
||||
return nonce, nil
|
||||
}
|
||||
nonce, err := CSPNonce()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("csp nonce: %w", err)
|
||||
}
|
||||
m["cspNonce"] = nonce
|
||||
return nonce, nil
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"unicode/utf8"
|
||||
)
|
||||
@@ -27,7 +28,13 @@ func IsTextFile(realPath string) (bool, error) {
|
||||
if len(content) > sampleSize {
|
||||
sample = content[:sampleSize]
|
||||
}
|
||||
// Check 1: Count null bytes - binary files typically have many nulls
|
||||
// Check 1: Reject PDFs. A PDF with a long ASCII text layer looks like text
|
||||
// for far more than sampleSize bytes.
|
||||
if http.DetectContentType(sample) == "application/pdf" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// Check 2: Count null bytes - binary files typically have many nulls
|
||||
nullCount := 0
|
||||
for _, b := range sample {
|
||||
if b == 0x00 {
|
||||
@@ -42,7 +49,7 @@ func IsTextFile(realPath string) (bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check 2: Validate UTF-8 encoding
|
||||
// Check 3: Validate UTF-8 encoding
|
||||
// Trim sample to last complete UTF-8 rune to avoid false negatives
|
||||
trimmedSample := sample
|
||||
for len(trimmedSample) > 0 {
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsTextFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
asciiPageStream := strings.Repeat("BT /Ft0 1 Tf <00430044004500460047> Tj ET\n", 300)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
content []byte
|
||||
want bool
|
||||
}{
|
||||
{name: "empty", content: nil, want: true},
|
||||
{name: "plain text", content: []byte("hello\nworld\n"), want: true},
|
||||
{name: "utf-8 text", content: []byte("café ☕\n"), want: true},
|
||||
{name: "svg", content: []byte(`<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg"></svg>`), want: true},
|
||||
{name: "binary with null bytes", content: append([]byte("GIF89a"), make([]byte, 64)...), want: false},
|
||||
{
|
||||
name: "pdf with an ascii text layer larger than the sample",
|
||||
content: append([]byte("%PDF-1.3\n"+asciiPageStream), 0xFF, 0xD8, 0xFF, 0xE0),
|
||||
want: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "sample")
|
||||
if err := os.WriteFile(path, tt.content, 0o600); err != nil {
|
||||
t.Fatalf("writing sample: %v", err)
|
||||
}
|
||||
|
||||
got, err := IsTextFile(path)
|
||||
if err != nil {
|
||||
t.Fatalf("IsTextFile: %v", err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Fatalf("IsTextFile(%s) = %v, want %v", tt.name, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -146,6 +146,7 @@ func getOrCreateAuthenticatedUser(username string, loginMethod users.LoginMethod
|
||||
}
|
||||
// Verify login method matches
|
||||
if userValue.LoginMethod != loginMethod {
|
||||
logger.Debugf("login rejected: user %q attempted %s login but account loginMethod is %q", username, loginMethod, userValue.LoginMethod)
|
||||
return nil, errors.ErrWrongLoginMethod
|
||||
}
|
||||
// Sync IdP groups into access-control GroupMap (write-through). Skip when the
|
||||
@@ -233,17 +234,7 @@ func logoutHandler(w http.ResponseWriter, r *http.Request, d *Context) (int, err
|
||||
}
|
||||
|
||||
// Clear the authentication cookie by setting it to expire in the past
|
||||
host := sessionCookieDomain(r)
|
||||
cookie := &http.Cookie{
|
||||
Name: "filebrowser_quantum_jwt",
|
||||
Value: "",
|
||||
Domain: host,
|
||||
Path: "/",
|
||||
SameSite: http.SameSiteStrictMode,
|
||||
Expires: time.Unix(0, 0), // Expire immediately
|
||||
MaxAge: -1, // Delete cookie
|
||||
}
|
||||
http.SetCookie(w, cookie)
|
||||
http.SetCookie(w, sessionCookie(r, "", time.Unix(0, 0), -1, http.SameSiteStrictMode))
|
||||
|
||||
logoutUrl := fmt.Sprintf("%vlogin", settings.Config.Http.BaseURL) // Default fallback
|
||||
if d.User != nil && d.User.LoginMethod == users.LoginMethodProxy {
|
||||
@@ -427,17 +418,27 @@ func AuthenticateShareRequest(r *http.Request, l share.Share) (int, error) {
|
||||
return 200, nil
|
||||
}
|
||||
|
||||
// SetSessionCookie sets the authentication token as an HTTP cookie.
|
||||
func SetSessionCookie(w http.ResponseWriter, r *http.Request, token string, expiresTime time.Time) {
|
||||
cookie := &http.Cookie{
|
||||
Name: "filebrowser_quantum_jwt",
|
||||
const sessionCookieName = "filebrowser_quantum_jwt"
|
||||
|
||||
// sessionCookie builds the JWT cookie. HttpOnly prevents srcdoc XSS from reading
|
||||
// document.cookie; Secure is set when the request is HTTPS (including via proxy).
|
||||
func sessionCookie(r *http.Request, token string, expiresTime time.Time, maxAge int, sameSite http.SameSite) *http.Cookie {
|
||||
return &http.Cookie{
|
||||
Name: sessionCookieName,
|
||||
Value: token,
|
||||
Domain: sessionCookieDomain(r),
|
||||
Path: "/",
|
||||
SameSite: http.SameSiteStrictMode, // strict mode prevents cookie from being sent to other domains
|
||||
SameSite: sameSite,
|
||||
HttpOnly: true,
|
||||
Secure: requestScheme(r) == "https",
|
||||
Expires: expiresTime,
|
||||
MaxAge: maxAge,
|
||||
}
|
||||
http.SetCookie(w, cookie)
|
||||
}
|
||||
|
||||
// SetSessionCookie sets the authentication token as an HTTP cookie.
|
||||
func SetSessionCookie(w http.ResponseWriter, r *http.Request, token string, expiresTime time.Time) {
|
||||
http.SetCookie(w, sessionCookie(r, token, expiresTime, 0, http.SameSiteStrictMode))
|
||||
}
|
||||
|
||||
// applyNamedApiTokenGlobalCaps intersects owner globals with JWT global caps for named custom API tokens.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
libError "errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/errors"
|
||||
)
|
||||
|
||||
// loginMethodHTTPStatus maps a login error to an HTTP status and client-safe message.
|
||||
func loginMethodHTTPStatus(err error) (int, error) {
|
||||
if libError.Is(err, errors.ErrWrongLoginMethod) {
|
||||
return http.StatusUnauthorized, errors.ErrInvalidLoginMethod
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/app"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/auth"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/state"
|
||||
fberrors "github.com/gtsteffaniak/filebrowser/backend/internal/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
)
|
||||
|
||||
func TestGetOrCreateAuthenticatedUserRejectsLoginMethodMismatch(t *testing.T) {
|
||||
setupTestEnv(t)
|
||||
|
||||
passwordUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodPassword,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(passwordUser, "secret"); err != nil {
|
||||
t.Fatalf("CreateUser: %v", err)
|
||||
}
|
||||
|
||||
_, err := getOrCreateAuthenticatedUser("graham", users.LoginMethodOidc, false, nil)
|
||||
if !errors.Is(err, fberrors.ErrWrongLoginMethod) {
|
||||
t.Fatalf("getOrCreateAuthenticatedUser() err = %v, want ErrWrongLoginMethod", err)
|
||||
}
|
||||
|
||||
loaded, err := state.GetUserByUsername("graham")
|
||||
if err != nil {
|
||||
t.Fatalf("GetUserByUsername: %v", err)
|
||||
}
|
||||
if loaded.LoginMethod != users.LoginMethodPassword {
|
||||
t.Fatalf("loginMethod changed to %q, want password", loaded.LoginMethod)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetOrCreateAuthenticatedUserRejectsPasswordUserForOIDCAccount(t *testing.T) {
|
||||
setupTestEnv(t)
|
||||
|
||||
oidcUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodOidc,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(oidcUser, ""); err != nil {
|
||||
t.Fatalf("CreateUser: %v", err)
|
||||
}
|
||||
|
||||
_, err := getOrCreateAuthenticatedUser("graham", users.LoginMethodOidc, false, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("getOrCreateAuthenticatedUser() for matching oidc user: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthenticatePasswordRejectsWrongLoginMethod(t *testing.T) {
|
||||
setupTestEnv(t)
|
||||
|
||||
oidcUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodOidc,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(oidcUser, "secret"); err != nil {
|
||||
t.Fatalf("CreateUser: %v", err)
|
||||
}
|
||||
|
||||
req := httptest.NewRequest(http.MethodPost, "/api/auth/login?username=graham", nil)
|
||||
req.Header.Set("X-Password", url.QueryEscape("secret"))
|
||||
|
||||
_, err := auth.AuthenticatePassword(req, true)
|
||||
if !errors.Is(err, fberrors.ErrWrongLoginMethod) {
|
||||
t.Fatalf("AuthenticatePassword() err = %v, want ErrWrongLoginMethod", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoginHelperReturnsInvalidLoginMethodForPasswordMismatch(t *testing.T) {
|
||||
setupTestEnv(t)
|
||||
app.MustWireServices(state.Default())
|
||||
|
||||
oidcUser := &users.User{
|
||||
FrontendUser: users.FrontendUser{
|
||||
Username: "graham",
|
||||
LoginMethod: users.LoginMethodOidc,
|
||||
},
|
||||
}
|
||||
if err := state.CreateUser(oidcUser, "secret"); err != nil {
|
||||
t.Fatalf("CreateUser: %v", err)
|
||||
}
|
||||
|
||||
origPassword := settings.Config.Auth.Methods.PasswordAuth.Enabled
|
||||
settings.Config.Auth.Methods.PasswordAuth.Enabled = true
|
||||
t.Cleanup(func() {
|
||||
settings.Config.Auth.Methods.PasswordAuth.Enabled = origPassword
|
||||
})
|
||||
|
||||
handler := LoginHelper(true, func(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
return http.StatusOK, nil
|
||||
})
|
||||
|
||||
req := httptest.NewRequest(http.MethodPost, "/api/auth/login?username=graham", nil)
|
||||
req.Header.Set("X-Password", url.QueryEscape("secret"))
|
||||
rec := httptest.NewRecorder()
|
||||
|
||||
status, err := handler(rec, req, &requestContext{})
|
||||
if status != http.StatusUnauthorized {
|
||||
t.Fatalf("status = %d, want 401", status)
|
||||
}
|
||||
if !errors.Is(err, fberrors.ErrInvalidLoginMethod) {
|
||||
t.Fatalf("err = %v, want ErrInvalidLoginMethod", err)
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
libErrors "github.com/gtsteffaniak/filebrowser/backend/internal/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/share"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/preview"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/indexing/iteminfo"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
"github.com/gtsteffaniak/go-cache/cache"
|
||||
@@ -139,6 +140,8 @@ func ErrToStatus(err error) int {
|
||||
return http.StatusBadRequest
|
||||
case errors.Is(err, libErrors.ErrIsDirectory):
|
||||
return http.StatusMethodNotAllowed
|
||||
case errors.Is(err, preview.ErrUnsupportedFormat):
|
||||
return http.StatusUnsupportedMediaType
|
||||
default:
|
||||
return http.StatusInternalServerError
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/preview"
|
||||
)
|
||||
|
||||
func TestErrToStatusUnsupportedPreviewFormat(t *testing.T) {
|
||||
status := ErrToStatus(preview.ErrUnsupportedFormat)
|
||||
if status != http.StatusUnsupportedMediaType {
|
||||
t.Fatalf("ErrToStatus() = %d, want %d", status, http.StatusUnsupportedMediaType)
|
||||
}
|
||||
}
|
||||
|
||||
func TestErrToStatusWrapsUnsupportedPreviewFormat(t *testing.T) {
|
||||
err := errors.Join(errors.New("preview failed"), preview.ErrUnsupportedFormat)
|
||||
status := ErrToStatus(err)
|
||||
if status != http.StatusUnsupportedMediaType {
|
||||
t.Fatalf("ErrToStatus() = %d, want %d", status, http.StatusUnsupportedMediaType)
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func authenticateLDAP(username, password string) ([]string, map[string]string, e
|
||||
logger.Debugf("ldap: no service account bind (userPassword empty)")
|
||||
}
|
||||
|
||||
groupAttr := settings.ResolveGroupsClaim(c.GroupsClaim)
|
||||
groupAttr := settings.ResolveLdapGroupsClaim(c.GroupsClaim)
|
||||
attributes := []string{"dn", groupAttr}
|
||||
if c.UserIdentifier != "" {
|
||||
attributes = append(attributes, c.UserIdentifier)
|
||||
|
||||
@@ -387,6 +387,9 @@ func LoginHelper(disableOtp bool, fn handleFunc) handleFunc {
|
||||
if err == errors.ErrNoTotpProvided {
|
||||
return 403, err
|
||||
}
|
||||
if status, mapped := loginMethodHTTPStatus(err); status != 0 {
|
||||
return status, mapped
|
||||
}
|
||||
return 401, errors.ErrUnauthorized
|
||||
}
|
||||
d.User = user
|
||||
@@ -504,6 +507,9 @@ func getJwtUser(w http.ResponseWriter, r *http.Request, data *requestContext, fn
|
||||
// Setup user based on JWT claims
|
||||
user, err := SetupJwtUser(r, data, username, claims)
|
||||
if err != nil {
|
||||
if status, mapped := loginMethodHTTPStatus(err); status != 0 {
|
||||
return status, mapped
|
||||
}
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
data.User = user
|
||||
@@ -535,6 +541,9 @@ func getProxyUser(w http.ResponseWriter, r *http.Request, data *requestContext,
|
||||
// proxy user logic
|
||||
user, err := SetupProxyUser(r, data, proxyUser)
|
||||
if err != nil {
|
||||
if status, mapped := loginMethodHTTPStatus(err); status != 0 {
|
||||
return status, mapped
|
||||
}
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
data.User = user
|
||||
|
||||
@@ -239,9 +239,10 @@ func oidcCallbackHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
rawIDToken, ok := token.Extra("id_token").(string)
|
||||
// accessToken := token.AccessToken // Access token is needed for UserInfo, already in 'token'
|
||||
|
||||
var userdata userInfo // Declare userdata here to be populated by either source
|
||||
claimsFromIDToken := false // Flag to track if we successfully got claims from ID token
|
||||
loginUsername := "" // Variable to hold the login username
|
||||
var userdata userInfo // Declare userdata here to be populated by either source
|
||||
var idTokenClaims map[string]any // Verified ID-token claims preserved across UserInfo fallback
|
||||
claimsFromIDToken := false // Flag to track if we successfully got claims from ID token
|
||||
loginUsername := "" // Variable to hold the login username
|
||||
|
||||
// Create custom unmarshaller for userInfo
|
||||
userInfoUnmarshaller := &userInfoUnmarshaller{
|
||||
@@ -267,6 +268,9 @@ func oidcCallbackHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
} else {
|
||||
// Successfully verified and decoded ID token claims
|
||||
logger.Debugf("ID Token verified and claims decoded: %+v", userdata)
|
||||
if len(userdata.Claims) > 0 {
|
||||
idTokenClaims = maps.Clone(userdata.Claims)
|
||||
}
|
||||
|
||||
// Decide if we rely on ID token claims or still need UserInfo
|
||||
// Even if parsing succeeded, if essential claims are missing, use UserInfo
|
||||
@@ -301,6 +305,9 @@ func oidcCallbackHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
logger.Errorf("failed to decode user info from endpoint: %v", err)
|
||||
return http.StatusInternalServerError, fmt.Errorf("failed to decode user info from endpoint: %v", err)
|
||||
}
|
||||
if len(idTokenClaims) > 0 {
|
||||
mergeMissingOidcClaims(&userdata, idTokenClaims)
|
||||
}
|
||||
}
|
||||
|
||||
// --- Determine login username dynamically ---
|
||||
@@ -319,6 +326,18 @@ func oidcCallbackHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
return loginWithOidcUser(w, r, loginUsername, userdata.Groups)
|
||||
}
|
||||
|
||||
// mergeMissingOidcClaims copies claims from from into userdata when absent after UserInfo fallback.
|
||||
func mergeMissingOidcClaims(userdata *userInfo, from map[string]any) {
|
||||
if userdata.Claims == nil {
|
||||
userdata.Claims = make(map[string]any)
|
||||
}
|
||||
for k, v := range from {
|
||||
if _, exists := userdata.Claims[k]; !exists {
|
||||
userdata.Claims[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loginWithOidcUser extracts the username from the user claims (userInfo)
|
||||
// based on the configured UserIdentifier and logs the user into the application.
|
||||
// It creates a new user if one doesn't exist.
|
||||
@@ -357,6 +376,9 @@ func loginWithOidcUser(w http.ResponseWriter, r *http.Request, username string,
|
||||
|
||||
user, err := getOrCreateAuthenticatedUser(username, users.LoginMethodOidc, isAdmin, groups)
|
||||
if err != nil {
|
||||
if status, mapped := loginMethodHTTPStatus(err); status != 0 {
|
||||
return status, mapped
|
||||
}
|
||||
return http.StatusUnauthorized, err
|
||||
}
|
||||
|
||||
@@ -375,19 +397,8 @@ func loginWithOidcUser(w http.ResponseWriter, r *http.Request, username string,
|
||||
// This allows backend to identify expired sessions and provide better user feedback
|
||||
expiresTime := time.Now().Add(expires).Add(time.Minute * 30)
|
||||
|
||||
// Set the authentication token as an HTTP cookie
|
||||
host := requestHost(r)
|
||||
cookie := &http.Cookie{
|
||||
Name: "filebrowser_quantum_jwt",
|
||||
Value: tokenString,
|
||||
Domain: strings.Split(host, ":")[0], // Set domain to the host without port
|
||||
Path: "/",
|
||||
SameSite: http.SameSiteLaxMode, // Lax mode allows cookie on navigation from OIDC provider
|
||||
Expires: expiresTime,
|
||||
// HttpOnly: true, // Cannot use HttpOnly since frontend needs to read cookie for renew operations
|
||||
// Secure: true, // Enable this in production with HTTPS
|
||||
}
|
||||
http.SetCookie(w, cookie)
|
||||
// Set the authentication token as an HTTP cookie (Lax for OIDC redirect return).
|
||||
http.SetCookie(w, sessionCookie(r, tokenString, expiresTime, 0, http.SameSiteLaxMode))
|
||||
|
||||
// Set the authenticated user in the request context or response writer
|
||||
// This allows subsequent handlers to access the current user.
|
||||
|
||||
@@ -206,6 +206,42 @@ func TestUserInfoUnmarshaller_InvalidJSON(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeMissingOidcClaims_PreservesIDTokenIdentifier(t *testing.T) {
|
||||
userdata := userInfo{
|
||||
Claims: map[string]any{"groups": []any{"admins"}},
|
||||
Groups: []string{"admins"},
|
||||
}
|
||||
idTokenClaims := map[string]any{
|
||||
"preferred_username": "alice",
|
||||
"sub": "user-123",
|
||||
}
|
||||
|
||||
mergeMissingOidcClaims(&userdata, idTokenClaims)
|
||||
|
||||
if userdata.Claims["preferred_username"] != "alice" {
|
||||
t.Fatalf("preferred_username = %v, want alice", userdata.Claims["preferred_username"])
|
||||
}
|
||||
if userdata.Claims["sub"] != "user-123" {
|
||||
t.Fatalf("sub = %v, want user-123", userdata.Claims["sub"])
|
||||
}
|
||||
if _, ok := userdata.Claims["groups"]; !ok {
|
||||
t.Fatal("UserInfo groups claim should be preserved")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeMissingOidcClaims_UserInfoWinsOnConflict(t *testing.T) {
|
||||
userdata := userInfo{
|
||||
Claims: map[string]any{"email": "from-userinfo@example.com"},
|
||||
}
|
||||
idTokenClaims := map[string]any{"email": "from-idtoken@example.com"}
|
||||
|
||||
mergeMissingOidcClaims(&userdata, idTokenClaims)
|
||||
|
||||
if userdata.Claims["email"] != "from-userinfo@example.com" {
|
||||
t.Fatalf("email = %v, want UserInfo value preserved", userdata.Claims["email"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestOidcRedirectURLTrustProxyHeaders(t *testing.T) {
|
||||
settings.Config.Http.BaseURL = "/"
|
||||
settings.Config.Http.TrustProxyHeaders = true
|
||||
|
||||
@@ -803,6 +803,7 @@ func ResourcePostHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
if acquireErr := activeUploadSessions.acquire(realPath, sessionID); acquireErr != nil {
|
||||
if isUploadSessionConflict(acquireErr) {
|
||||
logger.Debugf("%v", acquireErr)
|
||||
drainRequestBody(r)
|
||||
return http.StatusConflict, acquireErr
|
||||
}
|
||||
logger.Debugf("%v", acquireErr)
|
||||
@@ -819,6 +820,7 @@ func ResourcePostHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
// If type mismatch (existing dir vs requesting file) and not overriding
|
||||
if existingIsDir != requestingDir && r.URL.Query().Get("override") != "true" {
|
||||
logger.Debugf("Type conflict detected in chunked: existing is dir=%v, requesting dir=%v at path=%v", existingIsDir, requestingDir, realPath)
|
||||
drainRequestBody(r)
|
||||
return http.StatusConflict, nil
|
||||
}
|
||||
}
|
||||
@@ -828,6 +830,7 @@ func ResourcePostHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
if err == nil { // File exists
|
||||
if r.URL.Query().Get("override") != "true" {
|
||||
logger.Debugf("resource already exists: %v", fileInfo.RealPath)
|
||||
drainRequestBody(r)
|
||||
return http.StatusConflict, nil
|
||||
}
|
||||
// If overriding, delete existing thumbnails
|
||||
@@ -935,6 +938,9 @@ func ResourcePostHandler(w http.ResponseWriter, r *http.Request, d *Context) (in
|
||||
activity.RecordUpload(r, toActor(d), source, path, false)
|
||||
activeUploadSessions.release(realPath, sessionID)
|
||||
}
|
||||
if err = writeChunkUploadResponse(w, assembled, totalSize, assembled == totalSize); err != nil {
|
||||
logger.Debugf("could not write chunk upload response: %v", err)
|
||||
}
|
||||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/adapters/fs/files"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/utils"
|
||||
)
|
||||
|
||||
func TestCheckPermissionsMissingParamsStatus(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
opts utils.FileOptions
|
||||
}{
|
||||
{name: "missing path", opts: utils.FileOptions{Source: "default"}},
|
||||
{name: "missing source", opts: utils.FileOptions{Path: "/"}},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, _, err := files.CheckPermissions(tt.opts, &users.User{})
|
||||
if err == nil {
|
||||
t.Fatal("expected an error")
|
||||
}
|
||||
if status := ErrToStatus(err); status != http.StatusBadRequest {
|
||||
t.Fatalf("status=%d err=%v, want %d", status, err, http.StatusBadRequest)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -560,3 +561,51 @@ func TestResourcePostHandler_ExpiredSessionAllowsNewUpload(t *testing.T) {
|
||||
t.Fatalf("got %q want %q", got, body)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourcePostHandler_PartialChunkResponse(t *testing.T) {
|
||||
_, user := setupUploadHTTPTest(t)
|
||||
part1 := []byte("aaaa")
|
||||
total := 8
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
req := httptest.NewRequest(http.MethodPost, "/api/resources?source=uploads&path=/partial.bin", bytes.NewReader(part1))
|
||||
req.ContentLength = int64(len(part1))
|
||||
req.Header.Set("X-File-Upload-Session", "session-partial")
|
||||
req.Header.Set("X-File-Chunk-Offset", "0")
|
||||
req.Header.Set("X-File-Total-Size", strconv.Itoa(total))
|
||||
|
||||
status, err := ResourcePostHandler(rec, req, &requestContext{User: user})
|
||||
if status != http.StatusOK || err != nil {
|
||||
t.Fatalf("chunk1 status=%d err=%v", status, err)
|
||||
}
|
||||
if rec.Header().Get("Connection") != "close" {
|
||||
t.Fatalf("expected Connection: close, got %q", rec.Header().Get("Connection"))
|
||||
}
|
||||
var payload chunkUploadResponse
|
||||
if decodeErr := json.NewDecoder(rec.Body).Decode(&payload); decodeErr != nil {
|
||||
t.Fatalf("decode response: %v", decodeErr)
|
||||
}
|
||||
if payload.Complete || payload.Offset != int64(len(part1)) || payload.Total != int64(total) {
|
||||
t.Fatalf("unexpected payload: %+v", payload)
|
||||
}
|
||||
|
||||
part2 := []byte("bbbb")
|
||||
rec2 := httptest.NewRecorder()
|
||||
req2 := httptest.NewRequest(http.MethodPost, "/api/resources?source=uploads&path=/partial.bin", bytes.NewReader(part2))
|
||||
req2.ContentLength = int64(len(part2))
|
||||
req2.Header.Set("X-File-Upload-Session", "session-partial")
|
||||
req2.Header.Set("X-File-Chunk-Offset", strconv.Itoa(len(part1)))
|
||||
req2.Header.Set("X-File-Total-Size", strconv.Itoa(total))
|
||||
|
||||
status, err = ResourcePostHandler(rec2, req2, &requestContext{User: user})
|
||||
if status != http.StatusOK || err != nil {
|
||||
t.Fatalf("chunk2 status=%d err=%v", status, err)
|
||||
}
|
||||
var finalPayload chunkUploadResponse
|
||||
if decodeErr := json.NewDecoder(rec2.Body).Decode(&finalPayload); decodeErr != nil {
|
||||
t.Fatalf("decode final response: %v", decodeErr)
|
||||
}
|
||||
if !finalPayload.Complete || finalPayload.Offset != int64(total) {
|
||||
t.Fatalf("unexpected final payload: %+v", finalPayload)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
)
|
||||
|
||||
func TestSessionCookie_HttpOnlyAndSecureOnHTTPS(t *testing.T) {
|
||||
prev := settings.Config.Http.TrustProxyHeaders
|
||||
settings.Config.Http.TrustProxyHeaders = true
|
||||
t.Cleanup(func() { settings.Config.Http.TrustProxyHeaders = prev })
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "https://example.com/", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
req.Header.Set("X-Forwarded-Proto", "https")
|
||||
req.Host = "example.com"
|
||||
|
||||
c := sessionCookie(req, "token", time.Now().Add(time.Hour), 0, http.SameSiteStrictMode)
|
||||
if !c.HttpOnly {
|
||||
t.Fatal("expected HttpOnly session cookie")
|
||||
}
|
||||
if !c.Secure {
|
||||
t.Fatal("expected Secure session cookie over HTTPS")
|
||||
}
|
||||
if c.Name != sessionCookieName {
|
||||
t.Fatalf("cookie name: got %q", c.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSessionCookie_NotSecureOnHTTP(t *testing.T) {
|
||||
req, err := http.NewRequest(http.MethodGet, "http://localhost/", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
req.Host = "localhost"
|
||||
|
||||
c := sessionCookie(req, "token", time.Now().Add(time.Hour), 0, http.SameSiteStrictMode)
|
||||
if !c.HttpOnly {
|
||||
t.Fatal("expected HttpOnly session cookie")
|
||||
}
|
||||
if c.Secure {
|
||||
t.Fatal("did not expect Secure cookie on plain HTTP")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSpaContentSecurityPolicy_BlocksUntrustedScripts(t *testing.T) {
|
||||
csp := spaContentSecurityPolicy("testnonce")
|
||||
if csp != "script-src 'self' 'nonce-testnonce' https://cdn.jsdelivr.net https://www.google.com https://www.gstatic.com" {
|
||||
t.Fatalf("unexpected CSP: %s", csp)
|
||||
}
|
||||
if strings.Contains(csp, "'unsafe-inline'") {
|
||||
t.Fatal("script-src must not allow unsafe-inline (srcdoc XSS)")
|
||||
}
|
||||
if strings.Contains(csp, "default-src") {
|
||||
t.Fatal("CSP should only restrict script-src to avoid breaking frames, blobs, and external assets")
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/fs"
|
||||
@@ -42,7 +43,13 @@ func (t *TemplateRenderer) Render(w http.ResponseWriter, name string, data inter
|
||||
return fmt.Errorf("error reloading template: %w", err)
|
||||
}
|
||||
}
|
||||
// Set headers
|
||||
nonce, err := utils.CSPNonceFromData(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Inherited by srcdoc preview frames: nonce'd SPA scripts run; untrusted preview scripts do not.
|
||||
w.Header().Set("Content-Security-Policy", spaContentSecurityPolicy(nonce))
|
||||
w.Header().Set("Cache-Control", "no-cache, private, max-age=0")
|
||||
w.Header().Set("Pragma", "no-cache")
|
||||
w.Header().Set("X-Accel-Expires", "0")
|
||||
@@ -51,6 +58,15 @@ func (t *TemplateRenderer) Render(w http.ResponseWriter, name string, data inter
|
||||
return templates.ExecuteTemplate(w, name, data)
|
||||
}
|
||||
|
||||
// spaContentSecurityPolicy restricts only scripts. srcdoc preview frames inherit
|
||||
// this header, blocking inline scripts without limiting frames, images, or API calls.
|
||||
func spaContentSecurityPolicy(nonce string) string {
|
||||
return fmt.Sprintf(
|
||||
"script-src 'self' 'nonce-%s' https://cdn.jsdelivr.net https://www.google.com https://www.gstatic.com",
|
||||
nonce,
|
||||
)
|
||||
}
|
||||
|
||||
func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestContext, file, contentType string) (int, error) {
|
||||
w.Header().Set("Content-Type", contentType)
|
||||
userSelectedTheme := ""
|
||||
@@ -80,7 +96,7 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
|
||||
externalLinks = newExternalLinks
|
||||
}
|
||||
|
||||
defaultThemeColor := "#455a64"
|
||||
defaultThemeColor := settings.DefaultBackgroundColor()
|
||||
staticURL := settings.Config.Http.BaseURL + "public/static"
|
||||
description := settings.Config.Frontend.Description
|
||||
title := settings.Config.Frontend.Name
|
||||
@@ -195,6 +211,8 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
|
||||
"minSearchLength": settings.Config.Server.MinSearchLength,
|
||||
"disableExternal": settings.Config.Frontend.DisableDefaultLinks,
|
||||
"darkMode": settings.Config.UserDefaults.UI.DarkMode,
|
||||
"lightBackground": settings.Config.Frontend.Styling.LightBackground,
|
||||
"darkBackground": settings.Config.Frontend.Styling.DarkBackground,
|
||||
"baseURL": settings.Config.Http.BaseURL,
|
||||
"version": versionString,
|
||||
"commitSHA": commitSHAString,
|
||||
@@ -223,8 +241,20 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
|
||||
"loginButtonText": settings.Config.Frontend.LoginButtonText,
|
||||
"passkeyAvailable": settings.Config.Auth.Methods.PasskeyAuth.Enabled,
|
||||
"passkeyLoginButtonText": settings.Config.Auth.Methods.PasskeyAuth.LoginButtonText,
|
||||
"disablePWAInstall": settings.Config.Frontend.DisablePWAInstall,
|
||||
}
|
||||
|
||||
cspNonce, err := utils.CSPNonce()
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, fmt.Errorf("csp nonce: %w", err)
|
||||
}
|
||||
globalVars, ok := data["globalVars"].(map[string]interface{})
|
||||
if !ok {
|
||||
return http.StatusInternalServerError, errors.New("unable to load global variables")
|
||||
}
|
||||
globalVars["cspNonce"] = cspNonce
|
||||
data["cspNonce"] = cspNonce
|
||||
|
||||
// Marshal each variable to JSON strings for direct template usage
|
||||
globalVarsJSON, err := json.Marshal(data["globalVars"])
|
||||
if err != nil {
|
||||
@@ -324,6 +354,7 @@ func staticAssetHandler(w http.ResponseWriter, r *http.Request) {
|
||||
assetPath = "img/icons/favicon.png"
|
||||
case "icons/favicon-32x32.png",
|
||||
"icons/pwa-icon-192.png", "icons/pwa-icon-256.png", "icons/pwa-icon-512.png",
|
||||
"icons/pwa-icon-maskable-192.png", "icons/pwa-icon-maskable-512.png",
|
||||
"icons/apple-touch-icon.png", "icons/mstile-256x256.png":
|
||||
// Files are generated as PWAIconsCacheDir()/basename (URL uses icons/ prefix only for routing)
|
||||
rel := strings.TrimPrefix(path, "icons/")
|
||||
|
||||
@@ -3,7 +3,9 @@ package web
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -96,3 +98,27 @@ func isContentUpload(r *http.Request) bool {
|
||||
_, ok, err := parseUploadTotalSize(r)
|
||||
return err == nil && ok
|
||||
}
|
||||
|
||||
func drainRequestBody(r *http.Request) {
|
||||
if r.Body == nil {
|
||||
return
|
||||
}
|
||||
_, _ = io.Copy(io.Discard, r.Body)
|
||||
_ = r.Body.Close()
|
||||
}
|
||||
|
||||
type chunkUploadResponse struct {
|
||||
Offset int64 `json:"offset"`
|
||||
Total int64 `json:"total"`
|
||||
Complete bool `json:"complete"`
|
||||
}
|
||||
|
||||
func writeChunkUploadResponse(w http.ResponseWriter, offset, total int64, complete bool) error {
|
||||
w.Header().Set("Connection", "close")
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
return json.NewEncoder(w).Encode(chunkUploadResponse{
|
||||
Offset: offset,
|
||||
Total: total,
|
||||
Complete: complete,
|
||||
})
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
stderrors "errors"
|
||||
"fmt"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/adapters/fs/files"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/activity"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -13,15 +11,17 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/activity"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/adapters/fs/files"
|
||||
|
||||
activitydb "github.com/gtsteffaniak/filebrowser/backend/internal/database/activity"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/database/users"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/state"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/usersidebar"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/internal/utils"
|
||||
"github.com/gtsteffaniak/go-logger/logger"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/pkg/settings"
|
||||
|
||||
"github.com/gtsteffaniak/go-logger/logger"
|
||||
)
|
||||
|
||||
type UserRequest struct {
|
||||
@@ -273,6 +273,25 @@ func validatePatchWhich(which []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateNonAdminSelfPatchWhich rejects self-service PATCH attempts that touch privileged fields.
|
||||
// Non-admins may only update NonAdminEditable profile fields, plus password (with X-Password) and otpEnabled.
|
||||
func validateNonAdminSelfPatchWhich(which []string) error {
|
||||
allowed := nonAdminEditableFieldNameSet()
|
||||
for _, w := range which {
|
||||
f := utils.CapitalizeFirst(strings.TrimSpace(w))
|
||||
if f == "" {
|
||||
return fmt.Errorf("which must not contain empty field names")
|
||||
}
|
||||
if strings.EqualFold(f, "Password") || strings.EqualFold(f, "OtpEnabled") {
|
||||
continue
|
||||
}
|
||||
if _, ok := allowed[f]; !ok {
|
||||
return fmt.Errorf("cannot update privileged user fields without admin permissions")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// userPutOnlyNonAdminEditableFields reports whether req.Which lists exclusively NonAdminEditable fields,
|
||||
// excluding Password.
|
||||
func userPutOnlyNonAdminEditableFields(which []string) bool {
|
||||
@@ -373,6 +392,11 @@ func userPatchHandler(w http.ResponseWriter, r *http.Request, d *Context) (int,
|
||||
if !d.User.Permissions.Admin && targetUsername != d.User.Username {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
if !d.User.Permissions.Admin && targetUsername == d.User.Username {
|
||||
if err = validateNonAdminSelfPatchWhich(req.Which); err != nil {
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
}
|
||||
|
||||
uValue, err2 := state.GetUserByUsername(targetUsername)
|
||||
if err2 == errors.ErrNotExist {
|
||||
|
||||
@@ -53,3 +53,51 @@ func TestValidatePatchWhich(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestValidateNonAdminSelfPatchWhich(t *testing.T) {
|
||||
t.Run("allows profile fields", func(t *testing.T) {
|
||||
for _, which := range [][]string{
|
||||
{"locale"},
|
||||
{"darkMode", "viewMode"},
|
||||
{"preview"},
|
||||
{"sorting"},
|
||||
} {
|
||||
if err := validateNonAdminSelfPatchWhich(which); err != nil {
|
||||
t.Fatalf("unexpected error for which=%v: %v", which, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("allows password and otpEnabled", func(t *testing.T) {
|
||||
for _, which := range [][]string{
|
||||
{"password"},
|
||||
{"otpEnabled"},
|
||||
{"locale", "password"},
|
||||
} {
|
||||
if err := validateNonAdminSelfPatchWhich(which); err != nil {
|
||||
t.Fatalf("unexpected error for which=%v: %v", which, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("rejects privileged fields", func(t *testing.T) {
|
||||
for _, which := range [][]string{
|
||||
{"scopes"},
|
||||
{"permissions"},
|
||||
{"sourcePermissions"},
|
||||
{"loginMethod"},
|
||||
{"lockPassword"},
|
||||
{"disableSettings"},
|
||||
} {
|
||||
if err := validateNonAdminSelfPatchWhich(which); err == nil {
|
||||
t.Fatalf("expected error for which=%v", which)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("rejects mixed privileged and profile fields", func(t *testing.T) {
|
||||
if err := validateNonAdminSelfPatchWhich([]string{"locale", "scopes"}); err == nil {
|
||||
t.Fatal("expected error when which mixes profile and privileged fields")
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -149,6 +149,9 @@ func ValidateLdapAuth() error {
|
||||
if ldapCfg.UserFilter == "" {
|
||||
ldapCfg.UserFilter = "(&(cn=%s)(objectClass=user))"
|
||||
}
|
||||
if ldapCfg.GroupsClaim == "" {
|
||||
ldapCfg.GroupsClaim = defaultLdapGroupsClaim
|
||||
}
|
||||
applyAuthCommonDefaults(&ldapCfg.AuthCommon)
|
||||
if err := verifyLdapConnection(); err != nil {
|
||||
logger.Fatalf("LDAP connection check failed: %v", err)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package settings
|
||||
|
||||
const defaultGroupsClaim = "groups"
|
||||
const (
|
||||
defaultGroupsClaim = "groups"
|
||||
defaultLdapGroupsClaim = "memberOf"
|
||||
)
|
||||
|
||||
// ResolveGroupsClaim returns the configured groups claim or the shared default when empty.
|
||||
func ResolveGroupsClaim(claim string) string {
|
||||
@@ -10,6 +13,14 @@ func ResolveGroupsClaim(claim string) string {
|
||||
return claim
|
||||
}
|
||||
|
||||
// ResolveLdapGroupsClaim returns the configured LDAP groups attribute or memberOf when empty.
|
||||
func ResolveLdapGroupsClaim(claim string) string {
|
||||
if claim == "" {
|
||||
return defaultLdapGroupsClaim
|
||||
}
|
||||
return claim
|
||||
}
|
||||
|
||||
// applyAuthCommonDefaults sets shared defaults for external auth methods that support group claims.
|
||||
func applyAuthCommonDefaults(c *AuthCommon) {
|
||||
c.GroupsClaim = ResolveGroupsClaim(c.GroupsClaim)
|
||||
|
||||
@@ -24,3 +24,23 @@ func TestResolveGroupsClaim(t *testing.T) {
|
||||
t.Fatalf("ResolveGroupsClaim(memberOf) = %q, want memberOf", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveLdapGroupsClaim(t *testing.T) {
|
||||
if got := ResolveLdapGroupsClaim(""); got != "memberOf" {
|
||||
t.Fatalf("ResolveLdapGroupsClaim(\"\") = %q, want memberOf", got)
|
||||
}
|
||||
if got := ResolveLdapGroupsClaim("groups"); got != "groups" {
|
||||
t.Fatalf("ResolveLdapGroupsClaim(groups) = %q, want groups", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyLdapAuthCommonDefaultsUsesMemberOf(t *testing.T) {
|
||||
ldapCfg := LdapConfig{AuthCommon: AuthCommon{}}
|
||||
if ldapCfg.GroupsClaim == "" {
|
||||
ldapCfg.GroupsClaim = defaultLdapGroupsClaim
|
||||
}
|
||||
applyAuthCommonDefaults(&ldapCfg.AuthCommon)
|
||||
if ldapCfg.GroupsClaim != "memberOf" {
|
||||
t.Fatalf("ldap groupsClaim = %q, want memberOf", ldapCfg.GroupsClaim)
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,16 @@ const (
|
||||
)
|
||||
|
||||
func Initialize(configFile string) {
|
||||
initializeConfig(configFile, false)
|
||||
}
|
||||
|
||||
// InitializeCLI loads config for CLI subcommands without server-only setup (ffmpeg, frontend, etc.).
|
||||
func InitializeCLI(configFile string) {
|
||||
initializeConfig(configFile, true)
|
||||
}
|
||||
|
||||
func initializeConfig(configFile string, cliMode bool) {
|
||||
Env.IsCLIMode = cliMode
|
||||
err := loadConfigWithDefaults(configFile, false)
|
||||
if err != nil {
|
||||
logger.Error("unable to load config, waiting 5 seconds before exiting...")
|
||||
@@ -57,6 +67,9 @@ func Initialize(configFile string) {
|
||||
setupSources(false)
|
||||
InitializeUserResolvers() // Initialize user package resolvers after sources are set up
|
||||
setupUrls()
|
||||
if cliMode {
|
||||
return
|
||||
}
|
||||
warnHttpProxyConfig()
|
||||
setupFrontend(false)
|
||||
setupMedia(false)
|
||||
|
||||
@@ -38,6 +38,7 @@ type Http struct {
|
||||
}
|
||||
|
||||
type Environment struct {
|
||||
IsCLIMode bool `json:"-"` // true when running a CLI subcommand (user set, promote, etc.)
|
||||
IsPlaywright bool `json:"-"`
|
||||
IsDevMode bool `json:"-"`
|
||||
IsFirstLoad bool `json:"-"` // used internally to track if this is the first load of the application
|
||||
@@ -300,6 +301,7 @@ type Frontend struct {
|
||||
LoginIcon string `json:"loginIcon"` // path to an image file for the login page icon
|
||||
LoginButtonText string `json:"loginButtonText"` // text to display on the login button
|
||||
OIDCLoginButtonText string `json:"oidcLoginButtonText"` // text to display on the OIDC login button
|
||||
DisablePWAInstall bool `json:"disablePWAInstall"` // disable the PWA install button in the sidebar
|
||||
}
|
||||
|
||||
type StylingConfig struct {
|
||||
|
||||
@@ -118,3 +118,11 @@ func readCustomCSS(path string) (string, error) {
|
||||
logger.Debugf("Loaded custom CSS from: %s (%d bytes)", path, len(content))
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
// DefaultBackgroundColor returns the background color of the instance's default theme.
|
||||
func DefaultBackgroundColor() string {
|
||||
if Config.UserDefaults.UI.DarkMode != nil && *Config.UserDefaults.UI.DarkMode {
|
||||
return Config.Frontend.Styling.DarkBackground
|
||||
}
|
||||
return Config.Frontend.Styling.LightBackground
|
||||
}
|
||||
@@ -5675,6 +5675,10 @@ const docTemplate = `{
|
||||
"description": "disable the nav buttons in the sidebar",
|
||||
"type": "boolean"
|
||||
},
|
||||
"disablePWAInstall": {
|
||||
"description": "disable the PWA install button in the sidebar",
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableUsedPercentage": {
|
||||
"description": "disable used percentage for the sources in the sidebar",
|
||||
"type": "boolean"
|
||||
|
||||
@@ -5664,6 +5664,10 @@
|
||||
"description": "disable the nav buttons in the sidebar",
|
||||
"type": "boolean"
|
||||
},
|
||||
"disablePWAInstall": {
|
||||
"description": "disable the PWA install button in the sidebar",
|
||||
"type": "boolean"
|
||||
},
|
||||
"disableUsedPercentage": {
|
||||
"description": "disable used percentage for the sources in the sidebar",
|
||||
"type": "boolean"
|
||||
|
||||
@@ -413,6 +413,9 @@ definitions:
|
||||
disableNavButtons:
|
||||
description: disable the nav buttons in the sidebar
|
||||
type: boolean
|
||||
disablePWAInstall:
|
||||
description: disable the PWA install button in the sidebar
|
||||
type: boolean
|
||||
disableUsedPercentage:
|
||||
description: disable used percentage for the sources in the sidebar
|
||||
type: boolean
|
||||
|
||||
@@ -164,6 +164,7 @@ frontend:
|
||||
loginIcon: "" # path to an image file for the login page icon
|
||||
loginButtonText: "" # text to display on the login button
|
||||
oidcLoginButtonText: "" # text to display on the OIDC login button
|
||||
disablePWAInstall: false # disable the PWA install button in the sidebar
|
||||
userDefaults: # optional signup/CLI defaults; per-user values are managed in the UI
|
||||
sidebar:
|
||||
disableQuickToggles: false # disable the quick toggles in the sidebar
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, viewport-fit=cover">
|
||||
<title>"{{ .htmlVars.title }}"</title>
|
||||
|
||||
<link rel="icon" type="image/png" sizes="256x256" href="{{ .htmlVars.favicon }}">
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<!-- Add to home screen for Safari on iOS/iPadOS -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="apple-mobile-web-app-title" content="assets">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ .htmlVars.appIcon }}">
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<link rel="canonical" href="https://filebrowserquantum.com">
|
||||
|
||||
<!-- Injected variables come from backend server -->
|
||||
<script>
|
||||
<script nonce="{{ .cspNonce }}">
|
||||
window.globalVars = {{ .globalVars }};
|
||||
window.__pwaDeferredPrompt = null;
|
||||
window.addEventListener("beforeinstallprompt", function (event) {
|
||||
@@ -72,6 +72,14 @@
|
||||
--iconBackground: #dddddd;
|
||||
--activeWhiteIcon: gray;
|
||||
}
|
||||
/* paint safe areas + iOS overscroll with app background (notched PWAs) */
|
||||
html {
|
||||
background-color: {{ .htmlVars.lightBackground }};
|
||||
min-height: calc(100% + env(safe-area-inset-top, 0px));
|
||||
}
|
||||
html:has(.dark-mode) {
|
||||
background-color: {{ .htmlVars.darkBackground }};
|
||||
}
|
||||
.dark-mode {
|
||||
--background: {{ .htmlVars.darkBackground }};
|
||||
--alt-background: #283136;
|
||||
|
||||
@@ -19,6 +19,14 @@ export { fetchPreviewImage } from '@/utils/previewRequests'
|
||||
|
||||
const VIEW_TOKEN_TTL_SECONDS = 15 * 60;
|
||||
|
||||
function chunkUploadApiPath(apiPath, headers) {
|
||||
if (headers["X-File-Chunk-Offset"] === undefined) {
|
||||
return apiPath;
|
||||
}
|
||||
const sep = apiPath.includes("?") ? "&" : "?";
|
||||
return `${apiPath}${sep}_chunkSeq=${headers["X-File-Chunk-Offset"]}`;
|
||||
}
|
||||
|
||||
function cacheViewTokenFromListing(data) {
|
||||
const scope = getters.isShare()
|
||||
? state.shareInfo?.hash || data?.source
|
||||
@@ -718,11 +726,15 @@ export function post(
|
||||
}
|
||||
const request = new XMLHttpRequest();
|
||||
opState.xhr = request;
|
||||
request.open("POST", apiPath, true);
|
||||
const resolvedPath = chunkUploadApiPath(apiPath, headers);
|
||||
request.open("POST", resolvedPath, true);
|
||||
|
||||
Object.entries(headers).forEach(([header, value]) => {
|
||||
request.setRequestHeader(header, value);
|
||||
});
|
||||
if (headers["X-File-Chunk-Offset"] !== undefined) {
|
||||
request.setRequestHeader("Connection", "close");
|
||||
}
|
||||
|
||||
if (typeof onupload === "function") {
|
||||
request.upload.onprogress = (event) => {
|
||||
@@ -1258,11 +1270,14 @@ export function postPublic(
|
||||
});
|
||||
|
||||
const request = new XMLHttpRequest();
|
||||
request.open("POST", apiPath, true);
|
||||
request.open("POST", chunkUploadApiPath(apiPath, headers), true);
|
||||
|
||||
Object.entries(headers).forEach(([header, value]) => {
|
||||
request.setRequestHeader(header, value);
|
||||
});
|
||||
if (headers["X-File-Chunk-Offset"] !== undefined) {
|
||||
request.setRequestHeader("Connection", "close");
|
||||
}
|
||||
|
||||
if (typeof onupload === "function") {
|
||||
request.upload.onprogress = (event) => {
|
||||
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
resizeStartX: 0,
|
||||
resizeStartWidth: 0,
|
||||
previousSidebarSize: null, // Remember the previous width when switching from desktop to mobile.
|
||||
pwaInstallDismissed: sessionStorage.getItem("pwaInstallDismissed") === "true",
|
||||
pwaInstallDismissed: localStorage.getItem("pwaInstallDismissed") === "true",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@@ -121,7 +121,7 @@ export default {
|
||||
);
|
||||
},
|
||||
showPwaInstall() {
|
||||
return installAvailable.value && !this.pwaInstallDismissed && !this.isSettings;
|
||||
return installAvailable.value && !this.pwaInstallDismissed && !this.isSettings && !globalVars.disablePWAInstall;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -178,11 +178,14 @@ export default {
|
||||
mutations.setSeenUpdate(globalVars.updateAvailable);
|
||||
},
|
||||
async installPwa() {
|
||||
await promptInstall();
|
||||
const accepted = await promptInstall();
|
||||
if (accepted) {
|
||||
this.dismissPwaInstall();
|
||||
}
|
||||
},
|
||||
dismissPwaInstall() {
|
||||
this.pwaInstallDismissed = true;
|
||||
sessionStorage.setItem("pwaInstallDismissed", "true");
|
||||
localStorage.setItem("pwaInstallDismissed", "true");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
--layer-middle: 3;
|
||||
--layer-below-top: 4;
|
||||
--layer-top: 10;
|
||||
/* device insets (notch, rounded corners, home indicator) */
|
||||
--safe-area-top: env(safe-area-inset-top, 0px);
|
||||
--safe-area-left: env(safe-area-inset-left, 0px);
|
||||
--safe-area-right: env(safe-area-inset-right, 0px);
|
||||
--safe-area-bottom: env(safe-area-inset-bottom, 0px);
|
||||
/* app top bar height, including the top safe-area inset */
|
||||
--header-height: calc(4em + var(--safe-area-top));
|
||||
--borderRadius: 1em;
|
||||
--borderWidth: 1.5px;
|
||||
--surfaceElevationShadow:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
body {
|
||||
font-family: "Roboto", sans-serif;
|
||||
padding-top: 4em;
|
||||
padding-top: var(--header-height);
|
||||
color: #333333;
|
||||
overflow:initial;
|
||||
scrollbar-width: none; /* Firefox */
|
||||
@@ -70,9 +70,12 @@ i.spin {
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
position: fixed;
|
||||
padding-top: 4em;
|
||||
padding-top: var(--header-height);
|
||||
padding-left: var(--safe-area-left);
|
||||
padding-right: var(--safe-area-right);
|
||||
overflow: unset;
|
||||
top: 0;
|
||||
/* fill the visible viewport only; the html background paints the black-translucent safe areas */
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -12,6 +12,14 @@ header {
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
/* only the app top bar absorbs the safe-area insets (top bar, landscape notch) */
|
||||
header.flexbar {
|
||||
height: var(--header-height);
|
||||
padding-top: calc(0.5em + var(--safe-area-top));
|
||||
padding-left: calc(0.5em + var(--safe-area-left));
|
||||
padding-right: calc(0.5em + var(--safe-area-right));
|
||||
}
|
||||
|
||||
header title {
|
||||
display: block;
|
||||
flex: 1 1 auto;
|
||||
|
||||
@@ -30,6 +30,7 @@ export const availableLocales: Record<string, string> = {
|
||||
ru: 'ru',
|
||||
sk: 'sk',
|
||||
svSE: 'sv-se',
|
||||
tr: 'tr',
|
||||
ua: 'ua',
|
||||
zhCN: 'zh-cn',
|
||||
zhTW: 'zh-tw',
|
||||
|
||||
+224
-224
@@ -8,26 +8,26 @@
|
||||
"selectMultiple": "Çoklu seçim",
|
||||
"switchView": "Görünümü değiştir",
|
||||
"copyDownloadLinkToClipboard": "İndirme bağlantısını panoya kopyala",
|
||||
"generateNewOtp": "Sıfırlama ve yeni iki faktörlü kod oluşturma",
|
||||
"generateNewOtp": "Sıfırla ve yeni iki faktörlü kod oluştur",
|
||||
"pauseAll": "Tümünü duraklat",
|
||||
"resumeAll": "Tümünü devam ettir",
|
||||
"clearCompleted": "Temizleme tamamlandı",
|
||||
"openParentFolder": "Üst klasörü açın",
|
||||
"clearCompleted": "Tamamlananları Temizle",
|
||||
"openParentFolder": "Üst klasörü aç",
|
||||
"selectedCount": "Bir eylemi gerçekleştirmek için seçilen öğe sayısı",
|
||||
"listView": "Liste Görünümü",
|
||||
"normalView": "Normal Görünüm",
|
||||
"galleryView": "Galeri Görünümü",
|
||||
"selectAll": "Tümünü seçin",
|
||||
"discardAndExit": "At ve Çık",
|
||||
"selectAll": "Tümünü seç",
|
||||
"discardAndExit": "Kaydetmeden Çık",
|
||||
"saveAndExit": "Kaydet ve Çık",
|
||||
"keepEditing": "Düzenlemeye Devam Et",
|
||||
"closeAnyway": "Her Neyse Kapat",
|
||||
"closeAnyway": "Yine de Kapat",
|
||||
"watchFile": "Dosyayı izle",
|
||||
"showMore": "Gelişmiş Seçenekleri Göster",
|
||||
"showLess": "Gelişmiş Seçenekleri Gizle",
|
||||
"goToSource": "Kaynak Konuma Git",
|
||||
"goToItem": "Öğeye git",
|
||||
"copyPath": "Kopyalama Yolu",
|
||||
"copyPath": "Yolu Kopyala",
|
||||
"pinItem": "Sabitle",
|
||||
"unpinItem": "Sabitlemeyi Kaldır",
|
||||
"sendToApp": "Uygulamaya gönder",
|
||||
@@ -43,12 +43,12 @@
|
||||
"requestTimedOut": "İstek zaman aşımına uğradı. Ağ ayarlarınızı veya ters proxy ayarlarınızı kontrol edin."
|
||||
},
|
||||
"files": {
|
||||
"lastModified": "Son güncellenme",
|
||||
"lastModified": "Son değiştirilme{suffix}",
|
||||
"multipleSelectionEnabled": "Çoklu seçim etkin",
|
||||
"sortByLastModified": "Güncelleme tarihine göre sırala",
|
||||
"sortByName": "İsme göre sırala",
|
||||
"sortBySize": "Boyuta göre sırala",
|
||||
"noPreview": "Bu dosya için önizleme aktif değil",
|
||||
"noPreview": "Bu dosya için önizleme kullanılamıyor.",
|
||||
"noDownloadAccess": "İndirme mevcut değil.",
|
||||
"newFile": "Yeni dosya{suffix}",
|
||||
"newFolder": "Yeni klasör{suffix}",
|
||||
@@ -70,17 +70,17 @@
|
||||
"f2": "Normal görünüme geç",
|
||||
"f3": "Galeri görünümüne geç",
|
||||
"scroll": "Liste ve düzenleyici yazı tipi boyutlarını değiştir",
|
||||
"d": "seçili öğeleri indirin",
|
||||
"d": "seçili öğeleri indir",
|
||||
"b": "kenar çubuğunu değiştir",
|
||||
"comma": "ayarlara git",
|
||||
"c": "seçili öğeleri kopyala",
|
||||
"v": "kopyalanan/kesilen öğeleri yapıştırma",
|
||||
"v": "kopyalanan/kesilen öğeleri yapıştır",
|
||||
"x": "seçili öğeleri kes",
|
||||
"e": "Düzenleyici ve Markdown görüntüleyici arasında geçiş yap (.md dosyalarında)",
|
||||
"click": "birden fazla dosya veya klasör seçin"
|
||||
"click": "birden fazla dosya veya klasör seç"
|
||||
},
|
||||
"del": "seçilileri sil",
|
||||
"esc": "seçimi temizle veya kapatın",
|
||||
"del": "seçili öğeleri sil",
|
||||
"esc": "seçimi temizle ve/veya istemi kapat",
|
||||
"f4": "listeyi ve meta verileri yenile",
|
||||
"f2": "dosyayı yeniden adlandır",
|
||||
"f1": "yardım istemini göster",
|
||||
@@ -89,7 +89,7 @@
|
||||
"wiki": "FileBrowser Quantum Resmi Dokümanları",
|
||||
"media": {
|
||||
"title": "Medya Oynatıcı",
|
||||
"playPause": "Oynat/Durdur",
|
||||
"playPause": "Oynat/Duraklat",
|
||||
"seekPercentage": "%10'dan %90'a atla",
|
||||
"seek": "10 sn geri veya ileri atla",
|
||||
"volume": "Sesi aç veya kıs",
|
||||
@@ -103,8 +103,8 @@
|
||||
},
|
||||
"altArrowUp": "Üst klasöre git",
|
||||
"altArrowDown": "Seçilen dosya/klasörü aç",
|
||||
"click": "dosya veya klasör seçin",
|
||||
"marqueeSelect": "Boş alana sürükleyerek birden fazla dosya veya klasör seçin"
|
||||
"click": "dosya veya klasör seç",
|
||||
"marqueeSelect": "boş alana sürükleyerek birden fazla dosya veya klasör seç"
|
||||
},
|
||||
"languages": {
|
||||
"ar": "العربية",
|
||||
@@ -151,28 +151,28 @@
|
||||
"deleteTitle": "Dosyaları sil",
|
||||
"displayName": "Görünen Ad:",
|
||||
"downloadMessage": "İndirmek istediğiniz formatı seçin.",
|
||||
"error": "Bir şeyler yanlış gitti",
|
||||
"error": "Bir şeyler ters gitti",
|
||||
"fileInfo": "Dosya bilgisi",
|
||||
"newFile": "Yeni dosya",
|
||||
"newFileMessage": "Yeni dosyanın adını yazın.",
|
||||
"replaceMessage": "Yüklemeye çalıştığınız dosyalardan biri, adı nedeniyle çakışıyor. Mevcut olanı değiştirmek istiyor musunuz?\n",
|
||||
"replaceMessage": "Yüklemeye çalıştığınız dosyalardan biri, adı nedeniyle çakışıyor. Yüklemeye devam etmek mi yoksa mevcut dosyayı değiştirmek mi istersiniz?\n\n",
|
||||
"optionalPassword": "İsteğe bağlı şifre",
|
||||
"deleteUserMessage": "Bu kullanıcıyı silmek istediğinizden emin misiniz?",
|
||||
"deleted": "Başarıyla silindi!",
|
||||
"destinationSource": "Hedef Kaynak:",
|
||||
"dragAndDrop": "Dosyaları buraya sürükleyip bırakın",
|
||||
"completed": "Tamamlandı",
|
||||
"conflictsDetected": "Tespit edilen çatışmalar",
|
||||
"conflictsDetected": "Çakışmalar tespit edildi",
|
||||
"downloadsLimit": "İndirme sayısı sınırı",
|
||||
"maxBandwidth": "Maksimum indirme bant genişliği (kbps)",
|
||||
"shareThemeColor": "Tema rengini paylaş (CSS değeri)",
|
||||
"shareDescription": "Açıklama paylaş",
|
||||
"shareBanner": "Banner URL'sini paylaş",
|
||||
"shareFavicon": "Favicon URL'sini paylaş",
|
||||
"shareThemeColor": "Paylaşım tema rengi (CSS değeri)",
|
||||
"shareDescription": "Paylaşım açıklaması",
|
||||
"shareBanner": "Paylaşım afiş URL'si",
|
||||
"shareFavicon": "Paylaşım favicon URL'si",
|
||||
"renameMessage": "Yeni bir ad girin:",
|
||||
"renameMessageInvalid": "Bir dosya \"/\" veya \"\\\" içeremez",
|
||||
"deleteMessageMultiple": "{count} dosya(lar)ını silmek istediğinizden emin misiniz?",
|
||||
"deleteMessageShare": "Bu paylaşımı silmek istediğinizden emin misiniz? {path} ?",
|
||||
"renameMessageInvalid": "Bir dosya adı \"/\" veya \"\\\" içeremez",
|
||||
"deleteMessageMultiple": "{count} dosyayı silmek istediğinizden emin misiniz?",
|
||||
"deleteMessageShare": "Bu paylaşımı silmek istediğinizden emin misiniz: {path}?",
|
||||
"renameMessageConflict": "\"{filename}\" adında bir öğe zaten var!",
|
||||
"uploadSettingsChunked": "Maksimum eşzamanlı yükleme: {maxConcurrentUpload}, yığın boyutu: {uploadChunkSizeMb} MB",
|
||||
"uploadSettingsNoChunk": "Maksimum eşzamanlı yükleme: {maxConcurrentUpload}, yığınlanmış yükleme devre dışı",
|
||||
@@ -183,23 +183,23 @@
|
||||
"saveBeforeExit": "Kaydedilmemiş Değişiklikler",
|
||||
"saveBeforeExitMessage": "Düzenleyicide kaydedilmemiş değişiklikleriniz var. Ne yapmak istiyorsunuz?",
|
||||
"copyPasteConfirm": "Kopyala/Yapıştır Onayı",
|
||||
"copyItemQuestion": "Bu öğeyi yeni konuma kopyalayayım mı?",
|
||||
"moveItemQuestion": "Bu öğeyi yeni konuma taşıyın mı?",
|
||||
"destinationPath": "Varış yeri:",
|
||||
"copyItemQuestion": "Bu öğe yeni konuma kopyalansın mı?",
|
||||
"moveItemQuestion": "Bu öğe yeni konuma taşınsın mı?",
|
||||
"destinationPath": "Hedef:",
|
||||
"closeWithActiveUploadsMessage": "Uyarı: Aktif yüklemeleriniz var ve yükleme istemini kapatmak tamamlanmamış yüklemelere neden olabilir. Ne yapmak istiyorsunuz?",
|
||||
"closeWithActiveUploads": "Aktif yüklemeler",
|
||||
"basicInfo": "Temel Bilgiler",
|
||||
"additionalInfo": "Ek Bilgi",
|
||||
"hidden": "Gizli",
|
||||
"hasPreview": "Has Önizleme",
|
||||
"checksums": "Checksumlar",
|
||||
"hasPreview": "Önizleme Var",
|
||||
"checksums": "Sağlama Toplamları",
|
||||
"hashAlgorithm": "Hash Algoritması",
|
||||
"hashValue": "Hash Değeri",
|
||||
"selectHashAlgorithm": "Bir karma algoritma seçin",
|
||||
"generate": "Oluşturmak",
|
||||
"selectHashAlgorithm": "Bir hash algoritması seçin",
|
||||
"generate": "Oluştur",
|
||||
"errorGeneratingHash": "Hash oluştururken hata oluştu",
|
||||
"token": "Jeton",
|
||||
"onlyOfficeId": "SadeceOfis Kimliği",
|
||||
"token": "Belirteç",
|
||||
"onlyOfficeId": "OnlyOffice Kimliği",
|
||||
"firstLoadTitle": "FileBrowser Quantum'a hoş geldiniz!",
|
||||
"halloweenTitle": "Mutlu Cadılar Bayramı!",
|
||||
"halloweenBody": "Cadılar Bayramı teması uygulanmıştır. Beğenmediyseniz devre dışı bırakabilir veya profil ayarlarından başka bir tema seçerek kalıcı olarak devre dışı bırakabilirsiniz.",
|
||||
@@ -219,28 +219,28 @@
|
||||
"archiveSuccess": "Arşiv başarıyla oluşturuldu!",
|
||||
"unarchive": "Arşivi ayıkla",
|
||||
"unarchiveMessage": "Arşivin nereye çıkarılacağını seçin.",
|
||||
"unarchiveDestination": "Özetle:",
|
||||
"unarchiveDestination": "Şuraya çıkar:",
|
||||
"unarchiveSuccess": "Arşiv başarıyla çıkarıldı!",
|
||||
"downloadFailed": "Yığın indirme başarısız oldu - bu tekrarlanırsa yığın boyutunu küçültmeyi deneyin: {message}",
|
||||
"confirmPasswordToSaveUser": "Bu kullanıcı değişikliklerini kaydetmek için mevcut şifrenizi girin."
|
||||
},
|
||||
"search": {
|
||||
"smallerThan": "Daha küçük:",
|
||||
"largerThan": "Daha büyük:",
|
||||
"smallerThan": "Şundan küçük:",
|
||||
"largerThan": "Şundan büyük:",
|
||||
"onlyFolders": "Yalnızca Klasörler",
|
||||
"onlyFiles": "Sadece Dosyalar",
|
||||
"onlyFiles": "Yalnızca Dosyalar",
|
||||
"searchContext": "Arama Bağlamı: {context}",
|
||||
"notEnoughCharacters": "Arama yapmak için yeterli karakter yok (min {minSearchLength})",
|
||||
"typeToSearch": "Aramaya başlamak için {minSearchLength} veya daha fazla karakter yazmaya başlayın.",
|
||||
"showPreviewImages": "Önizleme resimlerini göster",
|
||||
"showPreviewImagesDescription": "Kullanılabilir olduğunda arama sonuçları için küçük resim önizlemelerini görüntüleyin ve tüm sonuçlar için daha büyük simgeler gösterin.",
|
||||
"olderThanDate": "Daha yaşlı:",
|
||||
"newerThanDate": "Daha yeni:",
|
||||
"olderThanDate": "Şundan eski:",
|
||||
"newerThanDate": "Şundan yeni:",
|
||||
"noResults": "Sonuç bulunamadı.",
|
||||
"helpText1": "Arama, yazdığınız her karakterde gerçekleşir ({minSearchLength} minimum karakter).",
|
||||
"helpText2": "Yalnızca dosya veya klasör adlarında alt dize eşleşmesi (tam yollarda değil). case:exact büyük/küçük harfe duyarlı eşleştirme için\n\n terimler arasında VEYA için boru karakteri kullanın; bir ifade için çift tırnak kullanın.\n\nDaha gelişmiş seçenekler için joker karakter aramayı etkinleştirin.",
|
||||
"useWildcardSearch": "Joker karakter araması (büyük/küçük harfe duyarlı)",
|
||||
"useWildcardSearchDescription": "Desteklenen joker karakter seçenekleri:\n\n- Herhangi bir diziyi eşleştirin: *\n\n- Bir karakteri eşleştirin: ?\n\n- Karakter sınıfı: [a-z], [0-9]\n\n- Negasyon: [^0-9]\n\n- Literal *, ? veya [ parantez içine alınmalıdır, örneğin [*], [?], [[]\n\n- Tüm sonuçlar büyük/küçük harfe duyarlıdır",
|
||||
"helpText1": "Arama, yazdığınız her karakterde gerçekleşir (en az {minSearchLength} karakter).",
|
||||
"helpText2": "Yalnızca dosya veya klasör adlarında büyük/küçük harfe duyarsız alt dize eşleşmesi (tam yollarda değil). Boşlukla ayrılmış kelimeler; nokta, alt çizgi ve tire gibi yaygın ayraçlar arasında eşleşir (örn. \"Blade Runner\" araması Blade.Runner.mkv dosyasını bulur). Büyük/küçük harfe duyarlı eşleştirme için case:exact kullanın.\n\nTerimler arasında VEYA için dik çizgi karakterini kullanın; boşluk içeren tam bir ifade için çift tırnak kullanın.\n\nGelişmiş glob kalıpları (*, ?, [a-z]) için joker karakter aramasını etkinleştirin.",
|
||||
"useWildcardSearch": "Joker karakter araması",
|
||||
"useWildcardSearchDescription": "Desteklenen joker karakter seçenekleri:\n\n• Herhangi bir diziyi eşleştir: *\n\n• Bir karakteri eşleştir: ?\n\n• Karakter sınıfı: [a-z], [0-9]\n\n• Olumsuzlama: [^0-9]\n\n• Literal *, ? veya [ karakterleri köşeli parantez içine alınmalıdır, örn. [*], [?], [[]",
|
||||
"openInAdvancedSearch": "Gelişmiş Aramada Aç",
|
||||
"caseExact": "Büyük/küçük harf duyarlı eşleştirme",
|
||||
"caseExactDescription": "Büyük ve küçük harfleri göz ardı etmek yerine, dosya ve klasör adlarını tam harf büyük/küçük yazımına göre eşleştirin.",
|
||||
@@ -248,12 +248,12 @@
|
||||
"allFileTypes": "Tüm Dosya Türleri"
|
||||
},
|
||||
"settings": {
|
||||
"avoidChanges": "(değişiklikleri önlemek için boş bırakın)",
|
||||
"avoidChanges": "bu parolayı uygulamak için 'parolayı değiştir' seçeneğini de işaretleyin",
|
||||
"lockPassword": "Kullanıcının parolayı değiştirmesini engelle",
|
||||
"permissions": {
|
||||
"admin": "Yönetici",
|
||||
"realtime": "Gerçek zamanlı bağlantıları ve güncellemeleri etkinleştirin",
|
||||
"api": "Uzun ömürlü API Belirteçleri oluşturma ve yönetme"
|
||||
"api": "Uzun ömürlü API Belirteçleri oluştur ve yönet"
|
||||
},
|
||||
"settingsUpdated": "Ayarlar güncellendi!",
|
||||
"shareDeleted": "Paylaşım silindi!",
|
||||
@@ -262,8 +262,8 @@
|
||||
"modifyOtherUser": "Kullanıcıyı değiştir:",
|
||||
"themeColor": "Tema Rengi",
|
||||
"listingOptions": "Listeleme seçenekleri",
|
||||
"emptyGlobal": "Şu anda global yapılandırma seçenekleri yoktur, sistem ayarlarını yapmak için yapılandırma yaml'ını düzenleyebilirsiniz.",
|
||||
"scopes": "İzin verilen kaynakları ve bunlar içindeki kullanıcı kapsamını tanımlama",
|
||||
"emptyGlobal": "Şu anda genel yapılandırma seçeneği yok; sistem ayarlarını düzenlemek için yapılandırma yaml dosyasını kullanabilirsiniz.",
|
||||
"scopes": "İzin verilen kaynakları ve bunlar içindeki kullanıcı kapsamını tanımlayın",
|
||||
"userNotAdmin": "Kullanıcı yönetici değil",
|
||||
"enterPassword": "Şifre girin",
|
||||
"enterPasswordAgain": "Şifreyi tekrar girin",
|
||||
@@ -285,7 +285,7 @@
|
||||
"analyticsEnabledDescription": "Kullanıcının onayıyla gerçekleştirilen dağıtım analitiği, uygulamanın geliştirilmesine katkıda bulunmak amacıyla FileBrowser Quantum geliştirici sunucularına anonim bilgiler gönderir.",
|
||||
"analyticsLoadFailed": "Analitik ayarları yüklenemedi",
|
||||
"analyticsUpdateFailed": "Analitik ayarları güncellenemedi",
|
||||
"analyticsPreviewFailed": "Analitik tanılama bilgilerini yükleyemedi",
|
||||
"analyticsPreviewFailed": "Analitik tanılama bilgileri yüklenemedi",
|
||||
"scopePath": "Kapsam yolu",
|
||||
"sourcePermissionsHelp": "Bir kaynak satırını genişleterek, o kaynak için görüntüleme, indirme, değiştirme, oluşturma ve silme izinlerini ayarlayın.",
|
||||
"permissionsHelp": "Kullanıcının genel izinleri, tüm kaynaklar ve paylaşımlar dahil olmak üzere her yerde geçerlidir.",
|
||||
@@ -294,21 +294,21 @@
|
||||
"accountDefaults": "Hesap varsayılan ayarları",
|
||||
"disableUserSettings": "Kullanıcı ayarları sayfasını devre dışı bırak",
|
||||
"userDefaultFieldLockedFromConfig": "Bu varsayılan ayar, yapılandırma dosyasında belirlenmiştir ve buradan değiştirilemez.",
|
||||
"sourceAccessDefaultsHelp": "Kaynaklara ve yeni kullanıcılara varsayılan dosya izinleri uygulanır. “Enforce” seçeneği, yönetici olmayan tüm kullanıcılar için bir değeri kilitler."
|
||||
"sourceAccessDefaultsHelp": "Kaynaklara ve yeni kullanıcılara uygulanan varsayılan dosya izinleri. \"Uygula\" seçeneği, yönetici olmayan tüm kullanıcılar için bir değeri kilitler."
|
||||
},
|
||||
"sidebar": {
|
||||
"updateIsAvailable": "Bir güncelleme mevcut!",
|
||||
"fileActions": "Dosya işlemleri",
|
||||
"customizeLinks": "Kenar Çubuğu Bağlantılarını Özelleştirme",
|
||||
"customizeLinks": "Kenar Çubuğu Bağlantılarını Özelleştir",
|
||||
"customizeLinksDescription": "Kenar çubuğunuzda gösterilen bağlantıları özelleştirin. Yeniden sıralamak için sürükleyip bırakın.",
|
||||
"currentLinks": "Güncel Bağlantılar",
|
||||
"addNewLink": "Yeni Bağlantı Ekle",
|
||||
"linkType": "Bağlantı Türü",
|
||||
"selectLinkType": "Bir bağlantı türü seçin",
|
||||
"customLink": "Özel Bağlantı",
|
||||
"selectSource": "Kaynak Seçiniz",
|
||||
"selectSource": "Kaynak Seç",
|
||||
"chooseSource": "Bir kaynak seçin",
|
||||
"selectTool": "Araç Seçin",
|
||||
"selectTool": "Araç Seç",
|
||||
"chooseTool": "Bir araç seçin",
|
||||
"linkName": "Bağlantı Adı",
|
||||
"linkNamePlaceholder": "Bağlantı adını girin",
|
||||
@@ -321,40 +321,40 @@
|
||||
"noLinksYet": "Henüz yapılandırılmış bağlantı yok. İlk bağlantınızı aşağıya ekleyin.",
|
||||
"customizeShareLinksDescription": "Bu paylaşım için kenar çubuğunda gösterilen bağlantıları özelleştirin. Yeniden sıralamak için sürükleyip bırakın.",
|
||||
"editLink": "Bağlantıyı Düzenle",
|
||||
"selectShare": "Paylaşımı Seçin",
|
||||
"selectShare": "Paylaşım Seç",
|
||||
"chooseShare": "Bir paylaşım seçin",
|
||||
"browseIcons": "Simgelere Gözat",
|
||||
"browseIcons": "Simgelere Göz At",
|
||||
"pickIcon": "Bir Simge Seçin",
|
||||
"pickIconDescription": "Materyal Simgeleri kitaplığından bir simge arayın ve seçin",
|
||||
"linkIconPlaceholder": "İsteğe bağlı olarak bir malzeme simgesi adı belirtin",
|
||||
"pickIconDescription": "Material Icons kitaplığından bir simge arayın ve seçin",
|
||||
"linkIconPlaceholder": "İsteğe bağlı olarak bir Material simge adı belirtin",
|
||||
"switchMode": "Kenar çubuğu modunu değiştir",
|
||||
"showIndexedUsageDescription": "Kaynaktaki dizinlenmiş dosyalardan hesaplanan kullanım çubuğunu görüntüleyin.",
|
||||
"showDiskUsageDescription": "İşletim sistemi tarafından bildirilen disk/bölüm boyutundan kullanım çubuğunu görüntüleyin. Bu boyut büyük olasılıkla daha büyük olacaktır ve dizine eklenmemiş dosyaları da içerir.",
|
||||
"usageTextDisplay": "Hangi kullanım metni görüntülenmelidir?",
|
||||
"usageTextIndexed": "endeksli olarak kullanım",
|
||||
"usageTextIndexed": "dizinlenmiş haliyle kullanım",
|
||||
"usageTextDisk": "disk/bölüm tarafından bildirilen kullanım",
|
||||
"dividerNamePlaceholder": "Bölücü metin (bir çizgi göstermek için boş bırakın)",
|
||||
"showIndexedUsage": "İndekslenmiş haliyle kullanımını göster",
|
||||
"dividerNamePlaceholder": "Ayırıcı metin (bir çizgi göstermek için boş bırakın)",
|
||||
"showIndexedUsage": "Kullanımı dizinlenmiş haliyle göster",
|
||||
"showDiskUsage": "Disk/bölüm tarafından bildirilen kullanım miktarını göster"
|
||||
},
|
||||
"share": {
|
||||
"notice": "Not: Bir paylaşım oluşturulduğunda, herkese daha açık hale gelir ve erişim için farklı kurallara sahip olur. Paylaşımınız güvenli bir şekilde yapılandırılmamışsa, herkes tarafından erişilebilir.",
|
||||
"disableAnonymousDescription": "Etkinleştirildiğinde, paylaşıma yalnızca kimliği doğrulanmış kullanıcılar erişebilir. Kullanıcının paylaşımın kaynağına erişimi olmalıdır.",
|
||||
"disableThumbnailsDescription": "Etkinleştirildiğinde, önizleme küçük resimleri paylaşımda gösterilmeyecektir.",
|
||||
"enableAllowedUsernamesDescription": "Etkinleştirildiğinde, paylaşıma yalnızca belirtilen kullanıcılar erişebilir. Kullanıcının paylaşımın kaynağına erişimi olmalıdır.",
|
||||
"disableAnonymousDescription": "Paylaşıma yalnızca kimliği doğrulanmış kullanıcılar erişebilir. Kullanıcının paylaşımın kaynağına erişimi olmalıdır.",
|
||||
"disableThumbnailsDescription": "Önizleme küçük resimleri paylaşımda gösterilmez.",
|
||||
"enableAllowedUsernamesDescription": "Paylaşıma yalnızca belirtilen kullanıcılar erişebilir. Kullanıcının paylaşımın kaynağına erişimi olmalıdır.",
|
||||
"downloadsLimitDescription": "Paylaşımdaki herhangi bir dosya/klasörün en fazla kaç kez indirilebileceği. Sınırsız için boş bırakın.",
|
||||
"maxBandwidthDescription": "Saniye başına kilobayt cinsinden maksimum indirme bant genişliği. Sınırsız için boş bırakın.",
|
||||
"shareThemeDescription": "Paylaşım bağlantısı için kullanılacak tema.",
|
||||
"disableAnonymous": "Anonim erişimi devre dışı bırakın",
|
||||
"maxBandwidthDescription": "kbps cinsinden maksimum indirme bant genişliği. Sınırsız için boş bırakın.",
|
||||
"shareThemeDescription": "Paylaşım bağlantısı için kullanılacak tema",
|
||||
"disableAnonymous": "Anonim erişimi devre dışı bırak",
|
||||
"disableThumbnails": "Küçük Resimleri Devre Dışı Bırak",
|
||||
"enableAllowedUsernames": "Yalnızca belirli kullanıcılarla paylaşın",
|
||||
"enableAllowedUsernames": "Yalnızca belirli kullanıcılarla paylaş",
|
||||
"allowedUsernamesPlaceholder": "Kullanıcı adlarını virgülle ayırarak girin",
|
||||
"keepAfterExpiration": "Süresi dolduktan sonra paylaşımı silme",
|
||||
"keepAfterExpirationDescription": "Paylaşım, süresi dolduktan sonra silinmeyecektir. Bu, bir paylaşımın süresini uzatmak veya süresi dolduktan sonra daha fazla düzenlemek istiyorsanız kullanışlıdır.",
|
||||
"shareDurationDescription": "Paylaşımın sona ermesinden önceki süre. Kalıcı bir paylaşım için boş bırakın.",
|
||||
"passwordDescription": "Kimliği doğrulanmış kullanıcılar da dahil olmak üzere bu paylaşıma erişmek için gereken isteğe bağlı parola.",
|
||||
"shareThemeColorDescription": "Paylaşımın temasına uygulanan CSS renk değeri (örneğin, kırmızı, #0ea5e9, rgb(14,165,233)).",
|
||||
"shareTitleDescription": "Paylaşım sayfasında gösterilen özel sayfa başlığı.",
|
||||
"shareTitleDescription": "Paylaşım sayfasında gösterilen özel sayfa başlığı. Bu paylaşım bir PWA olarak yüklenirse, uygulama adı 30 karakterle sınırlıdır.",
|
||||
"shareDescriptionHelp": "Paylaşım sayfasında gösterilen kısa açıklama (meta etiketlerde kullanılabilir).",
|
||||
"shareBannerDescription": "Banner resmi URL'si veya istemci tarafından erişilebilen yol -- mutlak veya dizin yolu kabul edilir: örneğin 'https://domain.com/banner.png' veya '/path/to/banner.png'",
|
||||
"shareFaviconDescription": "Favicon URL'si veya istemci tarafından erişilebilen yol -- mutlak veya dizin yolu kabul edilir: örneğin 'https://domain.com/favicon.png' veya '/path/to/favicon.png'",
|
||||
@@ -367,10 +367,10 @@
|
||||
"disableSidebarDescription": "Paylaşılan sayfadaki kenar çubuğunu devre dışı bırakın.",
|
||||
"enforceDarkLightMode": "Tema modunu zorla",
|
||||
"enforceDarkLightModeDescription": "Kullanıcı tercihlerini geçersiz kılarak bu paylaşım için belirli bir tema modunu (koyu veya açık) zorlayın.",
|
||||
"default": "Bir modu zorlamayın",
|
||||
"dark": "Karanlık",
|
||||
"light": "Işık",
|
||||
"enableOnlyOffice": "OnlyOffice görüntüleyiciyi etkinleştirin",
|
||||
"default": "Kullanıcı tercihini kullan",
|
||||
"dark": "Koyu",
|
||||
"light": "Açık",
|
||||
"enableOnlyOffice": "OnlyOffice görüntüleyiciyi etkinleştir",
|
||||
"enableOnlyOfficeDescription": "Bu paylaşımda OnlyOffice kullanarak ofis dosyalarının görüntülenmesine izin verin.",
|
||||
"titleDefault": "Paylaşılan dosyalar - {title}",
|
||||
"defaultViewMode": "Varsayılan görünüm modu",
|
||||
@@ -383,7 +383,7 @@
|
||||
"perUserDownloadLimit": "İndirme sınırını her kullanıcıya uygulayın",
|
||||
"perUserDownloadLimitDescription": "Etkinleştirildiğinde, indirme sınırı her kullanıcıya uygulanacaktır. Anonim kullanıcılar bu paylaşımdan herhangi bir dosya indiremeyecektir.",
|
||||
"descriptionUploadDefault": "Dosyaları yüklemeniz için size bir paylaşım gönderildi.",
|
||||
"extractEmbeddedSubtitles": "Gömülü altyazıları çıkarma",
|
||||
"extractEmbeddedSubtitles": "Gömülü altyazıları çıkar",
|
||||
"extractEmbeddedSubtitlesDescription": "Yüklenen medya dosyalarından gömülü altyazıları ayıklayın -- bu işlem büyük dosyalar için yavaş olabilir.",
|
||||
"disableDownload": "Dosya indirmeyi devre dışı bırak",
|
||||
"disableDownloadDescription": "Hiç kimse dosya indiremeyecek veya bir dosyanın içeriğini görüntüleyemeyecektir.",
|
||||
@@ -396,22 +396,22 @@
|
||||
"allowCreate": "Dosya ve klasör oluşturmaya ve yüklemeye izin ver",
|
||||
"allowCreateDescription": "Herkes bu paylaşımda yeni dosyalar ve klasörler oluşturabilir ve yükleyebilir.",
|
||||
"customizeSidebarLinksButton": "Bağlantıları Özelleştir",
|
||||
"shareInfo": "QR Kodunu ve Bilgilerini Paylaş",
|
||||
"shareInfoDescription": "Bu bağlantı, başlık, açıklama, başlık ve QR kodu dahil olmak üzere paylaşımın bilgilerini bir açılır pencerede görüntüler.",
|
||||
"shareInfo": "Paylaşım QR Kodu ve Bilgisi",
|
||||
"shareInfoDescription": "Bu bağlantı, başlık, açıklama, afiş ve QR kodu dahil olmak üzere paylaşımın bilgilerini bir açılır pencerede görüntüler.",
|
||||
"downloadDescription": "Bu bağlantı, tüm paylaşım içeriğinin sıkıştırılmış bir dosya olarak indirilmesini sağlar.",
|
||||
"disableLoginOption": "Giriş seçeneğini gizle",
|
||||
"disableLoginOptionDescription": "Anonim kullanıcılar için kenar çubuğundaki oturum açma düğmesini gizleyin. Etkinleştirildiğinde, anonim kullanıcılar oturum açma seçeneğini görmez.",
|
||||
"browseFiles": "Dosyalara göz atın",
|
||||
"selectBannerImage": "Afiş resmini seçin",
|
||||
"selectFaviconImage": "Favicon resmini seçin",
|
||||
"browseFiles": "Dosyalara göz at",
|
||||
"selectBannerImage": "Afiş görselini seç",
|
||||
"selectFaviconImage": "Favicon görselini seç",
|
||||
"deleteFailed": "Paylaşım silinemedi",
|
||||
"readOnlySourceNotice": "Bu kaynak salt okunurdur. Yükleme paylaşımları ve dosyaları değiştiren izinler devre dışı bırakılmıştır."
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Oluşturuldu:",
|
||||
"expiresAt": "Son kullanma tarihi:",
|
||||
"expiresAt": "Sona erme:",
|
||||
"permissions": "İzinler:",
|
||||
"tokenDuration": "Token Süresi:",
|
||||
"tokenDuration": "Belirteç Süresi:",
|
||||
"durationNumberPlaceholder": "Sayı",
|
||||
"permissionNote": "Anahtar için en az bir izin seçin. Kullanıcınız da bu izne sahip olmalıdır.",
|
||||
"swaggerLinkText": "swagger sayfası",
|
||||
@@ -421,29 +421,29 @@
|
||||
"apiKeyDeleted": "API belirteci silindi!",
|
||||
"description": "API belirteçleri, onları oluşturan kullanıcıyı temel alır.",
|
||||
"clickToCopyKey": "Belirteci kopyalamak için tıklayın (gizli)",
|
||||
"customizeToken": "Simgeyi Özelleştir",
|
||||
"customizeToken": "Belirteci Özelleştir",
|
||||
"minimalInfo": "Belirteç özelleştirmelerini hariç tutar, izinler ilişkili kullanıcıyla eşleşir ve başka hiçbir özniteliğe sahip olmaz.",
|
||||
"createTitle": "API Belirteci Oluşturma",
|
||||
"createTitle": "API Belirteci Oluştur",
|
||||
"keyNamePlaceholder": "API belirteci için benzersiz bir ad girin",
|
||||
"customizeTokenInfo": "Belirteç izinlerini ve özniteliklerini özelleştirin. Bu, bazı WebDAV istemcilerinde çalışmayabilecek daha uzun bir belirteç oluşturacaktır."
|
||||
"customizeTokenInfo": "Genel belirteç izinlerini özelleştirin (yönetici, API, paylaşım, gerçek zamanlı). Dosya izinleri her zaman kaynak bazında ilişkili kullanıcı hesabından gelir."
|
||||
},
|
||||
"index": {
|
||||
"assessment": "Değerlendirme",
|
||||
"lastScanned": "Son Taranan",
|
||||
"lastScanned": "Son Tarama",
|
||||
"quickScan": "Hızlı Tarama Saniyeleri",
|
||||
"fullScan": "Tam Tarama Saniyeleri",
|
||||
"settingsHover": "Kullanıcı Ayarları",
|
||||
"toggleClick": "Tek Tıklamayı Değiştir",
|
||||
"toggleDark": "Karanlık Modu Aç / Kapat",
|
||||
"toggleSticky": "Yapışkan Modunu Değiştir",
|
||||
"toggleClick": "Tek Tıklamayı Aç/Kapat",
|
||||
"toggleDark": "Koyu Modu Aç/Kapat",
|
||||
"toggleSticky": "Sabit Modu Aç/Kapat",
|
||||
"noSources": "Bu kullanıcı için kullanılabilir kaynak yok. Ya bu kullanıcı için bir kaynak ekleyin ya da defaultEnabled: true ile bir kaynak yapılandırın",
|
||||
"unknown": "Bilinmiyor",
|
||||
"simple": "Basit",
|
||||
"normal": "Normal",
|
||||
"complex": "Kompleks",
|
||||
"highlyComplex": "Son Derece Karmaşık",
|
||||
"complex": "Karmaşık",
|
||||
"highlyComplex": "Çok Karmaşık",
|
||||
"ready": "Hazır",
|
||||
"indexing": "İndeksleme",
|
||||
"indexing": "Dizinleniyor",
|
||||
"unavailable": "Kullanılamıyor"
|
||||
},
|
||||
"otp": {
|
||||
@@ -454,36 +454,36 @@
|
||||
"invalidCodeType": "Doğrulama kodu 6 İngilizce hane olmalıdır",
|
||||
"verificationFailed": "Doğrulama Başarısız",
|
||||
"verificationSucceed": "Doğrulama Başarılı",
|
||||
"generationFailed": "Nesil Başarısız",
|
||||
"generationFailed": "Oluşturma Başarısız",
|
||||
"passwordRequiredForGeneration": "Kimlik doğrulayıcı kodu oluşturmak için parolanız gereklidir."
|
||||
},
|
||||
"general": {
|
||||
"name": "İsim",
|
||||
"path": "Yol",
|
||||
"user": "Kullanıcı",
|
||||
"group": "Grup",
|
||||
"signup": "Kaydolun",
|
||||
"password": "Şifre",
|
||||
"username": "Kullanıcı Adı",
|
||||
"files": "Dosyalar",
|
||||
"folders": "Klasörler",
|
||||
"exit": "Çıkış",
|
||||
"permanent": "Daimi",
|
||||
"hash": "Hash",
|
||||
"of": ".",
|
||||
"name": "İsim{suffix}",
|
||||
"path": "Yol{suffix}",
|
||||
"user": "Kullanıcı{suffix}",
|
||||
"group": "Grup{suffix}",
|
||||
"signup": "Kaydol{suffix}",
|
||||
"password": "Parola{suffix}",
|
||||
"username": "Kullanıcı Adı{suffix}",
|
||||
"files": "Dosyalar{suffix}",
|
||||
"folders": "Klasörler{suffix}",
|
||||
"exit": "Çıkış{suffix}",
|
||||
"permanent": "Kalıcı{suffix}",
|
||||
"hash": "Hash{suffix}",
|
||||
"of": "/{suffix}",
|
||||
"percentage": "{percentage}%",
|
||||
"type": "Tip{suffix}",
|
||||
"type": "Tür{suffix}",
|
||||
"size": "Boyut{suffix}",
|
||||
"home": "Ev{suffix}",
|
||||
"home": "Ana Sayfa{suffix}",
|
||||
"help": "Yardım{suffix}",
|
||||
"login": "Giriş{suffix}",
|
||||
"logout": "Oturum Kapatma{suffix}",
|
||||
"logout": "Çıkış Yap{suffix}",
|
||||
"preview": "Önizleme{suffix}",
|
||||
"settings": "Ayarlar{suffix}",
|
||||
"links": "Bağlantılar{suffix}",
|
||||
"tool": "Alet{suffix}",
|
||||
"tool": "Araç{suffix}",
|
||||
"status": "Durum{suffix}",
|
||||
"analyze": "Analiz{suffix}",
|
||||
"analyze": "Analiz Et{suffix}",
|
||||
"results": "Sonuçlar{suffix}",
|
||||
"users": "Kullanıcılar{suffix}",
|
||||
"photos": "Fotoğraflar",
|
||||
@@ -491,118 +491,118 @@
|
||||
"models": "3D Modeller",
|
||||
"documents": "Belgeler{suffix}",
|
||||
"archives": "Arşivler{suffix}",
|
||||
"images": "Görüntüler{suffix}",
|
||||
"images": "Görseller{suffix}",
|
||||
"search": "Arama{suffix}",
|
||||
"number": "Sayı{suffix}",
|
||||
"types": "Türleri{suffix}",
|
||||
"number": "Numara{suffix}",
|
||||
"types": "Türler{suffix}",
|
||||
"admin": "Yönetici{suffix}",
|
||||
"language": "Dil{suffix}",
|
||||
"dark": "Karanlık{suffix}",
|
||||
"light": "Işık{suffix}",
|
||||
"expires": "Sona erdi{suffix}",
|
||||
"dark": "Koyu{suffix}",
|
||||
"light": "Açık{suffix}",
|
||||
"expires": "Sona eriyor{suffix}",
|
||||
"downloads": "İndirmeler{suffix}",
|
||||
"submit": "Giriş{suffix}",
|
||||
"submit": "Gönder{suffix}",
|
||||
"navigation": "Navigasyon{suffix}",
|
||||
"loading": "Yükleniyor{suffix}",
|
||||
"add": "Ekle{suffix}",
|
||||
"cancel": "İptal{suffix}",
|
||||
"verify": "Doğrulama{suffix}",
|
||||
"verify": "Doğrula{suffix}",
|
||||
"close": "Kapat{suffix}",
|
||||
"copy": "Anlaşıldı{suffix}",
|
||||
"copy": "Kopyala{suffix}",
|
||||
"create": "Oluştur{suffix}",
|
||||
"delete": "Silme{suffix}",
|
||||
"delete": "Sil{suffix}",
|
||||
"download": "İndir{suffix}",
|
||||
"file": "Dosya{suffix}",
|
||||
"folder": "Klasör{suffix}",
|
||||
"info": "Bilgi{suffix}",
|
||||
"move": "Hareket{suffix}",
|
||||
"move": "Taşı{suffix}",
|
||||
"new": "Yeni{suffix}",
|
||||
"next": "Sonraki{suffix}",
|
||||
"ok": "TAMAM.{suffix}",
|
||||
"ok": "Tamam{suffix}",
|
||||
"previous": "Önceki{suffix}",
|
||||
"rename": "Yeniden Adlandır{suffix}",
|
||||
"replace": "Değiştirin{suffix}",
|
||||
"replace": "Değiştir{suffix}",
|
||||
"save": "Kaydet{suffix}",
|
||||
"select": "Seçiniz{suffix}",
|
||||
"select": "Seç{suffix}",
|
||||
"share": "Paylaş{suffix}",
|
||||
"update": "Güncelleme{suffix}",
|
||||
"update": "Güncelle{suffix}",
|
||||
"upload": "Yükle{suffix}",
|
||||
"openFile": "Dosya aç{suffix}",
|
||||
"edit": "Düzenle{suffix}",
|
||||
"pause": "Duraklat{suffix}",
|
||||
"resume": "Özgeçmiş{suffix}",
|
||||
"resume": "Devam Et{suffix}",
|
||||
"retry": "Yeniden Dene{suffix}",
|
||||
"disable": "Devre dışı bırak{suffix}",
|
||||
"confirm": "Onaylayın{suffix}",
|
||||
"stay": "Kalmak{suffix}",
|
||||
"scopes": "Dürbünler{suffix}",
|
||||
"uploading": "Yükleme{suffix}",
|
||||
"confirm": "Onayla{suffix}",
|
||||
"stay": "Kal{suffix}",
|
||||
"scopes": "Kapsamlar{suffix}",
|
||||
"uploading": "Yükleniyor{suffix}",
|
||||
"paused": "Duraklatıldı{suffix}",
|
||||
"conflict": "Çatışma{suffix}",
|
||||
"change": "Değişim{suffix}",
|
||||
"lines": "Çizgiler{suffix}",
|
||||
"conflict": "Çakışma{suffix}",
|
||||
"change": "Değiştir{suffix}",
|
||||
"lines": "Satırlar{suffix}",
|
||||
"lastUpdate": "Son Güncelleme{suffix}",
|
||||
"latency": "Gecikme{suffix}",
|
||||
"all": "Tümü{suffix}",
|
||||
"acknowledge": "Onaylamak{suffix}",
|
||||
"expiration": "Son kullanma tarihi{suffix}",
|
||||
"acknowledge": "Onayla{suffix}",
|
||||
"expiration": "Sona erme{suffix}",
|
||||
"zoom": "Yakınlaştır{suffix}",
|
||||
"background": "Arka plan{suffix}",
|
||||
"reset": "Sıfırla{suffix}",
|
||||
"space": "Uzay{suffix}",
|
||||
"space": "Alan{suffix}",
|
||||
"format": "Biçim{suffix}",
|
||||
"office": "Ofis{suffix}",
|
||||
"divider": "Bölücü{suffix}",
|
||||
"divider": "Ayırıcı{suffix}",
|
||||
"audio": "Ses{suffix}",
|
||||
"readOnly": "Salt okunur{suffix}",
|
||||
"private": "Özel{suffix}",
|
||||
"yes": "Evet{suffix}",
|
||||
"no": "Hayır{suffix}",
|
||||
"to": "...'ye{suffix}",
|
||||
"to": "-e{suffix}",
|
||||
"and": "ve{suffix}",
|
||||
"or": "veya{suffix}",
|
||||
"camera": "Kamera{suffix}",
|
||||
"video": "Video{suffix}",
|
||||
"anonymous": "isimsiz",
|
||||
"anonymous": "anonim",
|
||||
"details": "Ayrıntılar{suffix}",
|
||||
"ipAddress": "IP adresi{suffix}",
|
||||
"paths": "Yollar{suffix}",
|
||||
"browse": "Göz at{suffix}",
|
||||
"error": "Hata{suffix}",
|
||||
"value": "Değer{suffix}",
|
||||
"selected": "{prefix}seçilen{suffix}",
|
||||
"selected": "{prefix}seçili{suffix}",
|
||||
"pinned": "Sabitlenmiş{suffix}",
|
||||
"created": "Oluşturuldu{suffix}",
|
||||
"actions": "Eylemler{suffix}",
|
||||
"enabled": "Etkinleştirildi{suffix}",
|
||||
"disabled": "Engelli{suffix}",
|
||||
"disabled": "Devre dışı{suffix}",
|
||||
"permissions": "İzinler{suffix}",
|
||||
"management": "Yönetim{suffix}",
|
||||
"profile": "Profil{suffix}",
|
||||
"global": "Küresel{suffix}",
|
||||
"global": "Genel{suffix}",
|
||||
"theme": "Tema{suffix}",
|
||||
"pinnedFolders": "Sabitlenmiş klasörler",
|
||||
"pinnedFiles": "Sabitlenmiş dosyalar",
|
||||
"selectionSingle": "seçilen öğe",
|
||||
"selectionMultiple": "seçilen öğeler",
|
||||
"selectionSingle": "öğe seçildi",
|
||||
"selectionMultiple": "öğe seçildi",
|
||||
"newUser": "Yeni kullanıcı",
|
||||
"newFolder": "Yeni klasör",
|
||||
"profileSettings": "Profil ayarları",
|
||||
"shareSettings": "Ayarları paylaş",
|
||||
"shareSettings": "Paylaşım ayarları",
|
||||
"globalSettings": "Genel ayarlar",
|
||||
"userManagement": "Kullanıcı yönetimi",
|
||||
"shareManagement": "Hisse yönetimi",
|
||||
"shareHash": "Hash'i paylaş",
|
||||
"shareManagement": "Paylaşım yönetimi",
|
||||
"shareHash": "Paylaşım hash'i",
|
||||
"downloadFiles": "Dosyaları indir",
|
||||
"editFiles": "Dosyaları düzenle",
|
||||
"createFiles": "Dosya oluştur",
|
||||
"deleteFiles": "Dosyaları sil",
|
||||
"shareFiles": "Dosya paylaşımı",
|
||||
"shareTheme": "Temayı paylaş",
|
||||
"shareTitle": "Başlığı paylaş",
|
||||
"shareTheme": "Paylaşım teması",
|
||||
"shareTitle": "Paylaşım başlığı",
|
||||
"allUsers": "Tüm kullanıcılar",
|
||||
"allSources": "Tüm kaynaklar",
|
||||
"allShares": "Tüm hisseler",
|
||||
"allShares": "Tüm paylaşımlar",
|
||||
"playPause": "Oynat/Duraklat",
|
||||
"clearSelection": "Seçimi temizle",
|
||||
"interval": "Aralık{suffix}",
|
||||
@@ -625,7 +625,7 @@
|
||||
"totalDenied": "Reddedildi",
|
||||
"totalAllowed": "İzin verildi",
|
||||
"all": "Tümünü Reddet",
|
||||
"defaultBehaviorDescription": "Bu, bir kullanıcı belirli erişim kurallarının bulunmadığı bir yola erişmeye çalıştığında ne olacağını gösterir. 'Allow' kullanıcıların varsayılan olarak erişebileceği anlamına gelir, 'Deny' ise açıkça izin verilmediği sürece kullanıcıların varsayılan olarak engellendiği anlamına gelir.",
|
||||
"defaultBehaviorDescription": "Bu, bir kullanıcı belirli erişim kurallarının bulunmadığı bir yola erişmeye çalıştığında ne olacağını gösterir. 'İzin ver' kullanıcıların varsayılan olarak erişebileceği, 'Reddet' ise açıkça izin verilmediği sürece kullanıcıların varsayılan olarak engellendiği anlamına gelir.",
|
||||
"defaultBehavior": "Varsayılan eylem{suffix}",
|
||||
"deletedCascade": "Erişim kuralları yoldan ve tüm alt yollardan silindi!",
|
||||
"cascadeDelete": "Yinelemeli Silme",
|
||||
@@ -635,9 +635,9 @@
|
||||
"title": "Yüklemeler & İndirmeler",
|
||||
"maxConcurrentUpload": "Maksimum eşzamanlı yükleme",
|
||||
"maxConcurrentUploadHelp": "Eşzamanlı yüklemelerin maksimum sayısı. Daha yüksek değerler genellikle daha iyi performans gösterir, ancak bu birçok faktöre bağlıdır.",
|
||||
"uploadChunkSizeMb": "MB cinsinden yığın boyutu yükleme",
|
||||
"uploadChunkSizeMb": "MB cinsinden yükleme yığın boyutu",
|
||||
"uploadChunkSizeMbHelp": "Tipik olarak 5 ila 50 MB, daha küçük kararsız veya kısıtlı bağlantılar için daha iyidir. 0 olarak ayarlandığında yükleme yığınlaması devre dışı bırakılır.",
|
||||
"clearAll": "Clear completed hata, duraklama ve çakışmayı kaldırmalıdır",
|
||||
"clearAll": "Tamamlananları temizle; hata, duraklatma ve çakışmaları da kaldırmalı",
|
||||
"clearAllDescription": "Tamamlananları temizle düğmesi hata, duraklatılmış ve çakışma durumları da dahil olmak üzere bitmiş durumdaki tüm yüklemeleri temizler.",
|
||||
"uploadSettings": "Yükleme Ayarları",
|
||||
"downloadChunkSizeMb": "MB cinsinden indirme yığın boyutu",
|
||||
@@ -648,7 +648,7 @@
|
||||
"green": "yeşil",
|
||||
"blue": "mavi",
|
||||
"yellow": "sarı",
|
||||
"violet": "menekşe",
|
||||
"violet": "mor",
|
||||
"orange": "turuncu"
|
||||
},
|
||||
"profileSettings": {
|
||||
@@ -659,34 +659,34 @@
|
||||
"deleteAfterArchive": "Arşiv oluşturma/çıkarma işleminden sonra kaynak dosyaları sil",
|
||||
"deleteAfterArchiveDescription": "Etkinleştirildiğinde, arşivlerin başarıyla oluşturulması/çıkarılmasından sonra kaynak dosyaları siler",
|
||||
"hideFilesInTree": "Ağaç gezintisinde dosyaları gizle",
|
||||
"hideFilesInTreeDescription": "Etkinleştirildiğinde, kenar çubuğu Ağaç Gezintisinde yalnızca klasörler gösterilir",
|
||||
"setDateFormat": "Tam tarih biçimini ayarlama",
|
||||
"hideFilesInTreeDescription": "Etkinleştirildiğinde, kenar çubuğu Ağaç Gezintisinde yalnızca klasörler gösterilir.",
|
||||
"setDateFormat": "Tam tarih biçimini ayarla",
|
||||
"showHiddenFiles": "Gizli dosyaları göster",
|
||||
"showHiddenFilesDescription": "Gizli dosyaları listede gösterin (örn. .thumbnails, ProgramData), ancak dizine eklenecek şekilde yapılandırılmışlarsa yine de manuel olarak erişilebilirler.",
|
||||
"showQuickDownload": "Hızlı erişim için indirme simgesini göster",
|
||||
"showQuickDownloadDescription": "Anında indirmek için tıklanabilecek her dosya öğesinde hızlı erişim için indirme simgesini gösterin.",
|
||||
"disableUpdateNotifications": "Bildirim güncellemesini göstermeyi devre dışı bırak",
|
||||
"disableUpdateNotificationsDescription": "Kenar çubuğunda yönetici kullanıcılar için gösterilen güncelleme bildirim başlığını devre dışı bırakın.",
|
||||
"disableHideSidebar": "Dosyaları önizlerken veya düzenlerken kenar çubuğunu açık tutma",
|
||||
"disableHideSidebar": "Dosyaları önizlerken veya düzenlerken kenar çubuğunu açık tut",
|
||||
"disableHideSidebarDescription": "Etkinleştirildiğinde, dosyaları önizlerken veya düzenlerken kenar çubuğu otomatik olarak gizlenmez.",
|
||||
"autoplayMedia": "Medya dosyalarını görüntülerken otomatik oynatma",
|
||||
"autoplayMedia": "Medya dosyalarını görüntülerken otomatik oynat",
|
||||
"autoplayMediaDescription": "Medya dosyalarını görüntülerken otomatik oynat. Bu yalnızca dosya bir medya dosyasıysa çalışacaktır.",
|
||||
"sidebarOptions": "Kenar çubuğu seçenekleri",
|
||||
"disableQuickToggles": "Hızlı geçişleri devre dışı bırakma",
|
||||
"disableQuickToggles": "Hızlı geçişleri devre dışı bırak",
|
||||
"disableQuickTogglesDescription": "Kenar çubuğunda görünen hızlı geçişleri devre dışı bırakın.",
|
||||
"disableSearchOptions": "Arama seçeneklerini devre dışı bırak",
|
||||
"disableSearchOptionsDescription": "Kenar çubuğunda görünen arama seçeneklerini devre dışı bırakın.",
|
||||
"hideSidebarFileActions": "Kenar çubuğundaki dosya eylemleri düğmesini gizle",
|
||||
"deleteWithoutConfirming": "Dosyaları onay istemi olmadan silme",
|
||||
"deleteWithoutConfirming": "Dosyaları onay istemi olmadan sil",
|
||||
"deleteWithoutConfirmingDescription": "Dosyaları onay istemi olmadan silin. Bu yalnızca dosya bir medya dosyasıysa çalışacaktır.",
|
||||
"editorQuickSave": "Düzenleyicide hızlı kaydetme düğmesi",
|
||||
"editorQuickSaveDescription": "Metin düzenleyici her zaman kaydet simgesini gösterecek ve diğer eylemleri gizleyecektir",
|
||||
"previewOfficeDescription": "Liste görünümünde ofis dosya türleri için küçük resimleri gösterme",
|
||||
"disableThumbnailPreviews": "Belirli dosya uzantıları için küçük resimleri devre dışı bırakma",
|
||||
"previewOfficeDescription": "Liste görünümünde ofis dosya türleri için küçük resimleri göster",
|
||||
"disableThumbnailPreviews": "Belirli dosya uzantıları için küçük resimleri devre dışı bırak",
|
||||
"disableThumbnailPreviewsDescription": "Küçük resim önizlemelerinin devre dışı bırakılacağı dosya uzantılarının boşluk bırakılarak ayrılmış listesi (örn. '.txt .html').",
|
||||
"disableViewingFiles": "Belirli dosya uzantıları için dosya görüntüleyiciyi/editörü devre dışı bırakma",
|
||||
"disableViewingFiles": "Belirli dosya uzantıları için dosya görüntüleyiciyi/düzenleyiciyi devre dışı bırak",
|
||||
"disableViewingFilesDescription": "Dosya görüntüleyici/düzenleyicinin devre dışı bırakılacağı dosya uzantılarının boşluk bırakılarak ayrılmış listesi (örn. '.txt .pdf').",
|
||||
"disableOfficeEditor": "Belirli dosya uzantıları için ofis görüntüleyiciyi devre dışı bırakma",
|
||||
"disableOfficeEditor": "Belirli dosya uzantıları için ofis görüntüleyiciyi devre dışı bırak",
|
||||
"defaultThemeDescription": "default - Varsayılan tema",
|
||||
"customTheme": "Temanızı seçin",
|
||||
"showSelectMultiple": "Masaüstündeki bağlam menüsünde çoklu seçmeyi göster",
|
||||
@@ -723,9 +723,9 @@
|
||||
"showToolsInSidebar": "Araçları kenar çubuğunda göster",
|
||||
"showToolsInSidebarDescription": "Araçlar bağlantısını her zaman kenar çubuğunda gösterin.",
|
||||
"enforcedByAdmin": "Yöneticiniz, kullanıcıların bu özelliği değiştirmesini engellemiştir",
|
||||
"singleClick": "Dosyaları tek tıklamayla açın",
|
||||
"singleClick": "Dosyaları tek tıklamayla aç",
|
||||
"stickySidebar": "Sabit kenar çubuğu",
|
||||
"darkMode": "Karanlık mod"
|
||||
"darkMode": "Koyu mod"
|
||||
},
|
||||
"editor": {
|
||||
"uninitialized": "Düzenleyici başlatılamadı. Lütfen yeniden yükleyin.",
|
||||
@@ -750,8 +750,8 @@
|
||||
"emptyQueue": "Kuyruk boş",
|
||||
"queueCleared": "Kuyruk temizlendi",
|
||||
"queue": "Kuyruk",
|
||||
"lyrics": "Şarkı sözü",
|
||||
"noLyrics": "Şarkı sözü mevcut değil",
|
||||
"lyrics": "Şarkı sözleri",
|
||||
"noLyrics": "Şarkı sözü bulunamadı",
|
||||
"lockLyrics": "Şarkı sözlerini kilitle",
|
||||
"unlockLyrics": "Şarkı sözlerinin kilidini aç",
|
||||
"toggleLyrics": "Şarkı sözlerini göster/gizle",
|
||||
@@ -782,8 +782,8 @@
|
||||
}
|
||||
},
|
||||
"fileSizeAnalyzer": {
|
||||
"title": "Dosya Boyutu Analizörü",
|
||||
"largerThan": "Daha Büyük (MB)",
|
||||
"title": "Dosya Boyutu Analizcisi",
|
||||
"largerThan": "Şundan Büyük (MB)",
|
||||
"includeFolders": "Klasörleri Dahil Et",
|
||||
"totalFiles": "Toplam Dosya{suffix}",
|
||||
"totalSize": "Toplam Boyut{suffix}",
|
||||
@@ -791,7 +791,7 @@
|
||||
"completeResults": "Tam sonuçlar gösterilmektedir!",
|
||||
"incompleteResults": "Sonuçlar eksik olabilir",
|
||||
"relativePercentage": "Göreceli Yüzde{suffix}",
|
||||
"percentageOfResults": "{percentage}Sonuçların %'si",
|
||||
"percentageOfResults": "sonuçların %{percentage}'i",
|
||||
"includeFoldersDescription": "Analize klasörleri dahil et"
|
||||
},
|
||||
"fileTypes": {
|
||||
@@ -806,7 +806,7 @@
|
||||
"tools": {
|
||||
"description": "Dosyalarınız için yardımcı programlar ve analiz araçları",
|
||||
"sizeAnalyzer": {
|
||||
"name": "Dosya Boyutu Analizörü",
|
||||
"name": "Dosya Boyutu Analizcisi",
|
||||
"description": "Etkileşimli bir ağaç haritası ile büyük dosya ve klasörleri görselleştirin"
|
||||
},
|
||||
"title": "Araçlar",
|
||||
@@ -815,15 +815,15 @@
|
||||
"description": "Depolama alanını geri kazanmak için yinelenen dosyaları bulun ve yönetin"
|
||||
},
|
||||
"materialIconPicker": {
|
||||
"name": "Malzeme Simge Seçici",
|
||||
"description": "Canlı önizleme ile Materyal Simgelerine göz atın ve arayın",
|
||||
"searchPlaceholder": "Arama simgeleri...",
|
||||
"popularIcons": "{count} popüler simgeler gösteriliyor",
|
||||
"showingResults": "{count} sonuçları gösteriliyor",
|
||||
"name": "Material Simge Seçici",
|
||||
"description": "Material Icons simgelerine canlı önizleme ile göz atın ve arayın",
|
||||
"searchPlaceholder": "Simge ara...",
|
||||
"popularIcons": "{count} popüler simge gösteriliyor",
|
||||
"showingResults": "{count} sonuç gösteriliyor",
|
||||
"noResults": "Simge bulunamadı",
|
||||
"tryDifferentSearch": "Farklı bir arama terimi deneyin",
|
||||
"custom": "Özel",
|
||||
"useCustomIcon": "Özel simge kullanın: {name}",
|
||||
"useCustomIcon": "Özel simge kullan: {name}",
|
||||
"iconLibraryUrl": "fonts.google.com/icons",
|
||||
"browseFullLibrary": "Simge kitaplığının tamamına göz atın"
|
||||
},
|
||||
@@ -832,16 +832,16 @@
|
||||
"fileWatcher": {
|
||||
"name": "Dosya İzleyici",
|
||||
"description": "Gecikme izleme ile dosyaları gerçek zamanlı olarak izleyin ve takip edin",
|
||||
"emptyState": "Bir dosya seçin ve dosya değişikliklerini izlemeye başlamak için oynat'a tıklayın",
|
||||
"emptyState": "Bir dosya seçin ve dosya değişikliklerini izlemeye başlamak için Oynat'a tıklayın",
|
||||
"chooseFile": "Bir dosya seçin"
|
||||
},
|
||||
"advancedSearch": {
|
||||
"name": "Gelişmiş Arama",
|
||||
"description": "Kaynaklar, filtreler ve seçenekler üzerinde tam kontrol ile dizinde arama yapın",
|
||||
"searchTerms": "Arama terimleri",
|
||||
"matchAllTerms": "Tüm terimleri eşleştirin",
|
||||
"matchAllTerms": "Tüm terimleri eşleştir",
|
||||
"matchAllTermsDescription": "Etkinleştirildiğinde, her dosya için tüm arama terimleri bulunmalıdır",
|
||||
"scopeAria": "Aramayı bir klasörle sınırlandırın",
|
||||
"scopeAria": "Aramayı bir klasörle sınırla",
|
||||
"noTerms": "En az bir arama terimi girin.",
|
||||
"termTooShort": "Her bir arama terimi en az {minSearchLength} karakter olmalıdır",
|
||||
"resultsTitle": "Arama sonuçları",
|
||||
@@ -849,7 +849,7 @@
|
||||
"noResults": "Eşleşen dosya veya klasör yok."
|
||||
},
|
||||
"activityViewer": {
|
||||
"name": "Etkinlik Görüntüleyicisi",
|
||||
"name": "Etkinlik Görüntüleyici",
|
||||
"description": "İndirmeler, dosya değişiklikleri, paylaşımlar ve yönetici işlemleri kapsamındaki kullanıcı etkinliklerini görüntüleyin ve dışa aktarın",
|
||||
"activityScope": "Etkinlik kategorisi",
|
||||
"timeRange": "Zaman aralığı",
|
||||
@@ -861,10 +861,10 @@
|
||||
"eventType": "Etkinlik türü",
|
||||
"eventSummary": "Etkinlik",
|
||||
"interval": "Zaman aralığı",
|
||||
"splitBy": "Şu kriterlere göre ayır",
|
||||
"splitBy": "Şuna göre ayır",
|
||||
"ungrouped": "Gruplama yok (toplamlar)",
|
||||
"splitByTotal": "Toplam (bölünmemiş)",
|
||||
"viewType": "Görüntüle",
|
||||
"viewType": "Görünüm",
|
||||
"chartView": "Çubuk grafik",
|
||||
"lineView": "Çizgi grafiği",
|
||||
"pieView": "Pasta grafik",
|
||||
@@ -873,39 +873,39 @@
|
||||
"exportCsv": "CSV'yi Dışa Aktar",
|
||||
"totalEvents": "Toplam etkinlik sayısı{suffix}",
|
||||
"cachedResult": "Önbelleğe alınmış sonuç",
|
||||
"showingPage": "{total} adresindeki {shown} sayfası görüntüleniyor (sayfa {page}/{pages})",
|
||||
"pageOf": "{page}. sayfası {pages}",
|
||||
"showingPage": "{total} sonuçtan {shown} tanesi gösteriliyor (sayfa {page}/{pages})",
|
||||
"pageOf": "Sayfa {page} / {pages}",
|
||||
"pathFilter": "Yol filtresi",
|
||||
"pathFilterMode": "Şu kriterlere göre filtrele",
|
||||
"pathFilterMode": "Şuna göre filtrele",
|
||||
"pathFilterPattern": "Desen",
|
||||
"pathGlob": "Yol kalıbı (glob)",
|
||||
"shareFilter": "Filtreyi paylaş",
|
||||
"passkeyRegister": "Şifre eklendi",
|
||||
"passkeyDelete": "Şifre kaldırıldı",
|
||||
"shareFilter": "Paylaşım filtresi",
|
||||
"passkeyRegister": "Geçiş anahtarı eklendi",
|
||||
"passkeyDelete": "Geçiş anahtarı kaldırıldı",
|
||||
"webSession": "Web oturumu",
|
||||
"actorToken": "Aktör belirteci",
|
||||
"affectedToken": "Etkilenen token",
|
||||
"activityOverTime": "Zaman içindeki faaliyet",
|
||||
"activityOverTimeBy": "Zaman içindeki faaliyetler, şuna göre: {subject}",
|
||||
"activityBy": "Etkinlik düzenleyen {subject}",
|
||||
"affectedToken": "Etkilenen belirteç",
|
||||
"activityOverTime": "Zaman içindeki etkinlik",
|
||||
"activityOverTimeBy": "{subject} bazında zaman içindeki etkinlik",
|
||||
"activityBy": "{subject} bazında etkinlik",
|
||||
"eventTotals": "Etkinlik toplamları",
|
||||
"activityTotalsBy": "Etkinlik toplamları, şuna göre: {subject}",
|
||||
"activityTotalsBy": "{subject} bazında etkinlik toplamları",
|
||||
"subjectEventType": "etkinlik türü",
|
||||
"viewActivity": "Etkinliği görüntüle",
|
||||
"tableColumns": "Tablo sütunları",
|
||||
"scopeAll": "Tüm etkinlikler",
|
||||
"scopeFiles": "Dosya etkinliği",
|
||||
"scopeShares": "Etkinliği paylaş",
|
||||
"scopeShares": "Paylaşım etkinliği",
|
||||
"eventBulkDelete": "Toplu silme",
|
||||
"eventShareCreate": "Paylaş Oluştur",
|
||||
"eventShareUpdate": "Güncellemeyi paylaş",
|
||||
"eventShareDelete": "Paylaş Sil",
|
||||
"eventShareCreate": "Paylaşım oluşturma",
|
||||
"eventShareUpdate": "Paylaşım güncelleme",
|
||||
"eventShareDelete": "Paylaşım silme",
|
||||
"eventUserCreate": "Kullanıcı oluşturma",
|
||||
"eventUserUpdate": "Kullanıcı güncellemesi",
|
||||
"eventUserDelete": "Kullanıcı silme",
|
||||
"eventAccessUpdate": "Erişim güncellemesi",
|
||||
"eventTokenCreate": "Jeton oluşturma",
|
||||
"eventTokenDelete": "Jeton silme",
|
||||
"eventTokenCreate": "Belirteç oluşturma",
|
||||
"eventTokenDelete": "Belirteç silme",
|
||||
"webSessionNamed": "Web oturumu ({name})",
|
||||
"scopeAccess": "Erişim etkinliği",
|
||||
"eventAccessCreate": "Erişim oluştur",
|
||||
@@ -924,10 +924,10 @@
|
||||
"duplicateFinder": {
|
||||
"minSize": "Minimum Boyut (MB){suffix}",
|
||||
"minSizeHint": "Yalnızca bu boyuttan (megabayt cinsinden) büyük dosyaları analiz edin",
|
||||
"findDuplicates": "Kopyaları Bul",
|
||||
"findDuplicates": "Yinelenenleri Bul",
|
||||
"groupsFound": "Yinelenen Gruplar Bulundu{suffix}",
|
||||
"totalWastedSpace": "Toplam Boşa Harcanan Alan{suffix}",
|
||||
"wasted": "Ziyan{suffix}",
|
||||
"wasted": "Boşa Harcanan{suffix}",
|
||||
"emptyState": "Yinelenen dosyaları belirlemek için arama kriterlerini girin ve Yinelenenleri Bul'a tıklayın"
|
||||
},
|
||||
"notifications": {
|
||||
@@ -938,11 +938,11 @@
|
||||
"appEnabled": "Uygulama bildirimleri",
|
||||
"appEnabledDescription": "Bu sekme arka planda iken dosya işlemleri tamamlandığında tarayıcı bildirimlerini göster. Tarayıcı izni gerektirir. Yalnızca bu tarayıcıda saklanır.",
|
||||
"appUnsupported": "Bu tarayıcıda uygulama bildirimleri desteklenmemektedir.",
|
||||
"permissionGranted": "izin verilen",
|
||||
"permissionGranted": "izin verildi",
|
||||
"permissionDeniedHelp": "Bildirimler engellenmiştir. Bu site için tarayıcı ayarlarınızdan bildirimleri etkinleştirin.",
|
||||
"uploadTitle": "Yükleme tamamlandı",
|
||||
"downloadTitle": "Tam sürümü indir",
|
||||
"moveTitle": "İşlem tamamlandı",
|
||||
"downloadTitle": "İndirme tamamlandı",
|
||||
"moveTitle": "Taşıma tamamlandı",
|
||||
"copyTitle": "Kopyalama tamamlandı",
|
||||
"uploadFailedTitle": "Yükleme başarısız",
|
||||
"downloadFailedTitle": "İndirme başarısız",
|
||||
@@ -955,13 +955,13 @@
|
||||
"connectionLost": "Sunucu ile bağlantı kesildi. Yeniden bağlanmaya çalışıyorum..."
|
||||
},
|
||||
"threejs": {
|
||||
"failedToLoad": "3B Model Yüklenemedi",
|
||||
"failedToLoad": "3D Model Yüklenemedi",
|
||||
"keyboard": "Klavye:",
|
||||
"autoRotate": "Otomatik döndürme",
|
||||
"rotateY": "Y Döndür",
|
||||
"rotateX": "X'i döndür",
|
||||
"rotateX": "X Döndür",
|
||||
"controls": "3D Kontroller",
|
||||
"changeBackground": "Arka plan rengini değiştirme"
|
||||
"changeBackground": "Arka plan rengini değiştir"
|
||||
},
|
||||
"onlyoffice": {
|
||||
"debugTitle": "OnlyOffice Hata Ayıklama İzi",
|
||||
@@ -979,11 +979,11 @@
|
||||
"onlyOffice": "OnlyOffice",
|
||||
"fileBrowser": "FileBrowser",
|
||||
"processSteps": "Süreç Adımları",
|
||||
"entries": "girişler",
|
||||
"entries": "kayıt",
|
||||
"internalUrl": "Dahili URL",
|
||||
"userRequest": "Kullanıcı Talebi",
|
||||
"logsNotAvailable": "Arka uç günlükleri mevcut değil -- arka uç günlüklerini görüntülemek için kullanıcının yönetici olması gerekir",
|
||||
"waitingForLogs": "Arka uç günlüklerini bekliyorum...",
|
||||
"waitingForLogs": "Arka uç günlükleri bekleniyor...",
|
||||
"errorDetected": "Hata Algılandı",
|
||||
"integrationFailed": "OnlyOffice entegrasyonu başarısız oldu. Yukarıdaki başarısız adımları kontrol edin.",
|
||||
"documentInitialized": "Belge Başlatıldı",
|
||||
@@ -991,26 +991,26 @@
|
||||
"troubleshootingGuide": "Sorun Giderme Kılavuzunu Görüntüle",
|
||||
"startingInit": "OnlyOffice başlatılıyor...",
|
||||
"configCheck": "Yapılandırma Kontrolü - URL Oluşturuldu",
|
||||
"apiRequest": "API İsteği - Konfigürasyon Alındı",
|
||||
"serverConnection": "OnlyOffice Sunucu Bağlantısı - Konfigürasyon Gönderildi",
|
||||
"testingConnectivity": "OnlyOffice sunucu bağlantısını test etme...",
|
||||
"apiRequest": "API İsteği - Yapılandırma Alındı",
|
||||
"serverConnection": "OnlyOffice Sunucu Bağlantısı - Yapılandırma Gönderildi",
|
||||
"testingConnectivity": "OnlyOffice sunucu bağlantısı test ediliyor...",
|
||||
"serverReachable": "OnlyOffice sunucusuna erişilebilir görünüyor",
|
||||
"documentDownload": "Belge İndirme - Tamamlandı",
|
||||
"editorSuccess": "Editör Başlatma - Başarılı! Tüm adımlar tamamlandı.",
|
||||
"editorSuccess": "Düzenleyici Başlatma - Başarılı! Tüm adımlar tamamlandı.",
|
||||
"setupError": "Kurulum Hatası"
|
||||
},
|
||||
"pwa": {
|
||||
"install": "Uygulamayı yükle"
|
||||
},
|
||||
"time": {
|
||||
"time": "Zaman{suffix}",
|
||||
"minute": "dakika{suffix}",
|
||||
"minutes": "Tutanak{suffix}",
|
||||
"hour": "saat{suffix}",
|
||||
"hours": "Çalışma Saatleri{suffix}",
|
||||
"day": "gün{suffix}",
|
||||
"days": "Günler{suffix}",
|
||||
"months": "Aylar{suffix}",
|
||||
"time": "{prefix}Zaman{suffix}",
|
||||
"minute": "{prefix}dakika{suffix}",
|
||||
"minutes": "{prefix}Dakika{suffix}",
|
||||
"hour": "{prefix}saat{suffix}",
|
||||
"hours": "{prefix}Saat{suffix}",
|
||||
"day": "{prefix}gün{suffix}",
|
||||
"days": "{prefix}Gün{suffix}",
|
||||
"months": "{prefix}Ay{suffix}",
|
||||
"timeUnit": "Zaman birimi"
|
||||
}
|
||||
}
|
||||
+37
-53
@@ -1,6 +1,5 @@
|
||||
import { getters, mutations, state } from "@/store";
|
||||
import { globalVars } from "@/utils/constants";
|
||||
import { getCookie } from "@/utils/cookie.js";
|
||||
import { getApiPath } from "@/utils/url.js";
|
||||
|
||||
/** Session JWT: renew when within 30 minutes of expiry (former X-Renew-Token threshold). */
|
||||
@@ -14,6 +13,29 @@ const KEEP_ALIVE_INTERVAL_MS = 60 * 1000;
|
||||
|
||||
let keepAliveTimer = null;
|
||||
let renewInFlight = null;
|
||||
let sessionExpiresAt = null;
|
||||
|
||||
function decodeJwtExp(token) {
|
||||
if (!token) {
|
||||
return null;
|
||||
}
|
||||
const parts = token.split(".");
|
||||
if (parts.length < 2) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const padded = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
||||
const padLength = (4 - (padded.length % 4)) % 4;
|
||||
const payload = JSON.parse(atob(padded + "=".repeat(padLength)));
|
||||
return typeof payload.exp === "number" ? payload.exp : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function setSessionExpiresAtFromToken(token) {
|
||||
sessionExpiresAt = decodeJwtExp(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number|null|undefined} expiresAtSeconds Unix expiry in seconds
|
||||
@@ -36,36 +58,9 @@ export function shouldRefreshBeforeExpiry(expiresAtSeconds, refreshBeforeMs) {
|
||||
return msUntilRefresh(expiresAtSeconds, refreshBeforeMs) === 0;
|
||||
}
|
||||
|
||||
function decodeBase64UrlJson(segment) {
|
||||
const padded = segment.replace(/-/g, "+").replace(/_/g, "/");
|
||||
const padLength = (4 - (padded.length % 4)) % 4;
|
||||
const base64 = padded + "=".repeat(padLength);
|
||||
return JSON.parse(atob(base64));
|
||||
}
|
||||
|
||||
/** Unix `exp` from the session JWT cookie, or null if missing/unreadable. */
|
||||
/** Unix `exp` tracked from the last successful renew response, or null if unknown. */
|
||||
export function getSessionJwtExpiresAt() {
|
||||
const raw = getCookie(SESSION_COOKIE_NAME);
|
||||
if (!raw) {
|
||||
return null;
|
||||
}
|
||||
// Cookie value may be URI-encoded depending on how it was set.
|
||||
let token = raw;
|
||||
try {
|
||||
token = decodeURIComponent(raw);
|
||||
} catch {
|
||||
// use raw
|
||||
}
|
||||
const parts = token.split(".");
|
||||
if (parts.length < 2) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const payload = decodeBase64UrlJson(parts[1]);
|
||||
return typeof payload.exp === "number" ? payload.exp : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
return sessionExpiresAt;
|
||||
}
|
||||
|
||||
export async function validateLogin(isPublicRoute = false) {
|
||||
@@ -80,19 +75,11 @@ export async function validateLogin(isPublicRoute = false) {
|
||||
});
|
||||
|
||||
if (res.status !== 200) {
|
||||
// A 401 from the non-public self check means our session cookie (JWT) is no
|
||||
// longer valid — typically it expired. Clear it and redirect to login so the
|
||||
// user can re-authenticate, instead of leaving the stale cookie in place
|
||||
// (which otherwise leaves the app stuck on reload). Only do this for a real,
|
||||
// non-public session: public routes legitimately 401 for anonymous share
|
||||
// visitors, and we skip it when there is no session cookie to clear.
|
||||
if (
|
||||
res.status === 401 &&
|
||||
!isPublicRoute &&
|
||||
document.cookie
|
||||
.split(";")
|
||||
.some((c) => c.trim().startsWith(`${SESSION_COOKIE_NAME}=`))
|
||||
) {
|
||||
// A 401 from the non-public self check means our session is no longer valid —
|
||||
// typically the HttpOnly JWT cookie expired. Redirect to login when the app
|
||||
// still considers the user logged in (public routes legitimately 401 for
|
||||
// anonymous share visitors).
|
||||
if (res.status === 401 && !isPublicRoute && getters.isLoggedIn()) {
|
||||
sessionExpired();
|
||||
}
|
||||
throw new Error(`{"status":${res.status},"message":"${await res.text()}"}`);
|
||||
@@ -136,6 +123,7 @@ export async function renew() {
|
||||
});
|
||||
const body = await res.text();
|
||||
if (res.status === 200) {
|
||||
setSessionExpiresAtFromToken(body);
|
||||
mutations.setSession(generateRandomCode(8));
|
||||
return;
|
||||
}
|
||||
@@ -208,8 +196,8 @@ export async function logout(redirectUrl) {
|
||||
if (redirectUrl) {
|
||||
destination = redirectUrl;
|
||||
}
|
||||
// Backend clears the cookie, but frontend does it as fail-safe cleanup
|
||||
document.cookie = `${SESSION_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/`;
|
||||
// Backend clears the HttpOnly session cookie.
|
||||
sessionExpiresAt = null;
|
||||
void mutations.setCurrentUser(null);
|
||||
// No need to clear state.jwt - cookie is the source of truth
|
||||
// Add a small delay to ensure cookie deletion completes before redirect
|
||||
@@ -226,16 +214,12 @@ export async function logout(redirectUrl) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle an authenticated request that came back 401 because the session cookie
|
||||
// (JWT) is no longer valid — typically it expired while the tab was idle. Unlike
|
||||
// logout(), this does NOT call the server (which would itself 401 on an expired
|
||||
// token and leave the stale cookie in place); it clears the cookie locally and
|
||||
// redirects to the login page so the user can re-authenticate, instead of being
|
||||
// stuck on a raw "token is expired" error.
|
||||
// Handle an authenticated request that came back 401 because the session is no
|
||||
// longer valid — typically it expired while the tab was idle. Unlike logout(),
|
||||
// this does NOT call the server; it clears client state and redirects to login.
|
||||
export function sessionExpired() {
|
||||
stopSessionKeepAlive();
|
||||
document.cookie =
|
||||
`${SESSION_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/`;
|
||||
sessionExpiresAt = null;
|
||||
void mutations.setCurrentUser(null);
|
||||
// Avoid a redirect loop if we're already on the login page.
|
||||
if (window.location.pathname.endsWith("/login")) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
getSessionJwtExpiresAt,
|
||||
msUntilRefresh,
|
||||
renew,
|
||||
SESSION_COOKIE_NAME,
|
||||
SESSION_REFRESH_BEFORE_MS,
|
||||
shouldRefreshBeforeExpiry,
|
||||
startSessionKeepAlive,
|
||||
@@ -33,8 +32,6 @@ import {
|
||||
VIEW_REFRESH_BEFORE_MS,
|
||||
} from './auth.js';
|
||||
|
||||
const COOKIE = SESSION_COOKIE_NAME;
|
||||
|
||||
function respond(status, body = '') {
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
status,
|
||||
@@ -58,10 +55,8 @@ function makeJwt(expSeconds) {
|
||||
describe('validateLogin session-expiry handling', () => {
|
||||
beforeEach(() => {
|
||||
storeMock.mutations.setCurrentUser.mockClear();
|
||||
storeMock.getters.isLoggedIn.mockReturnValue(true);
|
||||
stopSessionKeepAlive();
|
||||
document.cookie = `${COOKIE}=stale; path=/`;
|
||||
// Stub navigation via Vitest's global-stub API (jsdom doesn't implement
|
||||
// real navigation). pathname+search feed the redirect; href captures it.
|
||||
vi.stubGlobal('location', { pathname: '/files/', search: '?a=1', href: '' });
|
||||
});
|
||||
|
||||
@@ -70,12 +65,10 @@ describe('validateLogin session-expiry handling', () => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it('clears the cookie + user and redirects (with encoded return path) on a non-public 401 with a session cookie', async () => {
|
||||
it('clears the user and redirects (with encoded return path) on a non-public 401 while logged in', async () => {
|
||||
respond(401, 'token is expired');
|
||||
await expect(validateLogin(false)).rejects.toThrow();
|
||||
expect(storeMock.mutations.setCurrentUser).toHaveBeenCalledWith(null);
|
||||
expect(document.cookie.includes(`${COOKIE}=stale`)).toBe(false);
|
||||
// Full redirect contract: login route + correctly encoded current path+query.
|
||||
expect(window.location.href).toBe(
|
||||
`/login?redirect=${encodeURIComponent('/files/?a=1')}`
|
||||
);
|
||||
@@ -85,12 +78,11 @@ describe('validateLogin session-expiry handling', () => {
|
||||
respond(401, 'unauthorized');
|
||||
await expect(validateLogin(true)).rejects.toThrow();
|
||||
expect(storeMock.mutations.setCurrentUser).not.toHaveBeenCalledWith(null);
|
||||
expect(document.cookie.includes(`${COOKIE}=stale`)).toBe(true);
|
||||
expect(window.location.href).toBe('');
|
||||
});
|
||||
|
||||
it('does NOT log out or redirect on a non-public 401 when there is NO session cookie', async () => {
|
||||
document.cookie = `${COOKIE}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/`;
|
||||
it('does NOT log out or redirect on a non-public 401 when the app is not logged in', async () => {
|
||||
storeMock.getters.isLoggedIn.mockReturnValue(false);
|
||||
respond(401, 'unauthorized');
|
||||
await expect(validateLogin(false)).rejects.toThrow();
|
||||
expect(storeMock.mutations.setCurrentUser).not.toHaveBeenCalledWith(null);
|
||||
@@ -101,7 +93,6 @@ describe('validateLogin session-expiry handling', () => {
|
||||
respond(500, 'server error');
|
||||
await expect(validateLogin(false)).rejects.toThrow();
|
||||
expect(storeMock.mutations.setCurrentUser).not.toHaveBeenCalledWith(null);
|
||||
expect(document.cookie.includes(`${COOKIE}=stale`)).toBe(true);
|
||||
expect(window.location.href).toBe('');
|
||||
});
|
||||
});
|
||||
@@ -133,22 +124,24 @@ describe('session JWT keep-alive', () => {
|
||||
afterEach(() => {
|
||||
stopSessionKeepAlive();
|
||||
vi.useRealTimers();
|
||||
document.cookie = `${COOKIE}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/`;
|
||||
});
|
||||
|
||||
it('parses exp from the session cookie JWT', () => {
|
||||
it('tracks exp from the renew response JWT', async () => {
|
||||
const exp = Math.floor(Date.now() / 1000) + 3600;
|
||||
document.cookie = `${COOKIE}=${makeJwt(exp)}; path=/`;
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
status: 200,
|
||||
text: async () => makeJwt(exp),
|
||||
});
|
||||
await renew();
|
||||
expect(getSessionJwtExpiresAt()).toBe(exp);
|
||||
});
|
||||
|
||||
it('ensureSessionFresh renews when JWT is within the refresh window', async () => {
|
||||
const exp = Math.floor(Date.now() / 1000) + 60; // 1 minute left
|
||||
document.cookie = `${COOKIE}=${makeJwt(exp)}; path=/`;
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
status: 200,
|
||||
text: async () => 'new-token',
|
||||
});
|
||||
global.fetch = vi.fn()
|
||||
.mockResolvedValueOnce({ status: 200, text: async () => makeJwt(exp) })
|
||||
.mockResolvedValueOnce({ status: 200, text: async () => makeJwt(exp + 3600) });
|
||||
await renew();
|
||||
const renewed = await ensureSessionFresh(SESSION_REFRESH_BEFORE_MS);
|
||||
expect(renewed).toBe(true);
|
||||
expect(global.fetch).toHaveBeenCalledWith(
|
||||
@@ -160,7 +153,11 @@ describe('session JWT keep-alive', () => {
|
||||
|
||||
it('ensureSessionFresh skips renew when JWT is still fresh', async () => {
|
||||
const exp = Math.floor(Date.now() / 1000) + 2 * 60 * 60; // 2 hours left
|
||||
document.cookie = `${COOKIE}=${makeJwt(exp)}; path=/`;
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
status: 200,
|
||||
text: async () => makeJwt(exp),
|
||||
});
|
||||
await renew();
|
||||
global.fetch = vi.fn();
|
||||
const renewed = await ensureSessionFresh(SESSION_REFRESH_BEFORE_MS);
|
||||
expect(renewed).toBe(false);
|
||||
@@ -169,7 +166,11 @@ describe('session JWT keep-alive', () => {
|
||||
|
||||
it('ensureSessionFresh returns false for joined callers when renew fails', async () => {
|
||||
const exp = Math.floor(Date.now() / 1000) + 60;
|
||||
document.cookie = `${COOKIE}=${makeJwt(exp)}; path=/`;
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
status: 200,
|
||||
text: async () => makeJwt(exp),
|
||||
});
|
||||
await renew();
|
||||
let release;
|
||||
const barrier = new Promise((resolve) => {
|
||||
release = resolve;
|
||||
@@ -206,10 +207,9 @@ describe('session JWT keep-alive', () => {
|
||||
|
||||
it('startSessionKeepAlive ticks ensureSessionFresh on an interval', async () => {
|
||||
const exp = Math.floor(Date.now() / 1000) + 60;
|
||||
document.cookie = `${COOKIE}=${makeJwt(exp)}; path=/`;
|
||||
global.fetch = vi.fn().mockResolvedValue({
|
||||
status: 200,
|
||||
text: async () => 'new-token',
|
||||
text: async () => makeJwt(exp),
|
||||
});
|
||||
startSessionKeepAlive();
|
||||
expect(global.fetch).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -141,7 +141,7 @@ describe("rewriteCssContent", () => {
|
||||
});
|
||||
|
||||
describe("buildHtmlPreview", () => {
|
||||
it("rewrites linked assets and preserves scripts in sandboxed srcdoc", () => {
|
||||
it("rewrites linked assets and strips scripts from sandboxed srcdoc", () => {
|
||||
const html = `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -156,10 +156,9 @@ describe("buildHtmlPreview", () => {
|
||||
|
||||
const { srcdoc } = buildHtmlPreview(html, "/pages/index.html", "src");
|
||||
expect(srcdoc).toContain(encodeURIComponent("/pages/theme.css"));
|
||||
expect(srcdoc).toContain(encodeURIComponent("/pages/app.js"));
|
||||
expect(srcdoc).toContain(encodeURIComponent("/pages/photo.jpg"));
|
||||
expect(srcdoc).toContain(encodeURIComponent("/pages/other.html"));
|
||||
expect(srcdoc).toContain("<script");
|
||||
expect(srcdoc).not.toContain("<script");
|
||||
expect(srcdoc).not.toContain("javascript:");
|
||||
});
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ import { getParentDir, resolveRelativePath } from "@/utils/url";
|
||||
export const HTML_SANITIZE_CONFIG = {
|
||||
USE_PROFILES: { html: true, svg: true, svgFilters: true },
|
||||
WHOLE_DOCUMENT: true,
|
||||
ADD_TAGS: ["link", "script"],
|
||||
FORBID_TAGS: ["iframe", "object", "embed", "form", "base", "meta"],
|
||||
ADD_TAGS: ["link"],
|
||||
FORBID_TAGS: ["iframe", "object", "embed", "form", "base", "meta", "script"],
|
||||
FORBID_ATTR: ["target", "formaction"],
|
||||
};
|
||||
|
||||
@@ -30,7 +30,6 @@ const REWRITABLE_LINK_RELS = new Set([
|
||||
]);
|
||||
|
||||
const RESOURCE_ATTRIBUTES: Array<[string, string]> = [
|
||||
["script", "src"],
|
||||
["link", "href"],
|
||||
["img", "src"],
|
||||
["video", "src"],
|
||||
|
||||
@@ -357,15 +357,12 @@ class UploadManager {
|
||||
this.hadActiveUploads = true; // Mark that we've had active uploads
|
||||
upload.status = "uploading";
|
||||
|
||||
// Get chunk size in MB, default to 5 if not set or if 0
|
||||
let chunkSizeMb = state.user.fileLoading?.uploadChunkSizeMb ?? 5;
|
||||
if (chunkSizeMb === 0) {
|
||||
chunkSizeMb = 5;
|
||||
}
|
||||
// Default to 5 MB when unset; explicit 0 disables chunking (single-shot upload).
|
||||
const chunkSizeMb = state.user.fileLoading?.uploadChunkSizeMb ?? 5;
|
||||
const chunkSize = chunkSizeMb * 1024 * 1024;
|
||||
|
||||
// Use non-chunked upload if file size is less than chunk size
|
||||
if (upload.size < chunkSize) {
|
||||
// Single-shot upload when chunking is disabled or file is smaller than chunk size.
|
||||
if (chunkSize === 0 || upload.size < chunkSize) {
|
||||
const progress = (percent) => {
|
||||
this.updateProgress(upload, percent);
|
||||
};
|
||||
@@ -496,10 +493,7 @@ class UploadManager {
|
||||
}
|
||||
|
||||
chunkSizeBytes() {
|
||||
let chunkSizeMb = state.user.fileLoading?.uploadChunkSizeMb ?? 5;
|
||||
if (chunkSizeMb === 0) {
|
||||
chunkSizeMb = 5;
|
||||
}
|
||||
const chunkSizeMb = state.user.fileLoading?.uploadChunkSizeMb ?? 5;
|
||||
return chunkSizeMb * 1024 * 1024;
|
||||
}
|
||||
|
||||
@@ -541,7 +535,7 @@ class UploadManager {
|
||||
if (upload?.status !== "uploading") {
|
||||
return;
|
||||
}
|
||||
if (upload.type !== "directory" && upload.size >= this.chunkSizeBytes()) {
|
||||
if (upload.type !== "directory" && this.chunkSizeBytes() > 0 && upload.size >= this.chunkSizeBytes()) {
|
||||
try {
|
||||
if (getters.isShare()) {
|
||||
await resourcesApi.signalUploadPause(null, upload.path, state.shareInfo.hash);
|
||||
|
||||
@@ -167,6 +167,15 @@ export default {
|
||||
$route() {
|
||||
this.reEval()
|
||||
},
|
||||
isDarkMode: {
|
||||
immediate: true,
|
||||
handler(dark) {
|
||||
const color = dark ? globalVars.darkBackground : globalVars.lightBackground;
|
||||
if (!color) return;
|
||||
const meta = document.querySelector('meta[name="theme-color"]');
|
||||
if (meta) meta.setAttribute("content", color);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
reEval() {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
:key="req.path"
|
||||
class="html-content"
|
||||
:srcdoc="htmlPreview.srcdoc"
|
||||
sandbox="allow-scripts allow-popups allow-same-origin"
|
||||
sandbox="allow-scripts allow-popups"
|
||||
referrerpolicy="no-referrer"
|
||||
title="HTML preview"
|
||||
></iframe>
|
||||
|
||||
Reference in new issue
Block a user