feat!: Vue3 Rewrite (#757)

This commit is contained in:
Daan Wijns 2023-10-20 15:15:28 +02:00 committed by GitHub
parent b81670d80c
commit 575b071f6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
377 changed files with 14855 additions and 25404 deletions

View file

@ -1,4 +1,2 @@
VITE_USE_FAKE_TORRENTS=false
VITE_FAKE_TORRENT_COUNT=5
VITE_QBITTORRENT_TARGET='http://127.0.0.1'
VITE_QBITTORRENT_PORT=8080
VITE_QBITTORRENT_TARGET='http://127.0.0.1'

View file

@ -1,2 +0,0 @@
node_modules/*
vuetorrent/

View file

@ -1,12 +1,11 @@
# My Title [feat/fix/perf/chore]
Please explain what kind of feature your PR's brings or what kind of bug it fixes. Feel free to include screenshots for UI related changes. Keep all the commits inside your PR
related to topic of the PR, otherwise create a seperate PR
related to topic of the PR, otherwise create a seperate PR. Don't forget to link the related issue! (if applicable)
# PR Checklist
## PR Checklist
- [ ] I've started from master
- [ ] I've only committed changes related to this PR
- [ ] All Unit tests pass
- [ ] All tests pass
- [ ] I've removed all commented code
- [ ] I've removed all unneeded console.log statements

View file

@ -9,20 +9,25 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build Node.js cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build VueTorrent
run: npm run build
- name: Push to nightly-release
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:

View file

@ -13,7 +13,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run release please
uses: google-github-actions/release-please-action@v3.7.12
uses: google-github-actions/release-please-action@v3.7
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
@ -61,20 +61,25 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build Node.js cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build VueTorrent
run: npm run build
- name: Push to latest-release
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:

View file

@ -8,17 +8,21 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build Node.js cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build VueTorrent
run: npm run build

View file

@ -8,22 +8,32 @@ on:
- master
jobs:
test-core:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Build Node.js cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: check linting
run: npm run lint
- name: Run tests
run: npm run test:unit
run: npm run test
- name: Test Build
run: npm run build

39
.github/workflows/vue3.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: Build Vue3 nightly
on:
push:
branches:
- vue3
jobs:
push-nightly-vue3:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Build Node.js cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Build VueTorrent
run: npm run build
- name: Run tests
run: npm run test
- name: Push to nightly-release
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: nightly-release-vue3
FOLDER: ./vuetorrent

52
.gitignore vendored
View file

@ -1,20 +1,32 @@
.DS_Store
node_modules
# Log files
npm-debug.log*
# Editor directories and files
.idea
.vscode
.history
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# vuetorrent
vuetorrent/**
config
Downloads
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# non-essential
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Custom
vuetorrent/**
docker/**
coverage/
config/

View file

@ -1,10 +0,0 @@
{
"printWidth": 180,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"proseWrap": "always",
"endOfLine": "auto",
"arrowParens": "avoid"
}

16
.prettierrc.json Normal file
View file

@ -0,0 +1,16 @@
{
"arrowParens": "avoid",
"bracketSameLine": true,
"bracketSpacing": true,
"endOfLine": "auto",
"htmlWhitespaceSensitivity": "css",
"printWidth": 180,
"proseWrap": "always",
"quoteProps": "as-needed",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false
}

3
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}

View file

@ -2,39 +2,41 @@
## [1.8.0](https://github.com/WDaan/VueTorrent/compare/v1.7.4...v1.8.0) (2023-10-04)
### Features
* login with url query ([#1108](https://github.com/WDaan/VueTorrent/issues/1108)) ([459b7e0](https://github.com/WDaan/VueTorrent/commit/459b7e08f2c630f6e92a459fd39b3dade7ef7fdf))
- login with url query ([#1108](https://github.com/WDaan/VueTorrent/issues/1108)) ([459b7e0](https://github.com/WDaan/VueTorrent/commit/459b7e08f2c630f6e92a459fd39b3dade7ef7fdf))
### Bug Fixes
* hungarian translations ([#1127](https://github.com/WDaan/VueTorrent/issues/1127)) ([2c9c9d5](https://github.com/WDaan/VueTorrent/commit/2c9c9d5ac197c1e56fec2f26c20fc631c2dc86e1))
- hungarian translations ([#1127](https://github.com/WDaan/VueTorrent/issues/1127)) ([2c9c9d5](https://github.com/WDaan/VueTorrent/commit/2c9c9d5ac197c1e56fec2f26c20fc631c2dc86e1))
### Improvements
* Add autofocus on login page ([#1117](https://github.com/WDaan/VueTorrent/issues/1117)) ([7ca220d](https://github.com/WDaan/VueTorrent/commit/7ca220dfa6eff9a6f943fcacd045ef6b8f2ce570))
* add Hungarian translations ([#1121](https://github.com/WDaan/VueTorrent/issues/1121)) ([f584aad](https://github.com/WDaan/VueTorrent/commit/f584aadcea38e28251f7347a8d794eca8ce807a0))
- Add autofocus on login page ([#1117](https://github.com/WDaan/VueTorrent/issues/1117))
([7ca220d](https://github.com/WDaan/VueTorrent/commit/7ca220dfa6eff9a6f943fcacd045ef6b8f2ce570))
- add Hungarian translations ([#1121](https://github.com/WDaan/VueTorrent/issues/1121))
([f584aad](https://github.com/WDaan/VueTorrent/commit/f584aadcea38e28251f7347a8d794eca8ce807a0))
## [1.7.4](https://github.com/WDaan/VueTorrent/compare/v1.7.3...v1.7.4) (2023-09-19)
### Bug Fixes
* change settings speed tab speed unit to KiBps ([#1082](https://github.com/WDaan/VueTorrent/issues/1082)) ([587038a](https://github.com/WDaan/VueTorrent/commit/587038a7ae25fcedcb29b358a12e5f3a3b38ce64))
* formatDataValues for values with 4 digits or more ([#1083](https://github.com/WDaan/VueTorrent/issues/1083)) ([ad562f0](https://github.com/WDaan/VueTorrent/commit/ad562f056a4976b484ae7f98da2eef8153f9b0c4))
* **logs:** wrong date parsing ([#1076](https://github.com/WDaan/VueTorrent/issues/1076)) ([14a6b90](https://github.com/WDaan/VueTorrent/commit/14a6b90547dda3284254608f6cd203bc84634768))
* Revert "fix(logs): Wrong date parsing" ([#1099](https://github.com/WDaan/VueTorrent/issues/1099)) ([1110bdb](https://github.com/WDaan/VueTorrent/commit/1110bdb8b780d9512366d1e46ed8aecadb2efa4d))
- change settings speed tab speed unit to KiBps ([#1082](https://github.com/WDaan/VueTorrent/issues/1082))
([587038a](https://github.com/WDaan/VueTorrent/commit/587038a7ae25fcedcb29b358a12e5f3a3b38ce64))
- formatDataValues for values with 4 digits or more ([#1083](https://github.com/WDaan/VueTorrent/issues/1083))
([ad562f0](https://github.com/WDaan/VueTorrent/commit/ad562f056a4976b484ae7f98da2eef8153f9b0c4))
- **logs:** wrong date parsing ([#1076](https://github.com/WDaan/VueTorrent/issues/1076))
([14a6b90](https://github.com/WDaan/VueTorrent/commit/14a6b90547dda3284254608f6cd203bc84634768))
- Revert "fix(logs): Wrong date parsing" ([#1099](https://github.com/WDaan/VueTorrent/issues/1099))
([1110bdb](https://github.com/WDaan/VueTorrent/commit/1110bdb8b780d9512366d1e46ed8aecadb2efa4d))
## [1.7.3](https://github.com/WDaan/VueTorrent/compare/v1.7.2...v1.7.3) (2023-08-31)
### Bug Fixes
* mobile long press [#911](https://github.com/WDaan/VueTorrent/issues/911) ([6871e54](https://github.com/WDaan/VueTorrent/commit/6871e54f94c19f4c5d54f6d5056a4f1b302a956a))
* revert longpress fix, unreliable on pwa [#911](https://github.com/WDaan/VueTorrent/issues/911) ([3214997](https://github.com/WDaan/VueTorrent/commit/3214997194f76d01b3ead9439589c3103eb2728c))
- mobile long press [#911](https://github.com/WDaan/VueTorrent/issues/911) ([6871e54](https://github.com/WDaan/VueTorrent/commit/6871e54f94c19f4c5d54f6d5056a4f1b302a956a))
- revert longpress fix, unreliable on pwa [#911](https://github.com/WDaan/VueTorrent/issues/911)
([3214997](https://github.com/WDaan/VueTorrent/commit/3214997194f76d01b3ead9439589c3103eb2728c))
## [1.7.2](https://github.com/WDaan/VueTorrent/compare/v1.7.1...v1.7.2) (2023-08-31)

674
LICENSE
View file

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -1,11 +1,11 @@
<div>
<img align="left" width="200" src="https://cdn.jsdelivr.net/gh/WDaan/VueTorrent/VueTorrent-logo.png" alt="VueTorrent"/>
<img style="float: left" width="200" src="https://cdn.jsdelivr.net/gh/WDaan/VueTorrent/VueTorrent-logo.png" alt="VueTorrent"/>
<h1>VueTorrent</h1>
<p>The sleekest looking WebUI for qBittorrent made with Vue.js!</p>
</div>
![Vue](https://img.shields.io/badge/Vue-%5E2.7.14-brightgreen) ![qBittorrent](https://img.shields.io/badge/qBittorrent-4.4%2B-brightgreen)
![Vuetify](https://img.shields.io/badge/Vuetify-%5E2.6.10-brightgreen)
![Vue](https://img.shields.io/badge/Vue-%5E3.3.4-brightgreen) ![qBittorrent](https://img.shields.io/badge/qBittorrent-4.4%2B-brightgreen)
![Vuetify](https://img.shields.io/badge/Vuetify-%5E3.3.15-brightgreen)
![stars](https://img.shields.io/github/stars/WDaan/VueTorrent) ![Forks](https://img.shields.io/github/forks/WDaan/VueTorrent)
![Issues](https://img.shields.io/github/issues/WDaan/VueTorrent) ![Closed](https://img.shields.io/github/issues-closed/WDaan/VueTorrent)
@ -15,25 +15,25 @@
## Screenshots
- Desktop
<p align="middle">
<img src="readme_assets/screenshot-desktop.png" width="800" />
<p>
<img src="readme_assets/screenshot-desktop.png" width="800" alt="Screenshot Desktop (Light Mode)" />
</p>
- Desktop Dark Mode
<p align="middle">
<img src="readme_assets/screenshot-desktop-dark-mode.png" width="800" />
<p>
<img src="readme_assets/screenshot-desktop-dark-mode.png" width="800" alt="Screenshot Desktop (Dark Mode)" />
</p>
- Mobile
<p align="middle">
<img src="readme_assets/screenshot-mobile.png" width="400" />
<img src="readme_assets/screenshot-mobile-navbar.png" width="400" />
<p>
<img src="readme_assets/screenshot-mobile.png" width="400" alt="Screenshot Mobile Dashboard (Light Mode)" />
<img src="readme_assets/screenshot-mobile-navbar.png" width="400" alt="Screenshot Mobile Navbar (Light Mode)" />
</p>
- Mobile Dark Mode
<p align="middle">
<img src="readme_assets/screenshot-mobile-dark-mode.png" width="400" />
<img src="readme_assets/screenshot-mobile-navbar-dark-mode.png" width="400" />
<p>
<img src="readme_assets/screenshot-mobile-dark-mode.png" width="400" alt="Screenshot Mobile Dashboard (Dark Mode)" />
<img src="readme_assets/screenshot-mobile-navbar-dark-mode.png" width="400" alt="Screenshot Mobile Dashboard (Light Mode)" />
</p>
## Installation
@ -79,9 +79,17 @@ If you like to always have the latest and greatest, please sync to the `nightly-
- search for new torrents straight from the WebUI!
- search filtering powered by Fuse.js!
- Keyboard shortcuts!
- select all torrents with <kbd>Ctrl</kbd>-<kbd>A</kbd>
- delete selected torrents with <kbd>delete</kbd>
- <kbd>Shift</kbd>-click to select from one torrent
- Mac keymap is supported (use <kbd>Cmd</kbd> instead of <kbd>Ctrl</kbd>)
- Press <kbd>Escape</kbd> to dismiss any dialogs or to return to Dashboard view
- Dashboard
- Select all torrents with <kbd>Ctrl</kbd>-<kbd>A</kbd>
- Focus search input with <kbd>Ctrl</kbd>-<kbd>F</kbd>
- Press again to enable native browser search
- When no dialogs are opened, press <kbd>Escape</kbd> to unfocus search input
- Press again to unselect all torrents
- Delete selected torrents with <kbd>Delete</kbd> (<kbd>Fn</kbd>-<kbd>Backspace</kbd> on Mac)
- <kbd>Ctrl</kbd>-click on a torrent card to enable multi-select mode and select it
- Hold <kbd>Shift</kbd> and click on a torrent card to select all torrents between the last selected torrent and the clicked torrent
- System
- see session stats (down / upload speed, session uploaded / downloaded, free space)
- beautiful transfer graphs
@ -97,6 +105,20 @@ I'll gladly accept help/pull requests & advice!
[FAQ](../../wiki/FAQ)
### Localize the app
To help us localize VueTorrent, you will need to:
- `src/locales/<your language>.json`
- Create a json file containing the translations by matching the structure of `en.json`
- every key may not be specified, that's fine, it will default to the english locale
- `<your language>` should match the ISO 639 locale code of the added language
- `src/locales/locales.ts`
- add your language to the `Locales` enum, it should match the json filename
- Update the `LOCALES` constant with the local language name and the created enum value
- `src/locales/index.ts`
- import the json file
- include it in the `messages` object using the created enum value as key
## Support
Open up an issue 😛
@ -108,7 +130,6 @@ but before you do that:
<a href="https://www.buymeacoffee.com/wdaan"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=wdaan&button_colour=FFDD00&font_colour=000000&font_family=Arial&outline_colour=000000&coffee_colour=ffffff"></a>
## Credits
- [qBittorrent](https://github.com/qbittorrent/qBittorrent)
- Many thanks [@m4ximuel](https://github.com/m4ximuel) for designing the icon & helping out with the project
## Contributors
- [@m4ximuel](https://github.com/m4ximuel)
- [@Larsluph](https://github.com/Larsluph)

View file

@ -1,14 +0,0 @@
module.exports = {
presets: ['@babel/preset-env'],
plugins: [
function () {
return {
visitor: {
MetaProperty(path) {
path.replaceWithSourceString('process')
}
}
}
}
]
}

View file

@ -1,4 +1,4 @@
version: '3.6'
version: '3.8'
services:
qbit:
image: linuxserver/qbittorrent:latest
@ -10,9 +10,9 @@ services:
- UMASK_SET=022
- WEBUI_PORT=8080
volumes:
- ./config:/config
- ./Downloads:/downloads
- ./docker/config:/config
- ./docker/downloads:/downloads
- ./vuetorrent:/vuetorrent
ports:
- 8080:8080
- '8080:8080'
restart: unless-stopped

9
env.d.ts vendored
View file

@ -1,9 +0,0 @@
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}
declare module 'vuetify/lib/framework' {
import Vuetify from 'vuetify'
export default Vuetify
}

4042
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,66 +1,61 @@
{
"name": "vuetorrent",
"version": "1.8.0",
"private": true,
"version": "2.0.0",
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "vite build",
"test": "npm run test:unit",
"test:unit": "vitest run",
"start": "vite",
"dev": "vite",
"build": "vue-tsc && vite build",
"check-build": "vue-tsc",
"preview": "vite preview",
"lint": "eslint --fix --ignore-path .gitignore && prettier . -w -u --ignore-path .gitignore",
"start": "npm run dev"
"test": "vitest run",
"coverage": "vitest run --coverage"
},
"dependencies": {
"ajv": "^8.12.0",
"apexcharts": "^3.43.0",
"axios": "^1.5.1",
"dayjs": "^1.11.10",
"lodash": "^4.17.21",
"quick-score": "^0.2.0",
"typeface-roboto": "^1.1.13",
"typeface-roboto-mono": "^1.1.13",
"uuid": "^9.0.0",
"vue": "~2.7.14",
"vue-apexcharts": "^1.6.2",
"vue-i18n": "^8",
"vue-property-decorator": "^9.1.2",
"vue-router": "^3.6.5",
"vue-toastification": "^1.7.11",
"vuedraggable": "^2.24.3",
"vuetify": "^2.7.1",
"vuex": "^3.6.2",
"vuex-persist": "^3.1.3"
"@fontsource/roboto": "^5.0.8",
"@fontsource/roboto-mono": "^5.0.14",
"@mdi/js": "^7.2.96",
"@vueuse/core": "^10.5.0",
"apexcharts": "^3.42.0",
"axios": "^1.5.0",
"dayjs": "^1.11.9",
"lodash.debounce": "^4.0.8",
"pinia": "^2.1.6",
"pinia-plugin-persist": "^1.0.0",
"uuid": "^9.0.1",
"vite-plugin-pwa": "^0.16.5",
"vue": "^3.3.4",
"vue-i18n": "^9.3.0",
"vue-router": "^4.2.4",
"vue3-apexcharts": "^1.4.4",
"vue3-toastify": "^0.1.12",
"vuedraggable": "^4.1.0",
"vuetify": "^3.3.21"
},
"devDependencies": {
"@faker-js/faker": "^8.1.0",
"@mdi/js": "^7",
"@types/jsdom": "^21.1.3",
"@types/lodash": "^4.14.199",
"@mdi/font": "^7.2.96",
"@pinia/testing": "^0.1.3",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^20.6.0",
"@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"@vitejs/plugin-vue2": "^2",
"@vue/eslint-config-typescript": "^12",
"@vue/test-utils": "^1",
"eslint": "^8",
"eslint-config-prettier": "^9",
"eslint-plugin-prettier": "^5",
"eslint-plugin-vue": "^9",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"@vitejs/plugin-vue": "^4.3.4",
"@vitest/coverage-v8": "^0.34.6",
"@vue/test-utils": "^2.4.1",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-vue": "^9.17.0",
"jsdom": "^22.1.0",
"prettier": "^3",
"sass": "~1.32.13",
"unplugin-vue-components": "^0.25",
"vite": "^4",
"vite-plugin-eslint": "^1",
"vite-plugin-pwa": "^0.16.5",
"prettier": "^3.0.3",
"sass": "^1.66.1",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vite-plugin-vuetify": "^1.0.2",
"vitest": "^0.34.6",
"vue-template-compiler": "^2",
"vue-typed-mixins": "^0.2.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie <= 10"
]
"vue-tsc": "^1.8.10"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -1,82 +1,101 @@
<template>
<v-app>
<component :is="modal.component" v-for="modal in modals" :key="modal.guid" v-bind="{ guid: modal.guid, ...modal.props }" />
<Navbar v-if="authenticated" />
<v-main class="background">
<router-view />
</v-main>
</v-app>
</template>
<script>
import { mapState } from 'vuex'
<script setup lang="ts">
import AddPanel from '@/components/AddPanel.vue'
import DnDZone from '@/components/DnDZone.vue'
import Navbar from '@/components/Navbar/Navbar.vue'
import qbit from '@/services/qbit'
import { General } from '@/mixins'
import { getVersion } from './helpers'
import { useAppStore } from '@/stores/app'
import { useAuthStore } from '@/stores/auth'
import { useDialogStore } from '@/stores/dialog'
import { useLogStore } from '@/stores/logs'
import { useMaindataStore } from '@/stores/maindata'
import { usePreferenceStore } from '@/stores/preferences'
import { useVueTorrentStore } from '@/stores/vuetorrent'
export default {
name: 'App',
components: { Navbar },
mixins: [General],
computed: {
...mapState(['modals', 'webuiSettings', 'authenticated']),
onLoginPage() {
return this.$router.currentRoute.name?.includes('login')
}
},
created() {
this.$vuetify.theme.dark = this.webuiSettings.darkTheme
this.$store.commit('SET_APP_VERSION', getVersion())
this.$store.commit('SET_LANGUAGE')
this.checkAuthentication()
this.blockContextMenu()
},
watch: {
authenticated(newValue) {
if (newValue) {
this.$store.dispatch('INIT_INTERVALS')
this.$store.commit('updateMainData')
this.$store.dispatch('FETCH_SETTINGS')
} else {
this.$store.commit('REMOVE_INTERVALS')
}
}
},
methods: {
async checkAuthentication() {
const authenticated = await qbit.getAuthenticationStatus()
if (authenticated) {
this.$store.commit('LOGIN', true)
this.$store.dispatch('INIT_INTERVALS')
this.$store.commit('updateMainData')
this.$store.dispatch('FETCH_SETTINGS')
if (this.onLoginPage) this.redirectOnSuccess()
return
}
import { computed, onBeforeMount, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
this.$store.commit('LOGIN', false)
if (!this.onLoginPage) return this.$router.push({ name: 'login', query: { redirect: this.$route.fullPath } })
},
blockContextMenu() {
document.addEventListener('contextmenu', event => {
if (!event.target) return
const nodeName = event.target.nodeName.toLowerCase()
const nodeType = event.target.getAttribute('type')
const router = useRouter()
const route = useRoute()
if (['textarea', 'a'].includes(nodeName)) return
if (nodeName === 'input' && ['text', 'password', 'email', 'number'].includes(nodeType)) return
const authStore = useAuthStore()
const appStore = useAppStore()
const dialogStore = useDialogStore()
const logStore = useLogStore()
const maindataStore = useMaindataStore()
const preferencesStore = usePreferenceStore()
const vuetorrentStore = useVueTorrentStore()
event.preventDefault()
const onLoginPage = computed(() => router.currentRoute.value.name === 'login')
return false
})
},
redirectOnSuccess() {
const redirect = this.$route.query.redirect
if (redirect) return this.$router.push(redirect)
this.$router.push({ name: 'dashboard' })
}
const checkAuthentication = async () => {
await authStore.updateAuthStatus()
if (!authStore.isAuthenticated && !onLoginPage.value) {
await vuetorrentStore.redirectToLogin()
} else {
redirectOnSuccess()
}
}
const blockContextMenu = () => {
document.addEventListener('contextmenu', event => {
if (!event.target) return
const targetNode = event.target as Element
const nodeName = targetNode.nodeName.toLowerCase()
const nodeType = targetNode.getAttribute('type')?.toLowerCase() ?? ''
if (['textarea', 'a', 'img'].includes(nodeName)) return
if (nodeName === 'input' && ['text', 'password', 'email', 'number'].includes(nodeType)) return
event.preventDefault()
return false
})
}
const redirectOnSuccess = () => {
const redirectUrl = route.query.redirect as string | undefined
if (redirectUrl) router.push(redirectUrl)
else if (onLoginPage.value) router.push({ name: 'dashboard' })
}
onBeforeMount(() => {
if (vuetorrentStore.matchSystemTheme) {
vuetorrentStore.updateSystemTheme()
} else {
vuetorrentStore.updateTheme()
}
vuetorrentStore.setLanguage(vuetorrentStore.language)
checkAuthentication()
blockContextMenu()
})
watch(
() => authStore.isAuthenticated,
async isAuthenticated => {
if (isAuthenticated) {
appStore.pushInterval(() => maindataStore.updateMaindata(), vuetorrentStore.refreshInterval)
await maindataStore.updateMaindata()
await preferencesStore.fetchPreferences()
await logStore.fetchLogs()
} else {
appStore.clearIntervals()
}
},
{
immediate: true
}
)
</script>
<template>
<v-app class="text-noselect">
<component v-for="dialog in dialogStore.dialogs" :is="dialog.component"
v-bind="{ guid: dialog.guid, ...dialog.props }" />
<Navbar v-if="authStore.isAuthenticated" />
<v-main>
<router-view />
</v-main>
<AddPanel />
<DnDZone />
</v-app>
</template>

View file

@ -1,41 +0,0 @@
import store from '@/store'
import { formatSpeed } from '@/filters'
import { formatProgress } from '@/filters'
import { Torrent } from '@/models'
export class DocumentTitle {
private static setDefault() {
this.set('qBittorrent')
}
private static setGlobalSpeed() {
const status = store.getters.getStatus()
const useBitSpeed = store.state.webuiSettings.useBitSpeed
this.set(`[D: ${formatSpeed(status.dlspeed, useBitSpeed)}, U: ${formatSpeed(status.upspeed, useBitSpeed)}] VueTorrent`)
}
private static setFirstTorrentStatus() {
const useBitSpeed = store.state.webuiSettings.useBitSpeed
const torrents: Torrent[] = store.getters.getTorrents()
if (!torrents || !torrents.length) return
const torrent = torrents[0]
this.set(`[D: ${formatSpeed(torrent.dlspeed, useBitSpeed)}, U: ${formatSpeed(torrent.upspeed, useBitSpeed)}] ${formatProgress(torrent.progress)}`)
}
public static update() {
const mode = store.getters.getWebuiSettings().title
switch (mode) {
case 'Global Speed':
return this.setGlobalSpeed()
case 'First Torrent Status':
return this.setFirstTorrentStatus()
case 'Default':
default:
return this.setDefault()
}
}
private static set(title: string) {
document.title = title
}
}

View file

@ -1,11 +0,0 @@
import store from '@/store'
export class Graph {
public static shiftValues() {
const state = store.state
state.download_data.shift()
state.download_data.push(state.status.dlspeedRaw || 0)
state.upload_data.shift()
state.upload_data.push(state.status.upspeedRaw || 0)
}
}

View file

@ -1,32 +0,0 @@
import store from '@/store'
import { Hostname } from '@/helpers'
import { Torrent as VtTorrent } from '@/models'
import type { Torrent as QbitTorrent } from '@/types/qbit/models'
import { isProduction } from '@/utils'
import { generateMultiple } from '@/utils/faker'
export class Torrents {
static update(data: QbitTorrent[]) {
if (store.state.webuiSettings.showTrackerFilter) {
// don't calculate trackers when disabled
if (store.state.sort_options.tracker !== null) {
data = data.filter(d => Hostname.get(d.tracker) === store.state.sort_options.tracker)
}
}
// update torrents
store.state.torrents = data.map(t => new VtTorrent(t, store.state.webuiSettings.dateFormat))
// load fake torrents if enabled
if (!isProduction()) {
if (import.meta.env.VITE_USE_FAKE_TORRENTS === 'false') return
const count = import.meta.env.VITE_FAKE_TORRENT_COUNT
store.state.torrents.push(...generateMultiple(count))
}
// filter out deleted torrents from selection
const hash_index = store.state.torrents.map(torrent => torrent.hash)
store.state.selected_torrents = store.state.selected_torrents.filter(hash => hash_index.includes(hash))
}
}

View file

@ -1,15 +0,0 @@
import store from '@/store'
import { Hostname } from '@/helpers'
import type { Torrent } from '@/types/qbit/models'
export class Trackers {
static update(data: Torrent[]) {
if (store.state.webuiSettings.showTrackerFilter) {
store.state.trackers = data
.map(t => t.tracker)
.map(url => Hostname.get(url))
.filter((domain, index, self) => index === self.indexOf(domain) && domain)
.sort()
}
}
}

View file

@ -1,6 +0,0 @@
import { DocumentTitle } from './DocumentTitle'
import { Torrents } from './Torrents'
import { Trackers } from './Trackers'
import { Graph } from './Graph'
export { DocumentTitle, Torrents, Trackers, Graph }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>

Before

Width:  |  Height:  |  Size: 539 B

View file

@ -0,0 +1,24 @@
<script setup lang="ts">
import AddTorrentDialog from '@/components/Dialogs/AddTorrentDialog.vue'
import { useDialogStore } from '@/stores/dialog'
import { useNavbarStore } from '@/stores/navbar'
const dialogStore = useDialogStore()
const navbarStore = useNavbarStore()
function openAddTorrentDialog() {
dialogStore.createDialog(AddTorrentDialog)
}
</script>
<template>
<v-bottom-navigation :active="navbarStore.pendingTorrentsCount > 0" class="pointer" v-touch="{ up: openAddTorrentDialog }" @click="openAddTorrentDialog">
<v-list-item :title="$t('navbar.addPanel.torrentsPendingCount', navbarStore.pendingTorrentsCount)" />
<v-spacer />
<v-list-item>
<v-icon icon="mdi-chevron-up" />
</v-list-item>
</v-bottom-navigation>
</template>
<style scoped></style>

View file

@ -0,0 +1,45 @@
import { describe, beforeEach, it, expect, vi } from 'vitest'
import { VueWrapper, mount } from '@vue/test-utils'
import { createTestingPinia } from '@pinia/testing'
import DataCard from './DataCard.vue'
import i18n from '@/plugins/i18n'
import vuetify from '@/plugins/vuetify'
const title = 'Downloaded'
const value = 10000
const color = 'download'
let wrapper: VueWrapper
describe('StorageCard.vue', () => {
beforeEach(() => {
wrapper = mount(DataCard, {
propsData: { title, value, color },
global: {
plugins: [
createTestingPinia({
createSpy: vi.fn()
}),
i18n,
vuetify
]
}
})
})
it('should render the title', () => {
expect(wrapper.find('[data-testid="card-title"]').text()).toEqual(title)
})
it('should render value and unit & be formatted', () => {
expect(wrapper.find('[data-testid="card-value"]').exists()).toBe(true)
expect(wrapper.find('[data-testid="card-value"]').text()).toBe('10.0')
expect(wrapper.find('[data-testid="card-unit"]').exists()).toBe(true)
expect(wrapper.find('[data-testid="card-unit"]').text()).toBe('kB')
})
it('text should have the passed-in color', () => {
expect(wrapper.find('[data-testid="card-wrapper"]').classes()).toContain('text-' + color)
})
})

View file

@ -0,0 +1,28 @@
<script setup lang="ts">
import { formatDataUnit, formatDataValue } from '@/helpers'
import { useVueTorrentStore } from '@/stores/vuetorrent'
defineProps<{ title: string; color: string; value: number }>()
const vueTorrentStore = useVueTorrentStore()
</script>
<template>
<v-sheet color="secondary" rounded="lg" class="pa-3">
<v-row data-testid="card-wrapper" :class="[`text-${color}`]">
<v-col data-testid="card-title" cols="7" class="text-subtitle-1">{{ title }}</v-col>
<v-col cols="5" class="">
<span data-testid="card-value" class="text-subtitle-1 roboto">{{ formatDataValue(value, vueTorrentStore.useBinarySize) }}</span>
<span data-testid="card-unit" class="font-weight-light text-caption ml-1 text-subtitle-1">{{ formatDataUnit(value, vueTorrentStore.useBinarySize) }}</span>
</v-col>
</v-row>
</v-sheet>
</template>
<style scoped lang="scss">
@import '@fontsource/roboto-mono';
.roboto {
font-family: 'Roboto Mono', sans-serif !important;
font-weight: 500;
}
</style>

View file

@ -0,0 +1,27 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
defineProps<{
hideIcon?: boolean
prependIcon?: string
}>()
const showPassword = ref(false)
function toggleShow() {
showPassword.value = !showPassword.value
}
const type = computed(() => (showPassword.value ? 'text' : 'password'))
const icon = computed(() => (showPassword.value ? 'mdi-eye' : 'mdi-eye-off'))
</script>
<template>
<v-text-field :type="type" :append-inner-icon="hideIcon ? '' : icon" @click:append-inner="toggleShow">
<template v-slot:prepend v-if="prependIcon">
<v-icon color="accent" :icon="prependIcon" />
</template>
</v-text-field>
</template>
<style scoped></style>

View file

@ -1,47 +1,43 @@
<template>
<v-card v-ripple flat rounded="md" color="secondary" class="speedCard" data-testid="SpeedCard" @click="open">
<v-layout row align-center :class="color + '--text'">
<v-flex v-if="icon" xs2 class="pl-1">
<v-icon data-testid="SpeedCard-icon" :color="color" size="20px">
{{ icon }}
</v-icon>
</v-flex>
<v-layout column xs10>
<v-flex class="text-center font-weight-bold robot-mono">
<span data-testid="SpeedCard-value">{{ value | formatSpeedValue(shouldUseBitSpeed()) }}</span>
</v-flex>
<v-flex class="caption robot-mono text-center mt-n1">
<span data-testid="SpeedCard-unit">{{ value | formatSpeedUnit(shouldUseBitSpeed()) }}</span>
</v-flex>
</v-layout>
</v-layout>
</v-card>
</template>
<script setup lang="ts">
import { formatSpeedUnit, formatSpeedValue } from '@/helpers'
import { useVueTorrentStore } from '@/stores/vuetorrent'
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters } from 'vuex'
import { General } from '@/mixins'
export default defineComponent({
name: 'SpeedCard',
mixins: [General],
props: ['color', 'icon', 'value'],
computed: {
...mapGetters(['shouldUseBitSpeed'])
defineProps({
icon: {
type: String,
required: true
},
methods: {
open() {
this.createModal('SpeedLimitModal', { mode: this.color })
}
color: {
type: String,
required: true
},
value: {
type: Number,
required: true
}
})
const vueTorrentStore = useVueTorrentStore()
</script>
<style scoped>
.speedCard {
padding: 20px 20px !important;
font-size: 1.1em;
cursor: pointer;
<template>
<v-sheet color="secondary" rounded="lg" class="py-3">
<v-row class="d-flex flex-row align-center px-3">
<v-col cols="2" class="px-4">
<v-icon class="" :icon="icon" :color="color" />
</v-col>
<v-col cols="8" class="d-flex flex-column align-center justify-center">
<span class="text-subtitle-1 roboto" :class="`text-${color}`">{{ formatSpeedValue(value, vueTorrentStore.useBitSpeed) }}</span>
<span class="text-caption" :class="`text-${color}`">{{ formatSpeedUnit(value, vueTorrentStore.useBitSpeed) }}</span>
</v-col>
</v-row>
</v-sheet>
</template>
<style scoped lang="scss">
@import '@fontsource/roboto-mono';
.roboto {
font-family: 'Roboto Mono', sans-serif !important;
font-weight: 500;
}
</style>
</style>

View file

@ -1,30 +0,0 @@
<template>
<v-card flat color="secondary" class="mr-2 ml-2">
<v-row class="px-3">
<v-col cols="6" class="d-flex align-center">
<div :class="color + '--text'" data-testid="StorageCard-label">
{{ label }}
</div>
</v-col>
<v-col cols="6" class="d-flex align-center">
<span data-testid="StorageCard-Wrapper" :class="color + '--text title'">
<span data-testid="StorageCard-value">{{ value | formatDataValue(shouldUseBinaryData()) }} </span>
<span data-testid="StorageCard-unit" class="caption">{{ value | formatDataUnit(shouldUseBinaryData()) }}</span>
</span>
</v-col>
</v-row>
</v-card>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters } from 'vuex'
export default defineComponent({
name: 'StorageCard',
props: ['color', 'label', 'value'],
computed: {
...mapGetters(['shouldUseBinaryData'])
}
})
</script>

View file

@ -1,23 +1,14 @@
<script setup lang="ts">
defineProps<{ title: string; value: any; color: string }>()
</script>
<template>
<v-card flat color="secondary" class="mr-2 ml-2">
<v-row class="px-3">
<v-col cols="6" class="d-flex align-center">
<div :class="color + '--text'" data-testid="StringCard-label">
{{ label }}
</div>
</v-col>
<v-col cols="6" class="d-flex align-center">
<span data-testid="StringCard-Wrapper" :class="color + '--text title'">
<span data-testid="StringCard-value">{{ value }}</span>
</span>
<v-sheet color="secondary" rounded="lg" class="pa-3">
<v-row>
<v-col cols="7" class="text-subtitle-1" :class="`text-${color}`">{{ title }}</v-col>
<v-col cols="5" :class="`text-${color}`">
<span class="text-subtitle-1">{{ value }}</span>
</v-col>
</v-row>
</v-card>
</v-sheet>
</template>
<script lang="ts">
export default {
name: 'StringCard',
props: ['color', 'label', 'value']
}
</script>

View file

@ -0,0 +1,19 @@
<script setup lang="ts">
import { Torrent } from '@/types/vuetorrent'
defineProps<{ torrent: Torrent; title: string; value: string; total: string }>()
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
{{ torrent[value] }}
<span class="text-caption text-grey"> / {{ torrent[total] }} </span>
</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,36 @@
<script setup lang="ts">
import { Torrent } from '@/types/vuetorrent'
import { computed } from 'vue'
const props = defineProps<{ torrent: Torrent; title: string; value: string; color: string }>()
const values = computed(() => {
const val = props.torrent[props.value]
const type = typeof val
if (type === 'string') return val.length > 0 ? [val] : []
else if (type === 'object' /* array */) return val
})
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div class="d-flex flex-row gap">
<v-chip v-if="!values || values.length < 1" :color="color.replace('$1', torrent[value])" variant="flat">
{{ $t(`torrent.properties.empty_${value}`) }}
</v-chip>
<v-chip v-else v-for="val in values" :color="color.replace('$1', torrent.state)" variant="flat">
{{ val }}
</v-chip>
</div>
</div>
</template>
<style scoped>
.gap {
gap: 8px;
}
</style>

View file

@ -0,0 +1,25 @@
<script setup lang="ts">
import { formatDataUnit, formatDataValue } from '@/helpers'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { Torrent } from '@/types/vuetorrent'
defineProps<{ torrent: Torrent; title: string; value: string }>()
const vuetorrentStore = useVueTorrentStore()
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
{{ formatDataValue(torrent[value], vuetorrentStore.useBinarySize) }}
<span class="text-caption text-grey">
{{ formatDataUnit(torrent[value], vuetorrentStore.useBinarySize) }}
</span>
</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,25 @@
<script setup lang="ts">
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { Torrent } from '@/types/vuetorrent'
import dayjs from '@/plugins/dayjs'
defineProps<{ torrent: Torrent; title: string; value: string }>()
const vueTorrentStore = useVueTorrentStore()
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
<span v-if="torrent[value] > 0">
{{ dayjs(torrent[value] * 1000).format(vueTorrentStore.dateFormat ?? 'DD/MM/YYYY, HH:mm:ss') }}
</span>
<span v-else>{{ $t('dashboard.not_complete') }}</span>
</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,24 @@
<script setup lang="ts">
import { Torrent } from '@/types/vuetorrent'
import dayjs from '@/plugins/dayjs'
defineProps<{ torrent: Torrent; title: string; value: string }>()
const durationFormat = 'D[d] H[h] m[m] s[s]'
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
<span v-if="torrent[value] > 0">
{{ dayjs.duration(torrent[value], 'seconds').format(durationFormat) }}
</span>
<span v-else>{{ $t('dashboard.not_complete') }}</span>
</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,36 @@
<script setup lang="ts">
import { TorrentState } from '@/constants/qbit'
import { formatPercent } from '@/helpers'
import { Torrent } from '@/types/vuetorrent'
import { computed } from 'vue'
const props = defineProps<{ torrent: Torrent; title: string; value: string }>()
const isTorrentActive = computed(() => {
return [
TorrentState.UPLOADING,
TorrentState.CHECKING_UP,
TorrentState.FORCED_UP,
TorrentState.ALLOCATING,
TorrentState.DOWNLOADING,
TorrentState.META_DL,
TorrentState.CHECKING_DL,
TorrentState.FORCED_DL,
TorrentState.CHECKING_RESUME_DATA,
TorrentState.MOVING
].includes(props.torrent.state)
})
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<v-progress-linear :model-value="torrent[value]" :max="1" :striped="isTorrentActive" :height="20" :color="`torrent-${torrent.state}`" rounded="sm" style="width: 10em">
{{ formatPercent(torrent[value]) }}
</v-progress-linear>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,19 @@
<script setup lang="ts">
import { Torrent } from '@/types/vuetorrent'
import dayjs from '@/plugins/dayjs'
defineProps<{ torrent: Torrent; title: string; value: string }>()
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
<span>{{ dayjs(torrent[value] * 1000).fromNow() }}</span>
</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,25 @@
<script setup lang="ts">
import { formatSpeedUnit, formatSpeedValue } from '@/helpers'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { Torrent } from '@/types/vuetorrent'
defineProps<{ torrent: Torrent; title: string; value: string }>()
const vuetorrentStore = useVueTorrentStore()
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>
{{ formatSpeedValue(torrent[value], vuetorrentStore.useBitSpeed) }}
<span class="text-caption text-grey">
{{ formatSpeedUnit(torrent[value], vuetorrentStore.useBitSpeed) }}
</span>
</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,16 @@
<script setup lang="ts">
import { Torrent } from '@/types/vuetorrent'
defineProps<{ torrent: Torrent; title: string; value: string }>()
</script>
<template>
<div class="d-flex flex-column">
<div class="text-caption text-grey">
{{ $t(`torrent.properties.${title}`) }}
</div>
<div>{{ torrent[value] }}</div>
</div>
</template>
<style scoped></style>

View file

@ -0,0 +1,312 @@
<script setup lang="ts">
import RightClickMenuEntry from '@/components/Dashboard/TRC/RightClickMenuEntry.vue'
import ConfirmDeleteDialog from '@/components/Dialogs/ConfirmDeleteDialog.vue'
import MoveTorrentDialog from '@/components/Dialogs/MoveTorrentDialog.vue'
import RenameTorrentDialog from '@/components/Dialogs/RenameTorrentDialog.vue'
import { useDashboardStore } from '@/stores/dashboard'
import { useDialogStore } from '@/stores/dialog'
import { useMaindataStore } from '@/stores/maindata'
import { usePreferenceStore } from '@/stores/preferences'
import { TRCMenuEntry } from '@/types/vuetorrent'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
const props = defineProps<{
modelValue: boolean
}>()
const emit = defineEmits(['update:modelValue'])
const { t } = useI18n()
const router = useRouter()
const dashboardStore = useDashboardStore()
const dialogStore = useDialogStore()
const maindataStore = useMaindataStore()
const preferenceStore = usePreferenceStore()
const trcVisible = computed({
get: () => props.modelValue,
set: value => emit('update:modelValue', value)
})
const isMultiple = computed(() => dashboardStore.selectedTorrents.length > 1)
const hashes = computed(() => dashboardStore.selectedTorrents)
const hash = computed(() => hashes.value[0])
const torrent = computed(() => maindataStore.getTorrentByHash(hash.value))
const torrents = computed(() => dashboardStore.selectedTorrents.map(maindataStore.getTorrentByHash).filter(torrent => !!torrent))
const availableCategories = computed(() => [{ name: '' }, ...maindataStore.categories])
async function resumeTorrents() {
await maindataStore.resumeTorrents(hashes)
}
async function forceResumeTorrents() {
await maindataStore.forceResumeTorrents(hashes)
}
async function pauseTorrents() {
await maindataStore.pauseTorrents(hashes)
}
function deleteTorrents() {
dialogStore.createDialog(ConfirmDeleteDialog, { hashes: [...dashboardStore.selectedTorrents] })
}
function moveTorrents() {
dialogStore.createDialog(MoveTorrentDialog, { hashes: [...dashboardStore.selectedTorrents] })
}
function renameTorrents() {
dialogStore.createDialog(RenameTorrentDialog, { hash: dashboardStore.selectedTorrents[0] })
}
async function forceRecheck() {
await maindataStore.recheckTorrents(hashes)
}
async function forceReannounce() {
await maindataStore.reannounceTorrents(hashes)
}
async function toggleSeqDl() {
await maindataStore.toggleSeqDl(hashes)
}
async function toggleFLPiecePrio() {
await maindataStore.toggleFLPiecePrio(hashes)
}
async function toggleAutoTMM() {
await maindataStore.toggleAutoTmm(hashes, !torrent.value?.auto_tmm)
}
function hasTag(tag: string) {
return torrents.value.every(torrent => torrent && torrent.tags && torrent.tags.includes(tag))
}
async function toggleTag(tag: string) {
if (hasTag(tag)) await maindataStore.removeTorrentTags(hashes.value, [tag])
else await maindataStore.addTorrentTags(hashes.value, [tag])
}
async function copyValue(valueToCopy: string) {
await navigator.clipboard.writeText(valueToCopy)
}
async function exportTorrents() {
hashes.value.forEach(hash => {
maindataStore.exportTorrent(hash).then(blob => {
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.style.opacity = '0'
link.setAttribute('download', `${hash}.torrent`)
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
})
}
const menuData = computed<TRCMenuEntry[]>(() => [
{
text: t('dashboard.right_click.advanced.title'),
icon: 'mdi-head-cog',
children: [
{
text: t('dashboard.right_click.advanced.change_location'),
icon: 'mdi-folder',
action: moveTorrents
},
{
text: t('dashboard.right_click.advanced.rename'),
icon: 'mdi-rename-box',
hidden: isMultiple.value,
action: renameTorrents
},
{
text: t('dashboard.right_click.advanced.recheck'),
icon: 'mdi-playlist-check',
action: forceRecheck
},
{
text: t('dashboard.right_click.advanced.reannounce'),
icon: 'mdi-bullhorn',
action: forceReannounce
},
{
text: t('dashboard.right_click.advanced.seq_dl'),
icon: torrent.value?.seq_dl ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline',
action: toggleSeqDl
},
{
text: t('dashboard.right_click.advanced.f_l_prio'),
icon: torrent.value?.f_l_piece_prio ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline',
action: toggleFLPiecePrio
},
{
text: t('dashboard.right_click.advanced.auto_tmm'),
icon: torrent.value?.auto_tmm ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline',
action: toggleAutoTMM
}
]
},
{
text: t('dashboard.right_click.priority.title'),
icon: 'mdi-priority-high',
hidden: !preferenceStore.preferences!.queueing_enabled,
children: [
{
text: t('dashboard.right_click.priority.top'),
icon: 'mdi-priority-high',
action: async () => await maindataStore.setTorrentPriority(hashes.value, 'topPrio')
},
{
text: t('dashboard.right_click.priority.increase'),
icon: 'mdi-arrow-up',
action: async () => await maindataStore.setTorrentPriority(hashes.value, 'increasePrio')
},
{
text: t('dashboard.right_click.priority.decrease'),
icon: 'mdi-arrow-down',
action: async () => await maindataStore.setTorrentPriority(hashes.value, 'decreasePrio')
},
{
text: t('dashboard.right_click.priority.bottom'),
icon: 'mdi-priority-low',
action: async () => await maindataStore.setTorrentPriority(hashes.value, 'bottomPrio')
}
]
},
{
text: t('dashboard.right_click.tags.title'),
icon: 'mdi-tag',
disabled: maindataStore.tags.length === 0,
disabledText: t('dashboard.right_click.tags.disabled_title'),
disabledIcon: 'mdi-tag-off',
children: maindataStore.tags.map(tag => ({
text: tag,
icon: hasTag(tag) ? 'mdi-checkbox-marked' : 'mdi-checkbox-blank-outline',
action: async () => await toggleTag(tag)
}))
},
{
text: t('dashboard.right_click.category.title'),
icon: 'mdi-label',
disabled: maindataStore.categories.length === 0,
disabledText: t('dashboard.right_click.category.disabled_title'),
disabledIcon: 'mdi-label-off',
children: availableCategories.value.map(category => ({
text: category.name === '' ? t('dashboard.right_click.category.clear') : category.name,
action: async () => await maindataStore.setTorrentCategory(hashes.value, category.name)
}))
},
{
text: t('dashboard.right_click.speed_limit.title'),
icon: 'mdi-speedometer-slow',
children: [
{
text: t('dashboard.right_click.speed_limit.download'),
icon: 'mdi-download',
action: () => {
/* TODO */
}
},
{
text: t('dashboard.right_click.speed_limit.upload'),
icon: 'mdi-upload',
action: () => {
/* TODO */
}
},
{
text: t('dashboard.right_click.speed_limit.share'),
icon: 'mdi-account-group',
action: () => {
/* TODO */
}
}
]
},
{
text: t('dashboard.right_click.copy.title'),
icon: 'mdi-content-copy',
hidden: isMultiple.value,
children: [
{
text: t('dashboard.right_click.copy.name'),
icon: 'mdi-alphabetical-variant',
action: async () => torrent.value && (await copyValue(torrent.value.name))
},
{
text: t('dashboard.right_click.copy.hash'),
icon: 'mdi-pound',
action: async () => await copyValue(hash.value)
},
{
text: t('dashboard.right_click.copy.magnet'),
icon: 'mdi-magnet',
action: async () => torrent.value && (await copyValue(torrent.value.magnet))
}
]
},
{
text: t('dashboard.right_click.export', dashboardStore.selectedTorrents.length),
icon: isMultiple.value ? 'mdi-download-multiple' : 'mdi-download',
action: exportTorrents
},
{
text: t('dashboard.right_click.info'),
icon: 'mdi-information',
hidden: isMultiple.value,
action: () => router.push({ name: 'torrentDetail', params: { hash: hash.value } })
}
])
</script>
<template>
<v-menu v-if="trcVisible" v-model="trcVisible" activator="parent" :close-on-content-click="true" transition="slide-y-transition" scroll-strategy="none">
<v-list>
<v-list-item>
<div class="d-flex justify-space-around">
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn density="compact" variant="plain" icon="mdi-play" v-bind="props" @click="resumeTorrents" />
</template>
<span>Resume</span>
</v-tooltip>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn density="compact" variant="plain" icon="mdi-fast-forward" v-bind="props" @click="forceResumeTorrents" />
</template>
<span>Force Resume</span>
</v-tooltip>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn density="compact" variant="plain" icon="mdi-pause" v-bind="props" @click="pauseTorrents" />
</template>
<span>Pause</span>
</v-tooltip>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn color="red" density="compact" variant="plain" icon="mdi-delete-forever" v-bind="props" @click="deleteTorrents" />
</template>
<span>Delete</span>
</v-tooltip>
</div>
</v-list-item>
<RightClickMenuEntry v-for="entry in menuData" v-bind="entry" />
</v-list>
</v-menu>
</template>
<style scoped lang="scss">
.menu-scrollable {
max-height: 500px;
overflow: visible;
}
</style>

View file

@ -0,0 +1,35 @@
<script setup lang="ts">
import { TRCMenuEntry } from '@/types/vuetorrent'
defineProps<{
text: string
icon?: string
action?: () => void
hidden?: boolean
disabled?: boolean
disabledText?: string
disabledIcon?: string
divider?: boolean
children?: TRCMenuEntry[]
}>()
</script>
<template>
<v-list-item class="px-3 pointer" :disabled="disabled" v-if="!hidden" @click="action">
<div class="d-flex">
<v-icon class="mr-2" v-if="disabled && disabledIcon">{{ disabledIcon }}</v-icon>
<v-icon class="mr-2" v-else-if="icon">{{ icon }}</v-icon>
<span v-if="disabled && disabledText">{{ disabledText }}</span>
<span v-else>{{ text }}</span>
<v-spacer />
<v-icon v-if="children">mdi-chevron-right</v-icon>
</div>
<v-menu v-if="children" activator="parent" :open-on-hover="true" :open-on-click="true" close-delay="0" open-delay="0" location="right">
<v-list>
<RightClickMenuEntry v-for="child in children" v-bind="child" />
</v-list>
</v-menu>
</v-list-item>
</template>
<style scoped></style>

View file

@ -0,0 +1,81 @@
<script setup lang="ts">
import { DashboardPropertyType } from '@/constants/vuetorrent'
import { doesCommand } from '@/helpers'
import { useDashboardStore } from '@/stores/dashboard'
import { useMaindataStore } from '@/stores/maindata'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { Torrent } from '@/types/vuetorrent'
import { computed } from 'vue'
import ItemAmount from './DashboardItems/ItemAmount.vue'
import ItemChip from './DashboardItems/ItemChip.vue'
import ItemData from './DashboardItems/ItemData.vue'
import ItemDateTime from './DashboardItems/ItemDateTime.vue'
import ItemDuration from './DashboardItems/ItemDuration.vue'
import ItemPercent from './DashboardItems/ItemPercent.vue'
import ItemRelativeTime from './DashboardItems/ItemRelativeTime.vue'
import ItemSpeed from './DashboardItems/ItemSpeed.vue'
import ItemText from './DashboardItems/ItemText.vue'
const props = defineProps<{ torrent: Torrent }>()
const dashboardStore = useDashboardStore()
const maindataStore = useMaindataStore()
const vuetorrentStore = useVueTorrentStore()
const torrentProperties = computed(() => {
let ppts = props.torrent.progress === 1 ? vuetorrentStore.doneTorrentProperties : vuetorrentStore.busyTorrentProperties
return ppts.filter(ppt => ppt.active).sort((a, b) => a.order - b.order)
})
function onClick(e: MouseEvent) {
if (e.shiftKey) {
dashboardStore.spanTorrentSelection(maindataStore.getTorrentIndexByHash(props.torrent.hash))
} else if (doesCommand(e) || dashboardStore.isSelectionMultiple) {
dashboardStore.isSelectionMultiple = true
dashboardStore.toggleSelect(props.torrent.hash)
}
}
const getComponent = (type: DashboardPropertyType) => {
switch (type) {
case DashboardPropertyType.AMOUNT:
return ItemAmount
case DashboardPropertyType.CHIP:
return ItemChip
case DashboardPropertyType.DATA:
return ItemData
case DashboardPropertyType.DATETIME:
return ItemDateTime
case DashboardPropertyType.DURATION:
return ItemDuration
case DashboardPropertyType.PERCENT:
return ItemPercent
case DashboardPropertyType.RELATIVE:
return ItemRelativeTime
case DashboardPropertyType.SPEED:
return ItemSpeed
case DashboardPropertyType.TEXT:
default:
return ItemText
}
}
const isTorrentSelected = computed(() => dashboardStore.isTorrentInSelection(props.torrent.hash))
</script>
<template>
<v-card :class="`sideborder ${torrent.state} pointer`" :color="isTorrentSelected ? `torrent-${torrent.state}` : undefined" width="100%" @click="onClick">
<v-card-title class="font-weight-bold">{{ torrent.name }}</v-card-title>
<v-card-text>
<div class="d-flex gap flex-wrap">
<component :is="getComponent(ppt.type)" :torrent="torrent" v-bind="ppt.props" v-for="ppt in torrentProperties" />
</div>
</v-card-text>
</v-card>
</template>
<style scoped>
.gap {
gap: 8px 16px;
}
</style>

View file

@ -0,0 +1,293 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { AppPreferences } from '@/constants/qbit'
import { ContentLayout, StopCondition } from '@/constants/qbit/AppPreferences'
import { useMaindataStore } from '@/stores/maindata'
import { useNavbarStore } from '@/stores/navbar'
import { usePreferenceStore } from '@/stores/preferences'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { Category } from '@/types/qbit/models'
import { AddTorrentPayload } from '@/types/qbit/payloads'
import { computed, onBeforeMount, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const props = withDefaults(defineProps<{
guid: string
openSuddenly?: boolean
}>(), {
openSuddenly: false
})
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const maindataStore = useMaindataStore()
const navbarStore = useNavbarStore()
const preferenceStore = usePreferenceStore()
const vueTorrentStore = useVueTorrentStore()
const fileOverflowDisplayLimit = 2
const isFormValid = computed(() => navbarStore.addTorrentDialogUrls.length > 0 || navbarStore.addTorrentDialogFiles.length > 0)
const formData = reactive({
autoTMM: false,
skipChecking: false,
sequentialDownload: false,
firstLastPiecePrio: false,
startNow: true,
contentLayout: ContentLayout.ORIGINAL,
stopCondition: StopCondition.NONE,
savepath: '',
category: null as Category | null,
tags: [] as string[]
})
const tagSearch = ref('')
const categorySearch = ref('')
const contentLayoutOptions = ref([
{ title: t('constants.contentLayout.original'), value: AppPreferences.ContentLayout.ORIGINAL },
{ title: t('constants.contentLayout.subfolder'), value: AppPreferences.ContentLayout.SUBFOLDER },
{ title: t('constants.contentLayout.nosubfolder'), value: AppPreferences.ContentLayout.NO_SUBFOLDER }
])
const stopConditionOptions = ref([
{ title: t('constants.stopCondition.none'), value: AppPreferences.StopCondition.NONE },
{ title: t('constants.stopCondition.metadataReceived'), value: AppPreferences.StopCondition.METADATA_RECEIVED },
{ title: t('constants.stopCondition.filesChecked'), value: AppPreferences.StopCondition.FILES_CHECKED }
])
const resetForm = () => {
navbarStore.addTorrentDialogUrls = ''
navbarStore.addTorrentDialogFiles = []
formData.autoTMM = false
formData.skipChecking = false
formData.sequentialDownload = false
formData.firstLastPiecePrio = false
formData.startNow = true
formData.contentLayout = preferenceStore.preferences!.torrent_content_layout
formData.stopCondition = preferenceStore.preferences!.torrent_stop_condition
formData.savepath = preferenceStore.preferences!.save_path
formData.category = null
formData.tags = []
}
const submit = async () => {
if (!isFormValid.value) return
const params: AddTorrentPayload = {
savepath: formData.savepath,
paused: !formData.startNow,
skip_checking: formData.skipChecking,
autoTMM: formData.autoTMM,
sequentialDownload: formData.sequentialDownload,
firstLastPiecePrio: formData.firstLastPiecePrio,
contentLayout: formData.contentLayout,
stopCondition: formData.stopCondition
}
if (navbarStore.addTorrentDialogUrls.length > 0) params.urls = navbarStore.addTorrentDialogUrls
if (formData.category && formData.category.name) params.category = formData.category.name
if (formData.tags.length > 0) params.tags = formData.tags.join(',')
await maindataStore.addTorrents(params, navbarStore.addTorrentDialogFiles)
resetForm()
close()
}
const close = () => {
isOpened.value = false
}
const onCategoryChanged = () => {
formData.savepath = formData.category && formData.category.savePath ? formData.category.savePath : preferenceStore.preferences!.save_path
}
onBeforeMount(async () => {
if (!preferenceStore.preferences) {
await preferenceStore.fetchPreferences()
}
formData.autoTMM = preferenceStore.preferences!.auto_tmm_enabled
formData.startNow = !preferenceStore.preferences!.start_paused_enabled
formData.contentLayout = preferenceStore.preferences!.torrent_content_layout
formData.stopCondition = preferenceStore.preferences!.torrent_stop_condition
formData.savepath = preferenceStore.preferences!.save_path
})
onBeforeMount(async () => {
if (maindataStore.categories.length < 1) {
await maindataStore.fetchCategories()
}
if (maindataStore.tags.length < 1) {
await maindataStore.fetchTags()
}
})
</script>
<template>
<v-dialog
v-model="isOpened"
:transition="openSuddenly ? 'none' : 'dialog-bottom-transition'"
:fullscreen="$vuetify.display.mobile"
:class="$vuetify.display.mobile ? '' : 'w-50'">
<v-card>
<v-card-title>
<v-toolbar color="transparent">
<v-toolbar-title>{{ t('dialogs.add.title') }}</v-toolbar-title>
<v-btn icon="mdi-close" @click="close" />
</v-toolbar>
</v-card-title>
<v-card-text>
<v-row>
<v-col>
<v-file-input
v-model="navbarStore.addTorrentDialogFiles"
accept=".torrent"
counter
:show-size="vueTorrentStore.useBinarySize ? 1024 : 1000"
multiple
persistent-clear
persistent-hint
prepend-icon=""
variant="outlined"
:label="t('dialogs.add.files')">
<template v-slot:prepend>
<v-icon color="accent">mdi-paperclip</v-icon>
</template>
<template v-slot:selection="{ fileNames }">
<template v-for="(filename, index) in fileNames">
<v-chip v-if="index < fileOverflowDisplayLimit" color="accent" label size="small" class="mr-2">{{ filename }} </v-chip>
</template>
<span v-if="fileNames.length == fileOverflowDisplayLimit" class="text-overline text-grey-darken-2 ml-2">
{{ t('dialogs.add.fileOverflow', fileNames.length - fileOverflowDisplayLimit) }}
</span>
</template>
</v-file-input>
<v-textarea v-model="navbarStore.addTorrentDialogUrls" clearable :label="t('dialogs.add.links')">
<template v-slot:prepend>
<v-icon color="accent">mdi-link</v-icon>
</template>
</v-textarea>
</v-col>
</v-row>
<v-row>
<v-col>
<v-combobox
v-model="formData.tags"
v-model:search="tagSearch"
:items="maindataStore.tags"
:hide-no-data="false"
clearable
chips
multiple
:label="t('dialogs.add.tags')">
<template v-slot:prepend>
<v-icon color="accent">mdi-tag</v-icon>
</template>
<template v-slot:no-data>
<v-list-item>
<v-list-item-title v-if="tagSearch?.length > 0">
{{ t('dialogs.add.noTagMatch', { query: tagSearch }) }}
</v-list-item-title>
<v-list-item-title v-else>
{{ t('dialogs.add.noTags') }}
</v-list-item-title>
</v-list-item>
</template>
</v-combobox>
<v-combobox
v-model="formData.category"
v-model:search="categorySearch"
:items="maindataStore.categories"
item-title="name"
return-object
:hide-no-data="false"
clearable
chips
label="Category"
@update:modelValue="onCategoryChanged">
<template v-slot:prepend>
<v-icon color="accent">mdi-label</v-icon>
</template>
<template v-slot:no-data>
<v-list-item>
<v-list-item-title v-if="categorySearch?.length > 0">
{{ t('dialogs.add.noCategoryMatch', { query: categorySearch }) }}
</v-list-item-title>
<v-list-item-title v-else>
{{ t('dialogs.add.noCategories') }}
</v-list-item-title>
</v-list-item>
</template>
</v-combobox>
</v-col>
</v-row>
<v-row>
<v-col>
<v-text-field v-model="formData.savepath" :disabled="formData.autoTMM" :label="t('dialogs.add.savePath')">
<template v-slot:prepend>
<v-icon color="accent">mdi-folder</v-icon>
</template>
</v-text-field>
</v-col>
</v-row>
<v-row>
<v-col>
<v-select
v-model="formData.contentLayout"
:items="contentLayoutOptions"
hide-details
color="accent"
variant="solo-filled"
rounded="xl"
:label="t('constants.contentLayout.title')" />
</v-col>
</v-row>
<v-row>
<v-col>
<v-select
v-model="formData.stopCondition"
:items="stopConditionOptions"
hide-details
color="accent"
variant="solo-filled"
rounded="xl"
:label="t('constants.stopCondition.title')" />
</v-col>
</v-row>
<v-row>
<v-col>
<v-list>
<v-list-item>
<v-checkbox v-model="formData.startNow" density="compact" hide-details :label="t('dialogs.add.startNow')" />
</v-list-item>
<v-list-item>
<v-checkbox v-model="formData.skipChecking" density="compact" hide-details :label="t('dialogs.add.skipChecking')" />
</v-list-item>
<v-list-item>
<v-checkbox v-model="formData.autoTMM" density="compact" hide-details :label="t('dialogs.add.autoTMM')" />
</v-list-item>
<v-list-item>
<v-checkbox v-model="formData.sequentialDownload" density="compact" hide-details :label="t('dialogs.add.sequentialDownload')" />
</v-list-item>
<v-list-item>
<v-checkbox v-model="formData.firstLastPiecePrio" density="compact" hide-details :label="t('dialogs.add.firstLastPiecePrio')" />
</v-list-item>
</v-list>
</v-col>
</v-row>
</v-card-text>
<v-card-actions class="justify-center">
<v-btn :disabled="!isFormValid" color="accent" variant="elevated" :text="$t('dialogs.add.submit')" @click="submit" />
<v-btn color="error" variant="flat" :text="$t('common.close')" @click="close" />
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,75 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useMaindataStore } from '@/stores/maindata'
import { Category } from '@/types/qbit/models'
import { onBeforeMount, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
initialCategory?: Category
}>()
const { t } = useI18n()
const maindataStore = useMaindataStore()
const { isOpened } = useDialog(props.guid)
const form = ref<VForm>()
const isFormValid = ref(false)
const nameRules = [(v: string) => !!v || t('dialogs.category.nameRequired')]
const formData = reactive<Category>({
name: '',
savePath: ''
})
async function submit() {
if (!isFormValid.value) return
if (!!props.initialCategory) {
await maindataStore.editCategory(formData, props.initialCategory.name === formData.name ? undefined : props.initialCategory.name)
} else {
await maindataStore.createCategory(formData)
}
close()
}
const close = () => {
isOpened.value = false
}
onBeforeMount(() => {
formData.name = props.initialCategory?.name || ''
formData.savePath = props.initialCategory?.savePath || ''
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>{{ $t(`dialogs.category.title.${initialCategory ? 'edit' : 'create'}`) }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent @keydown.enter.prevent="submit">
<v-text-field v-if="!!initialCategory" :model-value="initialCategory.name" disabled :label="$t('dialogs.category.oldName')" />
<v-text-field v-model="formData.name" :rules="nameRules" :autofocus="!initialCategory" :label="$t('dialogs.category.name')" />
<v-text-field v-model="formData.savePath" :autofocus="!!initialCategory" :label="$t('dialogs.category.savePath')" />
<v-scroll-x-transition>
<div class="text-warning" v-if="!!initialCategory && initialCategory.name !== formData.name">
<v-icon>mdi-alert</v-icon>
{{ $t('dialogs.category.warnEdit') }}
</div>
</v-scroll-x-transition>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" :disabled="!isFormValid" @click="submit">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,98 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useDashboardStore } from '@/stores/dashboard'
import { useMaindataStore } from '@/stores/maindata'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { computed, onBeforeMount, onUnmounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
hashes: string[]
}>()
const { isOpened } = useDialog(props.guid)
const route = useRoute()
const router = useRouter()
const { t } = useI18n()
const dashboardStore = useDashboardStore()
const maindataStore = useMaindataStore()
const vuetorrentStore = useVueTorrentStore()
const form = ref<VForm>()
const isFormValid = ref(false)
const selection = computed(() => maindataStore.torrents.filter(t => props.hashes?.includes(t.hash)))
async function submit() {
if (!isFormValid.value) return
await maindataStore.deleteTorrents(
selection.value.map(t => t.hash),
vuetorrentStore.deleteWithFiles
)
dashboardStore.unselectAllTorrents()
close()
if (route.name === 'torrentDetail') {
await router.push({ name: 'dashboard' })
}
}
const close = () => {
isOpened.value = false
}
function handleKeyboardShortcuts(e: KeyboardEvent) {
if (e.key === 'Enter') {
e.preventDefault()
submit()
return true
}
}
onBeforeMount(() => {
document.addEventListener('keydown', handleKeyboardShortcuts)
})
onUnmounted(() => {
document.removeEventListener('keydown', handleKeyboardShortcuts)
})
</script>
<template>
<v-dialog v-model="isOpened" max-width="1000">
<v-card>
<v-card-title>{{ t('dialogs.delete.title', selection.length) }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent>
<div class="d-flex flex-wrap gap">
<span class="pa-1 border wrap-anywhere" v-for="torrent in selection">{{ torrent.name }}</span>
</div>
<v-checkbox v-model="vuetorrentStore.deleteWithFiles" hide-details :label="$t('dialogs.delete.deleteWithFiles')" />
<v-scroll-x-transition>
<div class="text-red" v-show="vuetorrentStore.deleteWithFiles">
<v-icon>mdi-alert</v-icon>
{{ $t('dialogs.delete.warnDelete') }}
</div>
</v-scroll-x-transition>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="error" :disabled="!isFormValid" @click="submit">{{ $t('common.delete') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
.gap {
gap: 8px;
}
</style>

View file

@ -0,0 +1,51 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useAppStore } from '@/stores/app'
import { useAuthStore } from '@/stores/auth'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { useI18n } from 'vue-i18n'
import { toast } from 'vue3-toastify'
const props = defineProps<{
guid: string
}>()
const { t } = useI18n()
const { isOpened } = useDialog(props.guid)
const appStore = useAppStore()
const authStore = useAuthStore()
const vueTorrentStore = useVueTorrentStore()
const close = () => {
isOpened.value = false
}
const shutdown = async () => {
if (await appStore.shutdownQbit()) {
authStore.setAuthStatus(false)
await vueTorrentStore.redirectToLogin()
toast.success(t('dialogs.shutdown.success'))
} else {
toast.error(t('dialogs.shutdown.error'))
}
close()
}
</script>
<template>
<v-dialog v-model="isOpened" width="auto">
<v-card :title="$t('dialogs.shutdown.title')" :text="$t('dialogs.shutdown.content')">
<v-card-actions class="justify-end">
<v-spacer />
<v-btn class="accent white--text elevation-0 px-4" variant="elevated" color="error" @click="shutdown">
{{ $t('common.yes') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close">
{{ $t('common.no') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,58 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { ConnectionStatus } from '@/constants/qbit'
import { useLogStore } from '@/stores/logs'
import { useMaindataStore } from '@/stores/maindata'
import { computed } from 'vue'
const props = defineProps<{
guid: string
}>()
const { isOpened } = useDialog(props.guid)
const logStore = useLogStore()
const maindataStore = useMaindataStore()
const connectionStatusColor = computed(() => {
switch (maindataStore.serverState?.connection_status) {
case ConnectionStatus.CONNECTED:
return 'text-success'
case ConnectionStatus.DISCONNECTED:
return 'text-error'
case ConnectionStatus.FIREWALLED:
return 'text-warning'
default:
return 'text-grey'
}
})
const close = () => {
isOpened.value = false
}
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-text>
<v-list>
<v-list-item :title="$t('dialogs.connectionStatus.status')">
<span :class="['ml-2', connectionStatusColor]">
{{ $t('constants.connectionStatus.' + maindataStore.serverState?.connection_status) }}
</span>
</v-list-item>
<v-list-item :title="$t('dialogs.connectionStatus.externalIp')">
<span class="ml-2" v-if="logStore.externalIp">{{ logStore.externalIp }}</span>
<span class="ml-2 text-error" v-else>No IP detected</span>
</v-list-item>
</v-list>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.close') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,65 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useMaindataStore } from '@/stores/maindata'
import { computed, onBeforeMount, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
hashes: string[]
}>()
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const maindataStore = useMaindataStore()
const form = ref<VForm>()
const isFormValid = ref(false)
const formData = reactive({
newPath: ''
})
const rules = [(v: string) => !!v || t('dialogs.moveTorrent.required'), (v: string) => v !== oldPath.value || t('dialogs.moveTorrent.samePath')]
const torrents = computed(() => props.hashes.map(maindataStore.getTorrentByHash))
const oldPath = computed(() => torrents.value[0]?.savePath)
async function submit() {
await form.value?.validate()
if (!isFormValid.value) return
await maindataStore.moveTorrents(props.hashes, formData.newPath)
close()
}
const close = () => {
isOpened.value = false
}
onBeforeMount(() => {
formData.newPath = torrents.value[0]?.savePath || ''
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>{{ $t('dialogs.moveTorrent.title') }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent>
<v-text-field v-if="oldPath" :model-value="oldPath" disabled :label="$t('dialogs.moveTorrent.oldPath')" />
<v-text-field v-model="formData.newPath" :rules="rules" autofocus :label="$t('dialogs.moveTorrent.newPath')" @keydown.enter="submit" />
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" :disabled="!isFormValid" @click="submit">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,80 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useMaindataStore } from '@/stores/maindata'
import { nextTick, onBeforeMount, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
hash: string
isFolder: boolean
oldName: string
}>()
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const maindataStore = useMaindataStore()
const form = ref<VForm>()
const input = ref<HTMLInputElement>()
const isFormValid = ref(false)
const formData = reactive({
newName: ''
})
const rules = [(v: string) => !!v || t('dialogs.moveTorrent.required')]
async function submit() {
await form.value?.validate()
if (!isFormValid.value) return
if (props.isFolder) {
await maindataStore.renameTorrentFolder(props.hash, props.oldName, formData.newName)
} else {
await maindataStore.renameTorrentFile(props.hash, props.oldName, formData.newName)
}
close()
}
const close = () => {
isOpened.value = false
}
onBeforeMount(() => {
formData.newName = props.oldName
if (props.isFolder) {
nextTick(() => input.value?.select())
} else {
const startIndex = formData.newName.lastIndexOf('/')
const endIndex = formData.newName.lastIndexOf('.')
nextTick(() => {
input.value?.setSelectionRange(startIndex + 1, endIndex == -1 ? formData.newName.length : endIndex)
})
}
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>{{ t('dialogs.moveTorrentFile.title', 1 + Number(isFolder)) }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent>
<v-text-field v-if="oldName" :model-value="oldName" disabled :label="$t('dialogs.moveTorrentFile.oldName')" />
<v-text-field v-model="formData.newName" ref="input" :rules="rules" autofocus :label="$t('dialogs.moveTorrent.newPath')" @keydown.enter="submit" />
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" :disabled="!isFormValid" @click="submit">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,130 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useSearchEngineStore } from '@/stores/searchEngine'
import { SearchPlugin } from '@/types/qbit/models'
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
}>()
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const searchEngineStore = useSearchEngineStore()
const headers = [
{ title: t('dialogs.pluginManager.headers.enabled'), key: 'enabled', sortable: false },
{ title: t('dialogs.pluginManager.headers.name'), key: 'fullName' },
{ title: t('dialogs.pluginManager.headers.version'), key: 'version' },
{ title: t('dialogs.pluginManager.headers.url'), key: 'url' },
{ title: t('dialogs.pluginManager.headers.actions'), key: 'actions' }
]
const loading = ref(false)
const updateLoading = ref(false)
const installisOpened = ref(false)
const isInstallFormValid = ref(false)
const installInput = ref('')
async function onTogglePlugin(plugin: SearchPlugin) {
await searchEngineStore.toggleSearchPlugin(plugin)
await searchEngineStore.fetchSearchPlugins()
}
async function updatePlugins() {
updateLoading.value = true
await searchEngineStore.updatePlugins().then(() => new Promise(resolve => setTimeout(resolve, 2000)))
await searchEngineStore.fetchSearchPlugins()
updateLoading.value = false
}
async function installNewPlugin() {
closeInstallDialog()
loading.value = true
await searchEngineStore.installSearchPlugin(installInput.value)
installInput.value = ''
setTimeout(() => {
searchEngineStore.fetchSearchPlugins().then(() => {
loading.value = false
})
}, 1000)
}
async function uninstallPlugin(plugin: SearchPlugin) {
loading.value = true
await searchEngineStore.uninstallSearchPlugin(plugin.name)
await searchEngineStore.fetchSearchPlugins()
loading.value = false
}
const close = () => {
isOpened.value = false
}
function closeInstallDialog() {
installisOpened.value = false
}
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title class="d-flex">
<div>
{{ $t(`dialogs.pluginManager.title`) }}
</div>
<v-spacer />
<v-btn :text="$t('dialogs.pluginManager.update')" color="accent" class="mr-2" :loading="updateLoading" @click="updatePlugins" />
<v-dialog v-model="installisOpened">
<template v-slot:activator="{ props }">
<v-btn v-bind="props" color="primary">
{{ $t('dialogs.pluginManager.install.activator') }}
</v-btn>
</template>
<v-card :title="$t('dialogs.pluginManager.install.title')">
<v-card-text>
<v-form v-model="isInstallFormValid" @submit.prevent>
<v-text-field v-model="installInput" autofocus :label="$t('dialogs.pluginManager.install.label')" />
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="closeInstallDialog">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" @click="installNewPlugin">{{ $t('common.ok') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card-title>
<v-card-text>
<v-data-table :headers="headers" items-per-page="-1" :items="searchEngineStore.searchPlugins" :sort-by="[{ key: 'fullName', order: 'asc' }]" :loading="loading">
<template v-slot:item.enabled="{ item }">
<v-checkbox-btn :model-value="item.enabled" @click="onTogglePlugin(item)" />
</template>
<template v-slot:item.url="{ item }">
<a :href="item.url" :title="item.name">{{ item.url }}</a>
</template>
<template v-slot:item.actions="{ item }">
<v-icon color="red" icon="mdi-delete" @click="uninstallPlugin(item)" />
</template>
<template v-slot:tfoot></template>
</v-data-table>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="accent" @click="close">{{ $t('common.close') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,69 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useMaindataStore } from '@/stores/maindata'
import { computed, onBeforeMount, onMounted, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
hash: string
}>()
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const maindataStore = useMaindataStore()
const field = ref<HTMLInputElement>()
const form = ref<VForm>()
const isFormValid = ref(false)
const formData = reactive({
newName: ''
})
const rules = [(v: string) => !!v || t('dialogs.renameTorrent.required'), (v: string) => v !== oldName.value || t('dialogs.renameTorrent.sameName')]
const torrent = computed(() => maindataStore.getTorrentByHash(props.hash))
const oldName = computed(() => torrent.value?.name)
async function submit() {
await form.value?.validate()
if (!isFormValid.value) return
await maindataStore.renameTorrent(props.hash, formData.newName)
close()
}
const close = () => {
isOpened.value = false
}
onBeforeMount(() => {
formData.newName = torrent.value?.name || ''
})
onMounted(() => {
field.value?.select()
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>{{ $t('dialogs.renameTorrent.title') }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent>
<v-text-field v-if="oldName" :model-value="oldName" disabled :label="$t('dialogs.renameTorrent.oldName')" />
<v-text-field v-model="formData.newName" ref="field" :rules="rules" autofocus :label="$t('dialogs.renameTorrent.newName')" @keydown.enter="submit" />
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" :disabled="!isFormValid" @click="submit">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,64 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useRssStore } from '@/stores/rss'
import { Feed } from '@/types/qbit/models'
import { onBeforeMount, reactive, ref } from 'vue'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
initialFeed?: Feed
}>()
const { isOpened } = useDialog(props.guid)
const rssStore = useRssStore()
const form = ref<VForm>()
const isFormValid = ref(false)
const formData = reactive({
name: '',
url: ''
})
async function save() {
if (props.initialFeed) {
await rssStore.editFeed(props.initialFeed.name, formData.name)
} else {
await rssStore.createFeed(formData.name, formData.url)
}
await rssStore.fetchFeeds()
close()
}
const close = () => {
isOpened.value = false
}
onBeforeMount(() => {
if (props.initialFeed) {
formData.name = props.initialFeed.name
formData.url = props.initialFeed.url
}
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>{{ $t(`dialogs.rss.feed.title.${initialFeed ? 'edit' : 'create'}`) }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent>
<v-text-field v-model="formData.name" :label="$t('dialogs.rss.feed.name')" />
<v-text-field v-model="formData.url" :disabled="!!initialFeed" :label="$t('dialogs.rss.feed.url')" />
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" @click="save">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,211 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { ContentLayout } from '@/constants/qbit/AppPreferences'
import { useMaindataStore } from '@/stores/maindata'
import { useRssStore } from '@/stores/rss'
import { FeedRule } from '@/types/qbit/models'
import { computed, onBeforeMount, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
initialRule?: FeedRule
}>()
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const maindataStore = useMaindataStore()
const rssStore = useRssStore()
const form = ref<VForm>()
const isFormValid = ref(false)
const formData = reactive({
addPaused: null,
affectedFeeds: [] as string[],
assignedCategory: '',
enabled: true,
episodeFilter: '',
ignoreDays: 0,
lastMatch: '',
mustContain: '',
mustNotContain: '',
name: '',
savePath: '',
smartFilter: false,
torrentContentLayout: null,
useRegex: false
})
const lastSavedName = ref('')
const matchingArticles = ref<{ type: string; value?: string }[]>([])
const addPausedOptions = [
{ title: t('common.useGlobalSettings'), value: null },
{ title: t('constants.addPaused.always'), value: true },
{ title: t('constants.addPaused.never'), value: false }
]
const contentLayoutOptions = [
{ title: t('common.useGlobalSettings'), value: null },
{ title: t('constants.contentLayout.original'), value: ContentLayout.ORIGINAL },
{ title: t('constants.contentLayout.subfolder'), value: ContentLayout.SUBFOLDER },
{ title: t('constants.contentLayout.nosubfolder'), value: ContentLayout.NO_SUBFOLDER }
]
const categories = computed(() => {
return [{ title: t('common.none'), value: '' }, ...maindataStore.categories.map(category => ({ title: category.name, value: category.name }))]
})
const lastMatch = computed(() => {
if (formData.lastMatch === '') return t('dialogs.rss.rule.lastMatch.unknownValue').toString()
const delta = new Date().getTime() - new Date(formData.lastMatch).getTime()
return t('dialogs.rss.rule.lastMatch.knownValue', Math.floor(delta / (1000 * 60 * 60 * 24)).toString())
})
const hasInitialRule = computed(() => {
return !!(props.initialRule && props.initialRule.name)
})
async function updateArticles() {
if (lastSavedName.value === '') return
const formattedArticles = []
const articles = await rssStore.fetchMatchingArticles(lastSavedName.value)
for (const feedName in articles) {
const feedArticles = articles[feedName]
if (formattedArticles.length > 0) formattedArticles.push({ type: 'divider' })
formattedArticles.push({ type: 'subheader', value: feedName })
for (const i in feedArticles) {
const article = feedArticles[i]
formattedArticles.push({ type: 'item', value: article })
}
}
matchingArticles.value = formattedArticles
}
async function setRule() {
if (!isFormValid.value) return
if ((hasInitialRule.value || lastSavedName.value !== '') && lastSavedName.value !== formData.name) {
await rssStore.renameRule(lastSavedName.value, formData.name)
}
await rssStore.setRule(formData.name, formData)
lastSavedName.value = formData.name
await rssStore.fetchRules()
await updateArticles()
}
async function selectNone() {
formData.affectedFeeds = []
}
async function selectAll() {
formData.affectedFeeds = rssStore.feeds.map(feed => feed.url)
}
const close = () => {
isOpened.value = false
}
onBeforeMount(async () => {
await maindataStore.fetchCategories()
await rssStore.fetchRules()
if (hasInitialRule.value) {
lastSavedName.value = props.initialRule!.name!
Object.assign(formData, props.initialRule!)
} else {
form.value?.reset()
}
await updateArticles()
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>
<v-toolbar color="transparent" :title="$t(`dialogs.rss.rule.title.${initialRule ? 'edit' : 'create'}`)">
<v-btn icon="mdi-close" @click="close" />
</v-toolbar>
</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent>
<v-row>
<v-col cols="12" sm="6" class="scrollable-col">
<v-text-field v-model="formData.name" autofocus required :label="$t('dialogs.rss.rule.name')" />
<v-divider />
<v-checkbox v-model="formData.useRegex" hide-details :label="$t('dialogs.rss.rule.useRegex')" />
<v-text-field v-model="formData.mustContain" :label="$t('dialogs.rss.rule.mustContain')" />
<v-text-field v-model="formData.mustNotContain" :label="$t('dialogs.rss.rule.mustNotContain')" />
<v-checkbox v-model="formData.smartFilter" hide-details :label="$t('dialogs.rss.rule.smartFilter')" />
<v-text-field v-model="formData.episodeFilter" :placeholder="$t('dialogs.rss.rule.episodeFilterPlaceholder')" :label="$t('dialogs.rss.rule.episodeFilter')" />
<v-divider class="mb-4" />
<v-select v-model="formData.assignedCategory" :items="categories" :label="$t('dialogs.rss.rule.assignedCategory')" />
<v-text-field v-model="formData.savePath" :placeholder="$t('dialogs.rss.rule.savePathPlaceholder')" :label="$t('dialogs.rss.rule.savePath')" />
<v-text-field v-model="formData.ignoreDays" type="number" :hint="$t('dialogs.rss.rule.ignoreDaysHint')" :label="$t('dialogs.rss.rule.ignoreDays')" />
<v-text-field v-model="lastMatch" disabled :label="$t('dialogs.rss.rule.lastMatch.label')" />
<v-divider />
<v-select v-model="formData.addPaused" :items="addPausedOptions" :label="$t('constants.addPaused.title')" />
<v-select v-model="formData.torrentContentLayout" :items="contentLayoutOptions" :label="$t('constants.contentLayout.title')" />
<v-list-subheader>{{ $t('dialogs.rss.rule.affectedFeedsSubheader') }}</v-list-subheader>
<v-row>
<v-col cols="6" class="d-flex align-center justify-center">
<v-btn color="accent" @click="selectAll">{{ $t('common.selectAll') }}</v-btn>
</v-col>
<v-col cols="6" class="d-flex align-center justify-center">
<v-btn color="primary" @click="selectNone">{{ $t('common.selectNone') }}</v-btn>
</v-col>
</v-row>
<v-checkbox v-for="item in rssStore.feeds" v-model="formData.affectedFeeds" multiple hide-details :label="item.name" :value="item.url" />
</v-col>
<v-divider :vertical="!$vuetify.display.mobile" />
<v-col cols="12" sm="6" class="scrollable-col">
<div class="v-card-title pa-0">{{ $t('dialogs.rss.rule.matchingArticles.title') }}</div>
<v-list>
<template v-for="item in matchingArticles">
<v-divider v-if="item.type === 'divider'" />
<v-list-subheader inset v-else-if="item.type === 'subheader'">{{ item.value }}</v-list-subheader>
<v-list-item v-else class="mb-3">{{ item.value }}</v-list-item>
</template>
<v-list-item v-if="matchingArticles.length === 0" :title="$t('dialogs.rss.rule.matchingArticles.noMatch')" />
</v-list>
</v-col>
</v-row>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.close') }}</v-btn>
<v-btn color="accent" @click="setRule">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
.scrollable-col {
@media (min-width: 600px) {
max-height: calc(100vh - 200px);
}
@media (max-width: 599px) {
max-height: calc(60vh - 200px);
}
overflow-y: auto;
}
</style>

View file

@ -0,0 +1,68 @@
<script setup lang="ts">
import { useDialog } from '@/composables'
import { useMaindataStore } from '@/stores/maindata'
import { onBeforeMount, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { VForm } from 'vuetify/components'
const props = defineProps<{
guid: string
initialTag?: string
}>()
const { isOpened } = useDialog(props.guid)
const { t } = useI18n()
const maindataStore = useMaindataStore()
const form = ref<VForm>()
const isFormValid = ref(false)
const rules = ref([(v: string) => !!v || t('dialogs.tag.required'), (v: string) => !props.initialTag || (!!props.initialTag && !v.includes(',')) || t('dialogs.tag.comma')])
const tagName = ref('')
async function submit() {
if (!isFormValid.value) return
if (!!props.initialTag) {
await maindataStore.editTag(props.initialTag, tagName.value)
} else {
await maindataStore.createTags(tagName.value.split(','))
}
close()
}
const close = () => {
isOpened.value = false
}
onBeforeMount(() => {
tagName.value = props.initialTag || ''
})
</script>
<template>
<v-dialog v-model="isOpened">
<v-card>
<v-card-title>{{ $t(`dialogs.tag.title.${initialTag ? 'rename' : 'create'}`) }}</v-card-title>
<v-card-text>
<v-form v-model="isFormValid" ref="form" @submit.prevent @keydown.enter.prevent="submit">
<v-text-field v-if="initialTag" :model-value="initialTag" disabled :label="$t('dialogs.tag.oldName')" />
<v-text-field v-model="tagName" :rules="rules" autofocus :hint="$t('dialogs.tag.hint')" :label="$t('dialogs.tag.name')" />
<v-scroll-x-transition>
<div class="text-warning" v-if="!!initialTag && initialTag !== tagName">
<v-icon>mdi-alert</v-icon>
{{ $t('dialogs.tag.warnEdit') }}
</div>
</v-scroll-x-transition>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="error" @click="close">{{ $t('common.cancel') }}</v-btn>
<v-btn color="accent" :disabled="!isFormValid" @click="submit">{{ $t('common.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped></style>

View file

@ -0,0 +1,85 @@
<script lang="ts" setup>
import { useAuthStore } from '@/stores/auth'
import { useNavbarStore } from '@/stores/navbar'
import { useDropZone } from '@vueuse/core'
import { onMounted, onUnmounted, ref } from 'vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const authStore = useAuthStore()
const navbarStore = useNavbarStore()
const dndZoneRef = ref<HTMLDivElement>()
function onDragEnter() {
if (route.name === 'login' || !authStore.isAuthenticated) return
isOverDropZone.value = true
}
function onDrop(files: File[] | null, event: DragEvent) {
event.preventDefault()
event.stopPropagation()
if (!event.dataTransfer) return
// Handle .torrent files
const torrentFiles = (files || [])
.filter(file => file.type === 'application/x-bittorrent' || file.name.endsWith('.torrent'))
const links = event.dataTransfer.getData('text/plain').split('\n')
.filter(link => link.startsWith('magnet:') || link.startsWith('http'))
torrentFiles.forEach(navbarStore.pushTorrentToQueue)
links.forEach(navbarStore.pushTorrentToQueue)
}
const { isOverDropZone } = useDropZone(dndZoneRef, { onDrop })
onMounted(() => {
document.addEventListener('dragenter', onDragEnter)
})
onUnmounted(() => {
document.removeEventListener('dragenter', onDragEnter)
})
</script>
<template>
<v-scale-transition>
<div v-show="isOverDropZone" ref="dndZoneRef" class="dnd-zone-outer">
<div class="dnd-zone">
<div class="dnd-zone-content text-accent">
<v-icon size="75">mdi-cloud-upload</v-icon>
<span>{{ $t('dialogs.add.dropLabel') }}</span>
</div>
</div>
</div>
</v-scale-transition>
</template>
<style lang="scss" scoped>
.dnd-zone-outer {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.66);
z-index: 9999;
}
.dnd-zone {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.dnd-zone-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: calc(100% - 48px);
height: calc(100% - 48px);
border: 2px solid rgb(var(--v-theme-accent));
border-radius: 48px;
}
</style>

View file

@ -1,349 +0,0 @@
<template>
<v-dialog
v-model="dialog"
:transition="dTransition"
:content-class="phoneLayout ? 'rounded-0' : 'rounded-form'"
max-width="500px"
:fullscreen="phoneLayout"
persistent
@keydown.enter.prevent="submit"
>
<div
class="noselect"
style="position: fixed; left: 0; top: 0; width: 100%; height: 100%"
@drop.prevent="addDropFile"
@dragover.prevent="showWrapDrag = true"
@dragend.prevent="showWrapDrag = false"
@dragleave.prevent="DragLeave"
/>
<v-card :class="showWrapDrag ? 'wrap-drag' : ''" @drop.prevent="addDropFile" @dragover.prevent="showWrapDrag = true" @dragend.prevent="showWrapDrag = false">
<v-container :class="`pa-0 project done`">
<v-card-title class="justify-center">
<v-toolbar flat dense class="transparent">
<v-toolbar-title class="mx-auto">
<h2>{{ $t('modals.add.title') }}</h2>
</v-toolbar-title>
<v-btn fab small class="transparent elevation-0" @click="close">
<v-icon>{{ mdiClose }}</v-icon>
</v-btn>
</v-toolbar>
</v-card-title>
<v-card-text class="pb-0">
<v-form ref="form" v-model="valid">
<v-container>
<v-row no-gutters>
<v-col ref="fileZone">
<v-file-input
v-if="urls.length === 0"
v-model="files"
color="deep-purple accent-4"
counter
:label="$t('modals.add.selectFiles')"
multiple
:prepend-icon="mdiPaperclip"
:rules="fileInputRules"
outlined
:show-size="1000"
>
<template #selection="{ index, text }">
<v-chip v-if="index < 2" color="deep-purple accent-4" dark label small>
{{ text }}
</v-chip>
<span v-else-if="index === 2" class="overline grey--text text--darken-3 mx-2">
+{{ files.length - 2 }}
File(s)
</span>
</template>
</v-file-input>
<v-textarea
v-if="files.length === 0"
v-model="urls"
style="max-height: 200px; overflow-x: hidden; overflow-y: auto"
:label="$t('url')"
:prepend-icon="mdiLink"
rows="1"
required
:autofocus="!phoneLayout"
auto-grow
clearable
:hint="$t('modals.add.urlHint')"
@click:prepend="paste"
/>
</v-col>
</v-row>
<v-combobox v-model="tags" :items="availableTags" clearable :label="$t('tags')" :prepend-icon="mdiTag" multiple chips />
<v-combobox v-model="category" :items="availableCategories" clearable :label="$t('category')" item-text="name" :prepend-icon="mdiLabel" @input="categoryChanged" />
<v-text-field
v-model="directory"
:disabled="autoTMM"
:label="$t('modals.add.downloadDirectory')"
:prepend-icon="mdiFolder"
autocomplete="download-directory"
name="download-directory"
/>
<v-row>
<v-col cols="12" sm="6" class="pt-0 pb-3">
<div class="d-flex flex-column align-center">
<p class="subtitle-1 mb-1">{{ $t('enums.contentLayout.title') }}</p>
<v-select v-model="contentLayout" flat solo dense hide-details background-color="background" class="rounded-xl" :items="contentLayoutOptions" />
</div>
</v-col>
<v-col cols="12" sm="6" class="pt-0 pb-3">
<div class="d-flex flex-column align-center">
<p class="subtitle-1 mb-1">{{ $t('enums.stopCondition.title') }}</p>
<v-select v-model="stopCondition" flat solo dense hide-details background-color="background" class="rounded-xl" :items="stopConditionOptions" />
</div>
</v-col>
</v-row>
<v-row no-gutters>
<v-flex xs12 sm6>
<v-checkbox v-model="start" :label="$t('modals.add.starttorrent')" hide-details />
</v-flex>
<v-flex xs12 sm6>
<v-checkbox v-model="skip_checking" :label="$t('modals.add.skipHashCheck')" hide-details />
</v-flex>
<v-flex xs12 sm6>
<v-checkbox v-model="autoTMM" :label="$t('modals.add.automaticTorrentManagement')" hide-details />
</v-flex>
<v-flex xs12 sm6>
<v-checkbox v-model="sequentialDownload" :label="$t('rightClick.advanced.sequentialDownload')" hide-details />
</v-flex>
<v-flex xs12 sm6>
<v-checkbox v-model="firstLastPiecePrio" :label="$t('rightClick.advanced.firstLastPriority')" hide-details />
</v-flex>
</v-row>
</v-container>
</v-form>
</v-card-text>
<v-spacer />
<v-form>
<v-card-actions class="justify-center">
<v-btn text :disabled="!valid" class="accent white--text mx-0 mt-3" @click="submit"> Add Torrent </v-btn>
<v-fab-transition v-if="phoneLayout">
<v-btn color="red" dark absolute bottom right @click="close">
<v-icon>{{ mdiClose }}</v-icon>
</v-btn>
</v-fab-transition>
</v-card-actions>
</v-form>
</v-container>
</v-card>
<div
v-show="showWrapDrag"
class="wrap-drag noselect"
style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; text-align: center; background-color: rgb(0, 0, 0, 0.5)"
>
<div class="align white--text">
<div>
<v-icon size="40" class="white--text">
{{ mdiCloudUpload }}
</v-icon>
</div>
<div>
<h3>{{ $t('modals.add.dropHereForAdd') }}</h3>
</div>
</div>
</div>
</v-dialog>
</template>
<script>
import { mapGetters, mapState } from 'vuex'
import qbit from '@/services/qbit'
import { mdiCloudUpload, mdiFolder, mdiTag, mdiLabel, mdiPaperclip, mdiLink, mdiClose } from '@mdi/js'
import { FullScreenModal, Modal } from '@/mixins'
import { AppPreferences } from '@/enums/qbit'
export default {
name: 'AddModal',
mixins: [Modal, FullScreenModal],
props: ['initialMagnet', 'openSuddenly'],
data() {
return {
dTransition: 'scale-transition',
hndlDialog: true,
showWrapDrag: false,
files: [],
category: null,
tags: [],
directory: '',
start: true,
skip_checking: false,
contentLayout: 'Original',
contentLayoutOptions: [
{ text: this.$t('enums.contentLayout.original'), value: AppPreferences.ContentLayout.ORIGINAL },
{ text: this.$t('enums.contentLayout.subfolder'), value: AppPreferences.ContentLayout.SUBFOLDER },
{ text: this.$t('enums.contentLayout.nosubfolder'), value: AppPreferences.ContentLayout.NO_SUBFOLDER }
],
stopCondition: 'None',
stopConditionOptions: [
{ text: this.$t('enums.stopCondition.none'), value: AppPreferences.StopCondition.NONE },
{ text: this.$t('enums.stopCondition.metadataReceived'), value: AppPreferences.StopCondition.METADATA_RECEIVED },
{ text: this.$t('enums.stopCondition.filesChecked'), value: AppPreferences.StopCondition.FILES_CHECKED }
],
autoTMM: true,
sequentialDownload: false,
firstLastPiecePrio: false,
fileInputRules: [
v => {
const result = v.every(f => {
if (f.type) return f.type === 'application/x-bittorrent'
else return /^.*\.torrent$/.test(f.name)
})
return result ? result : this.$t('modals.add.oneOrMoreFilesInvalidTorrent')
}
],
loading: false,
urls: '',
valid: false,
mdiCloudUpload,
mdiFolder,
mdiTag,
mdiLabel,
mdiPaperclip,
mdiLink,
mdiClose
}
},
computed: {
...mapState(['settings']),
...mapGetters(['getCategories', 'getAvailableTags']),
phoneLayout() {
return this.$vuetify.breakpoint.xsOnly
},
savepath() {
let savePath = this.settings.save_path
if (this.category && this.category.savePath) {
savePath = this.category.savePath
}
return savePath
},
availableCategories() {
return this.getCategories()
},
availableTags() {
return this.getAvailableTags()
}
},
created() {
if (this.initialMagnet) this.urls = this.initialMagnet
this.setSettings()
if (this.openSuddenly === true) {
this.dTransition = 'none'
}
},
mounted() {
this.dTransition = 'scale-transition'
},
methods: {
async setSettings() {
await this.$store.dispatch('FETCH_SETTINGS')
await this.$store.commit('FETCH_CATEGORIES')
await this.$store.commit('FETCH_TAGS')
this.start = !this.settings.start_paused_enabled
this.autoTMM = this.settings.auto_tmm_enabled
this.directory = this.savepath
this.contentLayout = this.settings.torrent_content_layout
this.stopCondition = this.settings.torrent_stop_condition
},
addDropFile(e) {
this.showWrapDrag = false
if (this.urls.length === 0) this.files.push(...Array.from(e.dataTransfer.files))
},
startDropFile() {
this.showWrapDrag = true
},
DragLeave() {
this.showWrapDrag = false
},
closeWrap() {
if (this.showWrapDrag) this.showWrapDrag = false
else this.close()
},
async paste(e) {
if (navigator.clipboard && window.isSecureContext) {
this.urls = await navigator.clipboard.readText()
} else {
e.target.focus()
if (!document.execCommand('paste')) {
this.$toast.error(this.$t('toast.pasteNotSupported').toString())
return
}
}
this.$toast.success(this.$t('toast.pasteSuccess').toString())
},
async submit() {
if (this.files.length === 0 && this.urls.length === 0) return
const torrents = []
const params = {
urls: null,
paused: !this.start,
skip_checking: this.skip_checking,
autoTMM: this.autoTMM,
sequentialDownload: this.sequentialDownload,
firstLastPiecePrio: this.firstLastPiecePrio,
contentLayout: this.contentLayout,
stopCondition: this.stopCondition
}
if (this.files.length) torrents.push(...this.files)
if (this.urls) params.urls = this.urls
if (this.category) params.category = this.category.name
if (this.tags) params.tags = this.tags.join(',')
if (!this.autoTMM) params.savepath = this.directory
await qbit.addTorrents(params, torrents)
this.resetForm()
this.$store.commit('DELETE_MODAL', this.guid)
},
categoryChanged() {
this.directory = this.savepath
},
resetForm() {
this.url = ''
this.files = []
this.category = null
this.tags = []
this.directory = this.savepath
this.skip_checking = false
this.contentLayout = this.settings.torrent_content_layout
this.stopCondition = this.settings.torrent_stop_condition
},
close() {
this.dialog = false
}
}
}
</script>
<style lang="scss" scoped>
.wrap-drag {
pointer-events: none;
}
.wrap-drag .align {
margin: -0.5em 0 0;
position: absolute;
top: 50%;
left: 0;
right: 0;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
color: #fff;
padding: 0;
}
.flex-gap {
column-gap: 8px;
}
</style>

View file

@ -1,90 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable :width="dialogWidth" :fullscreen="isPhone" @input="close">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.changeLocation.title') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col>
<v-list flat class="mb-4">
<v-list-item v-for="t in torrents" :key="t.hash" else>
<v-list-item-content>
<v-list-item-title class="text-wrap">
{{ t.name }}
</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
<v-text-field v-model="newPath" :label="$t('directory')" :prepend-icon="mdiFolder" autofocus @keydown.enter="setLocation" />
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="setLocation">
{{ $t('save') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters, mapState } from 'vuex'
import { mdiClose, mdiFile, mdiFolder } from '@mdi/js'
import { FullScreenModal, Modal } from '@/mixins'
import qbit from '@/services/qbit'
export default defineComponent({
name: 'ChangeLocationModal',
mixins: [Modal, FullScreenModal],
props: {
hashes: Array<string>
},
data() {
return {
newPath: '',
mdiFile,
mdiFolder,
mdiClose
}
},
computed: {
...mapState(['selectMode']),
...mapGetters(['getTorrent', 'getSettings']),
dialogWidth() {
return this.phoneLayout ? '100%' : '750px'
},
torrents() {
return [...this.hashes.map(hash => this.getTorrent(hash))]
},
isPhone() {
return this.$vuetify.breakpoint.xsOnly
}
},
created() {
this.newPath = this.torrents[0].savePath
},
methods: {
async setLocation() {
await qbit.setTorrentLocation(this.hashes, this.newPath)
this.close()
},
close() {
this.dialog = false
if (!this.selectMode) {
this.$store.commit('RESET_SELECTED')
}
}
}
})
</script>

View file

@ -1,78 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable content-class="rounded-form" max-width="600px" @input="close">
<v-card class="pa-2">
<v-card-title class="pa-0">
<v-toolbar-title class="mx-4 mt-2">
<h3>{{ $t('confirm') | titleCase }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text class="px-6p py-2 mb-2">
<v-list flat class="mb-4">
<v-list-item v-for="t in torrents" :key="t.hash" else>
<v-list-item-content>
<v-list-item-title class="text-wrap" v-text="t.name" />
</v-list-item-content>
</v-list-item>
</v-list>
<v-checkbox v-model="settings.deleteWithFiles" class="ma-0 pa-0" :label="$t('modals.delete.check')" hide-details />
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="white--text elevation-0 px-4" :class="settings.deleteWithFiles ? 'error' : 'info'" @click="deleteTorrent()">
{{ $t('delete') }}
</v-btn>
<v-spacer />
<v-btn class="grey white--text elevation-0 px-4" @click="close()">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters, mapState } from 'vuex'
import qbit from '@/services/qbit'
import { FullScreenModal, Modal } from '@/mixins'
import { Torrent } from '@/models'
import WebUISettings from '@/types/vuetorrent/WebUISettings'
export default defineComponent({
name: 'ConfirmDeleteModal',
props: {
hashes: Array<string>
},
mixins: [Modal, FullScreenModal],
computed: {
...mapState(['selectMode']),
...mapGetters(['getTorrents', 'getWebuiSettings']),
selection(): string[] {
return this.hashes ?? []
},
torrents(): Torrent[] {
return (this.getTorrents() as Torrent[]).filter(t => this.selection.includes(t.hash))
},
settings(): WebUISettings {
return this.getWebuiSettings()
}
},
methods: {
close() {
this.dialog = false
if (!this.selectMode) {
this.$store.commit('RESET_SELECTED')
}
},
async deleteTorrent() {
await qbit.deleteTorrents(this.selection, this.settings.deleteWithFiles)
this.$store.commit('RESET_SELECTED')
this.close()
if (this.$route.name === 'torrentDetail') {
this.$router.push({ name: 'dashboard' })
}
}
}
})
</script>

View file

@ -1,58 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable max-width="750px" :content-class="phoneLayout ? 'rounded-0' : 'rounded-form'" :fullscreen="false">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.shutdown.title') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col>
<span>{{ $t('modals.shutdown.content') }}</span>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-spacer />
<v-btn class="accent white--text elevation-0 px-4" @click="shutdownApplication">
{{ $t('yes') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close">
{{ $t('no') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import Modal from '../../mixins/Modal'
import { FullScreenModal } from '@/mixins'
import qbit from '@/services/qbit'
export default defineComponent({
name: 'ConfirmShutdownModal',
mixins: [Modal, FullScreenModal],
methods: {
close() {
this.dialog = false
},
async shutdownApplication() {
if (!(await qbit.shutdownApp())) {
this.$toast.error(this.$t('toast.shutdownError').toString())
} else {
this.$store.state.authenticated = false
await this.$router.push({ name: 'login' })
this.$toast.success(this.$t('toast.shutdownSuccess').toString())
}
this.close()
}
}
})
</script>

View file

@ -1,91 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable max-width="750px" :content-class="phoneLayout ? 'rounded-0' : 'rounded-form'" :fullscreen="phoneLayout" @keydown.enter.prevent="rename">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.rename.title') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-list-item>
<v-list-item-content>
<v-list-item-title class="caption">{{ $t('modals.rename.oldPath') }}</v-list-item-title>
<v-list-item-subtitle>{{ oldName }}</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-text-field v-model="newName" id="newPathInput" :label="$t('modals.rename.newPath')" autofocus :prepend-inner-icon="mdiFile" />
</v-list-item>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="rename">
{{ $t('save') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import Modal from '@/mixins/Modal'
import { mdiFile } from '@mdi/js'
import { FullScreenModal } from '@/mixins'
import qbit from '@/services/qbit'
import { defineComponent } from 'vue'
export default defineComponent({
name: 'RenameTorrentFileModal',
mixins: [Modal, FullScreenModal],
props: {
hash: String,
isFolder: Boolean,
oldName: String
},
data() {
return {
newName: '',
mdiFile
}
},
computed: {
torrentHash() {
return this.hash as string
}
},
created() {
this.newName = this.oldName as string
},
mounted() {
const input = document.getElementById('newPathInput') as HTMLInputElement
const startIndex = this.newName.lastIndexOf('/')
const endIndex = this.newName.lastIndexOf('.')
if (input) {
input.setSelectionRange(startIndex + 1, endIndex == -1 ? this.newName.length : endIndex)
}
},
methods: {
async rename() {
let result: Promise<void>
if (this.isFolder) {
result = qbit.renameFolder(this.torrentHash, this.oldName as string, this.newName)
} else {
result = qbit.renameFile(this.torrentHash, this.oldName as string, this.newName)
}
result.then(
() => this.close(),
() => this.$toast.error(this.$t('modals.rename.errorConflict'))
)
},
close() {
this.dialog = false
}
}
})
</script>

View file

@ -1,89 +0,0 @@
<template>
<v-dialog
v-model="dialog"
scrollable
max-width="750px"
:content-class="phoneLayout ? 'rounded-0' : 'rounded-form'"
:fullscreen="phoneLayout"
@keydown.enter.prevent="rename"
@keydown.esc.prevent="close"
@input="close"
>
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.rename.title') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col>
<v-text-field v-model="name" id="torrentNameInput" clearable :label="$t('modals.rename.torrentName')" autofocus :prepend-inner-icon="mdiFile" />
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="rename">
{{ $t('save') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { mapGetters, mapState } from 'vuex'
import Modal from '@/mixins/Modal'
import { mdiFile } from '@mdi/js'
import { FullScreenModal } from '@/mixins'
import qbit from '@/services/qbit'
import { defineComponent } from 'vue'
export default defineComponent({
name: 'RenameTorrentModal',
mixins: [Modal, FullScreenModal],
props: {
hash: String
},
data() {
return {
name: '',
mdiFile
}
},
computed: {
...mapState(['selectMode']),
...mapGetters(['getTorrent']),
torrent() {
return this.getTorrent(this.hash)
}
},
created() {
this.name = this.torrent.name
},
mounted() {
const input = document.getElementById('torrentNameInput') as HTMLInputElement
if (input) {
input.select()
}
},
methods: {
async rename() {
await qbit.setTorrentName(this.hash as string, this.name)
this.close()
},
close() {
this.dialog = false
if (!this.selectMode) {
this.$store.commit('RESET_SELECTED')
}
}
}
})
</script>

View file

@ -1,82 +0,0 @@
<template>
<v-dialog v-model="dialog" content-class="rounded-form" max-width="300px" @keydown.enter.prevent="submit">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ hasInitialFeed ? $t('edit') : $t('createNew') }} {{ $t('feed') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-form ref="feedForm" class="px-6 mt-3">
<v-container v-if="!hasInitialFeed">
<v-text-field v-model="feed.url" :rules="rules" :label="$t('modals.newFeed.url')" autofocus required />
</v-container>
<v-container>
<v-text-field v-model="feed.name" :rules="rules" :label="$t('modals.newFeed.feedName')" autofocus required />
</v-container>
</v-form>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="submit">
{{ $t(hasInitialFeed ? 'edit' : 'create') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="cancel">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import qbit from '@/services/qbit'
import { Modal } from '@/mixins'
import { mdiCancel, mdiPencil, mdiTagPlus } from '@mdi/js'
import { defineComponent } from 'vue'
export default defineComponent({
name: 'FeedForm',
mixins: [Modal],
props: {
initialFeed: Object
},
data: () => ({
feed: { url: '', name: '' },
rules: [(v: string) => !!v || 'Required'],
mdiCancel,
mdiTagPlus,
mdiPencil
}),
computed: {
hasInitialFeed() {
return !!(this.initialFeed && this.initialFeed.name && this.initialFeed.url)
}
},
created() {
if (this.hasInitialFeed) {
this.feed = { ...this.initialFeed }
}
},
methods: {
cancel() {
this.$store.commit('FETCH_FEEDS')
this.dialog = false
},
async create() {
await qbit.createFeed(this.feed)
this.cancel()
},
async edit() {
await qbit.editFeed(this.initialFeed.name, this.feed.name)
this.$toast.success(this.$t('toast.feedSaved'))
this.cancel()
},
async submit() {
if (this.feed.name === '' || this.feed.url === '') return
if (this.hasInitialFeed) await this.edit()
else await this.create()
}
}
})
</script>

View file

@ -1,229 +0,0 @@
<template>
<v-dialog v-model="dialog" max-width="1000px" @keydown.enter.prevent="setRule">
<v-card flat :loading="loading">
<v-container class="pa-0 project done">
<v-card-title class="justify-center">
<v-toolbar flat dense class="transparent">
<v-toolbar-title class="mx-auto">
<h2>{{ this.lastSavedName !== '' ? $t('modals.newRule.titleEdit') : $t('modals.newRule.titleCreate') }}</h2>
</v-toolbar-title>
<v-btn fab small class="transparent elevation-0" @click="close">
<v-icon>{{ mdiClose }}</v-icon>
</v-btn>
</v-toolbar>
</v-card-title>
<v-card-text class="pb-0">
<v-row>
<v-col cols="12" sm="6">
<v-form ref="form">
<v-container>
<v-text-field v-model="rule.name" :label="$t('modals.newRule.name')" autofocus required />
<v-divider />
<v-checkbox hide-details v-model="rule.useRegex" :label="$t('modals.newRule.def.useRegex')" />
<v-text-field hide-details v-model="rule.mustContain" :label="$t('modals.newRule.def.mustContain')" />
<v-text-field hide-details v-model="rule.mustNotContain" :label="$t('modals.newRule.def.mustNotContain')" />
<v-checkbox hide-details v-model="rule.smartFilter" :label="$t('modals.newRule.def.smartFilter')" />
<v-text-field v-model="rule.episodeFilter" :label="$t('modals.newRule.def.episodeFilter')" />
<v-divider />
<v-row>
<p class="subtitle-1 mb-1">{{ $t('modals.newRule.def.assignedCategory') }}</p>
<v-select flat solo dense hide-details background-color="background" class="rounded-xl" v-model="rule.assignedCategory" :items="availableCategories" />
</v-row>
<v-text-field hide-details v-model="rule.savePath" :label="$t('modals.newRule.def.savePath')" />
<v-text-field hide-details v-model="rule.ignoreDays" :label="$t('modals.newRule.def.ignoreDays')" required type="number" min="0" />
<v-text-field disabled :value="lastMatch" :label="$t('modals.newRule.def.lastMatch.title')" />
<v-divider />
<v-row class="my-2 flex-gap">
<v-col>
<div class="d-flex flex-column align-center">
<p class="subtitle-1 mb-1">{{ $t('modals.newRule.def.addPaused.title') }}</p>
<v-select v-model="rule.addPaused" flat solo dense hide-details background-color="background" class="rounded-xl" :items="addPausedOptions" />
</div>
</v-col>
<v-col>
<div class="d-flex flex-column align-center">
<p class="subtitle-1 mb-1">{{ $t('enums.contentLayout.title') }}</p>
<v-select v-model="rule.torrentContentLayout" flat solo dense hide-details background-color="background" class="rounded-xl" :items="contentLayoutOptions" />
</div>
</v-col>
</v-row>
<v-subheader class="pa-0">
{{ $t('modals.newRule.def.affectedFeeds') }}
</v-subheader>
<v-row>
<v-col cols="6" class="d-flex align-center justify-center">
<v-btn color="accent" @click="selectAll">{{ $t('selectAll') }}</v-btn>
</v-col>
<v-col cols="6" class="d-flex align-center justify-center">
<v-btn color="primary" @click="selectNone">{{ $t('selectNone') }}</v-btn>
</v-col>
</v-row>
<v-checkbox v-for="(item, index) in availableFeeds" :key="index" v-model="rule.affectedFeeds" hide-details :label="item.name" :value="item.url" />
</v-container>
</v-form>
</v-col>
<v-col v-if="$vuetify.breakpoint.smAndUp" cols="6">
<h2>{{ $t('modals.matchingArticles.title') }}</h2>
<v-list subheader>
<template v-for="item in matchingArticles">
<v-divider :key="item.value" v-if="item.type === 'divider'" />
<v-subheader inset v-else-if="item.type === 'subheader'">{{ item.value }}</v-subheader>
<v-list-item v-else class="mb-3">{{ item.value }}</v-list-item>
</template>
</v-list>
</v-col>
</v-row>
<v-btn fab color="accent" fixed right bottom @click="setRule">
<v-icon>{{ mdiContentSave }}</v-icon>
</v-btn>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="setRule">
{{ $t('save') }}
</v-btn>
<v-btn color="primary" class="white--text elevation-0 px-4" @click="close">
{{ $t('close') }}
</v-btn>
</v-card-actions>
</v-container>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters } from 'vuex'
import qbit from '@/services/qbit'
import { Modal } from '@/mixins'
import { mdiClose, mdiContentSave } from '@mdi/js'
import i18n from '@/plugins/i18n'
import { AppPreferences } from '@/enums/qbit'
import { Category, Feed } from '@/types/vuetorrent'
type FormattedArticle = { type: string; value?: string }
export default defineComponent({
name: 'RuleForm',
mixins: [Modal],
props: ['initialRule'],
data: () => ({
rule: {
addPaused: null,
affectedFeeds: [],
assignedCategory: '',
enabled: true,
episodeFilter: '',
ignoreDays: 0,
lastMatch: '',
mustContain: '',
mustNotContain: '',
name: '',
savePath: '',
smartFilter: false,
torrentContentLayout: null,
useRegex: false
},
addPausedOptions: [
{ text: i18n.t('useGlobalSettings'), value: null },
{ text: i18n.t('modals.newRule.def.addPaused.always'), value: true },
{ text: i18n.t('modals.newRule.def.addPaused.never'), value: false }
],
contentLayoutOptions: [
{ text: i18n.t('useGlobalSettings'), value: null },
{ text: i18n.t('enums.contentLayout.original'), value: AppPreferences.ContentLayout.ORIGINAL },
{ text: i18n.t('enums.contentLayout.subfolder'), value: AppPreferences.ContentLayout.SUBFOLDER },
{ text: i18n.t('enums.contentLayout.nosubfolder'), value: AppPreferences.ContentLayout.NO_SUBFOLDER }
],
loading: false,
matchingArticles: [] as FormattedArticle[],
lastSavedName: '',
mdiClose,
mdiContentSave
}),
computed: {
...mapGetters(['getFeeds', 'getCategories']),
lastMatch() {
if (this.rule.lastMatch === '') return i18n.t('modals.newRule.def.lastMatch.unknownValue').toString()
const delta = new Date().getTime() - new Date(this.rule.lastMatch).getTime()
return i18n
.t('modals.newRule.def.lastMatch.knownValue')
.toString()
.replace('%1', Math.floor(delta / (1000 * 60 * 60 * 24)).toString())
},
availableFeeds() {
// @ts-expect-error: TS2349: This expression is not callable. Type 'never' has no call signatures.
return this.getFeeds()
},
availableCategories() {
// @ts-expect-error: TS2349: This expression is not callable. Type 'never' has no call signatures.
return this.getCategories().map((c: Category) => c.name)
},
hasInitialRule() {
return !!(this.initialRule && this.initialRule.name)
}
},
created() {
this.$store.commit('FETCH_RULES')
if (this.hasInitialRule) {
this.rule = { ...this.initialRule }
this.lastSavedName = this.initialRule.name
}
},
mounted() {
this.updateArticles()
},
methods: {
async setRule() {
if ((this.hasInitialRule || this.lastSavedName !== '') && this.lastSavedName !== this.rule.name) {
await qbit.renameRule(this.lastSavedName, this.rule.name)
}
await qbit.setRule(this.rule)
this.lastSavedName = this.rule.name
this.$store.commit('FETCH_RULES')
await this.updateArticles()
},
async updateArticles() {
if (this.lastSavedName === '') return
this.loading = true
const formattedArticles = []
const articles = await qbit.getMatchingArticles(this.lastSavedName)
for (const feedName in articles) {
const feedArticles = articles[feedName]
if (formattedArticles.length > 0) formattedArticles.push({ type: 'divider' })
formattedArticles.push({ type: 'subheader', value: feedName })
for (const i in feedArticles) {
const article = feedArticles[i]
formattedArticles.push({ type: 'item', value: article })
}
}
this.matchingArticles = formattedArticles
this.loading = false
},
selectNone() {
this.rule.affectedFeeds = []
},
selectAll() {
this.rule.affectedFeeds = this.availableFeeds.map((feed: Feed) => feed.url)
},
close() {
this.dialog = false
}
}
})
</script>

View file

@ -1,4 +0,0 @@
import FeedForm from './FeedForm.vue'
import RuleForm from './RuleForm.vue'
export { FeedForm, RuleForm }

View file

@ -1,163 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable :width="dialogWidth" :fullscreen="phoneLayout" @keydown.esc.prevent="close">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.searchPluginManager.title') }}</h3>
</v-toolbar-title>
<v-spacer />
<v-dialog v-model="installDialog" max-width="500px">
<template v-slot:activator="{ on, attrs }">
<v-btn class="primary white--text elevation-0 px-4 ma-4" v-on="on">Install</v-btn>
</template>
<v-card>
<v-card-title>
<h5>{{ $t('modals.searchPluginManager.install.title') }}</h5>
</v-card-title>
<v-card-text>
<v-text-field v-model="installInput" :label="$t('modals.searchPluginManager.install.label')" autofocus required />
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn color="accent darken-1" text @click="closeInstallDialog">{{ $t('cancel') }}</v-btn>
<v-btn color="accent darken-1" text @click="installNewPlugin">{{ $t('ok') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card-title>
<v-card-text>
<v-data-table
style="width: 100%"
v-model="enabledPlugins"
item-key="name"
:headers="headers"
:items="searchPlugins"
disable-pagination
hide-default-footer
show-select
sort-by="name"
:loading="loading"
@item-selected="onTogglePlugin"
@toggle-select-all="onToggleAllPlugins"
>
<template v-slot:item.actions="{ item }">
<v-icon color="red" small @click="uninstallPlugin(item)">
{{ mdiDelete }}
</v-icon>
</template>
</v-data-table>
</v-card-text>
<v-divider />
<v-card-actions>
<v-spacer />
<v-btn class="white--text elevation-0 px-4" @click="checkForPluginUpdates">
{{ $t('modals.searchPluginManager.checkForUpdates') }}
</v-btn>
<v-btn class="accent white--text elevation-0 px-4" @click="close">
{{ $t('close') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { FullScreenModal, Modal } from '@/mixins'
import { mapState } from 'vuex'
import { SearchPlugin } from '@/types/qbit/models'
import qbit from '@/services/qbit'
import { mdiDelete } from '@mdi/js'
export default defineComponent({
name: 'SearchPluginManager',
mixins: [Modal, FullScreenModal],
data() {
return {
headers: [
{ text: 'Name', value: 'fullName' },
{ text: 'Version', value: 'version' },
{ text: 'URL', value: 'url' },
{ text: 'Actions', value: 'actions' }
],
enabledPlugins: [],
loading: false,
installDialog: false,
installInput: '',
mdiDelete
}
},
computed: {
...mapState(['searchPlugins'])
},
mounted() {
this.loading = true
this.updatePluginList()
this.loading = false
},
methods: {
async updatePluginList() {
await this.$store.dispatch('FETCH_SEARCH_PLUGINS')
this.enabledPlugins = this.searchPlugins.filter((plugin: SearchPlugin) => plugin.enabled)
},
async onTogglePlugin(payload: { item: SearchPlugin; value: boolean }) {
this.loading = true
await qbit.enableSearchPlugin([payload.item.name], payload.value)
this.loading = false
},
async onToggleAllPlugins(payload: { items: SearchPlugin[]; value: boolean }) {
this.loading = true
await qbit.enableSearchPlugin(
payload.items.map(plugin => plugin.name),
payload.value
)
this.loading = false
},
async installNewPlugin() {
this.loading = true
this.closeInstallDialog()
await qbit.installSearchPlugin([this.installInput])
this.installInput = ''
await this.updatePluginList()
this.loading = false
},
async checkForPluginUpdates() {
this.loading = true
await qbit.updateSearchPlugins()
await this.updatePluginList()
this.loading = false
},
async uninstallPlugin(plugin: SearchPlugin) {
this.loading = true
await qbit.uninstallSearchPlugin([plugin.name])
await this.updatePluginList()
this.loading = false
},
close() {
this.dialog = false
},
closeInstallDialog() {
this.installDialog = false
}
}
})
</script>

View file

@ -1,67 +0,0 @@
<template>
<div style="min-width: 300px">
<h3>{{ title }}</h3>
<v-list-item>
<v-row dense>
<v-col>
<v-switch v-model="global" class="v-input--reverse pa-0 ma-0" hide-details inset :label="$t('modals.shareLimit.input.globalLimit')" @change="disableUnlimited" />
</v-col>
</v-row>
</v-list-item>
<v-list-item>
<v-row dense>
<v-col>
<v-switch v-model="unlimited" class="v-input--reverse pa-0 ma-0" hide-details inset :label="$t('modals.shareLimit.input.unlimited')" @change="disabledGlobal" />
</v-col>
</v-row>
</v-list-item>
<v-list-item class="mx-2">
<v-text-field v-model="limit" type="number" autofocus clearable dense :label="`${title} Limit`" :prepend-inner-icon="title === 'Ratio' ? mdiPercent : mdiClockTimeEight" />
</v-list-item>
</div>
</template>
<script>
import { mdiPercent, mdiClose, mdiClockTimeEight } from '@mdi/js'
export default {
name: 'ShareLimitInput',
props: ['title', 'initialLimit'],
data() {
return {
mdiPercent,
mdiClose,
mdiClockTimeEight,
global: false,
unlimited: false,
limit: ''
}
},
created() {
if (this.initialLimit === -2) {
this.global = true
return
}
if (this.initialLimit === -1) {
this.unlimited = true
return
}
this.limit = this.initialLimit
},
methods: {
disableUnlimited() {
this.unlimited = false
},
disabledGlobal() {
this.global = false
},
export() {
if (this.global) return -2
if (this.unlimited) return -1
return this.limit
}
}
}
</script>

View file

@ -1,66 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable content-class="rounded-form" max-width="500px" :fullscreen="isPhone">
<v-card class="px-2">
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.shareLimit.limitRatio') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text class="px-4 py-2">
<ShareLimitInput ref="ratio" :title="$t('modals.shareLimit.titleRatio')" :initial-limit="torrent.ratio_limit" />
<ShareLimitInput ref="time" :title="$t('modals.shareLimit.titleDuration')" :initial-limit="torrent.ratio_time_limit" class="mt-2" />
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="save">
{{ $t('save') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import ShareLimitInput from './ShareLimitInput.vue'
import { Modal, FullScreenModal } from '@/mixins'
import qbit from '@/services/qbit'
export default {
name: 'ShareLimitModal',
components: { ShareLimitInput },
mixins: [Modal, FullScreenModal],
props: {
mode: String,
hash: String
},
computed: {
...mapGetters(['getTorrent']),
torrent() {
return this.getTorrent(this.hash)
},
isPhone() {
return this.$vuetify.breakpoint.xsOnly
}
},
methods: {
async save() {
await qbit.setShareLimit([this.hash], this.$refs.ratio.export(), this.$refs.time.export())
this.close()
},
close() {
this.dialog = false
}
}
}
</script>
<style lang="scss" scoped>
// Reversed input variant
:deep(.v-input--reverse .v-input__slot) {
@import '../../../styles/styles';
@include reverse-switch;
}
</style>

View file

@ -1,123 +0,0 @@
<template>
<v-dialog v-model="dialog" scrollable content-class="rounded-form" max-width="500px" :fullscreen="isPhone">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>Limit {{ mode | titleCase }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col>
<v-text-field
v-model="limit"
autofocus
clearable
:label="$t('modals.speedLimit.speedLimit')"
:prepend-inner-icon="mdiSpeedometer"
suffix="KB/s"
@focus="$event.target.select()"
@keydown.enter="setLimit"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="setLimit"> Save </v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="close"> Cancel </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import { mdiSpeedometer, mdiClose } from '@mdi/js'
import { Modal, FullScreenModal } from '@/mixins'
import qbit from '@/services/qbit'
export default {
name: 'SpeedLimitModal',
mixins: [Modal, FullScreenModal],
props: {
mode: String,
hash: String
},
data() {
return {
limit: '',
mdiSpeedometer,
mdiClose
}
},
computed: {
...mapGetters(['getTorrent']),
torrent() {
return this.getTorrent(this.hash)
},
isPhone() {
return this.$vuetify.breakpoint.xsOnly
}
},
async created() {
switch (this.mode) {
case 'download':
if (this.isGlobal()) {
const limit = await qbit.getGlobalDownloadLimit()
this.limit = this.formatLimit(limit)
} else {
this.limit = this.formatLimit(this.torrent?.dl_limit)
}
break
case 'upload':
if (this.isGlobal()) {
const limit = await qbit.getGlobalUploadLimit()
this.limit = this.formatLimit(limit)
} else {
this.limit = this.formatLimit(this.torrent?.up_limit)
}
break
default:
break
}
},
methods: {
async setLimit() {
switch (this.mode) {
case 'download':
if (this.isGlobal()) {
await qbit.setGlobalDownloadLimit(this.exportLimit())
} else {
await qbit.setDownloadLimit([this.hash], this.exportLimit())
}
break
case 'upload':
if (this.isGlobal()) {
await qbit.setGlobalUploadLimit(this.exportLimit())
} else {
await qbit.setUploadLimit([this.hash], this.exportLimit())
}
break
default:
break
}
this.close()
},
isGlobal() {
return !this.torrent
},
formatLimit(limit) {
return limit > 0 ? limit / 1024 : '∞'
},
exportLimit() {
return this.limit > 0 ? this.limit * 1024 : NaN
},
close() {
this.dialog = false
}
}
}
</script>

View file

@ -1,100 +0,0 @@
<template>
<v-dialog v-model="dialog" content-class="rounded-form" max-width="300px" @keydown.enter.prevent="submit">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ hasInitialCategory ? $t('edit') : $t('createNew') }} {{ $t('category') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-container>
<v-text-field
v-model="category.name"
:rules="nameRules"
:label="$t('modals.newCategory.categoryName')"
required
:autofocus="!hasInitialCategory"
:disabled="hasInitialCategory"
/>
<v-text-field v-model="category.savePath" :label="$t('path')" :autofocus="hasInitialCategory" />
</v-container>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn v-if="!hasInitialCategory" class="accent white--text elevation-0 px-4" :disabled="!isValid" @click="create">
{{ $t('create') }}
</v-btn>
<v-btn v-else class="accent white--text elevation-0 px-4" :disabled="!isValid" @click="edit">
{{ $t('edit') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="cancel">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import qbit from '@/services/qbit'
import { Modal } from '@/mixins'
import { mdiCancel, mdiPencil, mdiTagPlus } from '@mdi/js'
import Vue from 'vue'
export default {
name: 'CreateNewCategoryDialog',
mixins: [Modal],
props: {
initialCategory: Object
},
data: () => ({
category: { name: '', savePath: '' },
mdiCancel,
mdiTagPlus,
mdiPencil
}),
computed: {
...mapGetters(['getSelectedCategory']),
hasInitialCategory() {
return !!(this.initialCategory && this.initialCategory.name)
},
nameRules() {
return [v => !!v || this.$t('modals.newCategory.tipOnNoName')]
},
isValid() {
return !!this.category.name
}
},
created() {
this.$store.commit('FETCH_CATEGORIES')
if (this.hasInitialCategory) {
this.category = this.initialCategory
}
},
methods: {
async submit() {
if (this.hasInitialCategory) {
await this.edit()
} else {
await this.create()
}
},
async create() {
if (!this.isValid) return
await qbit.createCategory(this.category)
this.cancel()
},
async edit() {
if (!this.isValid) return
await qbit.editCategory(this.category)
Vue.$toast.success(this.$t('toast.categorySaved'))
this.cancel()
},
cancel() {
this.$store.commit('FETCH_CATEGORIES')
this.dialog = false
}
}
}
</script>

View file

@ -1,65 +0,0 @@
<template>
<v-dialog v-model="dialog" content-class="rounded-form" max-width="300px" @keydown.enter.prevent="create">
<v-card>
<v-card-title class="pa-0">
<v-toolbar-title class="ma-4 primarytext--text">
<h3>{{ $t('modals.newTag.createNewTag') }}</h3>
</v-toolbar-title>
</v-card-title>
<v-card-text>
<v-container>
<v-text-field v-model="tagname" :rules="rules" :label="$t('modals.newTag.tagName')" autofocus required />
</v-container>
</v-card-text>
<v-divider />
<v-card-actions class="justify-end">
<v-btn class="accent white--text elevation-0 px-4" @click="create" :disabled="!isValid">
{{ $t('create') }}
</v-btn>
<v-btn class="error white--text elevation-0 px-4" @click="cancel">
{{ $t('cancel') }}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters } from 'vuex'
import qbit from '@/services/qbit'
import { Modal } from '@/mixins'
export default defineComponent({
name: 'CreateNewTagDialog',
mixins: [Modal],
data() {
return {
tagname: '',
tags: [] as string[],
rules: [(v: string) => !!v || 'Tag is required', (v: string) => this.tags.indexOf(v) === -1 || 'Tag already exists']
}
},
computed: {
...mapGetters(['getAvailableTags']),
isValid() {
return !!this.tagname && this.tags.indexOf(this.tagname) === -1
}
},
async mounted() {
await this.$store.commit('FETCH_TAGS')
Object.assign(this.tags, this.getAvailableTags())
},
methods: {
async create() {
if (!this.isValid) return
await qbit.createTag([this.tagname])
this.cancel()
},
cancel() {
this.$store.commit('FETCH_TAGS')
this.dialog = false
}
}
})
</script>

View file

@ -1,4 +0,0 @@
import CreateNewTagDialog from './CreateNewTagDialog.vue'
import CreateNewCategoryDialog from './CreateNewCategoryDialog.vue'
export { CreateNewTagDialog, CreateNewCategoryDialog }

View file

@ -1,35 +0,0 @@
<template>
<v-tooltip top>
<template #activator="{ on }">
<div class="d-flex justify-center fill-height">
<v-icon class="white--text" v-on="on">
{{ currentIcon }}
</v-icon>
</div>
</template>
<span>{{ (status || $t('unknown')) | titleCase }}</span>
</v-tooltip>
</template>
<script>
import { mdiCheckNetwork, mdiNetworkOff, mdiCloseNetwork, mdiHelpNetwork } from '@mdi/js'
export default {
props: ['status'],
computed: {
currentIcon() {
const icons = {
connected: mdiCheckNetwork,
disconnected: mdiNetworkOff,
firewalled: mdiCloseNetwork
}
const icon = icons?.[this.status]
if (!this.status || !icon) return mdiHelpNetwork
return icon
}
}
}
</script>

View file

@ -1,31 +0,0 @@
<template>
<div v-if="status">
<div class="text-uppercase white--text caption ml-4 font-weight-medium">
{{ $t('navbar.currentSpeed') }}
</div>
<v-row dense class="mx-1 pt-1">
<v-col>
<SpeedCard :icon="mdiChevronDown" color="download" :value="status.dlspeed" />
</v-col>
<v-col>
<SpeedCard :icon="mdiChevronUp" color="upload" :value="status.upspeed" />
</v-col>
</v-row>
</div>
</template>
<script>
import { mdiChevronUp, mdiChevronDown } from '@mdi/js'
import SpeedCard from '@/components/Core/SpeedCard.vue'
export default {
name: 'CurrentSpeed',
components: {
SpeedCard
},
props: ['status'],
data: () => ({
mdiChevronUp,
mdiChevronDown
})
}
</script>

View file

@ -1,218 +0,0 @@
<template>
<div class="mt-1">
<div id="status_filter">
<label class="white--text text-uppercase font-weight-medium caption ml-4">
{{ $t('status') }}
</label>
<v-select
name="state_filter"
aria-label="state_filter"
:value="selectedState"
class="ml-2 mr-2"
:label="$t('status')"
flat
solo
:items="options"
item-text="name"
color="download"
item-color="download"
background-color="secondary"
@input="setState"
/>
</div>
<div id="category_filter">
<label class="white--text text-uppercase font-weight-medium caption ml-4">
{{ $t('category') }}
</label>
<v-select
aria-label="category_filter"
:value="selectedCategory"
flat
solo
class="ml-2 mr-2"
:label="$t('category')"
:items="availableCategories"
item-text="name"
color="download"
item-color="download"
background-color="secondary"
@input="setCategory"
/>
</div>
<div id="tag_filter">
<label class="white--text text-uppercase font-weight-medium caption ml-4">
{{ $t('tags') }}
</label>
<v-select
aria-label="tag_filter"
:value="selectedTag"
flat
solo
class="ml-2 mr-2"
:label="$t('tag')"
:items="availableTags"
item-text="name"
color="download"
item-color="download"
background-color="secondary"
@input="setTag"
/>
</div>
<div id="tracker_filter" v-if="showTrackerFilter">
<label class="white--text text-uppercase font-weight-medium caption ml-4">
{{ $t('tracker') }}
</label>
<v-select
aria-label="tracker_filter"
:value="selectedTracker"
flat
solo
class="ml-2 mr-2"
label="TRACKER"
:items="availableTrackers"
item-text="name"
color="download"
item-color="download"
background-color="secondary"
@input="setTracker"
/>
</div>
</div>
</template>
<script>
import { mapGetters, mapState } from 'vuex'
export default {
name: 'FilterSelect',
props: ['showTrackerFilter'],
data() {
return {
selectedState: null,
selectedCategory: null,
selectedTag: null,
selectedTracker: null
}
},
computed: {
...mapGetters(['getCategories', 'getAvailableTags', 'getTrackers']),
...mapState(['sort_options']),
options() {
return [
{ value: null, name: this.$t('all') },
{ value: 'downloading', name: this.$t('navbar.filters.downloading') },
{ value: 'seeding', name: this.$t('navbar.filters.seeding') },
{ value: 'completed', name: this.$t('navbar.filters.completed') },
{ value: 'resumed', name: this.$t('navbar.filters.resumed') },
{ value: 'paused', name: this.$t('navbar.filters.paused') },
{ value: 'active', name: this.$t('navbar.filters.active') },
{ value: 'inactive', name: this.$t('navbar.filters.inactive') },
{ value: 'stalled', name: this.$t('navbar.filters.stalled') },
{
value: 'stalled_uploading',
name: this.$t('navbar.filters.stalled_uploading')
},
{
value: 'stalled_downloading',
name: this.$t('navbar.filters.stalled_downloading')
},
{ value: 'checking', name: this.$t('navbar.filters.checking') },
{ value: 'moving', name: this.$t('navbar.filters.moving') },
{ value: 'errored', name: this.$t('navbar.filters.errored') }
]
},
availableCategories() {
const categories = [
{ name: this.$t('all'), value: null },
{ name: this.$t('navbar.filters.uncategorized'), value: '' }
]
categories.push(
...this.getCategories().map(c => {
return { name: c.name, value: c.name }
})
)
return categories
},
availableTags() {
return [{ name: this.$t('all'), value: null }, { name: this.$t('navbar.filters.untagged'), value: '' }, ...this.getAvailableTags()]
},
availableTrackers() {
const trackers = [
{ name: this.$t('all'), value: null },
{ name: this.$t('navbar.filters.not_working'), value: '' }
]
if (this.showTrackerFilter) {
trackers.push(
...this.getTrackers().map(t => {
return {
name: t,
value: t
}
})
)
}
return trackers
}
},
mounted() {
this.loadFilter()
},
methods: {
commitFilter() {
this.$store.commit('RESET_SELECTED')
this.$store.commit('UPDATE_SORT_OPTIONS', {
filter: this.selectedState,
category: this.selectedCategory,
tag: this.selectedTag,
tracker: this.selectedTracker
})
},
loadFilter() {
this.selectedState = this.$store.state.sort_options.filter
this.selectedCategory = this.$store.state.sort_options.category
this.selectedTag = this.$store.state.sort_options.tag
this.selectedTracker = this.$store.state.sort_options.tracker
},
setState(value) {
this.selectedState = value
this.commitFilter()
},
setCategory(value) {
this.selectedCategory = value
this.commitFilter()
},
setTag(value) {
this.selectedTag = value
this.commitFilter()
},
setTracker(value) {
this.selectedTracker = value
this.commitFilter()
}
}
}
</script>
<style lang="scss">
.v-select__selection,
.v-input__icon svg {
color: #64ceaa !important;
}
.v-select__slot > label {
&.theme--dark {
color: white !important;
}
&.theme--light {
color: black !important;
}
}
#app .v-select .v-text-field__details {
display: none;
}
#app .v-select .v-select__selection {
padding: 16px 0;
margin: 0;
}
</style>

View file

@ -1,16 +0,0 @@
<template>
<div v-if="space" class="mb-4">
<StorageCard v-if="space" class="mt-8" :label="$t('navbar.freeSpace')" color="upload" :value="space" />
</div>
</template>
<script>
import StorageCard from '@/components/Core/StorageCard.vue'
export default {
name: 'FreeSpace',
components: {
StorageCard
},
props: ['space']
}
</script>

View file

@ -1,168 +1,80 @@
<template>
<nav>
<!--title-->
<v-app-bar app elevate-on-scroll class="noselect">
<v-app-bar-nav-icon class="grey--text text--lighten-1" aria-label="Open Navigation Drawer" @click.stop="drawer = !drawer" />
<v-toolbar-title v-if="!$vuetify.breakpoint.xs" :class="['grey--text', { 'subheading ml-0': $vuetify.breakpoint.smAndDown }]">
<span class="font-weight-light">qBit</span>
<span>torrent</span>
</v-toolbar-title>
<script setup lang="ts">
import BottomActions from '@/components/Navbar/SideWidgets/BottomActions.vue'
import CurrentSpeed from '@/components/Navbar/SideWidgets/CurrentSpeed.vue'
import FilterSelect from '@/components/Navbar/SideWidgets/FilterSelect.vue'
import FreeSpace from '@/components/Navbar/SideWidgets/FreeSpace.vue'
import SpeedGraph from '@/components/Navbar/SideWidgets/SpeedGraph.vue'
import TransferStats from '@/components/Navbar/SideWidgets/TransferStats.vue'
import ActiveFilters from '@/components/Navbar/TopWidgets/ActiveFilters.vue'
import TopContainer from '@/components/Navbar/TopWidgets/TopContainer.vue'
import { useDashboardStore } from '@/stores/dashboard'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { ref } from 'vue'
<v-slide-x-transition>
<v-speed-dial v-if="filterCount > 0" v-model="filters_fab" open-on-hover transition="slide-y-transition" direction="bottom" class="ml-5">
<template #activator>
<v-btn color="primary" rounded small v-model="filters_fab">{{ $t('navbar.active_filter.btn_label').replace('$0', filterCount) }}</v-btn>
</template>
<div class="d-flex flex-column align-start" style="width: 100%; row-gap: 8px">
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="dashboard.searchFilter?.length > 0" small class="white--text caption">
{{ $t('navbar.active_filter.search_filter').replace('$0', dashboard.searchFilter) }}
</v-chip>
</template>
<span>{{ $t('status') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="sort_options.filter !== null" small :class="`torrent-${sort_options.filter}`" class="white--text caption">{{
$t(`navbar.filters.${sort_options.filter}`)
}}</v-chip>
</template>
<span>{{ $t('status') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="sort_options.category !== null" small class="category white--text caption">{{
sort_options.category === '' ? $t('navbar.filters.uncategorized') : sort_options.category
}}</v-chip>
</template>
<span>{{ $t('category') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="sort_options.tag !== null" small class="tags white--text caption">{{
sort_options.tag === '' ? $t('navbar.filters.untagged') : sort_options.tag
}}</v-chip>
</template>
<span>{{ $t('tags') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-chip v-if="sort_options.tracker !== null" small class="tracker white--text caption">{{
sort_options.tracker === '' ? $t('navbar.filters.not_working') : sort_options.tracker
}}</v-chip>
</template>
<span>{{ $t('tracker') }}</span>
</v-tooltip>
</div>
</v-speed-dial>
</v-slide-x-transition>
const dashboardStore = useDashboardStore()
const vueTorrentStore = useVueTorrentStore()
<v-spacer />
const isDrawerOpen = ref(vueTorrentStore.openSideBarOnStart)
<TopMenu />
</v-app-bar>
<!--navigation drawer itself -->
<v-navigation-drawer v-model="drawer" app class="primary drawer" style="position: fixed" width="256" height="100%" disable-resize-watcher :right="webuiSettings.rightDrawer">
<v-card v-if="status" style="display: flex; flex-direction: column" class="pt-3 primary" flat>
<CurrentSpeed v-if="webuiSettings.showCurrentSpeed" :status="status" />
<SpeedGraph v-if="webuiSettings.showSpeedGraph" />
<TransferStats v-if="webuiSettings.showAlltimeStat" :session="false" :status="status" />
<TransferStats v-if="webuiSettings.showSessionStat" :session="true" :status="status" />
<FreeSpace v-if="webuiSettings.showFreeSpace" :space="status.freeDiskSpace" />
<FilterSelect :show-tracker-filter="webuiSettings.showTrackerFilter" />
<div style="font-size: 0.9em" class="download--text text-uppercase text-center mt-5">
{{ torrentCountString }}
</div>
</v-card>
<template #append>
<div class="pa-2">
<NavbarActions />
</div>
</template>
</v-navigation-drawer>
</nav>
</template>
<script lang="ts">
import { mapGetters, mapState } from 'vuex'
import { NavbarActions, TopMenu, SpeedGraph, FreeSpace, TransferStats, CurrentSpeed, FilterSelect } from './index'
import WebUISettings from '@/types/vuetorrent/WebUISettings'
export default {
name: 'Navbar',
components: {
FreeSpace,
NavbarActions,
TopMenu,
SpeedGraph,
TransferStats,
CurrentSpeed,
FilterSelect
},
data() {
return {
drawer: this.$vuetify.breakpoint.mdAndUp,
filters_fab: false
}
},
computed: {
...mapGetters(['getWebuiSettings', 'getStatus', 'getTorrentCountString']),
...mapState(['dashboard', 'sort_options']),
webuiSettings(): WebUISettings {
return this.getWebuiSettings()
},
status() {
return this.getStatus()
},
torrentCountString() {
return this.getTorrentCountString()
},
filterCount() {
return (
(this.dashboard.searchFilter?.length > 0) +
(this.sort_options.filter !== null) +
(this.sort_options.category !== null) +
(this.sort_options.tag !== null) +
(this.sort_options.tracker !== null)
)
}
},
created() {
this.drawer = this.webuiSettings.openSideBarOnStart && this.$vuetify.breakpoint.mdAndUp
}
const toggleDrawer = () => {
isDrawerOpen.value = !isDrawerOpen.value
}
</script>
<style lang="scss">
#app > div > nav > nav > div.v-navigation-drawer__content {
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: #56718c;
border-radius: 20px;
}
}
<template>
<v-navigation-drawer v-model="isDrawerOpen" color="primary" disable-route-watcher>
<v-list class="clean-px px-2 pt-0">
<v-list-item v-if="vueTorrentStore.showCurrentSpeed">
<CurrentSpeed />
</v-list-item>
.v-app-bar > .v-toolbar__content {
padding-right: 0;
}
<v-list-item v-if="vueTorrentStore.showSpeedGraph">
<SpeedGraph />
</v-list-item>
.navbar {
@media screen and (max-width: 480px) {
.v-toolbar__title {
display: none;
}
.spacer {
display: none;
}
}
<v-list-item v-if="vueTorrentStore.showAlltimeStat">
<TransferStats :session="false" />
</v-list-item>
<v-list-item v-if="vueTorrentStore.showSessionStat">
<TransferStats :session="true" />
</v-list-item>
<v-list-item v-if="vueTorrentStore.showFreeSpace">
<FreeSpace />
</v-list-item>
<v-list-item>
<FilterSelect />
</v-list-item>
<v-list-item density="compact">
<div class="d-flex justify-center text-accent">
{{ dashboardStore.torrentCountString }}
</div>
</v-list-item>
</v-list>
<template v-slot:append>
<BottomActions />
</template>
</v-navigation-drawer>
<v-app-bar>
<v-app-bar-nav-icon @click="toggleDrawer" />
<v-app-bar-title>
<span v-if="$vuetify.display.smAndUp" class="text-accent">Vue</span>
<span v-if="$vuetify.display.smAndUp">Torrent</span>
<ActiveFilters />
</v-app-bar-title>
<TopContainer />
</v-app-bar>
</template>
<style scoped lang="scss">
.clean-px > * {
padding-inline-start: 0 !important;
padding-inline-end: 0 !important;
}
</style>

View file

@ -1,113 +0,0 @@
<template>
<v-row no-gutters>
<v-col>
<v-tooltip top>
<template #activator="{ on }">
<v-btn text tile block v-on="on" @click="logout">
<v-icon :class="commonStyle">
{{ mdiExitToApp }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('logout') }}</span>
</v-tooltip>
</v-col>
<v-col>
<v-tooltip top>
<template #activator="{ on }">
<v-btn text tile block v-on="on" @click="toggleSpeed">
<v-icon :class="altSpeed ? 'accent--text' : commonStyle">
{{ altSpeed ? mdiSpeedometerSlow : mdiSpeedometer }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.action.altSpeed') }}</span>
</v-tooltip>
</v-col>
<v-col>
<connection-status :status="connectionStatus" />
</v-col>
<v-col>
<v-tooltip top>
<template #activator="{ on }">
<v-btn text tile block v-on="on" @click="toggleTheme">
<v-icon :class="commonStyle">
{{ theme === 'Light' ? mdiBrightness7 : mdiBrightness4 }}
</v-icon>
</v-btn>
</template>
<span>{{ theme }}</span>
</v-tooltip>
</v-col>
<v-col v-if="webuiSettings.showShutdownButton">
<v-tooltip top>
<template #activator="{ on }">
<v-btn text tile block v-on="on" @click="createModal('ConfirmShutdownModal')">
<v-icon :class="commonStyle">
{{ mdiPower }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('shutdownApp') }}</span>
</v-tooltip>
</v-col>
</v-row>
</template>
<script>
import qbit from '@/services/qbit'
import { mapGetters, mapState } from 'vuex'
import { mdiBrightness4, mdiSpeedometerSlow, mdiBrightness7, mdiSpeedometer, mdiPower, mdiExitToApp, mdiBell, mdiBellOff } from '@mdi/js'
import ConnectionStatus from './ConnectionStatus.vue'
import { General } from '@/mixins'
export default {
name: 'NavbarActions',
components: {
ConnectionStatus
},
mixins: [General],
data: () => ({
commonStyle: 'white--text',
mdiBrightness4,
mdiBrightness7,
mdiSpeedometer,
mdiPower,
mdiExitToApp,
mdiSpeedometerSlow,
mdiBell,
mdiBellOff
}),
computed: {
...mapState(['webuiSettings']),
...mapGetters(['isDarkMode', 'getStatus']),
theme() {
return this.isDarkMode() ? this.$t('navbar.action.dark') : this.$t('navbar.action.light')
},
status() {
return this.getStatus()
},
altSpeed() {
if (this.status && this.status.altSpeed) return this.status.altSpeed
return null
},
connectionStatus() {
return this.status.status
}
},
methods: {
async logout() {
await this.$store.commit('LOGOUT')
this.$router.push({ name: 'login' })
},
async toggleSpeed() {
await qbit.toggleSpeedLimitsMode()
},
toggleTheme() {
this.webuiSettings.darkTheme = !this.webuiSettings.darkTheme
this.$vuetify.theme.dark = this.webuiSettings.darkTheme
}
}
}
</script>

View file

@ -1,26 +0,0 @@
<template>
<div v-if="status" class="mt-3 mb-3">
<label class="text-uppercase white--text caption font-weight-medium ml-4"> Session Stats </label>
<v-tooltip bottom>
<template #activator="{ on }">
<v-icon color="white" style="opacity: 0.3" small v-on="on">
{{ mdiInformationOutline }}
</v-icon>
</template>
<span>{{ $t('navbar.sessionStats.tooltip') }}</span>
</v-tooltip>
<StorageCard class="mb-4 mt-4" label="Downloaded" color="download" :value="status.downloaded" />
<StorageCard label="Uploaded" color="upload" :value="status.uploaded" />
</div>
</template>
<script>
import { mdiInformationOutline } from '@mdi/js'
import StorageCard from '@/components/Core/StorageCard.vue'
export default {
name: 'SessionStats',
components: { StorageCard },
props: ['status'],
data: () => ({ mdiInformationOutline })
}
</script>

View file

@ -0,0 +1,123 @@
<script setup lang="ts">
import ConfirmShutdownDialog from '@/components/Dialogs/ConfirmShutdownDialog.vue'
import ConnectionStatusDialog from '@/components/Dialogs/ConnectionStatusDialog.vue'
import { ConnectionStatus } from '@/constants/qbit'
import { useAppStore } from '@/stores/app'
import { useAuthStore } from '@/stores/auth'
import { useDialogStore } from '@/stores/dialog'
import { useMaindataStore } from '@/stores/maindata'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const authStore = useAuthStore()
const appStore = useAppStore()
const dialogStore = useDialogStore()
const maindataStore = useMaindataStore()
const vueTorrentStore = useVueTorrentStore()
const isAltSpeedEnabled = computed(() => !!maindataStore.serverState?.use_alt_speed_limits)
const connectionStatusIcon = computed(() => {
switch (maindataStore.serverState?.connection_status) {
case ConnectionStatus.CONNECTED:
return 'mdi-check-network'
case ConnectionStatus.FIREWALLED:
return 'mdi-close-network'
case ConnectionStatus.DISCONNECTED:
return 'mdi-network-off'
case ConnectionStatus.UNKNOWN:
default:
return 'mdi-help-network'
}
})
const connectionStatusText = computed(() => {
let key
switch (maindataStore.serverState?.connection_status) {
case ConnectionStatus.CONNECTED:
case ConnectionStatus.FIREWALLED:
case ConnectionStatus.DISCONNECTED:
key = maindataStore.serverState.connection_status
break
case ConnectionStatus.UNKNOWN:
default:
key = 'unknown'
}
return t('navbar.side.bottom_actions.conn_status', { status: t(`constants.connectionStatus.${key}`) })
})
const logout = async () => {
await authStore.logout()
await vueTorrentStore.redirectToLogin()
}
const toggleAltSpeed = () => {
appStore.toggleAlternativeMode()
}
function openConnectionStatusDialog() {
dialogStore.createDialog(ConnectionStatusDialog)
}
function openConfirmShutdownDialog() {
dialogStore.createDialog(ConfirmShutdownDialog)
}
</script>
<template>
<v-row no-gutters>
<v-col class="d-flex justify-center">
<v-tooltip :text="t('navbar.side.bottom_actions.logout')" location="top">
<template v-slot:activator="{ props }">
<v-btn variant="plain" icon="mdi-exit-to-app" v-bind="props" @click="logout" />
</template>
</v-tooltip>
</v-col>
<v-col class="d-flex justify-center">
<v-tooltip :text="t('navbar.side.bottom_actions.alt_speed')" location="top">
<template v-slot:activator="{ props }">
<v-btn
variant="plain"
:color="isAltSpeedEnabled ? 'accent' : undefined"
:icon="isAltSpeedEnabled ? 'mdi-speedometer-slow' : 'mdi-speedometer'"
v-bind="props"
@click="toggleAltSpeed" />
</template>
</v-tooltip>
</v-col>
<v-col class="d-flex justify-center">
<v-tooltip :text="connectionStatusText" location="top">
<template v-slot:activator="{ props }">
<v-btn variant="plain" :icon="connectionStatusIcon" v-bind="props" @click="openConnectionStatusDialog" />
</template>
</v-tooltip>
</v-col>
<v-col class="d-flex justify-center">
<v-tooltip :text="t('navbar.side.bottom_actions.dark_mode', Number(vueTorrentStore.darkMode))" location="top">
<template v-slot:activator="{ props }">
<v-btn
:disabled="vueTorrentStore.matchSystemTheme"
variant="plain"
:icon="vueTorrentStore.matchSystemTheme ? 'mdi-theme-light-dark' : vueTorrentStore.darkMode ? 'mdi-brightness-4' : 'mdi-brightness-7'"
v-bind="props"
@click="vueTorrentStore.toggleTheme()" />
</template>
</v-tooltip>
</v-col>
</v-row>
<v-row no-gutters v-if="vueTorrentStore.isShutdownButtonVisible">
<v-col class="d-flex justify-center">
<v-tooltip :text="t('navbar.side.bottom_actions.shutdown')" location="top">
<template v-slot:activator="{ props }">
<v-btn block color="error" rounded="0" v-bind="props" @click="openConfirmShutdownDialog">
<v-icon size="x-large">mdi-power</v-icon>
</v-btn>
</template>
</v-tooltip>
</v-col>
</v-row>
</template>
<style scoped></style>

View file

@ -0,0 +1,30 @@
<script setup lang="ts">
import SpeedCard from '@/components/Core/SpeedCard.vue'
import { useMaindataStore } from '@/stores/maindata'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const maindataStore = useMaindataStore()
</script>
<template>
<v-card flat color="primary">
<v-card-title class="px-0 text-uppercase white--text ml-1 font-weight-normal text-caption">
{{ t('navbar.side.current_speed.title') }}
</v-card-title>
<v-card-text class="px-0">
<v-sheet color="primary" class="mx-2">
<v-row class="pt-0">
<v-col class="px-1 pt-1">
<SpeedCard icon="mdi-chevron-down" color="download" :value="maindataStore.serverState?.dl_info_speed ?? 0" />
</v-col>
<v-col class="px-1 pt-1">
<SpeedCard icon="mdi-chevron-up" color="upload" :value="maindataStore.serverState?.up_info_speed ?? 0" />
</v-col>
</v-row>
</v-sheet>
</v-card-text>
</v-card>
</template>
<style scoped></style>

View file

@ -0,0 +1,92 @@
<script setup lang="ts">
import { FilterState } from '@/constants/qbit'
import { useDashboardStore } from '@/stores/dashboard'
import { useMaindataStore } from '@/stores/maindata'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const dashboardStore = useDashboardStore()
const maindataStore = useMaindataStore()
const vueTorrentStore = useVueTorrentStore()
const statusOptions = [
{ title: t('navbar.side.filters.disabled'), value: FilterState.ALL },
{ title: t('constants.filterStatus.downloading'), value: FilterState.DOWNLOADING },
{ title: t('constants.filterStatus.seeding'), value: FilterState.SEEDING },
{ title: t('constants.filterStatus.completed'), value: FilterState.COMPLETED },
{ title: t('constants.filterStatus.resumed'), value: FilterState.RESUMED },
{ title: t('constants.filterStatus.paused'), value: FilterState.PAUSED },
{ title: t('constants.filterStatus.active'), value: FilterState.ACTIVE },
{ title: t('constants.filterStatus.inactive'), value: FilterState.INACTIVE },
{ title: t('constants.filterStatus.stalled'), value: FilterState.STALLED },
{ title: t('constants.filterStatus.stalled_uploading'), value: FilterState.STALLED_UPLOADING },
{ title: t('constants.filterStatus.stalled_downloading'), value: FilterState.STALLED_DOWNLOADING },
{ title: t('constants.filterStatus.checking'), value: FilterState.CHECKING },
{ title: t('constants.filterStatus.moving'), value: FilterState.MOVING },
{ title: t('constants.filterStatus.errored'), value: FilterState.ERRORED }
]
const categories = computed(() => {
const categories = [
{ title: t('navbar.side.filters.disabled'), value: null },
{ title: t('navbar.side.filters.uncategorized'), value: '' }
]
categories.push(...maindataStore.categories.map(c => ({ title: c.name, value: c.name })))
return categories
})
const tags = computed(() => {
const tags = [
{ title: t('navbar.side.filters.disabled'), value: null },
{ title: t('navbar.side.filters.untagged'), value: '' }
]
tags.push(...maindataStore.tags.map(tag => ({ title: tag, value: tag })))
return tags
})
const trackers = computed(() => {
const trackers = [{ title: t('navbar.side.filters.disabled'), value: null as string | null }]
trackers.push(...maindataStore.trackers.map(tag => ({ title: tag, value: tag })))
return trackers
})
</script>
<template>
<v-list class="pb-0">
<v-list-item class="px-0 pb-3">
<v-list-item-title class="px-0 text-uppercase white--text ml-1 font-weight-normal text-caption">Status</v-list-item-title>
<v-select
v-model="dashboardStore.sortOptions.statusFilter"
:items="statusOptions"
class="text-accent pt-1"
hide-details
density="compact"
variant="solo"
bg-color="secondary" />
</v-list-item>
<v-list-item class="px-0 pb-3">
<v-list-item-title class="px-0 text-uppercase white--text ml-1 font-weight-light text-subtitle-2">Category</v-list-item-title>
<v-select
v-model="dashboardStore.sortOptions.categoryFilter"
:items="categories"
class="text-accent pt-1"
hide-details
density="compact"
variant="solo"
bg-color="secondary" />
</v-list-item>
<v-list-item class="px-0 pb-3">
<v-list-item-title class="px-0 text-uppercase white--text ml-1 font-weight-light text-subtitle-2">Tags</v-list-item-title>
<v-select v-model="dashboardStore.sortOptions.tagFilter" :items="tags" class="text-accent pt-1" hide-details density="compact" variant="solo" bg-color="secondary" />
</v-list-item>
<v-list-item :class="{ 'px-0': true, 'pb-3': vueTorrentStore.showTrackerFilter }" v-if="vueTorrentStore.showTrackerFilter">
<v-list-item-title class="px-0 text-uppercase white--text ml-1 font-weight-light text-subtitle-2">Tracker</v-list-item-title>
<v-select v-model="dashboardStore.sortOptions.trackerFilter" :items="trackers" class="text-accent pt-1" hide-details density="compact" variant="solo" bg-color="secondary" />
</v-list-item>
</v-list>
</template>
<style scoped></style>

View file

@ -0,0 +1,12 @@
<script setup lang="ts">
import DataCard from '@/components/Core/DataCard.vue'
import { useMaindataStore } from '@/stores/maindata'
const maindataStore = useMaindataStore()
</script>
<template>
<DataCard title="Free Space" :value="maindataStore.serverState?.free_space_on_disk ?? 0" color="upload" />
</template>
<style scoped></style>

View file

@ -0,0 +1,77 @@
<script setup lang="ts">
import { formatSpeed } from '@/helpers'
import { useNavbarStore } from '@/stores/navbar'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { ApexOptions } from 'apexcharts'
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import VueApexCharts from 'vue3-apexcharts'
import { useTheme } from 'vuetify'
const { t } = useI18n()
const theme = useTheme()
const navbarStore = useNavbarStore()
const vuetorrentStore = useVueTorrentStore()
const chart = ref<ApexCharts>()
const chartOptions: ApexOptions = {
chart: {
sparkline: {
enabled: true
},
animations: {
enabled: false
}
},
colors: [theme.current.value.colors.upload, theme.current.value.colors.download],
stroke: {
show: true,
curve: 'smooth',
lineCap: 'round',
width: 4
},
fill: {
type: 'gradient',
gradient: {
shade: 'dark',
type: 'vertical',
shadeIntensity: 0.5,
opacityFrom: 0.6,
opacityTo: 0.5,
stops: [0, 50, 100]
}
},
tooltip: {
theme: 'dark',
x: {
formatter: (value: number) => {
const step = vuetorrentStore.refreshInterval / 1000
const val = navbarStore.downloadData.length * step - value * step
return t('navbar.side.speed_graph.relative_time', val)
}
},
y: {
formatter: (value: number) => {
return formatSpeed(value, vuetorrentStore.useBitSpeed)
}
}
}
}
const series = computed(() => [
{
name: 'upload',
data: navbarStore.uploadData
},
{
name: 'download',
data: navbarStore.downloadData
}
])
</script>
<template>
<VueApexCharts ref="chart" type="area" :options="chartOptions" :series="series" />
</template>
<style scoped></style>

View file

@ -0,0 +1,33 @@
<script setup lang="ts">
import { useMaindataStore } from '@/stores/maindata'
import { computed } from 'vue'
import DataCard from '@/components/Core/DataCard.vue'
import StringCard from '@/components/Core/StringCard.vue'
const props = defineProps<{ session: boolean }>()
const maindataStore = useMaindataStore()
const title = computed(() => (props.session ? 'Session Stats' : 'Alltime Stats'))
const download = computed(() => (props.session ? maindataStore.serverState?.dl_info_data : maindataStore.serverState?.alltime_dl) ?? 0)
const upload = computed(() => (props.session ? maindataStore.serverState?.up_info_data : maindataStore.serverState?.alltime_ul) ?? 0)
const ratio = computed(() => (props.session ? undefined : maindataStore.serverState?.global_ratio) ?? 0)
</script>
<template>
<v-card variant="flat" color="primary">
<v-card-title class="px-0 pb-0 text-uppercase white--text ml-1 font-weight-normal text-caption">{{ title }}</v-card-title>
<v-card-text class="px-0 pb-0">
<div class="d-flex flex-column gap">
<DataCard title="Downloaded" :value="download" color="download" icon="mdi-arrow-down" />
<DataCard title="Uploaded" :value="upload" color="upload" icon="mdi-arrow-up" />
<StringCard v-if="!session" :value="ratio" title="Ratio" color="ratio" />
</div>
</v-card-text>
</v-card>
</template>
<style scoped>
.gap {
gap: 8px;
}
</style>

View file

@ -1,103 +0,0 @@
<template>
<div class="mt-4">
<apexcharts ref="chart" type="line" :options="chartOptions" :series="series" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters } from 'vuex'
import VueApexCharts from 'vue-apexcharts'
import { formatSpeed } from '@/filters'
export default defineComponent({
name: 'SpeedGraph',
components: {
apexcharts: VueApexCharts
},
data() {
return {
chartOptions: {
chart: {
sparkline: {
enabled: true
},
animations: {
enabled: false,
dynamicAnimation: {
speed: 1000
}
}
},
colors: [this.$vuetify.theme.currentTheme.upload, this.$vuetify.theme.currentTheme.download],
stroke: {
show: true,
curve: 'smooth',
lineCap: 'round',
width: 4
},
fill: {
type: 'gradient',
gradient: {
shade: 'dark',
type: 'vertical',
shadeIntensity: 0.5,
opacityFrom: 0.6,
opacityTo: 0.5,
stops: [0, 50, 100]
}
},
tooltip: {
theme: 'light',
x: {
formatter: (value: number) => {
const val = 32 - value * 2
return val + ' seconds ago'
}
},
y: {
formatter: (value: number) => {
return formatSpeed(value, this.shouldUseBitSpeed())
}
}
}
}
}
},
computed: {
...mapGetters(['getTheme', 'shouldUseBitSpeed']),
series() {
return [
{
name: 'upload',
type: 'area',
data: this.$store.state.upload_data
},
{
name: 'download',
type: 'area',
data: this.$store.state.download_data
}
]
},
theme() {
return this.getTheme()
}
},
watch: {
theme(newValue) {
this.setChartTooltipTheme(newValue)
}
},
mounted() {
this.setChartTooltipTheme(this.theme)
},
methods: {
setChartTooltipTheme(theme: string) {
this.chartOptions.tooltip.theme = theme.toLowerCase()
this.$refs.chart.updateOptions(this.chartOptions)
}
}
})
</script>

View file

@ -1,164 +0,0 @@
<template>
<div :class="mobile ? '' : 'flex-shrink-0 ml-0'">
<v-tooltip v-if="!mobile" bottom open-delay="400">
<template #activator="{ on }">
<v-btn small fab :text="!mobile" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.addTorrent')" v-on="on" @click="createModal('AddModal')">
<v-icon color="grey">
{{ mdiPlus }}
</v-icon>
</v-btn>
</template>
<span> {{ $t('navbar.topActions.addTorrent') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn small fab :text="!mobile" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.resumeSelected')" v-on="on" @click="resumeTorrents">
<v-icon color="grey">
{{ mdiPlay }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.topActions.resumeSelected') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn small fab :text="!mobile" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.pauseSelected')" v-on="on" @click="pauseTorrents">
<v-icon color="grey">
{{ mdiPause }}
</v-icon>
</v-btn>
</template>
<span> {{ $t('navbar.topActions.pauseSelected') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn :text="!mobile" small fab class="mr-0 ml-0" :aria-label="$t('navbar.topActions.removeSelected')" v-on="on" @click="removeTorrents">
<v-icon color="grey">
{{ mdiDelete }}
</v-icon>
</v-btn>
</template>
<span> {{ $t('navbar.topActions.removeSelected') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn :text="!mobile" small fab color="grey--text" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.searchNew')" v-on="on" @click="goToSearch">
<v-icon color="grey">
{{ mdiSearchWeb }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.topActions.searchNew') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn :text="!mobile" small fab color="grey--text" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.rssArticles')" v-on="on" @click="goToRss">
<v-icon color="grey">
{{ mdiRss }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.topActions.rssArticles') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn :text="!mobile" small fab color="grey--text" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.logs')" v-on="on" @click="goToLogs">
<v-icon color="grey">
{{ mdiFileDocumentMultiple }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.topActions.logs') }}</span>
</v-tooltip>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn small fab :text="!mobile" class="mr-0 ml-0" :aria-label="$t('navbar.topActions.openSettings')" v-on="on" @click="goToSettings">
<v-icon color="grey">
{{ mdiCog }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.topActions.openSettings') }}</span>
</v-tooltip>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapState } from 'vuex'
import { General } from '@/mixins'
import qbit from '@/services/qbit'
import {
mdiSort,
mdiCog,
mdiCheckboxBlankOutline,
mdiCheckboxMarked,
mdiSearchWeb,
mdiDelete,
mdiPlus,
mdiPlay,
mdiPause,
mdiRss,
mdiFileDocumentMultiple,
mdiPower
} from '@mdi/js'
export default defineComponent({
name: 'TopActions',
mixins: [General],
props: {
mobile: Boolean
},
data() {
return {
fab: false,
mdiCheckboxBlankOutline,
mdiCheckboxMarked,
mdiCog,
mdiDelete,
mdiPause,
mdiPlay,
mdiPlus,
mdiPower,
mdiRss,
mdiSearchWeb,
mdiSort,
mdiFileDocumentMultiple
}
},
computed: {
...mapState(['selected_torrents']),
isOnTorrentDetail() {
return this.$route.name === 'torrentDetail'
},
hashes(): string[] {
return this.isOnTorrentDetail ? [this.$route.params.hash] : this.selected_torrents
}
},
methods: {
async pauseTorrents() {
await qbit.pauseTorrents(this.hashes)
},
async resumeTorrents() {
await qbit.resumeTorrents(this.hashes)
},
removeTorrents() {
if (!this.hashes.length) return
return this.createModal('ConfirmDeleteModal', { hashes: this.hashes })
},
goToSearch() {
if (this.$route.name !== 'search') this.$router.push({ name: 'search' })
},
goToRss() {
if (this.$route.name !== 'rss') this.$router.push({ name: 'rss' })
},
goToLogs() {
if (this.$route.name !== 'logs') this.$router.push({ name: 'logs' })
},
goToSettings() {
if (this.$route.name !== 'settings') this.$router.push({ name: 'settings' })
}
}
})
</script>

View file

@ -1,46 +0,0 @@
<template>
<TopActions v-if="$vuetify.breakpoint.smAndUp" />
<div v-else>
<v-tooltip bottom open-delay="400">
<template #activator="{ on }">
<v-btn text small fab color="grey--text" class="mr-16 ml-0 mb-1" :aria-label="$t('navbar.topActions.addTorrent')" v-on="on" @click="createModal('AddModal')">
<v-icon color="grey">
{{ mdiPlus }}
</v-icon>
</v-btn>
</template>
<span>{{ $t('navbar.topActions.addTorrent') | titleCase }}</span>
</v-tooltip>
<v-speed-dial v-model="fab" transition="slide-y-transition" direction="bottom" style="position: absolute; top: 0.3em; right: 1em">
<template #activator>
<v-btn v-model="fab" color="grey" text small fab>
<v-icon>
{{ fab ? mdiClose : mdiDotsVertical }}
</v-icon>
</v-btn>
</template>
<TopActions mobile />
</v-speed-dial>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { General } from '@/mixins'
import TopActions from './TopActions.vue'
import { mdiClose, mdiDotsVertical, mdiPlus } from '@mdi/js'
export default defineComponent({
name: 'TopMenu',
components: { TopActions },
mixins: [General],
data() {
return {
fab: false,
mdiDotsVertical,
mdiClose,
mdiPlus
}
}
})
</script>

View file

@ -0,0 +1,64 @@
<script setup lang="ts">
import { FilterState } from '@/constants/qbit'
import { useDashboardStore } from '@/stores/dashboard'
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const dashboardStore = useDashboardStore()
const isTextFilterActive = computed(() => dashboardStore.searchFilter?.length > 0)
const isStatusFilterActive = computed(() => dashboardStore.sortOptions.statusFilter !== FilterState.ALL)
const isCategoryFilterActive = computed(() => dashboardStore.sortOptions.categoryFilter !== null)
const isTagFilterActive = computed(() => dashboardStore.sortOptions.tagFilter !== null)
const isTrackerFilterActive = computed(() => dashboardStore.sortOptions.trackerFilter !== null)
const filterCount = computed(
() =>
Number(isTextFilterActive.value) +
Number(isStatusFilterActive.value) +
Number(isCategoryFilterActive.value) +
Number(isTagFilterActive.value) +
Number(isTrackerFilterActive.value)
)
</script>
<template>
<v-menu open-on-click open-on-hover open-delay="0" close-delay="0">
<template v-slot:activator="{ props }">
<v-slide-x-transition>
<v-chip v-if="filterCount > 0" v-bind="props" class="ml-6" color="primary" variant="elevated">
{{ t('navbar.top.active_filters.menu_label', filterCount) }}
</v-chip>
</v-slide-x-transition>
</template>
<div class="d-flex flex-column gap mt-3">
<v-chip v-if="isTextFilterActive" variant="elevated" color="grey">
{{ t('navbar.top.active_filters.text', { value: dashboardStore.searchFilter }) }}
</v-chip>
<v-chip v-if="isStatusFilterActive" variant="elevated" :color="'state-' + dashboardStore.sortOptions.statusFilter">
{{ t('navbar.top.active_filters.status', { value: t(`constants.filterStatus.${dashboardStore.sortOptions.statusFilter}`) }) }}
</v-chip>
<v-chip v-if="isCategoryFilterActive" variant="elevated" color="category">
{{
t('navbar.top.active_filters.category', {
value: dashboardStore.sortOptions.categoryFilter === '' ? t('navbar.side.filters.uncategorized') : dashboardStore.sortOptions.categoryFilter
})
}}
</v-chip>
<v-chip v-if="isTagFilterActive" variant="elevated" color="tag">
{{ t('navbar.top.active_filters.tag', { value: dashboardStore.sortOptions.tagFilter === '' ? t('navbar.side.filters.untagged') : dashboardStore.sortOptions.tagFilter }) }}
</v-chip>
<v-chip v-if="isTrackerFilterActive" variant="elevated" color="tracker">
{{ t('navbar.top.active_filters.tracker', { value: dashboardStore.sortOptions.trackerFilter }) }}
</v-chip>
</div>
</v-menu>
</template>
<style scoped>
.gap {
gap: 8px;
}
</style>

Some files were not shown because too many files have changed in this diff Show more