Compare commits

..
Author SHA1 Message Date
Graham Steffaniak 2a3028e4a8 Remove buildinfo file (#1322) 2025-10-04 10:53:38 -05:00
Graham Steffaniak 8f318bed02 updated build info (#1321) 2025-10-04 10:42:00 -05:00
Graham Steffaniak fe2d798538 fixed rename issue (#1320) 2025-10-04 09:29:05 -05:00
Graham Steffaniak c40006c9a4 Merge branch 'dev/v0.8.8' of github.com:gtsteffaniak/filebrowser into dev/v0.8.8 2025-10-04 08:48:37 -05:00
Graham Steffaniak 3a8dadae65 remove blue icon 2025-10-04 08:47:56 -05:00
Graham Steffaniak d23544457c Last minute 0.8.8 (#1316) 2025-10-04 08:47:56 -05:00
Graham Steffaniak 2a1357fac0 updated with issue fixes (#1315) 2025-10-04 08:47:56 -05:00
Graham Steffaniak 392e15696b Upload only share type (#1314) 2025-10-04 08:47:56 -05:00
Kevin B. 819bd3801e fix/changes on playback and queue (#1311) 2025-10-04 08:47:56 -05:00
Graham Steffaniak 6a6faad9a3 Update Dockerfile 2025-10-04 08:47:56 -05:00
Graham Steffaniak 5acfaaece7 updated with performance improvements (#1308) 2025-10-04 08:47:56 -05:00
Graham Steffaniak ccbfb31a9d 2fa secret validation fix (#1307) 2025-10-04 08:47:56 -05:00
Graham Steffaniak 2b67f7ddde Other issues 0.8.8 (#1306) 2025-10-04 08:47:56 -05:00
Kevin B. 83c37938db Add playback shortcut key -- fix toggle loop (#1303) 2025-10-04 08:47:56 -05:00
Graham Steffaniak 1fdfe9a30d improve preview performance (#1300) 2025-10-04 08:47:55 -05:00
Kevin B.andGraham Steffaniak 6c399e99c0 Fix M4A thumbnails and previews (#1294)
Co-authored-by: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com>
2025-10-04 08:46:18 -05:00
Graham Steffaniak cf15dcdd7b convert video types options and plyr features (#1298) 2025-10-04 08:46:18 -05:00
Graham Steffaniak e6a577a2a7 updated 2025-10-04 08:46:18 -05:00
Graham Steffaniak 96205b0c30 updated (#1297) 2025-10-04 08:46:16 -05:00
Graham Steffaniak 9ec6c00a86 updated 2025-10-04 08:43:45 -05:00
Graham Steffaniak 96a34bb5de More features 0.8.8 (#1296) 2025-10-04 08:43:45 -05:00
Graham Steffaniak 238b584be0 remove build:dev 2025-10-04 08:43:45 -05:00
Graham Steffaniak 4ec4025627 removed build time changes for language 2025-10-04 08:43:45 -05:00
Graham Steffaniak dbe1eb0fd7 updated with translation check (#1289) 2025-10-04 08:43:45 -05:00
Graham Steffaniak 959d6d9898 updated readme 2025-10-04 08:43:45 -05:00
Graham Steffaniak a452ad0dcc updated (#1287) 2025-10-04 08:43:45 -05:00
Graham Steffaniak 776bb858e7 updated go sum 2025-10-04 08:43:45 -05:00
Graham Steffaniak d4456d2bd0 updated a lot (#1286) 2025-10-04 08:43:45 -05:00
Graham Steffaniak 7f1339f747 updated workflow for ghcr (#1284) 2025-10-04 08:43:45 -05:00
Graham Steffaniak 656cb3b86a fix config startup issue (#1283) 2025-10-04 08:43:44 -05:00
Graham Steffaniak e38dd64282 updated with config adjustments (#1281) 2025-10-04 08:43:44 -05:00
5553d5e40c Customize default file/directory permissions (#1263)
Co-authored-by: MrPanda376 <luca.silvestrin.2008@gmail.com>
Co-authored-by: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com>
2025-10-04 08:43:44 -05:00
Kevin B. 15f8443324 fix light and dark mode on the player and editor nextPrevious (#1279) 2025-10-04 08:43:44 -05:00
Graham Steffaniak ccf920b200 remove blue icon 2025-10-03 18:39:09 -05:00
Graham Steffaniak 9eec31e7b2 Last minute 0.8.8 (#1316) 2025-10-03 18:21:26 -05:00
Graham Steffaniak 31b59c2410 updated with issue fixes (#1315) 2025-10-03 13:03:13 -05:00
Graham Steffaniak 8c931eead8 Upload only share type (#1314) 2025-10-03 10:59:12 -05:00
Kevin B. 31b889cb15 fix/changes on playback and queue (#1311) 2025-10-02 10:37:19 -05:00
Graham Steffaniak 183f7d2f1b Update Dockerfile 2025-10-01 23:26:52 -05:00
Graham Steffaniak bb786117ec updated with performance improvements (#1308) 2025-10-01 18:01:53 -05:00
Graham Steffaniak 218b3e1615 2fa secret validation fix (#1307) 2025-10-01 16:33:32 -05:00
Graham Steffaniak 0ad15dac35 Other issues 0.8.8 (#1306) 2025-10-01 13:15:22 -05:00
Kevin B. aced6ef0c7 Add playback shortcut key -- fix toggle loop (#1303) 2025-10-01 13:05:18 -05:00
Graham Steffaniak facb1b4029 improve preview performance (#1300) 2025-09-30 18:49:24 -05:00
Kevin B.andGraham Steffaniak 41f473c3b6 Fix M4A thumbnails and previews (#1294)
Co-authored-by: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com>
2025-09-30 18:12:00 -05:00
Graham Steffaniak 0b6e3d3eeb convert video types options and plyr features (#1298) 2025-09-30 09:52:35 -05:00
Graham Steffaniak 0bed4b5016 updated 2025-09-29 18:58:50 -05:00
Graham Steffaniak 5290b59b37 Merge branch 'dev/v0.8.8' of github.com:gtsteffaniak/filebrowser into dev/v0.8.8 2025-09-29 18:42:14 -05:00
Graham Steffaniak fa685ece68 updated (#1297) 2025-09-29 18:32:21 -05:00
Graham Steffaniak dc8051adc8 updated 2025-09-29 18:25:14 -05:00
Graham Steffaniak 50e36c64c8 More features 0.8.8 (#1296) 2025-09-29 16:58:05 -05:00
Graham Steffaniak 537cc74d6f remove build:dev 2025-09-29 13:51:18 -05:00
Graham Steffaniak 6d541155ca removed build time changes for language 2025-09-29 13:50:45 -05:00
Graham Steffaniak 3f45683043 updated with translation check (#1289) 2025-09-29 13:47:31 -05:00
Graham Steffaniak 95dece8df0 updated readme 2025-09-27 09:11:08 -05:00
Graham Steffaniak 593c04591e updated (#1287) 2025-09-26 18:19:57 -05:00
Graham Steffaniak 4b567606aa updated go sum 2025-09-26 16:33:07 -05:00
Graham Steffaniak d9afef9b8d updated a lot (#1286) 2025-09-26 16:12:26 -05:00
Graham Steffaniak 607b7956d6 updated workflow for ghcr (#1284) 2025-09-25 14:10:06 -05:00
Graham Steffaniak ecaebd70dd fix config startup issue (#1283) 2025-09-25 10:50:07 -05:00
Graham Steffaniak 9722d1ee7f updated with config adjustments (#1281) 2025-09-24 11:22:57 -05:00
ffb7cf5df3 Customize default file/directory permissions (#1263)
Co-authored-by: MrPanda376 <luca.silvestrin.2008@gmail.com>
Co-authored-by: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com>
2025-09-23 16:05:11 -05:00
Graham Steffaniak c99c82b9d9 updated changelog (#1274) 2025-09-22 11:32:33 -05:00
Graham Steffaniak a2246c85f1 updated with many user update changes (#1271) 2025-09-22 10:28:44 -05:00
Graham Steffaniak 7f037746cd updated with ffmpeg caching and concurrency changes (#1269) 2025-09-21 12:18:41 -05:00
Kevin B. 973a0782f0 Fastfoward and rewind when playing media (#1261) 2025-09-21 09:08:36 -05:00
Kevin B. 23460a0008 i18n: Update translations (#1258) 2025-09-21 09:06:54 -05:00
Kurami d823c82d47 Improve styles of plyr (#1257) 2025-09-19 17:50:36 -05:00
Graham Steffaniak 771237ecf7 updated to fix with leading slash (#1256) 2025-09-19 14:14:55 -05:00
Graham Steffaniak a119d20285 updated with better bot check (#1255) 2025-09-19 12:25:08 -05:00
Graham Steffaniak 465cccf030 Fix auth loop handling (#1254) 2025-09-19 12:14:12 -05:00
Graham Steffaniak d4e2fe0bac updated with no indexing test (#1253) 2025-09-19 11:11:13 -05:00
Zhiyuan ZhengandGraham Steffaniak 1f0868a8f7 Fix directories empty issue when disableIndexing is true (#1249)
Co-authored-by: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com>
2025-09-19 10:44:00 -05:00
Graham Steffaniak 7a57e11a49 added json logging support (#1247) 2025-09-19 10:20:59 -05:00
Markos e0e464cca5 Feat: Enabled plyr video player to rotate when entering full screen (#1251) 2025-09-19 10:20:43 -05:00
Graham Steffaniak bbc087a4a5 updated dependencies (#1246) 2025-09-18 18:37:48 -05:00
271 changed files with 4023 additions and 12233 deletions

No files matched your search

+1 -4
View File
@@ -2,9 +2,6 @@ backend/**.db
backend/tmp
backend/dist
backend/backend*
backend/http/dist/**
backend/vendor/**
frontend/dist/**
frontend/node_modules/**
frontend/pkg/**
frontend/node_modules/**
-1
View File
@@ -7,7 +7,6 @@ on:
- "dev/v*.*.*"
- "beta/v*.*.*"
- "stable/v*.*.*"
- "staging/v*.*.*"
jobs:
prime_docker_cache:
name: Prime docker cache
@@ -86,3 +86,25 @@ jobs:
git push origin "$STABLE_BRANCH"
echo "✅ Successfully merged '$BETA_BRANCH' into '$STABLE_BRANCH'."
# - name: Delete beta branch after successful merge
# run: |
# VERSION="${{ github.event.inputs.version }}"
# BETA_BRANCH="beta/v$VERSION"
#
# # Delete beta branch locally and remotely
# git branch -d "$BETA_BRANCH"
# git push origin --delete "$BETA_BRANCH"
#
# echo "✅ Successfully deleted '$BETA_BRANCH'."
- name: Create Pull Request to Main
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT }}
commit-message: "Promote stable/v${{ github.event.inputs.version }} to main"
title: "Promote stable/v${{ github.event.inputs.version }} to main"
body: "This PR promotes stable/v${{ github.event.inputs.version }} to the main branch."
base: main
branch: stable/v${{ github.event.inputs.version }}
delete-branch: false
@@ -86,3 +86,14 @@ jobs:
git push origin "$BETA_BRANCH"
echo "✅ Successfully merged '$DEV_BRANCH' into '$BETA_BRANCH'."
# - name: Delete dev branch after successful merge
# run: |
# VERSION="${{ github.event.inputs.version }}"
# DEV_BRANCH="dev/v$VERSION"
#
# # Delete dev branch locally and remotely
# git branch -d "$DEV_BRANCH"
# git push origin --delete "$DEV_BRANCH"
#
# echo "✅ Successfully deleted '$DEV_BRANCH'."
+2 -2
View File
@@ -59,8 +59,8 @@ jobs:
target_commitish: ${{ github.sha }}
token: ${{ secrets.PAT }}
tag_name: ${{ steps.extract_branch.outputs.tag_name }}
prerelease: false
make_latest: false
prerelease: false # change this to false when stable gets released
make_latest: true # change this to false when stable gets released
draft: false
generate_release_notes: true
name: ${{ steps.extract_branch.outputs.tag_name }}
+2
View File
@@ -43,6 +43,8 @@ jobs:
TAGS="${{ steps.meta.outputs.tags }}"
# Apply modifications to both docker.io and ghcr.io tags
CLEANED_TAGS=$(echo "$TAGS" | sed 's/filebrowser:dev-v/filebrowser:/g' | sed -E 's/(filebrowser:[0-9]+\.[0-9]+\.[0-9]+)/\1-dev/g')
# Add dev tag to both registries
CLEANED_TAGS="$CLEANED_TAGS,gtstef/filebrowser:dev,ghcr.io/gtsteffaniak/filebrowser:dev"
echo "cleaned_tag<<EOF" >> $GITHUB_OUTPUT
echo "$CLEANED_TAGS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
+1 -2
View File
@@ -10,7 +10,7 @@ permissions:
jobs:
test_playwright:
name: Test Playwright - regular
name: Test Playwright
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -60,7 +60,6 @@ jobs:
token: ${{ secrets.PAT }}
tag_name: ${{ steps.extract_branch.outputs.tag_name }}
prerelease: false
make_latest: true
draft: false
generate_release_notes: true
name: ${{ steps.extract_branch.outputs.tag_name }}
+3 -5
View File
@@ -10,24 +10,22 @@ rice-box.go
/backend/filebrowser.exe
frontend/tsconfig.tsbuildinfo
/backend/backend.exe
/backend/playwright-files.db
/backend/tmp
/backend/dist
/frontend/dist
/frontend/pkg
/frontend/test-results
/frontend/playwright-files
/frontend/screenshots
/frontend/tests/playwright-files/demo*
/frontend/loginAuth.json
/frontend/package-lock.json
/backend/vendor
/backend/*.cov
/backend/*test_config.yaml
/backend/test_config.yaml
/backend/test-*.yaml
/backend/generated.yaml
/backend/srv
/backend/http/dist
/backend/http/embed
/backend/http/embed/*
.DS_Store
node_modules
-154
View File
@@ -2,158 +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.0.2-stable
**Notes**:
- [docker] upgraded ffmpeg 8.0 to 8.0.1
**BugFixes**:
- added missing exiftool to docker image for heic conversion orientation support
- Uploading a file will silently overwrite any existing file with the same name #1564
- Unable to download folder as ZIP #1604
- issues downloading and file actions on password protected share
## v1.0.1-stable
**BugFixes**:
- UserDefault always applies to newly created users #1518
- Updating user's own password sometimes doesn't work
- Anonymous Share link with optional password does not allow downloads #1553
- Share options should go in the meta tags #1511
- Unable to select compression format when downloading multiple files/dir via Share link (v1.0.0) #1557
- fixed sidebar clipping on some browsers like safari
- Files show as Download is not available even though it is #1537
## v1.0.1-beta & v1.0.0-stable
**New Features**:
- login icon support added via `frontend.loginIcon` config path variable
**Notes**:
- updated default login icon
- stopped publishing rolling `dev` docker tag.
- build requirement change -- from node 18 > node 20 with npm 9.0.0+
- version is not shown for unauthenticated users #1444
- adjusted how static assets are served to better handle icon standards
- fixed signup login #1444
- update makefile linker flags to properly set version and sha #1474
- better windows build support -- `make setup` and `make dev` work as long as git is installed on windows
- added better first initilization detection
- If filebrowser initialized and does not detect a database, a new warning message in server logs appears.
- If theres no database on start, any admin user's first login will see a welcome message in the ui.
- For docker, it defaults to ./data/database.db, but will also fallback to ./database.db without any additional configuration.
**BugFixes**:
- Generating multiple HEIC previews in parallel fails #1470
- ? in path not always encoded right #1447
- fixed some condition that the halloween background doesn't load properly
- some comments not showing up on config viewer in settings
## v1.0.0-beta
**Notes**:
- Enhanced onlyoffice debugger with more wholistic backend logs
- Updated info prompt styling
- share qr code links to externalUrl for entire share if exists #1329
**BugFixes**:
- cookie host is set using x-Forwarded-Host to better support reverse proxies.
- HEIC conversion not working #1460
- 'Prevent user changing their password' also prevents admins changing the users password. #1365
- OnlyOffice write problem #1397 #1068
- Conditionals starting with a . seem to not work. #1455
- Last modified in file info is empty #1443
- Share links: 'Default View Mode' does not apply to subfolders. #1463
## v0.8.11-beta
**New Features**:
- OnlyOffice debugger now shows backend logs as well for admin users.
- If proxy auth based `username` equals `auth.adminUsername`, the user will be promoted to admin.
- Guard against accidently cancelling uploads #1419
- Added a quirky halloween theme that automatically applies on october 31st -- you can disable this from happening by setting `frontend.styling.disableEventThemes`
**Notes**:
- Removed share setting `enableOnlyOfficeEditing` -- uses value from `allowEditing`
- Anonymous users can now edit if a share has edit permissions enabled.
- No "Incompatible user settings detected" message if its first setup
- cookie handling revamped
- fully backend managed
- `auth` cookie name changed to `filebrowser_quantum_jwt`
- auth cookie for password users no longer session based #1439
- removed state jwt state variable -- 100% cookie based.
**BugFixes**:
- Fixed issue editing onlyoffice on shares #1397
- Added proper and robust logging / error handling for the onlyoffice callback. #1422 #1068
- If a file was moved/renamed/deleted onlyoffice would re-save the original file without error, now it gives error the file doesn't exist anymore.
- OnlyOffice integration does not work behind proxy authentication #1422
- proxy-based authentication with docker does not work unless set up with password-based login first #1226
- Select all bug on safari mobile #1421
- Dragging a item into itself #1446
## v0.8.10-beta
**New Features**:
- Add marquee selection to listing view -- thanks @Kurami32 #1388
**Notes**:
- More changes to login auth flow
- respects `FILEBROWSER_DISABLE_AUTOMATIC_BACKUP='true'` env var #1398
- Deprecating `conditionals.hidden` instead use `conditionals.ignoreHidden`
**BugFixes**:
- Fix material outline styling
- "feels lonely here" when clicking at source tab #1387
- Anonymous upload bug 0.8.9 #1383
- changing previews between documents in onlyoffice #1410
- onlyoffice should display user language #1061
- Filebrowser will hard fail when OIDC provider is not found #733
- some API endpoints always return 404 #849
## v0.8.9-beta
> [!CAUTION]
> If you have indexing rules -- such as [maxWatchers](https://github.com/gtsteffaniak/filebrowser/blob/39514169f17ed9586d587dd496257588ded6e532/frontend/public/config.generated.yaml#L30), [neverWatchPaths](https://github.com/gtsteffaniak/filebrowser/blob/39514169f17ed9586d587dd496257588ded6e532/frontend/public/config.generated.yaml#L31C9-L31C24), [exclude](https://github.com/gtsteffaniak/filebrowser/blob/39514169f17ed9586d587dd496257588ded6e532/frontend/public/config.generated.yaml#L32C9-L32C16) rules, [include](https://github.com/gtsteffaniak/filebrowser/blob/39514169f17ed9586d587dd496257588ded6e532/frontend/public/config.generated.yaml#L43) rules, see [the migration guide](https://filebrowserquantum.com/en/docs/user-guides/general-configuration/exclusion-rules/) for help.
**New Features**:
- Playback Queue for media -- thanks @Kurami32 #1339
- Ctrl+b Shortcut to toggle sidebar, open settings, search #1172
- Add a "select all" toggle in the menu #974
- Save on exit text editor -- thanks @srini-abhiram #1334 #1241
- Disabled indexing for subfolders but allow browsing #783
- Added more granular create/upload, delete, and download (includes viewing content) permission #1200 #1199
- Upload settings can be adjusted directly in the upload prompt
- Added paste confirmation prompt when using copy/paste keyboard shortcuts.
- Updated shares
- `disableDownload` to disable download and (content viewing).
- `allowReplacements` to share permission -- prohibits replacing files on conflict #661
- normal shares can create/upload files if given permission
**Notes**:
- Optimized font and icon loading.
- the next/previous buttons will follow media queue order if playback mode has a queue.
- All new exclude rules -- see [full config example](https://github.com/gtsteffaniak/filebrowser/wiki/Full-Config-Example)
- The order of sources will strictly match order in config.yaml. Default landing page is root first source unless otherwise configured in profile settings.
- Uploading changes #1371
- Chunked uploading can no longer be explicitly disabled, defaults to 5MB chunks
- Automatic chunked/non-chunked uploads based on size. If an item exceeds the chunk size, chunked uploading will occur. If its less than chunk size, no chunked upload.
- To "disable" chunked upload, you an set your chunk size very large -- 0 chunk size will be reset to 5MB.
**BugFixes**:
- Remember the previous location after closing a preview #1336
- fixed issue related to multi-config parsing #1267
- Cannot save text files, missing button #1326 #1367
- Files are being overwritten and/or content disappears #1312
- moving between items using next/previous will reset the req and show a responsive loading spinner -- fixing several state related issues.
- access management: child folders accessible stopped showing up #1332
- Make source inaccessible if directory does not exist rather than exiting on start #1264
- HTTP Proxy environment gets ignored since version v0.8.6-beta #1324
- album artwork preview not showing on shares
- fixed OIDC logout causing a loop #995 #1361
- fixed checksum failure #1372
- Copy, paste, cut shortcuts don't work and make the UI unusable #1375
## v0.8.8-beta
**New Features**:
@@ -194,8 +42,6 @@ All notable changes to this project will be documented in this file. For commit
- console errors during login/logout
- fix scoped user share creation issue #1309
- share close button and navigation issues.
- OnlyOffice source not found when opening shared file #1285
- user scoped onlyoffice error saving files with Onlyoffice #1068
## v0.8.7-beta
+2 -2
View File
@@ -5,9 +5,9 @@ Thank you for your interest in contributing to FileBrowser Quantum! This guide w
## Prerequisites
- **Go 1.25+** (see `backend/go.mod`)
- **Node.js 20.0.0+** with npm 9.0.0+ (see `frontend/package.json`)
- **Node.js 18.0.0+** with npm 7.0.0+ (see `frontend/package.json`)
- **Docker** (optional, for containerized development)
- **Git** especially improtant on windows -- needed for bash support.
- **Git**
### Optional Tools
+35 -9
View File
@@ -8,28 +8,30 @@
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://github.com/gtsteffaniak/filebrowser/wiki/Q&A#is-there-a-way-to-donate-or-support-this-project)
<img width="150" src="https://github.com/user-attachments/assets/c40b22c9-33da-47b7-bc4c-ce69bb5cc174" title="Logo">
<img width="150" src="https://github.com/user-attachments/assets/59986a2a-f960-4536-aa35-4a9a7c98ad48" title="Logo">
<h3>FileBrowser Quantum</h3>
The best free self-hosted web-based file manager.
<br/><br/>
<img width="800" src="https://github.com/user-attachments/assets/162d7a95-33b7-49bd-976c-dd6822c0d22b">
</div>
## Pinned
> [!WARNING]
> There is no stable version -- :construction: planned for 2025. ([Read more](https://github.com/gtsteffaniak/filebrowser/discussions/628))
:loudspeaker: [Stable Release & v1.0.0 Update](https://github.com/gtsteffaniak/filebrowser/discussions/1293)
:pushpin: [Read The Official Docs](https://filebrowserquantum.com/) (currently english-only)
## Announcements
[Stable Release & 0.9.0 update](https://github.com/gtsteffaniak/filebrowser/discussions/1293)
## About
FileBrowser Quantum provides an easy way to access and manage your files from the web. It has a modern responsive interface that has many advanced features to manage users, access, sharing, and file preview and editing.
FileBrowser Quantum provides an easy way to access and manage your files from the web. It has has a modern responsive interface that has many advanced features to manage users, access, sharing, and file preview and editing.
This version is called "Quantum" because it packs tons of advanced features into a tiny easy to run file. Unlike the majority of alternative options, FileBrowser Quantum is simple to install and easy to configure.
The goal for this repo is to become the best open-source self-hosted file browsing application that exists -- **all for free**. This repo will always be free and open-source.
Ready to try it out? See [Getting Started Docs](https://filebrowserquantum.com/en/docs/getting-started/).
Ready to try it out? See [Getting Started Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/Getting-Started).
## How its different
@@ -63,6 +65,7 @@ Notable features that this fork *does not* have (removed):
- :construction: jobs are not supported yet.
- ❌ shell commands are completely removed and will not be returned.
FileBrowser Quantum differs significantly from the original version. Many of these changes required a significant overhaul. Creating a fork was a necessary process to make the program better. There have been many growing pains, but a stable release is planned and coming soon.
## System Requirements
@@ -90,12 +93,35 @@ a pop-up menu.
<img width="1000" src="https://github.com/user-attachments/assets/aa32b05c-f917-47bb-b07f-857edc5e47f7" title="Search GIF">
</p>
## Official Docs
## Install and Configuration
See the [Official Docs](https://filebrowserquantum.com/). Contributions are welcome and encouraged! See [FilebrowserDocs Github](https://github.com/quantumx-apps/filebrowserDocs).
Check out the [Getting Started Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/Getting-Started)
For help configuring your filebrowser see [Configuration Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/Configuration-And-Examples)
## Command Line Usage
See the [CLI Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/CLI)
## API Usage
See the [API Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/API)
## Office File Support
See [Office Support Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/Office-Support#adding-open-office-integration-for-docker) on how to enable office file editing and office-related features.
## Migration from the original filebrowser
See the [Migration Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/Migration)
## Other Questions
For more, see the [Q&A Wiki](https://github.com/gtsteffaniak/filebrowser/wiki/Q&A)
## Comparison Chart
Application Name | <img width="48" src="https://github.com/user-attachments/assets/c40b22c9-33da-47b7-bc4c-ce69bb5cc174" > Quantum | <img width="48" src="https://github.com/filebrowser/filebrowser/blob/master/frontend/public/img/logo.svg" > Filebrowser | <img width="48" src="https://github.com/mickael-kerjean/filestash/blob/master/public/assets/logo/app_icon.png?raw=true" > Filestash | <img width="48" src="https://avatars.githubusercontent.com/u/19211038?s=200&v=4" > Nextcloud | <img width="48" src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Google_Drive_logo.png/480px-Google_Drive_logo.png" > Google_Drive | <img width="48" src="https://avatars.githubusercontent.com/u/6422152?v=4" > FileRun
Application Name | <img width="48" src="https://github.com/user-attachments/assets/59986a2a-f960-4536-aa35-4a9a7c98ad48" > Quantum | <img width="48" src="https://github.com/filebrowser/filebrowser/blob/master/frontend/public/img/logo.svg" > Filebrowser | <img width="48" src="https://github.com/mickael-kerjean/filestash/blob/master/public/assets/logo/app_icon.png?raw=true" > Filestash | <img width="48" src="https://avatars.githubusercontent.com/u/19211038?s=200&v=4" > Nextcloud | <img width="48" src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Google_Drive_logo.png/480px-Google_Drive_logo.png" > Google_Drive | <img width="48" src="https://avatars.githubusercontent.com/u/6422152?v=4" > FileRun
--- | --- | --- | --- | --- | --- | --- |
Filesystem support | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ |
Linux | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
+4 -6
View File
@@ -1,4 +1,4 @@
FROM gtstef/ffmpeg:8.0.1-decode AS ffmpeg
FROM gtstef/ffmpeg:8.0-decode AS ffmpeg
FROM golang:alpine AS base
ARG VERSION
ARG REVISION
@@ -13,7 +13,7 @@ RUN go build -tags mupdf,musl -ldflags="-w -s \
-o filebrowser .
RUN upx filebrowser
FROM node:jod-slim AS nbuild
FROM node:lts-slim AS nbuild
WORKDIR /app
COPY ./frontend/package.json ./
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
@@ -28,21 +28,19 @@ COPY --from=ffmpeg [ "/ffmpeg", "/ffprobe", "/usr/local/bin/" ]
ENV FILEBROWSER_FFMPEG_PATH="/usr/local/bin/"
ENV FILEBROWSER_DATABASE="/home/filebrowser/data/database.db"
ENV PATH="$PATH:/home/filebrowser"
RUN apk --no-cache add ca-certificates mailcap tzdata curl exiftool
RUN apk --no-cache add ca-certificates mailcap tzdata curl
RUN adduser -D -s /bin/true -u 1000 filebrowser
USER filebrowser
WORKDIR /home/filebrowser
# copy config to two locations for compatibility
COPY --from=base --chown=filebrowser:1000 [ "/app/filebrowser", "./" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/filebrowser", "/app/config.yaml", "./" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/config.yaml", "./data/config.yaml" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/config.yaml", "./" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/reduce-rounded-corners.css", "./" ]
COPY --from=nbuild --chown=filebrowser:1000 [ "/app/dist/", "./http/dist/" ]
## sanity checks
RUN [ "filebrowser", "version" ]
RUN [ "ffmpeg", "-version" ]
RUN [ "ffprobe", "-version" ]
RUN [ "exiftool", "-ver" ]
USER root
# exposing default port for auto discovery.
EXPOSE 80
-1
View File
@@ -15,6 +15,5 @@ RUN mkdir -p ./http/dist
COPY [ "./backend/http/embed/", "./http/dist/"]
# Run tests
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN ./filebrowser set -u testuser1,testuser1
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
-1
View File
@@ -14,5 +14,4 @@ RUN mkdir -p ./http/dist
COPY [ "./backend/http/embed/", "./http/dist/"]
# Run tests
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
+1 -3
View File
@@ -6,7 +6,6 @@ COPY [ "./_docker/src/noauth/", "./" ]
WORKDIR /app/frontend
COPY [ "./frontend/tests", "./tests" ]
COPY [ "./frontend/tests/playwright-files", "./tests/playwright-files2" ]
WORKDIR /app/backend/
COPY [ "./backend/filebrowser", "./"]
@@ -14,5 +13,4 @@ RUN mkdir -p ./http/dist
COPY [ "./backend/http/embed/", "./http/dist/"]
# Run tests
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
-2
View File
@@ -8,8 +8,6 @@ RUN mkdir -p ./http/dist
COPY [ "./_docker/src/oidc/backend/", "./"]
COPY ["./backend/filebrowser", "./"]
COPY [ "./backend/http/embed/", "./http/dist/"]
# Run tests
WORKDIR /app/frontend
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN node mock-oidc-server.js & sleep 2 && cd ../backend/ && ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
-1
View File
@@ -11,5 +11,4 @@ RUN apt update && apt install nginx -y
RUN mv default.conf /etc/nginx/conf.d/default.conf
RUN mv .htpasswd /etc/nginx/conf.d/.htpasswd
RUN sed -i 's/filebrowser/localhost/g' /etc/nginx/conf.d/default.conf
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN nginx & ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
+2 -5
View File
@@ -2,19 +2,16 @@ FROM ghcr.io/gtsteffaniak/playwright-base:latest
WORKDIR /app
# Copy setup scripts first to leverage caching
COPY [ "./_docker/src/settings/", "./" ]
COPY [ "./_docker/src/no-config/", "./" ]
WORKDIR /app/frontend
COPY [ "./_docker/src/settings/frontend/", "./" ]
COPY [ "./_docker/src/no-config/frontend/", "./" ]
COPY [ "./frontend/tests/", "./tests" ]
WORKDIR /app/backend/
COPY [ "./backend/filebrowser*", "./"]
COPY [ "./backend/reduce-rounded-corners.css", "./no-rounded.css"]
RUN mkdir -p ./http/dist
COPY [ "./backend/http/embed/", "./http/dist/"]
# Run tests
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN ./filebrowser set -u testuser1,testuser1
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
-1
View File
@@ -14,5 +14,4 @@ RUN mkdir -p ./http/dist
COPY [ "./backend/http/embed/", "./http/dist/"]
# Run tests
ENV FILEBROWSER_PLAYWRIGHT_TEST=true
RUN ./filebrowser & sleep 2 && cd ../frontend && npx playwright test
+1 -2
View File
@@ -11,7 +11,7 @@ RUN go build -ldflags="-w -s \
-o filebrowser .
RUN upx filebrowser
FROM node:jod-slim AS nbuild
FROM node:lts-slim AS nbuild
WORKDIR /app
COPY ./frontend/package.json ./
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
@@ -30,7 +30,6 @@ USER filebrowser
WORKDIR /home/filebrowser
COPY --from=base --chown=filebrowser:1000 [ "/app/filebrowser", "./" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/config.yaml", "./data/config.yaml" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/config.yaml", "./" ]
COPY --from=base --chown=filebrowser:1000 [ "/app/reduce-rounded-corners.css", "./" ]
COPY --from=nbuild --chown=filebrowser:1000 [ "/app/dist/", "./http/dist/" ]
## sanity checks
+25 -13
View File
@@ -1,15 +1,27 @@
server:
<<: *server-main
port: 80
baseURL: "/"
logging:
- levels: "info|error|debug"
sources:
- path: "../frontend/tests/playwright-files"
name: "playwright + files"
config:
defaultEnabled: true
- path: "."
name: "docker"
config:
disableIndexing: true
defaultEnabled: true
frontend:
<<: *frontend-main
userDefaults:
preview:
image: true
popup: true
video: true
office: true
highQuality: true
permissions:
download: true
create: true
name: "Graham's Filebrowser"
disableDefaultLinks: true
styling:
customThemes:
no-rounded:
description: "No rounded corners" # The description of the theme to display in the UI.
css: "no-rounded.css" # The css file path and filename to use for the theme.
externalLinks:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
@@ -1,13 +0,0 @@
frontend-main: &frontend-main
name: "Graham's Filebrowser"
disableDefaultLinks: true
styling:
disableEventThemes: true
customThemes:
no-rounded:
description: "No rounded corners" # The description of the theme to display in the UI.
css: "no-rounded.css" # The css file path and filename to use for the theme.
externalLinks:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
@@ -1,15 +0,0 @@
server-main: &server-main
port: 80
baseURL: "/"
logging:
- levels: "info|error|debug"
sources:
- path: "../frontend/tests/playwright-files"
name: "playwright + files"
config:
defaultEnabled: true
- path: "."
name: "docker"
config:
disableIndexing: true
defaultEnabled: true
@@ -10,7 +10,7 @@ import { defineConfig, devices } from "@playwright/test";
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
globalSetup: "./tests/playwright/no-config-setup",
globalSetup: "./tests/playwright/local-setup",
timeout: 5000,
testDir: "./tests/playwright/no-config",
/* Run tests in files in parallel */
+4 -38
View File
@@ -5,38 +5,15 @@ server:
- levels: "info|error|debug"
sources:
- path: "../frontend/tests/playwright-files"
name: "exclude"
config:
defaultEnabled: true
conditionals:
rules:
- folderPath: "excluded"
- folderPath: "excludedButVisible"
viewable: true
- path: "../frontend/tests/playwright-files2"
name: "include"
config:
defaultEnabled: true
conditionals:
rules:
- includeRootItem: "myfolder"
- includeRootItem: "subfolderExclusions"
- filePath: "/subfolderExclusions/exclusionlist.sh"
- folderPath: "/subfolderExclusions/folderItem"
viewable: true
- fileStartsWith: "startsWith"
- folderEndsWith: "Folder"
- folderNames: 'folderNames'
- fileNames: 'fileNames'
- folderName: 'folderName'
- fileName: 'fileName'
- folderName: '.hiddenDir'
- fileName: '.hidden'
exclude:
folderPaths:
- "excluded"
auth:
methods:
noauth: true
frontend:
name: "Graham's Filebrowser"
disableDefaultLinks: true
@@ -44,17 +21,6 @@ frontend:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
styling:
disableEventThemes: true
userDefaults:
showHidden: true
preview:
image: true
popup: true
video: true
office: true
highQuality: true
permissions:
download: true
create: true
realtime: true
+2 -11
View File
@@ -14,8 +14,7 @@ frontend:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
styling:
disableEventThemes: true
auth:
methods:
password:
@@ -29,12 +28,6 @@ auth:
adminGroup: "Admins"
userDefaults:
preview:
image: true
popup: true
video: true
office: true
highQuality: true
darkMode: true
disableSettings: false
singleClick: false
@@ -42,6 +35,4 @@ userDefaults:
admin: false
modify: true
share: false
api: false
download: true
create: true
api: false
+2 -11
View File
@@ -16,8 +16,7 @@ frontend:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
styling:
disableEventThemes: true
auth:
methods:
password:
@@ -29,12 +28,6 @@ auth:
logoutRedirectUrl: "https://localhost/api/auth/logout2"
userDefaults:
preview:
image: true
popup: true
video: true
office: true
highQuality: true
darkMode: true
disableSettings: false
singleClick: false
@@ -42,6 +35,4 @@ userDefaults:
admin: false
modify: true
share: true
api: false
download: true
create: true
api: false
+1 -7
View File
@@ -17,7 +17,6 @@ frontend:
name: "Graham's Filebrowser"
disableDefaultLinks: true
styling:
disableEventThemes: true
customThemes:
no-rounded:
description: "No rounded corners" # The description of the theme to display in the UI.
@@ -25,9 +24,4 @@ frontend:
externalLinks:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
auth:
methods:
password:
signup: true
title: "Playwright"
@@ -11,14 +11,14 @@ import { defineConfig, devices } from "@playwright/test";
*/
export default defineConfig({
globalSetup: "./tests/playwright/global-setup",
timeout: 3000,
timeout: 10000,
testDir: "./tests/playwright/settings",
/* Run tests in files in parallel */
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: false,
/* Retry on CI only */
retries: 1,
retries: 2,
/* Opt out of parallel tests on CI. */
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
+1 -4
View File
@@ -13,13 +13,10 @@ server:
config:
private: true
defaultEnabled: true
frontend:
name: "Graham's Filebrowser"
disableDefaultLinks: true
externalLinks:
- text: "A playwright test"
url: "https://playwright.dev/"
title: "Playwright"
styling:
disableEventThemes: true
title: "Playwright"
+1 -1
View File
@@ -2,7 +2,7 @@ root = "."
tmp_dir = "tmp"
[build]
cmd = "go build -o ./tmp/filebrowser --tags=mupdf --ldflags=\"-w -s -X 'github.com/gtsteffaniak/filebrowser/backend/common/version.CommitSHA=commitSHA' -X 'github.com/gtsteffaniak/filebrowser/backend/common/version.Version=version'\" ."
cmd = "go build -o ./tmp/filebrowser --tags=mupdf --ldflags=\"-w -s -X 'github.com/gtsteffaniak/filebrowser/backend/version.CommitSHA=testingCommit' -X 'github.com/gtsteffaniak/filebrowser/backend/version.Version=testing'\" ."
bin = "tmp/filebrowser"
full_bin = "FILEBROWSER_DEVMODE=true CGO_ENABLED=1 ./tmp/filebrowser -c test_config.yaml"
include_ext = ["go", "tpl", "tmpl", "html"]
-21
View File
@@ -1,21 +0,0 @@
root = "."
tmp_dir = "tmp"
[build]
cmd = "go build -o ./tmp/filebrowser.exe --ldflags=\"-w -s -X 'github.com/gtsteffaniak/filebrowser/backend/common/version.CommitSHA=commitSHA' -X 'github.com/gtsteffaniak/filebrowser/backend/common/version.Version=version'\" ."
bin = "tmp/filebrowser.exe"
args_bin = ["-c", "test_config.yaml"]
include_ext = ["go", "tpl", "tmpl", "html"]
exclude_dir = ["tmp", "vendor", "http\\dist", "http\\embed", "swagger\\docs"]
exclude_unchanged = true
follow_symlink = false
poll = true
poll_interval = 1000
log = "air.log"
delay = 1000 # ms
[log]
time = true
[misc]
clean_on_exit = true
+6 -6
View File
@@ -255,12 +255,12 @@ func TestOverrideDirectoryToFile(t *testing.T) {
// Get the index and set up mock data
idx := indexing.GetIndex("test")
if idx == nil { //nolint:staticcheck // t.Fatal terminates execution
if idx == nil {
t.Fatal("Failed to get test index")
}
// Create mock directory structure
idx.Directories["/"] = &iteminfo.FileInfo{ //nolint:staticcheck // t.Fatal terminates execution
idx.Directories["/"] = &iteminfo.FileInfo{
Path: "/",
ItemInfo: iteminfo.ItemInfo{
Name: "/",
@@ -273,7 +273,7 @@ func TestOverrideDirectoryToFile(t *testing.T) {
// Simulate the directory-to-file override by updating the mock data
// Remove the directory from the parent's Folders slice
rootInfo := idx.Directories["/"] //nolint:staticcheck // t.Fatal terminates execution
rootInfo := idx.Directories["/"]
for i, folder := range rootInfo.Folders {
if folder.Name == "Test Object" {
rootInfo.Folders = append(rootInfo.Folders[:i], rootInfo.Folders[i+1:]...)
@@ -330,12 +330,12 @@ func TestOverrideFileToDirectory(t *testing.T) {
// Get the index and set up mock data
idx := indexing.GetIndex("test")
if idx == nil { //nolint:staticcheck // t.Fatal terminates execution
if idx == nil {
t.Fatal("Failed to get test index")
}
// Create mock directory structure with a file
idx.Directories["/"] = &iteminfo.FileInfo{ //nolint:staticcheck // t.Fatal terminates execution
idx.Directories["/"] = &iteminfo.FileInfo{
Path: "/",
ItemInfo: iteminfo.ItemInfo{
Name: "/",
@@ -348,7 +348,7 @@ func TestOverrideFileToDirectory(t *testing.T) {
// Simulate the file-to-directory override by updating the mock data
// Remove the file from the parent's Files slice
rootInfo := idx.Directories["/"] //nolint:staticcheck // t.Fatal terminates execution
rootInfo := idx.Directories["/"]
for i, file := range rootInfo.Files {
if file.Name == "Test Object" {
rootInfo.Files = append(rootInfo.Files[:i], rootInfo.Files[i+1:]...)
+54 -27
View File
@@ -15,6 +15,7 @@ import (
"github.com/dhowden/tag"
"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/database/access"
@@ -42,29 +43,58 @@ func FileInfoFaster(opts utils.FileOptions, access *access.Storage) (*iteminfo.E
}
opts.IsDir = isDir
var info *iteminfo.FileInfo
var exists bool
var useFsInfo bool
// Check if path is viewable (allows filesystem access without indexing)
isViewable := index.IsViewable(isDir, opts.Path)
// Check if indexing is disabled for this source
if index.Config.DisableIndexing {
useFsInfo = true
}
// For non-viewable paths, verify they are indexed
// Skip this check if indexing is disabled for the entire source
if !isViewable && !index.Config.DisableIndexing {
if !useFsInfo && isDir {
err = index.RefreshFileInfo(opts)
if err != nil {
return response, fmt.Errorf("path not accessible: %v", err)
if err == errors.ErrNotIndexed {
return response, fmt.Errorf("could not refresh file info: %v", err)
}
}
}
if isDir {
info, err = index.GetFsDirInfo(opts.Path)
if err != nil {
return response, err
if useFsInfo {
if isDir {
info, err = index.GetFsDirInfo(opts.Path)
if err != nil {
return response, err
}
} else {
var fileInfo os.FileInfo
// Get file info directly from filesystem
fileInfo, err = os.Stat(realPath)
if err != nil {
return response, fmt.Errorf("could not stat file: %v", err)
}
info = &iteminfo.FileInfo{
Path: opts.Path,
ItemInfo: iteminfo.ItemInfo{
Name: fileInfo.Name(),
Size: fileInfo.Size(),
ModTime: fileInfo.ModTime(),
},
}
info.DetectType(realPath, false)
}
} else {
// For files, get info from parent directory to ensure HasPreview is set correctly
info, err = index.GetFsDirInfo(opts.Path)
if err != nil {
return response, err
info, exists = index.GetReducedMetadata(opts.Path, opts.IsDir)
if !exists {
err = index.RefreshFileInfo(opts)
if err != nil {
return response, fmt.Errorf("could not refresh file info: %v", err)
}
info, exists = index.GetReducedMetadata(opts.Path, opts.IsDir)
if !exists {
return response, fmt.Errorf("could not get metadata for path: %v", opts.Path)
}
}
}
@@ -244,11 +274,6 @@ func RefreshIndex(source string, path string, isDir bool, recursive bool) error
path = strings.TrimSuffix(path, "/")
}
// Skip indexing for viewable paths (viewable: true means don't index, just allow FS access)
if idx.IsViewable(isDir, path) {
return nil
}
err := idx.RefreshFileInfo(utils.FileOptions{Path: path, IsDir: isDir, Recursive: recursive})
return err
}
@@ -282,7 +307,7 @@ func validateMoveDestination(src, dst string, isSrcDir bool) error {
return nil
}
func MoveResource(isSrcDir bool, sourceIndex, destIndex, realsrc, realdst string, s *share.Storage) error {
func MoveResource(isSrcDir, isDestDir bool, sourceIndex, destIndex, realsrc, realdst string, s *share.Storage) error {
// Validate the move operation before executing
if err := validateMoveDestination(realsrc, realdst, isSrcDir); err != nil {
return err
@@ -344,7 +369,7 @@ func MoveResource(isSrcDir bool, sourceIndex, destIndex, realsrc, realdst string
return nil
}
func CopyResource(isSrcDir bool, sourceIndex, destIndex, realsrc, realdst string) error {
func CopyResource(isSrcDir, isDestDir bool, sourceIndex, destIndex, realsrc, realdst string) error {
// Validate the copy operation before executing
if err := validateMoveDestination(realsrc, realdst, isSrcDir); err != nil {
return err
@@ -371,12 +396,14 @@ func CopyResource(isSrcDir bool, sourceIndex, destIndex, realsrc, realdst string
// Refresh destination (parent directory if it's a file)
dstRefreshPath := realdst
dstRefreshIsDir := isDestDir
if !isSrcDir {
// If copying a file (regardless of destination), refresh the parent directory
dstRefreshPath = filepath.Dir(realdst)
dstRefreshIsDir = true
}
go RefreshIndex(destIndex, dstRefreshPath, true, true) //nolint:errcheck
go RefreshIndex(destIndex, dstRefreshPath, dstRefreshIsDir, true) //nolint:errcheck
return nil
}
@@ -420,12 +447,12 @@ func WriteDirectory(opts utils.FileOptions) error {
return RefreshIndex(idx.Name, opts.Path, true, true)
}
func WriteFile(source, path string, in io.Reader) error {
idx := indexing.GetIndex(source)
func WriteFile(opts utils.FileOptions, in io.Reader) error {
idx := indexing.GetIndex(opts.Source)
if idx == nil {
return fmt.Errorf("could not get index: %v ", source)
return fmt.Errorf("could not get index: %v ", opts.Source)
}
realPath, _, _ := idx.GetRealPath(path)
realPath, _, _ := idx.GetRealPath(opts.Path)
// Strip trailing slash from realPath if it's meant to be a file
realPath = strings.TrimRight(realPath, "/")
// Ensure the parent directories exist
@@ -466,7 +493,7 @@ func WriteFile(source, path string, in io.Reader) error {
return err
}
return RefreshIndex(source, path, false, false)
return RefreshIndex(opts.Source, opts.Path, false, false)
}
// getContent reads and returns the file content if it's considered an editable text file.
+2 -2
View File
@@ -29,14 +29,14 @@ func MoveFile(src, dst string) error {
// fallback
err = CopyFile(src, dst)
if err != nil {
logger.Errorf("CopyFile failed %v", err)
logger.Errorf("CopyFile failed %v %v %v ", src, dst, err)
return err
}
go func() {
err = os.RemoveAll(src)
if err != nil {
logger.Errorf("os.Remove failed %v", err)
logger.Errorf("os.Remove failed %v %v ", src, err)
}
}()
+7
View File
@@ -15,6 +15,9 @@ func validateAccessRules() {
if store.Access == nil {
return
}
logger.Info("Validating and migrating access rules to new format...")
// Get all sources
for sourcePath := range settings.Config.Server.SourceMap {
// Clear cache before migration to ensure we get fresh data
@@ -47,6 +50,8 @@ func validateAccessRules() {
// Create the new path with trailing slash
newPath := oldPath + "/"
logger.Debugf("Migrating access rule from '%s' to '%s'", oldPath, newPath)
// Migrate the rule to the new path
if err := migrateAccessRule(sourcePath, oldPath, newPath, rule); err != nil {
logger.Errorf("Failed to migrate rule from %s to %s: %v", oldPath, newPath, err)
@@ -69,6 +74,8 @@ func validateAccessRules() {
logger.Infof("Migrated %d access rules for source %s", migratedCount, sourcePath)
}
}
logger.Info("Access rules validation completed")
}
// migrateAccessRule creates a new access rule with the new path format
+3 -2
View File
@@ -112,7 +112,7 @@ func runCLI() bool {
}
newUser.Permissions = settings.Config.UserDefaults.Permissions
newUser.Permissions.Admin = asAdmin
err = storage.CreateUser(newUser, newUser.Permissions)
err = storage.CreateUser(newUser)
if err != nil {
logger.Errorf("could not create user: %v", err)
}
@@ -350,7 +350,8 @@ func createConfig(configpath string) {
func generateYaml() {
generateConfig := os.Getenv("FILEBROWSER_GENERATE_CONFIG") == "true"
if generateConfig || settings.Config.Env.IsDevMode {
devMode := os.Getenv("FILEBROWSER_DEVMODE") == "true"
if generateConfig || devMode {
logger.Info("Generating config.yaml")
settings.GenerateYaml()
}
+5 -4
View File
@@ -79,10 +79,11 @@ func StartFilebrowser() {
}
// Dev mode enables development features like template hot-reloading
devMode := os.Getenv("FILEBROWSER_DEVMODE") == "true"
_, err := os.Stat("http/dist")
// In dev mode, always use filesystem assets. Otherwise, check if http/dist exists
if !settings.Config.Env.IsDevMode {
settings.Config.Env.EmbeddedFs = os.IsNotExist(err)
if !devMode {
settings.Config.Server.EmbeddedFs = os.IsNotExist(err)
}
sourceList := []string{}
@@ -94,7 +95,7 @@ func StartFilebrowser() {
logger.Infof("Auth Methods : %v", settings.Config.Auth.AuthMethods)
logger.Info(database)
logger.Infof("Sources : %v", sourceList)
logger.Debugf("Using Embedded FS : %v", settings.Config.Env.EmbeddedFs)
logger.Debugf("Using Embedded FS : %v", settings.Config.Server.EmbeddedFs)
serverConfig := settings.Config.Server
swagInfo := docs.SwaggerInfo
@@ -107,7 +108,7 @@ func StartFilebrowser() {
for _, source := range settings.Config.Server.SourceMap {
go indexing.Initialize(source, false)
}
validateUserInfo(!dbExists)
validateUserInfo()
validateOfficeIntegration()
validateAccessRules()
// Start the rootCMD in a goroutine
+5 -43
View File
@@ -2,7 +2,6 @@ package cmd
import (
"fmt"
"os"
"reflect"
"github.com/gtsteffaniak/filebrowser/backend/adapters/fs/fileutils"
@@ -11,9 +10,9 @@ import (
"github.com/gtsteffaniak/go-logger/logger"
)
var createBackup = false
var createBackup = []bool{}
func validateUserInfo(newDB bool) {
func validateUserInfo() {
// update source info for users if names/sources/paths might have changed
usersList, err := store.Users.Gets()
if err != nil {
@@ -34,9 +33,6 @@ func validateUserInfo(newDB bool) {
if updateLoginType(user) {
updateUser = true
}
if updateShowFirstLogin(user) {
updateUser = true
}
adminUser := settings.Config.Auth.AdminUsername
adminPass := settings.Config.Auth.AdminPassword
passwordEnabled := settings.Config.Auth.Methods.PasswordAuth.Enabled
@@ -48,8 +44,7 @@ func validateUserInfo(newDB bool) {
changePass = true
}
if updateUser {
skipCreateBackup := os.Getenv("FILEBROWSER_DISABLE_AUTOMATIC_BACKUP") == "true" || newDB
if createBackup && !skipCreateBackup {
if len(createBackup) == 1 {
logger.Warning("Incompatible user settings detected, creating backup of database before converting.")
err = fileutils.CopyFile(settings.Config.Server.Database, fmt.Sprintf("%s.bak", settings.Config.Server.Database))
if err != nil {
@@ -110,21 +105,9 @@ func updateUserScopes(user *users.User) bool {
return changed
}
func updateShowFirstLogin(user *users.User) bool {
if user.ShowFirstLogin && !settings.Config.Env.IsFirstLoad {
user.ShowFirstLogin = false
return true
}
return false
}
// func to convert legacy user with perm key to permissions
func updatePermissions(user *users.User) bool {
if user.Version == 1 {
return false
}
updateUser := true
user.Permissions.Download = true
updateUser := false
// if any keys are true, set the permissions to true
if user.Perm.Api {
user.Permissions.Api = true
@@ -146,29 +129,8 @@ func updatePermissions(user *users.User) bool {
user.Perm.Share = false
updateUser = true
}
if user.Perm.Create {
user.Permissions.Create = true
user.Perm.Create = false
updateUser = true
}
if user.Perm.Create {
user.Permissions.Create = true
user.Perm.Create = false
updateUser = true
}
if user.Perm.Download {
user.Permissions.Download = true
user.Perm.Download = false
updateUser = true
}
if user.Permissions.Modify {
user.Permissions.Create = true
user.Permissions.Delete = true
updateUser = true
}
user.Version = 1
if updateUser {
createBackup = true
createBackup = append(createBackup, true)
}
return updateUser
}
-2
View File
@@ -23,6 +23,4 @@ var (
ErrUnauthorized = errors.New("user unauthorized")
ErrNotIndexed = errors.New("directory or item excluded from indexing")
ErrWrongLoginMethod = errors.New("user attempted to login with wrong login method")
ErrDownloadNotAllowed = errors.New("downloads are not allowed for this share")
ErrUploadNotAllowed = errors.New("upload permission not allowed for this share")
)
+1 -3
View File
@@ -103,9 +103,7 @@ func validateOidcAuth() error {
ctx := context.Background()
// Create a custom HTTP client with proper User-Agent to avoid being blocked by bot protection
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment, // Respect HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables
}
transport := &http.Transport{}
// If disableVerifyTLS is true, disable TLS verification
if oidcCfg.DisableVerifyTLS {
+85 -233
View File
@@ -1,7 +1,6 @@
package settings
import (
"bytes"
"fmt"
"log"
"os"
@@ -43,13 +42,8 @@ func Initialize(configFile string) {
time.Sleep(5 * time.Second) // allow sleep time before exiting to give docker/kubernetes time before restarting
logger.Fatal(err.Error())
}
Config.Env.IsPlaywright = os.Getenv("FILEBROWSER_PLAYWRIGHT_TEST") == "true"
if Config.Env.IsPlaywright {
logger.Warning("Running in playwright test mode. This is not recommended for production.")
}
// setup logging first to ensure we log any errors
setupLogging()
setupFs()
setupLogging()
setupAuth(false)
setupSources(false)
setupUrls()
@@ -70,43 +64,9 @@ func setupFs() {
dirPermOctal, _ = strconv.ParseUint("755", 8, 32)
}
fileutils.SetFsPermissions(os.FileMode(filePermOctal), os.FileMode(dirPermOctal))
// try writing to cache dir
absCacheDir, err := filepath.Abs(Config.Server.CacheDir)
if err != nil {
logger.Errorf("error getting absolute path for 'server.cacheDir: %v': %v", Config.Server.CacheDir, err)
}
cacheDir := filepath.Join(absCacheDir, "init_test")
err = os.MkdirAll(cacheDir, fileutils.PermDir)
if err != nil {
logger.Errorf("Unable to write to 'server.cacheDir: %v', please ensure the cache directory is writable: %v", absCacheDir, err)
}
}
func setupFrontend(generate bool) {
if Config.Frontend.LoginIcon != "" {
// check if file exists
if _, err := os.Stat(Config.Frontend.LoginIcon); os.IsNotExist(err) {
logger.Warningf("login icon file '%v' does not exist", Config.Frontend.LoginIcon)
Config.Frontend.LoginIcon = ""
} else {
// validate image type
validExtensions := []string{".svg", ".png", ".jpg", ".jpeg", ".gif", ".webp", ".ico"}
isValid := false
lowerPath := strings.ToLower(Config.Frontend.LoginIcon)
for _, ext := range validExtensions {
if strings.HasSuffix(lowerPath, ext) {
isValid = true
break
}
}
if !isValid {
logger.Warningf("login icon file '%v' is not a valid image type (supported: svg, png, jpg, jpeg, gif, webp, ico)", Config.Frontend.LoginIcon)
Config.Frontend.LoginIcon = ""
}
}
}
if Config.Server.MinSearchLength == 0 {
Config.Server.MinSearchLength = 3
}
@@ -126,13 +86,7 @@ func setupFrontend(generate bool) {
}
Config.Frontend.Styling.LightBackground = FallbackColor(Config.Frontend.Styling.LightBackground, "#f5f5f5")
Config.Frontend.Styling.DarkBackground = FallbackColor(Config.Frontend.Styling.DarkBackground, "#141D24")
var err error
if Config.Frontend.Styling.CustomCSS != "" {
Config.Frontend.Styling.CustomCSSRaw, err = readCustomCSS(Config.Frontend.Styling.CustomCSS)
if err != nil {
logger.Warning(err.Error())
}
}
Config.Frontend.Styling.CustomCSSRaw = readCustomCSS(Config.Frontend.Styling.CustomCSS)
Config.Frontend.Styling.CustomThemeOptions = map[string]CustomTheme{}
if Config.Frontend.Styling.CustomThemes == nil {
Config.Frontend.Styling.CustomThemes = map[string]CustomTheme{}
@@ -158,6 +112,7 @@ func setupFrontend(generate bool) {
if !ok {
addCustomTheme("default", "The default theme", "")
}
// Load custom favicon if configured
loadCustomFavicon()
}
@@ -200,12 +155,16 @@ func setupVideoPreview() {
}
}
func checkPathExists(realPath string) error {
// check path exists
if _, err := os.Stat(realPath); os.IsNotExist(err) {
return fmt.Errorf("source path %v is currently not available", realPath)
func getRealPath(path string) string {
realPath, err := filepath.Abs(path)
if err != nil {
logger.Fatalf("could not find configured source path: %v", err)
}
return nil
// check path exists
if _, err = os.Stat(realPath); os.IsNotExist(err) {
logger.Fatalf("configured source path does not exist: %v", realPath)
}
return realPath
}
func setupSources(generate bool) {
@@ -216,14 +175,7 @@ func setupSources(generate bool) {
if source.Config.Disabled {
continue
}
realPath, err := filepath.Abs(source.Path)
if err != nil {
logger.Fatalf("error getting real path for source %v: %v", source.Path, err)
}
err = checkPathExists(realPath)
if err != nil {
logger.Warningf("error checking path exists: %v", err)
}
realPath := getRealPath(source.Path)
name := filepath.Base(realPath)
if name == "\\" {
name = strings.Split(realPath, ":")[0]
@@ -242,7 +194,6 @@ func setupSources(generate bool) {
}
}
modifyExcludeInclude(source)
setConditionals(source)
if source.Config.DefaultUserScope == "" {
source.Config.DefaultUserScope = "/"
}
@@ -258,12 +209,14 @@ func setupSources(generate bool) {
Config.Server.Sources[0].Config.DefaultEnabled = true
}
for _, sourcePathOnly := range Config.Server.Sources {
absPath := sourcePathOnly.Path
var realPath string
if generate {
// When generating, skip path validation and use the already-set path
absPath = sourcePathOnly.Path
realPath = sourcePathOnly.Path
} else {
realPath = getRealPath(sourcePathOnly.Path)
}
source, ok := Config.Server.SourceMap[absPath]
source, ok := Config.Server.SourceMap[realPath]
if ok && !slices.Contains(allSourceNames, source.Name) {
sourceList = append(sourceList, source)
if source.Config.DefaultEnabled {
@@ -347,7 +300,7 @@ func setupLogging() {
for _, logConfig := range Config.Server.Logging {
// Enable debug logging automatically in dev mode
levels := logConfig.Levels
if Config.Env.IsDevMode {
if os.Getenv("FILEBROWSER_DEVMODE") == "true" {
levels = "info|warning|error|debug"
}
@@ -365,71 +318,69 @@ func setupLogging() {
log.Println("[ERROR] Failed to set up logger:", err)
}
}
Config.Env.IsDevMode = os.Getenv("FILEBROWSER_DEVMODE") == "true"
if Config.Env.IsDevMode {
logger.Warning("Running in dev mode. This is not recommended for production.")
}
}
func loadConfigWithDefaults(configFile string, generate bool) error {
Config = setDefaults(generate)
// Check if config file exists
if _, err := os.Stat(configFile); err != nil {
func loadConfigWithDefaults(configFile string, isGenerate bool) error {
Config = setDefaults(isGenerate)
// Open and read the YAML file
yamlFile, err := os.Open(configFile)
if err != nil {
if configFile != "" {
logger.Errorf("could not open config file '%v', using default settings.", configFile)
}
Config.Server.Sources = []*Source{
{
Path: ".",
Config: SourceConfig{
DefaultEnabled: true,
},
},
}
loadEnvConfig()
return nil
}
defer yamlFile.Close()
// Try multi-file config first (combine all YAML files in the directory)
combinedYAML, err := combineYAMLFiles(configFile)
if err != nil {
return fmt.Errorf("failed to combine YAML files: %v", err)
// Get the directory containing the config file for reference resolution
configDir := filepath.Dir(configFile)
if configDir == "" {
configDir = "."
}
// First pass: Unmarshal into a generic map to resolve all anchors and aliases
// This allows YAML anchors defined in auxiliary files to be properly merged
var rawConfig map[string]interface{}
err = yaml.Unmarshal(combinedYAML, &rawConfig)
if err != nil {
return fmt.Errorf("error parsing YAML data: %v", err)
}
// Create decoder with ReferenceDirs to support multi-config files
// This enables YAML anchors and references to work across multiple files
decoder := yaml.NewDecoder(yamlFile,
yaml.DisallowUnknownField(),
yaml.ReferenceDirs(configDir),
)
// Filter to only keep valid top-level Settings struct fields
// This removes anchor definitions that are just templates (e.g., "test_server: &test_server")
validFields := map[string]bool{
"server": true,
"auth": true,
"integrations": true,
"frontend": true,
"userDefaults": true,
}
filteredConfig := make(map[string]interface{})
for key, value := range rawConfig {
if validFields[key] {
filteredConfig[key] = value
}
}
// Marshal the filtered config back to YAML
filteredYAML, err := yaml.Marshal(filteredConfig)
if err != nil {
return fmt.Errorf("error re-marshaling filtered YAML: %v", err)
}
// Second pass: Decode with strict validation (disallow unknown fields within valid sections)
decoder := yaml.NewDecoder(bytes.NewReader(filteredYAML), yaml.DisallowUnknownField())
err = decoder.Decode(&Config)
if err != nil {
return fmt.Errorf("error unmarshaling YAML data: %v", err)
// Fallback to old method if multi-config parsing fails
logger.Debugf("Multi-config parsing failed, falling back to single file parsing: %v", err)
// Reset file position and try old method
if _, seekErr := yamlFile.Seek(0, 0); seekErr != nil {
return fmt.Errorf("failed to read yaml file: %v", seekErr)
}
stat, statErr := yamlFile.Stat()
if statErr != nil {
return statErr
}
yamlData := make([]byte, stat.Size())
_, readErr := yamlFile.Read(yamlData)
if readErr != nil && configFile != "config.yaml" {
return fmt.Errorf("could not load specified config file: %v", readErr.Error())
}
if readErr != nil {
logger.Warningf("Could not load config file '%v', using default settings: %v", configFile, readErr)
}
// Use simple decoder without ReferenceDirs
fallbackErr := yaml.NewDecoder(strings.NewReader(string(yamlData)), yaml.DisallowUnknownField()).Decode(&Config)
if fallbackErr != nil {
return fmt.Errorf("error unmarshaling YAML data: %v", fallbackErr)
}
}
loadEnvConfig()
@@ -530,14 +481,6 @@ func setDefaults(generate bool) Settings {
database := os.Getenv("FILEBROWSER_DATABASE")
if database == "" {
database = "database.db"
} else {
// check if database file exists
if _, err := os.Stat(database); os.IsNotExist(err) {
database = "database.db"
}
}
if _, err := os.Stat(database); os.IsNotExist(err) {
logger.Warning("database file could not be found. If this is unexpected, the default path is `./database.db`, but it can be configured in the config file under `server.database`.")
}
s := Settings{
Server: Server{
@@ -705,15 +648,11 @@ func GetScopeFromSourcePath(scopes []users.SourceScope, sourcePath string) (stri
// assumes backend style scopes
func GetSources(u *users.User) []string {
sources := []string{}
// preserves order of sources
for _, source := range Config.Server.Sources {
_, err := GetScopeFromSourcePath(u.Scopes, source.Path)
if err != nil {
logger.Warningf("could not get scope for source %v: %v", source.Path, err)
continue
for _, scope := range u.Scopes {
source, ok := Config.Server.SourceMap[scope.Name]
if ok {
sources = append(sources, source.Name)
}
sources = append(sources, source.Name)
}
return sources
}
@@ -766,114 +705,27 @@ func loadCustomFavicon() {
logger.Infof("Successfully validated custom favicon at '%v' (%d bytes, %s)", faviconPath, stat.Size(), ext)
}
// setConditionalsMap builds optimized map structures from conditional rules for O(1) lookups
func setConditionals(config *Source) {
// backwards compatibility
if config.Config.Conditionals.Hidden {
logger.Warning("conditionals.hidden is deprecated, use conditionals.ignoreHidden instead")
config.Config.Conditionals.IgnoreHidden = true
}
rules := config.Config.Conditionals.ItemRules
// Initialize the maps structure (only exact match maps for Names)
resolved := &ResolvedConditionalsConfig{
FileNames: make(map[string]ConditionalIndexConfig),
FolderNames: make(map[string]ConditionalIndexConfig),
FilePaths: make(map[string]ConditionalIndexConfig),
FolderPaths: make(map[string]ConditionalIndexConfig),
FileEndsWith: make([]ConditionalIndexConfig, 0),
FolderEndsWith: make([]ConditionalIndexConfig, 0),
FileStartsWith: make([]ConditionalIndexConfig, 0),
FolderStartsWith: make([]ConditionalIndexConfig, 0),
NeverWatchPaths: make(map[string]struct{}),
IncludeRootItems: make(map[string]struct{}),
}
for _, rule := range rules {
if rule.FileEndsWith != "" {
resolved.FileEndsWith = append(resolved.FileEndsWith, rule)
}
if rule.FolderEndsWith != "" {
resolved.FolderEndsWith = append(resolved.FolderEndsWith, rule)
}
if rule.FileStartsWith != "" {
resolved.FileStartsWith = append(resolved.FileStartsWith, rule)
}
if rule.FolderStartsWith != "" {
resolved.FolderStartsWith = append(resolved.FolderStartsWith, rule)
}
if rule.FilePath != "" {
resolved.FilePaths[rule.FilePath] = rule
}
if rule.FolderPath != "" {
resolved.FolderPaths[rule.FolderPath] = rule
}
if rule.NeverWatchPath != "" {
resolved.NeverWatchPaths[rule.NeverWatchPath] = struct{}{}
}
if rule.IncludeRootItem != "" {
resolved.IncludeRootItems[rule.IncludeRootItem] = struct{}{}
}
if rule.FileNames != "" {
resolved.FileNames[rule.FileNames] = rule
}
if rule.FolderNames != "" {
resolved.FolderNames[rule.FolderNames] = rule
}
if rule.FileName != "" {
resolved.FileNames[rule.FileName] = rule
}
if rule.FolderName != "" {
resolved.FolderNames[rule.FolderName] = rule
}
}
config.Config.ResolvedConditionals = resolved
}
func modifyExcludeInclude(config *Source) {
// Helper to normalize a full path value (FilePaths, FolderPaths)
// These always start with "/" and match against full index paths
normalizeFullPath := func(value string, checkExists bool) string {
if value == "" {
return ""
}
normalized := "/" + strings.Trim(value, "/")
// check if file/folder exists
if checkExists {
realPath, err := filepath.Abs(config.Path + normalized)
if err != nil {
logger.Warningf("could not get absolute path for %v: %v", normalized, err)
return normalized
}
if _, err := os.Stat(realPath); os.IsNotExist(err) {
logger.Warningf("configured exclude/include path %v does not exist", realPath)
normalize := func(s []string, checkExists bool) {
for i, v := range s {
s[i] = "/" + strings.Trim(v, "/")
// check if file/folder exists
if checkExists {
realPath, err := filepath.Abs(config.Path + s[i])
if err != nil {
logger.Warningf("could not get absolute path for %v: %v", s[i], err)
continue
}
if _, err := os.Stat(realPath); os.IsNotExist(err) {
logger.Warningf("configured exclude/include path %v does not exist", realPath)
}
}
}
return normalized
}
// Helper to normalize a name-based value (FileNames, FolderNames, StartsWith, EndsWith)
// These match against baseName, so no leading slash
normalizeName := func(value string) string {
// Just trim slashes - names shouldn't have slashes
return strings.Trim(value, "/")
}
// Normalize []ConditionalIndexConfig slices for full paths
for i, rule := range config.Config.Conditionals.ItemRules {
// normalize full paths
config.Config.Conditionals.ItemRules[i].FilePath = normalizeFullPath(rule.FilePath, true)
config.Config.Conditionals.ItemRules[i].FolderPath = normalizeFullPath(rule.FolderPath, true)
config.Config.Conditionals.ItemRules[i].NeverWatchPath = normalizeFullPath(rule.NeverWatchPath, true)
config.Config.Conditionals.ItemRules[i].IncludeRootItem = normalizeFullPath(rule.IncludeRootItem, true)
// normalize names
config.Config.Conditionals.ItemRules[i].FileNames = normalizeName(rule.FileNames)
config.Config.Conditionals.ItemRules[i].FolderNames = normalizeName(rule.FolderNames)
config.Config.Conditionals.ItemRules[i].FileName = normalizeName(rule.FileName)
config.Config.Conditionals.ItemRules[i].FolderName = normalizeName(rule.FolderName)
}
normalize(config.Config.Exclude.FolderPaths, true)
normalize(config.Config.Exclude.FilePaths, true)
normalize(config.Config.Include.RootFolders, true)
normalize(config.Config.Include.RootFiles, true)
normalize(config.Config.NeverWatchPaths, true)
}
+6 -54
View File
@@ -2,7 +2,6 @@ package settings
import (
"os"
"path/filepath"
"reflect"
"testing"
@@ -43,19 +42,8 @@ func Test_setDefaults(t *testing.T) {
}
func TestConfigLoadChanged(t *testing.T) {
// Create isolated test directory
testDir := t.TempDir()
validContent, err := os.ReadFile("./validConfig.yaml")
if err != nil {
t.Fatalf("failed to read validConfig.yaml: %v", err)
}
configFile := filepath.Join(testDir, "config.yaml")
if err = os.WriteFile(configFile, validContent, 0644); err != nil {
t.Fatalf("failed to write test config: %v", err)
}
defaultConfig := setDefaults(true)
err = loadConfigWithDefaults(configFile, true)
err := loadConfigWithDefaults("./validConfig.yaml", true)
if err != nil {
t.Fatalf("error loading config file: %v", err)
}
@@ -66,22 +54,11 @@ func TestConfigLoadChanged(t *testing.T) {
}
func TestConfigLoadEnvVars(t *testing.T) {
// Create isolated test directory
testDir := t.TempDir()
validContent, err := os.ReadFile("./validConfig.yaml")
if err != nil {
t.Fatalf("failed to read validConfig.yaml: %v", err)
}
configFile := filepath.Join(testDir, "config.yaml")
if err = os.WriteFile(configFile, validContent, 0644); err != nil {
t.Fatalf("failed to write test config: %v", err)
}
defaultConfig := setDefaults(true)
expectedKey := "MYKEY"
// mock environment variables
os.Setenv("FILEBROWSER_ONLYOFFICE_SECRET", expectedKey)
err = loadConfigWithDefaults(configFile, true)
err := loadConfigWithDefaults("./validConfig.yaml", true)
if err != nil {
t.Fatalf("error loading config file: %v", err)
}
@@ -95,19 +72,8 @@ func TestConfigLoadEnvVars(t *testing.T) {
}
func TestConfigLoadSpecificValues(t *testing.T) {
// Create isolated test directory
testDir := t.TempDir()
validContent, err := os.ReadFile("./validConfig.yaml")
if err != nil {
t.Fatalf("failed to read validConfig.yaml: %v", err)
}
configFile := filepath.Join(testDir, "config.yaml")
if err = os.WriteFile(configFile, validContent, 0644); err != nil {
t.Fatalf("failed to write test config: %v", err)
}
defaultConfig := setDefaults(true)
err = loadConfigWithDefaults(configFile, true)
err := loadConfigWithDefaults("./validConfig.yaml", true)
if err != nil {
t.Fatalf("error loading config file: %v", err)
}
@@ -127,23 +93,9 @@ func TestConfigLoadSpecificValues(t *testing.T) {
}
func TestInvalidConfig(t *testing.T) {
// Create isolated test directory
testDir := t.TempDir()
invalidContent, err := os.ReadFile("./invalidConfig.yaml")
if err != nil {
t.Fatalf("failed to read invalidConfig.yaml: %v", err)
}
configFile := filepath.Join(testDir, "config.yaml")
if err = os.WriteFile(configFile, invalidContent, 0644); err != nil {
t.Fatalf("failed to write test config: %v", err)
}
err = loadConfigWithDefaults(configFile, true)
// Config loads successfully but validation should catch missing sources
configFile := "./invalidConfig.yaml"
err := loadConfigWithDefaults(configFile, true)
if err == nil {
err = ValidateConfig(Config)
if err == nil {
t.Fatal("expected validation error for config with missing required sources, got nil")
}
t.Fatalf("expected error loading config file %s, got nil", configFile)
}
}
+1 -10
View File
@@ -577,8 +577,7 @@ func buildNodeWithDefaults(v reflect.Value, comm CommentsMap, defaults reflect.V
// Check if this field should be redacted as a secret
var valNode *yaml.Node
var err error
generateConfig := os.Getenv("FILEBROWSER_GENERATE_CONFIG") == "true"
if secrets[typeName][sf.Name] && !generateConfig {
if secrets[typeName][sf.Name] {
// Check if the secret value is empty
fieldValue := currentField.Interface()
if str, ok := fieldValue.(string); ok && str == "" {
@@ -706,13 +705,6 @@ func GenerateYaml() {
Config.Server.Sources = []*Source{
{
Path: ".",
Config: SourceConfig{
Conditionals: ConditionalFilter{
ItemRules: []ConditionalIndexConfig{
{}, // Add empty sample rule to show all fields in generated YAML
},
},
},
},
}
@@ -727,7 +719,6 @@ func GenerateYaml() {
setupSources(true)
setupUrls()
setupVideoPreview()
setupFrontend(true)
// Restore original paths so the YAML output has the correct paths, not the placeholder
+5 -10
View File
@@ -29,8 +29,7 @@ simple_auth: &simple_auth
enabled: true
minLength: 8
`
// Use pattern-based naming: main config is "config.yaml", so anchors must be "*-config.yaml"
anchorsPath := filepath.Join(testDir, "definitions-config.yaml")
anchorsPath := filepath.Join(testDir, "anchors.yaml")
if err := os.WriteFile(anchorsPath, []byte(anchorsConfig), 0644); err != nil {
t.Fatalf("Failed to write anchors config: %v", err)
}
@@ -62,8 +61,7 @@ userDefaults:
}
// Test loading the multi-config setup
// Use generate=true to skip filesystem validation of fake paths
err := loadConfigWithDefaults(mainPath, true)
err := loadConfigWithDefaults(mainPath, false)
if err != nil {
t.Fatalf("Failed to load multi-config: %v", err)
}
@@ -130,8 +128,7 @@ frontend:
}
// Test that fallback works for simple configs
// Use generate=true to skip filesystem validation
err := loadConfigWithDefaults(configPath, true)
err := loadConfigWithDefaults(configPath, false)
if err != nil {
t.Fatalf("Failed to load simple config: %v", err)
}
@@ -166,8 +163,7 @@ base_permissions: &base_permissions
admin: false
api: false
`
// Use pattern-based naming: main config is "config.yaml", so anchors must be "*-config.yaml"
anchorsPath := filepath.Join(testDir, "definitions-config.yaml")
anchorsPath := filepath.Join(testDir, "anchors.yaml")
if err := os.WriteFile(anchorsPath, []byte(anchorsConfig), 0644); err != nil {
t.Fatalf("Failed to write anchors config: %v", err)
}
@@ -198,8 +194,7 @@ frontend:
}
// Test loading the nested reference setup
// Use generate=true to skip filesystem validation
err := loadConfigWithDefaults(mainPath, true)
err := loadConfigWithDefaults(mainPath, false)
if err != nil {
t.Fatalf("Failed to load nested config: %v", err)
}
+36 -71
View File
@@ -13,7 +13,6 @@ const (
)
type Settings struct {
Env Env `json:"-"`
Server Server `json:"server"`
Auth Auth `json:"auth"`
Frontend Frontend `json:"frontend"`
@@ -21,14 +20,6 @@ type Settings struct {
Integrations Integrations `json:"integrations"`
}
type Env struct {
IsPlaywright bool `json:"-"`
IsDevMode bool `json:"-"`
IsFirstLoad bool `json:"-"` // used internally to track if this is the first load of the application
MuPdfAvailable bool `json:"-"` // used internally if compiled with mupdf support
EmbeddedFs bool `json:"-"` // used internally if compiled with embedded fs support
}
type Server struct {
MinSearchLength int `json:"minSearchLength" yaml:"minSearchLength"` // minimum length of search query to begin searching (default: 3)
DisableUpdateCheck bool `json:"disableUpdateCheck"` // disables backend update check service
@@ -50,8 +41,10 @@ type Server struct {
MaxArchiveSizeGB int64 `json:"maxArchiveSize"` // max pre-archive combined size of files/folder that are allowed to be archived (in GB)
Filesystem Filesystem `json:"filesystem"` // filesystem settings
// not exposed to config
SourceMap map[string]*Source `json:"-" validate:"omitempty"` // uses realpath as key
NameToSource map[string]*Source `json:"-" validate:"omitempty"` // uses name as key
SourceMap map[string]*Source `json:"-" validate:"omitempty"` // uses realpath as key
NameToSource map[string]*Source `json:"-" validate:"omitempty"` // uses name as key
MuPdfAvailable bool `json:"-"` // used internally if compiled with mupdf support
EmbeddedFs bool `json:"-"` // used internally if compiled with embedded fs support
}
type Filesystem struct {
@@ -167,63 +160,37 @@ 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.
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"` // optional manual overide interval in minutes to re-index the source
DisableIndexing bool `json:"disableIndexing,omitempty"` // disable the indexing of this source
Conditionals ConditionalFilter `json:"conditionals"` // conditional rules to apply when indexing to include/exclude certain items
DefaultUserScope string `json:"defaultUserScope"` // default "/" should match folders under path
DefaultEnabled bool `json:"defaultEnabled"` // should be added as a default source for new users?
CreateUserDir bool `json:"createUserDir"` // create a user directory for each user
// hidden but used internally - optimized map lookups for conditional rules
ResolvedConditionals *ResolvedConditionalsConfig `json:"-"`
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.
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"` // optional manual overide interval in minutes to re-index the source
DisableIndexing bool `json:"disableIndexing,omitempty"` // disable the indexing of this source
MaxWatchers int `json:"maxWatchers"` // number of concurrent watchers to use for this source, currently not supported
NeverWatchPaths []string `json:"neverWatchPaths"` // paths that get initially once. Useful for folders that rarely change contents (without source path prefix)
Exclude ExcludeIndexFilter `json:"exclude"` // exclude files and folders from indexing, if include is not set
Include IncludeIndexFilter `json:"include"` // include files and folders from indexing, if exclude is not set
DefaultUserScope string `json:"defaultUserScope"` // default "/" should match folders under path
DefaultEnabled bool `json:"defaultEnabled"` // should be added as a default source for new users?
CreateUserDir bool `json:"createUserDir"` // create a user directory for each user
IndexAlbumArt bool `json:"indexAlbumArt"` // deprecated: always enabled since 0.8.6
}
type ConditionalFilter struct {
Hidden bool `json:"hidden"` // deprecated: use ignoreHidden instead to exclude hidden files and folders.
IgnoreHidden bool `json:"ignoreHidden"` // exclude hidden files and folders.
ZeroSizeFolders bool `json:"ignoreZeroSizeFolders"` // ignore folders with 0 size
ItemRules []ConditionalIndexConfig `json:"rules"` // list of item rules to apply to specific paths
type IncludeIndexFilter struct {
RootFolders []string `json:"rootFolders"` // list of root folders to include, relative to the source path (eg. "folder1")
RootFiles []string `json:"rootFiles"` // list of root files to include, relative to the source path (eg. "file1.txt")
}
type ConditionalIndexConfig struct {
NeverWatchPath string `json:"neverWatchPath"` // index the folder in the first pass to get included in search, but never re-indexed.
IncludeRootItem string `json:"includeRootItem"` // include only these items at root folder level
FileStartsWith string `json:"fileStartsWith"` // (global) exclude files that start with these prefixes. Eg. "archive-" or "backup-"
FolderStartsWith string `json:"folderStartsWith"` // (global) exclude folders that start with these prefixes. Eg. "archive-" or "backup-"
FileEndsWith string `json:"fileEndsWith"` // (global) exclude files that end with these suffixes. Eg. ".jpg" or ".txt"
FolderEndsWith string `json:"folderEndsWith"` // (global) exclude folders that end with these suffixes. Eg. ".thumbnails" or ".git"
FolderPath string `json:"folderPath"` // (global) exclude folders that match this path. Eg. "/path/to/folder" or "/path/to/folder/subfolder"
FilePath string `json:"filePath"` // (global) exclude files that match this path. Eg. "/path/to/file.txt" or "/path/to/file.txt/subfile.txt"
FileNames string `json:"fileNames"` // deprecated: exclude files that match these names. Eg. "file.txt" or "test.csv"
FolderNames string `json:"folderNames"` // deprecated: exclude folders that match these names. Eg. "folder" or "subfolder"
FileName string `json:"fileName"` // (global) exclude files that match these names. Eg. "file.txt" or "test.csv"
FolderName string `json:"folderName"` // (global) exclude folders that match these names. Eg. "folder" or "subfolder"
Viewable bool `json:"viewable"` // Enable viewing in UI but exclude from indexing
}
// ConditionalMaps provides O(1) lookup performance for conditional rules
// Maps are built from ConditionalFilter during initialization
type ResolvedConditionalsConfig struct {
// Exact match maps - O(1) lookup (only for names, not StartsWith/EndsWith)
FileNames map[string]ConditionalIndexConfig // key: file name
FolderNames map[string]ConditionalIndexConfig // key: folder name
// exact match for paths
FilePaths map[string]ConditionalIndexConfig // key: file path
FolderPaths map[string]ConditionalIndexConfig // key: folder path
FileEndsWith []ConditionalIndexConfig // list of item rules that have been resolved for specific paths
FolderEndsWith []ConditionalIndexConfig // list of item rules that have been resolved for specific paths
FileStartsWith []ConditionalIndexConfig // list of item rules that have been resolved for specific paths
FolderStartsWith []ConditionalIndexConfig // list of item rules that have been resolved for specific paths
// NeverWatch paths map - O(1) lookup for all paths with neverWatch: true
// This replaces the old NeverWatchPaths slice
NeverWatchPaths map[string]struct{} // key: full folder path
IncludeRootItems map[string]struct{} // key: inclusive root item
type ExcludeIndexFilter struct {
Hidden bool `json:"hidden"` // exclude hidden files and folders.
ZeroSizeFolders bool `json:"ignoreZeroSizeFolders"` // ignore folders with 0 size
FilePaths []string `json:"filePaths"` // list of filepaths Eg. "folder1" or "file1.txt" or "folder1/file1.txt" (without source path prefix)
FolderPaths []string `json:"folderPaths"` // (filepath) list of folder names to include/exclude. Eg. "folder1" or "folder1/subfolder" (do not include source path, just the subpaths from the source path)
FileNames []string `json:"fileNames"` // (global) list of file names to include/exclude. Eg. "a.jpg"
FolderNames []string `json:"folderNames"` // (global) list of folder names to include/exclude. Eg. "@eadir" or ".thumbnails"
FileEndsWith []string `json:"fileEndsWith"` // (global) exclude files that end with these suffixes. Eg. ".jpg" or ".txt"
FolderEndsWith []string `json:"folderEndsWith"` // (global) exclude folders that end with these suffixes. Eg. ".thumbnails" or ".git"
FileStartsWith []string `json:"fileStartsWith"` // (global) exclude files that start with these prefixes. Eg. "archive-" or "backup-"
FolderStartsWith []string `json:"folderStartsWith"` // (global) exclude folders that start with these prefixes. Eg. "archive-" or "backup-"
}
type Frontend struct {
@@ -235,16 +202,14 @@ type Frontend struct {
Styling StylingConfig `json:"styling"`
Favicon string `json:"favicon"` // path to a favicon to use for the frontend
Description string `json:"description"` // description that shows up in html head meta description
LoginIcon string `json:"loginIcon"` // path to an image file for the login page icon
}
type StylingConfig struct {
DisableEventBasedThemes bool `json:"disableEventThemes"` // disable the event based themes,
CustomCSS string `json:"customCSS"` // if a valid path to a css file is provided, it will be applied for all users. (eg. "reduce-rounded-corners.css")
CustomCSSRaw string `json:"-"` // The css raw content to use for the custom css.
LightBackground string `json:"lightBackground"` // specify a valid CSS color property value to use as the background color in light mode
DarkBackground string `json:"darkBackground"` // Specify a valid CSS color property value to use as the background color in dark mode
CustomThemes map[string]CustomTheme `json:"customThemes"` // A list of custom css files that each user can select to override the default styling. if "default" is key name then it will be the default option.
CustomCSS string `json:"customCSS"` // if a valid path to a css file is provided, it will be applied for all users. (eg. "reduce-rounded-corners.css")
CustomCSSRaw string `json:"-"` // The css raw content to use for the custom css.
LightBackground string `json:"lightBackground"` // specify a valid CSS color property value to use as the background color in light mode
DarkBackground string `json:"darkBackground"` // Specify a valid CSS color property value to use as the background color in dark mode
CustomThemes map[string]CustomTheme `json:"customThemes"` // A list of custom css files that each user can select to override the default styling. if "default" is key name then it will be the default option.
// In-memory (not exposed to config)
CustomThemeOptions map[string]CustomTheme `json:"-"` // not exposed
}
+11 -18
View File
@@ -1,8 +1,6 @@
package settings
import (
"errors"
"fmt"
"os"
"regexp"
"strings"
@@ -85,36 +83,31 @@ func addCustomTheme(name, description, cssFilePath string) {
// Load CSS content for runtime use (frontend consumption)
cssContent := ""
if cssFilePath != "" {
var err error
cssContent, err = readCustomCSS(cssFilePath)
if err != nil {
logger.Warning(err.Error())
return
}
cssContent = readCustomCSS(cssFilePath)
}
Config.Frontend.Styling.CustomThemeOptions[name] = CustomTheme{
Description: description,
CSS: cssFilePath,
CssRaw: cssContent, // Store loaded content
}
logger.Debugf("Added custom theme: %s", name)
}
func readCustomCSS(path string) (string, error) {
func readCustomCSS(path string) string {
if path == "" {
return "", errors.New("path is empty")
return ""
}
content, err := os.ReadFile(path)
if err != nil {
return "", fmt.Errorf("could not read custom CSS file: %v", err)
// Only log if the file exists but cannot be read (e.g., permission error)
if !os.IsNotExist(err) {
logger.Warningf("Could not read custom CSS file %s: %v", path, err)
return ""
}
}
if len(content) > 128*1024 {
return "", fmt.Errorf("custom CSS file is too large (%d bytes)", len(content))
}
if len(content) == 0 {
return "", fmt.Errorf("custom CSS file is empty: %s", path)
logger.Warningf("Custom CSS file %s is too large (%d bytes), ignoring", path, len(content))
return ""
}
logger.Debugf("Loaded custom CSS from: %s (%d bytes)", path, len(content))
return string(content), nil
return string(content)
}
-111
View File
@@ -1,111 +0,0 @@
package settings
import (
"fmt"
"os"
"path/filepath"
"sort"
"strings"
)
// combineYAMLFiles combines multiple YAML files from a directory into a single YAML document
// This allows YAML anchors defined in one file to be referenced in another
//
// Pattern matching: If main config is "config.yaml", only files matching "*-config.yaml" are merged
// Examples:
// - config.yaml + server-config.yaml + auth-config.yaml
// - test.yaml + database-test.yaml + frontend-test.yaml
// - myapp.yml + server-myapp.yml
func combineYAMLFiles(configFilePath string) ([]byte, error) {
// Get absolute path and expand tilde
expandedPath := configFilePath
if strings.HasPrefix(configFilePath, "~/") {
homeDir, err := os.UserHomeDir()
if err != nil {
return nil, fmt.Errorf("failed to expand home directory: %v", err)
}
expandedPath = filepath.Join(homeDir, configFilePath[2:])
}
absPath, err := filepath.Abs(expandedPath)
if err != nil {
return nil, fmt.Errorf("failed to resolve config file path: %v", err)
}
configDir := filepath.Dir(absPath)
configFileName := filepath.Base(absPath)
// Extract base name pattern for matching related config files
// e.g., "config.yaml" -> match "*-config.yaml"
// "test.yml" -> match "*-test.yml"
ext := filepath.Ext(configFileName)
baseName := strings.TrimSuffix(configFileName, ext)
pattern := "-" + baseName + ext
// Find all YAML files in the directory that match the pattern
entries, err := os.ReadDir(configDir)
if err != nil {
return nil, fmt.Errorf("failed to read config directory: %v", err)
}
var yamlFiles []string
var mainConfigContent []byte
for _, entry := range entries {
if entry.IsDir() {
continue
}
name := entry.Name()
// Skip hidden files (dotfiles like .goreleaser.yaml)
if strings.HasPrefix(name, ".") {
continue
}
fileExt := strings.ToLower(filepath.Ext(name))
// Only process .yaml and .yml files
if fileExt != ".yaml" && fileExt != ".yml" {
continue
}
fullPath := filepath.Join(configDir, name)
// Keep track of the main config file to process it last
if name == configFileName {
content, err := os.ReadFile(fullPath)
if err != nil {
return nil, fmt.Errorf("failed to read main config file: %v", err)
}
mainConfigContent = content
} else if strings.HasSuffix(name, pattern) {
// Only include files that match the pattern (e.g., *-config.yaml)
yamlFiles = append(yamlFiles, fullPath)
}
}
// Sort the auxiliary files for consistent ordering
sort.Strings(yamlFiles)
// Combine all YAML files as raw text into a single document
// We do NOT use `---` separators because anchors don't work across document boundaries
var combined strings.Builder
// First, add all auxiliary YAML files (these typically contain anchor definitions)
for _, file := range yamlFiles {
content, err := os.ReadFile(file)
if err != nil {
return nil, fmt.Errorf("failed to read YAML file %s: %v", file, err)
}
combined.Write(content)
combined.WriteString("\n") // Add newline between files
}
// Finally, add the main config file (this typically contains the references)
if mainConfigContent != nil {
combined.Write(mainConfigContent)
}
return []byte(combined.String()), nil
}
+3 -7
View File
@@ -7,7 +7,6 @@ import (
"strings"
"time"
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
"github.com/gtsteffaniak/filebrowser/backend/common/version"
"github.com/gtsteffaniak/go-logger/logger"
"golang.org/x/mod/semver"
@@ -31,9 +30,6 @@ func CheckForUpdates() (updateInfo, error) {
repoOwner := "gtsteffaniak"
repoName := "filebrowser"
currentVersion := version.Version
if currentVersion == "untracked" || currentVersion == "testing" || currentVersion == "" || settings.Config.Env.IsDevMode {
return updateInfo{}, nil
}
splitVersion := strings.Split(currentVersion, "-")
versionCategory := "stable"
if len(splitVersion) > 1 {
@@ -55,13 +51,13 @@ func CheckForUpdates() (updateInfo, error) {
if err := json.NewDecoder(resp.Body).Decode(&tags); err != nil {
return updateInfo{}, err
}
// Find the latest version greater than the current one that matches the version category
// Find the latest beta version greater than the current one
var NewVersion string
for _, tag := range tags {
// Check if the version is valid and the prerelease contains the version category
// Check if the version is valid, is a pre-release, and contains "beta"
if semver.IsValid(tag.Name) && strings.Contains(semver.Prerelease(tag.Name), versionCategory) {
// Check if this tag is greater than the current version
// and also greater than any other version we've found so far
// and also greater than any other beta version we've found so far
if semver.Compare(tag.Name, currentVersion) > 0 {
if NewVersion == "" || semver.Compare(tag.Name, NewVersion) > 0 {
NewVersion = tag.Name
+1
View File
@@ -48,6 +48,7 @@ type FileOptions struct {
Path string // realpath
Source string
IsDir bool
Modify bool
Expand bool
ReadHeader bool
Content bool
+12 -40
View File
@@ -6,45 +6,17 @@ server:
sources:
- path: "/srv"
userDefaults:
editorQuickSave: false # show quick save button in editor
hideSidebarFileActions: false # hide the file actions in the sidebar
disableQuickToggles: false # disable the quick toggles in the sidebar
disableSearchOptions: false # disable the search options in the search bar
stickySidebar: true # keep sidebar open when navigating
darkMode: true # should dark mode be enabled
viewMode: "normal" # view mode to use: eg. normal, list, grid, or compact
singleClick: false # open directory on single click, also enables middle click to open in new tab
showHidden: false # show hidden files in the UI. On windows this includes files starting with a dot and windows hidden files
dateFormat: false # when false, the date is relative, when true, the date is an exact timestamp
gallerySize: 3 # 0-9 - the size of the gallery thumbnails
themeColor: "var(--blue)" # theme color to use: eg. #ff0000, or var(--red), var(--purple), etc
quickDownload: false # show icon to download in one click
disablePreviewExt: "" # space separated list of file extensions to disable preview for
disableViewingExt: "" # space separated list of file extensions to disable viewing for
lockPassword: false # disable the user from changing their password
disableSettings: false # disable the user from viewing the settings page
preview:
disableHideSidebar: true # disable the hide sidebar preview for previews and editors
highQuality: true # generate high quality thumbnail preview images
image: true # show thumbnail preview image for image files
video: true # show thumbnail preview image for video files
motionVideoPreview: true # show multiple frames for videos in thumbnail preview when hovering
office: true # show thumbnail preview image for office files
popup: true # show larger popup preview when hovering over thumbnail
autoplayMedia: true # autoplay media files in preview
defaultMediaPlayer: true # disable html5 media player and use the default media player
folder: true # show thumbnail preview image for folder files
image: true
popup: true
video: false
office: false
highQuality: false
darkMode: true
disableSettings: false
singleClick: false
permissions:
api: false # allow api access
admin: false # allow admin access
modify: false # allow modifying files
share: false # allow sharing files
realtime: false # allow realtime updates
delete: false # allow deleting files
create: false # allow creating or uploading files
download: true # allow downloading files
disableUpdateNotifications: false # disable update notifications banner for admin users
deleteWithoutConfirming: false # delete files without confirmation
disableOnlyOfficeExt: ".md .txt .pdf" # list of file extensions to disable onlyoffice editor for
showSelectMultiple: false # show select multiple files on desktop
defaultLandingPage: "" # default landing page to use if no redirect is specified: eg. /files/mysource/mysubpath, /settings, etc.
admin: false
modify: false
share: false
api: false
+2 -6
View File
@@ -26,16 +26,12 @@ func (s *Storage) CheckChildItemAccess(response *iteminfo.ExtendedFileInfo, inde
return errors.ErrAccessDenied
}
// Save original folders and files before filtering
originalFolders := response.Folders
originalFiles := response.Files
// Filter and return only the items the user has access to
response.Folders = make([]iteminfo.ItemInfo, 0)
response.Files = make([]iteminfo.ItemInfo, 0)
// Check each subfolder for access permissions
for _, folder := range originalFolders {
for _, folder := range response.Folders {
indexPath := parentPath + folder.Name
if s.Permitted(index.Path, indexPath, username) {
response.Folders = append(response.Folders, folder)
@@ -43,7 +39,7 @@ func (s *Storage) CheckChildItemAccess(response *iteminfo.ExtendedFileInfo, inde
}
// Check each subfile for access permissions
for _, file := range originalFiles {
for _, file := range response.Files {
indexPath := parentPath + file.Name
if s.Permitted(index.Path, indexPath, username) {
response.Files = append(response.Files, file)
-11
View File
@@ -1,11 +1,8 @@
package share
import (
"fmt"
"os"
"path/filepath"
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
)
// IsSingleFileShare determines if this share is for a single file (not a directory).
@@ -143,11 +140,3 @@ func (l *Link) HasReachedUserLimit(username string) bool {
count := l.GetUserDownloadCount(username)
return count >= l.DownloadsLimit
}
func (l *Link) GetSourceName() (string, error) {
sourceInfo, ok := settings.Config.Server.SourceMap[l.Source]
if !ok {
return "", fmt.Errorf("source not found")
}
return sourceInfo.Name, nil
}
+11 -15
View File
@@ -3,6 +3,9 @@ package share
import "sync"
type CommonShare struct {
//AllowEdit bool `json:"allowEdit,omitempty"`
AllowUpload bool `json:"allowUpload,omitempty"`
DisableFileViewer bool `json:"disableFileViewer,omitempty"`
DownloadsLimit int `json:"downloadsLimit,omitempty"`
ShareTheme string `json:"shareTheme,omitempty"`
DisableAnonymous bool `json:"disableAnonymous,omitempty"`
@@ -25,15 +28,10 @@ type CommonShare struct {
EnforceDarkLightMode string `json:"enforceDarkLightMode,omitempty"` // "dark" or "light"
ViewMode string `json:"viewMode,omitempty"` // default view mode for anonymous users: "list", "compact", "normal", "gallery"
EnableOnlyOffice bool `json:"enableOnlyOffice,omitempty"`
EnableOnlyOfficeEditing bool `json:"enableOnlyOfficeEditing,omitempty"`
ShareType string `json:"shareType"` // type of share: normal, upload, max
PerUserDownloadLimit bool `json:"perUserDownloadLimit,omitempty"`
ExtractEmbeddedSubtitles bool `json:"extractEmbeddedSubtitles,omitempty"` // can be io intensive for large files and take 10-30 seconds.
AllowDelete bool `json:"allowDelete,omitempty"`
AllowCreate bool `json:"allowCreate,omitempty"` // allow creating files
AllowModify bool `json:"allowModify,omitempty"` // allow modifying files
DisableFileViewer bool `json:"disableFileViewer,omitempty"` // don't allow viewing files
DisableDownload bool `json:"disableDownload,omitempty"` // don't allow downloading files
AllowReplacements bool `json:"allowReplacements,omitempty"` // allow replacements of files
}
type CreateBody struct {
CommonShare
@@ -46,17 +44,15 @@ type CreateBody struct {
// Link is the information needed to build a shareable link.
type Link struct {
CommonShare
Downloads int `json:"downloads"`
Hash string `json:"hash" storm:"id,index"`
UserID uint `json:"userID"`
Expire int64 `json:"expire"`
PasswordHash string `json:"password_hash,omitempty"`
Mu sync.Mutex `json:"-"`
Downloads int `json:"downloads"`
UserDownloads map[string]int `json:"-"` // Track downloads per username (not persisted)
Hash string `json:"hash" storm:"id,index"`
UserID uint `json:"userID"`
Expire int64 `json:"expire"`
PasswordHash string `json:"password_hash,omitempty"`
// Token is a random value that will only be set when PasswordHash is set. It is
// URL-Safe and is used to download links in password-protected shares via a
// query arg.
Token string `json:"token,omitempty"`
Mu sync.Mutex `json:"-"`
UserDownloads map[string]int `json:"-"` // Track downloads per username (not persisted)
}
+1 -5
View File
@@ -84,14 +84,10 @@ func (st usersBackend) Update(user *users.User, actorIsAdmin bool, fields ...str
return err
}
if user.LoginMethod == "" {
user.LoginMethod = existingUser.LoginMethod
}
if !slices.Contains(fields, "Password") {
user.Password = existingUser.Password
} else {
if existingUser.LockPassword && !actorIsAdmin {
if existingUser.LockPassword {
return fmt.Errorf("password cannot be changed when lock password is enabled")
}
}
+1 -10
View File
@@ -42,11 +42,6 @@ func InitializeDb(path string) (*bolt.BoltStore, bool, error) {
return nil, exists, err
}
if !exists {
if settings.Config.Env.IsPlaywright || settings.Config.Env.IsDevMode {
settings.Config.Env.IsFirstLoad = false
} else {
settings.Config.Env.IsFirstLoad = true
}
quickSetup(store)
}
@@ -99,7 +94,6 @@ func quickSetup(store *bolt.BoltStore) {
}
user.LockPassword = false
user.Permissions = settings.AdminPerms()
user.ShowFirstLogin = settings.Config.Env.IsFirstLoad && user.Permissions.Admin
logger.Debugf("Creating user as admin: %v %v", user.Username, user.Password)
err = store.Users.Save(user, true, true)
utils.CheckErr("store.Users.Save", err)
@@ -107,9 +101,8 @@ func quickSetup(store *bolt.BoltStore) {
}
// create new user
func CreateUser(userInfo users.User, permissions users.Permissions) error {
func CreateUser(userInfo users.User) error {
newUser := &userInfo
newUser.ShowFirstLogin = settings.Config.Env.IsFirstLoad && newUser.Permissions.Admin
if userInfo.LoginMethod == "password" {
if userInfo.Password == "" {
return fmt.Errorf("password is required to create a password login user")
@@ -125,8 +118,6 @@ func CreateUser(userInfo users.User, permissions users.Permissions) error {
if userInfo.Username == "" {
return fmt.Errorf("username is required to create a user")
}
settings.ApplyUserDefaults(newUser)
newUser.Permissions = permissions
logger.Debugf("Creating user: %v %v", userInfo.Username, userInfo.Scopes)
// create new home directories
err := userStore.Save(newUser, true, false)
+6 -11
View File
@@ -27,14 +27,11 @@ type AuthToken struct {
}
type Permissions struct {
Api bool `json:"api"` // allow api access
Admin bool `json:"admin"` // allow admin access
Modify bool `json:"modify"` // allow modifying files
Share bool `json:"share"` // allow sharing files
Realtime bool `json:"realtime"` // allow realtime updates
Delete bool `json:"delete"` // allow deleting files
Create bool `json:"create"` // allow creating or uploading files
Download bool `json:"download"` // allow downloading files
Api bool `json:"api"`
Admin bool `json:"admin"`
Modify bool `json:"modify"`
Share bool `json:"share"`
Realtime bool `json:"realtime"`
}
// SortingSettings represents the sorting settings.
@@ -72,9 +69,7 @@ type User struct {
LoginMethod LoginMethod `json:"loginMethod"`
OtpEnabled bool `json:"otpEnabled"` // true if TOTP is enabled, false otherwise
// legacy for migration purposes... og filebrowser has perm attribute
Perm Permissions `json:"perm,omitzero"`
Version int `json:"version"`
ShowFirstLogin bool `json:"showFirstLogin"`
Perm Permissions `json:"perm,omitzero"`
}
type SourceScope struct {
+3 -1
View File
@@ -235,7 +235,9 @@ func (s *ImageService) ConvertHEICToJPEG(ctx context.Context, heicPath string, t
return nil, ctx.Err()
}
// Create temporary directory for tile processing
tempDir, err := os.MkdirTemp(s.cacheDir, "heic_convert")
outputDir := s.cacheDir
tempDir := filepath.Join(outputDir, fmt.Sprintf("heic_tiles_%d", os.Getpid()))
err := os.MkdirAll(tempDir, fileutils.PermDir)
if err != nil {
return nil, fmt.Errorf("failed to create temp directory: %w", err)
}
+48 -42
View File
@@ -4,28 +4,28 @@ go 1.25.0
require (
github.com/asdine/storm/v3 v3.2.1
github.com/coreos/go-oidc/v3 v3.16.0
github.com/coreos/go-oidc/v3 v3.15.0
github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8
github.com/dsoprea/go-exif/v3 v3.0.1
github.com/gen2brain/go-fitz v1.24.15
github.com/go-playground/validator/v10 v10.28.0
github.com/go-playground/validator/v10 v10.27.0
github.com/goccy/go-yaml v1.18.0
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/google/go-cmp v0.7.0
github.com/gtsteffaniak/go-cache v1.0.0
github.com/gtsteffaniak/go-logger v0.2.3
github.com/kovidgoyal/imaging v1.7.2
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926212932-e91a612f674c
github.com/kovidgoyal/imaging v1.6.4
github.com/pquerna/otp v1.5.0
github.com/spf13/afero v1.15.0
github.com/stretchr/testify v1.11.1
github.com/swaggo/http-swagger v1.3.4
github.com/swaggo/swag v1.16.6
golang.org/x/crypto v0.43.0
golang.org/x/image v0.32.0
golang.org/x/mod v0.29.0
golang.org/x/oauth2 v0.32.0
golang.org/x/sys v0.37.0
golang.org/x/time v0.14.0
golang.org/x/crypto v0.42.0
golang.org/x/image v0.31.0
golang.org/x/mod v0.28.0
golang.org/x/oauth2 v0.31.0
golang.org/x/sys v0.36.0
golang.org/x/time v0.13.0
gopkg.in/yaml.v3 v3.0.1
)
@@ -37,7 +37,7 @@ require (
dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect
dev.gaijin.team/go/golib v0.6.0 // indirect
github.com/4meepo/tagalign v1.4.3 // indirect
github.com/Abirdcfly/dupword v0.1.7 // indirect
github.com/Abirdcfly/dupword v0.1.6 // indirect
github.com/AdminBenni/iota-mixing v1.0.0 // indirect
github.com/AlwxSin/noinlineerr v1.0.5 // indirect
github.com/Antonboom/errname v1.1.1 // indirect
@@ -46,7 +46,7 @@ require (
github.com/BurntSushi/toml v1.5.0 // indirect
github.com/Djarvur/go-err113 v0.1.1 // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/MirrexOne/unqueryvet v1.2.1 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect
github.com/air-verse/air v1.63.0 // indirect
@@ -57,8 +57,8 @@ require (
github.com/alfatraining/structtag v1.0.0 // indirect
github.com/alingse/asasalint v0.0.11 // indirect
github.com/alingse/nilnesserr v0.2.0 // indirect
github.com/ashanbrown/forbidigo/v2 v2.3.0 // indirect
github.com/ashanbrown/makezero/v2 v2.1.0 // indirect
github.com/ashanbrown/forbidigo/v2 v2.1.0 // indirect
github.com/ashanbrown/makezero/v2 v2.0.1 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bep/godartsass/v2 v2.5.0 // indirect
@@ -66,16 +66,16 @@ require (
github.com/bkielbasa/cyclop v1.2.3 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
github.com/bombsimon/wsl/v5 v5.3.0 // indirect
github.com/bombsimon/wsl/v5 v5.2.0 // indirect
github.com/boombuler/barcode v1.1.0 // indirect
github.com/breml/bidichk v0.3.3 // indirect
github.com/breml/errchkjson v0.4.1 // indirect
github.com/butuzov/ireturn v0.4.0 // indirect
github.com/butuzov/mirror v1.3.0 // indirect
github.com/catenacyber/perfsprint v0.10.0 // indirect
github.com/catenacyber/perfsprint v0.9.1 // indirect
github.com/ccojocar/zxcvbn-go v1.0.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/charithe/durationcheck v0.0.11 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/lipgloss v1.1.0 // indirect
github.com/charmbracelet/x/ansi v0.8.0 // indirect
@@ -99,18 +99,23 @@ require (
github.com/firefart/nonamedreturns v1.0.6 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
github.com/ghostiam/protogetter v0.3.17 // indirect
github.com/go-critic/go-critic v0.14.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
github.com/ghostiam/protogetter v0.3.16 // indirect
github.com/go-critic/go-critic v0.13.0 // indirect
github.com/go-errors/errors v1.5.1 // indirect
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
github.com/go-jose/go-jose/v4 v4.1.2 // indirect
github.com/go-openapi/jsonpointer v0.22.1 // indirect
github.com/go-openapi/jsonreference v0.21.2 // indirect
github.com/go-openapi/spec v0.22.0 // indirect
github.com/go-openapi/swag v0.25.1 // indirect
github.com/go-openapi/swag/cmdutils v0.25.1 // indirect
github.com/go-openapi/swag/conv v0.25.1 // indirect
github.com/go-openapi/swag/fileutils v0.25.1 // indirect
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
github.com/go-openapi/swag/jsonutils v0.25.1 // indirect
github.com/go-openapi/swag/loading v0.25.1 // indirect
github.com/go-openapi/swag/mangling v0.25.1 // indirect
github.com/go-openapi/swag/netutils v0.25.1 // indirect
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
@@ -126,18 +131,19 @@ require (
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/godoc-lint/godoc-lint v0.10.1 // indirect
github.com/gofrs/flock v0.13.0 // indirect
github.com/godoc-lint/godoc-lint v0.10.0 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/gohugoio/hugo v0.149.1 // indirect
github.com/golang/geo v0.0.0-20251030142647-5906ab3d21fa // indirect
github.com/golang/geo v0.0.0-20250917161122-64cb148137c6 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golangci/asciicheck v0.5.0 // indirect
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect
github.com/golangci/go-printf-func-name v0.1.1 // indirect
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
github.com/golangci/golangci-lint/v2 v2.6.0 // indirect
github.com/golangci/golangci-lint/v2 v2.5.0 // indirect
github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 // indirect
github.com/golangci/misspell v0.7.0 // indirect
github.com/golangci/nilerr v0.0.0-20250918000102-015671e622fe // indirect
github.com/golangci/plugin-module-register v0.1.2 // indirect
github.com/golangci/revgrep v0.8.0 // indirect
github.com/golangci/swaggoswag v0.0.0-20250504205917-77f2aca3143e // indirect
@@ -146,7 +152,7 @@ require (
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/gostaticanalysis/comment v1.5.0 // indirect
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
github.com/gostaticanalysis/nilerr v0.1.2 // indirect
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
@@ -156,17 +162,17 @@ require (
github.com/jgautheron/goconst v1.8.2 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jjti/go-spancheck v0.6.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/julz/importas v0.2.0 // indirect
github.com/jupiterrider/ffi v0.5.1 // indirect
github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect
github.com/kisielk/errcheck v1.9.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.6 // indirect
github.com/kovidgoyal/go-parallel v1.0.1 // indirect
github.com/kulti/thelper v0.7.1 // indirect
github.com/kunwardeep/paralleltest v1.0.15 // indirect
github.com/kunwardeep/paralleltest v1.0.14 // indirect
github.com/lasiar/canonicalheader v1.1.2 // indirect
github.com/ldez/exptostd v0.4.5 // indirect
github.com/ldez/gomoddirectives v0.7.1 // indirect
github.com/ldez/exptostd v0.4.4 // indirect
github.com/ldez/gomoddirectives v0.7.0 // indirect
github.com/ldez/grignotin v0.10.1 // indirect
github.com/ldez/tagliatelle v0.7.2 // indirect
github.com/ldez/usetesting v0.5.0 // indirect
@@ -193,7 +199,7 @@ require (
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.12.0 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.21.2 // indirect
github.com/nunnatsa/ginkgolinter v0.21.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
@@ -203,7 +209,7 @@ require (
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/quasilyte/go-ruleguard v0.4.4 // indirect
github.com/quasilyte/go-ruleguard/dsl v0.3.23 // indirect
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
github.com/quasilyte/gogrep v0.5.0 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
@@ -211,14 +217,13 @@ require (
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
github.com/ryancurrah/gomodguard v1.4.1 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.29.0 // indirect
github.com/securego/gosec/v2 v2.22.10 // indirect
github.com/securego/gosec/v2 v2.22.8 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sonatard/noctx v0.4.0 // indirect
@@ -233,6 +238,7 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/swaggo/files v1.0.1 // indirect
github.com/tdakkota/asciicheck v0.4.1 // indirect
github.com/tdewolff/parse/v2 v2.8.3 // indirect
github.com/tetafro/godot v1.5.4 // indirect
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect
@@ -252,24 +258,24 @@ require (
gitlab.com/bosi/decorder v0.4.2 // indirect
go-simpler.org/musttag v0.14.0 // indirect
go-simpler.org/sloglint v0.11.1 // indirect
go.augendre.info/arangolint v0.3.1 // indirect
go.augendre.info/fatcontext v0.9.0 // indirect
go.augendre.info/arangolint v0.2.0 // indirect
go.augendre.info/fatcontext v0.8.1 // indirect
go.etcd.io/bbolt v1.4.3 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp/typeparams v0.0.0-20251002181428-27f1f14c8bb9 // indirect
golang.org/x/net v0.46.0 // indirect
golang.org/x/exp/typeparams v0.0.0-20250911091902-df9299821621 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/tools v0.38.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/tools v0.37.0 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
honnef.co/go/tools v0.6.1 // indirect
mvdan.cc/gofumpt v0.9.2 // indirect
mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15 // indirect
mvdan.cc/gofumpt v0.9.1 // indirect
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
+194 -93
View File
@@ -45,16 +45,22 @@ dev.gaijin.team/go/golib v0.6.0/go.mod h1:uY1mShx8Z/aNHWDyAkZTkX+uCi5PdX7KsG1eDQ
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/4meepo/tagalign v1.4.3 h1:Bnu7jGWwbfpAie2vyl63Zup5KuRv21olsPIha53BJr8=
github.com/4meepo/tagalign v1.4.3/go.mod h1:00WwRjiuSbrRJnSVeGWPLp2epS5Q/l4UEy0apLLS37c=
github.com/Abirdcfly/dupword v0.1.7 h1:2j8sInznrje4I0CMisSL6ipEBkeJUJAmK1/lfoNGWrQ=
github.com/Abirdcfly/dupword v0.1.7/go.mod h1:K0DkBeOebJ4VyOICFdppB23Q0YMOgVafM0zYW0n9lF4=
github.com/Abirdcfly/dupword v0.1.6 h1:qeL6u0442RPRe3mcaLcbaCi2/Y/hOcdtw6DE9odjz9c=
github.com/Abirdcfly/dupword v0.1.6/go.mod h1:s+BFMuL/I4YSiFv29snqyjwzDp4b65W2Kvy+PKzZ6cw=
github.com/AdminBenni/iota-mixing v1.0.0 h1:Os6lpjG2dp/AE5fYBPAA1zfa2qMdCAWwPMCgpwKq7wo=
github.com/AdminBenni/iota-mixing v1.0.0/go.mod h1:i4+tpAaB+qMVIV9OK3m4/DAynOd5bQFaOu+2AhtBCNY=
github.com/AlwxSin/noinlineerr v1.0.5 h1:RUjt63wk1AYWTXtVXbSqemlbVTb23JOSRiNsshj7TbY=
github.com/AlwxSin/noinlineerr v1.0.5/go.mod h1:+QgkkoYrMH7RHvcdxdlI7vYYEdgeoFOVjU9sUhw/rQc=
github.com/Antonboom/errname v1.1.0 h1:A+ucvdpMwlo/myWrkHEUEBWc/xuXdud23S8tmTb/oAE=
github.com/Antonboom/errname v1.1.0/go.mod h1:O1NMrzgUcVBGIfi3xlVuvX8Q/VP/73sseCaAppfjqZw=
github.com/Antonboom/errname v1.1.1 h1:bllB7mlIbTVzO9jmSWVWLjxTEbGBVQ1Ff/ClQgtPw9Q=
github.com/Antonboom/errname v1.1.1/go.mod h1:gjhe24xoxXp0ScLtHzjiXp0Exi1RFLKJb0bVBtWKCWQ=
github.com/Antonboom/nilnil v1.1.0 h1:jGxJxjgYS3VUUtOTNk8Z1icwT5ESpLH/426fjmQG+ng=
github.com/Antonboom/nilnil v1.1.0/go.mod h1:b7sAlogQjFa1wV8jUW3o4PMzDVFLbTux+xnQdvzdcIE=
github.com/Antonboom/nilnil v1.1.1 h1:9Mdr6BYd8WHCDngQnNVV0b554xyisFioEKi30sksufQ=
github.com/Antonboom/nilnil v1.1.1/go.mod h1:yCyAmSw3doopbOWhJlVci+HuyNRuHJKIv6V2oYQa8II=
github.com/Antonboom/testifylint v1.6.1 h1:6ZSytkFWatT8mwZlmRCHkWz1gPi+q6UBSbieji2Gj/o=
github.com/Antonboom/testifylint v1.6.1/go.mod h1:k+nEkathI2NFjKO6HvwmSrbzUcQ6FAnbZV+ZRrnXPLI=
github.com/Antonboom/testifylint v1.6.4 h1:gs9fUEy+egzxkEbq9P4cpcMB6/G0DYdMeiFS87UiqmQ=
github.com/Antonboom/testifylint v1.6.4/go.mod h1:YO33FROXX2OoUfwjz8g+gUxQXio5i9qpVy7nXGbxDD4=
github.com/BurntSushi/locker v0.0.0-20171006230638-a6e239ea1c69 h1:+tu3HOoMXB7RXEINRVIpxJCT+KdYiI7LAEAUrOw3dIU=
@@ -65,12 +71,14 @@ github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM=
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/Djarvur/go-err113 v0.1.1 h1:eHfopDqXRwAi+YmCUas75ZE0+hoBHJ2GQNLYRSxao4g=
github.com/Djarvur/go-err113 v0.1.1/go.mod h1:IaWJdYFLg76t2ihfflPZnM1LIQszWOsFDh2hhhAVF6k=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/MirrexOne/unqueryvet v1.2.1 h1:M+zdXMq84g+E1YOLa7g7ExN3dWfZQrdDSTCM7gC+m/A=
github.com/MirrexOne/unqueryvet v1.2.1/go.mod h1:IWwCwMQlSWjAIteW0t+28Q5vouyktfujzYznSIWiuOg=
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 h1:vckeWVESWp6Qog7UZSARNqfu/cZqvki8zsuj3piCMx4=
@@ -106,10 +114,10 @@ github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c h1:651/eoCRnQ7YtS
github.com/armon/go-radix v1.0.1-0.20221118154546-54df44f2176c/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asdine/storm/v3 v3.2.1 h1:I5AqhkPK6nBZ/qJXySdI7ot5BlXSZ7qvDY1zAn5ZJac=
github.com/asdine/storm/v3 v3.2.1/go.mod h1:LEpXwGt4pIqrE/XcTvCnZHT5MgZCV6Ub9q7yQzOFWr0=
github.com/ashanbrown/forbidigo/v2 v2.3.0 h1:OZZDOchCgsX5gvToVtEBoV2UWbFfI6RKQTir2UZzSxo=
github.com/ashanbrown/forbidigo/v2 v2.3.0/go.mod h1:5p6VmsG5/1xx3E785W9fouMxIOkvY2rRV9nMdWadd6c=
github.com/ashanbrown/makezero/v2 v2.1.0 h1:snuKYMbqosNokUKm+R6/+vOPs8yVAi46La7Ck6QYSaE=
github.com/ashanbrown/makezero/v2 v2.1.0/go.mod h1:aEGT/9q3S8DHeE57C88z2a6xydvgx8J5hgXIGWgo0MY=
github.com/ashanbrown/forbidigo/v2 v2.1.0 h1:NAxZrWqNUQiDz19FKScQ/xvwzmij6BiOw3S0+QUQ+Hs=
github.com/ashanbrown/forbidigo/v2 v2.1.0/go.mod h1:0zZfdNAuZIL7rSComLGthgc/9/n2FqspBOH90xlCHdA=
github.com/ashanbrown/makezero/v2 v2.0.1 h1:r8GtKetWOgoJ4sLyUx97UTwyt2dO7WkGFHizn/Lo8TY=
github.com/ashanbrown/makezero/v2 v2.0.1/go.mod h1:kKU4IMxmYW1M4fiEHMb2vc5SFoPzXvgbMR9gIp5pjSw=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
@@ -152,8 +160,10 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ
github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k=
github.com/bombsimon/wsl/v4 v4.7.0 h1:1Ilm9JBPRczjyUs6hvOPKvd7VL1Q++PL8M0SXBDf+jQ=
github.com/bombsimon/wsl/v4 v4.7.0/go.mod h1:uV/+6BkffuzSAVYD+yGyld1AChO7/EuLrCF/8xTiapg=
github.com/bombsimon/wsl/v5 v5.3.0 h1:nZWREJFL6U3vgW/B1lfDOigl+tEF6qgs6dGGbFeR0UM=
github.com/bombsimon/wsl/v5 v5.3.0/go.mod h1:Gp8lD04z27wm3FANIUPZycXp+8huVsn0oxc+n4qfV9I=
github.com/bombsimon/wsl/v5 v5.1.1 h1:cQg5KJf9FlctAH4cpL9vLKnziYknoCMCdqXl0wjl72Q=
github.com/bombsimon/wsl/v5 v5.1.1/go.mod h1:Gp8lD04z27wm3FANIUPZycXp+8huVsn0oxc+n4qfV9I=
github.com/bombsimon/wsl/v5 v5.2.0 h1:PyCCwd3Q7abGs3e34IW4jLYlBS+FbsU6iK+Tb3NnDp4=
github.com/bombsimon/wsl/v5 v5.2.0/go.mod h1:Gp8lD04z27wm3FANIUPZycXp+8huVsn0oxc+n4qfV9I=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.1.0 h1:ChaYjBR63fr4LFyGn8E8nt7dBSt3MiU3zMOZqFvVkHo=
github.com/boombuler/barcode v1.1.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
@@ -165,8 +175,8 @@ github.com/butuzov/ireturn v0.4.0 h1:+s76bF/PfeKEdbG8b54aCocxXmi0wvYdOVsWxVO7n8E
github.com/butuzov/ireturn v0.4.0/go.mod h1:ghI0FrCmap8pDWZwfPisFD1vEc56VKH4NpQUxDHta70=
github.com/butuzov/mirror v1.3.0 h1:HdWCXzmwlQHdVhwvsfBb2Au0r3HyINry3bDWLYXiKoc=
github.com/butuzov/mirror v1.3.0/go.mod h1:AEij0Z8YMALaq4yQj9CPPVYOyJQyiexpQEQgihajRfI=
github.com/catenacyber/perfsprint v0.10.0 h1:AZj1mYyxbxLRqmnYOeguZXEQwWOgQGm2wzLI5d7Hl/0=
github.com/catenacyber/perfsprint v0.10.0/go.mod h1:DJTGsi/Zufpuus6XPGJyKOTMELe347o6akPvWG9Zcsc=
github.com/catenacyber/perfsprint v0.9.1 h1:5LlTp4RwTooQjJCvGEFV6XksZvWE7wCOUvjD2z0vls0=
github.com/catenacyber/perfsprint v0.9.1/go.mod h1:q//VWC2fWbcdSLEY1R3l8n0zQCDPdE4IjZwyY1HMunM=
github.com/ccojocar/zxcvbn-go v1.0.4 h1:FWnCIRMXPj43ukfX000kvBZvV6raSxakYr1nzyNrUcc=
github.com/ccojocar/zxcvbn-go v1.0.4/go.mod h1:3GxGX+rHmueTUMvm5ium7irpyjmm7ikxYFOSJB21Das=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -174,8 +184,8 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/charithe/durationcheck v0.0.11 h1:g1/EX1eIiKS57NTWsYtHDZ/APfeXKhye1DidBcABctk=
github.com/charithe/durationcheck v0.0.11/go.mod h1:x5iZaixRNl8ctbM+3B2RrPG5t856TxRyVQEnbIEM2X4=
github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4=
github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
@@ -195,8 +205,8 @@ github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyM
github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/coreos/go-oidc/v3 v3.16.0 h1:qRQUCFstKpXwmEjDQTIbyY/5jF00+asXzSkmkoa/mow=
github.com/coreos/go-oidc/v3 v3.16.0/go.mod h1:wqPbKFrVnE90vty060SB40FCJ8fTHTxSwyXJqZH+sI8=
github.com/coreos/go-oidc/v3 v3.15.0 h1:R6Oz8Z4bqWR7VFQ+sPSvZPQv4x8M+sJkDO5ojgwlyAg=
github.com/coreos/go-oidc/v3 v3.15.0/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -238,6 +248,8 @@ github.com/dsoprea/go-utility/v2 v2.0.0-20221003142440-7a1927d49d9d/go.mod h1:LV
github.com/dsoprea/go-utility/v2 v2.0.0-20221003160719-7bc88537c05e/go.mod h1:VZ7cB0pTjm1ADBWhJUOHESu4ZYy9JN+ZPqjfiW09EPU=
github.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349 h1:DilThiXje0z+3UQ5YjYiSRRzVdtamFpvBQXKwMglWqw=
github.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349/go.mod h1:4GC5sXji84i/p+irqghpPFZBF8tRN/Q7+700G0/DLe8=
github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw=
github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k=
github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -261,18 +273,20 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo=
github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA=
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gen2brain/go-fitz v1.24.15 h1:sJNB1MOWkqnzzENPHggFpgxTwW0+S5WF/rM5wUBpJWo=
github.com/gen2brain/go-fitz v1.24.15/go.mod h1:SftkiVbTHqF141DuiLwBBM65zP7ig6AVDQpf2WlHamo=
github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ=
github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghostiam/protogetter v0.3.17 h1:sjGPErP9o7i2Ym+z3LsQzBdLCNaqbYy2iJQPxGXg04Q=
github.com/ghostiam/protogetter v0.3.17/go.mod h1:AivIX1eKA/TcUmzZdzbl+Tb8tjIe8FcyG6JFyemQAH4=
github.com/go-critic/go-critic v0.14.0 h1:fzA7pGprRPwgA2LwoiaHuWzZzmUEM7dZjihfFpiZQpQ=
github.com/go-critic/go-critic v0.14.0/go.mod h1:/2QgW4QJIJ9aYCYTQ9RWKc+1KnMFouAJ/FmPylhzOoU=
github.com/ghostiam/protogetter v0.3.15 h1:1KF5sXel0HE48zh1/vn0Loiw25A9ApyseLzQuif1mLY=
github.com/ghostiam/protogetter v0.3.15/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA=
github.com/ghostiam/protogetter v0.3.16 h1:UkrisuJBYLnZW6FcYUNBDJOqY3X22RtoYMlCsiNlFFA=
github.com/ghostiam/protogetter v0.3.16/go.mod h1:4SRRIv6PcjkIMpUkRUsP4TsUTqO/N3Fmvwivuc/sCHA=
github.com/go-critic/go-critic v0.13.0 h1:kJzM7wzltQasSUXtYyTl6UaPVySO6GkaR1thFnJ6afY=
github.com/go-critic/go-critic v0.13.0/go.mod h1:M/YeuJ3vOCQDnP2SU+ZhjgRzwzcBW87JqLpMJLrZDLI=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
@@ -282,8 +296,8 @@ github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs=
github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI=
github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
@@ -292,27 +306,64 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-openapi/jsonpointer v0.22.0 h1:TmMhghgNef9YXxTu1tOopo+0BGEytxA+okbry0HjZsM=
github.com/go-openapi/jsonpointer v0.22.0/go.mod h1:xt3jV88UtExdIkkL7NloURjRQjbeUgcxFblMjq2iaiU=
github.com/go-openapi/jsonpointer v0.22.1 h1:sHYI1He3b9NqJ4wXLoJDKmUmHkWy/L7rtEo92JUxBNk=
github.com/go-openapi/jsonpointer v0.22.1/go.mod h1:pQT9OsLkfz1yWoMgYFy4x3U5GY5nUlsOn1qSBH5MkCM=
github.com/go-openapi/jsonreference v0.21.1 h1:bSKrcl8819zKiOgxkbVNRUBIr6Wwj9KYrDbMjRs0cDA=
github.com/go-openapi/jsonreference v0.21.1/go.mod h1:PWs8rO4xxTUqKGu+lEvvCxD5k2X7QYkKAepJyCmSTT8=
github.com/go-openapi/jsonreference v0.21.2 h1:Wxjda4M/BBQllegefXrY/9aq1fxBA8sI5M/lFU6tSWU=
github.com/go-openapi/jsonreference v0.21.2/go.mod h1:pp3PEjIsJ9CZDGCNOyXIQxsNuroxm8FAJ/+quA0yKzQ=
github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY=
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
github.com/go-openapi/spec v0.22.0 h1:xT/EsX4frL3U09QviRIZXvkh80yibxQmtoEvyqug0Tw=
github.com/go-openapi/spec v0.22.0/go.mod h1:K0FhKxkez8YNS94XzF8YKEMULbFrRw4m15i2YUht4L0=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.24.1 h1:DPdYTZKo6AQCRqzwr/kGkxJzHhpKxZ9i/oX0zag+MF8=
github.com/go-openapi/swag v0.24.1/go.mod h1:sm8I3lCPlspsBBwUm1t5oZeWZS0s7m/A+Psg0ooRU0A=
github.com/go-openapi/swag v0.25.1 h1:6uwVsx+/OuvFVPqfQmOOPsqTcm5/GkBhNwLqIR916n8=
github.com/go-openapi/swag v0.25.1/go.mod h1:bzONdGlT0fkStgGPd3bhZf1MnuPkf2YAys6h+jZipOo=
github.com/go-openapi/swag/cmdutils v0.24.0 h1:KlRCffHwXFI6E5MV9n8o8zBRElpY4uK4yWyAMWETo9I=
github.com/go-openapi/swag/cmdutils v0.24.0/go.mod h1:uxib2FAeQMByyHomTlsP8h1TtPd54Msu2ZDU/H5Vuf8=
github.com/go-openapi/swag/cmdutils v0.25.1 h1:nDke3nAFDArAa631aitksFGj2omusks88GF1VwdYqPY=
github.com/go-openapi/swag/cmdutils v0.25.1/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0=
github.com/go-openapi/swag/conv v0.24.0 h1:ejB9+7yogkWly6pnruRX45D1/6J+ZxRu92YFivx54ik=
github.com/go-openapi/swag/conv v0.24.0/go.mod h1:jbn140mZd7EW2g8a8Y5bwm8/Wy1slLySQQ0ND6DPc2c=
github.com/go-openapi/swag/conv v0.25.1 h1:+9o8YUg6QuqqBM5X6rYL/p1dpWeZRhoIt9x7CCP+he0=
github.com/go-openapi/swag/conv v0.25.1/go.mod h1:Z1mFEGPfyIKPu0806khI3zF+/EUXde+fdeksUl2NiDs=
github.com/go-openapi/swag/fileutils v0.24.0 h1:U9pCpqp4RUytnD689Ek/N1d2N/a//XCeqoH508H5oak=
github.com/go-openapi/swag/fileutils v0.24.0/go.mod h1:3SCrCSBHyP1/N+3oErQ1gP+OX1GV2QYFSnrTbzwli90=
github.com/go-openapi/swag/fileutils v0.25.1 h1:rSRXapjQequt7kqalKXdcpIegIShhTPXx7yw0kek2uU=
github.com/go-openapi/swag/fileutils v0.25.1/go.mod h1:+NXtt5xNZZqmpIpjqcujqojGFek9/w55b3ecmOdtg8M=
github.com/go-openapi/swag/jsonname v0.24.0 h1:2wKS9bgRV/xB8c62Qg16w4AUiIrqqiniJFtZGi3dg5k=
github.com/go-openapi/swag/jsonname v0.24.0/go.mod h1:GXqrPzGJe611P7LG4QB9JKPtUZ7flE4DOVechNaDd7Q=
github.com/go-openapi/swag/jsonname v0.25.1 h1:Sgx+qbwa4ej6AomWC6pEfXrA6uP2RkaNjA9BR8a1RJU=
github.com/go-openapi/swag/jsonname v0.25.1/go.mod h1:71Tekow6UOLBD3wS7XhdT98g5J5GR13NOTQ9/6Q11Zo=
github.com/go-openapi/swag/jsonutils v0.24.0 h1:F1vE1q4pg1xtO3HTyJYRmEuJ4jmIp2iZ30bzW5XgZts=
github.com/go-openapi/swag/jsonutils v0.24.0/go.mod h1:vBowZtF5Z4DDApIoxcIVfR8v0l9oq5PpYRUuteVu6f0=
github.com/go-openapi/swag/jsonutils v0.25.1 h1:AihLHaD0brrkJoMqEZOBNzTLnk81Kg9cWr+SPtxtgl8=
github.com/go-openapi/swag/jsonutils v0.25.1/go.mod h1:JpEkAjxQXpiaHmRO04N1zE4qbUEg3b7Udll7AMGTNOo=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.1 h1:DSQGcdB6G0N9c/KhtpYc71PzzGEIc/fZ1no35x4/XBY=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.1/go.mod h1:kjmweouyPwRUEYMSrbAidoLMGeJ5p6zdHi9BgZiqmsg=
github.com/go-openapi/swag/loading v0.24.0 h1:ln/fWTwJp2Zkj5DdaX4JPiddFC5CHQpvaBKycOlceYc=
github.com/go-openapi/swag/loading v0.24.0/go.mod h1:gShCN4woKZYIxPxbfbyHgjXAhO61m88tmjy0lp/LkJk=
github.com/go-openapi/swag/loading v0.25.1 h1:6OruqzjWoJyanZOim58iG2vj934TysYVptyaoXS24kw=
github.com/go-openapi/swag/loading v0.25.1/go.mod h1:xoIe2EG32NOYYbqxvXgPzne989bWvSNoWoyQVWEZicc=
github.com/go-openapi/swag/mangling v0.24.0 h1:PGOQpViCOUroIeak/Uj/sjGAq9LADS3mOyjznmHy2pk=
github.com/go-openapi/swag/mangling v0.24.0/go.mod h1:Jm5Go9LHkycsz0wfoaBDkdc4CkpuSnIEf62brzyCbhc=
github.com/go-openapi/swag/mangling v0.25.1 h1:XzILnLzhZPZNtmxKaz/2xIGPQsBsvmCjrJOWGNz/ync=
github.com/go-openapi/swag/mangling v0.25.1/go.mod h1:CdiMQ6pnfAgyQGSOIYnZkXvqhnnwOn997uXZMAd/7mQ=
github.com/go-openapi/swag/netutils v0.24.0 h1:Bz02HRjYv8046Ycg/w80q3g9QCWeIqTvlyOjQPDjD8w=
github.com/go-openapi/swag/netutils v0.24.0/go.mod h1:WRgiHcYTnx+IqfMCtu0hy9oOaPR0HnPbmArSRN1SkZM=
github.com/go-openapi/swag/netutils v0.25.1 h1:2wFLYahe40tDUHfKT1GRC4rfa5T1B4GWZ+msEFA4Fl4=
github.com/go-openapi/swag/netutils v0.25.1/go.mod h1:CAkkvqnUJX8NV96tNhEQvKz8SQo2KF0f7LleiJwIeRE=
github.com/go-openapi/swag/stringutils v0.24.0 h1:i4Z/Jawf9EvXOLUbT97O0HbPUja18VdBxeadyAqS1FM=
github.com/go-openapi/swag/stringutils v0.24.0/go.mod h1:5nUXB4xA0kw2df5PRipZDslPJgJut+NjL7D25zPZ/4w=
github.com/go-openapi/swag/stringutils v0.25.1 h1:Xasqgjvk30eUe8VKdmyzKtjkVjeiXx1Iz0zDfMNpPbw=
github.com/go-openapi/swag/stringutils v0.25.1/go.mod h1:JLdSAq5169HaiDUbTvArA2yQxmgn4D6h4A+4HqVvAYg=
github.com/go-openapi/swag/typeutils v0.24.0 h1:d3szEGzGDf4L2y1gYOSSLeK6h46F+zibnEas2Jm/wIw=
github.com/go-openapi/swag/typeutils v0.24.0/go.mod h1:q8C3Kmk/vh2VhpCLaoR2MVWOGP8y7Jc8l82qCTd1DYI=
github.com/go-openapi/swag/typeutils v0.25.1 h1:rD/9HsEQieewNt6/k+JBwkxuAHktFtH3I3ysiFZqukA=
github.com/go-openapi/swag/typeutils v0.25.1/go.mod h1:9McMC/oCdS4BKwk2shEB7x17P6HmMmA6dQRtAkSnNb8=
github.com/go-openapi/swag/yamlutils v0.24.0 h1:bhw4894A7Iw6ne+639hsBNRHg9iZg/ISrOVr+sJGp4c=
github.com/go-openapi/swag/yamlutils v0.24.0/go.mod h1:DpKv5aYuaGm/sULePoeiG8uwMpZSfReo1HR3Ik0yaG8=
github.com/go-openapi/swag/yamlutils v0.25.1 h1:mry5ez8joJwzvMbaTGLhw8pXUnhDK91oSJLDPF1bmGk=
github.com/go-openapi/swag/yamlutils v0.25.1/go.mod h1:cm9ywbzncy3y6uPm/97ysW8+wZ09qsks+9RS8fLWKqg=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
@@ -321,8 +372,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI=
github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
@@ -357,10 +408,10 @@ github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/godoc-lint/godoc-lint v0.10.1 h1:ZPUVzlDtJfA+P688JfPJPkI/SuzcBr/753yGIk5bOPA=
github.com/godoc-lint/godoc-lint v0.10.1/go.mod h1:KleLcHu/CGSvkjUH2RvZyoK1MBC7pDQg4NxMYLcBBsw=
github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw=
github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0=
github.com/godoc-lint/godoc-lint v0.10.0 h1:OcyrziBi18sQSEpib6NesVHEJ/Xcng97NunePBA48g4=
github.com/godoc-lint/godoc-lint v0.10.0/go.mod h1:KleLcHu/CGSvkjUH2RvZyoK1MBC7pDQg4NxMYLcBBsw=
github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E=
github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20230805085216-e63c13218d0e h1:QArsSubW7eDh8APMXkByjQWvuljwPGAGQpJEFn0F0wY=
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20230805085216-e63c13218d0e/go.mod h1:3Ltoo9Banwq0gOtcOwxuHG6omk+AwsQPADyw2vQYOJQ=
@@ -383,8 +434,8 @@ github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
github.com/golang/geo v0.0.0-20251030142647-5906ab3d21fa h1:Q0YqGWxrOZZCHHlFc3KZBjnl6FKqFCpd2qxnbf7duXY=
github.com/golang/geo v0.0.0-20251030142647-5906ab3d21fa/go.mod h1:Mymr9kRGDc64JPr03TSZmuIBODZ3KyswLzm1xL0HFA8=
github.com/golang/geo v0.0.0-20250917161122-64cb148137c6 h1:8VSqEdhJCzXKe/SYulyQ7jgHNxP+BoCPmqzWF5STIyw=
github.com/golang/geo v0.0.0-20250917161122-64cb148137c6/go.mod h1:AN0OjM34c3PbjAsX+QNma1nYtJtRxl+s9MZNV7S+efw=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -420,16 +471,23 @@ github.com/golangci/asciicheck v0.5.0 h1:jczN/BorERZwK8oiFBOGvlGPknhvq0bjnysTj4n
github.com/golangci/asciicheck v0.5.0/go.mod h1:5RMNAInbNFw2krqN6ibBxN/zfRFa9S6tA1nPdM0l8qQ=
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 h1:WUvBfQL6EW/40l6OmeSBYQJNSif4O11+bmWEz+C7FYw=
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32/go.mod h1:NUw9Zr2Sy7+HxzdjIULge71wI6yEg1lWQr7Evcu8K0E=
github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUPPyAKJuzv8pEJU=
github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s=
github.com/golangci/go-printf-func-name v0.1.1 h1:hIYTFJqAGp1iwoIfsNTpoq1xZAarogrvjO9AfiW3B4U=
github.com/golangci/go-printf-func-name v0.1.1/go.mod h1:Es64MpWEZbh0UBtTAICOZiB+miW53w/K9Or/4QogJss=
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0aiOTsLKO2aZQAPT4nlQCsimGcSGE=
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY=
github.com/golangci/golangci-lint/v2 v2.6.0 h1:hgjuaMTwbWrBf1kvMrmWmyCRKq9wU7Cvi84O0METZHc=
github.com/golangci/golangci-lint/v2 v2.6.0/go.mod h1:qKA7VpZt6X2uo+ylnFYaNpdmJnm4tBSzdZiD0xDOIJE=
github.com/golangci/golangci-lint v1.64.8 h1:y5TdeVidMtBGG32zgSC7ZXTFNHrsJkDnpO4ItB3Am+I=
github.com/golangci/golangci-lint/v2 v2.4.0 h1:qz6O6vr7kVzXJqyvHjHSz5fA3D+PM8v96QU5gxZCNWM=
github.com/golangci/golangci-lint/v2 v2.4.0/go.mod h1:Oq7vuAf6L1iNL34uHDcsIF6Mnc0amOPdsT3/GlpHD+I=
github.com/golangci/golangci-lint/v2 v2.5.0 h1:BDRg4ASm4J1y/DSRY6zwJ5tr5Yy8ZqbZ79XrCeFxaQo=
github.com/golangci/golangci-lint/v2 v2.5.0/go.mod h1:IJtWJBZkLbx7AVrIUzLd8Oi3ADtwaNpWbR3wthVWHcc=
github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 h1:AkK+w9FZBXlU/xUmBtSJN1+tAI4FIvy5WtnUnY8e4p8=
github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95/go.mod h1:k9mmcyWKSTMcPPvQUCfRWWQ9VHJ1U9Dc0R7kaXAgtnQ=
github.com/golangci/misspell v0.7.0 h1:4GOHr/T1lTW0hhR4tgaaV1WS/lJ+ncvYCoFKmqJsj0c=
github.com/golangci/misspell v0.7.0/go.mod h1:WZyyI2P3hxPY2UVHs3cS8YcllAeyfquQcKfdeE9AFVg=
github.com/golangci/nilerr v0.0.0-20250918000102-015671e622fe h1:F1pK9tBy41i7eesBFkSNMldwtiAaWiU+3fT/24sTnNI=
github.com/golangci/nilerr v0.0.0-20250918000102-015671e622fe/go.mod h1:CtTxAluxD2ng9aIT9bPrVoMuISFWCD+SaxtvYtdWA2k=
github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg=
github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw=
github.com/golangci/revgrep v0.8.0 h1:EZBctwbVd0aMeRnNUsFogoyayvKHyxlV3CdUA46FX2s=
@@ -463,31 +521,42 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY=
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a h1://KbezygeMJZCSHH+HgUZiTeSoiuFspbMg1ge+eFj18=
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gordonklaus/ineffassign v0.1.0 h1:y2Gd/9I7MdY1oEIt+n+rowjBNDcLQq3RsH5hwJd0f9s=
github.com/gordonklaus/ineffassign v0.1.0/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0=
github.com/gordonklaus/ineffassign v0.2.0 h1:Uths4KnmwxNJNzq87fwQQDDnbNb7De00VOk9Nu0TySs=
github.com/gordonklaus/ineffassign v0.2.0/go.mod h1:TIpymnagPSexySzs7F9FnO1XFTy8IT3a59vmZp5Y9Lw=
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk=
github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc=
github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado=
github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM=
github.com/gostaticanalysis/comment v1.5.0 h1:X82FLl+TswsUMpMh17srGRuKaaXprTaytmEpgnKIDu8=
github.com/gostaticanalysis/comment v1.5.0/go.mod h1:V6eb3gpCv9GNVqb6amXzEUX3jXLVK/AdA+IrAMSqvEc=
github.com/gostaticanalysis/forcetypeassert v0.2.0 h1:uSnWrrUEYDr86OCxWa4/Tp2jeYDlogZiZHzGkWFefTk=
github.com/gostaticanalysis/forcetypeassert v0.2.0/go.mod h1:M5iPavzE9pPqWyeiVXSFghQjljW1+l/Uke3PXHS6ILY=
github.com/gostaticanalysis/nilerr v0.1.2 h1:S6nk8a9N8g062nsx63kUkF6AzbHGw7zzyHMcpu52xQU=
github.com/gostaticanalysis/nilerr v0.1.2/go.mod h1:A19UHhoY3y8ahoL7YKz6sdjDtduwTSI4CsymaC2htPA=
github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk=
github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A=
github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M=
github.com/gostaticanalysis/testutil v0.5.0 h1:Dq4wT1DdTwTGCQQv3rl3IvD5Ld0E6HiY+3Zh0sUGqw8=
github.com/gostaticanalysis/testutil v0.5.0/go.mod h1:OLQSbuM6zw2EvCcXTz1lVq5unyoNft372msDY0nY5Hs=
github.com/gtsteffaniak/go-cache v1.0.0 h1:CuZw6eI/be6Oi3oR94Jb5LhcZShMCs6+1wvS7WGN8oQ=
github.com/gtsteffaniak/go-cache v1.0.0/go.mod h1:rHUZvf4huhMX/bnNK4/oQ3sNAE2fYC2jFpAWZiBPWac=
github.com/gtsteffaniak/go-logger v0.2.3 h1:8nSC5xSMnMYQI61tsBS1tARpnkv/rOh5lzEXtAG72Nw=
github.com/gtsteffaniak/go-logger v0.2.3/go.mod h1:rapapTju4D7bwt6h4JOdZNUXDjnp0WkTBd6TN5yWglI=
github.com/gtsteffaniak/go-logger v0.2.1 h1:NTim7RgpZ0+JAuep+2n1a7oHJbnyaksnWJStdM7qMeU=
github.com/gtsteffaniak/go-logger v0.2.1/go.mod h1:U3ZkdAclcxXNMvoQLq+zDkqcTmdqhX3hTf+6AuTo6v0=
github.com/gtsteffaniak/go-logger v0.2.2 h1:5bEX4ndHK0CsHZjw76T+j0phKoaEGiDwC8erseF99yU=
github.com/gtsteffaniak/go-logger v0.2.2/go.mod h1:U3ZkdAclcxXNMvoQLq+zDkqcTmdqhX3hTf+6AuTo6v0=
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926211917-4f1ceadcc169 h1:kW5TWd6IsIB3ypImyoPGWj+jzXaG3muQ1lXdJpj7KCc=
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926211917-4f1ceadcc169/go.mod h1:rapapTju4D7bwt6h4JOdZNUXDjnp0WkTBd6TN5yWglI=
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926212455-9b14f7183bd2 h1:gCyi3Whqu0rp8+HG/VEjjBi1vZvp+yBl4c8pHABeV0s=
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926212455-9b14f7183bd2/go.mod h1:rapapTju4D7bwt6h4JOdZNUXDjnp0WkTBd6TN5yWglI=
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926212932-e91a612f674c h1:JGf2H8yweS5xYO5kGF0/IDs4WalX3TMhLq4D2gDSQ/g=
github.com/gtsteffaniak/go-logger v0.2.3-0.20250926212932-e91a612f674c/go.mod h1:rapapTju4D7bwt6h4JOdZNUXDjnp0WkTBd6TN5yWglI=
github.com/hairyhenderson/go-codeowners v0.7.0 h1:s0W4wF8bdsBEjTWzwzSlsatSthWtTAF2xLgo4a4RwAo=
github.com/hairyhenderson/go-codeowners v0.7.0/go.mod h1:wUlNgQ3QjqC4z8DnM5nnCYVq/icpqXJyJOukKx5U8/Q=
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 h1:CUW5RYIcysz+D3B+l1mDeXrQ7fUvGGCwJfdASSzbrfo=
@@ -542,10 +611,8 @@ github.com/kkHAIKE/contextcheck v1.1.6 h1:7HIyRcnyzxL9Lz06NGhiKvenXq7Zw6Q0UQu/tt
github.com/kkHAIKE/contextcheck v1.1.6/go.mod h1:3dDbMRNBFaq8HFXWC1JyvDSPm43CmE6IuHam8Wr0rkg=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kovidgoyal/go-parallel v1.0.1 h1:nYUjN+EdpbmQjTg3N5eTUInuXTB3/1oD2vHdaMfuHoI=
github.com/kovidgoyal/go-parallel v1.0.1/go.mod h1:BJNIbe6+hxyFWv7n6oEDPj3PA5qSw5OCtf0hcVxWJiw=
github.com/kovidgoyal/imaging v1.7.2 h1:mmT6k6Az3mC6dbqdZ6Q9KQCdZFWTAQ+q97NyGZgJ/2c=
github.com/kovidgoyal/imaging v1.7.2/go.mod h1:GdkCORjfZMMGFY0Pb7TDmRhj7PDhxF/QShKukSCj0VU=
github.com/kovidgoyal/imaging v1.6.4 h1:K0idhRPXnRrJBKnBYcTfI1HTWSNDeAn7hYDvf9I0dCk=
github.com/kovidgoyal/imaging v1.6.4/go.mod h1:bEIgsaZmXlvFfkv/CUxr9rJook6AQkJnpB5EPosRfRY=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -554,20 +621,26 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs=
github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I=
github.com/kulti/thelper v0.7.1 h1:fI8QITAoFVLx+y+vSyuLBP+rcVIB8jKooNSCT2EiI98=
github.com/kulti/thelper v0.7.1/go.mod h1:NsMjfQEy6sd+9Kfw8kCP61W1I0nerGSYSFnGaxQkcbs=
github.com/kunwardeep/paralleltest v1.0.15 h1:ZMk4Qt306tHIgKISHWFJAO1IDQJLc6uDyJMLyncOb6w=
github.com/kunwardeep/paralleltest v1.0.15/go.mod h1:di4moFqtfz3ToSKxhNjhOZL+696QtJGCFe132CbBLGk=
github.com/kunwardeep/paralleltest v1.0.14 h1:wAkMoMeGX/kGfhQBPODT/BL8XhK23ol/nuQ3SwFaUw8=
github.com/kunwardeep/paralleltest v1.0.14/go.mod h1:di4moFqtfz3ToSKxhNjhOZL+696QtJGCFe132CbBLGk=
github.com/kyokomi/emoji/v2 v2.2.13 h1:GhTfQa67venUUvmleTNFnb+bi7S3aocF7ZCXU9fSO7U=
github.com/kyokomi/emoji/v2 v2.2.13/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE=
github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4=
github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI=
github.com/ldez/exptostd v0.4.5 h1:kv2ZGUVI6VwRfp/+bcQ6Nbx0ghFWcGIKInkG/oFn1aQ=
github.com/ldez/exptostd v0.4.5/go.mod h1:QRjHRMXJrCTIm9WxVNH6VW7oN7KrGSht69bIRwvdFsM=
github.com/ldez/gomoddirectives v0.7.1 h1:FaULkvUIG36hj6chpwa+FdCNGZBsD7/fO+p7CCsM6pE=
github.com/ldez/gomoddirectives v0.7.1/go.mod h1:auDNtakWJR1rC+YX7ar+HmveqXATBAyEK1KYpsIRW/8=
github.com/ldez/exptostd v0.4.4 h1:58AtQjnLcT/tI5W/1KU7xE/O7zW9RAWB6c/ScQAnfus=
github.com/ldez/exptostd v0.4.4/go.mod h1:QfdzPw6oHjFVdNV7ILoPu5sw3OZ3OG1JS0I5JN3J4Js=
github.com/ldez/gomoddirectives v0.7.0 h1:EOx8Dd56BZYSez11LVgdj025lKwlP0/E5OLSl9HDwsY=
github.com/ldez/gomoddirectives v0.7.0/go.mod h1:wR4v8MN9J8kcwvrkzrx6sC9xe9Cp68gWYCsda5xvyGc=
github.com/ldez/grignotin v0.10.0 h1:NQPeh1E/Eza4F0exCeC1WkpnLvgUcQDT8MQ1vOLML0E=
github.com/ldez/grignotin v0.10.0/go.mod h1:oR4iCKUP9fwoeO6vCQeD7M5SMxCT6xdVas4vg0h1LaI=
github.com/ldez/grignotin v0.10.1 h1:keYi9rYsgbvqAZGI1liek5c+jv9UUjbvdj3Tbn5fn4o=
github.com/ldez/grignotin v0.10.1/go.mod h1:UlDbXFCARrXbWGNGP3S5vsysNXAPhnSuBufpTEbwOas=
github.com/ldez/tagliatelle v0.7.1 h1:bTgKjjc2sQcsgPiT902+aadvMjCeMHrY7ly2XKFORIk=
github.com/ldez/tagliatelle v0.7.1/go.mod h1:3zjxUpsNB2aEZScWiZTHrAXOl1x25t3cRmzfK1mlo2I=
github.com/ldez/tagliatelle v0.7.2 h1:KuOlL70/fu9paxuxbeqlicJnCspCRjH0x8FW+NfgYUk=
github.com/ldez/tagliatelle v0.7.2/go.mod h1:PtGgm163ZplJfZMZ2sf5nhUT170rSuPgBimoyYtdaSI=
github.com/ldez/usetesting v0.5.0 h1:3/QtzZObBKLy1F4F8jLuKJiKBjjVFi1IavpoWbmqLwc=
@@ -586,6 +659,8 @@ github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/makeworld-the-better-one/dither/v2 v2.4.0 h1:Az/dYXiTcwcRSe59Hzw4RI1rSnAZns+1msaCXetrMFE=
github.com/makeworld-the-better-one/dither/v2 v2.4.0/go.mod h1:VBtN8DXO7SNtyGmLiGA7IsFeKrBkQPze1/iAeM95arc=
github.com/manuelarte/embeddedstructfieldcheck v0.3.0 h1:VhGqK8gANDvFYDxQkjPbv7/gDJtsGU9k6qj/hC2hgso=
github.com/manuelarte/embeddedstructfieldcheck v0.3.0/go.mod h1:LSo/IQpPfx1dXMcX4ibZCYA7Yy6ayZHIaOGM70+1Wy8=
github.com/manuelarte/embeddedstructfieldcheck v0.4.0 h1:3mAIyaGRtjK6EO9E73JlXLtiy7ha80b2ZVGyacxgfww=
github.com/manuelarte/embeddedstructfieldcheck v0.4.0/go.mod h1:z8dFSyXqp+fC6NLDSljRJeNQJJDWnY7RoWFzV3PC6UM=
github.com/manuelarte/funcorder v0.5.0 h1:llMuHXXbg7tD0i/LNw8vGnkDTHFpTnWqKPI85Rknc+8=
@@ -608,6 +683,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mgechev/revive v1.11.0 h1:b/gLLpBE427o+Xmd8G58gSA+KtBwxWinH/A565Awh0w=
github.com/mgechev/revive v1.11.0/go.mod h1:tI0oLF/2uj+InHCBLrrqfTKfjtFTBCFFfG05auyzgdw=
github.com/mgechev/revive v1.12.0 h1:Q+/kkbbwerrVYPv9d9efaPGmAO/NsxwW/nE6ahpQaCU=
github.com/mgechev/revive v1.12.0/go.mod h1:VXsY2LsTigk8XU9BpZauVLjVrhICMOV3k1lpB3CXrp8=
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
@@ -639,8 +716,10 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK
github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs=
github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk=
github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c=
github.com/nunnatsa/ginkgolinter v0.21.2 h1:khzWfm2/Br8ZemX8QM1pl72LwM+rMeW6VUbQ4rzh0Po=
github.com/nunnatsa/ginkgolinter v0.21.2/go.mod h1:GItSI5fw7mCGLPmkvGYrr1kEetZe7B593jcyOpyabsY=
github.com/nunnatsa/ginkgolinter v0.20.0 h1:OmWLkAFO2HUTYcU6mprnKud1Ey5pVdiVNYGO5HVicx8=
github.com/nunnatsa/ginkgolinter v0.20.0/go.mod h1:dCIuFlTPfQerXgGUju3VygfAFPdC5aE1mdacCDKDJcQ=
github.com/nunnatsa/ginkgolinter v0.21.0 h1:IYwuX+ajy3G1MezlMLB1BENRtFj16+Evyi4uki1NOOQ=
github.com/nunnatsa/ginkgolinter v0.21.0/go.mod h1:QlzY9UP9zaqu58FjYxhp9bnjuwXwG1bfW5rid9ChNMw=
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY=
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw=
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c=
@@ -651,10 +730,11 @@ github.com/olekukonko/ll v0.0.9 h1:Y+1YqDfVkqMWuEQMclsF9HUR5+a82+dxJuL1HHSRpxI=
github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g=
github.com/olekukonko/tablewriter v1.0.9 h1:XGwRsYLC2bY7bNd93Dk51bcPZksWZmLYuaTHR0FqfL8=
github.com/olekukonko/tablewriter v1.0.9/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo=
github.com/onsi/ginkgo/v2 v2.26.0 h1:1J4Wut1IlYZNEAWIV3ALrT9NfiaGW2cDCJQSFQMs/gE=
github.com/onsi/ginkgo/v2 v2.26.0/go.mod h1:qhEywmzWTBUY88kfO0BRvX4py7scov9yR+Az2oavUzw=
github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
@@ -706,8 +786,8 @@ github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/quasilyte/go-ruleguard v0.4.4 h1:53DncefIeLX3qEpjzlS1lyUmQoUEeOWPFWqaTJq9eAQ=
github.com/quasilyte/go-ruleguard v0.4.4/go.mod h1:Vl05zJ538vcEEwu16V/Hdu7IYZWyKSwIy4c88Ro1kRE=
github.com/quasilyte/go-ruleguard/dsl v0.3.23 h1:lxjt5B6ZCiBeeNO8/oQsegE6fLeCzuMRoVWSkXC4uvY=
github.com/quasilyte/go-ruleguard/dsl v0.3.23/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE=
github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo=
github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng=
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU=
@@ -725,8 +805,6 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd h1:CmH9+J6ZSsIjUK3dcGsnCnO41eRBOnY12zwkn5qVwgc=
github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk=
github.com/ryancurrah/gomodguard v1.4.1 h1:eWC8eUMNZ/wM/PWuZBv7JxxqT5fiIKSIyTvjb7Elr+g=
github.com/ryancurrah/gomodguard v1.4.1/go.mod h1:qnMJwV1hX9m+YJseXEBhd2s90+1Xn6x9dLz11ualI1I=
github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU=
@@ -739,8 +817,10 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM
github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ=
github.com/sashamelentyev/usestdlibvars v1.29.0 h1:8J0MoRrw4/NAXtjQqTHrbW9NN+3iMf7Knkq057v4XOQ=
github.com/sashamelentyev/usestdlibvars v1.29.0/go.mod h1:8PpnjHMk5VdeWlVb4wCdrB8PNbLqZ3wBZTZWkrpZZL8=
github.com/securego/gosec/v2 v2.22.10 h1:ntbBqdWXnu46DUOXn+R2SvPo3PiJCDugTCgTW2g4tQg=
github.com/securego/gosec/v2 v2.22.10/go.mod h1:9UNjK3tLpv/w2b0+7r82byV43wCJDNtEDQMeS+H/g2w=
github.com/securego/gosec/v2 v2.22.7 h1:8/9P+oTYI4yIpAzccQKVsg1/90Po+JzGtAhqoHImDeM=
github.com/securego/gosec/v2 v2.22.7/go.mod h1:510TFNDMrIPytokyHQAVLvPeDr41Yihn2ak8P+XQfNE=
github.com/securego/gosec/v2 v2.22.8 h1:3NMpmfXO8wAVFZPNsd3EscOTa32Jyo6FLLlW53bexMI=
github.com/securego/gosec/v2 v2.22.8/go.mod h1:ZAw8K2ikuH9qDlfdV87JmNghnVfKB1XC7+TVzk6Utto=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
@@ -761,11 +841,16 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
@@ -793,6 +878,8 @@ github.com/swaggo/http-swagger v1.3.4 h1:q7t/XLx0n15H1Q9/tk3Y9L4n210XzJF5WtnDX64
github.com/swaggo/http-swagger v1.3.4/go.mod h1:9dAh0unqMBAlbp1uE2Uc2mQTxNMU/ha4UbucIg1MFkQ=
github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI=
github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg=
github.com/tdakkota/asciicheck v0.4.1 h1:bm0tbcmi0jezRA2b5kg4ozmMuGAFotKI3RZfrhfovg8=
github.com/tdakkota/asciicheck v0.4.1/go.mod h1:0k7M3rCfRXb0Z6bwgvkEIMleKH3kXNz9UqJ9Xuqopr8=
github.com/tdewolff/minify/v2 v2.24.2 h1:vnY3nTulEAbCAAlxTxPPDkzG24rsq31SOzp63yT+7mo=
github.com/tdewolff/minify/v2 v2.24.2/go.mod h1:1JrCtoZXaDbqioQZfk3Jdmr0GPJKiU7c1Apmb+7tCeE=
github.com/tdewolff/parse/v2 v2.8.3 h1:5VbvtJ83cfb289A1HzRA9sf02iT8YyUwN84ezjkdY1I=
@@ -803,6 +890,8 @@ github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA
github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0=
github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag=
github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY=
github.com/tetafro/godot v1.5.1 h1:PZnjCol4+FqaEzvZg5+O8IY2P3hfY9JzRBNPv1pEDS4=
github.com/tetafro/godot v1.5.1/go.mod h1:cCdPtEndkmqqrhiCfkmxDodMQJ/f3L1BCNskCUZdTwk=
github.com/tetafro/godot v1.5.4 h1:u1ww+gqpRLiIA16yF2PV1CV1n/X3zhyezbNXC3E14Sg=
github.com/tetafro/godot v1.5.4/go.mod h1:eOkMrVQurDui411nBY2FA05EYH01r14LuWY/NrVDVcU=
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
@@ -854,14 +943,18 @@ gitlab.com/bosi/decorder v0.4.2 h1:qbQaV3zgwnBZ4zPMhGLW4KZe7A7NwxEhJx39R3shffo=
gitlab.com/bosi/decorder v0.4.2/go.mod h1:muuhHoaJkA9QLcYHq4Mj8FJUwDZ+EirSHRiaTcTf6T8=
go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ=
go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28=
go-simpler.org/musttag v0.13.1 h1:lw2sJyu7S1X8lc8zWUAdH42y+afdcCnHhWpnkWvd6vU=
go-simpler.org/musttag v0.13.1/go.mod h1:8r450ehpMLQgvpb6sg+hV5Ur47eH6olp/3yEanfG97k=
go-simpler.org/musttag v0.14.0 h1:XGySZATqQYSEV3/YTy+iX+aofbZZllJaqwFWs+RTtSo=
go-simpler.org/musttag v0.14.0/go.mod h1:uP8EymctQjJ4Z1kUnjX0u2l60WfUdQxCwSNKzE1JEOE=
go-simpler.org/sloglint v0.11.1 h1:xRbPepLT/MHPTCA6TS/wNfZrDzkGvCCqUv4Bdwc3H7s=
go-simpler.org/sloglint v0.11.1/go.mod h1:2PowwiCOK8mjiF+0KGifVOT8ZsCNiFzvfyJeJOIt8MQ=
go.augendre.info/arangolint v0.3.1 h1:n2E6p8f+zfXSFLa2e2WqFPp4bfvcuRdd50y6cT65pSo=
go.augendre.info/arangolint v0.3.1/go.mod h1:6ZKzEzIZuBQwoSvlKT+qpUfIbBfFCE5gbAoTg0/117g=
go.augendre.info/fatcontext v0.9.0 h1:Gt5jGD4Zcj8CDMVzjOJITlSb9cEch54hjRRlN3qDojE=
go.augendre.info/fatcontext v0.9.0/go.mod h1:L94brOAT1OOUNue6ph/2HnwxoNlds9aXDF2FcUntbNw=
go.augendre.info/arangolint v0.2.0 h1:2NP/XudpPmfBhQKX4rMk+zDYIj//qbt4hfZmSSTcpj8=
go.augendre.info/arangolint v0.2.0/go.mod h1:Vx4KSJwu48tkE+8uxuf0cbBnAPgnt8O1KWiT7bljq7w=
go.augendre.info/fatcontext v0.8.0 h1:2dfk6CQbDGeu1YocF59Za5Pia7ULeAM6friJ3LP7lmk=
go.augendre.info/fatcontext v0.8.0/go.mod h1:oVJfMgwngMsHO+KB2MdgzcO+RvtNdiCEOlWvSFtax/s=
go.augendre.info/fatcontext v0.8.1 h1:/T4+cCjpL9g71gJpcFAgVo/K5VFpqlN+NPU7QXxD5+A=
go.augendre.info/fatcontext v0.8.1/go.mod h1:r3Qz4ZOzex66wfyyj5VZ1xUcl81vzvHQ6/GWzzlMEwA=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo=
go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
@@ -889,8 +982,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -905,12 +998,14 @@ golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/exp/typeparams v0.0.0-20251002181428-27f1f14c8bb9 h1:EvjuVHWMoRaAxH402KMgrQpGUjoBy/OWvZjLOqQnwNk=
golang.org/x/exp/typeparams v0.0.0-20251002181428-27f1f14c8bb9/go.mod h1:4Mzdyp/6jzw9auFDJ3OMF5qksa7UvPnzKqTVGcb04ms=
golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b h1:KdrhdYPDUvJTvrDK9gdjfFd6JTk8vA1WJoldYSi0kHo=
golang.org/x/exp/typeparams v0.0.0-20250620022241-b7579e27df2b/go.mod h1:LKZHyeOpPuZcMgxeHjJp4p5yvxrCX1xDvH10zYHhjjQ=
golang.org/x/exp/typeparams v0.0.0-20250911091902-df9299821621 h1:Yl4H5w2RV7L/dvSHp2GerziT5K2CORgFINPaMFxWGWw=
golang.org/x/exp/typeparams v0.0.0-20250911091902-df9299821621/go.mod h1:4Mzdyp/6jzw9auFDJ3OMF5qksa7UvPnzKqTVGcb04ms=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.32.0 h1:6lZQWq75h7L5IWNk0r+SCpUJ6tUVd3v4ZHnbRKLkUDQ=
golang.org/x/image v0.32.0/go.mod h1:/R37rrQmKXtO6tYXAjtDLwQgFLHmhW+V6ayXlxzP2Pc=
golang.org/x/image v0.31.0 h1:mLChjE2MV6g1S7oqbXC0/UcKijjm5fnJLUYKIYrLESA=
golang.org/x/image v0.31.0/go.mod h1:R9ec5Lcp96v9FTF+ajwaH3uGxPH4fKfHHAVbUILxghA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -936,8 +1031,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -980,16 +1075,16 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -1060,8 +1155,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -1078,13 +1173,13 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/time v0.13.0 h1:eUlYslOIt32DgYD6utsuUeHs4d7AsEYLuIAdg7FlYgI=
golang.org/x/time v0.13.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
@@ -1117,6 +1212,7 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -1126,17 +1222,20 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM=
golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY=
golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM=
@@ -1254,10 +1353,12 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.6.1 h1:R094WgE8K4JirYjBaOpz/AvTyUu/3wbmAoskKN/pxTI=
honnef.co/go/tools v0.6.1/go.mod h1:3puzxxljPCe8RGJX7BIy1plGbxEOZni5mR2aXe3/uk4=
mvdan.cc/gofumpt v0.9.2 h1:zsEMWL8SVKGHNztrx6uZrXdp7AX8r421Vvp23sz7ik4=
mvdan.cc/gofumpt v0.9.2/go.mod h1:iB7Hn+ai8lPvofHd9ZFGVg2GOr8sBUw1QUWjNbmIL/s=
mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15 h1:ssMzja7PDPJV8FStj7hq9IKiuiKhgz9ErWw+m68e7DI=
mvdan.cc/unparam v0.0.0-20251027182757-5beb8c8f8f15/go.mod h1:4M5MMXl2kW6fivUT6yRGpLLPNfuGtU2Z0cPvFquGDYU=
mvdan.cc/gofumpt v0.8.0 h1:nZUCeC2ViFaerTcYKstMmfysj6uhQrA2vJe+2vwGU6k=
mvdan.cc/gofumpt v0.8.0/go.mod h1:vEYnSzyGPmjvFkqJWtXkh79UwPWP9/HMxQdGEXZHjpg=
mvdan.cc/gofumpt v0.9.1 h1:p5YT2NfFWsYyTieYgwcQ8aKV3xRvFH4uuN/zB2gBbMQ=
mvdan.cc/gofumpt v0.9.1/go.mod h1:3xYtNemnKiXaTh6R4VtlqDATFwBbdXI8lJvH/4qk7mw=
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 h1:WjUu4yQoT5BHT1w8Zu56SP8367OuBV5jvo+4Ulppyf8=
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4/go.mod h1:rthT7OuvRbaGcd5ginj6dA2oLE7YNlta9qhBNNdCaLE=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY=
rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs=
-2
View File
@@ -49,8 +49,6 @@ func createApiKeyHandler(w http.ResponseWriter, r *http.Request, d *requestConte
Api: strings.Contains(permissionsStr, "api") && d.user.Permissions.Api,
Admin: strings.Contains(permissionsStr, "admin") && d.user.Permissions.Admin,
Modify: strings.Contains(permissionsStr, "modify") && d.user.Permissions.Modify,
Delete: strings.Contains(permissionsStr, "delete") && d.user.Permissions.Delete,
Create: strings.Contains(permissionsStr, "create") && d.user.Permissions.Create,
Share: strings.Contains(permissionsStr, "share") && d.user.Permissions.Share,
Realtime: strings.Contains(permissionsStr, "realtime") && d.user.Permissions.Realtime,
}
+25 -76
View File
@@ -28,7 +28,7 @@ import (
// then checks for query parameter
func extractToken(r *http.Request) (string, error) {
hasToken := false
tokenObj, err := r.Cookie("filebrowser_quantum_jwt")
tokenObj, err := r.Cookie("auth")
if err == nil {
hasToken = true
token := tokenObj.Value
@@ -81,10 +81,7 @@ func setupProxyUser(r *http.Request, data *requestContext, proxyUser string) (*u
Username: proxyUser,
}
settings.ApplyUserDefaults(&user)
if user.Username == config.Auth.AdminUsername {
user.Permissions.Admin = true
}
err = storage.CreateUser(user, user.Permissions)
err = storage.CreateUser(user)
if err != nil {
return nil, err
}
@@ -99,13 +96,6 @@ func setupProxyUser(r *http.Request, data *requestContext, proxyUser string) (*u
if data.user.LoginMethod != users.LoginMethodProxy {
return nil, errors.ErrWrongLoginMethod
}
if data.user.Username == config.Auth.AdminUsername && !data.user.Permissions.Admin {
data.user.Permissions.Admin = true
err = store.Users.Update(data.user, true, "Permissions")
if err != nil {
return nil, err
}
}
return data.user, nil
}
@@ -118,11 +108,8 @@ func setupProxyUser(r *http.Request, data *requestContext, proxyUser string) (*u
// @Success 200 {string} string "JWT token for authentication"
// @Failure 403 {object} map[string]string "Forbidden - authentication failed"
// @Failure 500 {object} map[string]string "Internal server error"
// @Router /api/auth/login [post]
// @Router /api/login [post]
func loginHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if d.user.LoginMethod == users.LoginMethodProxy {
return printToken(w, r, d.user)
}
passwordUser := d.user.LoginMethod == users.LoginMethodPassword
enforcedOtp := config.Auth.Methods.PasswordAuth.EnforcedOtp
missingOtp := d.user.TOTPSecret == ""
@@ -142,24 +129,6 @@ func loginHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (in
// @Router /api/auth/logout [post]
func logoutHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
defer auth.RevokeAPIKey(d.token)
// Clear the authentication cookie by setting it to expire in the past
// Get the correct domain for cookie - prefer X-Forwarded-Host from reverse proxy
host := r.Header.Get("X-Forwarded-Host")
if host == "" {
host = r.Host
}
cookie := &http.Cookie{
Name: "filebrowser_quantum_jwt",
Value: "",
Domain: strings.Split(host, ":")[0],
Path: "/",
SameSite: http.SameSiteLaxMode,
Expires: time.Unix(0, 0), // Expire immediately
MaxAge: -1, // Delete cookie
}
http.SetCookie(w, cookie)
logoutUrl := fmt.Sprintf("%vlogin", config.Server.BaseURL) // Default fallback
if d.user != nil && d.user.LoginMethod == users.LoginMethodProxy {
proxyRedirectUrl := config.Auth.Methods.ProxyAuth.LogoutRedirectUrl
@@ -190,44 +159,49 @@ func logoutHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (i
return http.StatusOK, nil
}
type signupBody struct {
Username string `json:"username"`
Password string `json:"password"`
}
// signupHandler registers a new user account.
// @Summary User signup
// @Description Register a new user account with a username and password.
// @Tags Auth
// @Accept json
// @Produce json
// @Param body body signupBody true "User signup details"
// @Success 201 {string} string "User created successfully"
// @Failure 400 {object} map[string]string "Bad request - invalid input"
// @Failure 405 {object} map[string]string "Method not allowed - signup is disabled"
// @Failure 409 {object} map[string]string "Conflict - user already exists"
// @Failure 500 {object} map[string]string "Internal server error"
// @Router /api/auth/signup [post]
// @Router /api/signup [post]
func signupHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if !settings.Config.Auth.Methods.PasswordAuth.Signup {
return http.StatusMethodNotAllowed, fmt.Errorf("signup is disabled")
}
// Get credentials from query parameters
username := r.URL.Query().Get("username")
password := r.URL.Query().Get("password")
// Validate that we have both username and password
if username == "" || password == "" {
return http.StatusBadRequest, fmt.Errorf("username and password are required")
if r.Body == nil {
return http.StatusBadRequest, fmt.Errorf("no post body provided")
}
info := &signupBody{}
err := json.NewDecoder(r.Body).Decode(info)
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid request body: %v", err)
}
user := users.User{
Username: username,
Username: info.Username,
NonAdminEditable: users.NonAdminEditable{
Password: password,
Password: info.Password,
},
LoginMethod: users.LoginMethodPassword,
}
err := storage.CreateUser(user, settings.Config.UserDefaults.Permissions)
user.Permissions = settings.Config.UserDefaults.Permissions
err = storage.CreateUser(user)
if err != nil {
logger.Debug(err.Error())
// Return the actual error message instead of a generic one
return http.StatusBadRequest, err
w.WriteHeader(http.StatusConflict)
return http.StatusConflict, fmt.Errorf("user already exists")
}
return 201, nil
}
@@ -247,39 +221,14 @@ func renewHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (in
return printToken(w, r, d.user)
}
func printToken(w http.ResponseWriter, r *http.Request, user *users.User) (int, error) {
expires := time.Hour * time.Duration(config.Auth.TokenExpirationHours)
signed, err := makeSignedTokenAPI(user, "WEB_TOKEN_"+utils.InsecureRandomIdentifier(4), expires, user.Permissions)
func printToken(w http.ResponseWriter, _ *http.Request, user *users.User) (int, error) {
signed, err := makeSignedTokenAPI(user, "WEB_TOKEN_"+utils.InsecureRandomIdentifier(4), time.Hour*time.Duration(config.Auth.TokenExpirationHours), user.Permissions)
if err != nil {
if strings.Contains(err.Error(), "key already exists with same name") {
return http.StatusConflict, err
}
return 401, errors.ErrUnauthorized
}
// Add 30 minutes buffer so expired token doesn't get automatically deleted by the browser
// This allows backend to identify expired sessions and provide better user feedback
expiresTime := time.Now().Add(expires).Add(time.Minute * 30)
// Set the authentication token as an HTTP cookie
// Get the correct domain for cookie - prefer X-Forwarded-Host from reverse proxy
host := r.Header.Get("X-Forwarded-Host")
if host == "" {
host = r.Host
}
cookie := &http.Cookie{
Name: "filebrowser_quantum_jwt",
Value: signed.Key,
Domain: strings.Split(host, ":")[0], // Set domain to the host without port
Path: "/",
SameSite: http.SameSiteLaxMode,
Expires: expiresTime,
// HttpOnly: true, // Cannot use HttpOnly since frontend needs to read cookie for renew operations
// Secure: true, // Enable this in production with HTTPS
}
http.SetCookie(w, cookie)
// Still return token in body for backward compatibility and state management
w.Header().Set("Content-Type", "text/plain")
if _, err := w.Write([]byte(signed.Key)); err != nil {
return 401, errors.ErrUnauthorized
+1
View File
@@ -0,0 +1 @@
*
+1 -94
View File
@@ -1,12 +1,9 @@
package http
import (
"encoding/json"
"fmt"
"io"
"net/http"
"sync"
"time"
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
"github.com/gtsteffaniak/filebrowser/backend/events"
@@ -29,7 +26,7 @@ func (msgr messenger) sendEvent(eventType, message string) error {
}
func sseHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if !(d.user.Permissions.Realtime || d.user.Permissions.Admin) {
if !d.user.Permissions.Realtime {
return http.StatusForbidden, fmt.Errorf("realtime is disabled for this user")
}
@@ -83,93 +80,3 @@ func sseHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int,
}
}
}
// OnlyOfficeLogContext stores context for OnlyOffice operations
type OnlyOfficeLogContext struct {
Username string
SessionID string
DocumentID string
FilePath string
Source string
ShareHash string
isAdmin bool
StartTime time.Time
}
// OnlyOfficeLogEvent represents a log event for SSE
type OnlyOfficeLogEvent struct {
EventType string `json:"eventType"`
DocumentID string `json:"documentId"`
Username string `json:"username"`
SessionID string `json:"sessionId"`
LogLevel string `json:"logLevel"`
Message string `json:"message"`
Timestamp string `json:"timestamp"`
Component string `json:"component"`
}
// Global map to store OnlyOffice log contexts
var onlyOfficeContexts = make(map[string]*OnlyOfficeLogContext)
var onlyOfficeContextsMutex sync.RWMutex
// Helper functions for OnlyOffice log context management
func createOnlyOfficeLogContext(username, sessionID, documentID, filePath, source, shareHash string, isAdmin bool) *OnlyOfficeLogContext {
return &OnlyOfficeLogContext{
Username: username,
SessionID: sessionID,
DocumentID: documentID,
FilePath: filePath,
Source: source,
ShareHash: shareHash,
StartTime: time.Now(),
isAdmin: isAdmin,
}
}
func storeOnlyOfficeLogContext(documentID string, context *OnlyOfficeLogContext) {
onlyOfficeContextsMutex.Lock()
defer onlyOfficeContextsMutex.Unlock()
onlyOfficeContexts[documentID] = context
}
func getOnlyOfficeLogContext(documentID string) *OnlyOfficeLogContext {
onlyOfficeContextsMutex.RLock()
defer onlyOfficeContextsMutex.RUnlock()
return onlyOfficeContexts[documentID]
}
func removeOnlyOfficeLogContext(documentID string) {
onlyOfficeContextsMutex.Lock()
defer onlyOfficeContextsMutex.Unlock()
delete(onlyOfficeContexts, documentID)
}
func sendOnlyOfficeLogEvent(context *OnlyOfficeLogContext, level, component, message string) {
if context == nil {
return
}
if !context.isAdmin {
return
}
// Create the log event message
logData := map[string]interface{}{
"documentId": context.DocumentID,
"username": context.Username,
"sessionId": context.SessionID,
"logLevel": level,
"message": message,
"timestamp": time.Now().Format(time.RFC3339),
"component": component,
}
// Convert to JSON
jsonData, err := json.Marshal(logData)
if err != nil {
logger.Errorf("Failed to marshal OnlyOffice log event: %v", err)
return
}
// Send to specific user only (not broadcast to all users)
events.SendToUsers("onlyOfficeLog", string(jsonData), []string{context.Username})
}
+10 -26
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"io/fs"
"net/http"
"os"
"text/template"
"time"
@@ -35,34 +36,24 @@ func (d dirFS) Open(name string) (fs.File, error) {
}
var (
store *bolt.BoltStore
config *settings.Settings
assetFs fs.FS
assetPathPrefix string // "img/icons/" for dev, "public/img/icons/" for embedded
store *bolt.BoltStore
config *settings.Settings
assetFs fs.FS
)
func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete chan struct{}) {
store = storage
config = &settings.Config
var err error
// Determine filesystem mode and set asset paths
if settings.Config.Env.EmbeddedFs {
// --- START: ADD THIS DECRYPTION LOGIC ---
if settings.Config.Server.EmbeddedFs {
// Embedded mode: Serve files from the embedded assets
assetFs, err = fs.Sub(assets, "embed")
if err != nil {
logger.Fatal("Could not embed frontend. Does dist exist?")
}
assetPathPrefix = "public/img/icons/"
if config.Frontend.LoginIcon == "" {
config.Frontend.LoginIcon = "embed/public/img/icons/favicon.svg"
}
} else {
// Dev mode: Serve files from http/dist directory
assetFs = dirFS{Dir: http.Dir("http/dist")}
assetPathPrefix = "img/icons/"
if config.Frontend.LoginIcon == "" {
config.Frontend.LoginIcon = "http/dist/img/icons/favicon.svg"
}
}
// In development mode, we want to reload the templates on each request.
@@ -73,12 +64,14 @@ func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete ch
return string(a), err
},
})
if !config.Env.IsDevMode {
devMode := os.Getenv("FILEBROWSER_DEVMODE") == "true"
if !devMode {
templates = template.Must(templates.ParseFS(assetFs, "public/index.html"))
}
templateRenderer = &TemplateRenderer{
templates: templates,
devMode: config.Env.IsDevMode,
devMode: devMode,
}
router := http.NewServeMux()
@@ -147,9 +140,6 @@ func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete ch
publicAPI.HandleFunc("GET /onlyoffice/callback", withHashFile(onlyofficeCallbackHandler))
publicAPI.HandleFunc("GET /onlyoffice/config", withHashFile(onlyofficeClientConfigGetHandler))
publicAPI.HandleFunc("POST /resources", withHashFile(publicUploadHandler))
publicAPI.HandleFunc("PUT /resources", withHashFile(publicPutHandler))
publicAPI.HandleFunc("DELETE /resources", withHashFile(publicDeleteHandler))
publicAPI.HandleFunc("PATCH /resources", withHashFile(publicPatchHandler))
// Settings routes
api.HandleFunc("GET /settings", withAdmin(settingsGetHandler))
@@ -187,12 +177,6 @@ func StartHttp(ctx context.Context, storage *bolt.BoltStore, shutdownComplete ch
staticPrefix := config.Server.BaseURL + "static/"
router.Handle(staticPrefix, http.StripPrefix(staticPrefix, http.HandlerFunc(staticFilesHandler)))
publicRoutes.Handle("GET /static/", http.StripPrefix("/static/", http.HandlerFunc(staticFilesHandler)))
publicRoutes.HandleFunc("GET /static/loginIcon", http.HandlerFunc(loginIconHandler))
// Standard browser favicon and manifest routes
router.HandleFunc("GET /favicon.ico", http.HandlerFunc(faviconHandler))
router.HandleFunc("GET /site.webmanifest", http.HandlerFunc(manifestHandler))
router.HandleFunc("GET /manifest.json", http.HandlerFunc(manifestHandler))
router.HandleFunc(config.Server.BaseURL, withOrWithoutUser(indexHandler))
router.HandleFunc(fmt.Sprintf("GET %vhealth", config.Server.BaseURL), healthHandler)
+33 -29
View File
@@ -103,6 +103,7 @@ func withHashFileHelper(fn handleFunc) handleFunc {
file, err := FileInfoFasterFunc(utils.FileOptions{
Path: utils.JoinPathAsUnix(link.Path, path),
Source: link.Source,
Modify: false,
Expand: true,
Content: getContent,
ExtractEmbeddedSubtitles: settings.Config.Integrations.Media.ExtractEmbeddedSubtitles && link.ExtractEmbeddedSubtitles,
@@ -114,7 +115,7 @@ func withHashFileHelper(fn handleFunc) handleFunc {
file.Token = link.Token
file.Source = ""
file.Hash = link.Hash
if !link.EnableOnlyOffice || link.DisableFileViewer || reachedDownloadsLimit {
if !link.EnableOnlyOffice || !link.DisableFileViewer || reachedDownloadsLimit {
file.OnlyOfficeId = ""
}
if getContent && file.Content != "" {
@@ -157,6 +158,15 @@ func extractUserFromExpiredToken(r *http.Request, data *requestContext) *users.U
return user
}
proxyUser := r.Header.Get(config.Auth.Methods.ProxyAuth.Header)
if config.Auth.Methods.ProxyAuth.Enabled && proxyUser != "" {
user, err := setupProxyUser(r, data, proxyUser)
if err != nil {
return nil
}
return user
}
keyFunc := func(token *jwt.Token) (interface{}, error) {
return []byte(config.Auth.Key), nil
}
@@ -295,7 +305,14 @@ func userWithoutOTPhelper(fn handleFunc) handleFunc {
// Call the actual handler function with the updated context
username := r.URL.Query().Get("username")
password := r.Header.Get("X-Password")
if username == "" || password == "" {
proxyUser := r.Header.Get(config.Auth.Methods.ProxyAuth.Header)
if config.Auth.Methods.ProxyAuth.Enabled && proxyUser != "" {
user, err := setupProxyUser(r, &requestContext{}, proxyUser)
if err != nil {
return 401, errors.ErrUnauthorized
}
d.user = user
} else if username == "" || password == "" {
return withUserHelper(fn)(w, r, d)
} else {
if !config.Auth.Methods.PasswordAuth.Enabled {
@@ -337,34 +354,39 @@ func withUserHelper(fn handleFunc) handleFunc {
return fn(w, r, data)
}
proxyUser := r.Header.Get(config.Auth.Methods.ProxyAuth.Header)
isProxyUser := config.Auth.Methods.ProxyAuth.Enabled && proxyUser != ""
if config.Auth.Methods.ProxyAuth.Enabled && proxyUser != "" {
user, err := setupProxyUser(r, data, proxyUser)
if err != nil {
return http.StatusForbidden, err
}
data.user = user
setUserInResponseWriter(w, data.user)
if fn == nil {
return http.StatusOK, nil
}
return fn(w, r, data)
}
keyFunc := func(token *jwt.Token) (interface{}, error) {
return []byte(config.Auth.Key), nil
}
tokenString, err := extractToken(r)
if err != nil && !isProxyUser {
if err != nil {
return http.StatusUnauthorized, err
}
data.token = tokenString
var tk users.AuthToken
token, err := jwt.ParseWithClaims(tokenString, &tk, keyFunc)
if err != nil {
if isProxyUser {
return getProxyUser(w, r, data, fn, proxyUser)
}
return http.StatusUnauthorized, fmt.Errorf("error processing token, %v", err)
}
if !token.Valid {
return http.StatusUnauthorized, fmt.Errorf("invalid token")
}
if auth.IsRevokedApiKey(data.token) || tk.Expires < time.Now().Unix() {
if isProxyUser {
return getProxyUser(w, r, data, fn, proxyUser)
}
return http.StatusUnauthorized, fmt.Errorf("token expired or revoked")
}
// Check if the token is about to expire and send a header to renew it
if tk.Expires < time.Now().Add(time.Minute*30).Unix() {
if tk.Expires < time.Now().Add(time.Hour).Unix() {
w.Header().Add("X-Renew-Token", "true")
} // Retrieve the user from the store and store it in the context
data.user, err = store.Users.Get(tk.BelongsTo)
@@ -384,24 +406,6 @@ func withUserHelper(fn handleFunc) handleFunc {
}
}
func getProxyUser(w http.ResponseWriter, r *http.Request, data *requestContext, fn handleFunc, proxyUser string) (int, error) {
// proxy user logic
user, err := setupProxyUser(r, data, proxyUser)
if err != nil {
return http.StatusForbidden, err
}
data.user = user
setUserInResponseWriter(w, data.user)
if data.user.Username == "" {
return http.StatusForbidden, errors.ErrUnauthorized
}
// Call the handler function, passing in the context (or return OK if no handler)
if fn == nil {
return http.StatusOK, nil
}
return fn(w, r, data)
}
// Middleware to ensure the user is either the requested user or an admin
func withSelfOrAdminHelper(fn handleFunc) handleFunc {
return withUserHelper(func(w http.ResponseWriter, r *http.Request, data *requestContext) (int, error) {
+1 -1
View File
@@ -117,7 +117,7 @@ func TestWithAdminHelper(t *testing.T) {
t.Fatalf("Error creating request: %v", err)
}
req.AddCookie(&http.Cookie{
Name: "filebrowser_quantum_jwt",
Name: "auth",
Value: token.Key,
})
+9 -21
View File
@@ -300,7 +300,7 @@ func loginWithOidcUser(w http.ResponseWriter, r *http.Request, username string,
if isAdmin {
user.Permissions.Admin = true
}
err = storage.CreateUser(*user, user.Permissions)
err = storage.CreateUser(*user)
if err != nil {
return http.StatusInternalServerError, err
}
@@ -329,10 +329,8 @@ func loginWithOidcUser(w http.ResponseWriter, r *http.Request, username string,
if err = store.Access.SyncUserGroups(username, groups); err != nil {
logger.Warningf("failed to sync oidc user %s groups: %v", username, err)
}
expires := time.Hour * time.Duration(config.Auth.TokenExpirationHours)
// Generate a signed token for the user
signed, err2 := makeSignedTokenAPI(user, "WEB_TOKEN_"+utils.InsecureRandomIdentifier(4), expires, user.Permissions)
signed, err2 := makeSignedTokenAPI(user, "WEB_TOKEN_"+utils.InsecureRandomIdentifier(4), time.Hour*time.Duration(config.Auth.TokenExpirationHours), user.Permissions)
if err2 != nil {
// Handle potential errors during token generation
if strings.Contains(err2.Error(), "key already exists with same name") {
@@ -341,25 +339,15 @@ func loginWithOidcUser(w http.ResponseWriter, r *http.Request, username string,
return http.StatusInternalServerError, fmt.Errorf("failed to generate authentication token for user %s: %v", username, err)
}
// Add 30 minutes buffer so expired token doesn't get automatically deleted by the browser
// This allows backend to identify expired sessions and provide better user feedback
expiresTime := time.Now().Add(expires).Add(time.Minute * 30)
// Set the authentication token as an HTTP cookie
// Get the correct domain for cookie - prefer X-Forwarded-Host from reverse proxy
host := r.Header.Get("X-Forwarded-Host")
if host == "" {
host = r.Host
}
cookie := &http.Cookie{
Name: "filebrowser_quantum_jwt",
Value: signed.Key,
Domain: strings.Split(host, ":")[0], // Set domain to the host without port
Path: "/",
SameSite: http.SameSiteLaxMode, // Lax mode allows cookie on navigation from OIDC provider
Expires: expiresTime,
// HttpOnly: true, // Cannot use HttpOnly since frontend needs to read cookie for renew operations
// Secure: true, // Enable this in production with HTTPS
Name: "auth", // The name of your auth cookie
Value: signed.Key, // The generated token value
Domain: strings.Split(r.Host, ":")[0], // Set domain to the host without port
Path: "/", // Make the cookie available to the whole site
// Secure: true, // Recommended: Set to true in production with HTTPS
// HttpOnly: true, // Recommended: Set to true to prevent client-side script access
Expires: time.Now().Add(time.Hour * time.Duration(config.Auth.TokenExpirationHours)), // Set cookie expiration
}
http.SetCookie(w, cookie)
+75 -278
View File
@@ -22,36 +22,18 @@ import (
)
const (
onlyOfficeStatusDocumentBeingEdited = 1
onlyOfficeStatusDocumentClosedWithChanges = 2
onlyOfficeStatusDocumentSavingError = 3
onlyOfficeStatusDocumentClosedWithNoChanges = 4
onlyOfficeStatusForceSaveWhileDocumentStillOpen = 6
onlyOfficeStatusForceSaveError = 7
)
type OnlyOfficeCallback struct {
Actions []OnlyOfficeAction `json:"actions,omitempty"`
ChangesURL string `json:"changesurl,omitempty"`
FileType string `json:"filetype,omitempty"`
ForceSaveType int `json:"forcesavetype,omitempty"`
FormsDataURL string `json:"formsdataurl,omitempty"`
History *OnlyOfficeHistory `json:"history,omitempty"`
Key string `json:"key,omitempty"`
Status int `json:"status,omitempty"`
URL string `json:"url,omitempty"`
UserData string `json:"userdata,omitempty"`
Users []string `json:"users,omitempty"`
}
type OnlyOfficeAction struct {
Type int `json:"type"`
UserID string `json:"userid"`
}
type OnlyOfficeHistory struct {
Changes interface{} `json:"changes"`
ServerVersion string `json:"serverVersion"`
ChangesURL string `json:"changesurl,omitempty"`
Key string `json:"key,omitempty"`
Status int `json:"status,omitempty"`
URL string `json:"url,omitempty"`
Users []string `json:"users,omitempty"`
UserData string `json:"userdata,omitempty"`
}
// OnlyOfficeJWTPayload represents the JWT payload structure for OnlyOffice callbacks
@@ -72,19 +54,18 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
// Extract clean parameters from request
source := r.URL.Query().Get("source")
providedPath := r.URL.Query().Get("path")
hash := r.URL.Query().Get("hash")
path := r.URL.Query().Get("path")
// Validate required parameters
if (providedPath == "" || source == "") && hash == "" {
logger.Errorf("OnlyOffice callback missing required parameters: source=%s, path=%s", source, providedPath)
if (path == "" || source == "") && d.fileInfo.Hash == "" {
logger.Errorf("OnlyOffice callback missing required parameters: source=%s, path=%s", source, path)
return http.StatusBadRequest, errors.New("missing required parameters: path + source/hash are required")
}
themeMode := utils.Ternary(d.user.DarkMode, "dark", "light")
var sourceInfo *settings.Source
var ok bool
if hash != "" {
sourceInfo, ok = settings.Config.Server.SourceMap[d.share.Source]
if d.fileInfo.Hash != "" {
sourceInfo, ok = settings.Config.Server.SourceMap[source]
if !ok {
logger.Error("OnlyOffice: source not found")
return http.StatusInternalServerError, fmt.Errorf("source not found")
@@ -96,9 +77,7 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
return http.StatusInternalServerError, fmt.Errorf("source not found")
}
}
source = sourceInfo.Name
path := providedPath
if hash == "" {
if d.fileInfo.Hash == "" {
// Build file info based on whether this is a share or regular request
// Regular user request - need to resolve scope
userScope, scopeErr := settings.GetScopeFromSourceName(d.user.Scopes, source)
@@ -106,22 +85,23 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
logger.Errorf("OnlyOffice: source %s not available for user %s: %v", source, d.user.Username, scopeErr)
return http.StatusForbidden, fmt.Errorf("source %s is not available", source)
}
path = utils.JoinPathAsUnix(userScope, path)
logger.Debugf("OnlyOffice user request: resolved path=%s", path)
indexPath := utils.JoinPathAsUnix(userScope, path)
logger.Debugf("OnlyOffice user request: resolved path=%s", indexPath)
fileInfo, err := files.FileInfoFaster(utils.FileOptions{
Username: d.user.Username,
Path: path,
Source: source,
Expand: false,
Path: indexPath,
Modify: d.user.Permissions.Modify,
Source: source,
Expand: false,
}, store.Access)
if err != nil {
logger.Errorf("OnlyOffice: failed to get file info for source=%s, path=%s: %v", source, path, err)
logger.Errorf("OnlyOffice: failed to get file info for source=%s, path=%s: %v", source, indexPath, err)
return errToStatus(err), err
}
d.fileInfo = *fileInfo
} else {
source = sourceInfo.Name
// path is index path, so we build from share path
path = utils.JoinPathAsUnix(d.share.Path, providedPath)
path = utils.JoinPathAsUnix(d.share.Path, path)
if d.share.EnforceDarkLightMode == "dark" {
themeMode = "dark"
}
@@ -133,19 +113,23 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
// Determine file type and editing permissions
fileType := strings.TrimPrefix(filepath.Ext(d.fileInfo.Name), ".")
// Determine modify permissions based on whether this is a share or regular request
var modifyPerms bool
if d.fileInfo.Hash != "" && d.share != nil {
// Share request - check share permissions
modifyPerms = d.share.AllowModify
canEdit := iteminfo.CanEditOnlyOffice(d.user.Permissions.Modify, fileType)
canEditMode := utils.Ternary(canEdit, "edit", "view")
if d.fileInfo.Hash != "" {
if d.share.EnableOnlyOfficeEditing {
canEditMode = "edit"
}
}
// For shares, we need to keep track of the original relative path for the callback URL
var callbackPath string
if d.fileInfo.Hash != "" {
// For shares, use the original path parameter (relative to share)
callbackPath = r.URL.Query().Get("path")
} else {
// Regular user request - check user permissions
modifyPerms = d.user.Permissions.Modify
// For regular requests, use the processed path
callbackPath = path
}
canEdit := iteminfo.CanEditOnlyOffice(modifyPerms, fileType)
canEditMode := utils.Ternary(canEdit, "edit", "view")
// Generate document ID for OnlyOffice
documentId, err := getOnlyOfficeId(d.fileInfo.RealPath)
if err != nil {
@@ -153,36 +137,11 @@ func onlyofficeClientConfigGetHandler(w http.ResponseWriter, r *http.Request, d
return http.StatusNotFound, fmt.Errorf("failed to generate document ID: %v", err)
}
// Create and store log context for this OnlyOffice session
sessionID := r.URL.Query().Get("sessionId")
if sessionID == "" {
sessionID = "unknown"
}
shareHash := ""
if d.fileInfo.Hash != "" {
shareHash = d.fileInfo.Hash
}
logContext := createOnlyOfficeLogContext(
d.user.Username,
sessionID,
documentId,
path,
source,
shareHash,
d.user.Permissions.Admin,
)
storeOnlyOfficeLogContext(documentId, logContext)
// Send initial log event with detailed path information
sendOnlyOfficeLogEvent(logContext, "INFO", "config", fmt.Sprintf("OnlyOffice session started for document: %s ", path))
// Build download URL that OnlyOffice server will use
downloadURL := buildOnlyOfficeDownloadURL(source, providedPath, d.fileInfo.Hash, d.token)
downloadURL := buildOnlyOfficeDownloadURL(source, callbackPath, d.fileInfo.Hash, d.token)
// Build callback URL for OnlyOffice to notify us of changes
callbackURL := buildOnlyOfficeCallbackURL(source, providedPath, d.fileInfo.Hash, d.token)
callbackURL := buildOnlyOfficeCallbackURL(source, callbackPath, d.fileInfo.Hash, d.token)
// Build OnlyOffice client configuration
clientConfig := map[string]interface{}{
@@ -297,21 +256,21 @@ func processOnlyOfficeCallback(w http.ResponseWriter, r *http.Request, d *reques
// Validate required parameters
if (path == "" || source == "") && d.fileInfo.Hash == "" {
logger.Errorf("OnlyOffice callback missing required parameters: source=%s, path=%s", source, path)
return returnOnlyOfficeError(w, r, 400, "missing required parameters: path + source/hash are required")
return http.StatusBadRequest, errors.New("missing required parameters: path + source/hash are required")
}
var sourceInfo *settings.Source
var ok bool
if d.fileInfo.Hash != "" {
sourceInfo, ok = settings.Config.Server.SourceMap[d.share.Source]
sourceInfo, ok = settings.Config.Server.SourceMap[source]
if !ok {
logger.Error("OnlyOffice: share source not found")
return returnOnlyOfficeError(w, r, 404, "source not found")
logger.Error("OnlyOffice: source not found")
return http.StatusInternalServerError, fmt.Errorf("source not found")
}
} else {
sourceInfo, ok = settings.Config.Server.NameToSource[source]
if !ok {
logger.Error("OnlyOffice: source not found")
return returnOnlyOfficeError(w, r, 404, "source not found")
return http.StatusInternalServerError, fmt.Errorf("source not found")
}
}
@@ -320,7 +279,7 @@ func processOnlyOfficeCallback(w http.ResponseWriter, r *http.Request, d *reques
userScope, scopeErr := settings.GetScopeFromSourceName(d.user.Scopes, source)
if scopeErr != nil {
logger.Errorf("OnlyOffice callback: source %s not available for user %s: %v", source, d.user.Username, scopeErr)
return returnOnlyOfficeError(w, r, 403, "source not available")
return http.StatusForbidden, fmt.Errorf("source %s is not available", source)
}
path = utils.JoinPathAsUnix(userScope, path)
} else {
@@ -338,185 +297,65 @@ func processOnlyOfficeCallback(w http.ResponseWriter, r *http.Request, d *reques
// When the document is fully closed by all editors,
// the document key should no longer be re-used.
deleteOfficeId(source, path)
// Send log event for document closure and clean up log context
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
statusMsg := "Document closed with changes"
if data.Status == onlyOfficeStatusDocumentClosedWithNoChanges {
statusMsg = "Document closed with no changes"
}
sendOnlyOfficeLogEvent(logContext, "INFO", "callback", statusMsg)
removeOnlyOfficeLogContext(data.Key)
}
}
// Handle document being edited (status 1) - just log for now
if data.Status == onlyOfficeStatusDocumentBeingEdited {
logger.Debugf("OnlyOffice callback: document being edited, key=%s, users=%v", data.Key, data.Users)
// Send log event for document being edited
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "DEBUG", "callback", fmt.Sprintf("Document being edited, users: %v", data.Users))
}
// Handle actions if present
for _, action := range data.Actions {
actionMsg := ""
switch action.Type {
case 0: // User disconnects
actionMsg = fmt.Sprintf("User ID %s disconnected from document", action.UserID)
logger.Debugf("OnlyOffice callback: user ID %s disconnected from document", action.UserID)
case 1: // New user connects
actionMsg = fmt.Sprintf("User ID %s connected to document", action.UserID)
logger.Debugf("OnlyOffice callback: user ID %s connected to document", action.UserID)
case 2: // User clicked forcesave button
actionMsg = fmt.Sprintf("User ID %s clicked forcesave button", action.UserID)
logger.Debugf("OnlyOffice callback: user ID %s clicked forcesave button", action.UserID)
default:
actionMsg = fmt.Sprintf("Unknown action type %d for user ID %s", action.Type, action.UserID)
logger.Debugf("OnlyOffice callback: unknown action type %d for user ID %s", action.Type, action.UserID)
}
// Send log event for action
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "DEBUG", "callback", actionMsg)
}
}
}
// Handle document save operations (status 2, 3, 6, 7)
// Handle document save operations
if data.Status == onlyOfficeStatusDocumentClosedWithChanges ||
data.Status == onlyOfficeStatusDocumentSavingError ||
data.Status == onlyOfficeStatusForceSaveWhileDocumentStillOpen ||
data.Status == onlyOfficeStatusForceSaveError {
data.Status == onlyOfficeStatusForceSaveWhileDocumentStillOpen {
// Log the save operation details
statusDesc := ""
switch data.Status {
case onlyOfficeStatusDocumentClosedWithChanges:
statusDesc = "document closed with changes"
case onlyOfficeStatusDocumentSavingError:
statusDesc = "document saving error"
case onlyOfficeStatusForceSaveWhileDocumentStillOpen:
statusDesc = "force save while document still open"
case onlyOfficeStatusForceSaveError:
statusDesc = "force save error"
}
logger.Debugf("OnlyOffice callback: processing save operation - %s, key=%s, url=%s, forcesavetype=%d",
statusDesc, data.Key, data.URL, data.ForceSaveType)
// Send log event for save operation
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "INFO", "callback", fmt.Sprintf("Processing save operation: %s", statusDesc))
}
// Handle history and changes URL if present
if data.History != nil {
logger.Debugf("OnlyOffice callback: received history data with serverVersion=%s", data.History.ServerVersion)
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "DEBUG", "callback", fmt.Sprintf("Received history data with serverVersion=%s", data.History.ServerVersion))
}
}
if data.ChangesURL != "" {
logger.Debugf("OnlyOffice callback: received changes URL: %s", data.ChangesURL)
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "DEBUG", "callback", "Received changes URL for document history")
}
}
// For status 3 (saving error), don't attempt to save the file
if data.Status == onlyOfficeStatusDocumentSavingError {
logger.Warningf("OnlyOffice callback: document saving error occurred, not attempting to save")
return returnOnlyOfficeSuccess(w, r)
}
// Check share permissions first if this is a share request
if d.fileInfo.Hash != "" {
if !d.share.AllowModify {
logger.Errorf("OnlyOffice callback: edit permission not allowed for this share")
return returnOnlyOfficeError(w, r, 403, "edit permission not allowed for this share")
}
} else {
// Verify user has modify permissions
if !d.user.Permissions.Modify {
logger.Errorf("OnlyOffice callback: user %s lacks modify permissions for path=%s",
d.user.Username, path)
return returnOnlyOfficeError(w, r, 403, "user lacks modify permissions")
}
// Verify user has modify permissions
if !d.user.Permissions.Modify {
logger.Warningf("OnlyOffice callback: user %s lacks modify permissions for source=%s, path=%s",
d.user.Username, source, path)
return http.StatusForbidden, nil
}
// Download the updated document from OnlyOffice server
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")
return http.StatusInternalServerError, err
}
defer doc.Body.Close()
// Check if the download was successful
if doc.StatusCode != 200 {
logger.Errorf("OnlyOffice callback: failed to download document, status code: %d", doc.StatusCode)
return returnOnlyOfficeError(w, r, 500, "failed to download document from OnlyOffice server")
// Resolve file path for writing (same logic as in config handler)
var resolvedPath string
if d.fileInfo.Hash == "" {
// Regular user request - need to resolve scope
userScope, scopeErr := settings.GetScopeFromSourceName(d.user.Scopes, source)
if scopeErr != nil {
logger.Errorf("OnlyOffice callback: source %s not available for user %s: %v",
source, d.user.Username, scopeErr)
return http.StatusForbidden, fmt.Errorf("source %s is not available", source)
}
resolvedPath = utils.JoinPathAsUnix(userScope, path)
}
logger.Debugf("OnlyOffice callback: saving document to path=%s",
path)
// Send detailed log event for file saving with path information
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "INFO", "callback", fmt.Sprintf("Saving document to path: %s", path))
}
// CRITICAL: Validate that the original file still exists before saving
// This prevents creating duplicate files if the original was renamed/moved
_, err = files.FileInfoFaster(utils.FileOptions{
// Write the updated document
fileOpts := utils.FileOptions{
Path: resolvedPath,
Source: source,
Path: path,
}, nil)
if err != nil {
logger.Errorf("OnlyOffice callback: original file no longer exists at path=%s: %v",
path, err)
// Send error log event with path information
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "ERROR", "callback",
fmt.Sprintf("Original file no longer exists at path: %s - %v -- was it renamed or moved?", path, err))
}
return returnOnlyOfficeError(w, r, 404, "original file no longer exists - it may have been renamed or moved")
}
writeErr := files.WriteFile(source, path, doc.Body)
writeErr := files.WriteFile(fileOpts, doc.Body)
if writeErr != nil {
logger.Errorf("OnlyOffice callback: failed to write updated document to path=%s: %v",
path, writeErr)
// Send error log event with path information
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "ERROR", "callback", fmt.Sprintf("Failed to save document to path: %s - %v", path, writeErr))
}
return returnOnlyOfficeError(w, r, 500, "failed to save document")
logger.Errorf("OnlyOffice callback: failed to write updated document: %v", writeErr)
return http.StatusInternalServerError, writeErr
}
logger.Infof("OnlyOffice callback: successfully saved document to path=%s",
path)
// Send success log event with detailed path information
if logContext := getOnlyOfficeLogContext(data.Key); logContext != nil {
sendOnlyOfficeLogEvent(logContext, "INFO", "callback", fmt.Sprintf("Document saved successfully to path: %s", path))
}
}
// Return success response to OnlyOffice server
return returnOnlyOfficeSuccess(w, r)
resp := map[string]int{
"error": 0,
}
return renderJSON(w, r, resp)
}
func onlyofficeCallbackHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
// Parse callback data based on request method
var callbackData *OnlyOfficeCallback
var err error
if r.Method == "GET" {
// OnlyOffice sends callback data in Authorization header as JWT
callbackData, err = parseOnlyOfficeCallbackFromJWT(r)
@@ -524,17 +363,12 @@ func onlyofficeCallbackHandler(w http.ResponseWriter, r *http.Request, d *reques
// OnlyOffice sends callback data in request body as JSON
callbackData, err = parseOnlyOfficeCallbackFromJSON(r)
} else {
return returnOnlyOfficeError(w, r, 405, fmt.Sprintf("unsupported method: %s", r.Method))
return http.StatusMethodNotAllowed, fmt.Errorf("unsupported method: %s", r.Method)
}
if err != nil {
logger.Errorf("OnlyOffice callback: failed to parse callback data: %v", err)
return returnOnlyOfficeError(w, r, 400, "failed to parse callback data")
}
if callbackData == nil {
logger.Errorf("OnlyOffice callback: parsed callback data is nil")
return returnOnlyOfficeError(w, r, 400, "parsed callback data is nil")
return http.StatusBadRequest, err
}
// Process the callback data using shared logic
@@ -659,40 +493,3 @@ func parseOnlyOfficeJWT(tokenString string) (*OnlyOfficeCallback, error) {
return callback, nil
}
// returnOnlyOfficeSuccess returns a success response to OnlyOffice server
func returnOnlyOfficeSuccess(w http.ResponseWriter, r *http.Request) (int, error) {
resp := map[string]int{
"error": 0,
}
return renderJSON(w, r, resp)
}
// returnOnlyOfficeError returns an error response to OnlyOffice server with proper status code
func returnOnlyOfficeError(w http.ResponseWriter, r *http.Request, statusCode int, message string) (int, error) {
// OnlyOffice expects specific error codes in the response body
errorCode := 0
switch statusCode {
case 400:
errorCode = 1 // Bad request
case 403:
errorCode = 1 // Forbidden (treated as bad request by OnlyOffice)
case 404:
errorCode = 1 // Not found (treated as bad request by OnlyOffice)
case 500:
errorCode = 1 // Internal server error (treated as bad request by OnlyOffice)
default:
errorCode = 1 // Default to bad request
}
resp := map[string]interface{}{
"error": errorCode,
}
// Log the error for debugging
logger.Errorf("OnlyOffice callback error (HTTP %d): %s", statusCode, message)
// Set the appropriate HTTP status code
w.WriteHeader(statusCode)
return renderJSON(w, r, resp)
}
+3 -8
View File
@@ -16,7 +16,6 @@ import (
"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/database/access"
"github.com/gtsteffaniak/filebrowser/backend/indexing"
"github.com/gtsteffaniak/filebrowser/backend/indexing/iteminfo"
"github.com/gtsteffaniak/filebrowser/backend/preview"
@@ -110,7 +109,7 @@ func rawFileHandler(w http.ResponseWriter, r *http.Request, file iteminfo.Extend
// getDirectoryPreview finds a valid preview file within a directory.
// It iterates through files, checking if they should bubble up to folder previews,
// and returns the first valid, non-corrupted file suitable for preview.
func getDirectoryPreview(r *http.Request, d *requestContext, accessStore *access.Storage) (*iteminfo.ExtendedFileInfo, error) {
func getDirectoryPreview(r *http.Request, d *requestContext) (*iteminfo.ExtendedFileInfo, error) {
var lastErr error
for _, item := range d.fileInfo.Files {
@@ -139,7 +138,7 @@ func getDirectoryPreview(r *http.Request, d *requestContext, accessStore *access
Path: path,
Source: source,
Metadata: true,
}, accessStore)
}, store.Access)
if err != nil {
lastErr = err
continue // Try next file if this one fails
@@ -178,13 +177,9 @@ func previewHelperFunc(w http.ResponseWriter, r *http.Request, d *requestContext
if !d.fileInfo.HasPreview {
return http.StatusBadRequest, fmt.Errorf("this item does not have a preview")
}
accessStore := store.Access
if d.share != nil {
accessStore = nil
}
if d.fileInfo.Type == "directory" {
// Get extended file info of first previewable item in directory
fileInfo, err := getDirectoryPreview(r, d, accessStore)
fileInfo, err := getDirectoryPreview(r, d)
if err != nil {
return http.StatusInternalServerError, err
}
+14 -190
View File
@@ -8,12 +8,8 @@ import (
"path/filepath"
"strings"
"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/indexing"
"github.com/gtsteffaniak/filebrowser/backend/preview"
"github.com/gtsteffaniak/go-logger/logger"
_ "github.com/gtsteffaniak/filebrowser/backend/swagger/docs"
@@ -41,11 +37,6 @@ func publicRawHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
return http.StatusNotImplemented, fmt.Errorf("downloads are disabled for upload shares")
}
// Check DisableDownload permission for normal shares
if d.share.DisableDownload {
return http.StatusForbidden, fmt.Errorf("downloads are not allowed for this share")
}
// Check global download limit (if not using per-user limits)
if !d.share.PerUserDownloadLimit && d.share.DownloadsLimit > 0 && d.share.Downloads >= d.share.DownloadsLimit {
return http.StatusForbidden, fmt.Errorf("share downloads limit reached")
@@ -112,9 +103,6 @@ func publicRawHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
var status int
status, err = rawFilesHandler(w, r, d, fileList)
if err != nil {
if err == errors.ErrDownloadNotAllowed {
return http.StatusForbidden, errors.ErrDownloadNotAllowed
}
logger.Errorf("public share handler: error processing filelist: '%v' with error %v", f, err)
return status, fmt.Errorf("error processing filelist: %v", f)
}
@@ -162,28 +150,22 @@ func publicGetResourceHandler(w http.ResponseWriter, r *http.Request, d *request
// @Failure 501 {object} map[string]string "Uploading disabled for non-upload shares"
// @Router /public/api/resources [post]
func publicUploadHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if d.share.ShareType != "upload" && !d.share.AllowCreate {
return http.StatusForbidden, fmt.Errorf("uploading is disabled for this share")
if d.share.ShareType != "upload" {
return http.StatusNotImplemented, fmt.Errorf("uploading is disabled for non-upload shares")
}
if !d.share.AllowReplacements && r.URL.Query().Get("action") == "override" {
return http.StatusForbidden, fmt.Errorf("cannot overwrite files for this share")
}
path, err := url.QueryUnescape(r.URL.Query().Get("targetPath"))
if err != nil {
logger.Debugf("invalid path encoding: %v", err)
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
fullPath := filepath.Join(d.share.Path, path)
fullPath := filepath.Join(d.share.Path, r.URL.Query().Get("targetPath"))
source := config.Server.SourceMap[d.share.Source].Name
logger.Infof("public upload handler: fullPath: '%v' for share: '%v' with source: '%v'", fullPath, d.share.Source, source)
// adjust query params to match resourcePostHandler
q := r.URL.Query()
q.Set("source", source)
q.Set("path", fullPath)
r.URL.RawQuery = q.Encode()
status, err := resourcePostHandler(w, r, d)
if err != nil {
logger.Errorf("public upload handler: error uploading with error %v", err)
logger.Errorf("public upload handler: error uploading: '%v' with error %v", d.fileInfo, err)
return http.StatusInternalServerError, fmt.Errorf("upload failure occured on backend")
}
return status, err
@@ -233,19 +215,15 @@ func publicPreviewHandler(w http.ResponseWriter, r *http.Request, d *requestCont
// Restore source name from share for preview generation
// The middleware clears file.Source for security, but we need it for index lookups
source, err := d.share.GetSourceName()
if err != nil {
return http.StatusNotFound, fmt.Errorf("source not available")
if d.fileInfo.Source == "" && d.share != nil {
sourceInfo, ok := settings.Config.Server.SourceMap[d.share.Source]
if !ok {
// Don't expose internal errors to share users
return http.StatusNotFound, fmt.Errorf("resource not available")
}
d.fileInfo.Source = sourceInfo.Name
}
fileInfo, err := FileInfoFasterFunc(utils.FileOptions{
Path: utils.JoinPathAsUnix(d.share.Path, d.fileInfo.Path),
Source: source,
Metadata: true,
}, nil)
if err != nil {
return http.StatusNotFound, fmt.Errorf("resource not available")
}
d.fileInfo = *fileInfo
status, err := previewHelperFunc(w, r, d)
if err != nil {
// Obfuscate errors for shares to prevent information leakage
@@ -253,157 +231,3 @@ func publicPreviewHandler(w http.ResponseWriter, r *http.Request, d *requestCont
}
return status, err
}
// publicPutHandler handles the PUT request for a public share.
// @Summary Update a file in a public share
// @Description Updates the content of a file in a public share.
// @Tags Public Shares
// @Accept json
// @Produce json
// @Param hash query string true "Share hash for authentication"
// @Param path query string true "Path to the file to update"
// @Param content body string true "New content for the file"
// @Success 200 {object} map[string]string "File updated successfully"
// @Failure 400 {object} map[string]string "Invalid request or parameters"
// @Failure 403 {object} map[string]string "Share unavailable or update not allowed"
// @Failure 404 {object} map[string]string "Share not found or file not found"
// @Failure 500 {object} map[string]string "Internal server error"
// @Router /public/api/resources [put]
func publicPutHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
// update path to be the source path
if !d.share.AllowModify {
return http.StatusForbidden, fmt.Errorf("create is not allowed for this share")
}
source, err := d.share.GetSourceName()
if err != nil {
return http.StatusNotFound, fmt.Errorf("source not available")
}
if !d.share.AllowModify {
return http.StatusForbidden, fmt.Errorf("edit permission not allowed for this share")
}
path := r.URL.Query().Get("path")
// Decode the URL-encoded path
path, err = url.QueryUnescape(path)
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
resolvedPath := utils.JoinPathAsUnix(d.share.Path, path)
err = files.WriteFile(source, resolvedPath, r.Body)
return errToStatus(err), err
}
func publicDeleteHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if !d.share.AllowDelete {
return http.StatusForbidden, fmt.Errorf("delete is not allowed for this share")
}
// TODO source := r.URL.Query().Get("source")
encodedPath := r.URL.Query().Get("path")
// Decode the URL-encoded path
path, err := url.QueryUnescape(encodedPath)
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
indexPath := utils.JoinPathAsUnix(d.share.Path, path)
source, err := d.share.GetSourceName()
if err != nil {
return http.StatusNotFound, fmt.Errorf("source not available")
}
fileInfo, err := files.FileInfoFaster(utils.FileOptions{
Username: d.user.Username,
Path: indexPath,
Source: source,
Expand: false,
}, nil)
if err != nil {
return http.StatusNotFound, fmt.Errorf("resource not available")
}
// delete thumbnails
preview.DelThumbs(r.Context(), *fileInfo)
err = files.DeleteFiles(source, fileInfo.RealPath, filepath.Dir(fileInfo.RealPath))
if err != nil {
return http.StatusInternalServerError, fmt.Errorf("an error occured while deleting the resource")
}
return http.StatusOK, nil
}
func publicPatchHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if !d.share.AllowModify {
return http.StatusForbidden, fmt.Errorf("edit permission not allowed for this share")
}
// The middleware clears file.Source for security, but we need it for index lookups
source, err := d.share.GetSourceName()
if err != nil {
return http.StatusNotFound, fmt.Errorf("source not available")
}
action := r.URL.Query().Get("action")
encodedFrom := r.URL.Query().Get("from")
// Decode the URL-encoded path
src, err := url.QueryUnescape(encodedFrom)
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
dst := r.URL.Query().Get("destination")
dst, err = url.QueryUnescape(dst)
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
idx := indexing.GetIndex(source)
if idx == nil {
return http.StatusNotFound, fmt.Errorf("source for share not found")
}
// get full paths for both locations
srcFullPath := utils.JoinPathAsUnix(d.share.Path, src)
if srcFullPath == "/" {
return http.StatusForbidden, fmt.Errorf("an error occured accessing the share")
}
dstFullPath := utils.JoinPathAsUnix(d.share.Path, dst)
if dstFullPath == "/" {
return http.StatusForbidden, fmt.Errorf("an error occured accessing the share")
}
// get real source and isDir
realSrc, isSrcDir, err := idx.GetRealPath(srcFullPath)
if err != nil {
return http.StatusNotFound, err
}
// get real destination and isDir parent
parentRealDest, _, err := idx.GetRealPath(filepath.Dir(dstFullPath))
if err != nil {
return http.StatusNotFound, err
}
dstFullPath = parentRealDest + "/" + filepath.Base(dst)
rename := r.URL.Query().Get("rename") == "true"
if rename {
dstFullPath = addVersionSuffix(dstFullPath)
}
// Validate move/rename operation to prevent circular references
if action == "rename" || action == "move" {
err = validateMoveOperation(realSrc, dstFullPath, isSrcDir)
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid move or rename operation")
}
}
err = patchAction(r.Context(), patchActionParams{
action: action,
srcIndex: source,
dstIndex: source,
src: realSrc,
dst: dstFullPath,
d: d,
isSrcDir: isSrcDir,
})
if err != nil {
logger.Debugf("Could not run patch action. src=%v dst=%v err=%v", realSrc, dstFullPath, err)
return http.StatusInternalServerError, fmt.Errorf("an error occured while processing the request")
}
return http.StatusOK, nil
}
+6 -86
View File
@@ -19,7 +19,6 @@ import (
"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"
"github.com/gtsteffaniak/go-logger/logger"
"golang.org/x/time/rate"
)
@@ -111,20 +110,12 @@ func addFile(path string, d *requestContext, tarWriter *tar.Writer, zipWriter *z
if idx == nil {
return fmt.Errorf("source %s is not available", source)
}
if d.share != nil {
_, err = files.FileInfoFaster(utils.FileOptions{
Path: path,
Source: source,
Expand: false,
}, nil)
} else {
_, err = files.FileInfoFaster(utils.FileOptions{
Username: d.user.Username,
Path: path,
Source: source,
Expand: false,
}, store.Access)
}
_, err = files.FileInfoFaster(utils.FileOptions{
Username: d.user.Username,
Path: path,
Source: source,
Expand: false,
}, store.Access)
if err != nil {
return err
}
@@ -241,9 +232,6 @@ func addSingleFile(realPath, archivePath string, zipWriter *zip.Writer, tarWrite
}
func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext, fileList []string) (int, error) {
if !d.user.Permissions.Download && d.share == nil {
return http.StatusForbidden, fmt.Errorf("user is not allowed to download")
}
splitFile := strings.Split(fileList[0], "::")
if len(splitFile) != 2 {
return http.StatusBadRequest, fmt.Errorf("invalid file in files request: %v", fileList[0])
@@ -255,31 +243,9 @@ func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext,
var err error
var userscope string
fileName := filepath.Base(firstFilePath)
// Check if this is an OnlyOffice file early for error logging
isOnlyOffice := isOnlyOfficeCompatibleFile(fileName) && config.Integrations.OnlyOffice.Url != ""
var documentId string
var logContext *OnlyOfficeLogContext
if d.share == nil {
userscope, err = settings.GetScopeFromSourceName(d.user.Scopes, firstFileSource)
if err != nil {
// Send OnlyOffice error log if this was an OnlyOffice file
if isOnlyOffice {
// Try to get document ID for error logging
idx := indexing.GetIndex(firstFileSource)
if idx != nil {
tempPath := utils.JoinPathAsUnix(userscope, firstFilePath)
if realPath, _, realErr := idx.GetRealPath(tempPath); realErr == nil {
if docId, _ := getOnlyOfficeId(realPath); docId != "" {
if ctx := getOnlyOfficeLogContext(docId); ctx != nil {
sendOnlyOfficeLogEvent(ctx, "ERROR", "download",
fmt.Sprintf("OnlyOffice download failed - source not available: %s - %v", firstFilePath, err))
}
}
}
}
}
return http.StatusForbidden, err
}
firstFilePath = utils.JoinPathAsUnix(userscope, firstFilePath)
@@ -287,24 +253,10 @@ func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext,
// For shares, the path is already correctly resolved by publicRawHandler
idx := indexing.GetIndex(firstFileSource)
if idx == nil {
// Send OnlyOffice error log if this was an OnlyOffice file
if isOnlyOffice {
sendOnlyOfficeLogEvent(logContext, "ERROR", "download",
fmt.Sprintf("OnlyOffice download failed - source index not available: %s", firstFileSource))
}
return http.StatusInternalServerError, fmt.Errorf("source %s is not available", firstFileSource)
}
realPath, isDir, err := idx.GetRealPath(firstFilePath)
if err != nil {
// Send OnlyOffice error log if this was an OnlyOffice file
if isOnlyOffice {
if docId, _ := getOnlyOfficeId(realPath); docId != "" {
if ctx := getOnlyOfficeLogContext(docId); ctx != nil {
sendOnlyOfficeLogEvent(ctx, "ERROR", "download",
fmt.Sprintf("OnlyOffice download failed - could not resolve path: %s - %v", firstFilePath, err))
}
}
}
return http.StatusInternalServerError, err
}
// Compute estimated download size
@@ -314,21 +266,8 @@ func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext,
}
// ** Single file download with Content-Length **
if len(fileList) == 1 && !isDir {
// Get document ID and log context for OnlyOffice downloads
if isOnlyOffice {
documentId, _ = getOnlyOfficeId(realPath)
if documentId != "" {
logContext = getOnlyOfficeLogContext(documentId)
}
}
fd, err2 := os.Open(realPath)
if err2 != nil {
// Send OnlyOffice error log if this was an OnlyOffice download
if isOnlyOffice && logContext != nil {
sendOnlyOfficeLogEvent(logContext, "ERROR", "download",
fmt.Sprintf("OnlyOffice download failed - could not open file: %s - %v", firstFilePath, err2))
}
return http.StatusInternalServerError, err2
}
defer fd.Close()
@@ -336,23 +275,9 @@ func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext,
// Get file size
fileInfo, err2 := fd.Stat()
if err2 != nil {
// Send OnlyOffice error log if this was an OnlyOffice download
if isOnlyOffice && logContext != nil {
sendOnlyOfficeLogEvent(logContext, "ERROR", "download",
fmt.Sprintf("OnlyOffice download failed - could not get file info: %s - %v", firstFilePath, err2))
}
return http.StatusInternalServerError, err2
}
// Send success log for OnlyOffice downloads
if isOnlyOffice && logContext != nil {
logger.Infof("OnlyOffice Server is downloading file: %s (documentId: %s)",
firstFilePath, documentId)
sendOnlyOfficeLogEvent(logContext, "INFO", "download",
fmt.Sprintf("OnlyOffice Server downloading file: %s", firstFilePath))
}
// Set headers
setContentDisposition(w, r, fileName)
w.Header().Set("Cache-Control", "private")
@@ -542,8 +467,3 @@ func createTarGz(d *requestContext, tmpDirPath string, filenames ...string) erro
return nil
}
// isOnlyOfficeCompatibleFile checks if a file extension is supported by OnlyOffice
func isOnlyOfficeCompatibleFile(fileName string) bool {
return iteminfo.IsOnlyOffice(fileName)
}
+84 -57
View File
@@ -87,9 +87,13 @@ func resourceGetHandler(w http.ResponseWriter, r *http.Request, d *requestContex
userscope = strings.TrimRight(userscope, "/")
scopePath := utils.JoinPathAsUnix(userscope, path)
getContent := r.URL.Query().Get("content") == "true"
if d.share != nil && d.share.DisableFileViewer {
getContent = false
}
fileInfo, err := files.FileInfoFaster(utils.FileOptions{
Username: d.user.Username,
Path: scopePath,
Modify: d.user.Permissions.Modify,
Source: source,
Expand: true,
Content: getContent,
@@ -98,9 +102,6 @@ func resourceGetHandler(w http.ResponseWriter, r *http.Request, d *requestContex
if err != nil {
return errToStatus(err), err
}
if !d.user.Permissions.Download && fileInfo.Content != "" {
return http.StatusForbidden, fmt.Errorf("user is not allowed to get content, requires download permission")
}
if userscope != "/" {
fileInfo.Path = strings.TrimPrefix(fileInfo.Path, userscope)
}
@@ -122,7 +123,6 @@ func resourceGetHandler(w http.ResponseWriter, r *http.Request, d *requestContex
} else if err != nil {
return http.StatusInternalServerError, err
}
fileInfo.Checksums = make(map[string]string)
fileInfo.Checksums[algo] = checksum
}
return renderJSON(w, r, fileInfo)
@@ -143,11 +143,6 @@ func resourceGetHandler(w http.ResponseWriter, r *http.Request, d *requestContex
// @Failure 500 {object} map[string]string "Internal server error"
// @Router /api/resources [delete]
func resourceDeleteHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
if !d.user.Permissions.Delete {
return http.StatusForbidden, fmt.Errorf("user is not allowed to delete")
}
// TODO source := r.URL.Query().Get("source")
encodedPath := r.URL.Query().Get("path")
source := r.URL.Query().Get("source")
@@ -174,6 +169,7 @@ func resourceDeleteHandler(w http.ResponseWriter, r *http.Request, d *requestCon
Username: d.user.Username,
Path: utils.JoinPathAsUnix(userscope, path),
Source: source,
Modify: d.user.Permissions.Modify,
Expand: false,
}, store.Access)
if err != nil {
@@ -208,45 +204,45 @@ func resourceDeleteHandler(w http.ResponseWriter, r *http.Request, d *requestCon
// @Router /api/resources [post]
func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
path := r.URL.Query().Get("path")
unescapedPath := path
source := r.URL.Query().Get("source")
var err error
accessStore := store.Access
// if share is not nil, then set accessStore to nil
// decode url encoded source name
source, err = url.QueryUnescape(source)
if err != nil {
logger.Debugf("invalid source encoding: %v", err)
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
}
path, err = url.QueryUnescape(path)
if err != nil {
logger.Debugf("invalid path encoding: %v", err)
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
shareUpload := false
if d.share != nil {
accessStore = nil
} else {
// decode url encoded source name
source, err = url.QueryUnescape(source)
if err != nil {
logger.Debugf("invalid source encoding: %v", err)
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
if d.share.ShareType == "upload" {
shareUpload = true
}
unescapedPath, err = url.QueryUnescape(path)
if err != nil {
logger.Debugf("invalid path encoding: %v", err)
return http.StatusBadRequest, fmt.Errorf("invalid path encoding: %v", err)
}
if !d.user.Permissions.Create {
return http.StatusForbidden, fmt.Errorf("user is not allowed to create or modify")
}
userscope := ""
// Determine if this is a directory or file based on trailing slash
// Strip trailing slash from userscope to prevent double slashes
userscope, err = settings.GetScopeFromSourceName(d.user.Scopes, source)
if err != nil {
logger.Debugf("error getting scope from source name: %v", err)
return http.StatusForbidden, err
}
userscope = strings.TrimRight(userscope, "/")
path = utils.JoinPathAsUnix(userscope, unescapedPath)
}
if !d.user.Permissions.Modify && !shareUpload {
logger.Debugf("user is not allowed to create or modify")
return http.StatusForbidden, fmt.Errorf("user is not allowed to create or modify")
}
isDir := strings.HasSuffix(unescapedPath, "/")
// Determine if this is a directory or file based on trailing slash
isDir := strings.HasSuffix(path, "/")
// Strip trailing slash from userscope to prevent double slashes
userscope, err := settings.GetScopeFromSourceName(d.user.Scopes, source)
if err != nil {
logger.Debugf("error getting scope from source name: %v", err)
return http.StatusForbidden, err
}
userscope = strings.TrimRight(userscope, "/")
fileOpts := utils.FileOptions{
Username: d.user.Username,
Path: path,
Path: utils.JoinPathAsUnix(userscope, path),
Source: source,
Modify: d.user.Permissions.Modify,
Expand: false,
}
idx := indexing.GetIndex(source)
@@ -254,10 +250,10 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
logger.Debugf("source %s not found", source)
return http.StatusNotFound, fmt.Errorf("source %s not found", source)
}
realPath, _, _ := idx.GetRealPath(path)
realPath, _, _ := idx.GetRealPath(userscope, path)
// Check access control for the target path
if accessStore != nil && !accessStore.Permitted(idx.Path, path, d.user.Username) {
if store.Access != nil && !store.Access.Permitted(idx.Path, path, d.user.Username) {
return http.StatusForbidden, fmt.Errorf("access denied to path %s", path)
}
@@ -269,7 +265,6 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
// If type mismatch (file vs folder or folder vs file) and not overriding
if existingIsDir != requestingDir && r.URL.Query().Get("override") != "true" {
logger.Debugf("Type conflict detected in chunked: existing is dir=%v, requesting dir=%v at path=%v", existingIsDir, requestingDir, realPath)
return http.StatusConflict, nil
}
}
@@ -316,10 +311,11 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
}
var fileInfo *iteminfo.ExtendedFileInfo
fileInfo, err = files.FileInfoFaster(fileOpts, accessStore)
fileInfo, err = files.FileInfoFaster(fileOpts, store.Access)
if err == nil { // File exists
if r.URL.Query().Get("override") != "true" {
logger.Debugf("resource already exists: %v", fileInfo.RealPath)
logger.Debugf("Resource already exists: %v", fileInfo.RealPath)
return http.StatusConflict, nil
}
// If overriding, delete existing thumbnails
@@ -368,8 +364,8 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
// Move the completed file from the temp location to the final destination
err = fileutils.MoveFile(tempFilePath, realPath)
if err != nil {
logger.Debugf("could not move file from %v to %v: %v", tempFilePath, realPath, err)
return http.StatusInternalServerError, fmt.Errorf("could not move file from chunked folder to destination: %v", err)
logger.Debugf("could not move temp file to destination: %v", err)
return http.StatusInternalServerError, fmt.Errorf("could not move temp file to destination: %v", err)
}
go files.RefreshIndex(source, realPath, false, false) //nolint:errcheck
}
@@ -377,19 +373,30 @@ func resourcePostHandler(w http.ResponseWriter, r *http.Request, d *requestConte
return http.StatusOK, nil
}
fileInfo, err := files.FileInfoFaster(fileOpts, accessStore)
if err == nil { // File exists
if r.URL.Query().Get("override") != "true" {
logger.Debugf("resource already exists: %v", fileInfo.RealPath)
// Check for file/folder conflicts for non-chunked uploads
if stat, statErr := os.Stat(realPath); statErr == nil {
existingIsDir := stat.IsDir()
requestingDir := false // Files are never directories
// If type mismatch (existing dir vs requesting file) and not overriding
if existingIsDir != requestingDir && r.URL.Query().Get("override") != "true" {
return http.StatusConflict, nil
}
// If overriding, delete existing thumbnails
}
fileInfo, err := files.FileInfoFaster(fileOpts, store.Access)
if err == nil {
if r.URL.Query().Get("override") != "true" {
return http.StatusConflict, nil
}
preview.DelThumbs(r.Context(), *fileInfo)
}
err = files.WriteFile(fileOpts.Source, fileOpts.Path, r.Body)
err = files.WriteFile(fileOpts, r.Body)
if err != nil {
logger.Debugf("error writing file: %v", err)
return errToStatus(err), err
}
return http.StatusOK, nil
}
@@ -416,7 +423,9 @@ func resourcePutHandler(w http.ResponseWriter, r *http.Request, d *requestContex
if err != nil {
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
}
if !d.user.Permissions.Modify {
return http.StatusForbidden, fmt.Errorf("user is not allowed to create or modify")
}
encodedPath := r.URL.Query().Get("path")
// Decode the URL-encoded path
@@ -433,6 +442,16 @@ func resourcePutHandler(w http.ResponseWriter, r *http.Request, d *requestContex
if err != nil {
return http.StatusForbidden, err
}
userscope = strings.TrimRight(userscope, "/")
fileOpts := utils.FileOptions{
Username: d.user.Username,
Path: utils.JoinPathAsUnix(userscope, path),
Source: source,
Modify: d.user.Permissions.Modify,
Expand: false,
}
// Check access control for the target path
idx := indexing.GetIndex(source)
if idx == nil {
@@ -443,7 +462,7 @@ func resourcePutHandler(w http.ResponseWriter, r *http.Request, d *requestContex
return http.StatusForbidden, fmt.Errorf("access denied to path %s", path)
}
err = files.WriteFile(source, utils.JoinPathAsUnix(userscope, path), r.Body)
err = files.WriteFile(fileOpts, r.Body)
return errToStatus(err), err
}
@@ -466,7 +485,7 @@ func resourcePutHandler(w http.ResponseWriter, r *http.Request, d *requestContex
// @Router /api/resources [patch]
func resourcePatchHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
action := r.URL.Query().Get("action")
if !d.user.Permissions.Modify && d.share == nil {
if !d.user.Permissions.Modify {
return http.StatusForbidden, fmt.Errorf("user is not allowed to create or modify")
}
@@ -517,7 +536,7 @@ func resourcePatchHandler(w http.ResponseWriter, r *http.Request, d *requestCont
return http.StatusNotFound, fmt.Errorf("source %s not found", dstIndex)
}
// check target dir exists
parentDir, _, err := idx.GetRealPath(userscopeDst, filepath.Dir(dst))
parentDir, isDstDir, err := idx.GetRealPath(userscopeDst, filepath.Dir(dst))
if err != nil {
logger.Debugf("Could not get real path for parent dir: %v %v %v", userscopeDst, filepath.Dir(dst), err)
return http.StatusNotFound, err
@@ -545,10 +564,15 @@ func resourcePatchHandler(w http.ResponseWriter, r *http.Request, d *requestCont
return http.StatusForbidden, fmt.Errorf("access denied to destination path %s", dst)
}
}
overwrite := r.URL.Query().Get("overwrite") == "true"
rename := r.URL.Query().Get("rename") == "true"
if rename {
realDest = addVersionSuffix(realDest)
}
// Permission for overwriting the file
if overwrite && !d.user.Permissions.Modify {
return http.StatusForbidden, fmt.Errorf("forbidden: user does not have permission to overwrite file")
}
// Validate move/rename operation to prevent circular references
if action == "rename" || action == "move" {
@@ -565,6 +589,7 @@ func resourcePatchHandler(w http.ResponseWriter, r *http.Request, d *requestCont
dst: realDest,
d: d,
isSrcDir: isSrcDir,
isDstDir: isDstDir,
})
if err != nil {
logger.Debugf("Could not run patch action. src=%v dst=%v err=%v", realSrc, realDest, err)
@@ -596,12 +621,13 @@ type patchActionParams struct {
dst string
d *requestContext
isSrcDir bool
isDstDir bool
}
func patchAction(ctx context.Context, params patchActionParams) error {
switch params.action {
case "copy":
err := files.CopyResource(params.isSrcDir, params.srcIndex, params.dstIndex, params.src, params.dst)
err := files.CopyResource(params.isSrcDir, params.isDstDir, params.srcIndex, params.dstIndex, params.src, params.dst)
return err
case "rename", "move":
idx := indexing.GetIndex(params.srcIndex)
@@ -614,6 +640,7 @@ func patchAction(ctx context.Context, params patchActionParams) error {
Path: srcPath,
Source: params.srcIndex,
IsDir: params.isSrcDir,
Modify: params.d.user.Permissions.Modify,
}, store.Access)
if err != nil {
@@ -622,7 +649,7 @@ func patchAction(ctx context.Context, params patchActionParams) error {
// delete thumbnails
preview.DelThumbs(ctx, *fileInfo)
return files.MoveResource(params.isSrcDir, params.srcIndex, params.dstIndex, params.src, params.dst, store.Share)
return files.MoveResource(params.isSrcDir, params.isDstDir, params.srcIndex, params.dstIndex, params.src, params.dst, store.Share)
default:
return fmt.Errorf("unsupported action %s: %w", params.action, errors.ErrInvalidRequestParams)
}
+3 -15
View File
@@ -3,7 +3,6 @@ package http
import (
"fmt"
"net/http"
"os"
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
)
@@ -60,27 +59,16 @@ func settingsConfigHandler(w http.ResponseWriter, r *http.Request, d *requestCon
var err error
var yamlConfig string
// Try to read the generated YAML file for comments (should always exist)
var embeddedYaml []byte
var readErr error
if config.Env.EmbeddedFs {
embeddedYaml, readErr = assets.ReadFile("embed/config.generated.yaml")
} else {
embeddedYaml, readErr = os.ReadFile("http/dist/config.generated.yaml")
if config.Server.EmbeddedFs {
embeddedYaml, readErr := assets.ReadFile("embed/config.generated.yaml")
if readErr != nil {
return http.StatusInternalServerError, fmt.Errorf("error reading generated YAML: %v", readErr)
return http.StatusInternalServerError, fmt.Errorf("error reading embedded YAML: %v", readErr)
}
}
// If we successfully read the generated YAML, use it as the comment source
if readErr == nil && len(embeddedYaml) > 0 {
yamlConfig, err = settings.GenerateConfigYamlWithEmbedded(config, showComments, showFull, false, string(embeddedYaml))
if err != nil {
return http.StatusInternalServerError, fmt.Errorf("error generating YAML: %v", err)
}
} else {
// Fallback to Go source parsing if generated YAML doesn't exist
yamlConfig, err = settings.GenerateConfigYaml(config, showComments, showFull, false)
if err != nil {
return http.StatusInternalServerError, fmt.Errorf("error generating YAML: %v", err)
+1 -7
View File
@@ -224,9 +224,6 @@ func sharePostHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
body.Path = s.Path
body.Source = s.Source
s.CommonShare = body.CommonShare
if s.ShareType == "upload" && !body.AllowCreate {
s.AllowCreate = true
}
// Reset download counts if limit settings changed
if shouldResetCounts {
@@ -284,9 +281,6 @@ func sharePostHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
return http.StatusForbidden, fmt.Errorf("path not found: %s", body.Path)
}
}
if body.ShareType == "upload" && !body.AllowCreate {
body.AllowCreate = true
}
body.Source = source.Path // backend source is path
s = &share.Link{
Expire: expire,
@@ -328,7 +322,7 @@ type DirectDownloadResponse struct {
// @Failure 400 {object} map[string]string "Bad request - invalid parameters or path is not a file"
// @Failure 403 {object} map[string]string "Forbidden - access denied"
// @Failure 500 {object} map[string]string "Internal server error"
// @Router /api/share/direct [get]
// @Router /public/share/direct [get]
func shareDirectDownloadHandler(w http.ResponseWriter, r *http.Request, d *requestContext) (int, error) {
// Extract query parameters
encodedPath := r.URL.Query().Get("path")
+13 -171
View File
@@ -41,37 +41,17 @@ func (t *TemplateRenderer) Render(w http.ResponseWriter, name string, data inter
func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestContext, file, contentType string) (int, error) {
w.Header().Set("Content-Type", contentType)
userSelectedTheme := ""
versionString := ""
commitSHAString := ""
externalLinks := config.Frontend.ExternalLinks
if config.Env.IsPlaywright {
versionString = version.Version
commitSHAString = version.CommitSHA
}
if d.user != nil && d.user.Username != "anonymous" {
if d.user != nil {
theme, ok := config.Frontend.Styling.CustomThemeOptions[d.user.CustomTheme]
if ok {
userSelectedTheme = theme.CssRaw
}
versionString = version.Version
commitSHAString = version.CommitSHA
} else if !config.Env.IsPlaywright {
newExternalLinks := []settings.ExternalLink{}
// remove version and commit SHA from external links
for _, link := range externalLinks {
if link.Title == version.CommitSHA {
continue
}
newExternalLinks = append(newExternalLinks, link)
}
externalLinks = newExternalLinks
}
defaultThemeColor := "#455a64"
staticURL := config.Server.BaseURL + "public/static"
description := config.Frontend.Description
title := config.Frontend.Name
// Use custom favicon if configured and validated, otherwise fall back to default
var favicon string
@@ -117,28 +97,18 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
shareProps["disableFileViewer"] = d.share.DisableFileViewer
shareProps["disableShareCard"] = d.share.DisableShareCard
shareProps["disableSidebar"] = d.share.DisableSidebar
shareProps["isPasswordProtected"] = d.share.HasPassword()
shareProps["isPasswordProtected"] = d.share.PasswordHash != ""
shareProps["downloadURL"] = getDownloadURL(r, d.share.Hash)
shareProps["enforceDarkLightMode"] = d.share.EnforceDarkLightMode
shareProps["viewMode"] = d.share.ViewMode
shareProps["enableOnlyOffice"] = d.share.EnableOnlyOffice
shareProps["enableOnlyOfficeEditing"] = d.share.EnableOnlyOfficeEditing
shareProps["shareType"] = utils.Ternary(d.share.ShareType == "", "normal", d.share.ShareType)
shareProps["perUserDownloadLimit"] = d.share.PerUserDownloadLimit
shareProps["extractEmbeddedSubtitles"] = d.share.ExtractEmbeddedSubtitles
shareProps["disableDownload"] = d.share.DisableDownload
shareProps["allowCreate"] = d.share.AllowCreate
shareProps["allowModify"] = d.share.AllowModify
shareProps["allowDelete"] = d.share.AllowDelete
shareProps["allowReplacements"] = d.share.AllowReplacements
shareProps["downloadsLimit"] = d.share.DownloadsLimit
shareProps["shareTheme"] = d.share.ShareTheme
shareProps["disableAnonymous"] = d.share.DisableAnonymous
shareProps["maxBandwidth"] = d.share.MaxBandwidth
shareProps["keepAfterExpiration"] = d.share.KeepAfterExpiration
shareProps["allowedUsernames"] = d.share.AllowedUsernames
shareProps["hideNavButtons"] = d.share.HideNavButtons
// Additional computed properties from extended.go
shareProps["hasPassword"] = d.share.HasPassword()
shareProps["isPermanent"] = d.share.IsPermanent()
shareProps["fileExtension"] = d.share.GetFileExtension()
shareProps["fileName"] = d.share.GetFileName()
@@ -150,16 +120,10 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
}
}
if d.share.Description != "" {
description = d.share.Description
data["description"] = d.share.Description
}
if d.share.Title != "" {
title = d.share.Title
}
if d.share.ShareTheme != "" {
theme, ok := config.Frontend.Styling.CustomThemeOptions[d.share.ShareTheme]
if ok {
userSelectedTheme = theme.CssRaw
}
data["title"] = d.share.Title
}
}
@@ -174,11 +138,8 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
data["winIcon"] = staticURL + "/img/icons/mstile-144x144.png"
data["appIcon"] = staticURL + "/img/icons/android-chrome-256x256.png"
}
// Set login icon URL
loginIcon := staticURL + "/loginIcon"
data["htmlVars"] = map[string]interface{}{
"title": title,
"title": config.Frontend.Name,
"customCSS": config.Frontend.Styling.CustomCSSRaw,
"userSelectedTheme": userSelectedTheme,
"lightBackground": config.Frontend.Styling.LightBackground,
@@ -186,11 +147,10 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
"staticURL": staticURL,
"baseURL": config.Server.BaseURL,
"favicon": favicon,
"loginIcon": loginIcon,
"color": defaultThemeColor,
"winIcon": staticURL + "/img/icons/mstile-144x144.png",
"appIcon": staticURL + "/img/icons/android-chrome-256x256.png",
"description": description,
"description": config.Frontend.Description,
}
// variables consumed by frontend as json
data["globalVars"] = map[string]interface{}{
@@ -199,12 +159,12 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
"disableExternal": config.Frontend.DisableDefaultLinks,
"darkMode": settings.Config.UserDefaults.DarkMode,
"baseURL": config.Server.BaseURL,
"version": versionString,
"commitSHA": commitSHAString,
"version": version.Version,
"commitSHA": version.CommitSHA,
"signup": settings.Config.Auth.Methods.PasswordAuth.Signup,
"noAuth": config.Auth.Methods.NoAuth,
"enableThumbs": !config.Server.DisablePreviews,
"externalLinks": externalLinks,
"externalLinks": config.Frontend.ExternalLinks,
"externalUrl": strings.TrimSuffix(config.Server.ExternalUrl, "/"),
"onlyOfficeUrl": settings.Config.Integrations.OnlyOffice.Url,
"sourceCount": len(config.Server.SourceMap),
@@ -212,13 +172,11 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
"proxyAvailable": config.Auth.Methods.ProxyAuth.Enabled,
"passwordAvailable": config.Auth.Methods.PasswordAuth.Enabled,
"mediaAvailable": config.Integrations.Media.FfmpegPath != "",
"muPdfAvailable": config.Env.MuPdfAvailable,
"muPdfAvailable": config.Server.MuPdfAvailable,
"updateAvailable": utils.GetUpdateAvailableUrl(),
"disableNavButtons": disableNavButtons,
"userSelectableThemes": config.Frontend.Styling.CustomThemeOptions,
"enableHeicConversion": config.Integrations.Media.Convert.ImagePreview[settings.HEICImagePreview],
"eventBasedThemes": !config.Frontend.Styling.DisableEventBasedThemes,
"loginIcon": loginIcon,
}
// Marshal each variable to JSON strings for direct template usage
@@ -242,117 +200,6 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *requestCont
return http.StatusOK, nil
}
func loginIconHandler(w http.ResponseWriter, r *http.Request) {
const maxAge = 86400 // 1 day
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", maxAge))
// Handle custom login icon if configured
if config.Frontend.LoginIcon != "" {
// Check if it's a file path (not embedded)
if _, err := fs.Stat(assetFs, config.Frontend.LoginIcon); err == nil {
// Serve from embedded/dist filesystem
fileContents, err := fs.ReadFile(assetFs, config.Frontend.LoginIcon)
if err == nil {
// Set content type based on file extension
lowerPath := strings.ToLower(config.Frontend.LoginIcon)
if strings.HasSuffix(lowerPath, ".svg") {
w.Header().Set("Content-Type", "image/svg+xml")
} else if strings.HasSuffix(lowerPath, ".png") {
w.Header().Set("Content-Type", "image/png")
} else if strings.HasSuffix(lowerPath, ".jpg") || strings.HasSuffix(lowerPath, ".jpeg") {
w.Header().Set("Content-Type", "image/jpeg")
} else if strings.HasSuffix(lowerPath, ".gif") {
w.Header().Set("Content-Type", "image/gif")
} else if strings.HasSuffix(lowerPath, ".webp") {
w.Header().Set("Content-Type", "image/webp")
} else if strings.HasSuffix(lowerPath, ".ico") {
w.Header().Set("Content-Type", "image/x-icon")
}
_, err = w.Write(fileContents)
if err != nil {
http.NotFound(w, r)
}
return
}
}
}
// Fallback to default favicon icon if custom login icon not found
// Try both paths to support embedded and dev modes
defaultIconPaths := []string{
"img/icons/favicon-256x256.png", // Dev mode path
"public/img/icons/favicon-256x256.png", // Embedded mode path
}
for _, defaultIconPath := range defaultIconPaths {
fileContents, err := fs.ReadFile(assetFs, defaultIconPath)
if err == nil {
w.Header().Set("Content-Type", "image/png")
_, err = w.Write(fileContents)
if err != nil {
http.NotFound(w, r)
}
return
}
}
// If even default icon fails, return 404
http.NotFound(w, r)
}
func faviconHandler(w http.ResponseWriter, r *http.Request) {
const maxAge = 86400 // 1 day
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", maxAge))
// Try to serve custom favicon if configured
if config.Frontend.Favicon != "" {
http.ServeFile(w, r, config.Frontend.Favicon)
return
}
// Serve default favicon.ico using path set at startup
iconPath := assetPathPrefix + "favicon.ico"
fileContents, err := fs.ReadFile(assetFs, iconPath)
if err == nil {
w.Header().Set("Content-Type", "image/x-icon")
_, err = w.Write(fileContents)
if err != nil {
http.NotFound(w, r)
}
return
}
http.NotFound(w, r)
}
func manifestHandler(w http.ResponseWriter, r *http.Request) {
const maxAge = 86400 // 1 day
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", maxAge))
w.Header().Set("Content-Type", "application/manifest+json")
// Read manifest using path set at startup
manifestPath := assetPathPrefix + "site.webmanifest"
fileContents, err := fs.ReadFile(assetFs, manifestPath)
if err != nil {
http.NotFound(w, r)
return
}
// Replace relative paths with baseURL-aware paths
manifestStr := string(fileContents)
baseURL := config.Server.BaseURL
staticURL := baseURL + "public/static/"
// Update the manifest to use the correct baseURL
manifestStr = strings.ReplaceAll(manifestStr, `"start_url": "/"`, fmt.Sprintf(`"start_url": "%s"`, baseURL))
manifestStr = strings.ReplaceAll(manifestStr, `"src": "img/icons/`, fmt.Sprintf(`"src": "%simg/icons/`, staticURL))
_, err = w.Write([]byte(manifestStr))
if err != nil {
http.NotFound(w, r)
}
}
func staticFilesHandler(w http.ResponseWriter, r *http.Request) {
const maxAge = 86400 // 1 day
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%v", maxAge))
@@ -364,11 +211,6 @@ func staticFilesHandler(w http.ResponseWriter, r *http.Request) {
return
}
// Handle site.webmanifest with proper content type
if strings.HasSuffix(r.URL.Path, "site.webmanifest") || strings.HasSuffix(r.URL.Path, "manifest.json") {
w.Header().Set("Content-Type", "application/manifest+json")
}
adjustedCompressed := r.URL.Path + ".gz"
if strings.HasSuffix(r.URL.Path, ".js") {
w.Header().Set("Content-Type", "application/javascript; charset=utf-8") // Set the correct MIME type for JavaScript files
+1 -1
View File
@@ -164,7 +164,7 @@ func usersPostHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
return http.StatusBadRequest, errors.ErrEmptyPassword
}
err = storage.CreateUser(req.User, req.User.Permissions)
err = storage.CreateUser(req.User)
if err != nil {
return http.StatusInternalServerError, err
}
-2
View File
@@ -14,8 +14,6 @@ func errToStatus(err error) int {
return http.StatusOK
case os.IsPermission(err):
return http.StatusForbidden
case errors.Is(err, libErrors.ErrAccessDenied):
return http.StatusForbidden
case os.IsNotExist(err), err == libErrors.ErrNotExist:
return http.StatusNotFound
case os.IsExist(err), err == libErrors.ErrExist:
-576
View File
@@ -1,576 +0,0 @@
package indexing
import (
"testing"
"github.com/gtsteffaniak/filebrowser/backend/common/settings"
)
// setupConditionalTestIndex creates a test index with conditional rules configured
func setupConditionalTestIndex(conditionals settings.ConditionalFilter) *Index {
source := &settings.Source{
Name: "test",
Path: "/test/path",
Config: settings.SourceConfig{
DisableIndexing: false,
Conditionals: conditionals,
},
}
// Build the conditional maps (this is normally done during config loading)
source.Config.ResolvedConditionals = &settings.ResolvedConditionalsConfig{
FileNames: make(map[string]settings.ConditionalIndexConfig),
FolderNames: make(map[string]settings.ConditionalIndexConfig),
FilePaths: make(map[string]settings.ConditionalIndexConfig),
FolderPaths: make(map[string]settings.ConditionalIndexConfig),
NeverWatchPaths: make(map[string]struct{}),
IncludeRootItems: make(map[string]struct{}),
}
// Build maps from ItemRules - match the real setConditionals implementation
resolved := source.Config.ResolvedConditionals
for _, rule := range conditionals.ItemRules {
// Note: FileNames and FolderNames are NOT populated from rules in the real implementation
// They remain empty maps (unused in current implementation)
// Handle exact path matches
if rule.FilePath != "" {
resolved.FilePaths[rule.FilePath] = rule
}
if rule.FolderPath != "" {
resolved.FolderPaths[rule.FolderPath] = rule
}
// Handle StartsWith/EndsWith (stored in slices)
if rule.FileEndsWith != "" {
resolved.FileEndsWith = append(resolved.FileEndsWith, rule)
}
if rule.FolderEndsWith != "" {
resolved.FolderEndsWith = append(resolved.FolderEndsWith, rule)
}
if rule.FileStartsWith != "" {
resolved.FileStartsWith = append(resolved.FileStartsWith, rule)
}
if rule.FolderStartsWith != "" {
resolved.FolderStartsWith = append(resolved.FolderStartsWith, rule)
}
// Handle NeverWatchPath
if rule.NeverWatchPath != "" {
resolved.NeverWatchPaths[rule.NeverWatchPath] = struct{}{}
}
// Handle IncludeRootItem
if rule.IncludeRootItem != "" {
resolved.IncludeRootItems[rule.IncludeRootItem] = struct{}{}
}
}
return &Index{
Source: *source,
mock: true,
}
}
func TestShouldSkip_FolderStartsWith(t *testing.T) {
tests := []struct {
name string
ruleValue string
fullPath string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip folder starting with 'graham'",
ruleValue: "graham", // After normalization (no leading slash)
fullPath: "/graham/", // Full index path
baseName: "graham", // Base name
shouldSkip: true,
description: "Folder 'graham' should be skipped",
},
{
name: "Skip folder starting with 'temp'",
ruleValue: "temp",
fullPath: "/temp/",
baseName: "temp",
shouldSkip: true,
description: "Folder 'temp' should be skipped",
},
{
name: "Skip folder starting with 'tmp-'",
ruleValue: "tmp-",
fullPath: "/tmp-backup/",
baseName: "tmp-backup",
shouldSkip: true,
description: "Folder 'tmp-backup' starts with 'tmp-' and should be skipped",
},
{
name: "Don't skip folder not starting with rule",
ruleValue: "graham",
fullPath: "/other/",
baseName: "other",
shouldSkip: false,
description: "Folder 'other' doesn't start with 'graham'",
},
{
name: "Don't skip folder that contains but doesn't start",
ruleValue: "graham",
fullPath: "/mygraham/",
baseName: "mygraham",
shouldSkip: false,
description: "Folder 'mygraham' contains but doesn't start with 'graham'",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FolderStartsWith: tt.ruleValue},
},
})
result := idx.shouldSkip(true, false, tt.fullPath, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (fullPath=%s, baseName=%s, rule=%s)",
tt.description, tt.shouldSkip, result, tt.fullPath, tt.baseName, tt.ruleValue)
}
})
}
}
func TestShouldSkip_FolderNames(t *testing.T) {
tests := []struct {
name string
ruleValue string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip exact folder name match",
ruleValue: "node_modules",
baseName: "node_modules",
shouldSkip: true,
description: "Exact match should be skipped",
},
{
name: "Skip folder name '@eaDir'",
ruleValue: "@eaDir",
baseName: "@eaDir",
shouldSkip: true,
description: "Synology thumbnail folder should be skipped",
},
{
name: "Don't skip partial match",
ruleValue: "node_modules",
baseName: "node_modules_backup",
shouldSkip: false,
description: "Partial match should not be skipped",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FolderNames: tt.ruleValue},
},
})
// Manually populate FolderNames map since setConditionals doesn't do it
idx.Config.ResolvedConditionals.FolderNames[tt.ruleValue] = settings.ConditionalIndexConfig{FolderNames: tt.ruleValue}
result := idx.shouldSkip(true, false, "/"+tt.baseName+"/", tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (baseName=%s, rule=%s)",
tt.description, tt.shouldSkip, result, tt.baseName, tt.ruleValue)
}
})
}
}
func TestShouldSkip_FolderPaths(t *testing.T) {
tests := []struct {
name string
ruleValue string
fullPath string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip exact folder path",
ruleValue: "/graham/", // Exact path with trailing slash
fullPath: "/graham/", // Full index path
baseName: "graham", // Base name
shouldSkip: true,
description: "Exact path match should be skipped (O(1) lookup)",
},
{
name: "Skip subfolder with prefix matching",
ruleValue: "/graham/",
fullPath: "/graham/subfolder/",
baseName: "subfolder",
shouldSkip: true,
description: "FolderPaths now does prefix matching for child folders",
},
{
name: "Don't skip unrelated path",
ruleValue: "/graham/",
fullPath: "/other/",
baseName: "other",
shouldSkip: false,
description: "Unrelated path should not be skipped",
},
{
name: "Skip nested path and its children",
ruleValue: "/projects/old/",
fullPath: "/projects/old/backup/",
baseName: "backup",
shouldSkip: true,
description: "Nested path under rule should be skipped",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FolderPath: tt.ruleValue},
},
})
result := idx.shouldSkip(true, false, tt.fullPath, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (fullPath=%s, baseName=%s, rule=%s)",
tt.description, tt.shouldSkip, result, tt.fullPath, tt.baseName, tt.ruleValue)
}
})
}
}
func TestShouldSkip_FileStartsWith(t *testing.T) {
tests := []struct {
name string
ruleValue string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip file starting with 'Docker'",
ruleValue: "Docker", // After normalization (no leading slash)
baseName: "Docker.dmg",
shouldSkip: true,
description: "File 'Docker.dmg' should be skipped",
},
{
name: "Skip file starting with '.'",
ruleValue: ".",
baseName: ".DS_Store",
shouldSkip: true,
description: "Hidden file should be skipped",
},
{
name: "Don't skip file not starting with rule",
ruleValue: "tmp",
baseName: "document.txt",
shouldSkip: false,
description: "File not starting with 'tmp' should not be skipped",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FileStartsWith: tt.ruleValue},
},
})
result := idx.shouldSkip(false, false, "/"+tt.baseName, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (baseName=%s, rule=%s)",
tt.description, tt.shouldSkip, result, tt.baseName, tt.ruleValue)
}
})
}
}
func TestShouldSkip_FileEndsWith(t *testing.T) {
tests := []struct {
name string
ruleValue string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip file ending with '.tmp'",
ruleValue: ".tmp",
baseName: "document.tmp",
shouldSkip: true,
description: "Temporary file should be skipped",
},
{
name: "Skip file ending with '~'",
ruleValue: "~",
baseName: "document.txt~",
shouldSkip: true,
description: "Backup file should be skipped",
},
{
name: "Don't skip file with different extension",
ruleValue: ".tmp",
baseName: "document.txt",
shouldSkip: false,
description: "Regular file should not be skipped",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FileEndsWith: tt.ruleValue},
},
})
result := idx.shouldSkip(false, false, "/"+tt.baseName, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (baseName=%s, rule=%s)",
tt.description, tt.shouldSkip, result, tt.baseName, tt.ruleValue)
}
})
}
}
func TestShouldSkip_FilePaths(t *testing.T) {
tests := []struct {
name string
ruleValue string
fullPath string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip exact file path",
ruleValue: "/config.txt",
fullPath: "/config.txt",
baseName: "config.txt",
shouldSkip: true,
description: "Exact file path match should be skipped (O(1) lookup)",
},
{
name: "Skip file in excluded folder with prefix matching",
ruleValue: "/logs",
fullPath: "/logs/app.log",
baseName: "app.log",
shouldSkip: true,
description: "FilePaths now does prefix matching for files in excluded folders",
},
{
name: "Don't skip file in different folder",
ruleValue: "/logs",
fullPath: "/data/file.txt",
baseName: "file.txt",
shouldSkip: false,
description: "File in different folder should not be skipped",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FilePath: tt.ruleValue},
},
})
result := idx.shouldSkip(false, false, tt.fullPath, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (fullPath=%s, rule=%s)",
tt.description, tt.shouldSkip, result, tt.fullPath, tt.ruleValue)
}
})
}
}
func TestShouldSkip_FileInExcludedFolderPath(t *testing.T) {
// Test that files in excluded folder paths are also skipped
// Uses FilePaths rule which applies to both the folder and its files via prefix matching
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FilePath: "/graham/"},
},
})
tests := []struct {
fullPath string
baseName string
shouldSkip bool
reason string
}{
{"/graham/file.txt", "file.txt", true, "File in excluded folder should be skipped"},
{"/graham/subfolder/file.txt", "file.txt", true, "File in subfolder of excluded folder should be skipped"},
{"/other/file.txt", "file.txt", false, "File in different folder should not be skipped"},
}
for _, tt := range tests {
result := idx.shouldSkip(false, false, tt.fullPath, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("File %s (%s): expected shouldSkip=%v, got %v",
tt.fullPath, tt.reason, tt.shouldSkip, result)
}
}
}
func TestShouldSkip_MultipleRules(t *testing.T) {
// Test that multiple rules work together
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FolderStartsWith: "temp"},
{FolderStartsWith: "tmp"},
{FolderNames: "node_modules"},
{FolderNames: "@eaDir"},
{FileStartsWith: "."},
{FileEndsWith: ".tmp"},
{FileEndsWith: "~"},
},
})
// Manually populate FolderNames map
idx.Config.ResolvedConditionals.FolderNames["node_modules"] = settings.ConditionalIndexConfig{FolderNames: "node_modules"}
idx.Config.ResolvedConditionals.FolderNames["@eaDir"] = settings.ConditionalIndexConfig{FolderNames: "@eaDir"}
tests := []struct {
isDir bool
fullPath string
baseName string
shouldSkip bool
reason string
}{
// Folders
{true, "/temp/", "temp", true, "starts with temp"},
{true, "/tmp-backup/", "tmp-backup", true, "starts with tmp"},
{true, "/node_modules/", "node_modules", true, "exact name match"},
{true, "/@eaDir/", "@eaDir", true, "exact name match"},
{true, "/regular/", "regular", false, "no rule matches"},
// Files
{false, "/.DS_Store", ".DS_Store", true, "starts with ."},
{false, "/file.tmp", "file.tmp", true, "ends with .tmp"},
{false, "/file.txt~", "file.txt~", true, "ends with ~"},
{false, "/document.txt", "document.txt", false, "no rule matches"},
}
for _, tt := range tests {
result := idx.shouldSkip(tt.isDir, false, tt.fullPath, tt.baseName, actionConfig{})
if result != tt.shouldSkip {
t.Errorf("%s (%s): expected shouldSkip=%v, got %v",
tt.baseName, tt.reason, tt.shouldSkip, result)
}
}
}
func TestShouldSkip_ViewableStillSkips(t *testing.T) {
// Test that Viewable:true doesn't affect shouldSkip behavior
// The Viewable field is checked separately in IsViewable(), not in shouldSkip()
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{FolderStartsWith: "important", Viewable: true}, // Viewable but still skipped from indexing
},
})
// shouldSkip still returns true even with Viewable:true (it's checked separately)
result := idx.shouldSkip(true, false, "/important/", "important", actionConfig{})
if result != true {
t.Errorf("Folder should be skipped (Viewable is checked separately), got shouldSkip=%v", result)
}
}
func TestShouldSkip_HiddenFiles(t *testing.T) {
idx := setupConditionalTestIndex(settings.ConditionalFilter{
IgnoreHidden: true, // Skip hidden files
})
tests := []struct {
isHidden bool
shouldSkip bool
}{
{true, true},
{false, false},
}
for _, tt := range tests {
result := idx.shouldSkip(false, tt.isHidden, "/file.txt", "file.txt", actionConfig{})
if result != tt.shouldSkip {
t.Errorf("isHidden=%v: expected shouldSkip=%v, got %v",
tt.isHidden, tt.shouldSkip, result)
}
}
}
func TestShouldSkip_NeverWatch(t *testing.T) {
// Test NeverWatch functionality - folders should be skipped during routine scans
idx := setupConditionalTestIndex(settings.ConditionalFilter{
ItemRules: []settings.ConditionalIndexConfig{
{NeverWatchPath: "/cache/"}, // Must match the fullPath exactly
{NeverWatchPath: "/logs/"}, // Must match the fullPath exactly
},
})
// Simulate a routine scan (wasIndexed=true, IsRoutineScan=true)
idx.wasIndexed = true
config := actionConfig{IsRoutineScan: true}
tests := []struct {
name string
fullPath string
baseName string
shouldSkip bool
description string
}{
{
name: "Skip NeverWatch path during routine scan",
fullPath: "/cache/",
baseName: "cache",
shouldSkip: true,
description: "Folder with neverWatch should be skipped in routine scan",
},
{
name: "Skip NeverWatch name during routine scan",
fullPath: "/logs/",
baseName: "logs",
shouldSkip: true,
description: "Folder with neverWatch name should be skipped in routine scan",
},
{
name: "Don't skip regular folder",
fullPath: "/regular/",
baseName: "regular",
shouldSkip: false,
description: "Regular folder should not be skipped",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := idx.shouldSkip(true, false, tt.fullPath, tt.baseName, config)
if result != tt.shouldSkip {
t.Errorf("%s: expected shouldSkip=%v, got %v (fullPath=%s, baseName=%s)",
tt.description, tt.shouldSkip, result, tt.fullPath, tt.baseName)
}
})
}
// Test initial scan (IsRoutineScan=false) - NeverWatch folders should NOT be skipped
config.IsRoutineScan = false
result := idx.shouldSkip(true, false, "/cache/", "cache", config)
if result != false {
t.Errorf("NeverWatch folder should NOT be skipped during initial scan, got shouldSkip=%v", result)
}
}
+133 -221
View File
@@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"runtime"
"slices"
"strings"
"sync"
"time"
@@ -24,10 +25,17 @@ var (
// actionConfig holds all configuration options for indexing operations
type actionConfig struct {
Quick bool // whether to perform a quick scan (skip unchanged directories)
Recursive bool // whether to recursively index subdirectories
CheckViewable bool // whether to check if the path has viewable:true (for API access checks)
IsRoutineScan bool // whether this is a routine/scheduled scan (vs initial indexing)
Quick bool // whether to perform a quick scan (skip unchanged directories)
Recursive bool // whether to recursively index subdirectories
ForceCheck bool // whether to check indexing skip rules.
}
// NewactionConfig creates a new actionConfig with common presets
func NewactionConfig() *actionConfig {
return &actionConfig{
Quick: false,
Recursive: true,
}
}
// reduced index is json exposed to the client
@@ -56,7 +64,7 @@ type Index struct {
FilesChangedDuringIndexing bool `json:"-"`
mock bool
mu sync.RWMutex
wasIndexed bool
hasIndex bool
FoundHardLinks map[string]uint64 `json:"-"` // hardlink path -> size
processedInodes map[uint64]struct{} `json:"-"`
totalSize uint64 `json:"-"`
@@ -115,12 +123,12 @@ func Initialize(source *settings.Source, mock bool) {
}
// indexDirectoryWithOptions wraps indexDirectory with actionConfig
func (idx *Index) indexDirectoryWithOptions(adjustedPath string, config actionConfig) error {
func (idx *Index) indexDirectoryWithOptions(adjustedPath string, config *actionConfig) error {
return idx.indexDirectory(adjustedPath, config)
}
// Define a function to recursively index files and directories
func (idx *Index) indexDirectory(adjustedPath string, config actionConfig) error {
func (idx *Index) indexDirectory(adjustedPath string, config *actionConfig) error {
// Normalize path to always have trailing slash (except for root which is just "/")
if adjustedPath != "/" {
adjustedPath = strings.TrimSuffix(adjustedPath, "/") + "/"
@@ -141,7 +149,7 @@ func (idx *Index) indexDirectory(adjustedPath string, config actionConfig) error
// check if excluded from indexing
hidden := isHidden(dirInfo, idx.Path+adjustedPath)
if idx.shouldSkip(dirInfo.IsDir(), hidden, adjustedPath, dirInfo.Name(), config) {
if idx.shouldSkip(dirInfo.IsDir(), hidden, adjustedPath, dirInfo.Name()) {
return errors.ErrNotIndexed
}
@@ -174,7 +182,7 @@ func (idx *Index) indexDirectory(adjustedPath string, config actionConfig) error
idx.mu.Unlock()
} else if config.Quick {
for _, item := range cacheDirItems {
subConfig := actionConfig{
subConfig := &actionConfig{
Quick: config.Quick,
Recursive: true,
}
@@ -223,10 +231,6 @@ func (idx *Index) GetFsDirInfo(adjustedPath string) (*iteminfo.FileInfo, error)
},
}
fileInfo.DetectType(realPath, false)
// Set HasPreview flags using consolidated helper
setFilePreviewFlags(&fileInfo.ItemInfo, realPath)
return &fileInfo, nil
}
@@ -237,10 +241,10 @@ func (idx *Index) GetFsDirInfo(adjustedPath string) (*iteminfo.FileInfo, error)
// adjustedPath is already normalized with trailing slash
combinedPath := adjustedPath
var response *iteminfo.FileInfo
response, err = idx.GetDirInfo(dir, dirInfo, realPath, adjustedPath, combinedPath, actionConfig{
Quick: false,
Recursive: false,
CheckViewable: true,
response, err = idx.GetDirInfo(dir, dirInfo, realPath, adjustedPath, combinedPath, &actionConfig{
Quick: false,
Recursive: false,
ForceCheck: true,
})
if err != nil {
return nil, err
@@ -270,7 +274,7 @@ func (idx *Index) GetFsDirInfo(adjustedPath string) (*iteminfo.FileInfo, error)
}
func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjustedPath, combinedPath string, config actionConfig) (*iteminfo.FileInfo, error) {
func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjustedPath, combinedPath string, config *actionConfig) (*iteminfo.FileInfo, error) {
// Ensure combinedPath has exactly one trailing slash to prevent double slashes in subdirectory paths
combinedPath = strings.TrimRight(combinedPath, "/") + "/"
// Read directory contents
@@ -296,21 +300,12 @@ func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjus
baseName := file.Name()
fullCombined := combinedPath + baseName
if adjustedPath == "/" {
if !idx.shouldInclude(file.Name()) {
if !idx.shouldInclude(isDir, combinedPath, file.Name()) {
continue
}
}
// Skip logic based on mode
if config.CheckViewable {
// When checking viewable items: skip if shouldSkip=true AND not viewable
if idx.shouldSkip(isDir, hidden, fullCombined, baseName, config) && !idx.IsViewable(isDir, fullCombined) {
continue
}
} else {
// Normal indexing mode: skip if shouldSkip=true
if idx.shouldSkip(isDir, hidden, fullCombined, baseName, config) {
continue
}
if !config.ForceCheck && idx.shouldSkip(isDir, hidden, fullCombined, baseName) {
continue
}
itemInfo := &iteminfo.ItemInfo{
Name: file.Name(),
@@ -320,9 +315,8 @@ func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjus
if isDir {
dirPath := combinedPath + file.Name()
// Check NeverWatchPaths map - O(1) lookup for paths with neverWatch: true
if idx.wasIndexed && config.Recursive && idx.Config.ResolvedConditionals != nil {
if _, exists := idx.Config.ResolvedConditionals.NeverWatchPaths[fullCombined]; exists {
if idx.hasIndex && config.Recursive && len(idx.Config.NeverWatchPaths) > 0 {
if slices.Contains(idx.Config.NeverWatchPaths, fullCombined) {
realDirInfo, exists := idx.GetMetadataInfo(dirPath, true)
if exists {
itemInfo.Size = realDirInfo.Size
@@ -359,21 +353,40 @@ func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjus
} else {
size, shouldCountSize := idx.handleFile(file, fullCombined)
itemInfo.DetectType(realPath+"/"+file.Name(), false)
// Set HasPreview flags - use cached metadata optimization only when indexing is enabled
if !idx.Config.DisableIndexing && config.Recursive {
// Optimization: For audio files during indexing, check if we can use cached album art info
simpleType := strings.Split(itemInfo.Type, "/")[0]
if simpleType == "audio" {
previousInfo, exists := idx.GetReducedMetadata(fullCombined, false)
if exists && time.Time.Equal(previousInfo.ModTime, file.ModTime()) {
// File unchanged - use cached album art info
itemInfo.HasPreview = previousInfo.HasPreview
}
simpleType := strings.Split(itemInfo.Type, "/")[0]
if simpleType == "audio" {
// Check if this file is new or changed by comparing with previous metadata
shouldCheckAlbumArt := false
previousInfo, exists := idx.GetReducedMetadata(fullCombined, false)
if !exists {
// File is new - check album art
shouldCheckAlbumArt = true
} else if previousInfo.ModTime != file.ModTime() {
// File has been modified - check album art
shouldCheckAlbumArt = true
} else {
// File unchanged - use cached album art info
itemInfo.HasPreview = previousInfo.HasPreview
}
if shouldCheckAlbumArt {
itemInfo.HasPreview = iteminfo.HasAlbumArt(realPath+"/"+file.Name(), filepath.Ext(file.Name()))
}
}
// When indexing is disabled or CheckViewable mode, always check directly
setFilePreviewFlags(itemInfo, realPath+"/"+file.Name())
ext := strings.ToLower(filepath.Ext(file.Name()))
extWithoutPeriod := strings.TrimPrefix(ext, ".")
if simpleType == "image" {
itemInfo.HasPreview = true
}
switch extWithoutPeriod {
case "heic", "heif":
if settings.CanConvertImage(extWithoutPeriod) {
itemInfo.HasPreview = true
}
}
if simpleType == "video" && settings.CanConvertVideo(extWithoutPeriod) {
itemInfo.HasPreview = true
}
itemInfo.Size = int64(size)
// Update parent folder preview status for images, videos, and audio with album art
@@ -382,6 +395,15 @@ func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjus
hasPreview = true
}
// Set HasPreview for office docs and PDFs
// These files are previewable but DON'T set parent folder preview
if settings.Config.Integrations.OnlyOffice.Secret != "" && iteminfo.IsOnlyOffice(file.Name()) {
itemInfo.HasPreview = true
}
if iteminfo.HasDocConvertableExtension(itemInfo.Name, itemInfo.Type) {
itemInfo.HasPreview = true
}
fileInfos = append(fileInfos, *itemInfo)
if shouldCountSize {
totalSize += itemInfo.Size
@@ -392,7 +414,7 @@ func (idx *Index) GetDirInfo(dirInfo *os.File, stat os.FileInfo, realPath, adjus
}
}
if totalSize == 0 && idx.Config.Conditionals.ZeroSizeFolders {
if totalSize == 0 && idx.Config.Exclude.ZeroSizeFolders {
return nil, errors.ErrNotIndexed
}
@@ -463,7 +485,7 @@ func (idx *Index) GetRealPath(relativePath ...string) (string, bool, error) {
}
func (idx *Index) RefreshFileInfo(opts utils.FileOptions) error {
config := actionConfig{
config := &actionConfig{
Quick: false,
Recursive: opts.Recursive,
}
@@ -514,194 +536,102 @@ func isHidden(file os.FileInfo, srcPath string) bool {
return false
}
// setFilePreviewFlags determines if a file should have a preview based on its type
// This consolidates the logic used in both GetFsDirInfo and GetDirInfo
func setFilePreviewFlags(fileInfo *iteminfo.ItemInfo, realPath string) {
simpleType := strings.Split(fileInfo.Type, "/")[0]
ext := strings.ToLower(filepath.Ext(fileInfo.Name))
extWithoutPeriod := strings.TrimPrefix(ext, ".")
// Check if it's an image
if simpleType == "image" {
fileInfo.HasPreview = true
}
// Check for HEIC/HEIF
switch extWithoutPeriod {
case "heic", "heif":
if settings.CanConvertImage(extWithoutPeriod) {
fileInfo.HasPreview = true
}
}
// Check if it's a video
if simpleType == "video" && settings.CanConvertVideo(extWithoutPeriod) {
fileInfo.HasPreview = true
}
// Check for audio with album art (always check, don't rely on cache)
if simpleType == "audio" {
fileInfo.HasPreview = iteminfo.HasAlbumArt(realPath, ext)
}
// Check for office docs and PDFs
if settings.Config.Integrations.OnlyOffice.Secret != "" && iteminfo.IsOnlyOffice(fileInfo.Name) {
fileInfo.HasPreview = true
}
if iteminfo.HasDocConvertableExtension(fileInfo.Name, fileInfo.Type) {
fileInfo.HasPreview = true
}
}
// IsViewable checks if a path has viewable:true (allows FS access without indexing)
func (idx *Index) IsViewable(isDir bool, adjustedPath string) bool {
rules := idx.Config.ResolvedConditionals
baseName := filepath.Base(strings.TrimSuffix(adjustedPath, "/"))
if isDir {
// Exact match (O(1))
if rule, exists := rules.FolderNames[baseName]; exists && rule.Viewable {
return true
}
// Prefix/suffix (O(n))
for _, rule := range rules.FolderPaths {
if strings.HasPrefix(adjustedPath, rule.FolderPath) && rule.Viewable {
func (idx *Index) shouldInclude(isDir bool, fullCombined, baseName string) bool {
rules := idx.Config.Include
hasRules := false
if len(rules.RootFolders) > 0 {
hasRules = true
for _, p := range rules.RootFolders {
if strings.HasPrefix(fullCombined, p) {
return true
}
}
for _, rule := range rules.FolderEndsWith {
if strings.HasSuffix(baseName, rule.FolderEndsWith) && rule.Viewable {
return true
}
}
for _, rule := range rules.FolderStartsWith {
if strings.HasPrefix(baseName, rule.FolderStartsWith) && rule.Viewable {
return true
}
}
} else {
// Exact match (O(1))
if rule, exists := rules.FileNames[baseName]; exists && rule.Viewable {
return true
}
// Prefix/suffix (O(n))
for _, rule := range rules.FilePaths {
if strings.HasPrefix(adjustedPath, rule.FilePath) && rule.Viewable {
return true
}
}
for _, rule := range rules.FileEndsWith {
if strings.HasSuffix(baseName, rule.FileEndsWith) && rule.Viewable {
return true
}
}
for _, rule := range rules.FileStartsWith {
if strings.HasPrefix(baseName, rule.FileStartsWith) && rule.Viewable {
}
if len(rules.RootFiles) > 0 {
hasRules = true
for _, p := range rules.RootFiles {
if strings.HasPrefix(fullCombined, p) {
return true
}
}
}
if !hasRules {
return true
}
return false
}
func (idx *Index) shouldSkip(isDir bool, isHidden bool, fullCombined, baseName string, config actionConfig) bool {
rules := idx.Config.ResolvedConditionals
if rules == nil {
rules = &settings.ResolvedConditionalsConfig{}
}
if fullCombined == "/" {
return false
}
// When indexing is disabled globally, behavior depends on the mode
func (idx *Index) shouldSkip(isDir bool, isHidden bool, fullCombined, baseName string) bool {
if idx.Config.DisableIndexing {
// If checking viewable (filesystem access), don't skip - show everything from filesystem
if config.CheckViewable {
return false
}
// If indexing mode, skip everything
return true
}
if isDir && config.IsRoutineScan {
// Check NeverWatch: Skip directories with index=true AND neverWatch=true during routine scans
// This allows them to be indexed once but never re-scanned
_, ok := rules.NeverWatchPaths[fullCombined]
if ok {
// skip scanning, but is viewable
return true
}
}
rules := idx.Config.Exclude
if isDir {
if rule, ok := rules.FolderNames[baseName]; ok {
if _, ok := rules.FolderPaths[fullCombined]; !ok {
// create a rule so sub folders can be skipped
rules.FolderPaths[fullCombined] = rule
}
return true
}
// Check FolderPaths: Two-stage check for performance
// Stage 1: O(1) exact match (fast path for the folder itself)
if _, ok := rules.FolderPaths[fullCombined]; ok {
return true
}
// Stage 2: O(n) prefix match (for child folders)
for path := range rules.FolderPaths {
if strings.HasPrefix(fullCombined, path) {
return true
}
}
// Check FolderEndsWith (suffix match on base name) - use original slice
if len(rules.FolderEndsWith) > 0 {
for _, rule := range rules.FolderEndsWith {
if hasSuffix := strings.HasSuffix(baseName, rule.FolderEndsWith); hasSuffix {
if len(rules.FolderPaths) > 0 {
for _, p := range rules.FolderPaths {
if strings.HasPrefix(fullCombined, p) {
return true
}
}
}
for _, rule := range rules.FolderStartsWith {
if hasPrefix := strings.HasPrefix(baseName, rule.FolderStartsWith); hasPrefix {
return true
if len(rules.FolderNames) > 0 && slices.Contains(rules.FolderNames, baseName) {
return true
}
if len(rules.FolderEndsWith) > 0 {
for _, end := range rules.FolderEndsWith {
if strings.HasSuffix(baseName, end) {
return true
}
}
}
if len(rules.FolderStartsWith) > 0 {
for _, start := range rules.FolderStartsWith {
if strings.HasPrefix(baseName, start) {
return true
}
}
}
} else {
// Check FileNames (exact match on base name) - O(1) lookup
if _, ok := rules.FileNames[baseName]; ok {
if len(rules.FilePaths) > 0 {
for _, p := range rules.FilePaths {
if strings.HasPrefix(fullCombined, p) {
return true
}
}
}
if len(rules.FileNames) > 0 && slices.Contains(rules.FileNames, baseName) {
return true
}
// Check FilePaths: Two-stage check for performance
// Stage 1: O(1) exact match (fast path for the file itself)
if _, ok := rules.FilePaths[fullCombined]; ok {
return true
}
// Stage 2: O(n) prefix match (for files in excluded folders)
for path := range rules.FilePaths {
if strings.HasPrefix(fullCombined, path) {
return true
if len(rules.FileEndsWith) > 0 {
for _, end := range rules.FileEndsWith {
if strings.HasSuffix(baseName, end) {
return true
}
}
}
for _, rule := range rules.FileEndsWith {
if hasSuffix := strings.HasSuffix(baseName, rule.FileEndsWith); hasSuffix {
return true
if len(rules.FileStartsWith) > 0 {
for _, start := range rules.FileStartsWith {
if strings.HasPrefix(baseName, start) {
return true
}
}
}
for _, rule := range rules.FileStartsWith {
if hasPrefix := strings.HasPrefix(baseName, rule.FileStartsWith); hasPrefix {
return true
// Exclude if parent directory matches FolderPaths
if len(rules.FolderPaths) > 0 {
parent := filepath.Dir(fullCombined)
for _, p := range rules.FolderPaths {
if strings.HasPrefix(parent, p) {
return true
}
}
}
}
if idx.Config.Conditionals.IgnoreHidden && isHidden {
if rules.Hidden && isHidden {
return true
}
return false
}
@@ -719,7 +649,7 @@ func (idx *Index) SetUsage(totalBytes uint64) {
idx.DiskTotal = totalBytes
}
func (idx *Index) SetStatus(status IndexStatus) error {
func (idx *Index) SetStatus(status IndexStatus) {
idx.mu.Lock()
idx.Status = status
switch status {
@@ -729,7 +659,7 @@ func (idx *Index) SetStatus(status IndexStatus) error {
idx.runningScannerCount = 0
}
idx.mu.Unlock()
return idx.SendSourceUpdateEvent()
idx.SendSourceUpdateEvent()
}
func (idx *Index) handleFile(file os.FileInfo, fullCombined string) (size uint64, shouldCountSize bool) {
@@ -779,21 +709,3 @@ func (idx *Index) MakeIndexPath(path string) string {
path = strings.TrimSuffix(path, "/") + "/"
return path
}
func (idx *Index) shouldInclude(baseName string) bool {
rules := idx.Config.ResolvedConditionals
if rules == nil {
rules = &settings.ResolvedConditionalsConfig{}
}
hasRules := false
if len(rules.IncludeRootItems) > 0 {
hasRules = true
if _, exists := rules.IncludeRootItems["/"+baseName]; exists {
return true
}
}
if !hasRules {
return true
}
return false
}
+1 -1
View File
@@ -20,7 +20,7 @@ func setupTestIndex(t *testing.T) (*Index, string, func()) {
DisableIndexing: false,
},
},
wasIndexed: true,
hasIndex: true,
mock: true, // Enable mock mode
Directories: make(map[string]*iteminfo.FileInfo),
DirectoriesLedger: make(map[string]struct{}),
+17 -26
View File
@@ -49,20 +49,19 @@ func (idx *Index) newScanner(origin string) {
}
}
func (idx *Index) PreScan() error {
return idx.SetStatus(INDEXING)
func (idx *Index) PreScan() {
idx.SetStatus(INDEXING)
}
func (idx *Index) PostScan() error {
func (idx *Index) PostScan() {
idx.mu.Lock()
idx.garbageCollection()
idx.wasIndexed = true
idx.hasIndex = true
idx.runningScannerCount--
idx.mu.Unlock()
if idx.runningScannerCount == 0 {
return idx.SetStatus(READY)
idx.SetStatus(READY)
}
return nil
}
func (idx *Index) garbageCollection() {
@@ -105,24 +104,25 @@ func (idx *Index) UpdateSchedule() {
}
}
func (idx *Index) SendSourceUpdateEvent() error {
func (idx *Index) SendSourceUpdateEvent() {
if idx.mock {
logger.Debug("Skipping source update event for mock index.")
return nil
return
}
reducedIndex, err := GetIndexInfo(idx.Name)
if err != nil {
return err
logger.Errorf("Error getting index info: %v", err)
return
}
sourceAsMap := map[string]ReducedIndex{
idx.Name: reducedIndex,
}
message, err := json.Marshal(sourceAsMap)
if err != nil {
return err
logger.Errorf("Error marshalling source update message: %v", err)
return
}
events.SendSourceUpdate(idx.Name, string(message))
return nil
}
func (idx *Index) RunIndexing(origin string, quick bool) {
@@ -130,11 +130,7 @@ func (idx *Index) RunIndexing(origin string, quick bool) {
logger.Debugf("Indexing already in progress for [%v]", idx.Name)
return
}
err := idx.PreScan()
if err != nil {
logger.Errorf("Error during indexing: %v", err)
return
}
idx.PreScan()
prevNumDirs := idx.NumDirs
prevNumFiles := idx.NumFiles
@@ -152,12 +148,11 @@ func (idx *Index) RunIndexing(origin string, quick bool) {
startTime := time.Now()
idx.FilesChangedDuringIndexing = false
// Perform the indexing operation
config := actionConfig{
Quick: quick,
Recursive: true,
IsRoutineScan: idx.wasIndexed, // This is a routine scan if we already have an index
config := &actionConfig{
Quick: quick,
Recursive: true,
}
err = idx.indexDirectory("/", config)
err := idx.indexDirectory("/", config)
if err != nil {
logger.Errorf("Error during indexing: %v", err)
}
@@ -192,11 +187,7 @@ func (idx *Index) RunIndexing(origin string, quick bool) {
logger.Debugf("Time spent indexing [%v]: %v seconds", idx.Name, idx.FullScanTime)
}
err = idx.PostScan()
if err != nil {
logger.Errorf("Error during post scan indexing: %v", err)
return
}
idx.PostScan()
}
func (idx *Index) setupIndexingScanners() {
+6 -11
View File
@@ -124,8 +124,6 @@ func TestMakeIndexPathRoot(t *testing.T) {
}
}
// TODO: Update these tests to use new ConditionalFilter structure
/*
func TestCheckIndexExclude(t *testing.T) {
tests := []struct {
name string
@@ -167,16 +165,14 @@ func TestCheckIndexExclude(t *testing.T) {
},
},
}
result := idx.shouldSkip(tc.isDir, tc.isHidden, tc.fullPath, tc.baseName, nil)
result := idx.shouldSkip(tc.isDir, tc.isHidden, tc.fullPath, tc.baseName)
if result != tc.expect {
t.Errorf("shouldSkip(%v, %v, %q, %q) = %v; want %v", tc.isDir, tc.isHidden, tc.fullPath, tc.baseName, result, tc.expect)
}
})
}
}
*/
/*
func TestCheckIndexInclude(t *testing.T) {
tests := []struct {
name string
@@ -211,11 +207,10 @@ func TestCheckIndexInclude(t *testing.T) {
},
},
}
result := idx.shouldInclude(tc.isDir, tc.fullPath, tc.baseName)
if result != tc.expect {
t.Errorf("shouldInclude(%v, %q, %q) = %v; want %v", tc.isDir, tc.fullPath, tc.baseName, result, tc.expect)
}
})
result := idx.shouldInclude(tc.isDir, tc.fullPath, tc.baseName)
if result != tc.expect {
t.Errorf("shouldInclude(%v, %q, %q) = %v; want %v", tc.isDir, tc.fullPath, tc.baseName, result, tc.expect)
}
})
}
}
*/
+1 -3
View File
@@ -52,8 +52,6 @@ var ResizableImageTypes = map[string]bool{
".png": true,
".gif": true,
".bmp": true,
".heic": true,
".heif": true,
".other": false,
}
@@ -350,7 +348,7 @@ func hasBundleExtension(name string) bool {
}
func HasDocConvertableExtension(name, mimetype string) bool {
if !settings.Config.Env.MuPdfAvailable {
if !settings.Config.Server.MuPdfAvailable {
return false
}
if strings.HasPrefix(mimetype, "text") {
+2 -5
View File
@@ -146,12 +146,10 @@ func GetIndex(name string) *Index {
source, ok := settings.Config.Server.SourceMap[name]
if !ok {
logger.Errorf("index %s not found", name)
return nil
}
index, ok = indexes[source.Name]
if !ok {
logger.Errorf("index %s not found", name)
return nil
}
}
@@ -169,9 +167,8 @@ func GetIndexInfo(sourceName string) (ReducedIndex, error) {
if !ok {
totalBytes, err := getPartitionSize(sourcePath)
if err != nil {
idx.mu.Lock()
idx.Status = UNAVAILABLE
idx.mu.Unlock()
logger.Errorf("error getting disk usage for %s: %v", sourcePath, err)
idx.SetStatus(UNAVAILABLE)
return ReducedIndex{}, fmt.Errorf("error getting disk usage for %s: %v", sourcePath, err)
}
+1
View File
@@ -1,4 +1,5 @@
//go:build !windows
// +build !windows
package indexing
+1
View File
@@ -1,4 +1,5 @@
//go:build windows
// +build windows
package indexing
-57
View File
@@ -1,57 +0,0 @@
server:
port: 8080
baseURL: "/"
database: "playwright-files.db"
logging:
- levels: "info|warning|debug|error"
sources:
- path: "../frontend/playwright-files"
config:
defaultEnabled: true
userDefaults:
editorQuickSave: false # show quick save button in editor
hideSidebarFileActions: false # hide the file actions in the sidebar
disableQuickToggles: false # disable the quick toggles in the sidebar
disableSearchOptions: false # disable the search options in the search bar
stickySidebar: true # keep sidebar open when navigating
darkMode: true # should dark mode be enabled
viewMode: "normal" # view mode to use: eg. normal, list, grid, or compact
singleClick: false # open directory on single click, also enables middle click to open in new tab
showHidden: false # show hidden files in the UI. On windows this includes files starting with a dot and windows hidden files
dateFormat: false # when false, the date is relative, when true, the date is an exact timestamp
gallerySize: 3 # 0-9 - the size of the gallery thumbnails
themeColor: "var(--blue)" # theme color to use: eg. #ff0000, or var(--red), var(--purple), etc
quickDownload: false # show icon to download in one click
disablePreviewExt: "" # space separated list of file extensions to disable preview for
disableViewingExt: "" # space separated list of file extensions to disable viewing for
lockPassword: false # disable the user from changing their password
disableSettings: false # disable the user from viewing the settings page
preview:
disableHideSidebar: true # disable the hide sidebar preview for previews and editors
highQuality: true # generate high quality thumbnail preview images
image: true # show thumbnail preview image for image files
video: true # show thumbnail preview image for video files
motionVideoPreview: true # show multiple frames for videos in thumbnail preview when hovering
office: true # show thumbnail preview image for office files
popup: true # show larger popup preview when hovering over thumbnail
autoplayMedia: true # autoplay media files in preview
defaultMediaPlayer: true # disable html5 media player and use the default media player
folder: true # show thumbnail preview image for folder files
permissions:
api: false # allow api access
admin: false # allow admin access
modify: false # allow modifying files
share: false # allow sharing files
realtime: false # allow realtime updates
delete: false # allow deleting files
create: false # allow creating or uploading files
download: true # allow downloading files
disableUpdateNotifications: false # disable update notifications banner for admin users
deleteWithoutConfirming: false # delete files without confirmation
disableOnlyOfficeExt: ".md .txt .pdf" # list of file extensions to disable onlyoffice editor for
showSelectMultiple: false # show select multiple files on desktop
defaultLandingPage: "" # default landing page to use if no redirect is specified: eg. /files/mysource/mysubpath, /settings, etc.
#office:
# url: "http://localhost:9052"
# secret: "6H1H7GzUk2alRkNxAPav0W02g8JS5oUd"
+1
View File
@@ -1,4 +1,5 @@
//go:build mupdf
// +build mupdf
package preview
+1
View File
@@ -1,4 +1,5 @@
//go:build !mupdf
// +build !mupdf
package preview
+3 -4
View File
@@ -89,8 +89,8 @@ func NewPreviewGenerator(concurrencyLimit int, ffmpegPath string, cacheDir strin
}
logger.Debugf("Media Enabled : %v", ffmpegMainPath != "" && ffprobePath != "")
logger.Debugf("FFmpeg Concurrency Limit : %d", ffmpegConcurrencyLimit)
settings.Config.Env.MuPdfAvailable = docEnabled()
logger.Debugf("MuPDF Enabled : %v", settings.Config.Env.MuPdfAvailable)
settings.Config.Server.MuPdfAvailable = docEnabled()
logger.Debugf("MuPDF Enabled : %v", settings.Config.Server.MuPdfAvailable)
// Create shared ffmpeg services
var videoService *ffmpeg.VideoService
@@ -208,7 +208,6 @@ func GeneratePreviewWithMD5(ctx context.Context, file iteminfo.ExtendedFileInfo,
hasher := md5.New()
_, _ = hasher.Write([]byte(CacheKey(fileMD5, previewSize, seekPercentage)))
hash := hex.EncodeToString(hasher.Sum(nil))
convertHEIC := strings.HasPrefix(file.Type, "image/heic") && settings.Config.Integrations.Media.Convert.ImagePreview[settings.HEICImagePreview]
// Generate an image from office document
if iteminfo.HasDocConvertableExtension(file.Name, file.Type) {
tempFilePath := filepath.Join(settings.Config.Server.CacheDir, "thumbnails", "docs", hash) + ".txt"
@@ -221,7 +220,7 @@ func GeneratePreviewWithMD5(ctx context.Context, file iteminfo.ExtendedFileInfo,
if err != nil {
return nil, fmt.Errorf("failed to create image for office file: %w", err)
}
} else if convertHEIC {
} else if strings.HasPrefix(file.Type, "image/heic") {
// HEIC files need FFmpeg conversion to JPEG with proper size/quality handling
imageBytes, err = service.convertHEICToJPEGWithFFmpeg(ctx, file.RealPath, previewSize)
if err != nil {
+335 -425
View File
@@ -394,47 +394,6 @@ const docTemplate = `{
}
}
},
"/api/auth/login": {
"post": {
"description": "Authenticate a user with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User login",
"responses": {
"200": {
"description": "JWT token for authentication",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden - authentication failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/auth/logout": {
"post": {
"description": "Returns a logout URL for the frontend to redirect to.",
@@ -624,65 +583,6 @@ const docTemplate = `{
]
}
},
"/api/auth/signup": {
"post": {
"description": "Register a new user account with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User signup",
"responses": {
"201": {
"description": "User created successfully",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad request - invalid input",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"405": {
"description": "Method not allowed - signup is disabled",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"409": {
"description": "Conflict - user already exists",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/auth/token": {
"put": {
"description": "Create an API key with specified name, duration, and permissions.",
@@ -913,6 +813,47 @@ const docTemplate = `{
}
}
},
"/api/login": {
"post": {
"description": "Authenticate a user with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User login",
"responses": {
"200": {
"description": "JWT token for authentication",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden - authentication failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/media/subtitles": {
"get": {
"description": "Extracts embedded subtitle content from video files by stream index and returns raw WebVTT content",
@@ -1804,90 +1745,6 @@ const docTemplate = `{
}
}
},
"/api/share/direct": {
"get": {
"description": "Creates a direct download link for a specific file with configurable duration, download count, and speed limits. If a share already exists with matching parameters, the existing share will be reused.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Shares"
],
"summary": "Create direct download link",
"parameters": [
{
"type": "string",
"description": "File path to create download link for",
"name": "path",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Source name for the file",
"name": "source",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Duration in minutes for link validity (default: 60)",
"name": "duration",
"in": "query"
},
{
"type": "string",
"description": "Maximum number of downloads allowed (default: unlimited)",
"name": "count",
"in": "query"
},
{
"type": "string",
"description": "Download speed limit in kbps (default: unlimited)",
"name": "speed",
"in": "query"
}
],
"responses": {
"201": {
"description": "Direct download link created",
"schema": {
"$ref": "#/definitions/http.DirectDownloadResponse"
}
},
"400": {
"description": "Bad request - invalid parameters or path is not a file",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"403": {
"description": "Forbidden - access denied",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/shares": {
"get": {
"description": "Returns a list of share links for the current user, or all links if the user is an admin.",
@@ -1968,6 +1825,76 @@ const docTemplate = `{
}
}
},
"/api/signup": {
"post": {
"description": "Register a new user account with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User signup",
"parameters": [
{
"description": "User signup details",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/http.signupBody"
}
}
],
"responses": {
"201": {
"description": "User created successfully",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad request - invalid input",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"405": {
"description": "Method not allowed - signup is disabled",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"409": {
"description": "Conflict - user already exists",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/users": {
"get": {
"description": "Returns a user's details based on their ID, or all users if no id is provided.",
@@ -2393,91 +2320,6 @@ const docTemplate = `{
}
},
"/public/api/resources": {
"put": {
"description": "Updates the content of a file in a public share.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Public Shares"
],
"summary": "Update a file in a public share",
"parameters": [
{
"type": "string",
"description": "Share hash for authentication",
"name": "hash",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Path to the file to update",
"name": "path",
"in": "query",
"required": true
},
{
"description": "New content for the file",
"name": "content",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "File updated successfully",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request or parameters",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"403": {
"description": "Share unavailable or update not allowed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "Share not found or file not found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"post": {
"description": "Handles file and directory uploads to an upload-only public share. Supports chunked uploads, conflict resolution (override), and directory creation.",
"consumes": [
@@ -2665,6 +2507,90 @@ const docTemplate = `{
}
}
}
},
"/public/share/direct": {
"get": {
"description": "Creates a direct download link for a specific file with configurable duration, download count, and speed limits. If a share already exists with matching parameters, the existing share will be reused.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Shares"
],
"summary": "Create direct download link",
"parameters": [
{
"type": "string",
"description": "File path to create download link for",
"name": "path",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Source name for the file",
"name": "source",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Duration in minutes for link validity (default: 60)",
"name": "duration",
"in": "query"
},
{
"type": "string",
"description": "Maximum number of downloads allowed (default: unlimited)",
"name": "count",
"in": "query"
},
{
"type": "string",
"description": "Download speed limit in kbps (default: unlimited)",
"name": "speed",
"in": "query"
}
],
"responses": {
"201": {
"description": "Direct download link created",
"schema": {
"$ref": "#/definitions/http.DirectDownloadResponse"
}
},
"400": {
"description": "Bad request - invalid parameters or path is not a file",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"403": {
"description": "Forbidden - access denied",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
@@ -2727,6 +2653,17 @@ const docTemplate = `{
}
}
},
"http.signupBody": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"indexing.IndexStatus": {
"type": "string",
"enum": [
@@ -2896,87 +2833,6 @@ const docTemplate = `{
}
}
},
"settings.ConditionalFilter": {
"type": "object",
"properties": {
"hidden": {
"description": "deprecated: use ignoreHidden instead to exclude hidden files and folders.",
"type": "boolean"
},
"ignoreHidden": {
"description": "exclude hidden files and folders.",
"type": "boolean"
},
"ignoreZeroSizeFolders": {
"description": "ignore folders with 0 size",
"type": "boolean"
},
"rules": {
"description": "list of item rules to apply to specific paths",
"type": "array",
"items": {
"$ref": "#/definitions/settings.ConditionalIndexConfig"
}
}
}
},
"settings.ConditionalIndexConfig": {
"type": "object",
"properties": {
"fileEndsWith": {
"description": "(global) exclude files that end with these suffixes. Eg. \".jpg\" or \".txt\"",
"type": "string"
},
"fileName": {
"description": "(global) exclude files that match these names. Eg. \"file.txt\" or \"test.csv\"",
"type": "string"
},
"fileNames": {
"description": "deprecated: exclude files that match these names. Eg. \"file.txt\" or \"test.csv\"",
"type": "string"
},
"filePath": {
"description": "(global) exclude files that match this path. Eg. \"/path/to/file.txt\" or \"/path/to/file.txt/subfile.txt\"",
"type": "string"
},
"fileStartsWith": {
"description": "(global) exclude files that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "string"
},
"folderEndsWith": {
"description": "(global) exclude folders that end with these suffixes. Eg. \".thumbnails\" or \".git\"",
"type": "string"
},
"folderName": {
"description": "(global) exclude folders that match these names. Eg. \"folder\" or \"subfolder\"",
"type": "string"
},
"folderNames": {
"description": "deprecated: exclude folders that match these names. Eg. \"folder\" or \"subfolder\"",
"type": "string"
},
"folderPath": {
"description": "(global) exclude folders that match this path. Eg. \"/path/to/folder\" or \"/path/to/folder/subfolder\"",
"type": "string"
},
"folderStartsWith": {
"description": "(global) exclude folders that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "string"
},
"includeRootItem": {
"description": "include only these items at root folder level",
"type": "string"
},
"neverWatchPath": {
"description": "index the folder in the first pass to get included in search, but never re-indexed.",
"type": "string"
},
"viewable": {
"description": "Enable viewing in UI but exclude from indexing",
"type": "boolean"
}
}
},
"settings.CustomTheme": {
"type": "object",
"properties": {
@@ -2990,6 +2846,75 @@ const docTemplate = `{
}
}
},
"settings.ExcludeIndexFilter": {
"type": "object",
"properties": {
"fileEndsWith": {
"description": "(global) exclude files that end with these suffixes. Eg. \".jpg\" or \".txt\"",
"type": "array",
"items": {
"type": "string"
}
},
"fileNames": {
"description": "(global) list of file names to include/exclude. Eg. \"a.jpg\"",
"type": "array",
"items": {
"type": "string"
}
},
"filePaths": {
"description": "list of filepaths Eg. \"folder1\" or \"file1.txt\" or \"folder1/file1.txt\" (without source path prefix)",
"type": "array",
"items": {
"type": "string"
}
},
"fileStartsWith": {
"description": "(global) exclude files that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "array",
"items": {
"type": "string"
}
},
"folderEndsWith": {
"description": "(global) exclude folders that end with these suffixes. Eg. \".thumbnails\" or \".git\"",
"type": "array",
"items": {
"type": "string"
}
},
"folderNames": {
"description": "(global) list of folder names to include/exclude. Eg. \"@eadir\" or \".thumbnails\"",
"type": "array",
"items": {
"type": "string"
}
},
"folderPaths": {
"description": "(filepath) list of folder names to include/exclude. Eg. \"folder1\" or \"folder1/subfolder\" (do not include source path, just the subpaths from the source path)",
"type": "array",
"items": {
"type": "string"
}
},
"folderStartsWith": {
"description": "(global) exclude folders that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "array",
"items": {
"type": "string"
}
},
"hidden": {
"description": "exclude hidden files and folders.",
"type": "boolean"
},
"ignoreZeroSizeFolders": {
"description": "ignore folders with 0 size",
"type": "boolean"
}
}
},
"settings.ExternalLink": {
"type": "object",
"required": [
@@ -3076,10 +3001,6 @@ const docTemplate = `{
"description": "path to a favicon to use for the frontend",
"type": "string"
},
"loginIcon": {
"description": "path to an image file for the login page icon",
"type": "string"
},
"name": {
"description": "display name",
"type": "string"
@@ -3089,6 +3010,25 @@ const docTemplate = `{
}
}
},
"settings.IncludeIndexFilter": {
"type": "object",
"properties": {
"rootFiles": {
"description": "list of root files to include, relative to the source path (eg. \"file1.txt\")",
"type": "array",
"items": {
"type": "string"
}
},
"rootFolders": {
"description": "list of root folders to include, relative to the source path (eg. \"folder1\")",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"settings.Integrations": {
"type": "object",
"properties": {
@@ -3447,14 +3387,6 @@ const docTemplate = `{
"settings.SourceConfig": {
"type": "object",
"properties": {
"conditionals": {
"description": "conditional rules to apply when indexing to include/exclude certain items",
"allOf": [
{
"$ref": "#/definitions/settings.ConditionalFilter"
}
]
},
"createUserDir": {
"description": "create a user directory for each user",
"type": "boolean"
@@ -3479,10 +3411,41 @@ const docTemplate = `{
"description": "disable the source, this is useful so you don't need to remove it from the config file",
"type": "boolean"
},
"exclude": {
"description": "exclude files and folders from indexing, if include is not set",
"allOf": [
{
"$ref": "#/definitions/settings.ExcludeIndexFilter"
}
]
},
"include": {
"description": "include files and folders from indexing, if exclude is not set",
"allOf": [
{
"$ref": "#/definitions/settings.IncludeIndexFilter"
}
]
},
"indexAlbumArt": {
"description": "deprecated: always enabled since 0.8.6",
"type": "boolean"
},
"indexingIntervalMinutes": {
"description": "optional manual overide interval in minutes to re-index the source",
"type": "integer"
},
"maxWatchers": {
"description": "number of concurrent watchers to use for this source, currently not supported",
"type": "integer"
},
"neverWatchPaths": {
"description": "paths that get initially once. Useful for folders that rarely change contents (without source path prefix)",
"type": "array",
"items": {
"type": "string"
}
},
"private": {
"description": "designate as source as private -- currently just means no sharing permitted.",
"type": "boolean"
@@ -3507,10 +3470,6 @@ const docTemplate = `{
"description": "Specify a valid CSS color property value to use as the background color in dark mode",
"type": "string"
},
"disableEventThemes": {
"description": "disable the event based themes,",
"type": "boolean"
},
"lightBackground": {
"description": "specify a valid CSS color property value to use as the background color in light mode",
"type": "string"
@@ -3647,19 +3606,8 @@ const docTemplate = `{
"share.CreateBody": {
"type": "object",
"properties": {
"allowCreate": {
"description": "allow creating files",
"type": "boolean"
},
"allowDelete": {
"type": "boolean"
},
"allowModify": {
"description": "allow modifying files",
"type": "boolean"
},
"allowReplacements": {
"description": "allow replacements of files",
"allowUpload": {
"description": "AllowEdit bool ` + "`" + `json:\"allowEdit,omitempty\"` + "`" + `",
"type": "boolean"
},
"allowedUsernames": {
@@ -3677,12 +3625,7 @@ const docTemplate = `{
"disableAnonymous": {
"type": "boolean"
},
"disableDownload": {
"description": "don't allow downloading files",
"type": "boolean"
},
"disableFileViewer": {
"description": "don't allow viewing files",
"type": "boolean"
},
"disableShareCard": {
@@ -3703,6 +3646,9 @@ const docTemplate = `{
"enableOnlyOffice": {
"type": "boolean"
},
"enableOnlyOfficeEditing": {
"type": "boolean"
},
"enforceDarkLightMode": {
"description": "\"dark\" or \"light\"",
"type": "string"
@@ -3770,19 +3716,8 @@ const docTemplate = `{
"share.Link": {
"type": "object",
"properties": {
"allowCreate": {
"description": "allow creating files",
"type": "boolean"
},
"allowDelete": {
"type": "boolean"
},
"allowModify": {
"description": "allow modifying files",
"type": "boolean"
},
"allowReplacements": {
"description": "allow replacements of files",
"allowUpload": {
"description": "AllowEdit bool ` + "`" + `json:\"allowEdit,omitempty\"` + "`" + `",
"type": "boolean"
},
"allowedUsernames": {
@@ -3800,12 +3735,7 @@ const docTemplate = `{
"disableAnonymous": {
"type": "boolean"
},
"disableDownload": {
"description": "don't allow downloading files",
"type": "boolean"
},
"disableFileViewer": {
"description": "don't allow viewing files",
"type": "boolean"
},
"disableShareCard": {
@@ -3829,6 +3759,9 @@ const docTemplate = `{
"enableOnlyOffice": {
"type": "boolean"
},
"enableOnlyOfficeEditing": {
"type": "boolean"
},
"enforceDarkLightMode": {
"description": "\"dark\" or \"light\"",
"type": "string"
@@ -3951,35 +3884,18 @@ const docTemplate = `{
"type": "object",
"properties": {
"admin": {
"description": "allow admin access",
"type": "boolean"
},
"api": {
"description": "allow api access",
"type": "boolean"
},
"create": {
"description": "allow creating or uploading files",
"type": "boolean"
},
"delete": {
"description": "allow deleting files",
"type": "boolean"
},
"download": {
"description": "allow downloading files",
"type": "boolean"
},
"modify": {
"description": "allow modifying files",
"type": "boolean"
},
"realtime": {
"description": "allow realtime updates",
"type": "boolean"
},
"share": {
"description": "allow sharing files",
"type": "boolean"
}
}
@@ -4182,9 +4098,6 @@ const docTemplate = `{
"$ref": "#/definitions/users.SourceScope"
}
},
"showFirstLogin": {
"type": "boolean"
},
"showHidden": {
"description": "show hidden files in the UI. On windows this includes files starting with a dot and windows hidden files",
"type": "boolean"
@@ -4217,9 +4130,6 @@ const docTemplate = `{
"username": {
"type": "string"
},
"version": {
"type": "integer"
},
"viewMode": {
"description": "view mode to use: eg. normal, list, grid, or compact",
"type": "string"
+335 -425
View File
@@ -383,47 +383,6 @@
}
}
},
"/api/auth/login": {
"post": {
"description": "Authenticate a user with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User login",
"responses": {
"200": {
"description": "JWT token for authentication",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden - authentication failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/auth/logout": {
"post": {
"description": "Returns a logout URL for the frontend to redirect to.",
@@ -613,65 +572,6 @@
]
}
},
"/api/auth/signup": {
"post": {
"description": "Register a new user account with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User signup",
"responses": {
"201": {
"description": "User created successfully",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad request - invalid input",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"405": {
"description": "Method not allowed - signup is disabled",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"409": {
"description": "Conflict - user already exists",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/auth/token": {
"put": {
"description": "Create an API key with specified name, duration, and permissions.",
@@ -902,6 +802,47 @@
}
}
},
"/api/login": {
"post": {
"description": "Authenticate a user with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User login",
"responses": {
"200": {
"description": "JWT token for authentication",
"schema": {
"type": "string"
}
},
"403": {
"description": "Forbidden - authentication failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/media/subtitles": {
"get": {
"description": "Extracts embedded subtitle content from video files by stream index and returns raw WebVTT content",
@@ -1793,90 +1734,6 @@
}
}
},
"/api/share/direct": {
"get": {
"description": "Creates a direct download link for a specific file with configurable duration, download count, and speed limits. If a share already exists with matching parameters, the existing share will be reused.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Shares"
],
"summary": "Create direct download link",
"parameters": [
{
"type": "string",
"description": "File path to create download link for",
"name": "path",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Source name for the file",
"name": "source",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Duration in minutes for link validity (default: 60)",
"name": "duration",
"in": "query"
},
{
"type": "string",
"description": "Maximum number of downloads allowed (default: unlimited)",
"name": "count",
"in": "query"
},
{
"type": "string",
"description": "Download speed limit in kbps (default: unlimited)",
"name": "speed",
"in": "query"
}
],
"responses": {
"201": {
"description": "Direct download link created",
"schema": {
"$ref": "#/definitions/http.DirectDownloadResponse"
}
},
"400": {
"description": "Bad request - invalid parameters or path is not a file",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"403": {
"description": "Forbidden - access denied",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/shares": {
"get": {
"description": "Returns a list of share links for the current user, or all links if the user is an admin.",
@@ -1957,6 +1814,76 @@
}
}
},
"/api/signup": {
"post": {
"description": "Register a new user account with a username and password.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "User signup",
"parameters": [
{
"description": "User signup details",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/http.signupBody"
}
}
],
"responses": {
"201": {
"description": "User created successfully",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad request - invalid input",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"405": {
"description": "Method not allowed - signup is disabled",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"409": {
"description": "Conflict - user already exists",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/users": {
"get": {
"description": "Returns a user's details based on their ID, or all users if no id is provided.",
@@ -2382,91 +2309,6 @@
}
},
"/public/api/resources": {
"put": {
"description": "Updates the content of a file in a public share.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Public Shares"
],
"summary": "Update a file in a public share",
"parameters": [
{
"type": "string",
"description": "Share hash for authentication",
"name": "hash",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Path to the file to update",
"name": "path",
"in": "query",
"required": true
},
{
"description": "New content for the file",
"name": "content",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "File updated successfully",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request or parameters",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"403": {
"description": "Share unavailable or update not allowed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "Share not found or file not found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"post": {
"description": "Handles file and directory uploads to an upload-only public share. Supports chunked uploads, conflict resolution (override), and directory creation.",
"consumes": [
@@ -2654,6 +2496,90 @@
}
}
}
},
"/public/share/direct": {
"get": {
"description": "Creates a direct download link for a specific file with configurable duration, download count, and speed limits. If a share already exists with matching parameters, the existing share will be reused.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Shares"
],
"summary": "Create direct download link",
"parameters": [
{
"type": "string",
"description": "File path to create download link for",
"name": "path",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Source name for the file",
"name": "source",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Duration in minutes for link validity (default: 60)",
"name": "duration",
"in": "query"
},
{
"type": "string",
"description": "Maximum number of downloads allowed (default: unlimited)",
"name": "count",
"in": "query"
},
{
"type": "string",
"description": "Download speed limit in kbps (default: unlimited)",
"name": "speed",
"in": "query"
}
],
"responses": {
"201": {
"description": "Direct download link created",
"schema": {
"$ref": "#/definitions/http.DirectDownloadResponse"
}
},
"400": {
"description": "Bad request - invalid parameters or path is not a file",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"403": {
"description": "Forbidden - access denied",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
@@ -2716,6 +2642,17 @@
}
}
},
"http.signupBody": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"indexing.IndexStatus": {
"type": "string",
"enum": [
@@ -2885,87 +2822,6 @@
}
}
},
"settings.ConditionalFilter": {
"type": "object",
"properties": {
"hidden": {
"description": "deprecated: use ignoreHidden instead to exclude hidden files and folders.",
"type": "boolean"
},
"ignoreHidden": {
"description": "exclude hidden files and folders.",
"type": "boolean"
},
"ignoreZeroSizeFolders": {
"description": "ignore folders with 0 size",
"type": "boolean"
},
"rules": {
"description": "list of item rules to apply to specific paths",
"type": "array",
"items": {
"$ref": "#/definitions/settings.ConditionalIndexConfig"
}
}
}
},
"settings.ConditionalIndexConfig": {
"type": "object",
"properties": {
"fileEndsWith": {
"description": "(global) exclude files that end with these suffixes. Eg. \".jpg\" or \".txt\"",
"type": "string"
},
"fileName": {
"description": "(global) exclude files that match these names. Eg. \"file.txt\" or \"test.csv\"",
"type": "string"
},
"fileNames": {
"description": "deprecated: exclude files that match these names. Eg. \"file.txt\" or \"test.csv\"",
"type": "string"
},
"filePath": {
"description": "(global) exclude files that match this path. Eg. \"/path/to/file.txt\" or \"/path/to/file.txt/subfile.txt\"",
"type": "string"
},
"fileStartsWith": {
"description": "(global) exclude files that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "string"
},
"folderEndsWith": {
"description": "(global) exclude folders that end with these suffixes. Eg. \".thumbnails\" or \".git\"",
"type": "string"
},
"folderName": {
"description": "(global) exclude folders that match these names. Eg. \"folder\" or \"subfolder\"",
"type": "string"
},
"folderNames": {
"description": "deprecated: exclude folders that match these names. Eg. \"folder\" or \"subfolder\"",
"type": "string"
},
"folderPath": {
"description": "(global) exclude folders that match this path. Eg. \"/path/to/folder\" or \"/path/to/folder/subfolder\"",
"type": "string"
},
"folderStartsWith": {
"description": "(global) exclude folders that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "string"
},
"includeRootItem": {
"description": "include only these items at root folder level",
"type": "string"
},
"neverWatchPath": {
"description": "index the folder in the first pass to get included in search, but never re-indexed.",
"type": "string"
},
"viewable": {
"description": "Enable viewing in UI but exclude from indexing",
"type": "boolean"
}
}
},
"settings.CustomTheme": {
"type": "object",
"properties": {
@@ -2979,6 +2835,75 @@
}
}
},
"settings.ExcludeIndexFilter": {
"type": "object",
"properties": {
"fileEndsWith": {
"description": "(global) exclude files that end with these suffixes. Eg. \".jpg\" or \".txt\"",
"type": "array",
"items": {
"type": "string"
}
},
"fileNames": {
"description": "(global) list of file names to include/exclude. Eg. \"a.jpg\"",
"type": "array",
"items": {
"type": "string"
}
},
"filePaths": {
"description": "list of filepaths Eg. \"folder1\" or \"file1.txt\" or \"folder1/file1.txt\" (without source path prefix)",
"type": "array",
"items": {
"type": "string"
}
},
"fileStartsWith": {
"description": "(global) exclude files that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "array",
"items": {
"type": "string"
}
},
"folderEndsWith": {
"description": "(global) exclude folders that end with these suffixes. Eg. \".thumbnails\" or \".git\"",
"type": "array",
"items": {
"type": "string"
}
},
"folderNames": {
"description": "(global) list of folder names to include/exclude. Eg. \"@eadir\" or \".thumbnails\"",
"type": "array",
"items": {
"type": "string"
}
},
"folderPaths": {
"description": "(filepath) list of folder names to include/exclude. Eg. \"folder1\" or \"folder1/subfolder\" (do not include source path, just the subpaths from the source path)",
"type": "array",
"items": {
"type": "string"
}
},
"folderStartsWith": {
"description": "(global) exclude folders that start with these prefixes. Eg. \"archive-\" or \"backup-\"",
"type": "array",
"items": {
"type": "string"
}
},
"hidden": {
"description": "exclude hidden files and folders.",
"type": "boolean"
},
"ignoreZeroSizeFolders": {
"description": "ignore folders with 0 size",
"type": "boolean"
}
}
},
"settings.ExternalLink": {
"type": "object",
"required": [
@@ -3065,10 +2990,6 @@
"description": "path to a favicon to use for the frontend",
"type": "string"
},
"loginIcon": {
"description": "path to an image file for the login page icon",
"type": "string"
},
"name": {
"description": "display name",
"type": "string"
@@ -3078,6 +2999,25 @@
}
}
},
"settings.IncludeIndexFilter": {
"type": "object",
"properties": {
"rootFiles": {
"description": "list of root files to include, relative to the source path (eg. \"file1.txt\")",
"type": "array",
"items": {
"type": "string"
}
},
"rootFolders": {
"description": "list of root folders to include, relative to the source path (eg. \"folder1\")",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"settings.Integrations": {
"type": "object",
"properties": {
@@ -3436,14 +3376,6 @@
"settings.SourceConfig": {
"type": "object",
"properties": {
"conditionals": {
"description": "conditional rules to apply when indexing to include/exclude certain items",
"allOf": [
{
"$ref": "#/definitions/settings.ConditionalFilter"
}
]
},
"createUserDir": {
"description": "create a user directory for each user",
"type": "boolean"
@@ -3468,10 +3400,41 @@
"description": "disable the source, this is useful so you don't need to remove it from the config file",
"type": "boolean"
},
"exclude": {
"description": "exclude files and folders from indexing, if include is not set",
"allOf": [
{
"$ref": "#/definitions/settings.ExcludeIndexFilter"
}
]
},
"include": {
"description": "include files and folders from indexing, if exclude is not set",
"allOf": [
{
"$ref": "#/definitions/settings.IncludeIndexFilter"
}
]
},
"indexAlbumArt": {
"description": "deprecated: always enabled since 0.8.6",
"type": "boolean"
},
"indexingIntervalMinutes": {
"description": "optional manual overide interval in minutes to re-index the source",
"type": "integer"
},
"maxWatchers": {
"description": "number of concurrent watchers to use for this source, currently not supported",
"type": "integer"
},
"neverWatchPaths": {
"description": "paths that get initially once. Useful for folders that rarely change contents (without source path prefix)",
"type": "array",
"items": {
"type": "string"
}
},
"private": {
"description": "designate as source as private -- currently just means no sharing permitted.",
"type": "boolean"
@@ -3496,10 +3459,6 @@
"description": "Specify a valid CSS color property value to use as the background color in dark mode",
"type": "string"
},
"disableEventThemes": {
"description": "disable the event based themes,",
"type": "boolean"
},
"lightBackground": {
"description": "specify a valid CSS color property value to use as the background color in light mode",
"type": "string"
@@ -3636,19 +3595,8 @@
"share.CreateBody": {
"type": "object",
"properties": {
"allowCreate": {
"description": "allow creating files",
"type": "boolean"
},
"allowDelete": {
"type": "boolean"
},
"allowModify": {
"description": "allow modifying files",
"type": "boolean"
},
"allowReplacements": {
"description": "allow replacements of files",
"allowUpload": {
"description": "AllowEdit bool `json:\"allowEdit,omitempty\"`",
"type": "boolean"
},
"allowedUsernames": {
@@ -3666,12 +3614,7 @@
"disableAnonymous": {
"type": "boolean"
},
"disableDownload": {
"description": "don't allow downloading files",
"type": "boolean"
},
"disableFileViewer": {
"description": "don't allow viewing files",
"type": "boolean"
},
"disableShareCard": {
@@ -3692,6 +3635,9 @@
"enableOnlyOffice": {
"type": "boolean"
},
"enableOnlyOfficeEditing": {
"type": "boolean"
},
"enforceDarkLightMode": {
"description": "\"dark\" or \"light\"",
"type": "string"
@@ -3759,19 +3705,8 @@
"share.Link": {
"type": "object",
"properties": {
"allowCreate": {
"description": "allow creating files",
"type": "boolean"
},
"allowDelete": {
"type": "boolean"
},
"allowModify": {
"description": "allow modifying files",
"type": "boolean"
},
"allowReplacements": {
"description": "allow replacements of files",
"allowUpload": {
"description": "AllowEdit bool `json:\"allowEdit,omitempty\"`",
"type": "boolean"
},
"allowedUsernames": {
@@ -3789,12 +3724,7 @@
"disableAnonymous": {
"type": "boolean"
},
"disableDownload": {
"description": "don't allow downloading files",
"type": "boolean"
},
"disableFileViewer": {
"description": "don't allow viewing files",
"type": "boolean"
},
"disableShareCard": {
@@ -3818,6 +3748,9 @@
"enableOnlyOffice": {
"type": "boolean"
},
"enableOnlyOfficeEditing": {
"type": "boolean"
},
"enforceDarkLightMode": {
"description": "\"dark\" or \"light\"",
"type": "string"
@@ -3940,35 +3873,18 @@
"type": "object",
"properties": {
"admin": {
"description": "allow admin access",
"type": "boolean"
},
"api": {
"description": "allow api access",
"type": "boolean"
},
"create": {
"description": "allow creating or uploading files",
"type": "boolean"
},
"delete": {
"description": "allow deleting files",
"type": "boolean"
},
"download": {
"description": "allow downloading files",
"type": "boolean"
},
"modify": {
"description": "allow modifying files",
"type": "boolean"
},
"realtime": {
"description": "allow realtime updates",
"type": "boolean"
},
"share": {
"description": "allow sharing files",
"type": "boolean"
}
}
@@ -4171,9 +4087,6 @@
"$ref": "#/definitions/users.SourceScope"
}
},
"showFirstLogin": {
"type": "boolean"
},
"showHidden": {
"description": "show hidden files in the UI. On windows this includes files starting with a dot and windows hidden files",
"type": "boolean"
@@ -4206,9 +4119,6 @@
"username": {
"type": "string"
},
"version": {
"type": "integer"
},
"viewMode": {
"description": "view mode to use: eg. normal, list, grid, or compact",
"type": "string"
+239 -309
View File
@@ -37,6 +37,13 @@ definitions:
token:
type: string
type: object
http.signupBody:
properties:
password:
type: string
username:
type: string
type: object
indexing.IndexStatus:
enum:
- ready
@@ -160,77 +167,6 @@ definitions:
description: 'secret: secret used to encrypt TOTP secrets'
type: string
type: object
settings.ConditionalFilter:
properties:
hidden:
description: 'deprecated: use ignoreHidden instead to exclude hidden files
and folders.'
type: boolean
ignoreHidden:
description: exclude hidden files and folders.
type: boolean
ignoreZeroSizeFolders:
description: ignore folders with 0 size
type: boolean
rules:
description: list of item rules to apply to specific paths
items:
$ref: '#/definitions/settings.ConditionalIndexConfig'
type: array
type: object
settings.ConditionalIndexConfig:
properties:
fileEndsWith:
description: (global) exclude files that end with these suffixes. Eg. ".jpg"
or ".txt"
type: string
fileName:
description: (global) exclude files that match these names. Eg. "file.txt"
or "test.csv"
type: string
fileNames:
description: 'deprecated: exclude files that match these names. Eg. "file.txt"
or "test.csv"'
type: string
filePath:
description: (global) exclude files that match this path. Eg. "/path/to/file.txt"
or "/path/to/file.txt/subfile.txt"
type: string
fileStartsWith:
description: (global) exclude files that start with these prefixes. Eg. "archive-"
or "backup-"
type: string
folderEndsWith:
description: (global) exclude folders that end with these suffixes. Eg. ".thumbnails"
or ".git"
type: string
folderName:
description: (global) exclude folders that match these names. Eg. "folder"
or "subfolder"
type: string
folderNames:
description: 'deprecated: exclude folders that match these names. Eg. "folder"
or "subfolder"'
type: string
folderPath:
description: (global) exclude folders that match this path. Eg. "/path/to/folder"
or "/path/to/folder/subfolder"
type: string
folderStartsWith:
description: (global) exclude folders that start with these prefixes. Eg.
"archive-" or "backup-"
type: string
includeRootItem:
description: include only these items at root folder level
type: string
neverWatchPath:
description: index the folder in the first pass to get included in search,
but never re-indexed.
type: string
viewable:
description: Enable viewing in UI but exclude from indexing
type: boolean
type: object
settings.CustomTheme:
properties:
css:
@@ -240,6 +176,63 @@ definitions:
description: The description of the theme to display in the UI.
type: string
type: object
settings.ExcludeIndexFilter:
properties:
fileEndsWith:
description: (global) exclude files that end with these suffixes. Eg. ".jpg"
or ".txt"
items:
type: string
type: array
fileNames:
description: (global) list of file names to include/exclude. Eg. "a.jpg"
items:
type: string
type: array
filePaths:
description: list of filepaths Eg. "folder1" or "file1.txt" or "folder1/file1.txt"
(without source path prefix)
items:
type: string
type: array
fileStartsWith:
description: (global) exclude files that start with these prefixes. Eg. "archive-"
or "backup-"
items:
type: string
type: array
folderEndsWith:
description: (global) exclude folders that end with these suffixes. Eg. ".thumbnails"
or ".git"
items:
type: string
type: array
folderNames:
description: (global) list of folder names to include/exclude. Eg. "@eadir"
or ".thumbnails"
items:
type: string
type: array
folderPaths:
description: (filepath) list of folder names to include/exclude. Eg. "folder1"
or "folder1/subfolder" (do not include source path, just the subpaths from
the source path)
items:
type: string
type: array
folderStartsWith:
description: (global) exclude folders that start with these prefixes. Eg.
"archive-" or "backup-"
items:
type: string
type: array
hidden:
description: exclude hidden files and folders.
type: boolean
ignoreZeroSizeFolders:
description: ignore folders with 0 size
type: boolean
type: object
settings.ExternalLink:
properties:
text:
@@ -303,15 +296,27 @@ definitions:
favicon:
description: path to a favicon to use for the frontend
type: string
loginIcon:
description: path to an image file for the login page icon
type: string
name:
description: display name
type: string
styling:
$ref: '#/definitions/settings.StylingConfig'
type: object
settings.IncludeIndexFilter:
properties:
rootFiles:
description: list of root files to include, relative to the source path (eg.
"file1.txt")
items:
type: string
type: array
rootFolders:
description: list of root folders to include, relative to the source path
(eg. "folder1")
items:
type: string
type: array
type: object
settings.Integrations:
properties:
media:
@@ -577,11 +582,6 @@ definitions:
type: object
settings.SourceConfig:
properties:
conditionals:
allOf:
- $ref: '#/definitions/settings.ConditionalFilter'
description: conditional rules to apply when indexing to include/exclude certain
items
createUserDir:
description: create a user directory for each user
type: boolean
@@ -601,9 +601,30 @@ definitions:
description: disable the source, this is useful so you don't need to remove
it from the config file
type: boolean
exclude:
allOf:
- $ref: '#/definitions/settings.ExcludeIndexFilter'
description: exclude files and folders from indexing, if include is not set
include:
allOf:
- $ref: '#/definitions/settings.IncludeIndexFilter'
description: include files and folders from indexing, if exclude is not set
indexAlbumArt:
description: 'deprecated: always enabled since 0.8.6'
type: boolean
indexingIntervalMinutes:
description: optional manual overide interval in minutes to re-index the source
type: integer
maxWatchers:
description: number of concurrent watchers to use for this source, currently
not supported
type: integer
neverWatchPaths:
description: paths that get initially once. Useful for folders that rarely
change contents (without source path prefix)
items:
type: string
type: array
private:
description: designate as source as private -- currently just means no sharing
permitted.
@@ -626,9 +647,6 @@ definitions:
description: Specify a valid CSS color property value to use as the background
color in dark mode
type: string
disableEventThemes:
description: disable the event based themes,
type: boolean
lightBackground:
description: specify a valid CSS color property value to use as the background
color in light mode
@@ -733,16 +751,8 @@ definitions:
type: object
share.CreateBody:
properties:
allowCreate:
description: allow creating files
type: boolean
allowDelete:
type: boolean
allowModify:
description: allow modifying files
type: boolean
allowReplacements:
description: allow replacements of files
allowUpload:
description: AllowEdit bool `json:"allowEdit,omitempty"`
type: boolean
allowedUsernames:
items:
@@ -754,11 +764,7 @@ definitions:
type: string
disableAnonymous:
type: boolean
disableDownload:
description: don't allow downloading files
type: boolean
disableFileViewer:
description: don't allow viewing files
type: boolean
disableShareCard:
type: boolean
@@ -772,6 +778,8 @@ definitions:
type: integer
enableOnlyOffice:
type: boolean
enableOnlyOfficeEditing:
type: boolean
enforceDarkLightMode:
description: '"dark" or "light"'
type: string
@@ -819,16 +827,8 @@ definitions:
type: object
share.Link:
properties:
allowCreate:
description: allow creating files
type: boolean
allowDelete:
type: boolean
allowModify:
description: allow modifying files
type: boolean
allowReplacements:
description: allow replacements of files
allowUpload:
description: AllowEdit bool `json:"allowEdit,omitempty"`
type: boolean
allowedUsernames:
items:
@@ -840,11 +840,7 @@ definitions:
type: string
disableAnonymous:
type: boolean
disableDownload:
description: don't allow downloading files
type: boolean
disableFileViewer:
description: don't allow viewing files
type: boolean
disableShareCard:
type: boolean
@@ -860,6 +856,8 @@ definitions:
type: integer
enableOnlyOffice:
type: boolean
enableOnlyOfficeEditing:
type: boolean
enforceDarkLightMode:
description: '"dark" or "light"'
type: string
@@ -948,28 +946,14 @@ definitions:
users.Permissions:
properties:
admin:
description: allow admin access
type: boolean
api:
description: allow api access
type: boolean
create:
description: allow creating or uploading files
type: boolean
delete:
description: allow deleting files
type: boolean
download:
description: allow downloading files
type: boolean
modify:
description: allow modifying files
type: boolean
realtime:
description: allow realtime updates
type: boolean
share:
description: allow sharing files
type: boolean
type: object
users.Preview:
@@ -1112,8 +1096,6 @@ definitions:
items:
$ref: '#/definitions/users.SourceScope'
type: array
showFirstLogin:
type: boolean
showHidden:
description: show hidden files in the UI. On windows this includes files starting
with a dot and windows hidden files
@@ -1140,8 +1122,6 @@ definitions:
type: string
username:
type: string
version:
type: integer
viewMode:
description: 'view mode to use: eg. normal, list, grid, or compact'
type: string
@@ -1407,33 +1387,6 @@ paths:
summary: Get all groups or groups for a user
tags:
- Access
/api/auth/login:
post:
consumes:
- application/json
description: Authenticate a user with a username and password.
produces:
- application/json
responses:
"200":
description: JWT token for authentication
schema:
type: string
"403":
description: Forbidden - authentication failed
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: User login
tags:
- Auth
/api/auth/logout:
post:
description: Returns a logout URL for the frontend to redirect to.
@@ -1555,45 +1508,6 @@ paths:
summary: Verify OTP
tags:
- OTP
/api/auth/signup:
post:
consumes:
- application/json
description: Register a new user account with a username and password.
produces:
- application/json
responses:
"201":
description: User created successfully
schema:
type: string
"400":
description: Bad request - invalid input
schema:
additionalProperties:
type: string
type: object
"405":
description: Method not allowed - signup is disabled
schema:
additionalProperties:
type: string
type: object
"409":
description: Conflict - user already exists
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: User signup
tags:
- Auth
/api/auth/token:
delete:
consumes:
@@ -1748,6 +1662,33 @@ paths:
summary: Get jobs info
tags:
- Jobs
/api/login:
post:
consumes:
- application/json
description: Authenticate a user with a username and password.
produces:
- application/json
responses:
"200":
description: JWT token for authentication
schema:
type: string
"403":
description: Forbidden - authentication failed
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: User login
tags:
- Auth
/api/media/subtitles:
get:
consumes:
@@ -2359,64 +2300,6 @@ paths:
summary: Create a share link
tags:
- Shares
/api/share/direct:
get:
consumes:
- application/json
description: Creates a direct download link for a specific file with configurable
duration, download count, and speed limits. If a share already exists with
matching parameters, the existing share will be reused.
parameters:
- description: File path to create download link for
in: query
name: path
required: true
type: string
- description: Source name for the file
in: query
name: source
required: true
type: string
- description: 'Duration in minutes for link validity (default: 60)'
in: query
name: duration
type: string
- description: 'Maximum number of downloads allowed (default: unlimited)'
in: query
name: count
type: string
- description: 'Download speed limit in kbps (default: unlimited)'
in: query
name: speed
type: string
produces:
- application/json
responses:
"201":
description: Direct download link created
schema:
$ref: '#/definitions/http.DirectDownloadResponse'
"400":
description: Bad request - invalid parameters or path is not a file
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden - access denied
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: Create direct download link
tags:
- Shares
/api/shares:
delete:
consumes:
@@ -2471,6 +2354,52 @@ paths:
summary: List share links
tags:
- Shares
/api/signup:
post:
consumes:
- application/json
description: Register a new user account with a username and password.
parameters:
- description: User signup details
in: body
name: body
required: true
schema:
$ref: '#/definitions/http.signupBody'
produces:
- application/json
responses:
"201":
description: User created successfully
schema:
type: string
"400":
description: Bad request - invalid input
schema:
additionalProperties:
type: string
type: object
"405":
description: Method not allowed - signup is disabled
schema:
additionalProperties:
type: string
type: object
"409":
description: Conflict - user already exists
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: User signup
tags:
- Auth
/api/users:
delete:
consumes:
@@ -2842,63 +2771,6 @@ paths:
summary: Upload files to a public upload share
tags:
- Public Shares
put:
consumes:
- application/json
description: Updates the content of a file in a public share.
parameters:
- description: Share hash for authentication
in: query
name: hash
required: true
type: string
- description: Path to the file to update
in: query
name: path
required: true
type: string
- description: New content for the file
in: body
name: content
required: true
schema:
type: string
produces:
- application/json
responses:
"200":
description: File updated successfully
schema:
additionalProperties:
type: string
type: object
"400":
description: Invalid request or parameters
schema:
additionalProperties:
type: string
type: object
"403":
description: Share unavailable or update not allowed
schema:
additionalProperties:
type: string
type: object
"404":
description: Share not found or file not found
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: Update a file in a public share
tags:
- Public Shares
/public/api/share:
get:
consumes:
@@ -2950,4 +2822,62 @@ paths:
summary: Get file/directory information from a public share
tags:
- Public Shares
/public/share/direct:
get:
consumes:
- application/json
description: Creates a direct download link for a specific file with configurable
duration, download count, and speed limits. If a share already exists with
matching parameters, the existing share will be reused.
parameters:
- description: File path to create download link for
in: query
name: path
required: true
type: string
- description: Source name for the file
in: query
name: source
required: true
type: string
- description: 'Duration in minutes for link validity (default: 60)'
in: query
name: duration
type: string
- description: 'Maximum number of downloads allowed (default: unlimited)'
in: query
name: count
type: string
- description: 'Download speed limit in kbps (default: unlimited)'
in: query
name: speed
type: string
produces:
- application/json
responses:
"201":
description: Direct download link created
schema:
$ref: '#/definitions/http.DirectDownloadResponse'
"400":
description: Bad request - invalid parameters or path is not a file
schema:
additionalProperties:
type: string
type: object
"403":
description: Forbidden - access denied
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
summary: Create direct download link
tags:
- Shares
swagger: "2.0"
-1
View File
@@ -22,7 +22,6 @@
}
},
"rules": {
"no-unreachable": "off",
// vue-i18n rules:
// This rule will check if the key used in $t() exists in your locale messages.
// By default, it checks against all locales. We want it to primarily use 'en.json'
+4 -4
View File
@@ -4,14 +4,14 @@
"private": true,
"type": "module",
"engines": {
"npm": ">=9.0.0",
"node": ">=20.0.0"
"npm": ">=7.0.0",
"node": ">=18.0.0"
},
"scripts": {
"build": "rm -rf ../backend/http/dist/* && rm -rf ../backend/http/embed/* && vite build --outDir ../backend/http/dist && cp -r ../backend/http/dist/* ../backend/http/embed",
"build": "vite build --outDir ../backend/http/dist && cp -r ../backend/http/dist/* ../backend/http/embed",
"build:windows": "vite build --outDir ../backend/http/dist && robocopy ../backend/http/dist ../backend/http/embed /e",
"build:docker": "vite build",
"watch": "vite build --watch --outDir ../backend/http/dist",
"watch": "DEV_BUILD=true vite build --watch --outDir ../backend/http/dist",
"typecheck": "vue-tsc -p ./tsconfig.json --noEmit",
"lint": "eslint --ext .js,.vue,ts src",
"lint:fix": "eslint --fix src/",
+4 -17
View File
@@ -12,7 +12,7 @@ import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
globalSetup: "./tests/playwright/local-setup",
timeout: 5000,
testDir: "./tests/playwright/local",
testDir: "./tests/playwright/copy",
/* Run tests in files in parallel */
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -20,6 +20,7 @@ export default defineConfig({
/* Retry on CI only */
retries: 2,
/* Opt out of parallel tests on CI. */
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "line",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
@@ -39,22 +40,8 @@ export default defineConfig({
/* Configure projects for major browsers */
projects: [
{
name: "dark-screenshots",
use: {
...devices["Desktop Firefox"],
theme: 'dark',
},
testMatch: /.*screenshots.spec.ts/,
retries: 0,
},
{
name: "light-screenshots",
use: {
...devices["Desktop Firefox"],
theme: 'light',
},
testMatch: /.*screenshots.spec.ts/,
retries: 0,
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
],
});
+22 -26
View File
@@ -27,21 +27,22 @@ server:
disabled: false # disable the source, this is useful so you don't need to remove it from the config file
indexingIntervalMinutes: 0 # optional manual overide interval in minutes to re-index the source
disableIndexing: false # disable the indexing of this source
conditionals: # conditional rules to apply when indexing to include/exclude certain items
ignoreHidden: false # exclude hidden files and folders.
maxWatchers: 0 # number of concurrent watchers to use for this source, currently not supported
neverWatchPaths: # paths that get initially once. Useful for folders that rarely change contents (without source path prefix)
exclude: # exclude files and folders from indexing, if include is not set
hidden: false # exclude hidden files and folders.
ignoreZeroSizeFolders: false # ignore folders with 0 size
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.
includeRootItem: "" # include only these items at root folder level
fileStartsWith: "" # (global) exclude files that start with these prefixes. Eg. "archive-" or "backup-"
folderStartsWith: "" # (global) exclude folders that start with these prefixes. Eg. "archive-" or "backup-"
fileEndsWith: "" # (global) exclude files that end with these suffixes. Eg. ".jpg" or ".txt"
folderEndsWith: "" # (global) exclude folders that end with these suffixes. Eg. ".thumbnails" or ".git"
folderPath: "" # (global) exclude folders that match this path. Eg. "/path/to/folder" or "/path/to/folder/subfolder"
filePath: "" # (global) exclude files that match this path. Eg. "/path/to/file.txt" or "/path/to/file.txt/subfile.txt"
fileName: "" # (global) exclude files that match these names. Eg. "file.txt" or "test.csv"
folderName: "" # (global) exclude folders that match these names. Eg. "folder" or "subfolder"
viewable: false # Enable viewing in UI but exclude from indexing
filePaths: # list of filepaths Eg. "folder1" or "file1.txt" or "folder1/file1.txt" (without source path prefix)
folderPaths: # (filepath) list of folder names to include/exclude. Eg. "folder1" or "folder1/subfolder" (do not include source path, just the subpaths from the source path)
fileNames: # (global) list of file names to include/exclude. Eg. "a.jpg"
folderNames: # (global) list of folder names to include/exclude. Eg. "@eadir" or ".thumbnails"
fileEndsWith: # (global) exclude files that end with these suffixes. Eg. ".jpg" or ".txt"
folderEndsWith: # (global) exclude folders that end with these suffixes. Eg. ".thumbnails" or ".git"
fileStartsWith: # (global) exclude files that start with these prefixes. Eg. "archive-" or "backup-"
folderStartsWith: # (global) exclude folders that start with these prefixes. Eg. "archive-" or "backup-"
include: # include files and folders from indexing, if exclude is not set
rootFolders: # list of root folders to include, relative to the source path (eg. "folder1")
rootFiles: # list of root files to include, relative to the source path (eg. "file1.txt")
defaultUserScope: "/" # default "/" should match folders under path
defaultEnabled: true # should be added as a default source for new users?
createUserDir: false # create a user directory for each user
@@ -83,8 +84,8 @@ auth:
adminGroup: "" # if set, users in this group will be granted admin privileges.
groupsClaim: "groups" # the JSON field name to read groups from. Default is "groups"
key: "" # secret: the key used to sign the JWT tokens. If not set, a random key will be generated.
adminUsername: "admin" # secret: the username of the admin user. If not set, the default is "admin".
adminPassword: "admin" # secret: the password of the admin user. If not set, the default is "admin".
adminUsername: "**hidden**" # secret: the username of the admin user. If not set, the default is "admin".
adminPassword: "**hidden**" # secret: the password of the admin user. If not set, the default is "admin".
totpSecret: "" # secret: secret used to encrypt TOTP secrets
frontend:
name: "FileBrowser Quantum" # display name
@@ -99,7 +100,6 @@ frontend:
url: "help prompt" # the url to link to validate:required
disableNavButtons: false # disable the nav buttons in the sidebar
styling:
disableEventThemes: false # disable the event based themes,
customCSS: "" # if a valid path to a css file is provided, it will be applied for all users. (eg. "reduce-rounded-corners.css")
lightBackground: "#f5f5f5" # specify a valid CSS color property value to use as the background color in light mode
darkBackground: "#141D24" # Specify a valid CSS color property value to use as the background color in dark mode
@@ -112,7 +112,6 @@ frontend:
css: "" # The css file path and filename to use for the theme.
favicon: "" # path to a favicon to use for the frontend
description: "FileBrowser Quantum is a file manager for the web which can be used to manage files on your server" # description that shows up in html head meta description
loginIcon: "" # path to an image file for the login page icon
userDefaults:
editorQuickSave: false # show quick save button in editor
hideSidebarFileActions: false # hide the file actions in the sidebar
@@ -144,14 +143,11 @@ userDefaults:
defaultMediaPlayer: false # disable html5 media player and use the default media player
folder: false # show thumbnail preview image for folder files
permissions:
api: false # allow api access
admin: false # allow admin access
modify: false # allow modifying files
share: false # allow sharing files
realtime: false # allow realtime updates
delete: false # allow deleting files
create: false # allow creating or uploading files
download: false # allow downloading files
api: false
admin: false
modify: false
share: false
realtime: false
loginMethod: "password" # login method to use: eg. password, proxy, oidc
disableUpdateNotifications: false # disable update notifications banner for admin users
deleteWithoutConfirming: false # delete files without confirmation
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff. Show more