diff --git a/Start-FileBrowser.ps1 b/Start-FileBrowser.ps1 index 9cdd2dd..55dcd97 100644 --- a/Start-FileBrowser.ps1 +++ b/Start-FileBrowser.ps1 @@ -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) diff --git a/run.bat b/run.bat new file mode 100644 index 0000000..507e90a --- /dev/null +++ b/run.bat @@ -0,0 +1,4 @@ +@echo off +chcp 65001 >nul +powershell -NoProfile -ExecutionPolicy ByPass -File "%~dp0Start-FileBrowser.ps1" +pause