diff --git a/.github/workflows/webui_ci.yaml b/.github/workflows/webui_ci.yaml new file mode 100644 index 000000000..aa836523d --- /dev/null +++ b/.github/workflows/webui_ci.yaml @@ -0,0 +1,31 @@ +name: WebUI CI + +on: [pull_request, push] + +jobs: + check_webui: + name: Check WebUI + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: src/webui/www + + steps: + - name: checkout repository + uses: actions/checkout@v2 + + - name: setup nodejs + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: install tools + run: npm install + + - name: lint code + run: npm run lint + + - name: format code + run: | + npm run format + git diff --exit-code diff --git a/src/webui/www/.eslintrc.json b/src/webui/www/.eslintrc.json new file mode 100644 index 000000000..c2cb0a275 --- /dev/null +++ b/src/webui/www/.eslintrc.json @@ -0,0 +1,14 @@ +{ + "env": { + "browser": true, + "es2020": true + }, + "extends": "eslint:recommended", + "plugins": [ + "html" + ], + "rules": { + "no-undef": "off", + "no-unused-vars": "off" + } +} diff --git a/src/webui/www/.jsbeautifyrc b/src/webui/www/.jsbeautifyrc index 63cfb7984..8aa593440 100644 --- a/src/webui/www/.jsbeautifyrc +++ b/src/webui/www/.jsbeautifyrc @@ -11,7 +11,7 @@ "space_in_empty_paren": false, "jslint_happy": false, "space_after_anon_function": false, - "brace_style": "end-expand", + "brace_style": "end-expand,preserve-inline", "unindent_chained_methods": false, "break_chained_methods": false, "keep_array_indentation": false, diff --git a/src/webui/www/package.json b/src/webui/www/package.json new file mode 100644 index 000000000..e94124882 --- /dev/null +++ b/src/webui/www/package.json @@ -0,0 +1,17 @@ +{ + "name": "webui", + "description": "qBittorrent WebUI", + "repository": { + "type": "git", + "url": "https://github.com/qbittorrent/qBittorrent.git" + }, + "scripts": { + "format": "js-beautify private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js", + "lint": "eslint private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js" + }, + "devDependencies": { + "eslint": "*", + "eslint-plugin-html": "*", + "js-beautify": "*" + } +} diff --git a/src/webui/www/private/addpeers.html b/src/webui/www/private/addpeers.html index fb19ae181..c2075f763 100644 --- a/src/webui/www/private/addpeers.html +++ b/src/webui/www/private/addpeers.html @@ -1,69 +1,71 @@ -
- -QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]
- -QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]
+ +