From 01cc83c1b4518e0597011d0c773a1bddfdbd44e6 Mon Sep 17 00:00:00 2001 From: Rob Watson Date: Wed, 3 Jun 2020 09:28:00 +0200 Subject: [PATCH] Add icon to copy magnet URL to clipboard --- README.md | 2 ++ server/ui/src/components/search.tsx | 17 +++++++++++++++++ server/ui/src/index.tsx | 3 +++ 3 files changed, 22 insertions(+) diff --git a/README.md b/README.md index 15a42a1..fa7056f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ The torrent data is updated daily, and to do so, run, or place this in a crontab This updates the repository, and rebuilds the sqlite cache necessary for searching. +To re-build the frontend assets, use `cd server/ui && yarn build`. There is no need to restart the `./webserver.sh` script. + ## Command Line Searching ### Requirements diff --git a/server/ui/src/components/search.tsx b/server/ui/src/components/search.tsx index 391bf1d..821a859 100644 --- a/server/ui/src/components/search.tsx +++ b/server/ui/src/components/search.tsx @@ -153,6 +153,13 @@ export class Search extends Component { {moment(torrent.scraped_date * 1000).fromNow()} + + + { newSearch.page += (a.nextPage) ? 1 : -1; a.i.props.history.push(`/search/${newSearch.type_}/${newSearch.q}/${newSearch.page}`); } + + copyLink(evt) { + const href = evt.currentTarget.dataset.href; + try { + navigator.clipboard.writeText(href) + .then(() => alert("Copied magnet URL to clipboard")); + } catch(err) { + alert("Could not copy magnet URL: " + href) + } + } } diff --git a/server/ui/src/index.tsx b/server/ui/src/index.tsx index 638c559..b64dd81 100644 --- a/server/ui/src/index.tsx +++ b/server/ui/src/index.tsx @@ -61,6 +61,9 @@ class Index extends Component { spinner + + + );