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