mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-26 16:39:41 -05:00
Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6deb9b8ab | ||
|
|
215a3fd858 | ||
|
|
9c5df98b79 | ||
|
|
0382bec1cd | ||
|
|
532632de1c | ||
|
|
6c72d1b85f | ||
|
|
f4587d8ef3 | ||
|
|
3db63bd44c | ||
|
|
708a40b788 | ||
|
|
fa40a7472d | ||
|
|
548221c28c | ||
|
|
77d3ab9554 | ||
|
|
e2f27d1391 | ||
|
|
a8f2477879 | ||
|
|
d70ed3d806 | ||
|
|
786cabb666 | ||
|
|
d36c0bf8f9 | ||
|
|
8f78112a94 | ||
|
|
a4d20c8101 | ||
|
|
d0f5cc3593 | ||
|
|
e8c8ea2454 | ||
|
|
08fc72de8c | ||
|
|
09bfc919d6 | ||
|
|
ad13b56d7f | ||
|
|
6aae66551b | ||
|
|
ff72ca3061 | ||
|
|
595e167d47 | ||
|
|
9afc5f0017 | ||
|
|
6bb451758a | ||
|
|
54cdea3391 | ||
|
|
4b97b19a21 | ||
|
|
0fff81583d | ||
|
|
14ada6bba8 | ||
|
|
9b684ba40d | ||
|
|
977f64b248 | ||
|
|
95eb5da737 | ||
|
|
3bb4c099c1 |
No files matched your search
@@ -23,7 +23,6 @@ frontend/tsconfig.tsbuildinfo
|
||||
/frontend/generated
|
||||
/frontend/tests/playwright-files/demo*
|
||||
/frontend/loginAuth.json
|
||||
/frontend/sharePrepStorage.json
|
||||
/backend/vendor
|
||||
/backend/*.cov
|
||||
/backend/*test_config.yaml
|
||||
|
||||
@@ -2,34 +2,6 @@
|
||||
|
||||
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).
|
||||
|
||||
## v1.4.2
|
||||
|
||||
**Security**:
|
||||
- [Moderate] Add Rate Limiting on Authentication Endpoint Enables Brute Force Attacks (GHSA-r4v7-6wcg-ghj5)
|
||||
- [Critical] Path traversal in public share PATCH allows file ops outside shared directory -- thanks @Revanth011 and @fg0x0 (GHSA-qqqm-5547-774x)
|
||||
|
||||
**New Features**:
|
||||
- read-only source configuration via `source.config.readOnly: true` (#2438)
|
||||
|
||||
**Notes**:
|
||||
- auth rate limiting can be disabled via `auth.disableRateLimit`
|
||||
- updated share hash middleware (#2443)
|
||||
- updated source info popup to include private and readOnly properties
|
||||
|
||||
**BugFixes**:
|
||||
- Logout from share page now redirects to the share instead of `/Login` again. (#2245)
|
||||
- `This location cannot be reached` error when navigating with FileTree in shares. (#2245)
|
||||
- Fix FileTree rename and move actions in previews. (#2245)
|
||||
- Delete prompt not showing date and thumbnails in some previews. (#2245)
|
||||
- fix path slash issue on windows (#2451) (#2433) (#2419)
|
||||
- Always force url rewrite for onlyoffice internal URL. Fixes Error saving with OnlyOffice (#2450)
|
||||
- Overriding a Deny with an Allow not working (#2405)
|
||||
|
||||
## v1.4.1
|
||||
|
||||
**Security**:
|
||||
- Fix critical: unauthenticated user can view source info
|
||||
|
||||
## v1.4.0
|
||||
|
||||
**New Features**:
|
||||
|
||||
@@ -19,7 +19,5 @@ COPY [ "./backend/http/embed/", "./http/dist/"]
|
||||
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
|
||||
RUN ./filebrowser set -u testuser1,testuser1
|
||||
RUN ./filebrowser set rule -s access -p / -r user -v admin -allow -c config.yaml
|
||||
RUN ./filebrowser set rule -s access -p /excluded/showme.txt -r user -v admin -allow -c config.yaml
|
||||
RUN ./filebrowser set rule -s access -p /denied -r user -v admin -c config.yaml
|
||||
RUN ./filebrowser set rule -s access -p /excluded -r user -v admin -c config.yaml
|
||||
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
|
||||
@@ -3,7 +3,7 @@ server-main: &server-main
|
||||
baseURL: "/"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
name: "playwright + files"
|
||||
|
||||
@@ -2,7 +2,7 @@ server:
|
||||
port: 8080
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
config:
|
||||
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
baseURL: "/files/"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
name: "exclude"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
server:
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
config:
|
||||
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
baseURL: "/"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
baseURL: "/subpath"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
config:
|
||||
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
baseURL: "/files/"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
name: "playwright"
|
||||
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
baseURL: "/"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
name: "playwright + files"
|
||||
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
baseURL: "/"
|
||||
logging:
|
||||
- levels: "info|error|warning|debug"
|
||||
apiFilter: 'disabled'
|
||||
apiFilter: '.*'
|
||||
sources:
|
||||
- path: "../frontend/tests/playwright-files"
|
||||
name: "playwright + files"
|
||||
|
||||
@@ -145,7 +145,7 @@ func checkPermissionsImpl(opts utils.FileOptions, access *access.Storage, user *
|
||||
// Layer 1: USER ACCESS CONTROL
|
||||
// Quick check: Does THIS user have permission?
|
||||
if !access.Permitted(idx.Path, indexPath, user.Username) {
|
||||
return indexPath, "", errors.ErrAccessDenied
|
||||
return "", "", errors.ErrAccessDenied
|
||||
}
|
||||
return indexPath, userScope, nil
|
||||
}
|
||||
@@ -157,30 +157,30 @@ type Items struct {
|
||||
|
||||
// This removes files whose names match any extension in hideFileExt.
|
||||
func filterFilesByExt(files []iteminfo.ExtendedItemInfo, hideFileExt string) []iteminfo.ExtendedItemInfo {
|
||||
if hideFileExt == "" {
|
||||
return files
|
||||
}
|
||||
filtered := files[:0]
|
||||
for _, f := range files {
|
||||
if !utils.HideFileByExt(f.Name, hideFileExt) {
|
||||
filtered = append(filtered, f)
|
||||
}
|
||||
}
|
||||
return filtered
|
||||
if hideFileExt == "" {
|
||||
return files
|
||||
}
|
||||
filtered := files[:0]
|
||||
for _, f := range files {
|
||||
if !utils.HideFileByExt(f.Name, hideFileExt) {
|
||||
filtered = append(filtered, f)
|
||||
}
|
||||
}
|
||||
return filtered
|
||||
}
|
||||
|
||||
func GetDirItems(opts utils.FileOptions, access *access.Storage, user *users.User) (Items, error) {
|
||||
items := Items{}
|
||||
indexPath, _, topLevelErr := CheckPermissions(opts, access, user)
|
||||
accessRulesErr := topLevelErr != nil && topLevelErr == errors.ErrAccessDenied && indexPath != ""
|
||||
if topLevelErr != nil && !accessRulesErr {
|
||||
return items, topLevelErr
|
||||
indexPath, _, err := CheckPermissions(opts, access, user)
|
||||
if err != nil {
|
||||
return items, err
|
||||
}
|
||||
// Get index
|
||||
idx := indexing.GetIndex(opts.Source)
|
||||
if idx == nil {
|
||||
return items, fmt.Errorf("could not get index: %v ", opts.Source)
|
||||
}
|
||||
|
||||
info, err := idx.GetFileInfo(indexing.FileInfoRequest{
|
||||
IndexPath: indexPath,
|
||||
FollowSymlinks: opts.FollowSymlinks,
|
||||
@@ -198,10 +198,6 @@ func GetDirItems(opts utils.FileOptions, access *access.Storage, user *users.Use
|
||||
if err := access.CheckChildItemAccess(info, idx, user.Username); err != nil {
|
||||
return items, err
|
||||
}
|
||||
hasAccessibleItems := len(info.Files) > 0 || len(info.Folders) > 0
|
||||
if accessRulesErr && !hasAccessibleItems {
|
||||
return items, errors.ErrAccessDenied
|
||||
}
|
||||
if opts.Only == "files" || opts.Only == "" {
|
||||
for _, file := range info.Files {
|
||||
if opts.HideFileExt != "" && utils.HideFileByExt(file.Name, opts.HideFileExt) {
|
||||
@@ -228,10 +224,9 @@ func FileInfoFaster(opts utils.FileOptions, access *access.Storage, user *users.
|
||||
// fileInfoFasterImpl is the actual implementation of FileInfoFaster
|
||||
func fileInfoFasterImpl(opts utils.FileOptions, access *access.Storage, user *users.User, share *share.Storage) (*iteminfo.ExtendedFileInfo, error) {
|
||||
response := &iteminfo.ExtendedFileInfo{}
|
||||
indexPath, userScope, topLevelErr := CheckPermissions(opts, access, user)
|
||||
accessRulesErr := topLevelErr != nil && topLevelErr == errors.ErrAccessDenied && indexPath != ""
|
||||
if topLevelErr != nil && !accessRulesErr {
|
||||
return response, topLevelErr
|
||||
indexPath, userScope, err := CheckPermissions(opts, access, user)
|
||||
if err != nil {
|
||||
return response, err
|
||||
}
|
||||
// Get index
|
||||
idx := indexing.GetIndex(opts.Source)
|
||||
@@ -251,16 +246,13 @@ func fileInfoFasterImpl(opts utils.FileOptions, access *access.Storage, user *us
|
||||
if err != nil {
|
||||
return response, err // Path excluded by index rules OR doesn't exist
|
||||
}
|
||||
|
||||
// otherwise response keeps unfiltered Folders/Files while CheckChildItemAccess only mutates info.
|
||||
if info.Type == "directory" {
|
||||
if err := access.CheckChildItemAccess(info, idx, user.Username); err != nil {
|
||||
return response, err
|
||||
}
|
||||
}
|
||||
hasAccessibleItems := len(info.Files) > 0 || len(info.Folders) > 0
|
||||
if accessRulesErr && !hasAccessibleItems {
|
||||
return response, errors.ErrAccessDenied
|
||||
}
|
||||
|
||||
// Build response
|
||||
response.FileInfo = *info
|
||||
@@ -466,12 +458,10 @@ func extractAudioMetadata(ctx context.Context, item *iteminfo.ExtendedItemInfo,
|
||||
if rawLyrics := m.Lyrics(); rawLyrics != "" {
|
||||
item.Metadata.HasLyrics = true
|
||||
} else {
|
||||
// Check for sidecar .lrc file
|
||||
dir := filepath.Dir(realPath)
|
||||
base := filepath.Base(realPath)
|
||||
ext := filepath.Ext(base)
|
||||
nameWithoutExt := strings.TrimSuffix(base, ext)
|
||||
lrcPath := filepath.Join(dir, nameWithoutExt+".lrc")
|
||||
// Check for .lrc file
|
||||
ext := filepath.Ext(realPath)
|
||||
base := strings.TrimSuffix(realPath, ext)
|
||||
lrcPath := base + ".lrc"
|
||||
if _, err := os.Stat(lrcPath); err == nil {
|
||||
item.Metadata.HasLyrics = true
|
||||
}
|
||||
@@ -536,12 +526,9 @@ func ExtractLyrics(realPath string) ([]iteminfo.Lyric, error) {
|
||||
lyrics = parseLRC(raw)
|
||||
}
|
||||
if len(lyrics) == 0 {
|
||||
// Check for sidecar .lrc file
|
||||
dir := filepath.Dir(realPath)
|
||||
base := filepath.Base(realPath)
|
||||
ext := filepath.Ext(base)
|
||||
nameWithoutExt := strings.TrimSuffix(base, ext)
|
||||
lrcPath := filepath.Join(dir, nameWithoutExt+".lrc")
|
||||
ext := filepath.Ext(realPath)
|
||||
base := strings.TrimSuffix(realPath, ext)
|
||||
lrcPath := base + ".lrc"
|
||||
if data, err := os.ReadFile(lrcPath); err == nil {
|
||||
lyrics = parseLRC(string(data))
|
||||
}
|
||||
|
||||
+20
-10
@@ -25,9 +25,10 @@ type webAuthnSession struct {
|
||||
}
|
||||
|
||||
type WebAuthnService struct {
|
||||
wa *webauthn.WebAuthn
|
||||
sessions sync.Map
|
||||
stopCh chan struct{}
|
||||
wa *webauthn.WebAuthn
|
||||
sessions sync.Map
|
||||
stopCh chan struct{}
|
||||
originMu sync.Mutex
|
||||
}
|
||||
|
||||
var webAuthnInstance *WebAuthnService
|
||||
@@ -65,15 +66,24 @@ func IsWebAuthnEnabled() bool {
|
||||
return webAuthnInstance != nil
|
||||
}
|
||||
|
||||
// ValidateOrigin checks if the given origin is in the configured whitelist.
|
||||
// Returns true if the origin is allowed, false otherwise.
|
||||
func (s *WebAuthnService) ValidateOrigin(origin string) bool {
|
||||
for _, allowedOrigin := range s.wa.Config.RPOrigins {
|
||||
if allowedOrigin == origin {
|
||||
return true
|
||||
// EnsureOrigin dynamically adds the given origin to the allowed RP origins list.
|
||||
// This supports self-hosted deployments where the access domain may vary.
|
||||
func (s *WebAuthnService) EnsureOrigin(origin string) {
|
||||
s.originMu.Lock()
|
||||
defer s.originMu.Unlock()
|
||||
for _, o := range s.wa.Config.RPOrigins {
|
||||
if o == origin {
|
||||
return
|
||||
}
|
||||
}
|
||||
return false
|
||||
s.wa.Config.RPOrigins = append(s.wa.Config.RPOrigins, origin)
|
||||
}
|
||||
|
||||
// EnsureRPID dynamically updates the relying party ID to match the request host.
|
||||
func (s *WebAuthnService) EnsureRPID(rpID string) {
|
||||
s.originMu.Lock()
|
||||
defer s.originMu.Unlock()
|
||||
s.wa.Config.RPID = rpID
|
||||
}
|
||||
|
||||
func generateSessionID() string {
|
||||
|
||||
@@ -118,10 +118,10 @@ type JwtAuthConfig struct {
|
||||
|
||||
// PasskeyAuthConfig configures WebAuthn / Passkey authentication as a second factor.
|
||||
type PasskeyAuthConfig struct {
|
||||
Enabled bool `json:"enabled"` // whether to enable passkey MFA
|
||||
RPDisplayName string `json:"rpDisplayName"` // the Relying Party display name (defaults to frontend name)
|
||||
RPID string `json:"rpId"` // the Relying Party ID; if empty, auto-derived from base URL host
|
||||
RPOrigins []string `json:"rpOrigins"` // allowed origins; if empty, auto-derived from base URL
|
||||
Enabled bool `json:"enabled"` // whether to enable passkey MFA
|
||||
RPDisplayName string `json:"rpDisplayName"` // the Relying Party display name (defaults to frontend name)
|
||||
RPID string `json:"rpId"` // the Relying Party ID; if empty, auto-derived from base URL host
|
||||
RPOrigins []string `json:"rpOrigins"` // allowed origins; if empty, auto-derived from base URL
|
||||
LoginButtonText string `json:"loginButtonText"` // custom text for the passkey login button
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ func Initialize(configFile string) {
|
||||
}
|
||||
setupFs()
|
||||
setupServer()
|
||||
setupHttp()
|
||||
setupAuth(false)
|
||||
setupSources(false)
|
||||
InitializeUserResolvers() // Initialize user package resolvers after sources are set up
|
||||
@@ -84,15 +83,6 @@ func setupEnv() {
|
||||
}
|
||||
}
|
||||
|
||||
func setupHttp() {
|
||||
if len(Config.Http.TrustedHeadersArray) > 0 {
|
||||
Config.Http.TrustedHeaders = make(map[string]bool)
|
||||
for _, header := range Config.Http.TrustedHeadersArray {
|
||||
Config.Http.TrustedHeaders[strings.ToLower(header)] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setupFs() {
|
||||
// Convert permission values (like 644, 755) to octal interpretation
|
||||
filePermOctal, err := strconv.ParseUint(Config.Server.Filesystem.CreateFilePermission, 8, 32)
|
||||
|
||||
@@ -133,10 +133,6 @@ func ApplyUserDefaults(u *users.User) {
|
||||
// FileLoading settings
|
||||
u.FileLoading = d.FileLoading
|
||||
|
||||
if u.Username == "anonymous" {
|
||||
return
|
||||
}
|
||||
|
||||
// Permissions
|
||||
u.Permissions.Api = d.Account.Permissions.Api
|
||||
u.Permissions.Admin = d.Account.Permissions.Admin
|
||||
@@ -151,7 +147,7 @@ func ApplyUserDefaults(u *users.User) {
|
||||
u.LoginMethod = users.LoginMethod(d.Account.LoginMethod)
|
||||
}
|
||||
|
||||
if len(u.Scopes) == 0 {
|
||||
if len(u.Scopes) == 0 && u.Username != "anonymous" {
|
||||
for _, source := range Config.Server.Sources {
|
||||
if source.Config.DefaultEnabled {
|
||||
u.Scopes = append(u.Scopes, users.SourceScope{
|
||||
|
||||
@@ -20,14 +20,6 @@ type Settings struct {
|
||||
Frontend Frontend `json:"frontend"`
|
||||
UserDefaults UserDefaults `json:"userDefaults"`
|
||||
Integrations Integrations `json:"integrations"`
|
||||
Http Http `json:"http"`
|
||||
}
|
||||
type Http struct {
|
||||
TrustedHeadersArray []string `json:"trustedHeaders"` // list of headers to trust, useful when behind a reverse proxy.
|
||||
DisableRateLimit bool `json:"disableRateLimit"` // turns off built-in auth route rate limiting and failed-login lockout (default false).
|
||||
|
||||
// internal map of trusted headers
|
||||
TrustedHeaders map[string]bool `json:"-"`
|
||||
}
|
||||
|
||||
type Environment struct {
|
||||
@@ -211,7 +203,6 @@ type Source struct {
|
||||
type SourceConfig struct {
|
||||
DenyByDefault bool `json:"denyByDefault,omitempty"` // deny access unless an "allow" access rule was specifically created.
|
||||
Private bool `json:"private"` // designate as source as private -- currently just means no sharing permitted.
|
||||
ReadOnly bool `json:"readOnly,omitempty"` // read-only source, changes from the UI, webdav, and API will be disabled.
|
||||
Disabled bool `json:"disabled,omitempty"` // disable the source, this is useful so you don't need to remove it from the config file
|
||||
IndexingInterval uint32 `json:"indexingIntervalMinutes,omitempty"` // deprecated: create a rule with indexingIntervalMinutes to set the indexing interval for this source
|
||||
Conditionals ConditionalFilter `json:"conditionals"` // deprecated: use source.rules instead
|
||||
|
||||
@@ -3,29 +3,11 @@ package utils
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func randomBytes(n int) ([]byte, error) {
|
||||
b := make([]byte, n)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// RandomHex returns a hex-encoded string from byteLen bytes of crypto/rand (length 2*byteLen).
|
||||
func RandomHex(byteLen int) (string, error) {
|
||||
b, err := randomBytes(byteLen)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(b), nil
|
||||
}
|
||||
|
||||
var BcryptCost = bcrypt.DefaultCost
|
||||
var InvalidPasswordHash = ""
|
||||
|
||||
@@ -62,13 +44,3 @@ func GenerateKey() string {
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// CSPNonce returns a base64-encoded random value suitable for Content-Security-Policy nonces
|
||||
// and matching HTML nonce="" attributes (cryptographically random, URL/header safe characters).
|
||||
func CSPNonce() (string, error) {
|
||||
b, err := randomBytes(16)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return base64.StdEncoding.EncodeToString(b), nil
|
||||
}
|
||||
@@ -43,9 +43,9 @@ type CommonShare struct {
|
||||
AllowReplacements bool `json:"allowReplacements,omitempty"` // allow replacements of files
|
||||
SidebarLinks []users.SidebarLink `json:"sidebarLinks"` // customizable sidebar links
|
||||
HasPassword bool `json:"hasPassword,omitempty"`
|
||||
ShowHidden bool `json:"showHidden,omitempty"` // show hidden files in share (true = show, false = hide)
|
||||
HideFileExt string `json:"hideFileExt,omitempty"` // show hidden files based on extensions in shares
|
||||
DisableLoginOption bool `json:"disableLoginOption"` // disable login option in share (true = hide, false = show)
|
||||
ShowHidden bool `json:"showHidden,omitempty"` // show hidden files in share (true = show, false = hide)
|
||||
HideFileExt string `json:"hideFileExt,omitempty"`// show hidden files based on extensions in shares
|
||||
DisableLoginOption bool `json:"disableLoginOption"` // disable login option in share (true = hide, false = show)
|
||||
SourceURL string `json:"sourceURL,omitempty"`
|
||||
CanEditShare bool `json:"canEditShare,omitempty"`
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"archive/tar"
|
||||
"archive/zip"
|
||||
"compress/gzip"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -44,7 +46,11 @@ var (
|
||||
)
|
||||
|
||||
func randomArchiveToken() (string, error) {
|
||||
return utils.RandomHex(16)
|
||||
b := make([]byte, 16)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return hex.EncodeToString(b), nil
|
||||
}
|
||||
|
||||
func stopArchiveSpoolIdleTimer(token string) {
|
||||
|
||||
@@ -221,9 +221,7 @@ func setupJwtUser(r *http.Request, data *requestContext, username string, claims
|
||||
// @Param X-Password header string true "URL-encoded password"
|
||||
// @Param X-Secret header string false "TOTP code (if 2FA is enabled)"
|
||||
// @Success 200 {string} string "JWT token for authentication"
|
||||
// @Failure 401 {object} map[string]string "Unauthorized - authentication failed"
|
||||
// @Failure 403 {object} map[string]string "Forbidden - authentication failed"
|
||||
// @Failure 429 {object} map[string]string "Too many requests - rate limited or temporarily locked out after failed attempts"
|
||||
// @Failure 500 {object} map[string]string "Internal server error"
|
||||
// @Router /api/auth/login [post]
|
||||
func loginHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
@@ -322,7 +320,7 @@ func logoutHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (i
|
||||
// @Failure 500 {object} map[string]string "Internal server error"
|
||||
// @Router /api/auth/signup [post]
|
||||
func signupHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
if !config.Auth.Methods.PasswordAuth.Signup {
|
||||
if !settings.Config.Auth.Methods.PasswordAuth.Signup {
|
||||
return http.StatusMethodNotAllowed, fmt.Errorf("signup is disabled")
|
||||
}
|
||||
|
||||
@@ -342,7 +340,7 @@ func signupHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (i
|
||||
},
|
||||
LoginMethod: users.LoginMethodPassword,
|
||||
}
|
||||
err := storage.CreateUser(user, settings.ConvertPermissionsToUsers(config.UserDefaults.Account.Permissions))
|
||||
err := storage.CreateUser(user, settings.ConvertPermissionsToUsers(settings.Config.UserDefaults.Account.Permissions))
|
||||
if err != nil {
|
||||
logger.Debug(err.Error())
|
||||
// Return the actual error message instead of a generic one
|
||||
|
||||
@@ -1,269 +0,0 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gtsteffaniak/go-cache/cache"
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
// Built-in auth rate limits (per process). Toggle all off with http.disableRateLimit.
|
||||
//
|
||||
// Credential tier (login, OTP verify): dual token buckets (per IP + per username) plus
|
||||
// failed-login lockout (per IP+username). Tune burst ≤ maxAttempts so rapid floods hit
|
||||
// HTTP 429 from the bucket before lockout; lockout covers paced attacks that stay under RPM.
|
||||
const (
|
||||
authCredentialRPM = 10 // sustained ~1 attempt / 6s per IP and per username
|
||||
authCredentialBurst = 8 // rapid burst; 9th immediate attempt gets 429
|
||||
authModerateRPM = 30 // signup, logout, OTP generate
|
||||
authModerateBurst = 10
|
||||
authOIDCRPM = 60 // OIDC redirects (browser-driven, higher ceiling)
|
||||
authOIDCBurst = 20
|
||||
authAuthenticatedRPM = 180 // session/token management for logged-in users
|
||||
authAuthenticatedBurst = 60
|
||||
authFailedLoginMaxAttempts = 8 // lockout after N consecutive 401s (same IP + username)
|
||||
authFailedLoginLockoutMins = 15
|
||||
// Evict idle per-key token buckets so unique IPs/usernames cannot grow without bound.
|
||||
authLimiterEntryTTL = 24 * time.Hour
|
||||
)
|
||||
|
||||
// In-memory failed-attempt counters and lockout flags (per server process).
|
||||
var (
|
||||
authFailCounts = cache.NewCache[int](time.Minute, 10*time.Minute)
|
||||
authLockouts = cache.NewCache[bool](time.Minute, 10*time.Minute)
|
||||
)
|
||||
|
||||
// Per-route-class token buckets (keys: IP or username). Expired entries are dropped by go-cache.
|
||||
var (
|
||||
authRateLimitCredentialByIP = cache.NewCache[*rate.Limiter](authLimiterEntryTTL)
|
||||
authRateLimitCredentialByUsername = cache.NewCache[*rate.Limiter](authLimiterEntryTTL)
|
||||
authRateLimitModerateByIP = cache.NewCache[*rate.Limiter](authLimiterEntryTTL)
|
||||
authRateLimitOIDCByIP = cache.NewCache[*rate.Limiter](authLimiterEntryTTL)
|
||||
authRateLimitAuthenticatedByUser = cache.NewCache[*rate.Limiter](authLimiterEntryTTL)
|
||||
)
|
||||
|
||||
const authRateKeySep = "\x1e"
|
||||
|
||||
// AuthRateLimitKind selects which /api/auth rate limit tier applies (see withRateLimit and withRateLimitChain).
|
||||
type AuthRateLimitKind int
|
||||
|
||||
const (
|
||||
// AuthRateLimitCredential: strict per-IP and per-username limits; no failed-login lockout.
|
||||
AuthRateLimitCredential AuthRateLimitKind = iota
|
||||
// AuthRateLimitCredentialLockout: same limits as Credential, plus lockout after repeated 401s.
|
||||
AuthRateLimitCredentialLockout
|
||||
AuthRateLimitModerate
|
||||
AuthRateLimitOIDC
|
||||
// AuthRateLimitAuthenticated: per logged-in username (compose: withUser(withRateLimitChain(AuthRateLimitAuthenticated, h))).
|
||||
AuthRateLimitAuthenticated
|
||||
)
|
||||
|
||||
// withRateLimitChain applies a rate limit tier then fn for nesting inside withUser / withOrWithoutUser / withoutUser.
|
||||
func withRateLimitChain(kind AuthRateLimitKind, fn handleFunc) handleFunc {
|
||||
switch kind {
|
||||
case AuthRateLimitCredential:
|
||||
return withAuthRateLimitCredential(false, fn)
|
||||
case AuthRateLimitCredentialLockout:
|
||||
return withAuthRateLimitCredential(true, fn)
|
||||
case AuthRateLimitModerate:
|
||||
return withAuthRateLimitModerate(fn)
|
||||
case AuthRateLimitOIDC:
|
||||
return withAuthRateLimitOIDC(fn)
|
||||
case AuthRateLimitAuthenticated:
|
||||
return withAuthRateLimitAuthenticated(fn)
|
||||
default:
|
||||
return fn
|
||||
}
|
||||
}
|
||||
|
||||
// withRateLimit registers a rate-limited route (same shape as withTimeout: option first, handler second).
|
||||
func withRateLimit(kind AuthRateLimitKind, fn handleFunc) http.HandlerFunc {
|
||||
return wrapHandler(withRateLimitChain(kind, fn))
|
||||
}
|
||||
|
||||
func authRateLimitActive() bool {
|
||||
if config.Http.DisableRateLimit {
|
||||
return false
|
||||
}
|
||||
if config.Auth.Methods.NoAuth {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func tokenBucketLimiter(c *cache.KeyCache[*rate.Limiter], key string, requestsPerMinute, burst int) *rate.Limiter {
|
||||
if requestsPerMinute < 1 {
|
||||
requestsPerMinute = 1
|
||||
}
|
||||
if burst < 1 {
|
||||
burst = 1
|
||||
}
|
||||
if lim, ok := c.Get(key); ok && lim != nil {
|
||||
c.SetWithExp(key, lim, authLimiterEntryTTL)
|
||||
return lim
|
||||
}
|
||||
lim := rate.NewLimiter(rate.Limit(float64(requestsPerMinute))/60.0, burst)
|
||||
c.SetWithExp(key, lim, authLimiterEntryTTL)
|
||||
return lim
|
||||
}
|
||||
|
||||
func retryAfterSeconds(lim *rate.Limiter) int {
|
||||
res := lim.Reserve()
|
||||
delay := res.Delay()
|
||||
res.Cancel()
|
||||
secs := int(math.Ceil(delay.Seconds()))
|
||||
if secs < 1 {
|
||||
secs = 1
|
||||
}
|
||||
return secs
|
||||
}
|
||||
|
||||
func allowCredential(r *http.Request, loginUsername string) (retryAfter int, ok bool) {
|
||||
ip := getRemoteIP(r)
|
||||
limIP := tokenBucketLimiter(authRateLimitCredentialByIP, ip, authCredentialRPM, authCredentialBurst)
|
||||
if !limIP.Allow() {
|
||||
return retryAfterSeconds(limIP), false
|
||||
}
|
||||
if loginUsername != "" {
|
||||
limUser := tokenBucketLimiter(authRateLimitCredentialByUsername, loginUsername, authCredentialRPM, authCredentialBurst)
|
||||
if !limUser.Allow() {
|
||||
return retryAfterSeconds(limUser), false
|
||||
}
|
||||
}
|
||||
return 0, true
|
||||
}
|
||||
|
||||
func allowModerate(r *http.Request) (retryAfter int, ok bool) {
|
||||
ip := getRemoteIP(r)
|
||||
lim := tokenBucketLimiter(authRateLimitModerateByIP, ip, authModerateRPM, authModerateBurst)
|
||||
if !lim.Allow() {
|
||||
return retryAfterSeconds(lim), false
|
||||
}
|
||||
return 0, true
|
||||
}
|
||||
|
||||
func allowOIDC(r *http.Request) (retryAfter int, ok bool) {
|
||||
ip := getRemoteIP(r)
|
||||
lim := tokenBucketLimiter(authRateLimitOIDCByIP, ip, authOIDCRPM, authOIDCBurst)
|
||||
if !lim.Allow() {
|
||||
return retryAfterSeconds(lim), false
|
||||
}
|
||||
return 0, true
|
||||
}
|
||||
|
||||
func allowAuthenticated(username string) (retryAfter int, ok bool) {
|
||||
lim := tokenBucketLimiter(authRateLimitAuthenticatedByUser, username, authAuthenticatedRPM, authAuthenticatedBurst)
|
||||
if !lim.Allow() {
|
||||
return retryAfterSeconds(lim), false
|
||||
}
|
||||
return 0, true
|
||||
}
|
||||
|
||||
func authFailKey(ip, username string) string {
|
||||
return "fail" + authRateKeySep + ip + authRateKeySep + username
|
||||
}
|
||||
|
||||
func authLockKey(ip, username string) string {
|
||||
return "lock" + authRateKeySep + ip + authRateKeySep + username
|
||||
}
|
||||
|
||||
func authLockoutRetryAfterSecs() int {
|
||||
return authFailedLoginLockoutMins * 60
|
||||
}
|
||||
|
||||
func isAuthLockout(ip, username string) bool {
|
||||
locked, ok := authLockouts.Get(authLockKey(ip, username))
|
||||
return ok && locked
|
||||
}
|
||||
|
||||
func clearAuthLockout(ip, username string) {
|
||||
authLockouts.Delete(authLockKey(ip, username))
|
||||
authFailCounts.Delete(authFailKey(ip, username))
|
||||
}
|
||||
|
||||
func recordAuthFailure(ip, username string) {
|
||||
if username == "" {
|
||||
return
|
||||
}
|
||||
window := time.Duration(authFailedLoginLockoutMins) * time.Minute
|
||||
fk := authFailKey(ip, username)
|
||||
n := 0
|
||||
if v, ok := authFailCounts.Get(fk); ok {
|
||||
n = v
|
||||
}
|
||||
n++
|
||||
authFailCounts.SetWithExp(fk, n, window)
|
||||
if n >= authFailedLoginMaxAttempts {
|
||||
authLockouts.SetWithExp(authLockKey(ip, username), true, window)
|
||||
}
|
||||
}
|
||||
|
||||
// withRateLimitInternal applies token-bucket allow checks: when inactive, calls fn; when denied, 429 + Retry-After.
|
||||
func withRateLimitInternal(fn handleFunc, allow func(*http.Request, *requestContext) (retryAfter int, ok bool)) handleFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
if !authRateLimitActive() {
|
||||
return fn(w, r, d)
|
||||
}
|
||||
if after, ok := allow(r, d); !ok {
|
||||
w.Header().Set("Retry-After", strconv.Itoa(after))
|
||||
return http.StatusTooManyRequests, fmt.Errorf("too many requests")
|
||||
}
|
||||
return fn(w, r, d)
|
||||
}
|
||||
}
|
||||
|
||||
// withAuthRateLimitCredential enforces the credential tier (and optional per-username limits).
|
||||
// When trackFailures is true, 401 responses increment failed-attempt state for lockout; success clears it.
|
||||
func withAuthRateLimitCredential(trackFailures bool, fn handleFunc) handleFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
if !authRateLimitActive() {
|
||||
return fn(w, r, d)
|
||||
}
|
||||
username := r.URL.Query().Get("username")
|
||||
if isAuthLockout(getRemoteIP(r), username) {
|
||||
w.Header().Set("Retry-After", strconv.Itoa(authLockoutRetryAfterSecs()))
|
||||
return http.StatusTooManyRequests, fmt.Errorf("too many failed authentication attempts")
|
||||
}
|
||||
if after, ok := allowCredential(r, username); !ok {
|
||||
w.Header().Set("Retry-After", strconv.Itoa(after))
|
||||
return http.StatusTooManyRequests, fmt.Errorf("too many requests")
|
||||
}
|
||||
status, err := fn(w, r, d)
|
||||
if !trackFailures {
|
||||
return status, err
|
||||
}
|
||||
ip := getRemoteIP(r)
|
||||
if status == http.StatusUnauthorized && username != "" {
|
||||
recordAuthFailure(ip, username)
|
||||
}
|
||||
if err == nil && (status == 0 || status == http.StatusOK) {
|
||||
clearAuthLockout(ip, username)
|
||||
}
|
||||
return status, err
|
||||
}
|
||||
}
|
||||
|
||||
func withAuthRateLimitModerate(fn handleFunc) handleFunc {
|
||||
return withRateLimitInternal(fn, func(r *http.Request, _ *requestContext) (int, bool) {
|
||||
return allowModerate(r)
|
||||
})
|
||||
}
|
||||
|
||||
func withAuthRateLimitOIDC(fn handleFunc) handleFunc {
|
||||
return withRateLimitInternal(fn, func(r *http.Request, _ *requestContext) (int, bool) {
|
||||
return allowOIDC(r)
|
||||
})
|
||||
}
|
||||
|
||||
func withAuthRateLimitAuthenticated(fn handleFunc) handleFunc {
|
||||
return withRateLimitInternal(fn, func(_ *http.Request, d *requestContext) (int, bool) {
|
||||
if d.user == nil || d.user.Username == "" || d.user.Username == "anonymous" {
|
||||
return 0, true
|
||||
}
|
||||
return allowAuthenticated(d.user.Username)
|
||||
})
|
||||
}
|
||||
+18
-21
@@ -80,10 +80,6 @@ func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete ch
|
||||
publicRoutes := http.NewServeMux()
|
||||
publicApi := http.NewServeMux()
|
||||
|
||||
// health routes
|
||||
api.HandleFunc("GET /health", healthHandler)
|
||||
publicApi.HandleFunc("GET /health", healthHandler)
|
||||
|
||||
// ========================================
|
||||
// User Routes - /api/users/ (with public routes)
|
||||
// ========================================
|
||||
@@ -96,23 +92,23 @@ func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete ch
|
||||
// ========================================
|
||||
// Auth Routes - /api/auth/
|
||||
// ========================================
|
||||
api.HandleFunc("POST /auth/login", withRateLimit(AuthRateLimitCredentialLockout, loginHelper(loginHandler)))
|
||||
api.HandleFunc("POST /auth/logout", withOrWithoutUser(withRateLimitChain(AuthRateLimitModerate, logoutHandler)))
|
||||
api.HandleFunc("POST /auth/signup", withoutUser(withRateLimitChain(AuthRateLimitModerate, signupHandler)))
|
||||
api.HandleFunc("POST /auth/otp/generate", withOrWithoutUser(withRateLimitChain(AuthRateLimitModerate, generateOTPHandler)))
|
||||
api.HandleFunc("POST /auth/otp/verify", withOrWithoutUser(withRateLimitChain(AuthRateLimitCredentialLockout, verifyOTPHandler)))
|
||||
api.HandleFunc("POST /auth/renew", withUser(withRateLimitChain(AuthRateLimitAuthenticated, renewHandler)))
|
||||
api.HandleFunc("POST /auth/token", withUser(withRateLimitChain(AuthRateLimitAuthenticated, createApiTokenHandler)))
|
||||
api.HandleFunc("DELETE /auth/token", withUser(withRateLimitChain(AuthRateLimitAuthenticated, deleteApiTokenHandler)))
|
||||
api.HandleFunc("GET /auth/token/list", withUser(withRateLimitChain(AuthRateLimitAuthenticated, listApiTokensHandler)))
|
||||
api.HandleFunc("GET /auth/token", withUser(withRateLimitChain(AuthRateLimitAuthenticated, getApiTokenHandler)))
|
||||
api.HandleFunc("GET /auth/oidc/callback", withRateLimit(AuthRateLimitOIDC, oidcCallbackHandler))
|
||||
api.HandleFunc("GET /auth/oidc/login", withRateLimit(AuthRateLimitOIDC, oidcLoginHandler))
|
||||
api.HandleFunc("POST /auth/webauthn/begin-login", withoutUser(withRateLimitChain(AuthRateLimitCredential, beginPasskeyLoginHandler)))
|
||||
api.HandleFunc("POST /auth/webauthn/finish-login", withoutUser(withRateLimitChain(AuthRateLimitCredential, finishPasskeyLoginHandler)))
|
||||
api.HandleFunc("POST /auth/webauthn/begin-register", withUser(withRateLimitChain(AuthRateLimitAuthenticated, beginPasskeyRegistrationHandler)))
|
||||
api.HandleFunc("POST /auth/webauthn/finish-register", withUser(withRateLimitChain(AuthRateLimitAuthenticated, finishPasskeyRegistrationHandler)))
|
||||
api.HandleFunc("DELETE /auth/webauthn/{id}", withUser(withRateLimitChain(AuthRateLimitAuthenticated, deletePasskeyCredentialHandler)))
|
||||
api.HandleFunc("POST /auth/login", loginHelper(loginHandler))
|
||||
api.HandleFunc("POST /auth/logout", withOrWithoutUser(logoutHandler))
|
||||
api.HandleFunc("POST /auth/signup", withoutUser(signupHandler))
|
||||
api.HandleFunc("POST /auth/otp/generate", withOrWithoutUser(generateOTPHandler))
|
||||
api.HandleFunc("POST /auth/otp/verify", withOrWithoutUser(verifyOTPHandler))
|
||||
api.HandleFunc("POST /auth/renew", withUser(renewHandler))
|
||||
api.HandleFunc("POST /auth/token", withUser(createApiTokenHandler))
|
||||
api.HandleFunc("DELETE /auth/token", withUser(deleteApiTokenHandler))
|
||||
api.HandleFunc("GET /auth/token/list", withUser(listApiTokensHandler))
|
||||
api.HandleFunc("GET /auth/token", withUser(getApiTokenHandler))
|
||||
api.HandleFunc("GET /auth/oidc/callback", wrapHandler(oidcCallbackHandler))
|
||||
api.HandleFunc("GET /auth/oidc/login", wrapHandler(oidcLoginHandler))
|
||||
api.HandleFunc("POST /auth/webauthn/begin-login", withoutUser(beginPasskeyLoginHandler))
|
||||
api.HandleFunc("POST /auth/webauthn/finish-login", withoutUser(finishPasskeyLoginHandler))
|
||||
api.HandleFunc("POST /auth/webauthn/begin-register", withUser(beginPasskeyRegistrationHandler))
|
||||
api.HandleFunc("POST /auth/webauthn/finish-register", withUser(finishPasskeyRegistrationHandler))
|
||||
api.HandleFunc("DELETE /auth/webauthn/{id}", withUser(deletePasskeyCredentialHandler))
|
||||
|
||||
// ========================================
|
||||
// Resources Routes - /api/resources/ (with public routes)
|
||||
@@ -203,6 +199,7 @@ func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete ch
|
||||
// ========================================
|
||||
// Misc Routes
|
||||
// ========================================
|
||||
api.HandleFunc("GET /health", healthHandler)
|
||||
api.HandleFunc("GET /events", withUser(sseHandler))
|
||||
if settings.Env.IsDevMode {
|
||||
api.HandleFunc("GET /inspectIndex", inspectIndex)
|
||||
|
||||
@@ -26,7 +26,7 @@ func AuthenticateLDAPUser(username, password string) (*users.User, error) {
|
||||
}
|
||||
|
||||
// Use the configured UserIdentifier if available, otherwise use the login username
|
||||
ldapCfg := config.Auth.Methods.LdapAuth
|
||||
ldapCfg := settings.Config.Auth.Methods.LdapAuth
|
||||
mappedUsername := username
|
||||
if ldapCfg.UserIdentifier != "" {
|
||||
if val, ok := userAttributes[ldapCfg.UserIdentifier]; ok && val != "" {
|
||||
@@ -42,7 +42,7 @@ func AuthenticateLDAPUser(username, password string) (*users.User, error) {
|
||||
}
|
||||
|
||||
func authenticateLDAP(username, password string) ([]string, map[string]string, error) {
|
||||
c := config.Auth.Methods.LdapAuth
|
||||
c := settings.Config.Auth.Methods.LdapAuth
|
||||
logger.Debugf("ldap: connecting to %s", c.Server)
|
||||
|
||||
var opts []ldap.DialOpt
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/files"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/ffmpeg"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/indexing"
|
||||
@@ -128,7 +129,7 @@ func metadataHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
|
||||
Content: false,
|
||||
Metadata: true,
|
||||
AlbumArt: albumArt,
|
||||
ExtractEmbeddedSubtitles: config.Integrations.Media.ExtractEmbeddedSubtitles,
|
||||
ExtractEmbeddedSubtitles: settings.Config.Integrations.Media.ExtractEmbeddedSubtitles,
|
||||
ShowHidden: d.user.ShowHidden,
|
||||
HideFileExt: d.user.HideFileExt,
|
||||
SkipExtendedAttrs: false,
|
||||
@@ -166,7 +167,7 @@ func publicMetadataHandler(w http.ResponseWriter, r *http.Request, d *requestCon
|
||||
Content: false,
|
||||
Metadata: true,
|
||||
AlbumArt: albumArt,
|
||||
ExtractEmbeddedSubtitles: config.Integrations.Media.ExtractEmbeddedSubtitles && d.share.ExtractEmbeddedSubtitles,
|
||||
ExtractEmbeddedSubtitles: settings.Config.Integrations.Media.ExtractEmbeddedSubtitles && d.share.ExtractEmbeddedSubtitles,
|
||||
ShowHidden: d.share.ShowHidden,
|
||||
HideFileExt: d.user.HideFileExt,
|
||||
FollowSymlinks: false,
|
||||
|
||||
+52
-15
@@ -8,7 +8,6 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -32,6 +31,7 @@ type requestContext struct {
|
||||
fileInfo iteminfo.ExtendedFileInfo
|
||||
token string
|
||||
share *share.Link
|
||||
shareValid bool
|
||||
ctx context.Context
|
||||
MaxBandwidth int
|
||||
Data interface{}
|
||||
@@ -58,7 +58,6 @@ func withHashFileHelper(fn handleFunc) handleFunc {
|
||||
if err != nil && inputPath != "" {
|
||||
return http.StatusBadRequest, err
|
||||
}
|
||||
path = filepath.ToSlash(path)
|
||||
|
||||
// Get the file link by hash
|
||||
link, err := store.Share.GetByHash(hash)
|
||||
@@ -133,9 +132,9 @@ func withHashFileHelper(fn handleFunc) handleFunc {
|
||||
Content: getContent,
|
||||
Metadata: getMetadata,
|
||||
AlbumArt: strings.Contains(r.URL.Path, "/preview"),
|
||||
ExtractEmbeddedSubtitles: config.Integrations.Media.ExtractEmbeddedSubtitles && link.ExtractEmbeddedSubtitles,
|
||||
ExtractEmbeddedSubtitles: settings.Config.Integrations.Media.ExtractEmbeddedSubtitles && link.ExtractEmbeddedSubtitles,
|
||||
ShowHidden: link.ShowHidden,
|
||||
HideFileExt: link.HideFileExt,
|
||||
HideFileExt: link.HideFileExt,
|
||||
FollowSymlinks: true,
|
||||
}, store.Access, data.shareUser, store.Share)
|
||||
if err != nil {
|
||||
@@ -228,19 +227,57 @@ func extractUserFromExpiredToken(r *http.Request, data *requestContext) *users.U
|
||||
// If authentication fails, the request continues without a user.
|
||||
func withOrWithoutUserHelper(fn handleFunc) handleFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request, data *requestContext) (int, error) {
|
||||
var link *share.Link
|
||||
var isShareRequest bool
|
||||
var shareHash string
|
||||
|
||||
hash := r.URL.Query().Get("hash")
|
||||
if hash != "" {
|
||||
_, err := store.Share.GetByHash(hash)
|
||||
if err != nil {
|
||||
return http.StatusNotFound, fmt.Errorf("share hash not found")
|
||||
// Get the file link by hash
|
||||
isShareRequest = true
|
||||
shareHash = hash
|
||||
link, _ = store.Share.GetByHash(hash)
|
||||
} else {
|
||||
prefix := config.Server.BaseURL + "public/share/"
|
||||
reconstructed := config.Server.BaseURL + "public" + r.URL.Path
|
||||
if strings.HasPrefix(reconstructed, prefix) {
|
||||
remaining := strings.TrimPrefix(reconstructed, prefix)
|
||||
if remaining != "" {
|
||||
if idx := strings.IndexByte(remaining, '/'); idx >= 0 {
|
||||
remaining = remaining[:idx]
|
||||
}
|
||||
if remaining != "" {
|
||||
isShareRequest = true
|
||||
shareHash = remaining
|
||||
var err error
|
||||
link, err = store.Share.GetByHash(remaining)
|
||||
if err != nil {
|
||||
logger.Debugf("error getting share by hash: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a share request, always create a share context (even if invalid)
|
||||
if isShareRequest {
|
||||
if link != nil {
|
||||
data.share = link
|
||||
data.shareValid = true
|
||||
} else {
|
||||
// Create an empty share with just the hash for invalid shares
|
||||
data.share = &share.Link{Hash: shareHash}
|
||||
data.shareValid = false
|
||||
}
|
||||
}
|
||||
|
||||
// Try to authenticate user first
|
||||
status, err := withUserHelper(nil)(w, r, data)
|
||||
if err == nil && status < 400 {
|
||||
if data.share != nil && data.user != nil {
|
||||
data.user.CustomTheme = data.share.ShareTheme
|
||||
if data.share != nil && data.shareValid {
|
||||
if data.user != nil {
|
||||
data.user.CustomTheme = data.share.ShareTheme
|
||||
}
|
||||
}
|
||||
return fn(w, r, data)
|
||||
}
|
||||
@@ -251,7 +288,7 @@ func withOrWithoutUserHelper(fn handleFunc) handleFunc {
|
||||
userFromExpiredToken := extractUserFromExpiredToken(r, data)
|
||||
if userFromExpiredToken != nil {
|
||||
data.user = userFromExpiredToken
|
||||
if data.share != nil {
|
||||
if data.share != nil && data.shareValid {
|
||||
data.user.CustomTheme = data.share.ShareTheme
|
||||
}
|
||||
setUserInResponseWriter(w, data.user)
|
||||
@@ -263,7 +300,7 @@ func withOrWithoutUserHelper(fn handleFunc) handleFunc {
|
||||
settings.ApplyUserDefaults(data.user)
|
||||
// Clear any user data that might have been partially set
|
||||
data.token = ""
|
||||
if data.share != nil {
|
||||
if data.share != nil && data.shareValid {
|
||||
data.user.CustomTheme = data.share.ShareTheme
|
||||
}
|
||||
// Call the handler function without user context
|
||||
@@ -627,8 +664,8 @@ func withoutUser(fn handleFunc) http.HandlerFunc {
|
||||
return wrapHandler(withoutUserHelper(fn))
|
||||
}
|
||||
|
||||
func loginHelper(fn handleFunc) handleFunc {
|
||||
return LoginHelper(false, fn)
|
||||
func loginHelper(fn handleFunc) http.HandlerFunc {
|
||||
return wrapHandler(LoginHelper(false, fn))
|
||||
}
|
||||
|
||||
func withSelfOrAdmin(fn handleFunc) http.HandlerFunc {
|
||||
@@ -723,7 +760,7 @@ func setUserInResponseWriter(w http.ResponseWriter, user *users.User) {
|
||||
func getRemoteIP(r *http.Request) string {
|
||||
// 1. Check X-Forwarded-For
|
||||
xff := r.Header.Get("X-Forwarded-For")
|
||||
if config.Http.TrustedHeaders["x-forwarded-for"] && xff != "" {
|
||||
if xff != "" {
|
||||
// The first IP is the original client
|
||||
ips := strings.Split(xff, ",")
|
||||
return strings.TrimSpace(ips[0])
|
||||
@@ -731,7 +768,7 @@ func getRemoteIP(r *http.Request) string {
|
||||
|
||||
// 2. Check X-Real-IP
|
||||
xri := r.Header.Get("X-Real-IP")
|
||||
if config.Http.TrustedHeaders["x-real-ip"] && xri != "" {
|
||||
if xri != "" {
|
||||
return xri
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ func parseOIDCGroupsValue(groupsVal interface{}) []string {
|
||||
// @Success 302 {string} string "Redirect to OIDC provider"
|
||||
// @Router /api/auth/oidc/login [get]
|
||||
func oidcLoginHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
oidcCfg := config.Auth.Methods.OidcAuth
|
||||
oidcCfg := settings.Config.Auth.Methods.OidcAuth
|
||||
if !oidcCfg.Enabled {
|
||||
return http.StatusForbidden, fmt.Errorf("oidc authentication is not enabled")
|
||||
}
|
||||
@@ -197,7 +197,7 @@ func oidcLoginHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
|
||||
// @Router /api/auth/oidc/callback [get]
|
||||
func oidcCallbackHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
ctx := r.Context()
|
||||
oidcCfg := config.Auth.Methods.OidcAuth
|
||||
oidcCfg := settings.Config.Auth.Methods.OidcAuth
|
||||
if oidcCfg.Provider == nil || oidcCfg.Verifier == nil {
|
||||
// Ensure Provider and Verifier are initialized on application startup
|
||||
// This check is good, keep it.
|
||||
|
||||
+16
-121
@@ -11,7 +11,6 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v4"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/files"
|
||||
@@ -29,16 +28,8 @@ const (
|
||||
onlyOfficeStatusDocumentClosedWithNoChanges = 4
|
||||
onlyOfficeStatusForceSaveWhileDocumentStillOpen = 6
|
||||
onlyOfficeStatusForceSaveError = 7
|
||||
|
||||
onlyOfficeDownloadTimeout = 10 * time.Second
|
||||
)
|
||||
|
||||
// onlyOfficeDownloadClient fetches saved documents from the OnlyOffice document server.
|
||||
// A bounded timeout avoids hanging goroutines when the server is unreachable.
|
||||
var onlyOfficeDownloadClient = &http.Client{
|
||||
Timeout: onlyOfficeDownloadTimeout,
|
||||
}
|
||||
|
||||
type OnlyOfficeCallback struct {
|
||||
Actions []OnlyOfficeAction `json:"actions,omitempty"`
|
||||
ChangesURL string `json:"changesurl,omitempty"`
|
||||
@@ -90,7 +81,7 @@ type OnlyOfficeJWTPayload struct {
|
||||
// @Router /api/office/config [get]
|
||||
// @Security ApiKeyAuth
|
||||
func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
|
||||
if config.Integrations.OnlyOffice.Url == "" {
|
||||
if settings.Config.Integrations.OnlyOffice.Url == "" {
|
||||
return http.StatusInternalServerError, errors.New("only-office integration must be configured in settings")
|
||||
}
|
||||
|
||||
@@ -116,13 +107,13 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
|
||||
var sourceInfo *settings.Source
|
||||
var ok bool
|
||||
if hash != "" {
|
||||
sourceInfo, ok = config.Server.SourceMap[d.share.Source]
|
||||
sourceInfo, ok = settings.Config.Server.SourceMap[d.share.Source]
|
||||
if !ok {
|
||||
logger.Error("OnlyOffice: source not found")
|
||||
return http.StatusInternalServerError, fmt.Errorf("source not found")
|
||||
}
|
||||
} else {
|
||||
sourceInfo, ok = config.Server.NameToSource[source]
|
||||
sourceInfo, ok = settings.Config.Server.NameToSource[source]
|
||||
if !ok {
|
||||
logger.Error("OnlyOffice: source not found")
|
||||
return http.StatusInternalServerError, fmt.Errorf("source not found")
|
||||
@@ -219,7 +210,7 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
|
||||
"title": d.fileInfo.Name,
|
||||
"url": downloadURL,
|
||||
"permissions": map[string]interface{}{
|
||||
"edit": utils.Ternary(config.Integrations.OnlyOffice.ViewOnly, "view", canEditMode),
|
||||
"edit": utils.Ternary(settings.Config.Integrations.OnlyOffice.ViewOnly, "view", canEditMode),
|
||||
"download": true,
|
||||
"print": true,
|
||||
},
|
||||
@@ -236,14 +227,14 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
|
||||
"uiTheme": themeMode,
|
||||
},
|
||||
"lang": d.user.Locale,
|
||||
"mode": utils.Ternary(config.Integrations.OnlyOffice.ViewOnly, "view", canEditMode),
|
||||
"mode": utils.Ternary(settings.Config.Integrations.OnlyOffice.ViewOnly, "view", canEditMode),
|
||||
},
|
||||
}
|
||||
|
||||
// Sign configuration with JWT if secret is configured
|
||||
if config.Integrations.OnlyOffice.Secret != "" {
|
||||
if settings.Config.Integrations.OnlyOffice.Secret != "" {
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims(clientConfig))
|
||||
signature, err := token.SignedString([]byte(config.Integrations.OnlyOffice.Secret))
|
||||
signature, err := token.SignedString([]byte(settings.Config.Integrations.OnlyOffice.Secret))
|
||||
if err != nil {
|
||||
logger.Errorf("OnlyOffice: failed to sign JWT: %v", err)
|
||||
return http.StatusInternalServerError, fmt.Errorf("failed to sign configuration")
|
||||
@@ -258,10 +249,10 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
|
||||
func buildOnlyOfficeDownloadURL(r *http.Request, source, path, hash, token string) string {
|
||||
// Determine base URL (internal URL takes priority for OnlyOffice server communication)
|
||||
var baseURL string
|
||||
if config.Server.InternalUrl != "" {
|
||||
if settings.Config.Server.InternalUrl != "" {
|
||||
// InternalUrl is a full URL (e.g., http://localhost:8080), so use it directly
|
||||
internalURL := strings.TrimSuffix(config.Server.InternalUrl, "/")
|
||||
baseURLPath := strings.TrimPrefix(config.Server.BaseURL, "/")
|
||||
internalURL := strings.TrimSuffix(settings.Config.Server.InternalUrl, "/")
|
||||
baseURLPath := strings.TrimPrefix(settings.Config.Server.BaseURL, "/")
|
||||
if baseURLPath != "" {
|
||||
baseURL = internalURL + "/" + baseURLPath
|
||||
} else {
|
||||
@@ -285,7 +276,7 @@ func buildOnlyOfficeDownloadURL(r *http.Request, source, path, hash, token strin
|
||||
host = r.Host
|
||||
scheme = getScheme(r)
|
||||
}
|
||||
baseURL = fmt.Sprintf("%s://%s%s", scheme, host, config.Server.BaseURL)
|
||||
baseURL = fmt.Sprintf("%s://%s%s", scheme, host, settings.Config.Server.BaseURL)
|
||||
}
|
||||
|
||||
escapedPath := url.QueryEscape(path)
|
||||
@@ -302,10 +293,10 @@ func buildOnlyOfficeDownloadURL(r *http.Request, source, path, hash, token strin
|
||||
func buildOnlyOfficeCallbackURL(r *http.Request, source, path, hash, token string) string {
|
||||
// Determine base URL (internal URL takes priority for OnlyOffice server communication)
|
||||
var baseURL string
|
||||
if config.Server.InternalUrl != "" {
|
||||
if settings.Config.Server.InternalUrl != "" {
|
||||
// InternalUrl is a full URL (e.g., http://localhost:8080), so use it directly
|
||||
internalURL := strings.TrimSuffix(config.Server.InternalUrl, "/")
|
||||
baseURLPath := strings.TrimPrefix(config.Server.BaseURL, "/")
|
||||
internalURL := strings.TrimSuffix(settings.Config.Server.InternalUrl, "/")
|
||||
baseURLPath := strings.TrimPrefix(settings.Config.Server.BaseURL, "/")
|
||||
if baseURLPath != "" {
|
||||
baseURL = internalURL + "/" + baseURLPath
|
||||
} else {
|
||||
@@ -329,7 +320,7 @@ func buildOnlyOfficeCallbackURL(r *http.Request, source, path, hash, token strin
|
||||
host = r.Host
|
||||
scheme = getScheme(r)
|
||||
}
|
||||
baseURL = fmt.Sprintf("%s://%s%s", scheme, host, config.Server.BaseURL)
|
||||
baseURL = fmt.Sprintf("%s://%s%s", scheme, host, settings.Config.Server.BaseURL)
|
||||
}
|
||||
|
||||
var callbackURL string
|
||||
@@ -356,97 +347,6 @@ func buildOnlyOfficeCallbackURL(r *http.Request, source, path, hash, token strin
|
||||
return callbackURL
|
||||
}
|
||||
|
||||
// resolveOnlyOfficeDownloadURL validates a callback document URL against
|
||||
// integrations.office.url and optionally rewrites the origin to integrations.office.internalUrl.
|
||||
// Returns an empty string when the URL is missing, malformed, or not hosted on the configured
|
||||
// OnlyOffice server (SSRF protection).
|
||||
func resolveOnlyOfficeDownloadURL(rawURL string) string {
|
||||
if rawURL == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
publicBase := config.Integrations.OnlyOffice.Url
|
||||
if publicBase == "" {
|
||||
logger.Warningf("OnlyOffice callback: integrations.office.url is not configured")
|
||||
return ""
|
||||
}
|
||||
|
||||
parsedURL, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
logger.Warningf("OnlyOffice callback: could not parse document URL (%q): %v", rawURL, err)
|
||||
return ""
|
||||
}
|
||||
|
||||
publicURL, err := url.Parse(publicBase)
|
||||
if err != nil {
|
||||
logger.Warningf("OnlyOffice callback: could not parse integrations.office.url (%q): %v", publicBase, err)
|
||||
return ""
|
||||
}
|
||||
|
||||
if !onlyOfficeURLHostsMatch(parsedURL, publicURL) {
|
||||
logger.Warningf("OnlyOffice callback: rejecting document URL with untrusted host %q (expected %q)",
|
||||
parsedURL.Host, publicURL.Host)
|
||||
return ""
|
||||
}
|
||||
|
||||
internalBase := config.Integrations.OnlyOffice.InternalUrl
|
||||
if internalBase == "" {
|
||||
return rawURL
|
||||
}
|
||||
|
||||
internalURL, err := url.Parse(internalBase)
|
||||
if err != nil {
|
||||
logger.Warningf("OnlyOffice callback: could not parse integrations.office.internalUrl (%q): %v", internalBase, err)
|
||||
return ""
|
||||
}
|
||||
if !isAllowedOnlyOfficeScheme(internalURL.Scheme) || internalURL.Host == "" {
|
||||
logger.Warningf("OnlyOffice callback: invalid integrations.office.internalUrl (%q)", internalBase)
|
||||
return ""
|
||||
}
|
||||
|
||||
rewritten := *parsedURL
|
||||
rewritten.Scheme = internalURL.Scheme
|
||||
rewritten.Host = internalURL.Host
|
||||
result := rewritten.String()
|
||||
if result != rawURL {
|
||||
logger.Debugf("OnlyOffice callback: rewrote URL from %s to %s", rawURL, result)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func isAllowedOnlyOfficeScheme(scheme string) bool {
|
||||
return scheme == "http" || scheme == "https"
|
||||
}
|
||||
|
||||
func onlyOfficeEffectivePort(u *url.URL) string {
|
||||
if port := u.Port(); port != "" {
|
||||
return port
|
||||
}
|
||||
switch u.Scheme {
|
||||
case "https":
|
||||
return "443"
|
||||
case "http":
|
||||
return "80"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// onlyOfficeURLHostsMatch reports whether callback and configured URLs refer to the same
|
||||
// OnlyOffice host, comparing hostname and effective port (so office.local matches office.local:80).
|
||||
func onlyOfficeURLHostsMatch(callback, configured *url.URL) bool {
|
||||
if !isAllowedOnlyOfficeScheme(callback.Scheme) || !isAllowedOnlyOfficeScheme(configured.Scheme) {
|
||||
return false
|
||||
}
|
||||
if callback.Hostname() == "" || configured.Hostname() == "" {
|
||||
return false
|
||||
}
|
||||
if !strings.EqualFold(callback.Hostname(), configured.Hostname()) {
|
||||
return false
|
||||
}
|
||||
return onlyOfficeEffectivePort(callback) == onlyOfficeEffectivePort(configured)
|
||||
}
|
||||
|
||||
// processOnlyOfficeCallback handles the common callback processing logic for both GET and POST requests
|
||||
func processOnlyOfficeCallback(w http.ResponseWriter, r *http.Request, d *requestContext, data *OnlyOfficeCallback) (int, error) {
|
||||
// Extract clean parameters from query string
|
||||
@@ -592,12 +492,7 @@ func processOnlyOfficeCallback(w http.ResponseWriter, r *http.Request, d *reques
|
||||
}
|
||||
|
||||
// Download the updated document from OnlyOffice server
|
||||
downloadURL := resolveOnlyOfficeDownloadURL(data.URL)
|
||||
if downloadURL == "" {
|
||||
logger.Errorf("OnlyOffice callback: missing or untrusted document URL in callback payload")
|
||||
return returnOnlyOfficeError(w, r, 500, "missing or untrusted document URL in callback payload")
|
||||
}
|
||||
doc, err := onlyOfficeDownloadClient.Get(downloadURL)
|
||||
doc, err := http.Get(data.URL)
|
||||
if err != nil {
|
||||
logger.Errorf("OnlyOffice callback: failed to download updated document: %v", err)
|
||||
return returnOnlyOfficeError(w, r, 500, "failed to download updated document")
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestResolveOnlyOfficeDownloadURL(t *testing.T) {
|
||||
orig := config.Integrations.OnlyOffice
|
||||
t.Cleanup(func() {
|
||||
config.Integrations.OnlyOffice = orig
|
||||
})
|
||||
|
||||
config.Integrations.OnlyOffice.Url = "http://192.168.88.100:8282"
|
||||
config.Integrations.OnlyOffice.InternalUrl = "http://onlyoffice"
|
||||
|
||||
cachePath := "/cache/files/data/doc_1/output.ods/output.ods?md5=abc&expires=1"
|
||||
publicURL := "http://192.168.88.100:8282" + cachePath
|
||||
internalURL := "http://onlyoffice" + cachePath
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
input string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "rewrites public cache URL to internal host",
|
||||
input: publicURL,
|
||||
want: internalURL,
|
||||
},
|
||||
{
|
||||
name: "empty URL",
|
||||
input: "",
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "untrusted host rejected",
|
||||
input: "http://other-host:8282" + cachePath,
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "non-http scheme rejected",
|
||||
input: "ftp://192.168.88.100:8282" + cachePath,
|
||||
want: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := resolveOnlyOfficeDownloadURL(tt.input)
|
||||
if got != tt.want {
|
||||
t.Errorf("resolveOnlyOfficeDownloadURL() = %q, want %q", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("pass through public URL when internalUrl unset", func(t *testing.T) {
|
||||
config.Integrations.OnlyOffice.InternalUrl = ""
|
||||
got := resolveOnlyOfficeDownloadURL(publicURL)
|
||||
if got != publicURL {
|
||||
t.Errorf("resolveOnlyOfficeDownloadURL() = %q, want %q", got, publicURL)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("hostname match with default http port", func(t *testing.T) {
|
||||
config.Integrations.OnlyOffice.Url = "http://office.local"
|
||||
config.Integrations.OnlyOffice.InternalUrl = "http://onlyoffice"
|
||||
input := "http://office.local:80" + cachePath
|
||||
want := "http://onlyoffice" + cachePath
|
||||
got := resolveOnlyOfficeDownloadURL(input)
|
||||
if got != want {
|
||||
t.Errorf("resolveOnlyOfficeDownloadURL() = %q, want %q", got, want)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("reject when public url not configured", func(t *testing.T) {
|
||||
config.Integrations.OnlyOffice.Url = ""
|
||||
config.Integrations.OnlyOffice.InternalUrl = "http://onlyoffice"
|
||||
got := resolveOnlyOfficeDownloadURL(publicURL)
|
||||
if got != "" {
|
||||
t.Errorf("resolveOnlyOfficeDownloadURL() = %q, want empty", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestOnlyOfficeURLHostsMatch(t *testing.T) {
|
||||
mustParse := func(raw string) *url.URL {
|
||||
t.Helper()
|
||||
u, err := url.Parse(raw)
|
||||
if err != nil {
|
||||
t.Fatalf("url.Parse(%q): %v", raw, err)
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
if !onlyOfficeURLHostsMatch(mustParse("http://office.local:80/x"), mustParse("http://office.local/x")) {
|
||||
t.Fatal("expected office.local:80 to match office.local with default port")
|
||||
}
|
||||
if onlyOfficeURLHostsMatch(mustParse("http://evil.example/x"), mustParse("http://office.local/x")) {
|
||||
t.Fatal("expected different hostnames not to match")
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/files"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/indexing/iteminfo"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/preview"
|
||||
@@ -120,7 +121,7 @@ func getDirectoryPreview(r *http.Request, d *requestContext, frameIndex int) (*i
|
||||
path := utils.JoinPathAsUnix(d.fileInfo.Path, name)
|
||||
user := d.user
|
||||
if d.share != nil {
|
||||
sourceInfo, ok := config.Server.SourceMap[d.share.Source]
|
||||
sourceInfo, ok := settings.Config.Server.SourceMap[d.share.Source]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("source not found for share")
|
||||
}
|
||||
@@ -213,7 +214,7 @@ func previewHelperFunc(w http.ResponseWriter, r *http.Request, d *requestContext
|
||||
if d.fileInfo.OnlyOfficeId != "" {
|
||||
pathUrl := fmt.Sprintf("/api/resources/download?file=%s&source=%s", url.QueryEscape(d.fileInfo.Path), url.QueryEscape(d.fileInfo.Source))
|
||||
pathUrl = pathUrl + "&auth=" + d.token
|
||||
if config.Server.InternalUrl != "" {
|
||||
if settings.Config.Server.InternalUrl != "" {
|
||||
officeUrl = config.Server.InternalUrl + pathUrl
|
||||
} else {
|
||||
scheme := "http"
|
||||
|
||||
+4
-12
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/files"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/preview"
|
||||
"github.com/gtsteffaniak/go-logger/logger"
|
||||
@@ -79,7 +80,7 @@ func publicDownloadHandler(w http.ResponseWriter, r *http.Request, d *requestCon
|
||||
}
|
||||
|
||||
// Get the actual source name from the share's source mapping
|
||||
sourceInfo, ok := config.Server.SourceMap[d.share.Source]
|
||||
sourceInfo, ok := settings.Config.Server.SourceMap[d.share.Source]
|
||||
if !ok {
|
||||
return http.StatusInternalServerError, fmt.Errorf("source not found for share")
|
||||
}
|
||||
@@ -367,19 +368,10 @@ func publicPatchHandler(w http.ResponseWriter, r *http.Request, d *requestContex
|
||||
// Note: Share paths are absolute, so we don't strip user scope here
|
||||
// resourcePatchHandler will skip adding scope for shares
|
||||
for i := range req.Items {
|
||||
var sanitizedPath string
|
||||
sanitizedPath, err = utils.SanitizeUserPath(req.Items[i].FromPath)
|
||||
if err != nil {
|
||||
return http.StatusBadRequest, fmt.Errorf("invalid from path: %w", err)
|
||||
}
|
||||
req.Items[i].FromSource = sourceName
|
||||
req.Items[i].FromPath = utils.JoinPathAsUnix(d.share.Path, sanitizedPath)
|
||||
sanitizedPath, err = utils.SanitizeUserPath(req.Items[i].ToPath)
|
||||
if err != nil {
|
||||
return http.StatusBadRequest, fmt.Errorf("invalid to path: %w", err)
|
||||
}
|
||||
req.Items[i].FromPath = utils.JoinPathAsUnix(d.share.Path, req.Items[i].FromPath)
|
||||
req.Items[i].ToSource = sourceName
|
||||
req.Items[i].ToPath = utils.JoinPathAsUnix(d.share.Path, sanitizedPath)
|
||||
req.Items[i].ToPath = utils.JoinPathAsUnix(d.share.Path, req.Items[i].ToPath)
|
||||
}
|
||||
d.Data = req
|
||||
|
||||
|
||||
+13
-86
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/files"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/fileutils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/indexing"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/indexing/iteminfo"
|
||||
@@ -98,7 +99,7 @@ func resourceGetHandler(w http.ResponseWriter, r *http.Request, d *requestContex
|
||||
Expand: true,
|
||||
Content: getContent,
|
||||
Metadata: getMetadata,
|
||||
ExtractEmbeddedSubtitles: config.Integrations.Media.ExtractEmbeddedSubtitles,
|
||||
ExtractEmbeddedSubtitles: settings.Config.Integrations.Media.ExtractEmbeddedSubtitles,
|
||||
ShowHidden: d.user.ShowHidden,
|
||||
HideFileExt: d.user.HideFileExt,
|
||||
SkipExtendedAttrs: skipExtendedAttrs,
|
||||
@@ -145,27 +146,18 @@ func resourceDeleteHandler(w http.ResponseWriter, r *http.Request, d *requestCon
|
||||
if !d.user.Permissions.Delete {
|
||||
return http.StatusForbidden, fmt.Errorf("user is not allowed to delete")
|
||||
}
|
||||
|
||||
path := r.URL.Query().Get("path")
|
||||
source := r.URL.Query().Get("source")
|
||||
|
||||
if path == "/" {
|
||||
return http.StatusForbidden, fmt.Errorf("cannot delete your user's root directory")
|
||||
}
|
||||
|
||||
idx := indexing.GetIndex(source)
|
||||
if idx == nil {
|
||||
return http.StatusNotFound, fmt.Errorf("source %s not found", source)
|
||||
}
|
||||
|
||||
if idx.Config.ReadOnly {
|
||||
return http.StatusForbidden, fmt.Errorf("source is read-only")
|
||||
}
|
||||
|
||||
fileInfo, err := files.FileInfoFaster(utils.FileOptions{
|
||||
Path: path,
|
||||
Source: source,
|
||||
Expand: false,
|
||||
ShowHidden: d.user.ShowHidden,
|
||||
Path: path,
|
||||
Source: source,
|
||||
Expand: false,
|
||||
ShowHidden: d.user.ShowHidden,
|
||||
HideFileExt: d.user.HideFileExt,
|
||||
}, store.Access, d.user, store.Share)
|
||||
if err != nil {
|
||||
@@ -294,33 +286,8 @@ func resourceBulkDeleteHandler(w http.ResponseWriter, r *http.Request, d *reques
|
||||
if d.share != nil {
|
||||
sourceName := d.share.GetSourceName()
|
||||
if sourceName == "" {
|
||||
response.Failed = append(response.Failed, BulkDeleteItem{
|
||||
Source: item.Source,
|
||||
Path: sanitizedPath,
|
||||
Message: "source name is empty",
|
||||
})
|
||||
continue
|
||||
return http.StatusNotFound, fmt.Errorf("source not available")
|
||||
}
|
||||
|
||||
idx := indexing.GetIndex(sourceName)
|
||||
if idx == nil {
|
||||
response.Failed = append(response.Failed, BulkDeleteItem{
|
||||
Source: item.Source,
|
||||
Path: sanitizedPath,
|
||||
Message: "source not found",
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
if idx.Config.ReadOnly {
|
||||
response.Failed = append(response.Failed, BulkDeleteItem{
|
||||
Source: item.Source,
|
||||
Path: sanitizedPath,
|
||||
Message: "source is read-only",
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// get user scope path from share
|
||||
userScope, err := d.shareUser.GetScopeForSourceName(sourceName)
|
||||
if err != nil {
|
||||
@@ -389,15 +356,6 @@ func resourceBulkDeleteHandler(w http.ResponseWriter, r *http.Request, d *reques
|
||||
continue
|
||||
}
|
||||
|
||||
if idx.Config.ReadOnly {
|
||||
response.Failed = append(response.Failed, BulkDeleteItem{
|
||||
Source: item.Source,
|
||||
Path: sanitizedPath,
|
||||
Message: "source is read-only",
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
// Get file info
|
||||
fileInfo, err := files.FileInfoFaster(utils.FileOptions{
|
||||
FollowSymlinks: true,
|
||||
@@ -535,17 +493,6 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
|
||||
if d.share == nil && !d.user.Permissions.Create {
|
||||
return http.StatusForbidden, fmt.Errorf("user is not allowed to create or modify")
|
||||
}
|
||||
|
||||
idx := indexing.GetIndex(source)
|
||||
if idx == nil {
|
||||
logger.Debugf("source %s not found", source)
|
||||
return http.StatusNotFound, fmt.Errorf("source %s not found", source)
|
||||
}
|
||||
|
||||
if idx.Config.ReadOnly {
|
||||
return http.StatusForbidden, fmt.Errorf("source is read-only")
|
||||
}
|
||||
|
||||
filePermUser := d.user
|
||||
if d.share != nil {
|
||||
filePermUser = d.shareUser
|
||||
@@ -557,6 +504,11 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
|
||||
Expand: false,
|
||||
FollowSymlinks: true,
|
||||
}
|
||||
idx := indexing.GetIndex(source)
|
||||
if idx == nil {
|
||||
logger.Debugf("source %s not found", source)
|
||||
return http.StatusNotFound, fmt.Errorf("source %s not found", source)
|
||||
}
|
||||
|
||||
userscope, err := filePermUser.GetScopeForSourceName(source)
|
||||
if err != nil {
|
||||
@@ -770,9 +722,6 @@ func resourcePutHandler(w http.ResponseWriter, r *http.Request, d *requestContex
|
||||
if idx == nil {
|
||||
return http.StatusNotFound, fmt.Errorf("source %s not found", source)
|
||||
}
|
||||
if idx.Config.ReadOnly {
|
||||
return http.StatusForbidden, fmt.Errorf("source is read-only")
|
||||
}
|
||||
if store.Access != nil && !store.Access.Permitted(idx.Path, fullIndexPath, d.user.Username) {
|
||||
logger.Debugf("user %s denied access to path %s", d.user.Username, fullIndexPath)
|
||||
return http.StatusForbidden, fmt.Errorf("access denied to path %s", path)
|
||||
@@ -906,28 +855,6 @@ func resourcePatchHandler(w http.ResponseWriter, r *http.Request, d *requestCont
|
||||
continue
|
||||
}
|
||||
|
||||
if srcIdx.Config.ReadOnly && req.Action == "move" {
|
||||
item.Message = "source source is read-only"
|
||||
if d.share != nil {
|
||||
response.Failed = append(response.Failed, MoveCopyItem{
|
||||
Message: item.Message,
|
||||
})
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if dstIdx.Config.ReadOnly {
|
||||
item.Message = "destination source is read-only"
|
||||
if d.share != nil {
|
||||
response.Failed = append(response.Failed, MoveCopyItem{
|
||||
Message: item.Message,
|
||||
})
|
||||
continue
|
||||
}
|
||||
response.Failed = append(response.Failed, item)
|
||||
continue
|
||||
}
|
||||
|
||||
// Build full index paths for access control
|
||||
fullSrcIndexPath := utils.JoinPathAsUnix(userscopeSrc, item.FromPath)
|
||||
fullDstIndexPath := utils.JoinPathAsUnix(userscopeDst, item.ToPath)
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/indexing"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/indexing/iteminfo"
|
||||
@@ -42,12 +43,12 @@ type scopedSourcePath struct {
|
||||
//
|
||||
// Per-source search scope (preferred for multi-source):
|
||||
//
|
||||
// Repeated query parameter "scope" with the value "sourceName:relativePath",
|
||||
// split on the first colon. The path is user-relative (same as the legacy single-scope
|
||||
// path). Encode the whole value with the normal query string rules (e.g. %3A for ':' if needed).
|
||||
// Examples:
|
||||
// ?scope=mydisk:/&scope=backup:/Photos
|
||||
// Duplicate source names: the last repeated scope for that source wins.
|
||||
// Repeated query parameter "scope" with the value "sourceName:relativePath",
|
||||
// split on the first colon. The path is user-relative (same as the legacy single-scope
|
||||
// path). Encode the whole value with the normal query string rules (e.g. %3A for ':' if needed).
|
||||
// Examples:
|
||||
// ?scope=mydisk:/&scope=backup:/Photos
|
||||
// Duplicate source names: the last repeated scope for that source wins.
|
||||
//
|
||||
// Legacy (still supported):
|
||||
//
|
||||
@@ -256,7 +257,7 @@ func prepSearchOptions(r *http.Request, d *requestContext) (*searchOptions, erro
|
||||
|
||||
parsed := iteminfo.BuildSearchOptionsFromQuery(query, normalizedTerms, matchAllTerms)
|
||||
|
||||
minLen := config.Server.MinSearchLength
|
||||
minLen := settings.Config.Server.MinSearchLength
|
||||
if !largest {
|
||||
if len(normalizedTerms) > 0 {
|
||||
for _, t := range normalizedTerms {
|
||||
|
||||
@@ -206,12 +206,6 @@ func sharePatchHandler(w http.ResponseWriter, r *http.Request, d *requestContext
|
||||
return http.StatusBadRequest, fmt.Errorf("hash and path are required")
|
||||
}
|
||||
|
||||
sanitizedPath, err := utils.SanitizeUserPath(body.Path)
|
||||
if err != nil {
|
||||
return http.StatusBadRequest, fmt.Errorf("invalid path: %w", err)
|
||||
}
|
||||
body.Path = sanitizedPath
|
||||
|
||||
// only allow users to update their own shares
|
||||
thisShare, err := store.Share.GetByHash(body.Hash)
|
||||
if err != nil {
|
||||
@@ -221,7 +215,7 @@ func sharePatchHandler(w http.ResponseWriter, r *http.Request, d *requestContext
|
||||
return http.StatusForbidden, fmt.Errorf("you are not allowed to update this share")
|
||||
}
|
||||
// Update the share path
|
||||
err = store.Share.UpdateSharePath(body.Hash, sanitizedPath)
|
||||
err = store.Share.UpdateSharePath(body.Hash, body.Path)
|
||||
if err != nil {
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
|
||||
favicon := staticURL + "/favicon" + faviconExt
|
||||
shareHash := ""
|
||||
data := make(map[string]interface{})
|
||||
disableNavButtons := config.Frontend.DisableNavButtons
|
||||
if d.share != nil {
|
||||
disableNavButtons := settings.Config.Frontend.DisableNavButtons
|
||||
if d.share != nil && d.shareValid {
|
||||
if d.share.Favicon != "" {
|
||||
if strings.HasPrefix(d.share.Favicon, "http") {
|
||||
favicon = d.share.Favicon
|
||||
@@ -185,28 +185,28 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
|
||||
"pwaIcon512": pwaIcon512,
|
||||
"manifestURL": staticURL + "/site.webmanifest",
|
||||
}
|
||||
|
||||
// variables consumed by frontend as json
|
||||
data["globalVars"] = map[string]interface{}{
|
||||
"name": config.Frontend.Name,
|
||||
"minSearchLength": config.Server.MinSearchLength,
|
||||
"disableExternal": config.Frontend.DisableDefaultLinks,
|
||||
"darkMode": config.UserDefaults.UI.DarkMode,
|
||||
"darkMode": settings.Config.UserDefaults.UI.DarkMode,
|
||||
"baseURL": config.Server.BaseURL,
|
||||
"version": versionString,
|
||||
"commitSHA": commitSHAString,
|
||||
"signup": config.Auth.Methods.PasswordAuth.Signup,
|
||||
"signup": settings.Config.Auth.Methods.PasswordAuth.Signup,
|
||||
"noAuth": config.Auth.Methods.NoAuth,
|
||||
"enableThumbs": !config.Server.DisablePreviews,
|
||||
"externalLinks": externalLinks,
|
||||
"externalUrl": strings.TrimSuffix(config.Server.ExternalUrl, "/"),
|
||||
"onlyOfficeUrl": config.Integrations.OnlyOffice.Url,
|
||||
"onlyOfficeUrl": settings.Config.Integrations.OnlyOffice.Url,
|
||||
"oidcAvailable": config.Auth.Methods.OidcAuth.Enabled,
|
||||
"jwtAvailable": config.Auth.Methods.JwtAuth.Enabled,
|
||||
"proxyAvailable": config.Auth.Methods.ProxyAuth.Enabled,
|
||||
"passwordAvailable": config.Auth.Methods.PasswordAuth.Enabled,
|
||||
"ldapAvailable": config.Auth.Methods.LdapAuth.Enabled,
|
||||
"mediaAvailable": settings.MediaEnabled(),
|
||||
"exiftoolAvailable": config.Integrations.Media.ExiftoolPath != "",
|
||||
"exiftoolAvailable": settings.Config.Integrations.Media.ExiftoolPath != "",
|
||||
"muPdfAvailable": settings.Env.MuPdfAvailable,
|
||||
"updateAvailable": utils.GetUpdateAvailableUrl(),
|
||||
"disableNavButtons": disableNavButtons,
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/auth"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/database/storage"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/database/users"
|
||||
@@ -131,7 +132,7 @@ func GetFrontendSidebarLinks(links []users.SidebarLink, showToolsInSidebar bool)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if full, ok := config.Server.SourceMap[source.Path]; ok {
|
||||
if full, ok := settings.Config.Server.SourceMap[source.Path]; ok {
|
||||
if full.Config.ResolvedRules.IndexingDisabled && link.Category != "source-minimal" {
|
||||
link.Category = "source-alt"
|
||||
}
|
||||
|
||||
+12
-20
@@ -27,9 +27,7 @@ func beginPasskeyLoginHandler(w http.ResponseWriter, r *http.Request, d *request
|
||||
return http.StatusForbidden, errors.ErrPasskeyNotEnabled
|
||||
}
|
||||
|
||||
if err := validateRequestOrigin(r); err != nil {
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
registerRequestOrigin(r)
|
||||
|
||||
username := r.URL.Query().Get("username")
|
||||
password := r.Header.Get("X-Password")
|
||||
@@ -72,9 +70,7 @@ func finishPasskeyLoginHandler(w http.ResponseWriter, r *http.Request, d *reques
|
||||
return http.StatusForbidden, errors.ErrPasskeyNotEnabled
|
||||
}
|
||||
|
||||
if err := validateRequestOrigin(r); err != nil {
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
registerRequestOrigin(r)
|
||||
|
||||
sessionID := r.URL.Query().Get("session_id")
|
||||
if sessionID == "" {
|
||||
@@ -104,9 +100,7 @@ func beginPasskeyRegistrationHandler(w http.ResponseWriter, r *http.Request, d *
|
||||
return http.StatusForbidden, errors.ErrPasskeyNotEnabled
|
||||
}
|
||||
|
||||
if err := validateRequestOrigin(r); err != nil {
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
registerRequestOrigin(r)
|
||||
|
||||
rpID := deriveRPID(r)
|
||||
svc := auth.GetWebAuthn()
|
||||
@@ -140,9 +134,7 @@ func finishPasskeyRegistrationHandler(w http.ResponseWriter, r *http.Request, d
|
||||
return http.StatusForbidden, errors.ErrPasskeyNotEnabled
|
||||
}
|
||||
|
||||
if err := validateRequestOrigin(r); err != nil {
|
||||
return http.StatusForbidden, err
|
||||
}
|
||||
registerRequestOrigin(r)
|
||||
|
||||
sessionID := r.URL.Query().Get("session_id")
|
||||
credentialName := r.URL.Query().Get("name")
|
||||
@@ -215,9 +207,8 @@ func deriveRPID(r *http.Request) string {
|
||||
return host
|
||||
}
|
||||
|
||||
// validateRequestOrigin validates that the request's origin is in the configured whitelist.
|
||||
// Returns an error if the origin is not allowed.
|
||||
func validateRequestOrigin(r *http.Request) error {
|
||||
// registerRequestOrigin registers the request's origin and RP ID with the WebAuthn service.
|
||||
func registerRequestOrigin(r *http.Request) {
|
||||
scheme := "http"
|
||||
if r.TLS != nil {
|
||||
scheme = "https"
|
||||
@@ -229,12 +220,13 @@ func validateRequestOrigin(r *http.Request) error {
|
||||
host = r.Host
|
||||
}
|
||||
origin := fmt.Sprintf("%s://%s", scheme, host)
|
||||
|
||||
rpID := host
|
||||
if i := strings.LastIndex(rpID, ":"); i != -1 {
|
||||
rpID = rpID[:i]
|
||||
}
|
||||
svc := auth.GetWebAuthn()
|
||||
if svc != nil {
|
||||
if !svc.ValidateOrigin(origin) {
|
||||
return fmt.Errorf("origin %s is not in the configured whitelist", origin)
|
||||
}
|
||||
svc.EnsureOrigin(origin)
|
||||
svc.EnsureRPID(rpID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+49
-49
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
storm "github.com/asdine/storm/v3"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/files"
|
||||
commonerrors "github.com/gtsteffaniak/filebrowser/backend/common/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/utils"
|
||||
commonerrors "github.com/gtsteffaniak/filebrowser/backend/common/errors"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/database/access"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/database/share"
|
||||
"github.com/gtsteffaniak/filebrowser/backend/database/storage/bolt"
|
||||
@@ -41,7 +41,7 @@ func setupWebDAVTestEnv(t *testing.T) (string, string) {
|
||||
filepath.Join(dockerPath, "data"),
|
||||
filepath.Join(source2Path, "shared"),
|
||||
}
|
||||
|
||||
|
||||
for _, dir := range dirs {
|
||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -50,12 +50,12 @@ func setupWebDAVTestEnv(t *testing.T) (string, string) {
|
||||
|
||||
// Create test files
|
||||
testFiles := map[string]string{
|
||||
filepath.Join(source1Path, "public", "readme.txt"): "public content",
|
||||
filepath.Join(source1Path, "private", "secret.txt"): "private content",
|
||||
filepath.Join(source1Path, "viewable-only", "data.txt"): "viewable content",
|
||||
filepath.Join(source1Path, "not-viewable", "hidden.txt"): "hidden content",
|
||||
filepath.Join(dockerPath, "data", "config.yml"): "docker config",
|
||||
filepath.Join(source2Path, "shared", "document.txt"): "shared content",
|
||||
filepath.Join(source1Path, "public", "readme.txt"): "public content",
|
||||
filepath.Join(source1Path, "private", "secret.txt"): "private content",
|
||||
filepath.Join(source1Path, "viewable-only", "data.txt"): "viewable content",
|
||||
filepath.Join(source1Path, "not-viewable", "hidden.txt"): "hidden content",
|
||||
filepath.Join(dockerPath, "data", "config.yml"): "docker config",
|
||||
filepath.Join(source2Path, "shared", "document.txt"): "shared content",
|
||||
}
|
||||
|
||||
for path, content := range testFiles {
|
||||
@@ -74,18 +74,18 @@ func setupWebDAVTestEnv(t *testing.T) (string, string) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
||||
// Clear any previous access rules
|
||||
store.Access.AllRules = make(access.SourceRuleMap)
|
||||
store.Access.Groups = make(access.GroupMap)
|
||||
|
||||
// Set cache directory for index database
|
||||
config.Server.CacheDir = tempDir
|
||||
|
||||
// Setup config with sources - update both the local config var AND the global config
|
||||
settings.Config.Server.CacheDir = tempDir
|
||||
|
||||
// Setup config with sources - update both the local config var AND the global settings.Config
|
||||
config = &settings.Settings{
|
||||
Server: settings.Server{
|
||||
BaseURL: "/", // Use / for tests to avoid prefix mismatch
|
||||
BaseURL: "/", // Use / for tests to avoid prefix mismatch
|
||||
CacheDir: tempDir,
|
||||
SourceMap: map[string]*settings.Source{
|
||||
source1Path: {
|
||||
@@ -109,8 +109,8 @@ func setupWebDAVTestEnv(t *testing.T) (string, string) {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// CRITICAL: Also update the global config so access.Permitted can find sources
|
||||
|
||||
// CRITICAL: Also update the global settings.Config so access.Permitted can find sources
|
||||
settings.Config.Server.SourceMap = config.Server.SourceMap
|
||||
settings.Config.Server.NameToSource = config.Server.NameToSource
|
||||
|
||||
@@ -136,11 +136,11 @@ func setupWebDAVTestEnv(t *testing.T) (string, string) {
|
||||
// mockCheckPermissions mocks the CheckPermissions function to bypass index lookups
|
||||
func mockCheckPermissions(t *testing.T, source1Path, source2Path string) {
|
||||
t.Helper()
|
||||
|
||||
|
||||
// Store original function
|
||||
originalCheckPermissions := files.CheckPermissionsFunc
|
||||
t.Cleanup(func() { files.CheckPermissionsFunc = originalCheckPermissions })
|
||||
|
||||
|
||||
// Mock the function
|
||||
files.CheckPermissionsFunc = func(opts utils.FileOptions, access *access.Storage, user *users.User) (string, string, error) {
|
||||
// Get the source path
|
||||
@@ -152,7 +152,7 @@ func mockCheckPermissions(t *testing.T, source1Path, source2Path string) {
|
||||
} else {
|
||||
return "", "", fmt.Errorf("unknown source: %s", opts.Source)
|
||||
}
|
||||
|
||||
|
||||
// Get user scope for this source - match by source PATH, not name
|
||||
userScope := "/"
|
||||
hasScope := false
|
||||
@@ -163,26 +163,26 @@ func mockCheckPermissions(t *testing.T, source1Path, source2Path string) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If user has no scope for this source, deny access
|
||||
if !hasScope && len(user.Scopes) > 0 {
|
||||
return "", "", fmt.Errorf("user has no access to source: %s", opts.Source)
|
||||
}
|
||||
|
||||
|
||||
// Sanitize path
|
||||
safePath, err := utils.SanitizeUserPath(opts.Path)
|
||||
if err != nil {
|
||||
return "", "", commonerrors.ErrAccessDenied
|
||||
}
|
||||
|
||||
|
||||
// Combine scope + sanitized path
|
||||
indexPath := utils.JoinPathAsUnix(userScope, safePath)
|
||||
|
||||
|
||||
// Check access control
|
||||
if access != nil && !access.Permitted(sourcePath, indexPath, user.Username) {
|
||||
return "", "", commonerrors.ErrAccessDenied
|
||||
}
|
||||
|
||||
|
||||
return indexPath, userScope, nil
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ func mockWebDAVIndexing(t *testing.T, source1Path, source2Path string) {
|
||||
} else {
|
||||
return nil, fmt.Errorf("unknown source: %s", opts.Source)
|
||||
}
|
||||
|
||||
|
||||
// Simulate access control
|
||||
if access != nil && user != nil {
|
||||
// Simple scope check based on user's configured scopes (which use source PATH)
|
||||
@@ -214,7 +214,7 @@ func mockWebDAVIndexing(t *testing.T, source1Path, source2Path string) {
|
||||
// Check if path is within user's scope
|
||||
userScope := scope.Scope
|
||||
fullPath := utils.JoinPathAsUnix(userScope, opts.Path)
|
||||
|
||||
|
||||
// Check if user has permission using the access storage
|
||||
if !access.Permitted(sourcePath, fullPath, user.Username) {
|
||||
return nil, commonerrors.ErrAccessDenied
|
||||
@@ -229,12 +229,12 @@ func mockWebDAVIndexing(t *testing.T, source1Path, source2Path string) {
|
||||
|
||||
// Simulate indexing rules
|
||||
path := opts.Path
|
||||
|
||||
|
||||
// Paths containing "not-viewable" are not indexed and not viewable
|
||||
if strings.Contains(path, "not-viewable") {
|
||||
return nil, commonerrors.ErrNotViewable
|
||||
}
|
||||
|
||||
|
||||
// Paths containing "viewable-only" are not indexed but viewable
|
||||
if strings.Contains(path, "viewable-only") {
|
||||
return nil, commonerrors.ErrNotIndexed
|
||||
@@ -333,12 +333,12 @@ func TestWebDAV_PROPFIND_UserScopes(t *testing.T) {
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
user *users.User
|
||||
source string
|
||||
path string
|
||||
expectedStatus int
|
||||
shouldHaveContent bool
|
||||
name string
|
||||
user *users.User
|
||||
source string
|
||||
path string
|
||||
expectedStatus int
|
||||
shouldHaveContent bool
|
||||
}{
|
||||
{
|
||||
name: "Admin can access root of source1",
|
||||
@@ -353,7 +353,7 @@ func TestWebDAV_PROPFIND_UserScopes(t *testing.T) {
|
||||
user: scopedUser,
|
||||
source: "source1",
|
||||
path: "/",
|
||||
expectedStatus: 207, // PROPFIND returns 207 Multi-Status
|
||||
expectedStatus: 207, // PROPFIND returns 207 Multi-Status
|
||||
shouldHaveContent: false, // Empty because _docker is not viewable
|
||||
},
|
||||
{
|
||||
@@ -390,19 +390,19 @@ func TestWebDAV_PROPFIND_UserScopes(t *testing.T) {
|
||||
req := httptest.NewRequest("PROPFIND", "/dav/"+tc.source+tc.path, nil)
|
||||
req.SetPathValue("source", tc.source)
|
||||
req.SetPathValue("path", tc.path)
|
||||
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
ctx := &requestContext{user: tc.user}
|
||||
|
||||
status, err := webDAVHandler(w, req, ctx)
|
||||
|
||||
|
||||
// If handler returned an error status, use that instead of response code
|
||||
if status != 0 && status != http.StatusOK {
|
||||
if w.Code == 0 || w.Code == http.StatusOK {
|
||||
w.Code = status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check the actual HTTP response status code from ResponseWriter
|
||||
if w.Code != tc.expectedStatus {
|
||||
t.Errorf("expected status %d, got %d (err: %v)", tc.expectedStatus, w.Code, err)
|
||||
@@ -529,7 +529,7 @@ func TestWebDAV_WriteOperations(t *testing.T) {
|
||||
name: "Scoped user can write in their scope",
|
||||
user: scopedUser,
|
||||
method: http.MethodPut,
|
||||
path: "/scopedfile.txt", // Path relative to scope (/public)
|
||||
path: "/scopedfile.txt", // Path relative to scope (/public)
|
||||
expectedStatus: http.StatusCreated, // 201 for new file
|
||||
},
|
||||
{
|
||||
@@ -551,19 +551,19 @@ func TestWebDAV_WriteOperations(t *testing.T) {
|
||||
req := httptest.NewRequest(tc.method, "/dav/source1"+tc.path, body)
|
||||
req.SetPathValue("source", "source1")
|
||||
req.SetPathValue("path", tc.path)
|
||||
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
ctx := &requestContext{user: tc.user}
|
||||
|
||||
status, err := webDAVHandler(w, req, ctx)
|
||||
|
||||
|
||||
// If handler returned an error status, use that instead of response code
|
||||
if status != 0 && status != http.StatusOK {
|
||||
if w.Code == 0 || w.Code == http.StatusOK {
|
||||
w.Code = status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check the actual HTTP response status code from ResponseWriter
|
||||
if w.Code != tc.expectedStatus {
|
||||
t.Errorf("expected status %d, got %d (err: %v)", tc.expectedStatus, w.Code, err)
|
||||
@@ -611,7 +611,7 @@ func TestWebDAV_AccessControl(t *testing.T) {
|
||||
|
||||
// Initialize index
|
||||
initTestIndex(t, "source1", source1Path)
|
||||
|
||||
|
||||
// Create access rules by using the internal structure
|
||||
// User1 can access /private, user2 cannot
|
||||
// Set up a deny rule for user2 at /private
|
||||
@@ -621,7 +621,7 @@ func TestWebDAV_AccessControl(t *testing.T) {
|
||||
Users: access.StringSet{"user2": struct{}{}},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
// Add the rule to the access storage
|
||||
if store.Access.AllRules == nil {
|
||||
store.Access.AllRules = make(access.SourceRuleMap)
|
||||
@@ -668,19 +668,19 @@ func TestWebDAV_AccessControl(t *testing.T) {
|
||||
req := httptest.NewRequest("PROPFIND", "/dav/source1"+tc.path, nil)
|
||||
req.SetPathValue("source", "source1")
|
||||
req.SetPathValue("path", tc.path)
|
||||
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
ctx := &requestContext{user: tc.user}
|
||||
|
||||
status, err := webDAVHandler(w, req, ctx)
|
||||
|
||||
|
||||
// If handler returned an error status, use that instead of response code
|
||||
if status != 0 && status != http.StatusOK {
|
||||
if w.Code == 0 || w.Code == http.StatusOK {
|
||||
w.Code = status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check the actual HTTP response status code from ResponseWriter
|
||||
if w.Code != tc.expectedStatus {
|
||||
t.Errorf("expected status %d, got %d (err: %v)", tc.expectedStatus, w.Code, err)
|
||||
@@ -775,19 +775,19 @@ func TestWebDAV_IndexingStates(t *testing.T) {
|
||||
req := httptest.NewRequest(tc.method, "/dav/source1"+tc.path, body)
|
||||
req.SetPathValue("source", "source1")
|
||||
req.SetPathValue("path", tc.path)
|
||||
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
ctx := &requestContext{user: user}
|
||||
|
||||
status, err := webDAVHandler(w, req, ctx)
|
||||
|
||||
|
||||
// If handler returned an error status, use that instead of response code
|
||||
if status != 0 && status != http.StatusOK {
|
||||
if w.Code == 0 || w.Code == http.StatusOK {
|
||||
w.Code = status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check the actual HTTP response status code from ResponseWriter
|
||||
if w.Code != tc.expectedStatus {
|
||||
t.Errorf("%s: expected status %d, got %d (err: %v)", tc.description, tc.expectedStatus, w.Code, err)
|
||||
|
||||
@@ -29,7 +29,7 @@ var (
|
||||
// This is a simplified helper for shallow calculations and API calls
|
||||
// For scanning with hardlink detection, use handleFile instead
|
||||
// If useLogicalSize is true, returns the logical file size instead
|
||||
func getDiskUsage(fileInfo os.FileInfo, useLogicalSize bool) int64 {
|
||||
func getDiskUsage(fileInfo os.FileInfo, realPath string, useLogicalSize bool) int64 {
|
||||
// If useLogicalSize is true, return logical size (no block alignment)
|
||||
if useLogicalSize {
|
||||
if fileInfo.IsDir() {
|
||||
@@ -95,8 +95,6 @@ type Stats struct {
|
||||
type ReducedIndex struct {
|
||||
Stats
|
||||
IdxName string `json:"name"`
|
||||
ReadOnly bool `json:"readOnly"`
|
||||
Private bool `json:"private"`
|
||||
Status IndexStatus `json:"status"`
|
||||
Scanners []*ScannerInfo `json:"scanners,omitempty"`
|
||||
}
|
||||
@@ -540,7 +538,7 @@ func (idx *Index) GetFileInfo(req FileInfoRequest) (*iteminfo.FileInfo, error) {
|
||||
|
||||
// getFileInfoFromContext returns info for a single file
|
||||
func (idx *Index) getFileInfoFromContext(ctx *PathContext, isIndexable bool) (*iteminfo.FileInfo, error) {
|
||||
size := idx.getFileSizeForDisplay(ctx.FileInfo)
|
||||
size := idx.getFileSizeForDisplay(ctx.FileInfo, ctx.RealPath)
|
||||
fileInfo := &iteminfo.FileInfo{
|
||||
Path: ctx.IndexPath,
|
||||
ItemInfo: iteminfo.ItemInfo{
|
||||
@@ -829,7 +827,7 @@ func (idx *Index) processFileItem(file os.FileInfo, indexPath string, opts Optio
|
||||
var size uint64
|
||||
var shouldCountSize bool
|
||||
if !opts.Recursive && scanner == nil {
|
||||
size = uint64(idx.getFileSizeForDisplay(file))
|
||||
size = uint64(idx.getFileSizeForDisplay(file, fullCombined))
|
||||
shouldCountSize = true
|
||||
} else {
|
||||
size, shouldCountSize = idx.handleFile(file, indexPath, fullCombined, opts.IsRoutineScan, scanner)
|
||||
@@ -1159,14 +1157,14 @@ func (idx *Index) GetFolderSizeForDisplay(path string) int64 {
|
||||
}
|
||||
|
||||
// getFileSizeForDisplay returns file size with appropriate calculation based on config
|
||||
func (idx *Index) getFileSizeForDisplay(file os.FileInfo) int64 {
|
||||
func (idx *Index) getFileSizeForDisplay(file os.FileInfo, realPath string) int64 {
|
||||
if idx.Config.UseLogicalSize {
|
||||
// Logical size mode: return actual bytes
|
||||
return file.Size()
|
||||
}
|
||||
|
||||
// Disk usage mode: use getDiskUsage helper
|
||||
return getDiskUsage(file, false)
|
||||
return getDiskUsage(file, realPath, false)
|
||||
}
|
||||
|
||||
// SyncFolderSizesToDB syncs in-memory folder sizes to the database after a scan completes
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package indexing
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -74,12 +73,11 @@ func (s *Scanner) executeScan() {
|
||||
}()
|
||||
|
||||
if s.scanPath != "/" && !s.directoryExists() {
|
||||
s.handlePathGone("pre-scan check")
|
||||
logger.Debugf("Scanner [%s] skipping: directory no longer exists", s.scanPath)
|
||||
s.removeSelf()
|
||||
return
|
||||
}
|
||||
|
||||
s.prepareScanState()
|
||||
|
||||
s.idx.mu.Lock()
|
||||
s.idx.activeScannerPath = s.scanPath
|
||||
s.idx.mu.Unlock()
|
||||
@@ -175,14 +173,13 @@ func (s *Scanner) runFullScanRoot() {
|
||||
s.purgeStaleEntries(true, false) // isRoot=true, isQuickScan=false
|
||||
s.syncStatsWithDB()
|
||||
|
||||
s.resetHardlinkTracking()
|
||||
if s.processedInodes != nil {
|
||||
s.processedInodes = nil
|
||||
s.foundHardLinks = nil
|
||||
}
|
||||
|
||||
s.idx.mu.Lock()
|
||||
if s.idx.scanUpdatedPaths == nil {
|
||||
s.idx.scanUpdatedPaths = make(map[string]bool)
|
||||
} else {
|
||||
clear(s.idx.scanUpdatedPaths)
|
||||
}
|
||||
s.idx.scanUpdatedPaths = make(map[string]bool)
|
||||
s.idx.mu.Unlock()
|
||||
}
|
||||
|
||||
@@ -280,10 +277,6 @@ func (s *Scanner) runFullScanChild() {
|
||||
|
||||
_, _, err := s.idx.indexDirectory(s.scanPath, config, s)
|
||||
if err != nil {
|
||||
if isPathGone(err) {
|
||||
s.handlePathGone("full scan")
|
||||
return
|
||||
}
|
||||
logger.Errorf("Scanner [%s] error: %v", s.scanPath, err)
|
||||
} else if config.Recursive && config.IsRoutineScan {
|
||||
s.idx.mu.Lock()
|
||||
@@ -301,7 +294,10 @@ func (s *Scanner) runFullScanChild() {
|
||||
}
|
||||
}
|
||||
|
||||
s.resetHardlinkTracking()
|
||||
if s.processedInodes != nil {
|
||||
s.processedInodes = nil
|
||||
s.foundHardLinks = nil
|
||||
}
|
||||
|
||||
s.idx.mu.Lock()
|
||||
for path := range s.idx.scanUpdatedPaths {
|
||||
@@ -502,45 +498,6 @@ func (s *Scanner) updateComplexity() {
|
||||
}
|
||||
}
|
||||
|
||||
// ensureScanUpdatedPaths initializes scan path tracking for the current scan session.
|
||||
func (idx *Index) ensureScanUpdatedPaths() {
|
||||
idx.mu.Lock()
|
||||
defer idx.mu.Unlock()
|
||||
if idx.scanUpdatedPaths == nil {
|
||||
idx.scanUpdatedPaths = make(map[string]bool)
|
||||
}
|
||||
}
|
||||
|
||||
// prepareScanState initializes per-scan maps. Quick scans previously skipped this and could
|
||||
// panic with "assignment to entry in nil map" when writing scanUpdatedPaths or hardlink tracking.
|
||||
func (s *Scanner) prepareScanState() {
|
||||
s.idx.ensureScanUpdatedPaths()
|
||||
if s.processedInodes == nil {
|
||||
s.processedInodes = make(map[uint64]struct{})
|
||||
}
|
||||
if s.foundHardLinks == nil {
|
||||
s.foundHardLinks = make(map[string]uint64)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Scanner) resetHardlinkTracking() {
|
||||
s.processedInodes = nil
|
||||
s.foundHardLinks = nil
|
||||
}
|
||||
|
||||
func isPathGone(err error) bool {
|
||||
return err != nil && (os.IsNotExist(err) || errors.Is(err, os.ErrNotExist))
|
||||
}
|
||||
|
||||
// handlePathGone removes a child scanner whose root directory was deleted.
|
||||
func (s *Scanner) handlePathGone(context string) {
|
||||
if s.scanPath == "/" {
|
||||
return
|
||||
}
|
||||
logger.Infof("Scanner [%s] stopping (%s): directory no longer exists", s.scanPath, context)
|
||||
s.removeSelf()
|
||||
}
|
||||
|
||||
// directoryExists checks if the scanner's directory still exists
|
||||
func (s *Scanner) directoryExists() bool {
|
||||
realPath := strings.TrimRight(s.idx.Path, "/") + s.scanPath
|
||||
@@ -596,10 +553,7 @@ func (s *Scanner) checkFolderModtime(folderPath string) (bool, error) {
|
||||
info, err := os.Stat(realPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if folderPath == s.scanPath {
|
||||
s.handlePathGone("quick scan")
|
||||
}
|
||||
// Subfolder deleted — stale entries are removed by purge
|
||||
// Folder was deleted - will be caught by purge
|
||||
return false, nil
|
||||
}
|
||||
logger.Errorf("[QUICK_SCAN] Error stating %s: %v", folderPath, err)
|
||||
@@ -639,9 +593,6 @@ func (s *Scanner) checkFolderModtime(folderPath string) (bool, error) {
|
||||
|
||||
// Track this directory as having been updated (for file purge logic)
|
||||
s.idx.mu.Lock()
|
||||
if s.idx.scanUpdatedPaths == nil {
|
||||
s.idx.scanUpdatedPaths = make(map[string]bool)
|
||||
}
|
||||
s.idx.scanUpdatedPaths[folderPath] = true
|
||||
s.idx.mu.Unlock()
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package indexing
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
|
||||
)
|
||||
|
||||
func TestPrepareScanStateInitializesMaps(t *testing.T) {
|
||||
idx := &Index{
|
||||
Source: settings.Source{Name: "test", Path: t.TempDir()},
|
||||
}
|
||||
s := &Scanner{scanPath: "/music/", idx: idx}
|
||||
|
||||
s.prepareScanState()
|
||||
|
||||
idx.mu.Lock()
|
||||
idx.scanUpdatedPaths["/music/"] = true
|
||||
idx.mu.Unlock()
|
||||
|
||||
if s.processedInodes == nil {
|
||||
t.Fatal("processedInodes should be initialized")
|
||||
}
|
||||
s.processedInodes[1] = struct{}{}
|
||||
}
|
||||
|
||||
func TestIsPathGone(t *testing.T) {
|
||||
if isPathGone(nil) {
|
||||
t.Fatal("nil error should not be path gone")
|
||||
}
|
||||
if !isPathGone(os.ErrNotExist) {
|
||||
t.Fatal("os.ErrNotExist should be path gone")
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,6 @@ func (idx *Index) runSerialScanPass() {
|
||||
continue
|
||||
}
|
||||
if s.scanPath != "/" && !s.directoryExists() {
|
||||
s.removeSelf()
|
||||
continue
|
||||
}
|
||||
s.executeScan()
|
||||
@@ -284,10 +283,6 @@ func (idx *Index) schedulerAdaptiveTick() {
|
||||
}
|
||||
})
|
||||
logger.Debugf("[%s] scheduler: adaptive run path=%s nextRun=%s", idx.Name, s.scanPath, nextRunStr)
|
||||
if s.scanPath != "/" && !s.directoryExists() {
|
||||
s.removeSelf()
|
||||
continue
|
||||
}
|
||||
s.executeScan()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ func (idx *Index) UpdateMetadata(info *iteminfo.FileInfo, scanner *Scanner) bool
|
||||
// Track that this directory was updated by the scan (for timestamp conflict detection)
|
||||
normalizedPath := utils.AddTrailingSlashIfNotExists(info.Path)
|
||||
idx.mu.Lock()
|
||||
if idx.scanUpdatedPaths == nil {
|
||||
idx.scanUpdatedPaths = make(map[string]bool)
|
||||
}
|
||||
idx.scanUpdatedPaths[normalizedPath] = true
|
||||
idx.mu.Unlock()
|
||||
|
||||
@@ -383,8 +380,6 @@ func GetIndexInfo(sourceName string, forceCacheRefresh bool) (ReducedIndex, erro
|
||||
reducedIdx.LastScanned = lastIndexed
|
||||
reducedIdx.LastIndexedUnix = lastIndexed.Unix()
|
||||
reducedIdx.Status = idx.getStatusUnlocked()
|
||||
reducedIdx.ReadOnly = idx.Config.ReadOnly
|
||||
reducedIdx.Private = idx.Config.Private
|
||||
idx.mu.RUnlock()
|
||||
return reducedIdx, nil
|
||||
}
|
||||
|
||||
@@ -512,15 +512,6 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized - authentication failed",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden - authentication failed",
|
||||
"schema": {
|
||||
@@ -530,15 +521,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"429": {
|
||||
"description": "Too many requests - rate limited or temporarily locked out after failed attempts",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
@@ -5604,22 +5586,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings.Http": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disableRateLimit": {
|
||||
"description": "turns off built-in auth route rate limiting and failed-login lockout (default false).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"trustedHeaders": {
|
||||
"description": "list of headers to trust, useful when behind a reverse proxy.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings.IndexSqlConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -6183,9 +6149,6 @@ const docTemplate = `{
|
||||
"frontend": {
|
||||
"$ref": "#/definitions/settings.Frontend"
|
||||
},
|
||||
"http": {
|
||||
"$ref": "#/definitions/settings.Http"
|
||||
},
|
||||
"integrations": {
|
||||
"$ref": "#/definitions/settings.Integrations"
|
||||
},
|
||||
@@ -6255,10 +6218,6 @@ const docTemplate = `{
|
||||
"description": "designate as source as private -- currently just means no sharing permitted.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"readOnly": {
|
||||
"description": "read-only source, changes from the UI, webdav, and API will be disabled.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"rules": {
|
||||
"description": "list of item rules to apply to specific paths",
|
||||
"type": "array",
|
||||
|
||||
@@ -501,15 +501,6 @@
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized - authentication failed",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden - authentication failed",
|
||||
"schema": {
|
||||
@@ -519,15 +510,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"429": {
|
||||
"description": "Too many requests - rate limited or temporarily locked out after failed attempts",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
@@ -5593,22 +5575,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings.Http": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"disableRateLimit": {
|
||||
"description": "turns off built-in auth route rate limiting and failed-login lockout (default false).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"trustedHeaders": {
|
||||
"description": "list of headers to trust, useful when behind a reverse proxy.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings.IndexSqlConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -6172,9 +6138,6 @@
|
||||
"frontend": {
|
||||
"$ref": "#/definitions/settings.Frontend"
|
||||
},
|
||||
"http": {
|
||||
"$ref": "#/definitions/settings.Http"
|
||||
},
|
||||
"integrations": {
|
||||
"$ref": "#/definitions/settings.Integrations"
|
||||
},
|
||||
@@ -6244,10 +6207,6 @@
|
||||
"description": "designate as source as private -- currently just means no sharing permitted.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"readOnly": {
|
||||
"description": "read-only source, changes from the UI, webdav, and API will be disabled.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"rules": {
|
||||
"description": "list of item rules to apply to specific paths",
|
||||
"type": "array",
|
||||
|
||||
@@ -758,18 +758,6 @@ definitions:
|
||||
styling:
|
||||
$ref: '#/definitions/settings.StylingConfig'
|
||||
type: object
|
||||
settings.Http:
|
||||
properties:
|
||||
disableRateLimit:
|
||||
description: turns off built-in auth route rate limiting and failed-login
|
||||
lockout (default false).
|
||||
type: boolean
|
||||
trustedHeaders:
|
||||
description: list of headers to trust, useful when behind a reverse proxy.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
settings.IndexSqlConfig:
|
||||
properties:
|
||||
batchSize:
|
||||
@@ -1207,8 +1195,6 @@ definitions:
|
||||
$ref: '#/definitions/settings.Auth'
|
||||
frontend:
|
||||
$ref: '#/definitions/settings.Frontend'
|
||||
http:
|
||||
$ref: '#/definitions/settings.Http'
|
||||
integrations:
|
||||
$ref: '#/definitions/settings.Integrations'
|
||||
server:
|
||||
@@ -1260,10 +1246,6 @@ definitions:
|
||||
description: designate as source as private -- currently just means no sharing
|
||||
permitted.
|
||||
type: boolean
|
||||
readOnly:
|
||||
description: read-only source, changes from the UI, webdav, and API will be
|
||||
disabled.
|
||||
type: boolean
|
||||
rules:
|
||||
description: list of item rules to apply to specific paths
|
||||
items:
|
||||
@@ -2704,25 +2686,12 @@ paths:
|
||||
description: JWT token for authentication
|
||||
schema:
|
||||
type: string
|
||||
"401":
|
||||
description: Unauthorized - authentication failed
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"403":
|
||||
description: Forbidden - authentication failed
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"429":
|
||||
description: Too many requests - rate limited or temporarily locked out
|
||||
after failed attempts
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
|
||||
@@ -26,7 +26,6 @@ server:
|
||||
config:
|
||||
denyByDefault: false # deny access unless an "allow" access rule was specifically created.
|
||||
private: false # designate as source as private -- currently just means no sharing permitted.
|
||||
readOnly: false # read-only source, changes from the UI, webdav, and API will be disabled.
|
||||
disabled: false # disable the source, this is useful so you don't need to remove it from the config file
|
||||
rules: # list of item rules to apply to specific paths
|
||||
- neverWatchPath: "" # index the folder in the first pass to get included in search, but never re-indexed.
|
||||
@@ -258,6 +257,3 @@ integrations:
|
||||
debug: false # output ffmpeg stdout for media integration -- careful can produces lots of output!
|
||||
extractEmbeddedSubtitles: false # extract embedded subtitles from media files
|
||||
exiftoolPath: "" # path to exiftool executable
|
||||
http:
|
||||
trustedHeaders: # list of headers to trust, useful when behind a reverse proxy.
|
||||
disableRateLimit: false # turns off built-in auth route rate limiting and failed-login lockout (default false).
|
||||
@@ -58,7 +58,27 @@ export default {
|
||||
return getters.currentView();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.reEvalAction();
|
||||
},
|
||||
watch: {
|
||||
$route() {
|
||||
this.reEvalAction();
|
||||
},
|
||||
req() {
|
||||
this.reEvalAction();
|
||||
},
|
||||
currentView() {
|
||||
this.reEvalAction();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
reEvalAction() {
|
||||
const currentView = getters.currentView();
|
||||
if (currentView == "settings") {
|
||||
mutations.setActiveSettingsView(getters.currentHash());
|
||||
}
|
||||
},
|
||||
actionMultiIcon() {
|
||||
if (this.show) {
|
||||
mutations.closeHovers();
|
||||
|
||||
@@ -506,7 +506,7 @@ export default {
|
||||
},
|
||||
goToItem() {
|
||||
const item = this.firstSelected;
|
||||
url.goToItem(item.source, item.path, {}, true, getters.isShare());
|
||||
url.goToItem(item.source, item.path, {}, true);
|
||||
mutations.closeHovers();
|
||||
},
|
||||
hideTooltip() {
|
||||
|
||||
@@ -3,24 +3,14 @@
|
||||
ref="tooltipRef"
|
||||
v-show="tooltip.show"
|
||||
class="floating-tooltip floating-window"
|
||||
:class="{
|
||||
'dark-mode': isDarkMode,
|
||||
'pointer-enabled': tooltip.pointerEvents,
|
||||
'floating-tooltip--component': hasComponent,
|
||||
}"
|
||||
:class="{ 'dark-mode': isDarkMode, 'pointer-enabled': tooltip.pointerEvents }"
|
||||
:style="tooltipStyle"
|
||||
>
|
||||
<component
|
||||
v-if="hasComponent"
|
||||
:is="tooltip.component"
|
||||
v-bind="tooltip.componentProps || {}"
|
||||
/>
|
||||
<div v-else v-html="tooltip.content"></div>
|
||||
</div>
|
||||
v-html="tooltip.content"
|
||||
></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { state, getters, mutations } from "@/store";
|
||||
import { state,getters } from "@/store";
|
||||
|
||||
export default {
|
||||
name: "Tooltip",
|
||||
@@ -35,9 +25,6 @@ export default {
|
||||
tooltip() {
|
||||
return state.tooltip;
|
||||
},
|
||||
hasComponent() {
|
||||
return Boolean(this.tooltip.component);
|
||||
},
|
||||
isDarkMode() {
|
||||
return getters.isDarkMode();
|
||||
},
|
||||
@@ -47,14 +34,16 @@ export default {
|
||||
left: `${this.adjustedX}px`,
|
||||
};
|
||||
|
||||
// Add custom width if specified
|
||||
if (this.tooltip.width) {
|
||||
style.maxWidth = this.tooltip.width;
|
||||
style.width = this.tooltip.width;
|
||||
}
|
||||
|
||||
// Add max height and scrolling for viewport overflow
|
||||
if (this.tooltip.width || this.tooltip.pointerEvents) {
|
||||
style.maxHeight = "80vh";
|
||||
style.overflowY = "auto";
|
||||
style.maxHeight = '80vh';
|
||||
style.overflowY = 'auto';
|
||||
}
|
||||
|
||||
return style;
|
||||
@@ -63,7 +52,9 @@ export default {
|
||||
watch: {
|
||||
$route: {
|
||||
handler() {
|
||||
mutations.hideTooltip();
|
||||
// hide tooltip when route changes
|
||||
this.tooltip.show = false;
|
||||
this.tooltip.content = "";
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
@@ -130,12 +121,6 @@ export default {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.floating-tooltip--component {
|
||||
padding: 0;
|
||||
max-width: min(28em, 90vw);
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.floating-tooltip.pointer-enabled {
|
||||
pointer-events: auto;
|
||||
cursor: auto;
|
||||
@@ -150,4 +135,4 @@ export default {
|
||||
padding: 0.1em !important;
|
||||
padding-left: 0.5em !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -280,7 +280,7 @@ export default {
|
||||
}
|
||||
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, targetPath, {}, false, getters.isShare());
|
||||
url.goToItem(source, targetPath, {});
|
||||
};
|
||||
|
||||
notify.showSuccess(this.$t("prompts.moveSuccess"), {
|
||||
|
||||
@@ -317,8 +317,8 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
// If this folder has no items or items is not an array, finish here.
|
||||
if (!req.items || !Array.isArray(req.items)) return;
|
||||
// If this folder is empty, finish here.
|
||||
if (req.items === null) return;
|
||||
for (let item of req.items) {
|
||||
if (!this.showFolders && item.type === "directory") continue;
|
||||
if (!this.showFiles && item.type !== "directory") continue;
|
||||
@@ -426,6 +426,11 @@ export default {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
// Double click: navigate (into folder or open file)
|
||||
if (this.isDisplayMode) {
|
||||
this.navigateToItem(item);
|
||||
return;
|
||||
}
|
||||
const syntheticEvent = {
|
||||
currentTarget: {
|
||||
dataset: {
|
||||
@@ -518,9 +523,7 @@ export default {
|
||||
navigateToItem(item) {
|
||||
mutations.closeTopPrompt();
|
||||
mutations.setNavigationTransitioning(true);
|
||||
const isShare = !!(this.browseShare) || getters.isShare();
|
||||
const source = isShare ? (state.shareInfo?.hash) : (item.source || state.req.source);
|
||||
url.goToItem(source, item.path, undefined, false, isShare);
|
||||
url.goToItem(item.source || state.req.source, item.path, undefined);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -199,7 +199,6 @@ export default {
|
||||
);
|
||||
eventBus.on('itemsDeleted', this.refresh);
|
||||
eventBus.on('itemsRenamed', this.refresh);
|
||||
eventBus.on('itemsMoved', this.refresh);
|
||||
window.addEventListener('dragend', this.clearAllDragStates);
|
||||
},
|
||||
beforeUnmount() {
|
||||
@@ -211,12 +210,10 @@ export default {
|
||||
}
|
||||
eventBus.off('itemsDeleted', this.refresh);
|
||||
eventBus.off('itemsRenamed', this.refresh);
|
||||
eventBus.off('itemsMoved', this.refresh);
|
||||
window.removeEventListener('dragend', this.clearAllDragStates);
|
||||
},
|
||||
methods: {
|
||||
async loadRoot() {
|
||||
if (this.expanding) return;
|
||||
this.error = null;
|
||||
this.rootLoaded = false;
|
||||
if ((!this.currentSource && !this.shareHash) || !this.isRootInstance) {
|
||||
@@ -306,7 +303,7 @@ export default {
|
||||
},
|
||||
|
||||
async tryExpandNodes() {
|
||||
if (this.expanding || !this.rootLoaded || !this.pendingExpandPath) return;
|
||||
if (!this.rootLoaded || !this.pendingExpandPath) return;
|
||||
await this.expandToPath(this.pendingExpandPath);
|
||||
this.pendingExpandPath = null;
|
||||
},
|
||||
@@ -345,25 +342,18 @@ export default {
|
||||
navigateTo(node) {
|
||||
if (this.isShare) {
|
||||
mutations.setNavigationTransitioning(true);
|
||||
goToItem(this.shareHash, node.path, {}, false, true);
|
||||
goToItem(null, node.path, {}, false, this.shareHash);
|
||||
} else {
|
||||
mutations.setNavigationTransitioning(true);
|
||||
goToItem(this.currentSource, node.path, {});
|
||||
}
|
||||
},
|
||||
|
||||
normalizePath(p) {
|
||||
if (!p || p === '/') return '/';
|
||||
return p.replace(/\/+$/, '');
|
||||
},
|
||||
|
||||
isCurrentItem(node) {
|
||||
const normalizedNodePath = this.normalizePath(node.path);
|
||||
const normalizedCurrentPath = this.normalizePath(this.currentPath);
|
||||
if (this.isShare) {
|
||||
return normalizedNodePath === normalizedCurrentPath;
|
||||
return node.path === this.currentPath;
|
||||
} else {
|
||||
return node.source === this.currentSource && normalizedNodePath === normalizedCurrentPath;
|
||||
return node.source === this.currentSource && node.path === this.currentPath;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -408,7 +398,7 @@ export default {
|
||||
},
|
||||
|
||||
async refresh() {
|
||||
if (!this.isRootInstance || this.isRefreshing ) return;
|
||||
if (!this.isRootInstance || this.isRefreshing) return;
|
||||
this.isRefreshing = true;
|
||||
this.expandTimeouts.clear();
|
||||
// Save expanded paths before reload to restore them
|
||||
@@ -547,8 +537,13 @@ export default {
|
||||
|
||||
if (items.length === 0) return;
|
||||
|
||||
const targetDir = this.normalizePath(node.path);
|
||||
const sourceDir = this.normalizePath(state.req.path);
|
||||
// We'll use the same logic as Breadcrumbs
|
||||
const normalizePath = (path) => {
|
||||
if (!path || path === "/") return "/";
|
||||
return path.replace(/\/$/, '');
|
||||
};
|
||||
const targetDir = normalizePath(node.path);
|
||||
const sourceDir = normalizePath(state.req.path);
|
||||
if (targetDir === sourceDir) {
|
||||
notify.showErrorToast(this.$t("files.sameFolder"));
|
||||
return;
|
||||
@@ -589,7 +584,7 @@ export default {
|
||||
}
|
||||
const buttonAction = () => {
|
||||
if (this.isShare) {
|
||||
goToItem(this.shareHash, node.path, {}, false, true);
|
||||
goToItem(null, node.path, {}, false, this.shareHash);
|
||||
} else {
|
||||
goToItem(this.currentSource, node.path, {});
|
||||
}
|
||||
|
||||
@@ -1,39 +1,67 @@
|
||||
<template>
|
||||
<SettingsTable
|
||||
class="index-info-table"
|
||||
:header-title="info.name || 'Source'"
|
||||
:columns="columns"
|
||||
:items="rows"
|
||||
item-key="id"
|
||||
:aria-label="info.name || 'Source'"
|
||||
/>
|
||||
<table class="index-info-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">{{ info.name || 'Source' }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ $t("general.status") }}</td>
|
||||
<td>{{ getStatusLabel(info.status) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ $t("index.assessment") }}</td>
|
||||
<td>{{ getComplexityLabel(info.complexity || 0) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ $t("general.files") }}</td>
|
||||
<td>{{ info.files || 0 }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ $t("general.folders") }}</td>
|
||||
<td>{{ info.folders || 0 }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ $t("index.lastScanned") }}</td>
|
||||
<td>{{ getHumanReadable(info.lastIndex) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ $t("index.quickScan") }}</td>
|
||||
<td>{{ formatDuration(info.quickScanDurationSeconds) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ $t("index.fullScan") }}</td>
|
||||
<td>{{ formatDuration(info.fullScanDurationSeconds) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { state } from "@/store";
|
||||
import { fromNow } from "@/utils/moment";
|
||||
import SettingsTable from "@/components/settings/Table.vue";
|
||||
|
||||
export default {
|
||||
name: "IndexInfo",
|
||||
components: {
|
||||
SettingsTable,
|
||||
},
|
||||
props: {
|
||||
info: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
columns() {
|
||||
return [
|
||||
{ key: "label", label: "", sortable: false, align: "left" },
|
||||
{ key: "value", label: "", sortable: false, align: "left" },
|
||||
];
|
||||
methods: {
|
||||
getComplexityLabel(complexity) {
|
||||
return getComplexityLabel(complexity, this.$t);
|
||||
},
|
||||
rows() {
|
||||
return buildIndexInfoRows(this.info, this.$t, state.user.locale);
|
||||
getStatusLabel(status) {
|
||||
return getStatusLabel(status, this.$t);
|
||||
},
|
||||
getHumanReadable(lastIndex) {
|
||||
return getHumanReadableTime(lastIndex, state.user.locale);
|
||||
},
|
||||
formatDuration(seconds) {
|
||||
return formatDuration(seconds);
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -71,34 +99,77 @@ export function formatDuration(seconds) {
|
||||
return Number(seconds);
|
||||
}
|
||||
|
||||
export function formatBooleanYesNo(value, $t) {
|
||||
return value ? $t("general.yes") : $t("general.no");
|
||||
}
|
||||
|
||||
/** @returns {{ id: string, label: string, value: string | number }[]} */
|
||||
export function buildIndexInfoRows(info, $t, locale) {
|
||||
return [
|
||||
{ id: "status", label: $t("general.status"), value: getStatusLabel(info.status, $t) },
|
||||
{ id: "readOnly", label: $t("general.readOnly"), value: formatBooleanYesNo(info.readOnly, $t) },
|
||||
{ id: "private", label: $t("general.private"), value: formatBooleanYesNo(info.private, $t) },
|
||||
{ id: "assessment", label: $t("index.assessment"), value: getComplexityLabel(info.complexity || 0, $t) },
|
||||
{ id: "files", label: $t("general.files"), value: info.files || 0 },
|
||||
{ id: "folders", label: $t("general.folders"), value: info.folders || 0 },
|
||||
{ id: "lastScanned", label: $t("index.lastScanned"), value: getHumanReadableTime(info.lastIndex, locale) },
|
||||
{ id: "quickScan", label: $t("index.quickScan"), value: formatDuration(info.quickScanDurationSeconds) },
|
||||
{ id: "fullScan", label: $t("index.fullScan"), value: formatDuration(info.fullScanDurationSeconds) },
|
||||
];
|
||||
// Generate HTML tooltip content using the same logic as the component
|
||||
export function buildIndexInfoTooltipHTML(info, $t, locale) {
|
||||
return `
|
||||
<table style="border-collapse: collapse; text-align: left;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center; font-weight: bold; font-size: 1.1em; padding-bottom: 0.3em; border-bottom: 1px solid #888;">${info.name || 'Source'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${$t("general.status")}</td>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${getStatusLabel(info.status, $t)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${$t("index.assessment")}</td>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${getComplexityLabel(info.complexity || 0, $t)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${$t("general.files")}</td>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${info.files || 0}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${$t("general.folders")}</td>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${info.folders || 0}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${$t("index.lastScanned")}</td>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${getHumanReadableTime(info.lastIndex, locale)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${$t("index.quickScan")}</td>
|
||||
<td style="padding: 0.2em 0.5em; border-bottom: 1px solid #ccc;">${formatDuration(info.quickScanDurationSeconds)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0.2em 0.5em;">${$t("index.fullScan")}</td>
|
||||
<td style="padding: 0.2em 0.5em;">${formatDuration(info.fullScanDurationSeconds)}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.index-info-table :deep(thead th),
|
||||
.index-info-table :deep(tbody td) {
|
||||
padding: 0.5em;
|
||||
.index-info-table {
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.index-info-table :deep(tbody td:first-child) {
|
||||
.index-info-table thead th {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
padding-bottom: 0.3em;
|
||||
border-bottom: 1px solid #888;
|
||||
}
|
||||
|
||||
.index-info-table tbody td {
|
||||
padding: 0.2em 0.5em;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.index-info-table tbody tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.index-info-table tbody td:first-child {
|
||||
font-weight: 500;
|
||||
color: var(--textSecondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -809,7 +809,7 @@ export default {
|
||||
path: state.req.path,
|
||||
};
|
||||
}
|
||||
url.goToItem(this.source, this.path, previousHistoryItem || {}, false, getters.isShare());
|
||||
url.goToItem(this.source, this.path, previousHistoryItem || {});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -506,8 +506,6 @@ export default {
|
||||
state.previousHistoryItem.source,
|
||||
state.previousHistoryItem.path,
|
||||
state.previousHistoryItem,
|
||||
false,
|
||||
state.previousHistoryItem.isShare
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ export default {
|
||||
const archivePath = dest;
|
||||
const buttonAction = () => {
|
||||
if (archivePath) {
|
||||
goToItem(destSource || null, archivePath, {}, false, getters.isShare());
|
||||
goToItem(destSource || null, archivePath, {});
|
||||
}
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.archiveSuccess"), {
|
||||
|
||||
@@ -264,13 +264,13 @@ export default {
|
||||
mutations.setNavigationTransitioning(true);
|
||||
// Try next, then previous, then parent directory
|
||||
if (state.navigation.nextItem) {
|
||||
url.goToItem(state.navigation.nextItem.source, state.navigation.nextItem.path, undefined, false, getters.isShare());
|
||||
url.goToItem(state.navigation.nextItem.source, state.navigation.nextItem.path, undefined);
|
||||
} else if (state.navigation.previousItem) {
|
||||
url.goToItem(state.navigation.previousItem.source, state.navigation.previousItem.path, undefined, false, getters.isShare());
|
||||
url.goToItem(state.navigation.previousItem.source, state.navigation.previousItem.path, undefined);
|
||||
} else {
|
||||
// Navigate to parent directory of deleted item
|
||||
const parentPath = url.removeLastDir(deletedItem.path);
|
||||
url.goToItem(deletedItem.source, parentPath, {}, false, getters.isShare());
|
||||
url.goToItem(deletedItem.source, parentPath, {});
|
||||
}
|
||||
} else {
|
||||
mutations.setReload(true);
|
||||
@@ -281,7 +281,7 @@ export default {
|
||||
const deletedItem = this.itemsToDelete[0];
|
||||
if (deletedItem.type === 'directory' && deletedItem.path === state.req.path) {
|
||||
const parentPath = url.removeLastDir(deletedItem.path);
|
||||
url.goToItem(deletedItem.source, parentPath, {}, false, getters.isShare());
|
||||
url.goToItem(deletedItem.source, parentPath, {});
|
||||
this.deleting = false;
|
||||
return; // return early to avoid extra reload (and 404)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ import { notify } from "@/notify";
|
||||
import { goToItem } from "@/utils/url";
|
||||
import LoadingSpinner from "@/components/LoadingSpinner.vue";
|
||||
import PathPickerButton from "@/components/files/PathPickerButton.vue";
|
||||
import { eventBus } from '@/store/eventBus';
|
||||
|
||||
export default {
|
||||
name: "move-copy",
|
||||
@@ -348,71 +347,41 @@ export default {
|
||||
);
|
||||
}
|
||||
|
||||
// Determine if we should navigate (we can move items with fileTree context menu in previews)
|
||||
const shouldNavigate = getters.isPreviewView() && this.operation === 'move';
|
||||
let currentItemMoved = false;
|
||||
// Only close prompts and reload on success (or partial success)
|
||||
mutations.setReload(true);
|
||||
mutations.closeTopPrompt(); // close conflict prompt
|
||||
mutations.closeTopPrompt(); // close moveCopy prompt after conflict is resolved and file copied/moved
|
||||
mutations.setSearch(false); // close search if open
|
||||
|
||||
if (shouldNavigate) {
|
||||
currentItemMoved = this.localItems.some(item =>
|
||||
item.from === state.req?.path && item.fromSource === state.req?.source
|
||||
);
|
||||
}
|
||||
// Only show success notification if there were no failures (or partial success was already shown)
|
||||
if (!hasFailures || hasSuccesses) {
|
||||
// Store destination info for the button action
|
||||
const destSource = this.destSource;
|
||||
const destPath = this.destPath;
|
||||
|
||||
if (shouldNavigate && currentItemMoved) {
|
||||
eventBus.emit('itemsMoved');
|
||||
mutations.closeTopPrompt(); // close conflict prompt
|
||||
mutations.closeTopPrompt(); // close moveCopy prompt
|
||||
|
||||
if (!hasFailures || hasSuccesses) {
|
||||
notify.showSuccessToast(this.$t("prompts.moveSuccess"));
|
||||
}
|
||||
|
||||
// Navigate next, previous or parent dir (like when deleting)
|
||||
const next = state.navigation.nextItem;
|
||||
const prev = state.navigation.previousItem;
|
||||
if (next) {
|
||||
url.goToItem(next.source, next.path, undefined, false, getters.isShare());
|
||||
} else if (prev) {
|
||||
url.goToItem(prev.source, prev.path, undefined, false, getters.isShare());
|
||||
} else {
|
||||
url.goToItem(state.req.source, url.removeLastDir(state.req.path), {}, false, getters.isShare());
|
||||
}
|
||||
} else {
|
||||
|
||||
// Only close prompts and reload on success (or partial success)
|
||||
mutations.setReload(true);
|
||||
mutations.closeTopPrompt(); // close conflict prompt
|
||||
mutations.closeTopPrompt(); // close moveCopy prompt after conflict is resolved and file copied/moved
|
||||
mutations.setSearch(false); // close search if open
|
||||
|
||||
// Only show success notification if there were no failures (or partial success was already shown)
|
||||
if (!hasFailures || hasSuccesses) {
|
||||
// Store destination info for the button action
|
||||
const destSource = this.destSource;
|
||||
const destPath = this.destPath;
|
||||
|
||||
// Show success notification with optional button to navigate to destination
|
||||
// For shares, destSource might be null, but goToItem handles shares via state.shareInfo.hash
|
||||
const buttonAction = () => {
|
||||
if (destPath) {
|
||||
goToItem(destSource || state.shareInfo?.hash, destPath, {}, false, getters.isShare());
|
||||
}
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "folder",
|
||||
buttons: destPath ? [
|
||||
{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}
|
||||
] : undefined
|
||||
};
|
||||
if (this.operation === "move") {
|
||||
notify.showSuccess(this.$t("prompts.moveSuccess"), buttonProps);
|
||||
} else {
|
||||
notify.showSuccess(this.$t("prompts.copySuccess"), buttonProps);
|
||||
// Show success notification with optional button to navigate to destination
|
||||
// For shares, destSource might be null, but goToItem handles shares via state.shareInfo.hash
|
||||
const buttonAction = () => {
|
||||
if (destPath) {
|
||||
// For shares, goToItem will use state.shareInfo.hash, so source can be null
|
||||
// For regular files, destSource should be set
|
||||
goToItem(destSource || null, destPath, {});
|
||||
}
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "folder",
|
||||
buttons: destPath ? [
|
||||
{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}
|
||||
] : undefined
|
||||
};
|
||||
if (this.operation === "move") {
|
||||
notify.showSuccess(this.$t("prompts.moveSuccess"), buttonProps);
|
||||
} else {
|
||||
notify.showSuccess(this.$t("prompts.copySuccess"), buttonProps);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -103,21 +103,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
showNotification(source, newPath) {
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, newPath, {}, false, getters.isShare());
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "folder",
|
||||
buttons: [{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}]
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.newDirSuccess"), buttonProps);
|
||||
},
|
||||
|
||||
async createDirectory(overwrite = false) {
|
||||
this.creating = true;
|
||||
try {
|
||||
@@ -130,16 +115,25 @@ export default {
|
||||
mutations.setReload(true);
|
||||
mutations.closeTopPrompt();
|
||||
this.creating = false;
|
||||
// Show notification for shares
|
||||
this.showNotification(state.shareInfo?.hash, newPath);
|
||||
return;
|
||||
}
|
||||
await resourcesApi.post(source, newPath, "", overwrite, undefined, {}, true);
|
||||
mutations.setReload(true);
|
||||
mutations.closeTopPrompt();
|
||||
|
||||
// Show notification
|
||||
this.showNotification(source, newPath);
|
||||
// Show success notification with "go to item" button
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, newPath, {});
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "folder",
|
||||
buttons: [{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}]
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.newDirSuccess"), buttonProps);
|
||||
this.creating = false;
|
||||
} catch (error) {
|
||||
if (error.message === "conflict") {
|
||||
@@ -170,8 +164,6 @@ export default {
|
||||
mutations.closeTopPrompt(); // close conflict prompt
|
||||
mutations.closeTopPrompt(); // close new dir prompt
|
||||
success = true;
|
||||
// Show notification for shares after rename
|
||||
this.showNotification(state.shareInfo?.hash, newPath);
|
||||
return;
|
||||
}
|
||||
await resourcesApi.post(source, newPath, "", false, undefined, {}, true);
|
||||
@@ -180,8 +172,19 @@ export default {
|
||||
mutations.closeTopPrompt(); // close new dir prompt
|
||||
success = true;
|
||||
|
||||
// Show notification
|
||||
this.showNotification(source, newPath);
|
||||
// Show success notification with "go to item" button
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, newPath, {});
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "folder",
|
||||
buttons: [{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}]
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.newDirSuccess"), buttonProps);
|
||||
} catch (renameError) {
|
||||
if (renameError.message === "conflict") {
|
||||
// Continue to next iteration
|
||||
|
||||
@@ -100,21 +100,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
showNotification(source, newPath) {
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, newPath, {}, false, getters.isShare());
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "insert_drive_file",
|
||||
buttons: [{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}]
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.newFileSuccess"), buttonProps);
|
||||
},
|
||||
|
||||
async createFile(overwrite = false) {
|
||||
this.creating = true;
|
||||
try {
|
||||
@@ -127,16 +112,25 @@ export default {
|
||||
mutations.setReload(true);
|
||||
mutations.closeTopPrompt();
|
||||
this.creating = false;
|
||||
// Show notification for shares
|
||||
this.showNotification(state.shareInfo?.hash, newPath);
|
||||
return;
|
||||
}
|
||||
await resourcesApi.post(source, newPath, "", overwrite);
|
||||
mutations.setReload(true);
|
||||
mutations.closeTopPrompt();
|
||||
|
||||
// Show notification
|
||||
this.showNotification(source, newPath);
|
||||
// Show success notification with "go to item" button
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, newPath, {});
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "insert_drive_file",
|
||||
buttons: [{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}]
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.newFileSuccess"), buttonProps);
|
||||
this.creating = false;
|
||||
} catch (error) {
|
||||
if (error.message === "conflict") {
|
||||
@@ -167,8 +161,6 @@ export default {
|
||||
mutations.closeTopPrompt(); // close conflict prompt
|
||||
mutations.closeTopPrompt(); // close new file prompt
|
||||
success = true;
|
||||
// Show notification for shares after rename
|
||||
this.showNotification(state.shareInfo?.hash, newPath);
|
||||
return;
|
||||
}
|
||||
await resourcesApi.post(source, newPath, "", false);
|
||||
@@ -177,8 +169,19 @@ export default {
|
||||
mutations.closeTopPrompt(); // close new file prompt
|
||||
success = true;
|
||||
|
||||
// Show notification
|
||||
this.showNotification(source, newPath);
|
||||
// Show success notification with "go to item" button
|
||||
const buttonAction = () => {
|
||||
url.goToItem(source, newPath, {});
|
||||
};
|
||||
const buttonProps = {
|
||||
icon: "insert_drive_file",
|
||||
buttons: [{
|
||||
label: this.$t("buttons.goToItem"),
|
||||
primary: true,
|
||||
action: buttonAction
|
||||
}]
|
||||
};
|
||||
notify.showSuccess(this.$t("prompts.newFileSuccess"), buttonProps);
|
||||
} catch (renameError) {
|
||||
if (renameError.message === "conflict") {
|
||||
// Continue to next iteration
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { state, mutations, getters } from "@/store";
|
||||
import { state, mutations } from "@/store";
|
||||
import { url } from "@/utils";
|
||||
export default {
|
||||
name: "PlaybackQueue",
|
||||
@@ -195,7 +195,7 @@ export default {
|
||||
}
|
||||
},
|
||||
triggerNavigation(item) {
|
||||
url.goToItem(item.source || state.req.source, item.path, undefined, false, getters.isShare());
|
||||
url.goToItem( item.source || state.req.source, item.path, undefined );
|
||||
},
|
||||
scrollToCurrentItem() {
|
||||
if (this.queueCount === 0) return;
|
||||
|
||||
@@ -183,9 +183,6 @@ export default {
|
||||
|
||||
return { valid: true };
|
||||
},
|
||||
normalizePath(p) {
|
||||
return (p || '').replace(/^\/+|\/+$/g, '');
|
||||
},
|
||||
async submit() {
|
||||
// remove trailing slashes
|
||||
if (this.name.endsWith("/") || this.name.endsWith("\\")) {
|
||||
@@ -219,22 +216,7 @@ export default {
|
||||
mutations.closeTopPrompt();
|
||||
|
||||
if (this.isPreviewView) {
|
||||
// Navigate only if we rename the file that we're currently previewing (eg: from fileTree)
|
||||
const currentReqPath = this.normalizePath(state.req?.path);
|
||||
const oldItemPath = this.normalizePath(this.item.path);
|
||||
|
||||
// For shares compare path and for regulars compare both path and source
|
||||
const isCurrentItem = getters.isShare()
|
||||
? currentReqPath === oldItemPath
|
||||
: (currentReqPath === oldItemPath && this.item.source === state.req?.source);
|
||||
|
||||
if (isCurrentItem) {
|
||||
// Navigate to the renamed file
|
||||
const source = getters.isShare() ? state.shareInfo.hash : this.item.source;
|
||||
url.goToItem(source, newPath, undefined, false, getters.isShare()); // When undefined will not create browser history
|
||||
} else {
|
||||
mutations.setReload(true);
|
||||
}
|
||||
url.goToItem(this.item.source, newPath, undefined); // When undefined will not create browser history
|
||||
} else {
|
||||
mutations.setReload(true);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
</a>
|
||||
</div>
|
||||
<p> {{ $t('share.notice') }} </p>
|
||||
<p v-if="sourceReadOnly" class="read-only-notice">{{ $t('share.readOnlySourceNotice') }}</p>
|
||||
|
||||
<div v-if="listing">
|
||||
<settings-table
|
||||
@@ -122,7 +121,7 @@
|
||||
</p>
|
||||
<select class="input" v-model="shareType">
|
||||
<option value="normal">{{ $t("share.normalShare") }}</option>
|
||||
<option value="upload" :disabled="sourceReadOnly">{{ $t("share.uploadShare") }}</option>
|
||||
<option value="upload">{{ $t("share.uploadShare") }}</option>
|
||||
</select>
|
||||
<button @click="openSidebarLinksCustomization" class="button button--flat customize-sidebar-links-button">
|
||||
<i class="material-symbols">link</i>
|
||||
@@ -131,13 +130,13 @@
|
||||
<div class="settings-items" style="margin-top: 0.5em;">
|
||||
<ToggleSwitch v-if="shareType === 'normal'" class="item" v-model="allowModify"
|
||||
:name="$t('share.allowModify')" :description="$t('share.allowModifyDescription')"
|
||||
aria-label="allow editing files toggle" :disabled="sourceReadOnly" />
|
||||
aria-label="allow editing files toggle" />
|
||||
<ToggleSwitch v-if="shareType === 'normal'" class="item" v-model="allowCreate"
|
||||
:name="$t('share.allowCreate')" :description="$t('share.allowCreateDescription')"
|
||||
aria-label="allow creating and uploading files and folders toggle" :disabled="sourceReadOnly" />
|
||||
aria-label="allow creating and uploading files and folders toggle" />
|
||||
<ToggleSwitch v-if="shareType === 'normal'" class="item" v-model="allowDelete"
|
||||
:name="$t('share.allowDelete')" :description="$t('share.allowDeleteDescription')"
|
||||
aria-label="allow deleting files toggle" :disabled="sourceReadOnly" />
|
||||
aria-label="allow deleting files toggle" />
|
||||
</div>
|
||||
</div>
|
||||
<SettingsItem :title="showMoreExpanded ? $t('buttons.showLess') : $t('buttons.showMore')" :collapsable="true"
|
||||
@@ -174,8 +173,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<ToggleSwitch v-if="createAllowed" class="item" v-model="allowReplacements"
|
||||
:name="$t('share.allowReplacements')" :description="$t('share.allowReplacementsDescription')"
|
||||
:disabled="sourceReadOnly" />
|
||||
:name="$t('share.allowReplacements')" :description="$t('share.allowReplacementsDescription')" />
|
||||
<ToggleSwitch v-if="shareType === 'normal'" class="item" v-model="disableDownload"
|
||||
:name="$t('share.disableDownload')" :description="$t('share.disableDownloadDescription')"
|
||||
aria-label="disable downloading files toggle" />
|
||||
@@ -194,8 +192,7 @@
|
||||
:placeholder="$t('share.allowedUsernamesPlaceholder')" />
|
||||
</div>
|
||||
<ToggleSwitch v-if="shareType === 'normal' && onlyOfficeAvailable" class="item" v-model="enableOnlyOffice"
|
||||
:name="$t('share.enableOnlyOffice')" :description="$t('share.enableOnlyOfficeDescription')"
|
||||
:disabled="sourceReadOnly" />
|
||||
:name="$t('share.enableOnlyOffice')" :description="$t('share.enableOnlyOfficeDescription')" />
|
||||
<p>
|
||||
{{ $t("share.enforceDarkLightMode") }}
|
||||
<i class="material-symbols-outlined tooltip-info-icon"
|
||||
@@ -454,10 +451,6 @@ export default {
|
||||
// When editing, use the link's source; otherwise use the item's source
|
||||
return this.isEditMode ? this.link.source : this.item.source;
|
||||
},
|
||||
sourceReadOnly() {
|
||||
const info = state.sources.info?.[this.displaySource];
|
||||
return info?.readOnly === true;
|
||||
},
|
||||
onlyOfficeAvailable() {
|
||||
return globalVars.onlyOfficeUrl !== "";
|
||||
},
|
||||
@@ -532,24 +525,12 @@ export default {
|
||||
}
|
||||
},
|
||||
shareType(newType) {
|
||||
if (this.sourceReadOnly && newType === 'upload') {
|
||||
this.shareType = 'normal';
|
||||
return;
|
||||
}
|
||||
if (newType === 'upload') {
|
||||
this.description = this.$t("share.descriptionUploadDefault");
|
||||
} else {
|
||||
this.description = this.$t("share.descriptionDefault");
|
||||
}
|
||||
},
|
||||
sourceReadOnly: {
|
||||
immediate: true,
|
||||
handler(readOnly) {
|
||||
if (readOnly) {
|
||||
this.applyReadOnlyConstraints();
|
||||
}
|
||||
},
|
||||
},
|
||||
isEditMode: {
|
||||
immediate: true,
|
||||
handler(isEditMode) {
|
||||
@@ -597,9 +578,6 @@ export default {
|
||||
this.disableLoginOption = this.link.disableLoginOption || false;
|
||||
this.sidebarLinks = Array.isArray(this.link.sidebarLinks) ? [...this.link.sidebarLinks] : [];
|
||||
//this.viewMode = this.link.viewMode || "normal";
|
||||
if (this.sourceReadOnly) {
|
||||
this.applyReadOnlyConstraints();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -642,16 +620,6 @@ export default {
|
||||
eventBus.off('pathPickerCancelled', this.onBannerFaviconPathPickerCancelled);
|
||||
},
|
||||
methods: {
|
||||
applyReadOnlyConstraints() {
|
||||
if (this.shareType === 'upload') {
|
||||
this.shareType = 'normal';
|
||||
}
|
||||
this.allowModify = false;
|
||||
this.allowDelete = false;
|
||||
this.allowCreate = false;
|
||||
this.allowReplacements = false;
|
||||
this.enableOnlyOffice = false;
|
||||
},
|
||||
async copyToClipboard(text) {
|
||||
await copyToClipboard(text);
|
||||
},
|
||||
@@ -740,15 +708,6 @@ export default {
|
||||
payload.hash = this.editingLink.hash;
|
||||
}
|
||||
|
||||
if (this.sourceReadOnly) {
|
||||
payload.shareType = 'normal';
|
||||
payload.allowModify = false;
|
||||
payload.allowDelete = false;
|
||||
payload.allowCreate = false;
|
||||
payload.allowReplacements = false;
|
||||
payload.enableOnlyOffice = false;
|
||||
}
|
||||
|
||||
const res = await shareApi.create(payload);
|
||||
|
||||
if (!this.isEditMode && !this.editingLink) {
|
||||
@@ -828,9 +787,6 @@ export default {
|
||||
this.sidebarLinks = Array.isArray(link.sidebarLinks) ? [...link.sidebarLinks] : [];
|
||||
// Store the link being edited
|
||||
this.editingLink = link;
|
||||
if (this.sourceReadOnly) {
|
||||
this.applyReadOnlyConstraints();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param {Event} event
|
||||
@@ -1119,14 +1075,4 @@ export default {
|
||||
color: var(--primaryColor);
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
.read-only-notice {
|
||||
font-size: 0.9em;
|
||||
color: var(--textSecondary, #666);
|
||||
margin-top: 0.25em;
|
||||
}
|
||||
|
||||
select.input option:disabled {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
@@ -158,7 +158,7 @@ export default {
|
||||
|
||||
const destPath = this.destPath;
|
||||
const destSource = toSource;
|
||||
const buttonAction = () => destPath && goToItem(destSource || state.shareInfo?.hash, destPath, {}, false, getters.isShare());
|
||||
const buttonAction = () => destPath && goToItem(destSource, destPath, {});
|
||||
notify.showSuccess(this.$t("prompts.unarchiveSuccess"), {
|
||||
icon: "folder",
|
||||
buttons: destPath ? [{ label: this.$t("buttons.goToItem"), primary: true, action: buttonAction }] : undefined,
|
||||
|
||||
@@ -6,16 +6,7 @@
|
||||
:aria-busy="loading ? 'true' : undefined"
|
||||
>
|
||||
<thead>
|
||||
<tr v-if="headerTitle">
|
||||
<th
|
||||
:colspan="emptyColumnSpan"
|
||||
scope="col"
|
||||
class="settings-table__align-center settings-table__th--nosort settings-table__th--unified"
|
||||
>
|
||||
{{ headerTitle }}
|
||||
</th>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<tr>
|
||||
<th
|
||||
v-for="column in columns"
|
||||
:key="column.key"
|
||||
@@ -132,11 +123,6 @@ export default {
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
/** When set, renders one centered header cell spanning all columns instead of per-column headers. */
|
||||
headerTitle: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
/** i18n key for empty-state caption (icon + label), default `files.lonely`. */
|
||||
lonelyMessageKey: {
|
||||
type: String,
|
||||
@@ -342,7 +328,7 @@ export default {
|
||||
|
||||
.settings-table thead th,
|
||||
.settings-table tbody td {
|
||||
padding: 0.5em;
|
||||
padding: 0.5em 0;
|
||||
vertical-align: middle;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
}
|
||||
@@ -398,11 +384,6 @@ body.rtl .settings-table tr > *:last-child {
|
||||
background: color-mix(in srgb, var(--primaryColor) 12%, var(--surfacePrimary));
|
||||
}
|
||||
|
||||
.settings-table thead th.settings-table__th--unified,
|
||||
body.rtl .settings-table thead th.settings-table__th--unified {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.settings-table thead th.settings-table__th::after {
|
||||
content: "↕";
|
||||
position: absolute;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div v-else-if="user.username === 'anonymous' && shouldShowLogin" @click="navigateToLogin"
|
||||
class="inner-card user-card__profile">
|
||||
<button class="person-button action button" aria-label="Login">
|
||||
<button class="person-button action button">
|
||||
<i class="material-symbols-outlined">login</i> {{ $t("general.login") }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -76,7 +76,6 @@ import * as auth from "@/utils/auth";
|
||||
import { globalVars } from "@/utils/constants";
|
||||
import { state, getters, mutations } from "@/store";
|
||||
import SidebarLinks from "./Links.vue";
|
||||
import { url } from "@/utils";
|
||||
|
||||
export default {
|
||||
name: "SidebarGeneral",
|
||||
@@ -172,7 +171,6 @@ export default {
|
||||
name: state.req.name,
|
||||
source: state.req.source,
|
||||
path: state.req.path,
|
||||
isShare: getters.isShare()
|
||||
});
|
||||
this.$router.push({ path: path, hash: hash });
|
||||
mutations.closeTopPrompt();
|
||||
@@ -186,20 +184,7 @@ export default {
|
||||
},
|
||||
|
||||
// Logout the user
|
||||
async logout() {
|
||||
const isShare = getters.isShare();
|
||||
let sharePath;
|
||||
|
||||
if (isShare && state.shareInfo?.hash) {
|
||||
const shareBase = `/public/share/${state.shareInfo.hash}`;
|
||||
const subPath = state.req?.path && state.req.path !== '/'
|
||||
? url.removeLeadingSlash(state.req.path)
|
||||
: '';
|
||||
sharePath = subPath ? `${shareBase}/${url.encodedPath(subPath)}` : shareBase;
|
||||
}
|
||||
await auth.logout();
|
||||
window.location.href = sharePath || '/login';
|
||||
},
|
||||
logout: auth.logout,
|
||||
beforeEnter(el) {
|
||||
el.style.maxHeight = '0';
|
||||
el.style.opacity = '0';
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
<!-- Links section header -->
|
||||
<div class="sidebar-links-header"
|
||||
:class="{ 'with-top-spacing': isShare && !disableShareCard }">
|
||||
<i :class="{ 'disabled': !isLoggedIn }"
|
||||
aria-label="Navigate Home"
|
||||
@click="goHome()" class="material-symbols action">home</i>
|
||||
<i :class="{ 'disabled': !isLoggedIn }" @click="goHome()" class="material-symbols action">home</i>
|
||||
<!-- Mode button (is the title) -->
|
||||
<button @click="cycleMode" class="mode-toggle" @mouseenter="showTooltip($event, $t('sidebar.switchMode'))" @mouseleave="hideTooltip">
|
||||
{{ mode === 'links' ? $t('general.links') : $t('general.navigation') }}
|
||||
@@ -15,7 +13,6 @@
|
||||
:class="{ 'disabled': !canEdit }"
|
||||
@click="showEditShareHover" class="material-symbols action">edit</i>
|
||||
<i v-else @mouseenter="showTooltip($event, $t('sidebar.customizeLinks'))" @mouseleave="hideTooltip"
|
||||
aria-label="Edit Links"
|
||||
@click="openSidebarLinksPrompt" class="material-symbols action">edit</i>
|
||||
</div>
|
||||
<!-- Scrollable Content Area -->
|
||||
@@ -66,9 +63,7 @@
|
||||
</i>
|
||||
<span>{{ link.name }}</span>
|
||||
<i v-if="hasUsageInfo(link)" class="no-select material-symbols-outlined tooltip-info-icon"
|
||||
@click="onSourceInfoClick($event, sourceInfo[link.sourceName] || {})"
|
||||
@mouseenter="onSourceInfoMouseEnter($event, sourceInfo[link.sourceName] || {})"
|
||||
@mouseleave="onSourceInfoMouseLeave">
|
||||
@mouseenter="showSourceTooltip($event, sourceInfo[link.sourceName] || {})" @mouseleave="hideTooltip">
|
||||
info
|
||||
</i>
|
||||
</div>
|
||||
@@ -139,9 +134,9 @@
|
||||
<span>{{ activeSourceLink.name }}</span>
|
||||
<i v-if="hasUsageInfo(activeSourceLink)"
|
||||
class="no-select material-symbols-outlined tooltip-info-icon"
|
||||
@click="onSourceInfoClick($event, activeSourceInfo)"
|
||||
@mouseenter="onSourceInfoMouseEnter($event, activeSourceInfo)"
|
||||
@mouseleave="onSourceInfoMouseLeave">
|
||||
@mouseenter="showSourceTooltip($event, activeSourceInfo)"
|
||||
@mouseleave="hideTooltip"
|
||||
@click.stop>
|
||||
info
|
||||
</i>
|
||||
<!-- Dropdown arrow -->
|
||||
@@ -193,7 +188,7 @@ import { state, getters, mutations } from "@/store";
|
||||
import ProgressBar from "@/components/ProgressBar.vue";
|
||||
import { goToItem } from "@/utils/url";
|
||||
import { getIconClass } from "@/utils/material-symbols";
|
||||
import IndexInfo from "@/components/files/IndexInfo.vue";
|
||||
import { buildIndexInfoTooltipHTML } from "@/components/files/IndexInfo.vue";
|
||||
import { globalVars } from "@/utils/constants";
|
||||
import { resourcesApi } from "@/api";
|
||||
import ShareInfo from "@/components/files/ShareInfo.vue";
|
||||
@@ -209,13 +204,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
showSourceDropdown: false,
|
||||
sourceTooltipDismissHandler: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
useTapForSourceTooltip() {
|
||||
return getters.isMobile();
|
||||
},
|
||||
editShareText() {
|
||||
return this.$t('settings.shareManagement');
|
||||
},
|
||||
@@ -223,7 +214,7 @@ export default {
|
||||
return state.shareInfo?.canEditShare || false;
|
||||
},
|
||||
isLoggedIn() {
|
||||
return getters.isLoggedIn();
|
||||
return state.user?.username !== 'anonymous';
|
||||
},
|
||||
currentSource() {
|
||||
return state.req?.source || null;
|
||||
@@ -327,7 +318,6 @@ export default {
|
||||
},
|
||||
beforeUnmount() {
|
||||
document.removeEventListener('click', this.closeDropdown);
|
||||
this.unregisterSourceTooltipDismiss();
|
||||
},
|
||||
methods: {
|
||||
isSourceCategory(category) {
|
||||
@@ -457,7 +447,7 @@ export default {
|
||||
// For source links, use sourceName and target (relative path)
|
||||
if (!link.sourceName) return;
|
||||
const path = link.target || "/";
|
||||
goToItem(link.sourceName, path, {}, false, false);
|
||||
goToItem(link.sourceName, path, {});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -559,87 +549,20 @@ export default {
|
||||
}
|
||||
},
|
||||
hideTooltip() {
|
||||
this.unregisterSourceTooltipDismiss();
|
||||
mutations.hideTooltip();
|
||||
},
|
||||
isSourceTooltipVisible(info) {
|
||||
if (!state.tooltip.show || state.tooltip.component !== IndexInfo) {
|
||||
return false;
|
||||
}
|
||||
const shown = state.tooltip.componentProps?.info;
|
||||
if (!shown || !info) {
|
||||
return false;
|
||||
}
|
||||
return shown.name === info.name;
|
||||
},
|
||||
onSourceInfoClick(event, info) {
|
||||
if (!this.useTapForSourceTooltip) {
|
||||
return;
|
||||
}
|
||||
this.toggleSourceTooltip(event, info);
|
||||
},
|
||||
onSourceInfoMouseEnter(event, info) {
|
||||
if (this.useTapForSourceTooltip) {
|
||||
return;
|
||||
}
|
||||
this.showSourceTooltip(event, info);
|
||||
},
|
||||
onSourceInfoMouseLeave() {
|
||||
if (this.useTapForSourceTooltip) {
|
||||
return;
|
||||
}
|
||||
this.hideTooltip();
|
||||
},
|
||||
toggleSourceTooltip(event, info) {
|
||||
if (this.isSourceTooltipVisible(info)) {
|
||||
this.hideTooltip();
|
||||
return;
|
||||
}
|
||||
this.showSourceTooltip(event, info);
|
||||
},
|
||||
showSourceTooltip(event, info) {
|
||||
if (!info?.name) {
|
||||
return;
|
||||
}
|
||||
mutations.showTooltip({
|
||||
component: IndexInfo,
|
||||
componentProps: { info },
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
pointerEvents: this.useTapForSourceTooltip,
|
||||
});
|
||||
if (this.useTapForSourceTooltip) {
|
||||
this.registerSourceTooltipDismiss();
|
||||
if (info) {
|
||||
const tooltipContent = this.buildSourceTooltipContent(info);
|
||||
mutations.showTooltip({
|
||||
content: tooltipContent,
|
||||
x: event.clientX,
|
||||
y: event.clientY,
|
||||
});
|
||||
}
|
||||
},
|
||||
registerSourceTooltipDismiss() {
|
||||
this.unregisterSourceTooltipDismiss();
|
||||
this.sourceTooltipDismissHandler = (e) => {
|
||||
const target = e.target;
|
||||
if (target instanceof Element && (
|
||||
target.closest(".tooltip-info-icon") ||
|
||||
target.closest(".floating-tooltip")
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
this.hideTooltip();
|
||||
};
|
||||
// Defer so the same tap does not immediately dismiss the tooltip.
|
||||
requestAnimationFrame(() => {
|
||||
if (!this.sourceTooltipDismissHandler) {
|
||||
return;
|
||||
}
|
||||
document.addEventListener("click", this.sourceTooltipDismissHandler, true);
|
||||
document.addEventListener("touchstart", this.sourceTooltipDismissHandler, true);
|
||||
});
|
||||
},
|
||||
unregisterSourceTooltipDismiss() {
|
||||
if (!this.sourceTooltipDismissHandler) {
|
||||
return;
|
||||
}
|
||||
document.removeEventListener("click", this.sourceTooltipDismissHandler, true);
|
||||
document.removeEventListener("touchstart", this.sourceTooltipDismissHandler, true);
|
||||
this.sourceTooltipDismissHandler = null;
|
||||
buildSourceTooltipContent(info) {
|
||||
return buildIndexInfoTooltipHTML(info, this.$t, state.user.locale);
|
||||
},
|
||||
async showEditShareHover() {
|
||||
if (!this.canEdit) {
|
||||
@@ -683,7 +606,7 @@ export default {
|
||||
this.navigateToSource(sourceName);
|
||||
},
|
||||
navigateToSource(sourceName) {
|
||||
goToItem(sourceName, '/', {}, false, false);
|
||||
goToItem(sourceName, '/', {});
|
||||
},
|
||||
closeDropdown(event) {
|
||||
if (!this.showSourceDropdown) return;
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "تحديد صورة الشعار",
|
||||
"selectFaviconImage": "تحديد الصورة المفضلة",
|
||||
"selectImage": "حدد الصورة",
|
||||
"deleteFailed": "فشل في حذف المشاركة",
|
||||
"readOnlySourceNotice": "هذا المصدر للقراءة فقط. يتم تعطيل تحميل المشاركات والأذونات التي تعدل الملفات."
|
||||
"deleteFailed": "فشل في حذف المشاركة"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "تم الإنشاء في:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "مقسم{suffix}",
|
||||
"audio": "الصوت{suffix}",
|
||||
"and": "و",
|
||||
"or": "أو",
|
||||
"readOnly": "للقراءة فقط{suffix}",
|
||||
"private": "خاص{suffix}",
|
||||
"yes": "نعم{suffix}",
|
||||
"no": "لا يوجد{suffix}"
|
||||
"or": "أو"
|
||||
},
|
||||
"access": {
|
||||
"rules": "قواعد الوصول",
|
||||
|
||||
@@ -129,8 +129,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -229,8 +229,7 @@
|
||||
"selectBannerImage": "Výběr obrázku banneru",
|
||||
"selectFaviconImage": "Výběr obrázku favicon",
|
||||
"selectImage": "Vybrat obrázek",
|
||||
"deleteFailed": "Nepodařilo se odstranit sdílenou složku",
|
||||
"readOnlySourceNotice": "Tento zdroj je určen pouze pro čtení. Sdílení nahrávání a oprávnění, která upravují soubory, jsou zakázána."
|
||||
"deleteFailed": "Nepodařilo se odstranit sdílenou složku"
|
||||
},
|
||||
"prompts": {
|
||||
"copyMessage": "Vyberte místo, kam chcete soubory kopírovat:",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "Rozdělovač{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "a",
|
||||
"or": "nebo",
|
||||
"readOnly": "Pouze pro čtení{suffix}",
|
||||
"private": "Soukromé{suffix}",
|
||||
"yes": "Ano{suffix}",
|
||||
"no": "Ne{suffix}"
|
||||
"or": "nebo"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Pravidla přístupu",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Bannerbild auswählen",
|
||||
"selectFaviconImage": "Favicon-Bild auswählen",
|
||||
"selectImage": "Bild auswählen",
|
||||
"deleteFailed": "Freigabe konnte nicht gelöscht werden",
|
||||
"readOnlySourceNotice": "Diese Quelle ist schreibgeschützt. Upload-Freigaben und Berechtigungen, die Dateien ändern, sind deaktiviert."
|
||||
"deleteFailed": "Freigabe konnte nicht gelöscht werden"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Erstellt am:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Teiler{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "und",
|
||||
"or": "oder",
|
||||
"readOnly": "Schreibgeschützt{suffix}",
|
||||
"private": "Privat{suffix}",
|
||||
"yes": "Ja{suffix}",
|
||||
"no": "Nein{suffix}"
|
||||
"or": "oder"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Zugangsregeln",
|
||||
|
||||
@@ -129,8 +129,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Επιλέξτε εικόνα banner",
|
||||
"selectFaviconImage": "Επιλέξτε εικόνα favicon",
|
||||
"selectImage": "Επιλέξτε εικόνα",
|
||||
"deleteFailed": "Απέτυχε η διαγραφή κοινής χρήσης",
|
||||
"readOnlySourceNotice": "Αυτή η πηγή είναι μόνο για ανάγνωση. Οι μετοχές φόρτωσης και τα δικαιώματα που τροποποιούν αρχεία είναι απενεργοποιημένα."
|
||||
"deleteFailed": "Απέτυχε η διαγραφή κοινής χρήσης"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Δημιουργήθηκε στο:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Διαχωριστικό{suffix}",
|
||||
"audio": "Ήχος{suffix}",
|
||||
"and": "και",
|
||||
"or": "ή",
|
||||
"readOnly": "Μόνο για ανάγνωση{suffix}",
|
||||
"private": "Ιδιωτικό{suffix}",
|
||||
"yes": "Ναι{suffix}",
|
||||
"no": "Όχι{suffix}"
|
||||
"or": "ή"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Κανόνες πρόσβασης",
|
||||
|
||||
@@ -131,11 +131,7 @@
|
||||
"watching": "Watching{suffix}",
|
||||
"lines": "Lines{suffix}",
|
||||
"lastUpdate": "Last Update{suffix}",
|
||||
"latency": "Latency{suffix}",
|
||||
"readOnly": "Read-only{suffix}",
|
||||
"private": "Private{suffix}",
|
||||
"yes": "Yes{suffix}",
|
||||
"no": "No{suffix}"
|
||||
"latency": "Latency{suffix}"
|
||||
},
|
||||
"buttons": {
|
||||
"copySuccess": "Copied to clipboard!",
|
||||
@@ -267,8 +263,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -296,7 +292,6 @@
|
||||
},
|
||||
"share": {
|
||||
"notice": "Note: when a share is a created, it becomes more exposed to the public and has different rules for access. If your share is not securely configured, it may be accessed by anyone.",
|
||||
"readOnlySourceNotice": "This source is read-only. Upload shares and permissions that modify files are disabled.",
|
||||
"disableAnonymous": "Disable anonymous access",
|
||||
"disableThumbnails": "Disable Thumbnails",
|
||||
"enableAllowedUsernames": "Only share to certain users",
|
||||
@@ -996,4 +991,4 @@
|
||||
"editorSuccess": "Editor Initialization - Success! All steps completed.",
|
||||
"setupError": "Setup Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Seleccionar imagen de banner",
|
||||
"selectFaviconImage": "Seleccionar imagen de favicon",
|
||||
"selectImage": "Seleccionar imagen",
|
||||
"deleteFailed": "Error al borrar recurso compartido",
|
||||
"readOnlySourceNotice": "Esta fuente es de sólo lectura. Los recursos compartidos de carga y los permisos que modifican archivos están desactivados."
|
||||
"deleteFailed": "Error al borrar recurso compartido"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Creado en:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Divisor{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "y",
|
||||
"or": "o",
|
||||
"readOnly": "Sólo lectura{suffix}",
|
||||
"private": "Privado{suffix}",
|
||||
"yes": "Sí{suffix}",
|
||||
"no": "No{suffix}"
|
||||
"or": "o"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Reglas de acceso",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Sélectionner l'image de la bannière",
|
||||
"selectFaviconImage": "Sélectionner l'image du favicon",
|
||||
"selectImage": "Sélectionner l'image",
|
||||
"deleteFailed": "Échec de la suppression du partage",
|
||||
"readOnlySourceNotice": "Cette source est en lecture seule. Les partages de téléchargement et les autorisations qui modifient les fichiers sont désactivés."
|
||||
"deleteFailed": "Échec de la suppression du partage"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Créée le :",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Diviseur{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "et",
|
||||
"or": "ou",
|
||||
"readOnly": "Lecture seule{suffix}",
|
||||
"private": "Privé{suffix}",
|
||||
"yes": "Oui{suffix}",
|
||||
"no": "Non{suffix}"
|
||||
"or": "ou"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Règles d'accès",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "בחר תמונת באנר",
|
||||
"selectFaviconImage": "בחר תמונת סמל מועדף",
|
||||
"selectImage": "בחר תמונה",
|
||||
"deleteFailed": "לא ניתן למחוק את השיתוף",
|
||||
"readOnlySourceNotice": "מקור זה מוגדר לקריאה בלבד. העלאת קבצים והרשאות המשנות קבצים אינן זמינות."
|
||||
"deleteFailed": "לא ניתן למחוק את השיתוף"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "נוצר ב:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "מפריד{suffix}",
|
||||
"audio": "אודיו{suffix}",
|
||||
"and": "ו-",
|
||||
"or": "או",
|
||||
"readOnly": "לקריאה בלבד{suffix}",
|
||||
"private": "פרטי{suffix}",
|
||||
"yes": "כן{suffix}",
|
||||
"no": "לא{suffix}"
|
||||
"or": "או"
|
||||
},
|
||||
"access": {
|
||||
"rules": "כללי גישה",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Banner kép kiválasztása",
|
||||
"selectFaviconImage": "Favicon kép kiválasztása",
|
||||
"selectImage": "Kép kiválasztása",
|
||||
"deleteFailed": "Nem sikerült törölni a megosztást",
|
||||
"readOnlySourceNotice": "Ez a forrás csak olvasható. A feltöltési megosztások és a fájlokat módosító engedélyek letiltva vannak."
|
||||
"deleteFailed": "Nem sikerült törölni a megosztást"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Létrehozva:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Választó{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "és",
|
||||
"or": "vagy",
|
||||
"readOnly": "Csak olvasható{suffix}",
|
||||
"private": "Privát{suffix}",
|
||||
"yes": "Igen{suffix}",
|
||||
"no": "Nem{suffix}"
|
||||
"or": "vagy"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Hozzáférési szabályok",
|
||||
|
||||
@@ -131,11 +131,7 @@
|
||||
"latency": "Latenza{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "e",
|
||||
"or": "o",
|
||||
"readOnly": "Solo lettura{suffix}",
|
||||
"private": "Privato{suffix}",
|
||||
"yes": "Sì{suffix}",
|
||||
"no": "No{suffix}"
|
||||
"or": "o"
|
||||
},
|
||||
"buttons": {
|
||||
"copySuccess": "Copiato negli appunti!",
|
||||
@@ -267,8 +263,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -367,8 +363,7 @@
|
||||
"shareInfo": "QR Code e Info Condivisione",
|
||||
"shareInfoDescription": "Mostra le informazioni della condivisione (titolo, descrizione, banner, QR) in un popup.",
|
||||
"downloadDescription": "Permette di scaricare l'intero contenuto della condivisione come file compresso.",
|
||||
"deleteFailed": "Eliminazione condivisione fallita",
|
||||
"readOnlySourceNotice": "Questa sorgente è di sola lettura. Le azioni di caricamento e le autorizzazioni che modificano i file sono disabilitate."
|
||||
"deleteFailed": "Eliminazione condivisione fallita"
|
||||
},
|
||||
"prompts": {
|
||||
"operationInProgress": "Operazione in corso, attendere...",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "バナー画像を選択",
|
||||
"selectFaviconImage": "ファビコン画像を選択",
|
||||
"selectImage": "画像を選択",
|
||||
"deleteFailed": "共有の削除に失敗しました",
|
||||
"readOnlySourceNotice": "このソースは読み取り専用です。アップロード共有およびファイルを変更するパーミッションは無効です。"
|
||||
"deleteFailed": "共有の削除に失敗しました"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "で作成された:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "ディバイダー{suffix}",
|
||||
"audio": "オーディオ{suffix}",
|
||||
"and": "そして",
|
||||
"or": "または",
|
||||
"readOnly": "読み取り専用{suffix}",
|
||||
"private": "プライベート{suffix}",
|
||||
"yes": "はい{suffix}",
|
||||
"no": "いいえ{suffix}"
|
||||
"or": "または"
|
||||
},
|
||||
"access": {
|
||||
"rules": "アクセスルール",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "배너 이미지 선택",
|
||||
"selectFaviconImage": "파비콘 이미지 선택",
|
||||
"selectImage": "이미지 선택",
|
||||
"deleteFailed": "공유를 삭제하지 못했습니다.",
|
||||
"readOnlySourceNotice": "이 소스는 읽기 전용입니다. 파일을 수정하는 업로드 공유 및 권한은 비활성화됩니다."
|
||||
"deleteFailed": "공유를 삭제하지 못했습니다."
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "만든 곳:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "디바이더{suffix}",
|
||||
"audio": "오디오{suffix}",
|
||||
"and": "그리고",
|
||||
"or": "또는",
|
||||
"readOnly": "읽기 전용{suffix}",
|
||||
"private": "비공개{suffix}",
|
||||
"yes": "예{suffix}",
|
||||
"no": "아니요{suffix}"
|
||||
"or": "또는"
|
||||
},
|
||||
"access": {
|
||||
"rules": "액세스 규칙",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Selecteer bannerafbeelding",
|
||||
"selectFaviconImage": "Selecteer favicon afbeelding",
|
||||
"selectImage": "Afbeelding selecteren",
|
||||
"deleteFailed": "Share niet verwijderd",
|
||||
"readOnlySourceNotice": "Deze bron is alleen-lezen. Upload shares en rechten om bestanden te wijzigen zijn uitgeschakeld."
|
||||
"deleteFailed": "Share niet verwijderd"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Gemaakt op:",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "Verdeler{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "en",
|
||||
"or": "of",
|
||||
"readOnly": "Alleen-lezen{suffix}",
|
||||
"private": "Privé{suffix}",
|
||||
"yes": "Ja{suffix}",
|
||||
"no": "Geen{suffix}"
|
||||
"or": "of"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Toegangsregels",
|
||||
|
||||
+30
-35
@@ -9,8 +9,6 @@
|
||||
"noCreateOptions": "Er zijn geen opties beschikbaar"
|
||||
},
|
||||
"general": {
|
||||
"and": "en",
|
||||
"or": "of",
|
||||
"divider": "Scheiding{suffix}",
|
||||
"show": "Toon{suffix}",
|
||||
"office": "Office{suffix}",
|
||||
@@ -132,10 +130,8 @@
|
||||
"lines": "Regels{suffix}",
|
||||
"lastUpdate": "Laatste update{suffix}",
|
||||
"latency": "Vertraging{suffix}",
|
||||
"readOnly": "Alleen-lezen{suffix}",
|
||||
"private": "Privé{suffix}",
|
||||
"yes": "Ja{suffix}",
|
||||
"no": "Geen{suffix}"
|
||||
"and": "en",
|
||||
"or": "of"
|
||||
},
|
||||
"buttons": {
|
||||
"copySuccess": "Gekopieerd naar klembord!",
|
||||
@@ -235,7 +231,7 @@
|
||||
"del": "geselecteerde items verwijderen",
|
||||
"esc": "selectie wissen en/of opdrachtvenster sluiten",
|
||||
"f2": "bestand hernoemen",
|
||||
"f1": "hulp-venster weergeven",
|
||||
"f1": "hulp-venster tonen",
|
||||
"slash": "Zoeken inschakelen",
|
||||
"description": "U kunt de basisnavigatieopties hieronder bekijken. Ga voor aanvullende informatie naar",
|
||||
"wiki": "FileBrowser Quantum officiële documentatie",
|
||||
@@ -267,8 +263,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -367,8 +363,7 @@
|
||||
"shareInfo": "QR-code en info delen",
|
||||
"shareInfoDescription": "Deze koppeling toont de informatie van de gedeelde map, inclusief titel, beschrijving, banner en QR-code in een popup.",
|
||||
"downloadDescription": "Met deze koppeling kunt u de volledige inhoud van de gedeelde map downloaden als een gecomprimeerd bestand.",
|
||||
"deleteFailed": "Share niet verwijderd",
|
||||
"readOnlySourceNotice": "Deze bron is alleen-lezen. Upload shares en rechten om bestanden te wijzigen zijn uitgeschakeld."
|
||||
"deleteFailed": "Share niet verwijderd"
|
||||
},
|
||||
"prompts": {
|
||||
"operationInProgress": "Werk in uitvoering, even geduld...",
|
||||
@@ -479,12 +474,12 @@
|
||||
"largerThan": "Groter dan:",
|
||||
"olderThanDate": "Ouder dan:",
|
||||
"newerThanDate": "Nieuwer dan:",
|
||||
"showPreviewImages": "Voorbeeld weergeven",
|
||||
"showPreviewImages": "Voorbeeldafbeeldingen tonen",
|
||||
"showPreviewImagesDescription": "Toon, indien beschikbaar, miniatuurvoorbeelden voor zoekresultaten en toon grotere pictogrammen voor alle resultaten.",
|
||||
"helpText1": "Er wordt gezocht op elk teken dat je typt (minimaal{minSearchLength} tekens).",
|
||||
"helpText2": "Substring match alleen op bestands- of mapnamen (geen volledige paden). case:exact voor hoofdlettergevoelig matchen\n\n voor OR tussen termen gebruik je het teken pipe; dubbele aanhalingstekens voor één zin.\n\nSchakel wildcard zoeken in voor meer geavanceerde opties.",
|
||||
"useWildcardSearch": "Zoeken met jokertekens (hoofdlettergevoelig)",
|
||||
"useWildcardSearchDescription": "Ondersteunde jokertekenopties:\n\n- Overeenstemming met een willekeurige reeks: *\n\n- Overeenstemming met één teken: ?\n\n- Tekenklasse: [a-z], [0-9]\n\n- Negatie: [^0-9]\n\n- Letterlijke *, ?, of [ moeten tussen haakjes staan, bijv. [*], [?], [[]\n\n- Alle resultaten zijn hoofdlettergevoelig",
|
||||
"helpText1": "Er wordt gezocht op elk teken dat je typt (minimaal {minSearchLength} tekens).",
|
||||
"helpText2": "Substring match alleen op bestands- of mapnamen (geen volledige paden). case:exact voor hoofdlettergevoelig matchen\n\n voor OR tussen termen gebruik je het teken pipe; dubbele aanhalingstekens voor één zin.\n\nSchakel wildcard zoeken in voor meer geavanceerde opties.",
|
||||
"openInAdvancedSearch": "Openen in geavanceerd zoeken"
|
||||
},
|
||||
"profileSettings": {
|
||||
@@ -532,8 +527,6 @@
|
||||
"disableSearchOptions": "Zoekopties uitschakelen",
|
||||
"disableSearchOptionsDescription": "Schakel de zoekopties in de zijbalk uit.",
|
||||
"hideSidebarFileActions": "Verberg de knop Bestandsacties in de zijbalk",
|
||||
"showToolsInSidebar": "Toon gereedschappen in de zijbalk",
|
||||
"showToolsInSidebarDescription": "Toon altijd de link naar de hulpmiddelen in de zijbalk.",
|
||||
"showCopyPath": "Pad kopiëren tonen in contextmenu",
|
||||
"showCopyPathDescription": "Een actie Pad kopiëren weergeven in het contextmenu van bestanden en mappen.",
|
||||
"deleteWithoutConfirming": "Bestanden verwijderen zonder bevestigingsvenster",
|
||||
@@ -566,7 +559,9 @@
|
||||
"passkeyDeleteFailed": "Passkey verwijderen mislukt",
|
||||
"created": "Aangemaakt",
|
||||
"lastUsed": "Laatst gebruikt",
|
||||
"passkeyDefaultName": "Passkey"
|
||||
"passkeyDefaultName": "Passkey",
|
||||
"showToolsInSidebar": "Toon gereedschappen in de zijbalk",
|
||||
"showToolsInSidebarDescription": "Toon altijd de link naar de hulpmiddelen in de zijbalk."
|
||||
},
|
||||
"settings": {
|
||||
"systemAdmin": "Systeem & Beheer",
|
||||
@@ -885,20 +880,6 @@
|
||||
"name": "Duplicaatbestanden zoeken",
|
||||
"description": "Dubbele bestanden vinden en beheren om opslagruimte terug te winnen"
|
||||
},
|
||||
"advancedSearch": {
|
||||
"name": "Geavanceerd zoeken",
|
||||
"description": "Zoek in de index met volledige controle over bronnen, filters en opties",
|
||||
"searchTerms": "Zoektermen",
|
||||
"matchAllTerms": "Alle termen matchen",
|
||||
"matchAllTermsDescription": "Indien ingeschakeld, moeten alle zoektermen worden gevonden voor elk bestand",
|
||||
"scopeAria": "Zoekopdracht beperken tot een map",
|
||||
"noTerms": "Voer ten minste één zoekterm in.",
|
||||
"termTooShort": "Elke zoekterm moet minimaal {minSearchLength} tekens bevatten.",
|
||||
"caseExact": "Hoofdlettergevoelige match",
|
||||
"resultsTitle": "Zoekresultaten",
|
||||
"invalidSources": "Zet minstens één bron aan.",
|
||||
"noResults": "Geen overeenkomende bestanden of mappen."
|
||||
},
|
||||
"materialIconPicker": {
|
||||
"name": "Material pictogrammenkiezer",
|
||||
"description": "Bladeren en zoeken in Material pictogrammen met live voorbeeld",
|
||||
@@ -922,7 +903,21 @@
|
||||
"chooseFile": "Kies een bestand"
|
||||
},
|
||||
"toolNotFound": "Gereedschap niet gevonden",
|
||||
"backToTools": "Terug naar Gereedschap"
|
||||
"backToTools": "Terug naar Gereedschap",
|
||||
"advancedSearch": {
|
||||
"name": "Geavanceerd zoeken",
|
||||
"description": "Zoek in de index met volledige controle over bronnen, filters en opties",
|
||||
"searchTerms": "Zoektermen",
|
||||
"matchAllTerms": "Alle termen matchen",
|
||||
"matchAllTermsDescription": "Indien ingeschakeld, moeten alle zoektermen worden gevonden voor elk bestand",
|
||||
"scopeAria": "Zoekopdracht beperken tot een map",
|
||||
"noTerms": "Voer ten minste één zoekterm in.",
|
||||
"termTooShort": "Elke zoekterm moet minimaal {minSearchLength} tekens bevatten.",
|
||||
"caseExact": "Hoofdlettergevoelige match",
|
||||
"resultsTitle": "Zoekresultaten",
|
||||
"invalidSources": "Zet minstens één bron aan.",
|
||||
"noResults": "Geen overeenkomende bestanden of mappen."
|
||||
}
|
||||
},
|
||||
"notifications": {
|
||||
"title": "Meldingen",
|
||||
@@ -955,9 +950,9 @@
|
||||
"changeBackground": "Achtergrondkleur wijzigen",
|
||||
"failedToLoad": "Laden 3D-model mislukt",
|
||||
"keyboard": "Toetsenbord:",
|
||||
"autoRotate": "Automatisch roteren",
|
||||
"rotateY": "Roteren Y",
|
||||
"rotateX": "Roteren X"
|
||||
"autoRotate": "Automatisch draaien",
|
||||
"rotateY": "Y draaien",
|
||||
"rotateX": "X draaien"
|
||||
},
|
||||
"onlyoffice": {
|
||||
"debugTitle": "OnlyOffice Foutopsporing",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Wybierz obraz banera",
|
||||
"selectFaviconImage": "Wybierz obraz favicon",
|
||||
"selectImage": "Wybierz obraz",
|
||||
"deleteFailed": "Nie udało się usunąć udziału",
|
||||
"readOnlySourceNotice": "To źródło jest tylko do odczytu. Udziały przesyłania i uprawnienia modyfikujące pliki są wyłączone."
|
||||
"deleteFailed": "Nie udało się usunąć udziału"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Utworzono w:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Dzielnik{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "oraz",
|
||||
"or": "lub",
|
||||
"readOnly": "Tylko do odczytu{suffix}",
|
||||
"private": "Prywatny{suffix}",
|
||||
"yes": "Tak{suffix}",
|
||||
"no": "Nie{suffix}"
|
||||
"or": "lub"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Zasady dostępu",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Selecione a imagem do banner",
|
||||
"selectFaviconImage": "Selecione a imagem do favicon",
|
||||
"selectImage": "Selecionar imagem",
|
||||
"deleteFailed": "Falha ao excluir o compartilhamento",
|
||||
"readOnlySourceNotice": "Essa fonte é somente leitura. Os compartilhamentos de upload e as permissões que modificam arquivos estão desativados."
|
||||
"deleteFailed": "Falha ao excluir o compartilhamento"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Criado em:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Divisor{suffix}",
|
||||
"audio": "Áudio{suffix}",
|
||||
"and": "e",
|
||||
"or": "ou",
|
||||
"readOnly": "Somente leitura{suffix}",
|
||||
"private": "Privado{suffix}",
|
||||
"yes": "Sim{suffix}",
|
||||
"no": "Não{suffix}"
|
||||
"or": "ou"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Regras de acesso",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Selecionar imagem de banner",
|
||||
"selectFaviconImage": "Selecionar a imagem do favicon",
|
||||
"selectImage": "Selecionar imagem",
|
||||
"deleteFailed": "Falha ao eliminar a partilha",
|
||||
"readOnlySourceNotice": "Esta fonte é apenas de leitura. As partilhas de carregamento e as permissões que modificam ficheiros estão desactivadas."
|
||||
"deleteFailed": "Falha ao eliminar a partilha"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Criado em:",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "Divisor{suffix}",
|
||||
"audio": "Áudio{suffix}",
|
||||
"and": "e",
|
||||
"or": "ou",
|
||||
"readOnly": "Só de leitura{suffix}",
|
||||
"private": "Privado{suffix}",
|
||||
"yes": "Sim{suffix}",
|
||||
"no": "Não{suffix}"
|
||||
"or": "ou"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Regras de acesso",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Selectați imaginea bannerului",
|
||||
"selectFaviconImage": "Selectați imaginea favicon",
|
||||
"selectImage": "Selectați imaginea",
|
||||
"deleteFailed": "Eșec la ștergerea partajului",
|
||||
"readOnlySourceNotice": "Această sursă este numai pentru citire. Acțiunile de încărcare și permisiunile care modifică fișiere sunt dezactivate."
|
||||
"deleteFailed": "Eșec la ștergerea partajului"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Creat la:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Divizor{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "și",
|
||||
"or": "sau",
|
||||
"readOnly": "Numai citire{suffix}",
|
||||
"private": "Privat{suffix}",
|
||||
"yes": "Da{suffix}",
|
||||
"no": "Nu{suffix}"
|
||||
"or": "sau"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Reguli de acces",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Выберите изображение баннера",
|
||||
"selectFaviconImage": "Выберите изображение фавикона",
|
||||
"selectImage": "Выберите изображение",
|
||||
"deleteFailed": "Не удалось удалить общий ресурс",
|
||||
"readOnlySourceNotice": "Этот источник доступен только для чтения. Общие ресурсы загрузки и разрешения, изменяющие файлы, отключены."
|
||||
"deleteFailed": "Не удалось удалить общий ресурс"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Создан:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Разделитель{suffix}",
|
||||
"audio": "Аудио{suffix}",
|
||||
"and": "и",
|
||||
"or": "или",
|
||||
"readOnly": "Только для чтения{suffix}",
|
||||
"private": "Частный{suffix}",
|
||||
"yes": "Да{suffix}",
|
||||
"no": "Нет{suffix}"
|
||||
"or": "или"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Правила доступа",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Vyberte obrázok bannera",
|
||||
"selectFaviconImage": "Vyberte obrázok favicon",
|
||||
"selectImage": "Vybrať obrázok",
|
||||
"deleteFailed": "Nepodarilo sa odstrániť podiel",
|
||||
"readOnlySourceNotice": "Tento zdroj je len na čítanie. Zdieľania nahrávania a oprávnenia, ktoré upravujú súbory, sú zakázané."
|
||||
"deleteFailed": "Nepodarilo sa odstrániť podiel"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Vytvorené v:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Rozdeľovač{suffix}",
|
||||
"audio": "Audio{suffix}",
|
||||
"and": "a",
|
||||
"or": "alebo",
|
||||
"readOnly": "Len na čítanie{suffix}",
|
||||
"private": "Súkromná stránka{suffix}",
|
||||
"yes": "Áno{suffix}",
|
||||
"no": "Nie{suffix}"
|
||||
"or": "alebo"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Pravidlá prístupu",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Välj bannerbild",
|
||||
"selectFaviconImage": "Välj favicon-bild",
|
||||
"selectImage": "Välj bild",
|
||||
"deleteFailed": "Misslyckades med att ta bort delning",
|
||||
"readOnlySourceNotice": "Denna källa är skrivskyddad. Uppladdningsandelar och behörigheter som ändrar filer är inaktiverade."
|
||||
"deleteFailed": "Misslyckades med att ta bort delning"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Skapad på:",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "Uppdelare{suffix}",
|
||||
"audio": "Ljud{suffix}",
|
||||
"and": "och",
|
||||
"or": "eller",
|
||||
"readOnly": "Skrivskyddad{suffix}",
|
||||
"private": "Privat{suffix}",
|
||||
"yes": "Ja{suffix}",
|
||||
"no": "Nej{suffix}"
|
||||
"or": "eller"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Regler för åtkomst",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Afiş resmini seçin",
|
||||
"selectFaviconImage": "Favicon resmini seçin",
|
||||
"selectImage": "Resim seçiniz",
|
||||
"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."
|
||||
"deleteFailed": "Paylaşım silinemedi"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Oluşturuldu:",
|
||||
@@ -678,11 +677,7 @@
|
||||
"divider": "Bölücü{suffix}",
|
||||
"audio": "Ses{suffix}",
|
||||
"and": "ve",
|
||||
"or": "veya",
|
||||
"readOnly": "Salt okunur{suffix}",
|
||||
"private": "Özel{suffix}",
|
||||
"yes": "Evet{suffix}",
|
||||
"no": "Hayır{suffix}"
|
||||
"or": "veya"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Erişim kuralları",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "Виберіть зображення банера",
|
||||
"selectFaviconImage": "Виберіть зображення іконки",
|
||||
"selectImage": "Виберіть зображення",
|
||||
"deleteFailed": "Не вдалося видалити спільний ресурс",
|
||||
"readOnlySourceNotice": "Це джерело доступне лише для читання. Спільні ресурси для завантаження та дозволи, які змінюють файли, вимкнено."
|
||||
"deleteFailed": "Не вдалося видалити спільний ресурс"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "Створено в Ат:",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "Перегородка{suffix}",
|
||||
"audio": "Аудіо{suffix}",
|
||||
"and": "і",
|
||||
"or": "або",
|
||||
"readOnly": "Тільки для читання{suffix}",
|
||||
"private": "Рядовий{suffix}",
|
||||
"yes": "Так.{suffix}",
|
||||
"no": "Ні.{suffix}"
|
||||
"or": "або"
|
||||
},
|
||||
"access": {
|
||||
"rules": "Правила доступу",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "选择横幅图片",
|
||||
"selectFaviconImage": "选择图标图像",
|
||||
"selectImage": "选择图像",
|
||||
"deleteFailed": "删除共享失败",
|
||||
"readOnlySourceNotice": "此源为只读。上传共享和修改文件的权限被禁用。"
|
||||
"deleteFailed": "删除共享失败"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "创建于",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "分割器{suffix}",
|
||||
"audio": "音频{suffix}",
|
||||
"and": "和",
|
||||
"or": "或",
|
||||
"readOnly": "只读{suffix}",
|
||||
"private": "私人{suffix}",
|
||||
"yes": "是{suffix}",
|
||||
"no": "没有{suffix}"
|
||||
"or": "或"
|
||||
},
|
||||
"access": {
|
||||
"rules": "访问规则",
|
||||
|
||||
@@ -126,8 +126,8 @@
|
||||
"it": "Italiano",
|
||||
"ja": "日本語",
|
||||
"ko": "한국어",
|
||||
"nl": "Nederlands",
|
||||
"nlBE": "Nederlands (België)",
|
||||
"nlBE": "Dutch (Belgium)",
|
||||
"nl": "Dutch",
|
||||
"pl": "Polski",
|
||||
"pt": "Português",
|
||||
"ptBR": "Português (Brasil)",
|
||||
@@ -493,8 +493,7 @@
|
||||
"selectBannerImage": "選擇橫幅圖片",
|
||||
"selectFaviconImage": "選擇 Favicon 圖片",
|
||||
"selectImage": "選擇圖片",
|
||||
"deleteFailed": "刪除分享失敗",
|
||||
"readOnlySourceNotice": "此來源為唯讀。上傳共用和修改檔案的權限已停用。"
|
||||
"deleteFailed": "刪除分享失敗"
|
||||
},
|
||||
"api": {
|
||||
"createdAt": "建立於:",
|
||||
@@ -779,11 +778,7 @@
|
||||
"divider": "分隔線{suffix}",
|
||||
"audio": "音訊{suffix}",
|
||||
"and": "和",
|
||||
"or": "或",
|
||||
"readOnly": "唯讀{suffix}",
|
||||
"private": "私人{suffix}",
|
||||
"yes": "是{suffix}",
|
||||
"no": "沒有{suffix}"
|
||||
"or": "或"
|
||||
},
|
||||
"access": {
|
||||
"rules": "存取規則",
|
||||
|
||||
@@ -130,7 +130,7 @@ async function setupSSE () {
|
||||
}
|
||||
|
||||
// Original notification logic - only show error after multiple failures
|
||||
if (state.realtimeDownCount === 2 && !isManuallyClosed) {
|
||||
if (state.realtimeDownCount == 2 && !isManuallyClosed) {
|
||||
notify.showErrorToast(i18n.global.t('events.connectionLost'))
|
||||
}
|
||||
scheduleReconnect()
|
||||
|
||||
@@ -47,8 +47,8 @@ const actions = {
|
||||
upload: (context, item) => {
|
||||
let uploadsCount = Object.keys(context.state.uploads).length;
|
||||
|
||||
let isQueueEmpty = context.state.queue.length === 0;
|
||||
let isUploadsEmpty = uploadsCount === 0;
|
||||
let isQueueEmpty = context.state.queue.length == 0;
|
||||
let isUploadsEmpty = uploadsCount == 0;
|
||||
|
||||
if (isQueueEmpty && isUploadsEmpty) {
|
||||
window.addEventListener("beforeunload", beforeUnload);
|
||||
@@ -67,8 +67,8 @@ const actions = {
|
||||
let uploadsCount = Object.keys(context.state.uploads).length;
|
||||
|
||||
let isBellowLimit = uploadsCount < UPLOADS_LIMIT;
|
||||
let isQueueEmpty = context.state.queue.length === 0;
|
||||
let isUploadsEmpty = uploadsCount === 0;
|
||||
let isQueueEmpty = context.state.queue.length == 0;
|
||||
let isUploadsEmpty = uploadsCount == 0;
|
||||
|
||||
let isFinished = isQueueEmpty && isUploadsEmpty;
|
||||
let canProcess = isBellowLimit && !isQueueEmpty;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { markRaw } from "vue";
|
||||
import * as i18n from "@/i18n";
|
||||
import { state } from "./state.js";
|
||||
import { getters } from "./getters.js";
|
||||
@@ -128,7 +127,7 @@ export const mutations = {
|
||||
for (const k of Object.keys(value)) {
|
||||
const source = value[k];
|
||||
if (state.sources.info[k]) {
|
||||
if (source.total === 0) {
|
||||
if (source.total == 0) {
|
||||
state.sources.hasSourceInfo = false
|
||||
} else {
|
||||
state.sources.hasSourceInfo = true
|
||||
@@ -146,8 +145,6 @@ export const mutations = {
|
||||
state.sources.info[k].fullScanDurationSeconds = source.fullScanDurationSeconds || 0;
|
||||
state.sources.info[k].complexity = source.complexity || 0;
|
||||
state.sources.info[k].scanners = source.scanners || [];
|
||||
state.sources.info[k].readOnly = source.readOnly || false;
|
||||
state.sources.info[k].private = source.private || false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,8 +196,6 @@ export const mutations = {
|
||||
fullScanDurationSeconds: merge ? prev.fullScanDurationSeconds : 0,
|
||||
complexity: merge ? prev.complexity : 0,
|
||||
scanners: merge && prev.scanners ? [...prev.scanners] : [],
|
||||
readOnly: merge ? prev.readOnly : false,
|
||||
private: merge ? prev.private : false,
|
||||
};
|
||||
}
|
||||
// Sidebar usage bar uses hasSourceInfo + per-source used/total; must survive object replace
|
||||
@@ -749,14 +744,9 @@ export const mutations = {
|
||||
emitStateChanged();
|
||||
},
|
||||
showTooltip(value) {
|
||||
const useComponent = Boolean(value.component);
|
||||
state.tooltip.content = useComponent ? "" : (value.content ?? "");
|
||||
state.tooltip.component = useComponent ? markRaw(value.component) : null;
|
||||
state.tooltip.componentProps = useComponent ? (value.componentProps ?? {}) : null;
|
||||
state.tooltip.content = value.content;
|
||||
state.tooltip.x = value.x;
|
||||
state.tooltip.y = value.y;
|
||||
state.tooltip.width = value.width ?? null;
|
||||
state.tooltip.pointerEvents = value.pointerEvents ?? false;
|
||||
state.tooltip.show = true;
|
||||
emitStateChanged();
|
||||
},
|
||||
@@ -768,11 +758,6 @@ export const mutations = {
|
||||
return;
|
||||
}
|
||||
state.tooltip.show = false;
|
||||
state.tooltip.content = "";
|
||||
state.tooltip.component = null;
|
||||
state.tooltip.componentProps = null;
|
||||
state.tooltip.width = null;
|
||||
state.tooltip.pointerEvents = false;
|
||||
emitStateChanged();
|
||||
},
|
||||
setMaxConcurrentUpload: (value) => {
|
||||
|
||||
@@ -6,8 +6,6 @@ export const state = reactive({
|
||||
tooltip: {
|
||||
show: false,
|
||||
content: "",
|
||||
component: null,
|
||||
componentProps: null,
|
||||
x: 0,
|
||||
y: 0,
|
||||
pointerEvents: false,
|
||||
|
||||
@@ -18,7 +18,6 @@ export interface ReqObject {
|
||||
source?: string;
|
||||
content?: string;
|
||||
modified?: string;
|
||||
hasPreview?: string;
|
||||
subtitles?: any[];
|
||||
|
||||
// Directory listing properties
|
||||
@@ -109,8 +108,6 @@ export interface StoreState {
|
||||
tooltip: {
|
||||
show: boolean;
|
||||
content: string;
|
||||
component: import("vue").Component | null;
|
||||
componentProps: Record<string, unknown> | null;
|
||||
x: number;
|
||||
y: number;
|
||||
pointerEvents: boolean;
|
||||
|
||||
@@ -8,10 +8,10 @@ describe('testSort', () => {
|
||||
{input: 1, expected:"1.0 bytes"},
|
||||
{input: 1150, expected:"1.1 KB"},
|
||||
{input: 5105650, expected:"4.9 MB"},
|
||||
{input: Number('156518899684'), expected:"145.8 GB"},
|
||||
{input: Number('1020993183744'), expected:"950.9 GB"},
|
||||
{input: Number('4891498498488'), expected:"4.4 TB"},
|
||||
{input: Number('11991498498488488'), expected:"10.7 PB"},
|
||||
{input: 156518899684, expected:"145.8 GB"},
|
||||
{input: 1020993183744, expected:"950.9 GB"},
|
||||
{input: 4891498498488, expected:"4.4 TB"},
|
||||
{input: 11991498498488488, expected:"10.7 PB"},
|
||||
]
|
||||
for (let i in tests) {
|
||||
expect(getHumanReadableFilesize(tests[i].input)).toEqual(tests[i].expected);
|
||||
|
||||
Loaded 100 of 120 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user