feat: add convenience batch file

This commit is contained in:
itsscb 2025-04-16 14:17:58 +02:00
parent 20d037b1e8
commit 910dadf061
2 changed files with 30 additions and 17 deletions

View File

@ -25,29 +25,38 @@ process
Copy-Item $MyInvocation.MyCommand.Path $Path -Force | Out-Null
Write-Warning "Initializing Database"
$null = filebrowser config init -d $db_path -c $config_path | Out-Null
filebrowser users add guest "" `
--perm.download=true `
--perm.admin=false `
--perm.delete=false `
--perm.execute=false `
--perm.modify=false `
--perm.rename=false `
--perm.share=false `
--perm.create=false `
--locale=de `
--viewMode 'list' `
--scope "." `
--lockPassword `
-d $db_path `
-c $config_path | Out-Null
Write-Warning "Folgender Ordner ist nun öffentlich zugänglich: $Path"
Write-Warning "Creating 'guest' User"
$filebrowserArgs = @(
'users',
'add',
'guest', '""',
'--perm.download=true',
'--perm.admin=false',
'--perm.delete=false',
'--perm.execute=false',
'--perm.modify=false',
'--perm.rename=false',
'--perm.share=false',
'--perm.create=false',
'--locale=de',
'--viewMode', 'list',
'--scope', ".",
'--lockPassword',
'-d', $db_path,
'-c', $config_path)
& filebrowser @filebrowserArgs | Out-Null
Write-Warning "Folgender Ordner ist nun oeffentlich zugaenglich: $Path"
filebrowser -r $Path -d $db_path -c $config_path -a "0.0.0.0"
}
begin
{
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()
$config_json = '{
"settings": {
"signup": false,
@ -150,7 +159,7 @@ begin
Set-Alias 'filebrowser' $filebrowser_exe
$config_path = Join-Path $app_dir 'config.json'
$config_json > $config_path
$config_json | Set-Content -Path $config_path
$db_path = Join-Path $app_dir "filebrowser.db"
if(Test-Path $db_path -PathType Leaf)

4
run.bat Normal file
View File

@ -0,0 +1,4 @@
@echo off
chcp 65001 >nul
powershell -NoProfile -ExecutionPolicy ByPass -File "%~dp0Start-FileBrowser.ps1"
pause