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(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog] - - - - + + - + }); + + - -
-

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]

+ +
+ +
- +
+ + diff --git a/src/webui/www/private/addtrackers.html b/src/webui/www/private/addtrackers.html index e78a24091..7321d5a75 100644 --- a/src/webui/www/private/addtrackers.html +++ b/src/webui/www/private/addtrackers.html @@ -47,10 +47,10 @@
-
+

QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDialog]

-
+
diff --git a/src/webui/www/private/confirmdeletion.html b/src/webui/www/private/confirmdeletion.html index 60aa45f16..6ee9050de 100644 --- a/src/webui/www/private/confirmdeletion.html +++ b/src/webui/www/private/confirmdeletion.html @@ -42,10 +42,10 @@ -
+

  QBT_TR(Are you sure you want to delete the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]

-     

+     

    
diff --git a/src/webui/www/private/download.html b/src/webui/www/private/download.html index b7a4a50a5..91cbba935 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -16,7 +16,7 @@
-
+

QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]

QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]

diff --git a/src/webui/www/private/edittracker.html b/src/webui/www/private/edittracker.html index c4ffc1ac9..56420fd16 100644 --- a/src/webui/www/private/edittracker.html +++ b/src/webui/www/private/edittracker.html @@ -58,12 +58,12 @@
-
+

QBT_TR(Tracker URL:)QBT_TR[CONTEXT=TrackerListWidget]

-
+
diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 948914d75..aa01441e5 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -46,69 +46,69 @@
  • QBT_TR(File)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Edit)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(View)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Tools)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Help)QBT_TR[CONTEXT=MainWindow]
  •    - QBT_TR(Add Torrent Link...)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Add Torrent File...)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Delete)QBT_TR[CONTEXT=TransferListWidget] - QBT_TR(Resume)QBT_TR[CONTEXT=TransferListWidget] - QBT_TR(Pause)QBT_TR[CONTEXT=TransferListWidget] + QBT_TR(Add Torrent Link...)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Add Torrent File...)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Delete)QBT_TR[CONTEXT=TransferListWidget] + QBT_TR(Resume)QBT_TR[CONTEXT=TransferListWidget] + QBT_TR(Pause)QBT_TR[CONTEXT=TransferListWidget] - QBT_TR(Top of Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Move Up Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Bottom of Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Top of Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Move Up Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Bottom of Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog] + QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog]
    diff --git a/src/webui/www/private/views/propertiesToolbar.html b/src/webui/www/private/views/propertiesToolbar.html index 789dc320e..aa0c924ad 100644 --- a/src/webui/www/private/views/propertiesToolbar.html +++ b/src/webui/www/private/views/propertiesToolbar.html @@ -1,7 +1,7 @@
    - +