diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2ba3a271..781aa085 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,12 +4,11 @@ Please explain the changes you made here. If the feature changes current behaviour, explain why your solution is better. --> -:rotating_light: Before submitting your PR, please read [community](https://github.com/filebrowser/community), and indicate which issues (in any of the repos) are either fixed or closed by this PR. See [GitHub Help: Closing issues using keywords](https://help.github.com/articles/closing-issues-via-commit-messages/). +:rotating_light: Before submitting your PR, please indicate which issues are either fixed or closed by this PR. See [GitHub Help: Closing issues using keywords](https://help.github.com/articles/closing-issues-via-commit-messages/). - [ ] DO make sure you are requesting to **pull a topic/feature/bugfix branch** (right side). Don't request your master! - [ ] DO make sure you are making a pull request against the **master branch** (left side). Also you should start *your branch* off *our master*. - [ ] DO make sure that File Browser can be successfully built. See [builds](https://github.com/filebrowser/community/blob/master/builds.md) and [development](https://github.com/filebrowser/community/blob/master/development.md). -- [ ] DO make sure that related issues are opened in other repositories. I.e., the frontend, caddy plugins or the web page need to be updated accordingly. - [ ] AVOID breaking the continuous integration build. **Further comments** diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c504686a..ff6ea28d 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -13,26 +13,26 @@ jobs: lint-frontend: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: '18' - run: make lint-frontend lint-backend: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21.0 - run: make lint-backend lint-commits: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '18' - run: make lint-commits @@ -46,16 +46,16 @@ jobs: test-frontend: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: '18' - run: make test-frontend test-backend: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21.0 - run: make test-backend @@ -71,13 +71,13 @@ jobs: needs: [lint, test] if: startsWith(github.event.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v5 with: go-version: 1.21.0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v4 with: node-version: '18' - name: Set up QEMU diff --git a/cmd/config.go b/cmd/config.go index ed3cc772..5c7efbba 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -31,6 +31,7 @@ func addConfigFlags(flags *pflag.FlagSet) { addServerFlags(flags) addUserFlags(flags) flags.BoolP("signup", "s", false, "allow users to signup") + flags.Bool("create-user-dir", false, "generate user's home directory automatically") flags.String("shell", "", "shell command to which other commands should be appended") flags.String("auth.method", string(auth.MethodJSONAuth), "authentication type") diff --git a/cmd/config_init.go b/cmd/config_init.go index 7d183368..611e6c50 100644 --- a/cmd/config_init.go +++ b/cmd/config_init.go @@ -29,11 +29,12 @@ override the options.`, authMethod, auther := getAuthentication(flags) s := &settings.Settings{ - Key: generateKey(), - Signup: mustGetBool(flags, "signup"), - Shell: convertCmdStrToCmdArray(mustGetString(flags, "shell")), - AuthMethod: authMethod, - Defaults: defaults, + Key: generateKey(), + Signup: mustGetBool(flags, "signup"), + CreateUserDir: mustGetBool(flags, "create-user-dir"), + Shell: convertCmdStrToCmdArray(mustGetString(flags, "shell")), + AuthMethod: authMethod, + Defaults: defaults, Branding: settings.Branding{ Name: mustGetString(flags, "branding.name"), DisableExternal: mustGetBool(flags, "branding.disableExternal"), diff --git a/cmd/config_set.go b/cmd/config_set.go index ba800adb..9dbea9dc 100644 --- a/cmd/config_set.go +++ b/cmd/config_set.go @@ -49,6 +49,8 @@ you want to change. Other options will remain unchanged.`, hasAuth = true case "shell": set.Shell = convertCmdStrToCmdArray(mustGetString(flags, flag.Name)) + case "create-user-dir": + set.CreateUserDir = mustGetBool(flags, flag.Name) case "branding.name": set.Branding.Name = mustGetString(flags, flag.Name) case "branding.color": diff --git a/files/file.go b/files/file.go index c0460ac8..1c3788e0 100644 --- a/files/file.go +++ b/files/file.go @@ -24,7 +24,7 @@ import ( "github.com/filebrowser/filebrowser/v2/rules" ) -const PermFile = 0664 +const PermFile = 0644 const PermDir = 0755 // FileInfo describes a file. diff --git a/fileutils/file.go b/fileutils/file.go index 81aeffeb..fdf11225 100644 --- a/fileutils/file.go +++ b/fileutils/file.go @@ -7,6 +7,8 @@ import ( "path/filepath" "github.com/spf13/afero" + + "github.com/filebrowser/filebrowser/v2/files" ) // MoveFile moves file from src to dst. @@ -40,13 +42,13 @@ func CopyFile(fs afero.Fs, source, dest string) error { // Makes the directory needed to create the dst // file. - err = fs.MkdirAll(filepath.Dir(dest), 0666) //nolint:gomnd + err = fs.MkdirAll(filepath.Dir(dest), files.PermDir) if err != nil { return err } // Create the destination file. - dst, err := fs.OpenFile(dest, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0775) //nolint:gomnd + dst, err := fs.OpenFile(dest, os.O_RDWR|os.O_CREATE|os.O_TRUNC, files.PermFile) if err != nil { return err } diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d898e595..0b3ec184 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -46,7 +46,7 @@ "postcss": "^8.4.31", "prettier": "^3.0.1", "terser": "^5.19.2", - "vite": "^4.4.12", + "vite": "^4.5.2", "vite-plugin-compression2": "^0.10.3", "vite-plugin-rewrite-all": "^1.0.1" } @@ -5663,9 +5663,9 @@ "dev": true }, "node_modules/vite": { - "version": "4.4.12", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.12.tgz", - "integrity": "sha512-KtPlUbWfxzGVul8Nut8Gw2Qe8sBzWY+8QVc5SL8iRFnpnrcoCaNlzO40c1R6hPmcdTwIPEDkq0Y9+27a5tVbdQ==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", + "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/frontend/package.json b/frontend/package.json index 4449a5f5..b0ff7612 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -52,7 +52,7 @@ "postcss": "^8.4.31", "prettier": "^3.0.1", "terser": "^5.19.2", - "vite": "^4.4.12", + "vite": "^4.5.2", "vite-plugin-compression2": "^0.10.3", "vite-plugin-rewrite-all": "^1.0.1" }, diff --git a/frontend/public/index.html b/frontend/public/index.html index 39d926d8..530da7cf 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -16,6 +16,8 @@ [{[ if .Name -]}][{[ .Name ]}][{[ else ]}]File Browser[{[ end ]}] + +