Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: web client refresh #1476

Merged
merged 114 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
550cbc6
refactor: add prefer-const to eslint
ckerr Sep 20, 2020
ddab4af
refactor: add no-unused-vars to eslint
ckerr Sep 20, 2020
1d06d36
refactor: add no-undef to eslint
ckerr Sep 20, 2020
c7e8f94
refactor: add no-var to eslint
ckerr Sep 20, 2020
4919880
refactor: add prefer-template to eslint
ckerr Sep 20, 2020
c83f19f
refactor: add object-shorthand to eslint rules
ckerr Sep 20, 2020
2e4b53c
refactor: add prefer-spread to eslint rules
ckerr Sep 20, 2020
b8a5493
refactor: add prefer-rest-params to eslint rules
ckerr Sep 20, 2020
00516ab
refactor: add prefer-numeric-literals to eslint rules
ckerr Sep 20, 2020
c8cf6d9
refactor: add no-use-before-define to eslint rules
ckerr Sep 20, 2020
0c77c84
refactor: add strict to eslint rules
ckerr Sep 20, 2020
773431d
refactor: add init-declarations to eslint rules
ckerr Sep 21, 2020
c7b2046
refactor: add no-shadow to eslint rules
ckerr Sep 21, 2020
4b88dca
refactor: add class-methods-use-this to eslint rules
ckerr Sep 21, 2020
7a27d0b
refactor: add eqeqeq to eslint rules
ckerr Sep 21, 2020
aa9a0a5
refactor: add sort-keys to eslint rules
ckerr Sep 21, 2020
4d39893
refactor: add prefer-destructuring to eslint rules
ckerr Sep 21, 2020
dd9bcad
refactor: add arrow-spacing to eslint rules
ckerr Sep 21, 2020
c880487
refactor: add prefer-arrow-callback to eslint rules
ckerr Sep 21, 2020
c044da1
refactor: add prefer-object-spread to eslint rules
ckerr Sep 21, 2020
ed72883
refactor: add more eslint rules
ckerr Sep 21, 2020
88f55d7
refactor: remove jQuery prop use
ckerr Sep 21, 2020
ad5387f
refactor: remove a lot of jQuery
ckerr Sep 22, 2020
48fb022
refactor: fix Util code smell
ckerr Sep 22, 2020
13f3635
chore: add html, css, scss to prettier
ckerr Sep 22, 2020
3e7b318
refactor: separate words in ID and class names with a hyphen
ckerr Sep 22, 2020
d2c9a43
fixup! refactor: fix Util code smell
ckerr Sep 23, 2020
9afffa8
feat: use stylelint and prettier on css
ckerr Sep 23, 2020
f98906f
feat: re-enable property-no-unknown rule
ckerr Sep 23, 2020
2304297
feat: re-enable declaration-property-value-disallowed-list rule
ckerr Sep 23, 2020
410d559
feat: re-enable scss/at-mixin-pattern rule
ckerr Sep 23, 2020
bb5092f
feat: re-enable selector-no-qualifying-type rule
ckerr Sep 23, 2020
dcecabc
feat: enable stylelint "possible errors" rules
ckerr Sep 23, 2020
8ffe034
refactor: make inspector pages align better
ckerr Sep 23, 2020
c201ea8
savepoint
ckerr Sep 24, 2020
0da8f4a
refactor: move web app to webpack
ckerr Sep 26, 2020
56c7348
chore: upgrade jquery.ui-contextmenu.js plugin from upstream
ckerr Sep 26, 2020
fee5dd3
chore: re-enable the no-extend-native eslint rule
ckerr Sep 26, 2020
711584d
chore: add the radix eslint rule
ckerr Sep 26, 2020
412495b
chore: add the prefer-exponentiation-operator eslint rule
ckerr Sep 26, 2020
8337c8f
chore: re-enable the jquery/no-trigger rule
ckerr Sep 26, 2020
ba72a8c
chore: re-enable the jquery/no-ajax rule
ckerr Sep 27, 2020
39412e2
chore: remove some jQuery use
ckerr Sep 27, 2020
74d55b5
chore: prettier checks package.json
ckerr Sep 27, 2020
25f1e03
chore: remove some jQuery use
ckerr Sep 27, 2020
1ee5e07
chore: remove some jQuery use
ckerr Sep 27, 2020
145c9a3
savepoint: merging mobile and common scss
ckerr Sep 27, 2020
96a723e
savepoint: toolbar
ckerr Sep 28, 2020
21a3479
chore: add TODO.md
ckerr Sep 28, 2020
1d8d34f
chore: use terser grid-column syntax
ckerr Sep 28, 2020
58e1762
fix: torrent remove dialog layout
ckerr Sep 29, 2020
159d3ae
refactor: improve dialog layout on mobile
ckerr Sep 29, 2020
499a348
refactor: tweak the dialog background gradient
ckerr Sep 30, 2020
f32239e
fix: compact mode layout
ckerr Sep 30, 2020
318e8bd
chore: replace png icons with svg versions
ckerr Sep 30, 2020
b2ab28d
chore: move separate configs to their own files
ckerr Sep 30, 2020
1a8fb1a
feat: improve formatting of numbers
ckerr Sep 30, 2020
01a3ba6
refactor: simplify dialog closing
ckerr Oct 1, 2020
5bf26f6
refactor: create fewer debounce timers
ckerr Oct 1, 2020
986337e
feat: add sidebar menu
ckerr Oct 4, 2020
9760bc7
refactor: remove context menu dependency on jQuery
ckerr Oct 6, 2020
6992f65
feat: add primary-mime-type in RPC server and trqt
ckerr Oct 6, 2020
7c03474
feat: use primary-mime-type in web client
ckerr Oct 7, 2020
2a989c9
fixup! feat: add primary-mime-type in RPC server and trqt
ckerr Oct 7, 2020
ac1f533
fixup! feat: use primary-mime-type in web client
ckerr Oct 8, 2020
00ac6e8
feat: add primary-mime-type in RPC server and trqt
ckerr Oct 6, 2020
2138fc7
fixup! feat: add primary-mime-type in RPC server and trqt
ckerr Oct 7, 2020
3fbc634
fixup! feat: add primary-mime-type in RPC server and trqt
ckerr Oct 8, 2020
d692fca
feat: add torrent-get 'primary-mime-type' to RPC.
ckerr Oct 8, 2020
3ed9144
use size_t for content byte count
ckerr Oct 8, 2020
cc3bac3
explicit boolean expressions
ckerr Oct 8, 2020
8bb48ac
use uint64_t for content byte counts
ckerr Oct 8, 2020
c2ec7fe
avoid unnecessary logic branches
ckerr Oct 8, 2020
070cc14
explicit cast
ckerr Oct 8, 2020
fa8544d
refactor: add an autogenerated mime-type.h header
ckerr Oct 8, 2020
b0a19ab
chore: maybe fix the win32 FTBFS
ckerr Oct 8, 2020
4c0d546
chore: add mime-types.[ch] to xcode
ckerr Oct 8, 2020
2d1dad1
fixup! feat: add primary-mime-type in RPC server and trqt
ckerr Oct 8, 2020
d7ad214
Merge branch 'add-mime-type-info-to-rpc' into web-client-refresh
ckerr Oct 8, 2020
8a74353
Merge branch 'add-mime-type-info-to-rpc' of github.com:transmission/t…
ckerr Oct 8, 2020
d34dfd0
Merge branch 'add-mime-type-info-to-rpc' into web-client-refresh
ckerr Oct 8, 2020
0f79856
chore: improve inspector styling
ckerr Oct 9, 2020
a515fdd
refactor: popup dialogs
ckerr Oct 10, 2020
39df465
refactor: remove jQuery
ckerr Oct 12, 2020
e75d4ef
Squashed commit of the following:
ckerr Oct 14, 2020
620d180
fix bugs
ckerr Oct 14, 2020
c005015
savepoint: prefs
ckerr Oct 16, 2020
f5beae4
chore: optimize png files
ckerr Oct 17, 2020
08844ff
refactor: use symbolic colors in css
ckerr Oct 18, 2020
f3df1c3
chore: prefs dialog's open port checker
ckerr Oct 19, 2020
33e69e6
chore: add turtle to prefs dialog altspeed section
ckerr Oct 19, 2020
e8cfbe7
fix: compact mode progressbar size regression
ckerr Oct 19, 2020
15a7496
fix: compact mode progress text size
ckerr Oct 19, 2020
cd3d81c
refactor: clean up peer list
ckerr Oct 20, 2020
311704f
refactor: partial cleanup of utils module
ckerr Oct 20, 2020
6e59f3a
chore: update the inspector's torrent tier list
ckerr Oct 20, 2020
473a5cc
fix: start-added-torrents
ckerr Oct 21, 2020
3a49a18
chore: tweak web client cmake/automake
ckerr Oct 21, 2020
23535ba
chore: skip "build" and "node_modules" in cpack
ckerr Oct 21, 2020
50203b5
chore: use "public_html" in tr_getWebClientDir()
ckerr Oct 21, 2020
9c9d8a3
feat: add log message saying where web files are served from
ckerr Oct 21, 2020
85b4c26
chore: update windows installer to use public_html
ckerr Oct 21, 2020
58fc8cc
fix: ignore CMAKE_BINARY_DIR in cpack
ckerr Oct 22, 2020
92b2d22
chore: remove jQuery from linter
ckerr Oct 22, 2020
26ad5e9
chore: add unicorn/catch-error-name
ckerr Oct 22, 2020
5ec947c
chore: add unicorn/error-message
ckerr Oct 22, 2020
fd6230d
chore: add unicorn to eslint
ckerr Oct 22, 2020
0ea635e
chore: add sonarjs to eslint
ckerr Oct 22, 2020
fc01a1d
chore: yarn upgrade
ckerr Oct 22, 2020
d0b61be
fixup! chore: update windows installer to use public_html
ckerr Oct 22, 2020
ce73c29
squash-merge origin/master
ckerr Oct 22, 2020
67b88fd
Merge branch 'master' into web-client-refresh
ckerr Oct 22, 2020
500bf2c
fix: do not glob files in trweb cmake deps
ckerr Oct 22, 2020
77b44d5
fix: new lgtm warnings
ckerr Oct 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ macosx/en.lproj/*~.nib
node_modules/
po/*.mo
third-party/miniupnp/miniupnpcstrings.h
web/public_html/transmission-app.js.map
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include(TrMacros)
tr_auto_option(ENABLE_GTK "Build GTK+ client" AUTO)
tr_auto_option(ENABLE_QT "Build Qt client" AUTO)
tr_auto_option(ENABLE_MAC "Build Mac client" AUTO)
option(ENABLE_WEB "Build Web client" OFF)
option(ENABLE_UTILS "Build utils (create, edit, show)" ON)
option(ENABLE_CLI "Build command-line client" OFF)
option(ENABLE_TESTS "Build unit tests" ON)
Expand Down Expand Up @@ -622,10 +623,7 @@ if(ENABLE_TESTS)
endif()

function(tr_install_web DST_DIR)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/web DESTINATION ${DST_DIR}
PATTERN *.am EXCLUDE
PATTERN *.in EXCLUDE
PATTERN *.scss EXCLUDE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/web/public_html DESTINATION ${DST_DIR})
endfunction()

add_subdirectory(libtransmission)
Expand All @@ -637,7 +635,7 @@ if(ENABLE_GTK AND ENABLE_NLS)
add_subdirectory(po)
endif()

foreach(P daemon cli utils gtk qt mac)
foreach(P cli daemon gtk mac qt utils web)
string(TOUPPER "${P}" P_ID)
if(ENABLE_${P_ID})
if(DEFINED ${P_ID}_PROJECT_DIR)
Expand All @@ -664,7 +662,11 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "${TR_NAME}-${TR_USER_AGENT_PREFIX}")
if(NOT TR_STABLE_RELEASE)
string(APPEND CPACK_SOURCE_PACKAGE_FILE_NAME "-r${TR_VCS_REVISION}")
endif()
list(APPEND CPACK_SOURCE_IGNORE_FILES [.]git)
list(APPEND CPACK_SOURCE_IGNORE_FILES
"${CMAKE_BINARY_DIR}"
"[.]git"
"node_modules"
)
set(CPACK_INSTALL_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/cmake/CPackSourceFixDirLinks.cmake")

## Code Formatting
Expand Down
5 changes: 4 additions & 1 deletion code_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ fi
cd "${root}/web" || exit 1
if [ -n "$fix" ]; then
cd "${root}/web" && yarn --silent install && yarn --silent 'lint:fix'
elif ! yarn -s install && yarn --silent lint; then
elif ! yarn -s install; then
echo 'JS code could not be checked -- "yarn install" failed'
exitcode=1
elif ! yarn --silent lint; then
echo 'JS code needs formatting'
exitcode=1
fi
Expand Down
2 changes: 1 addition & 1 deletion dist/msi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ png2ico(Transmission.ico
"${ICONS_DIR}/192x192/transmission-qt.png"
"${ICONS_DIR}/256x256/transmission-qt.png")

set(WEBSRCDIR "${CMAKE_INSTALL_PREFIX}/share/transmission/web")
set(WEBSRCDIR "${CMAKE_INSTALL_PREFIX}/share/transmission/public_html")
set(TRQMSRCDIR "${CMAKE_INSTALL_PREFIX}/share/transmission/translations")
set(QTQMSRCDIR "${TR_QT_DIR}/translations")

Expand Down
2 changes: 1 addition & 1 deletion dist/msi/Transmission.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<Merge Id="VCRedist" SourceFile="$(var.MsvcCrtMsmFile)" DiskId="1" Language="0" />
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
<Directory Id="INSTALLDIR" Name="Transmission">
<Directory Id="WEBINSTALLDIR" Name="web" />
<Directory Id="WEBINSTALLDIR" Name="public_html" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs"/>
Expand Down
6 changes: 3 additions & 3 deletions libtransmission/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ char const* tr_getWebClientDir(tr_session const* session)
#ifdef BUILD_MAC_CLIENT /* on Mac, look in the Application Support folder first, then in the app bundle. */

/* Look in the Application Support folder */
s = tr_buildPath(tr_sessionGetConfigDir(session), "web", NULL);
s = tr_buildPath(tr_sessionGetConfigDir(session), "public_html", NULL);

if (!isWebClientDir(s))
{
Expand All @@ -511,7 +511,7 @@ char const* tr_getWebClientDir(tr_session const* session)
CFRelease(appRef);

/* Fallback to the app bundle */
s = tr_buildPath(appString, "Contents", "Resources", "web", NULL);
s = tr_buildPath(appString, "Contents", "Resources", "public_html", NULL);

if (!isWebClientDir(s))
{
Expand Down Expand Up @@ -628,7 +628,7 @@ char const* tr_getWebClientDir(tr_session const* session)
/* walk through the candidates & look for a match */
for (tr_list* l = candidates; l != NULL; l = l->next)
{
char* path = tr_buildPath(l->data, "transmission", "web", NULL);
char* path = tr_buildPath(l->data, "transmission", "public_html", NULL);
bool const found = isWebClientDir(path);

if (found)
Expand Down
9 changes: 8 additions & 1 deletion libtransmission/rpc-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ static char const* mimetype_guess(char const* path)
{ "html", "text/html" },
{ "ico", "image/vnd.microsoft.icon" },
{ "js", "application/javascript" },
{ "png", "image/png" }
{ "png", "image/png" },
{ "svg", "image/svg+xml" }
};
char const* dot = strrchr(path, '.');

Expand Down Expand Up @@ -1264,5 +1265,11 @@ tr_rpc_server* tr_rpcInit(tr_session* session, tr_variant* settings)
}
}

char const* webClientDir = tr_getWebClientDir(s->session);
if (!tr_str_is_empty(webClientDir))
{
tr_logAddNamedInfo(MY_NAME, _("Serving RPC and Web requests from directory '%s'"), webClientDir);
}

return s;
}
129 changes: 129 additions & 0 deletions web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:sonarjs/recommended",
"plugin:unicorn/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"sourceType": "module"
},
"plugins": [
"sonarjs",
"unicorn"
],
"rules": {
"accessor-pairs": "error",
"array-callback-return": "error",
"arrow-spacing": "error",
"block-scoped-var": "error",
"class-methods-use-this": "error",
"consistent-return": "error",
"curly": "error",
"default-case": "error",
"default-case-last": "error",
"default-param-last": "error",
"eqeqeq": "error",
"grouped-accessor-pairs": "error",
"guard-for-in": "error",
"init-declarations": "error",
"no-array-constructor": "error",
"no-caller": "error",
"no-confusing-arrow": "error",
"no-constructor-return": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-empty-function": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-loss-of-precision": "error",
"no-multi-str": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-promise-executor-return": "error",
"no-proto": "error",
"no-redeclare": "error",
"no-restricted-exports": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-properties": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-template-curly-in-string": "error",
"no-this-before-super": "error",
"no-throw-literal": "error",
"no-undef-init": "error",
"no-undefined": "error",
"no-unmodified-loop-condition": "error",
"no-unreachable-loop": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-unused-vars": "error",
"no-use-before-define": "error",
"no-useless-backreference": "error",
"no-useless-call": "error",
"no-useless-catch": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"no-void": "error",
"no-with": "error",
"object-shorthand": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-destructuring": "error",
"prefer-exponentiation-operator": "error",
"prefer-numeric-literals": "error",
"prefer-object-spread": "error",
"prefer-promise-reject-errors": "error",
"prefer-regex-literals": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"radix": "error",
"require-atomic-updates": "error",
"require-await": "error",
"semi": "error",
"sonarjs/cognitive-complexity": "off",
"sonarjs/no-duplicate-string": "off",
"sort-keys": "error",
"strict": "error",
'unicorn/consistent-function-scoping': 'off',
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/no-null": "off",
"unicorn/no-reduce": "off",
"unicorn/no-unused-properties": "off",
"unicorn/prevent-abbreviations": "off",
}
};
17 changes: 17 additions & 0 deletions web/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
project(trweb)

file(GLOB trweb_srcs "src/*.js" "style/*.scss")
ckerr marked this conversation as resolved.
Show resolved Hide resolved
file(GLOB trweb_imgs "style/images/*.png")

add_custom_target(
trweb ALL
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/package.json" "${CMAKE_CURRENT_BINARY_DIR}/package.json"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/yarn.lock" "${CMAKE_CURRENT_BINARY_DIR}/yarn.lock"
COMMAND yarn install
COMMAND yarn webpack --config "${CMAKE_CURRENT_SOURCE_DIR}/webpack.config.js" --context "${CMAKE_CURRENT_SOURCE_DIR}"
BYPRODUCTS
public_html/transmission-app.js
public_html/transmission-app.js.LICENSE.txt
DEPENDS ${trweb_imgs}
SOURCES ${trweb_srcs}
)