Merge frontend into project

This commit is contained in:
jb-alvarado 2024-09-24 10:49:37 +02:00
commit bac82d6d07
74 changed files with 23615 additions and 1 deletions

@ -1 +0,0 @@
Subproject commit c897226188cc289b0744bb721691a438dba0f5fd

View File

@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Logging**
If applicable, add logs to help explain your problem.
**Server (please complete the following information):**
- OS: [e.g. debian]
- Version [e.g. 10]
**Repo Version (please complete the following information):**
- Version [e.g. v3.0.0]
**Additional context**
Add any other context about the problem here.

39
frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,39 @@
node_modules
*.log*
.nuxt
.nitro
.cache
.output
.env
dist
.eslintcache
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# Service worker
sw.*
# Mac OSX
.DS_Store
# Vim swap files
*.swp
master.m3u8
tv-media
tv-media/
Videos
Videos/
*.tar*
home
home/
live1
live1/
Musik
Musik/
test.vue

10
frontend/.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"recommendations": [
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"hollowtree.vue-snippets",
"vue.volar",
"wscats.vue",
]
}

34
frontend/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,34 @@
{
"eslint.experimental.useFlatConfig": true,
"prettier.tabWidth": 4,
"prettier.printWidth": 120,
"vue3snippets.semi": false,
"vue3snippets.singleQuote": true,
"vue3snippets.jsxSingleQuote": true,
"vue3snippets.printWidth": 120,
"vue3snippets.tabWidth": 4,
"prettier.jsxSingleQuote": true,
"prettier.semi": false,
"prettier.singleQuote": true,
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cSpell.words": [
"nuxt"
],
}

674
frontend/LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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
<http://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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

29
frontend/README.md Normal file
View File

@ -0,0 +1,29 @@
ffplayout-frontend
=====
This web application is used to manage the [ffplayout](https://github.com/ffplayout/ffplayout).
The interface is mostly designed for 24/7 streaming. Other scenarios like streaming in folder mode or playlists with no start time will work but will not be displayed correctly.
For a better understanding of the functionality, take a look at the screenshots below.
### Login
![login](/docs/images/login.png)
### System Dashboard
![login](/docs/images/dasboard.png)
### Control Page
![player](/docs/images/player.png)
### Media Page
![media](/docs/images/media.png)
### Message Page
![message](/docs/images/message.png)
### Logging Page
![logging](/docs/images/logging.png)
### Configuration Page
![config-gui](/docs/images/config-gui.png)

12
frontend/app.vue Normal file
View File

@ -0,0 +1,12 @@
<template>
<div>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</template>
<script setup lang="ts">
const configStore = useConfig()
await useAsyncData('init', () => configStore.configInit())
</script>

Binary file not shown.

View File

@ -0,0 +1,93 @@
Copyright (c) 2015, Stephan Ahlf (https://github.com/s-a/digital-numbers-font stephan.ahlf@googlemail.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,124 @@
@import 'bootstrap-icons/font/bootstrap-icons.css';
#__nuxt,
#__nuxt > div,
main,
main > div {
height: 100%;
width: 100%;
}
@font-face {
font-family: 'DigitalNumbers';
src: url('@/assets/fonts/DigitalNumbers-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
.splitpanes--horizontal > .splitpanes__splitter {
position: relative;
border-top: 1px solid var(--my-gray);
border-bottom: 1px solid var(--my-gray);
height: 6px !important;
}
.splitpanes--vertical > .splitpanes__splitter {
position: relative;
border-left: 1px solid var(--my-gray);
border-right: 1px solid var(--my-gray);
width: 6px !important;
}
.splitpanes--horizontal > .splitpanes__splitter::before {
content: '';
position: absolute;
background-color: var(--my-gray);
transform: translateY(-50%);
top: 50%;
left: 50%;
height: 2px;
width: 30px;
transition: background-color 0.3s;
margin-left: -1px;
}
.splitpanes--vertical > .splitpanes__splitter::before {
content: '';
position: absolute;
background-color: var(--my-gray);
transform: translateY(-50%);
top: 50%;
left: 50%;
width: 2px;
height: 30px;
transition: background-color 0.3s;
margin-left: -1px;
}
/* ----------------------------------------------------------------------------
multiselect customization
-----------------------------------------------------------------------------*/
.multiselect-caret {
background-image: none !important;
-webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z'%3E%3C/path%3E%3C/svg%3E");
background-position: center;
mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z'%3E%3C/path%3E%3C/svg%3E");
background-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: contain;
mask-size: contain;
background-color: var(--my-gray);
opacity: 1 !important;
}
.multiselect-clear-icon {
background-image: none !important;
-webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'%3E%3C/path%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: contain;
mask-size: contain;
background-color: var(--my-gray);
opacity: 1 !important;
transition: 0.3s;
}
.bg-multiselect-remove {
background-image: none !important;
-webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'%3E%3C/path%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'%3E%3C/path%3E%3C/svg%3E");
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: contain;
mask-size: contain;
background-color: var(--my-gray);
opacity: 1 !important;
transition: 0.3s;
}
.multiselect-tag-remove-icon {
display: inline-block;
height: 0.75rem;
width: 0.75rem;
background-image: none !important;
-webkit-mask-image: url("data:image/svg+xml,%3csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'%3e%3c/path%3e%3c/svg%3e");
mask-image: url("data:image/svg+xml,%3csvg viewBox='0 0 320 512' fill='currentColor' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z'%3e%3c/path%3e%3c/svg%3e");
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: contain;
mask-size: contain;
background-color: var(--my-gray);
opacity: 1 !important;
transition: 0.3s;
}

View File

@ -0,0 +1,33 @@
<template>
<div
v-if="indexStore.showAlert"
role="alert"
class="alert fixed top-20 right-3 z-40 w-auto min-w-64 max-w-[90%] md:max-w-[50%] xl:max-w-[40%]"
:class="`alert-${indexStore.alertVariant}`"
>
<SvgIcon :name="indexStore.alertVariant" />
{{ indexStore.alertMsg }}
</div>
<!-- HACK: init alerts to get the right colors, can be remove when bug is fixed -->
<div class="alert alert-success w-auto max-w-[700px] justify-start py-2 rounded hidden">
<SvgIcon name="success" />
<span class="truncate w-full">bla bla bla</span>
</div>
<div class="alert alert-warning w-auto max-w-[700px] justify-start py-2 rounded hidden">
<SvgIcon name="warning" />
<span class="truncate w-full">bla bla bla</span>
</div>
<div class="alert alert-info w-auto max-w-[700px] justify-start py-2 rounded hidden">
<SvgIcon name="info" />
<span class="truncate w-full">bla bla bla</span>
</div>
<div class="alert alert-error w-auto max-w-[700px] justify-start py-2 rounded hidden">
<SvgIcon name="error" />
<span class="truncate w-full">bla bla bla</span>
</div>
</template>
<script setup lang="ts">
const indexStore = useIndex()
</script>

View File

@ -0,0 +1,104 @@
<template>
<div class="min-w-[200px] pe-8 w-[768px]">
<h2 class="pt-3 text-3xl">{{ t('advanced.title') }}</h2>
<p class="mt-5 font-bold text-orange-500">{{ t('advanced.warning') }}</p>
<form
v-if="configStore.advanced"
class="mt-10 grid md:grid-cols-[180px_auto] gap-5"
@submit.prevent="onSubmitAdvanced"
>
<template v-for="(item, key) in configStore.advanced" :key="key">
<div class="text-xl pt-3 text-right">{{ setTitle(key.toString()) }}:</div>
<div class="md:pt-4">
<label
v-for="(_, name) in (item as Record<string, any>)"
:key="name"
class="form-control w-full"
>
<div class="label">
<span class="label-text !text-md font-bold">{{ name }}</span>
</div>
<input
:id="name"
v-model="item[name]"
type="text"
class="input input-sm input-bordered w-full"
/>
</label>
</div>
</template>
<div class="mt-5 mb-10">
<button class="btn btn-primary" type="submit">{{ t('config.save') }}</button>
</div>
</form>
</div>
<GenericModal
:title="t('config.restartTile')"
:text="t('config.restartText')"
:show="showModal"
:modal-action="restart"
/>
</template>
<script setup lang="ts">
const { t } = useI18n()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const showModal = ref(false)
function setTitle(input: string): string {
switch (input) {
case 'decoder':
return t('advanced.decoder')
case 'encoder':
return t('advanced.encoder')
case 'filter':
return t('advanced.filter')
case 'ingest':
return t('advanced.ingest')
default:
return input
}
}
async function onSubmitAdvanced() {
const update = await configStore.setAdvancedConfig()
configStore.onetimeInfo = true
if (update.status === 200) {
indexStore.msgAlert('success', t('advanced.updateSuccess'), 2)
const channel = configStore.channels[configStore.id].id
await $fetch(`/api/control/${channel}/process/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ command: 'status' }),
}).then((response: any) => {
if (response === 'active') {
showModal.value = true
}
})
} else {
indexStore.msgAlert('error', t('advanced.updateFailed'), 2)
}
}
async function restart(res: boolean) {
if (res) {
const channel = configStore.channels[configStore.id].id
await $fetch(`/api/control/${channel}/process/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ command: 'restart' }),
})
}
showModal.value = false
}
</script>

View File

@ -0,0 +1,172 @@
<template>
<div v-if="configStore.channels && configStore.channels[configStore.id]" class="w-full max-w-[800px]">
<h2 class="pt-3 text-3xl">{{ t('config.channelConf') }} ({{ configStore.channels[configStore.id].id }})</h2>
<div class="w-full flex justify-end my-4">
<button v-if="authStore.role === 'GlobalAdmin'" class="btn btn-sm btn-primary" @click="newChannel()">
{{ t('config.addChannel') }}
</button>
</div>
<div class="w-full">
<label class="form-control w-full">
<div class="label">
<span class="label-text">{{ t('config.name') }}</span>
</div>
<input
v-model="configStore.channels[configStore.id].name"
type="text"
placeholder="Type here"
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full mt-5">
<div class="label">
<span class="label-text">{{ t('config.previewUrl') }}</span>
</div>
<input
v-model="configStore.channels[configStore.id].preview_url"
type="text"
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full mt-5">
<div class="label">
<span class="label-text">{{ t('config.extensions') }}</span>
</div>
<input
v-model="configStore.channels[configStore.id].extra_extensions"
type="text"
class="input input-bordered w-full"
/>
</label>
<template v-if="authStore.role === 'GlobalAdmin'">
<div class="mt-7 font-bold h-3">
<p v-if="configStore.playout.storage.shared_storage">
<SvgIcon name="warning" classes="inline mr-2" />
<span>{{ t('config.sharedStorage') }}</span>
</p>
</div>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">{{ t('config.hlsPath') }}</span>
</div>
<input
v-model="configStore.channels[configStore.id].hls_path"
type="text"
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full mt-5">
<div class="label">
<span class="label-text">{{ t('config.playlistPath') }}</span>
</div>
<input
v-model="configStore.channels[configStore.id].playlist_path"
type="text"
class="input input-bordered w-full"
/>
</label>
<label class="form-control w-full mt-5">
<div class="label">
<span class="label-text">{{ t('config.storagePath') }}</span>
</div>
<input
v-model="configStore.channels[configStore.id].storage_path"
type="text"
class="input input-bordered w-full"
/>
</label>
</template>
<div class="join my-4">
<button class="join-item btn btn-primary" @click="addUpdateChannel()">
{{ t('config.save') }}
</button>
<button
v-if="
authStore.role === 'GlobalAdmin' &&
configStore.channels.length > 1 &&
configStore.channels[configStore.id].id > 1
"
class="join-item btn btn-primary"
@click="deleteChannel()"
>
{{ t('config.delete') }}
</button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
const { $_ } = useNuxtApp()
const { t } = useI18n()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
function rmId(path: string) {
return path.replace(/\/\d+$/, '')
}
function newChannel() {
const channels = $_.cloneDeep(configStore.channels)
const newChannel = $_.cloneDeep(configStore.channels[configStore.channels.length - 1])
newChannel.id = channels.length + 1
newChannel.name = `Channel ${newChannel.id}`
newChannel.preview_url = `${window.location.protocol}//${window.location.host}/live/${newChannel.id}/stream.m3u8`
newChannel.hls_path = `${rmId(newChannel.hls_path)}/${newChannel.id}`
newChannel.playlist_path = `${rmId(newChannel.playlist_path)}/${newChannel.id}`
newChannel.storage_path = `${rmId(newChannel.storage_path)}/${newChannel.id}`
channels.push(newChannel)
configStore.channels = channels
configStore.id = configStore.channels.length - 1
}
async function addUpdateChannel() {
/*
Save channel settings.
*/
const update = await configStore.setChannelConfig(configStore.channels[configStore.id])
if (update.status && update.status < 400) {
indexStore.msgAlert('success', t('config.updateChannelSuccess'), 2)
} else {
indexStore.msgAlert('error', t('config.updateChannelFailed'), 2)
}
}
async function deleteChannel() {
const config = $_.cloneDeep(configStore.channels)
const id = config[configStore.id].id
if (id === 1) {
indexStore.msgAlert('warning', t('config.errorChannelDelete'), 2)
return
}
const response = await fetch(`/api/channel/${id}`, {
method: 'DELETE',
headers: authStore.authHeader,
})
config.splice(configStore.id, 1)
configStore.channels = config
configStore.id = configStore.channels.length - 1
await configStore.getPlayoutConfig()
if (response.status === 200) {
indexStore.msgAlert('success', t('config.errorChannelDelete'), 2)
} else {
indexStore.msgAlert('error', t('config.deleteChannelFailed'), 2)
}
}
</script>

View File

@ -0,0 +1,204 @@
<template>
<div class="max-w-[1200px] pe-8">
<h2 class="pt-3 text-3xl">{{ t('config.playoutConf') }}</h2>
<form
v-if="configStore.playout"
class="mt-10 grid md:grid-cols-[180px_auto] gap-5"
@submit.prevent="onSubmitPlayout"
>
<template v-for="(item, key) in configStore.playout" :key="key">
<div class="text-xl pt-3 text-right">{{ setTitle(key.toString()) }}:</div>
<div class="md:pt-4">
<label
v-for="(prop, name) in (item as Record<string, any>)"
:key="name"
class="form-control w-full"
:class="[typeof prop === 'boolean' && 'flex-row', name.toString() !== 'help_text' && 'mt-2']"
>
<template v-if="name.toString() !== 'startInSec' && name.toString() !== 'lengthInSec' && !(name.toString() === 'path' && key.toString() === 'storage')" >
<div v-if="name.toString() !== 'help_text'" class="label">
<span class="label-text !text-md font-bold">{{ name }}</span>
</div>
<div v-if="name.toString() === 'help_text'" class="whitespace-pre-line">
{{ setHelp(key.toString(), prop) }}
</div>
<input
v-else-if="name.toString() === 'sender_pass'"
v-model="item[name]"
type="password"
:placeholder="t('config.placeholderPass')"
class="input input-sm input-bordered w-full"
/>
<textarea
v-else-if="name.toString() === 'output_param' || name.toString() === 'custom_filter'"
v-model="item[name]"
class="textarea textarea-bordered"
rows="3"
/>
<input
v-else-if="typeof prop === 'number' && prop % 1 === 0"
v-model="item[name]"
type="number"
class="input input-sm input-bordered w-full"
/>
<input
v-else-if="typeof prop === 'number'"
v-model="item[name]"
type="number"
class="input input-sm input-bordered w-full"
step="0.0001"
style="max-width: 250px"
/>
<input
v-else-if="typeof prop === 'boolean'"
v-model="item[name]"
type="checkbox"
class="checkbox checkbox-sm ms-2 mt-2"
/>
<input
v-else-if="name === 'ignore_lines'"
v-model="formatIgnoreLines"
type="text"
class="input input-sm input-bordered w-full"
/>
<input
v-else
:id="name"
v-model="item[name]"
type="text"
class="input input-sm input-bordered w-full"
/>
</template>
</label>
</div>
</template>
<div class="mt-5 mb-10">
<button class="btn btn-primary" type="submit">{{ t('config.save') }}</button>
</div>
</form>
</div>
<GenericModal
:title="t('config.restartTile')"
:text="t('config.restartText')"
:show="showModal"
:modal-action="restart"
/>
</template>
<script setup lang="ts">
const { t } = useI18n()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const showModal = ref(false)
const formatIgnoreLines = computed({
get() {
return configStore.playout.logging.ignore_lines.join(';')
},
set(value) {
configStore.playout.logging.ignore_lines = value.split(';')
},
})
function setTitle(input: string): string {
switch (input) {
case 'general':
return t('config.general')
case 'rpc_server':
return t('config.rpcServer')
case 'mail':
return t('config.mail')
case 'logging':
return t('config.logging')
case 'processing':
return t('config.processing')
case 'ingest':
return t('config.ingest')
case 'playlist':
return t('config.playlist')
case 'storage':
return t('config.storage')
case 'text':
return t('config.text')
case 'task':
return t('config.task')
case 'output':
return t('config.output')
default:
return input
}
}
function setHelp(key: string, text: string): string {
switch (key) {
case 'general':
return t('config.generalText')
case 'rpc_server':
return t('config.rpcText')
case 'mail':
return t('config.mailText')
case 'logging':
return t('config.logText')
case 'processing':
return t('config.processingText')
case 'ingest':
return t('config.ingestText')
case 'playlist':
return t('config.playlistText')
case 'storage':
return t('config.storageText')
case 'text':
return t('config.textText')
case 'task':
return t('config.taskText')
case 'output':
return t('config.outputText')
default:
return text
}
}
async function onSubmitPlayout() {
const update = await configStore.setPlayoutConfig(configStore.playout)
configStore.onetimeInfo = true
if (update.status === 200) {
indexStore.msgAlert('success', t('config.updatePlayoutSuccess'), 2)
const channel = configStore.channels[configStore.id].id
await $fetch(`/api/control/${channel}/process/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ command: 'status' }),
}).then(async (response: any) => {
if (response === 'active') {
showModal.value = true
}
await configStore.getPlayoutConfig()
})
} else {
indexStore.msgAlert('error', t('config.updatePlayoutFailed'), 2)
}
}
async function restart(res: boolean) {
if (res) {
const channel = configStore.channels[configStore.id].id
await $fetch(`/api/control/${channel}/process/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ command: 'restart' }),
})
}
showModal.value = false
}
</script>

View File

@ -0,0 +1,267 @@
<template>
<div class="w-full max-w-[800px] pe-8">
<h2 class="pt-3 text-3xl">{{ t('user.title') }}</h2>
<div v-if="authStore.role === 'GlobalAdmin'" class="flex flex-col xs:flex-row gap-2 w-full mb-5 mt-10">
<div class="grow">
<select v-model="selected" class="select select-bordered w-full max-w-xs" @change="onChange($event)">
<option v-for="item in users" :key="item.username" :value="item.id">{{ item.username }}</option>
</select>
</div>
<div class="flex-none join">
<button class="join-item btn btn-primary" title="Add new User" @click="showUserModal = true">
{{ t('user.add') }}
</button>
<button class="join-item btn btn-primary" title="Delete selected user" @click="deleteUser()">
{{ t('user.delete') }}
</button>
</div>
</div>
<form v-if="configStore.configUser" class="mt-5" @submit.prevent="onSubmitUser">
<label class="form-control w-full max-w-md">
<div class="label">
<span class="label-text">{{ t('user.name') }}</span>
</div>
<input
v-model="configStore.configUser.username"
type="text"
class="input input-bordered w-full !bg-base-100"
disabled
/>
</label>
<label class="form-control w-full max-w-md mt-3">
<div class="label">
<span class="label-text">{{ t('user.mail') }}</span>
</div>
<input v-model="configStore.configUser.mail" type="email" class="input input-bordered w-full" />
</label>
<label class="form-control w-full max-w-md mt-3">
<div class="label">
<span class="label-text">{{ t('user.newPass') }}</span>
</div>
<input v-model="newPass" type="password" class="input input-bordered w-full" />
</label>
<label class="form-control w-full max-w-md mt-3">
<div class="label">
<span class="label-text">{{ t('user.confirmPass') }}</span>
</div>
<input v-model="confirmPass" type="password" class="input input-bordered w-full" />
</label>
<div v-if="authStore.role === 'GlobalAdmin'" class="form-control w-full max-w-md mt-5">
<Multiselect
v-model="configStore.configUser.channel_ids"
:options="configStore.channels"
mode="tags"
:close-on-select="true"
:can-clear="false"
label="name"
value-prop="id"
:classes="multiSelectClasses"
:disabled="configStore.configUser.role_id === 1"
/>
</div>
<div>
<button class="btn btn-primary mt-5" type="submit">{{ t('user.save') }}</button>
</div>
</form>
</div>
<GenericModal :show="showUserModal" title="Add user" :modal-action="addUser">
<div class="w-full max-w-[500px] h-[490px]">
<label class="form-control w-full">
<div class="label">
<span class="label-text">{{ t('user.name') }}</span>
</div>
<input v-model="user.username" name="username" type="text" class="input input-bordered w-full" />
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">{{ t('user.mail') }}</span>
</div>
<input v-model="user.mail" name="mail" type="email" class="input input-bordered w-full" />
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">{{ t('user.password') }}</span>
</div>
<input v-model="user.password" type="password" class="input input-bordered w-full" />
</label>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">{{ t('user.confirmPass') }}</span>
</div>
<input v-model="user.confirm" type="password" class="input input-bordered w-full" />
</label>
<div class="form-control mt-5">
<Multiselect
v-model="user.channel_ids"
:options="configStore.channels"
mode="tags"
:close-on-select="true"
:can-clear="false"
label="name"
value-prop="id"
:classes="multiSelectClasses"
/>
</div>
<div class="form-control mt-3">
<label class="label cursor-pointer w-1/2">
<span class="label-text">{{ t('user.admin') }}</span>
<input v-model.number="user.admin" type="checkbox" class="checkbox" />
</label>
</div>
</div>
</GenericModal>
</template>
<script setup lang="ts">
const { t } = useI18n()
const { multiSelectClasses } = useVariables()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const selected = ref(null as null | number)
const users = ref([] as User[])
const showUserModal = ref(false)
const newPass = ref('')
const confirmPass = ref('')
const user = ref({
id: 0,
username: '',
mail: '',
password: '',
confirm: '',
admin: false,
channel_ids: [1],
role_id: 3,
} as User)
onMounted(() => {
getUsers()
})
async function getUsers() {
fetch('/api/users', {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => response.json())
.then((data) => {
users.value = data
selected.value = configStore.currentUser
})
}
function onChange(event: any) {
selected.value = event.target.value
getUserConfig()
}
async function getUserConfig() {
await fetch(`/api/user/${selected.value}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => response.json())
.then((data) => {
configStore.configUser = data
})
}
async function deleteUser() {
if (configStore.configUser.id === configStore.currentUser) {
indexStore.msgAlert('error', t('user.deleteNotPossible'), 2)
} else {
await fetch(`/api/user/${configStore.configUser.id}`, {
method: 'DELETE',
headers: authStore.authHeader,
})
.then(async () => {
indexStore.msgAlert('success', t('user.deleteSuccess'), 2)
await configStore.getUserConfig()
await getUsers()
})
.catch((e) => {
indexStore.msgAlert('error', `${t('user.deleteError')}: ${e}`, 2)
})
}
}
function clearUser() {
user.value.id = 0
user.value.username = ''
user.value.mail = ''
user.value.password = ''
user.value.confirm = ''
user.value.admin = false
user.value.channel_ids = [1]
user.value.role_id = 3
}
async function addUser(add: boolean) {
if (add) {
if (user.value.admin) {
user.value.role_id = 2
} else {
user.value.role_id = 3
}
delete user.value.admin
if (user.value.username && user.value.password && user.value.password === user.value.confirm) {
authStore.inspectToken()
const update = await configStore.addNewUser(user.value)
showUserModal.value = false
if (update.status === 200) {
indexStore.msgAlert('success', t('user.addSuccess'), 2)
await getUsers()
await getUserConfig()
} else {
indexStore.msgAlert('error', t('user.addFailed'), 2)
}
clearUser()
} else {
indexStore.msgAlert('error', t('user.mismatch'), 2)
}
} else {
showUserModal.value = false
clearUser()
}
}
async function onSubmitUser() {
if (newPass.value && newPass.value === confirmPass.value) {
configStore.configUser.password = newPass.value
}
authStore.inspectToken()
const update = await configStore.setUserConfig(configStore.configUser)
if (update.status === 200) {
indexStore.msgAlert('success', t('user.updateSuccess'), 2)
} else {
indexStore.msgAlert('error', t('user.updateFailed'), 2)
}
newPass.value = ''
confirmPass.value = ''
}
</script>

View File

@ -0,0 +1,14 @@
<template>
<div class="flex items-center ps-4 pe-1">
<div
class="w-2 h-2 rounded-full"
:class="indexStore.sseConnected ? 'bg-success shadow shadow-success' : 'bg-error shadow shadow-error'"
:title="indexStore.sseConnected ? t('socketConnected') : t('socketDisconnected')"
/>
</div>
</template>
<script setup lang="ts">
const { t } = useI18n()
const indexStore = useIndex()
</script>

View File

@ -0,0 +1,59 @@
<template>
<div v-if="show" class="z-50 fixed top-0 bottom-0 left-0 right-0 flex justify-center items-center bg-black/30 overflow-auto m-auto max-h-screen space-y-1">
<div class="flex flex-col bg-base-100 min-w-[400px] max-w-[90%] h-auto rounded-md p-5 shadow-xl">
<div class="inline-block">
<div class="flex gap-2">
<div class="font-bold text-lg truncate flex-1 w-0">{{ title }}</div>
<button v-if="hideButtons" class="btn btn-sm w-8 h-8 rounded-full" @click="modalAction(false)">
<i class="bi bi-x-lg" />
</button>
</div>
<div class="grow mt-3">
<slot>
<div v-html="text" />
</slot>
</div>
</div>
<div v-if="!hideButtons" class="flex justify-end mt-3">
<div class="join">
<button class="btn btn-sm bg-base-300 hover:bg-base-300/50 join-item" @click="modalAction(false)">
{{ t('cancel') }}
</button>
<button class="btn btn-sm bg-base-300 hover:bg-base-300/50 join-item" @click="modalAction(true)">
{{ t('ok') }}
</button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
const { t } = useI18n()
defineProps({
title: {
type: String,
default: '',
},
text: {
type: String,
default: '',
},
modalAction: {
type: Function,
default() {
return ''
},
},
show: {
type: Boolean,
default: false,
},
hideButtons: {
type: Boolean,
default: false,
},
})
</script>

View File

@ -0,0 +1,192 @@
<template>
<div class="navbar bg-base-100 min-h-[52px] p-0 shadow">
<NuxtLink class="navbar-brand min-w-[46px] p-2" href="/">
<img src="~/assets/images/ffplayout-small.png" class="img-fluid" alt="Logo" width="30" height="30" />
</NuxtLink>
<EventStatus v-if="route.name?.toString().includes('player__')" class="z-10" />
<div class="navbar-end w-1/5 grow">
<label class="swap swap-rotate me-2 2sm:hidden">
<input type="checkbox" :checked="indexStore.darkMode" @change="toggleDarkTheme" />
<SvgIcon name="swap-on" classes="w-5 h-5" />
<SvgIcon name="swap-off" classes="w-5 h-5" />
</label>
<details ref="menuDropdown" tabindex="0" class="dropdown dropdown-end z-50">
<summary class="btn btn-ghost 2sm:hidden" @click="clickMenu()" @blur="blurMenu()">
<SvgIcon name="burger" classes="w-5 h-5" />
</summary>
<ul class="menu menu-sm dropdown-content mt-1 z-[1] p-2 shadow bg-base-100 rounded-box w-52">
<li v-for="item in menuItems" :key="item.name" class="bg-base-100 rounded-md">
<NuxtLink
:to="item.link"
class="h-[27px] text-base"
exact-active-class="is-active"
@click="closeMenu()"
>
<span>
{{ item.name }}
</span>
</NuxtLink>
</li>
<li v-if="configStore.channels.length > 1">
<details tabindex="0" @focusout="closeDropdown">
<summary>
<div class="h-[19px] text-base">
<span> {{ configStore.channels[configStore.id].name }} </span>
</div>
</summary>
<ul class="p-2">
<li v-for="(channel, index) in configStore.channels" :key="index">
<span>
<a class="dropdown-item cursor-pointer" @click="selectChannel(index)">{{ channel.name }}</a>
</span>
</li>
</ul>
</details>
</li>
<li class="bg-base-100 rounded-md">
<button class="h-[27px] text-base" exactActiveClass="is-active" @click="logout()">
{{ t('button.logout') }}
</button>
</li>
</ul>
</details>
</div>
<div class="navbar-end hidden 2sm:flex w-4/5 min-w-[750px]">
<ul class="menu menu-sm menu-horizontal px-1">
<li v-for="item in menuItems" :key="item.name" class="bg-base-100 rounded-md p-0">
<NuxtLink
:to="item.link"
class="px-2 h-[27px] relative text-base text-base-content"
active-class="is-active"
>
<span>
{{ item.name }}
</span>
</NuxtLink>
</li>
<li v-if="configStore.channels.length > 1">
<details tabindex="0" @focusout="closeDropdown">
<summary>
<div class="h-[19px] text-base">
<span> {{ configStore.channels[configStore.id].name }} </span>
</div>
</summary>
<ul class="p-2 bg-base-100 rounded-md !mt-1 w-36" tabindex="0">
<li v-for="(channel, index) in configStore.channels" :key="index">
<a class="dropdown-item cursor-pointer" @click="selectChannel(index)">
{{ channel.name }}
</a>
</li>
</ul>
</details>
</li>
<li class="bg-base-100 rounded-md p-0">
<button class="h-[27px] pt-[4px] text-base" @click="logout()">
{{ t('button.logout') }}
</button>
</li>
<li class="p-0">
<label class="swap swap-rotate">
<input type="checkbox" :checked="indexStore.darkMode" @change="toggleDarkTheme" />
<SvgIcon name="swap-on" classes="w-5 h-5" />
<SvgIcon name="swap-off" classes="w-5 h-5" />
</label>
</li>
</ul>
</div>
</div>
</template>
<script setup lang="ts">
const colorMode = useColorMode()
const { t } = useI18n()
const localePath = useLocalePath()
const route = useRoute()
const router = useRouter()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const menuDropdown = ref()
const isOpen = ref(false)
const menuItems = ref([
{ name: t('button.home'), link: localePath({ name: 'index' }) },
{ name: t('button.player'), link: localePath({ name: 'player' }) },
{ name: t('button.media'), link: localePath({ name: 'media' }) },
{ name: t('button.message'), link: localePath({ name: 'message' }) },
{ name: t('button.logging'), link: localePath({ name: 'logging' }) },
{ name: t('button.configure'), link: localePath({ name: 'configure' }) },
])
if (colorMode.value === 'dark') {
indexStore.darkMode = true
}
function closeMenu() {
setTimeout(() => {
isOpen.value = false
menuDropdown.value.removeAttribute('open')
console.log('close')
}, 200)
}
function clickMenu() {
console.log('close')
isOpen.value = !isOpen.value
if (!isOpen.value) {
menuDropdown.value.removeAttribute('open')
}
}
function blurMenu() {
if (isOpen.value) {
isOpen.value = !isOpen.value
} else {
setTimeout(() => {
menuDropdown.value.removeAttribute('open')
}, 200)
}
}
function closeDropdown($event: any) {
setTimeout(() => {
$event.target.parentNode.removeAttribute('open')
}, 200)
}
function logout() {
authStore.removeToken()
router.push(localePath({ name: 'index' }))
}
function selectChannel(index: number) {
configStore.id = index
configStore.getPlayoutConfig()
}
function toggleDarkTheme() {
indexStore.darkMode = !indexStore.darkMode
if (indexStore.darkMode) {
colorMode.preference = 'dark'
} else {
colorMode.preference = 'light'
}
}
</script>
<style lang="scss" scoped>
.is-active > span::after {
background: var(--my-accent);
position: relative;
left: 0px;
content: ' ';
width: inherit;
height: 2px;
color: red;
display: block;
border-radius: 0.15em;
}
</style>

View File

@ -0,0 +1,108 @@
<template>
<div v-if="mediaStore.isLoading" class="h-full w-full absolute z-10 flex justify-center bg-base-100/70">
<span class="loading loading-spinner loading-lg" />
</div>
<div class="bg-base-100 border-b border-my-gray">
<div v-if="mediaStore.folderTree.parent && mediaStore.crumbs">
<nav class="breadcrumbs px-2">
<ul>
<li v-for="(crumb, index) in mediaStore.crumbs" :key="index">
<button
v-if="mediaStore.crumbs.length > 1 && mediaStore.crumbs.length - 1 > index"
class="flex items-center"
@click="mediaStore.getTree(crumb.path)"
>
<i class="bi-folder-fill me-1" />
<span class="text-xs font-bold text-base-content/60 leading-tight">{{ crumb.text }}</span>
</button>
<div v-else class="flex items-center">
<i class="bi-folder-fill me-1" />
<span class="text-xs font-bold text-base-content/60">{{ crumb.text }}</span>
</div>
</li>
</ul>
</nav>
</div>
</div>
<div class="w-full h-[calc(100%-40px)] overflow-auto">
<div
v-for="folder in mediaStore.folderTree.folders"
:key="folder.uid"
class="flex px-2 py-[2px] bg-base-200"
>
<button class="truncate" @click="mediaStore.getTree(`/${mediaStore.folderTree.source}/${folder.name}`)">
<i class="bi-folder-fill" />
{{ folder.name }}
</button>
</div>
<table class="w-full table table-zebra table-fixed">
<Sortable :list="mediaStore.folderTree.files" :options="browserSortOptions" item-key="name" tag="tbody">
<template #item="{ element, index }">
<tr
:id="`file-${index}`"
:key="element.name"
class="w-full border-b border-t border-base-content/20"
:class="{ 'grabbing cursor-grab': width > 768 && configStore.playout.processing.mode === 'playlist' }"
>
<td class="ps-2 py-1 w-[20px]" :class="{'timeHidden': configStore.playout.playlist.infinit}">
<i v-if="mediaType(element.name) === 'audio'" class="bi-music-note-beamed" />
<i v-else-if="mediaType(element.name) === 'video'" class="bi-film" />
<i v-else-if="mediaType(element.name) === 'image'" class="bi-file-earmark-image" />
<i v-else class="bi-file-binary" />
</td>
<td class="px-[1px] py-1 truncate">
{{ element.name }}
</td>
<td class="px-1 py-1 w-[30px] text-center leading-3">
<button @click="preview(element.name)">
<i class="bi-play-fill" />
</button>
</td>
<td class="px-0 py-1 w-[65px] text-nowrap">
{{ secToHMS(element.duration) }}
</td>
<td class="py-1 hidden">00:00:00</td>
<td class="py-1 hidden">{{ secToHMS(element.duration) }}</td>
<td class="py-1 hidden">&nbsp;</td>
<td class="py-1 hidden">&nbsp;</td>
<td class="py-1 hidden">&nbsp;</td>
</tr>
</template>
</Sortable>
</table>
</div>
</template>
<script setup lang="ts">
const { width } = useWindowSize({ initialWidth: 800 })
const { secToHMS, mediaType } = stringFormatter()
const configStore = useConfig()
const mediaStore = useMedia()
const { id } = storeToRefs(useConfig())
const browserSortOptions = {
group: { name: 'playlist', pull: 'clone', put: false },
handle: '.grabbing',
sort: false,
}
defineProps({
preview: {
type: Function,
default() {
return ''
},
},
})
onMounted(async () => {
if (!mediaStore.folderTree.parent || !mediaStore.currentPath) {
await mediaStore.getTree('')
}
})
watch([id], () => {
mediaStore.getTree('')
})
</script>

View File

@ -0,0 +1,344 @@
<template>
<div class="w-full">
<div class="grid grid-cols-1 md:grid-cols-[auto_512px] xl:grid-cols-[512px_auto_450px]">
<div class="order-1 p-1">
<div class="bg-base-100 w-full h-full rounded shadow flex items-center p-2">
<div class="w-full aspect-video">
<video v-if="streamExtension === 'flv'" ref="httpStreamFlv" controls />
<VideoPlayer
v-else-if="configStore.showPlayer && configStore.channels[configStore.id]"
:key="configStore.id"
class="live-player"
reference="httpStream"
:options="{
liveui: true,
controls: true,
suppressNotSupportedError: true,
autoplay: false,
preload: 'auto',
sources: [
{
type: 'application/x-mpegURL',
src: configStore.channels[configStore.id].preview_url,
},
],
}"
/>
</div>
</div>
</div>
<div
class="order-3 xl:order-2 col-span-1 md:col-span-2 xl:col-span-1 bg-base-200 h-full grid grid-cols-1 xs:grid-cols-2"
>
<div class="col-span-1 p-1">
<div
class="w-full h-full bg-base-100 rounded font-['DigitalNumbers'] p-6 text-3xl md:text-2xl 2xl:text-5xl 4xl:text-7xl tracking-tighter flex justify-center items-center shadow"
>
{{ timeStr }}
</div>
</div>
<div class="col-span-1 p-1 min-h-[50%]">
<div
class="w-full h-full bg-base-100 rounded font-['DigitalNumbers'] p-6 text-3xl md:text-2xl 2xl:text-5xl 4xl:text-7xl tracking-tighter flex justify-center items-center shadow"
>
{{ secToHMS(timeRemaining()) }}
</div>
</div>
<div class="col-span-1 xs:col-span-2 p-1">
<div class="w-full h-full bg-base-100 rounded flex items-center p-3 shadow">
<div class="w-full h-full flex flex-col">
<div v-if="playlistStore.ingestRuns" class="h-1/3 font-bold truncate">
{{ t('control.ingest') }}
</div>
<div
v-else
class="h-1/3 font-bold text truncate"
:class="{'text-base-content/60': playlistStore.current.category === 'advertisement'}"
:title="playlistStore.current.title || filename(playlistStore.current.source)"
>
{{
playlistStore.current.title ||
filename(playlistStore.current.source) ||
t('control.noClip')
}}
</div>
<div class="grow">
<strong>{{ t('player.duration') }}:</strong>
{{ secToHMS(playlistStore.current.duration) }} |
<strong>{{ t('player.in') }}:</strong> {{ secToHMS(playlistStore.current.in) }} |
<strong>{{ t('player.out') }}:</strong>
{{ secToHMS(playlistStore.current.out) }}
<template v-if="playlistStore.shift !== 0">
| <strong>{{ t('player.shift') }}:</strong>
{{ secToHMS(playlistStore.shift) }}
</template>
</div>
<div class="h-1/3">
<progress
class="progress progress-accent w-full"
:value="playlistStore.progressValue"
max="100"
/>
</div>
</div>
</div>
</div>
</div>
<div class="order-2 xl:order-3 p-1">
<div class="bg-base-100 h-full flex justify-center rounded shadow">
<div class="w-full h-full grid grid-cols-3">
<div class="text-center">
<div class="w-full h-1/2 aspect-square p-2">
<button
:title="t('control.start')"
class="btn btn-primary h-full w-full text-7xl text-lime-600"
:class="playlistStore.playoutIsRunning && 'shadow-glow shadow-lime-600'"
@click="controlProcess('start')"
>
<i class="bi-play" />
</button>
</div>
<div class="w-full h-1/2 aspect-square p-2">
<button
:title="t('control.last')"
class="btn btn-primary h-full w-full text-7xl text-cyan-600"
@click="controlPlayout('back')"
>
<i class="bi-skip-start" />
</button>
</div>
</div>
<div class="text-center">
<div class="w-full h-1/2 aspect-square p-2">
<button
:title="t('control.stop')"
class="btn btn-primary h-full w-full text-7xl text-red-600"
@click="controlProcess('stop')"
>
<i class="bi-stop" />
</button>
</div>
<div class="w-full h-1/2 aspect-square p-2">
<button
:title="t('control.reset')"
class="btn btn-primary h-full w-full text-6xl text-cyan-600"
@click="controlPlayout('reset')"
>
<i class="bi-arrow-repeat" />
</button>
</div>
</div>
<div class="text-center">
<div class="w-full h-1/2 aspect-square p-2">
<button
:title="t('control.restart')"
class="btn btn-primary h-full w-full text-6xl text-yellow-500"
@click="controlProcess('restart')"
>
<i class="bi-arrow-clockwise" />
</button>
</div>
<div class="w-full h-1/2 aspect-square p-2">
<button
:title="t('control.next')"
class="btn btn-primary h-full w-full text-7xl text-cyan-600"
@click="controlPlayout('next')"
>
<i class="bi-skip-end" />
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import mpegts from 'mpegts.js'
const { t } = useI18n()
const { $dayjs } = useNuxtApp()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const playlistStore = usePlaylist()
const { filename, secToHMS } = stringFormatter()
const { id } = storeToRefs(useConfig())
const currentDefault = {
uid: '',
title: t('control.noClip'),
source: t('control.noClip'),
duration: 0,
in: 0,
out: 0,
} as PlaylistItem
playlistStore.current = currentDefault
const timeStr = ref('00:00:00')
const timer = ref()
const errorCounter = ref(0)
const streamExtension = ref(configStore.channels[configStore.id].preview_url.split('.').pop())
const httpStreamFlv = ref(null)
const httpFlvSource = ref({
type: 'flv',
isLive: true,
url: configStore.channels[configStore.id].preview_url,
})
const mpegtsOptions = ref({
lazyLoadMaxDuration: 3 * 60,
liveBufferLatencyChasing: true,
})
const streamUrl = ref(
`/data/event/${configStore.channels[configStore.id].id}?endpoint=playout&uuid=${authStore.uuid}`
)
// 'http://127.0.0.1:8787/data/event/1?endpoint=playout&uuid=f2f8c29b-712a-48c5-8919-b535d3a05a3a'
const { status, data, error, close } = useEventSource(streamUrl, [], {
autoReconnect: {
retries: -1,
delay: 1000,
onFailed() {
indexStore.sseConnected = false
},
},
})
onMounted(() => {
let player: any = null
if (streamExtension.value === 'flv' && mpegts.getFeatureList().mseLivePlayback) {
if (typeof player !== 'undefined' && player != null) {
player.unload()
player.detachMediaElement()
player.destroy()
player = null
}
player = mpegts.createPlayer(httpFlvSource.value, mpegtsOptions.value)
player.attachMediaElement(httpStreamFlv.value)
player.load()
}
clock()
})
onBeforeUnmount(() => {
indexStore.sseConnected = false
close()
if (timer.value) {
clearTimeout(timer.value)
}
})
watch([status, error], async () => {
if (status.value === 'OPEN') {
indexStore.sseConnected = true
errorCounter.value = 0
} else {
indexStore.sseConnected = false
errorCounter.value += 1
if (errorCounter.value > 11) {
await authStore.obtainUuid()
streamUrl.value = `/data/event/${
configStore.channels[configStore.id].id
}?endpoint=playout&uuid=${authStore.uuid}`
errorCounter.value = 0
}
}
})
watch([data], () => {
if (data.value) {
try {
const playout_status = JSON.parse(data.value)
playlistStore.setStatus(playout_status)
} catch {
indexStore.sseConnected = true
playlistStore.playoutIsRunning = false
resetStatus()
}
}
})
watch([id], () => {
resetStatus()
streamUrl.value = `/data/event/${configStore.channels[configStore.id].id}?endpoint=playout&uuid=${
authStore.uuid
}`
if (timer.value) {
clearTimeout(timer.value)
}
})
function timeRemaining() {
let remaining = playlistStore.current.out - playlistStore.elapsedSec
if (remaining < 0) {
remaining = 0
}
return remaining
}
async function clock() {
async function setTime(resolve: any) {
timeStr.value = $dayjs().utcOffset(configStore.utcOffset).format('HH:mm:ss')
timer.value = setTimeout(() => setTime(resolve), 1000)
}
return new Promise((resolve) => setTime(resolve))
}
function resetStatus() {
playlistStore.elapsedSec = 0
playlistStore.shift = 0
playlistStore.current = currentDefault
}
async function controlProcess(state: string) {
/*
Control playout (start, stop, restart)
*/
const channel = configStore.channels[configStore.id].id
await $fetch(`/api/control/${channel}/process/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ command: state }),
})
}
async function controlPlayout(state: string) {
/*
Control playout:
- jump to next clip
- jump to last clip
- reset playout state
*/
const channel = configStore.channels[configStore.id].id
await $fetch(`/api/control/${channel}/playout/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ control: state }),
})
}
</script>

View File

@ -0,0 +1,425 @@
<template>
<div
class="z-50 fixed top-0 bottom-0 w-full h-full left-0 right-0 flex justify-center items-center bg-black/30 overflow-y-auto"
>
<div
class="relative flex flex-col bg-base-100 w-[800px] min-w-[300px] max-w-[90vw] h-[680px] rounded-md p-5 shadow-xl"
>
<div class="font-bold text-lg">{{ t('player.generateProgram') }}</div>
<div class="h-[calc(100%-95px)] mt-3">
<div role="tablist" class="tabs tabs-bordered">
<input
type="radio"
name="my_tabs_2"
role="tab"
class="tab"
:aria-label="t('player.simple')"
checked
@change="advancedGenerator = false"
/>
<div role="tabpanel" class="tab-content w-full pt-3">
<div class="w-full">
<div class="grid">
<nav class="breadcrumbs px-3 pt-0">
<ul>
<li v-for="(crumb, index) in mediaStore.folderCrumbs" :key="index">
<button
v-if="
mediaStore.folderCrumbs.length > 1 &&
mediaStore.folderCrumbs.length - 1 > index
"
@click="mediaStore.getTree(crumb.path, true)"
>
<i class="bi-folder-fill me-1" />
{{ crumb.text }}
</button>
<span v-else><i class="bi-folder-fill me-1" />{{ crumb.text }}</span>
</li>
</ul>
</nav>
</div>
<ul class="h-[475px] border border-my-gray rounded overflow-auto bg-base-300 m-1 py-1">
<li
v-for="folder in mediaStore.folderList.folders"
:key="folder.uid"
class="even:bg-base-200 px-2 w-full"
>
<div class="grid grid-cols-[auto_24px]">
<button
class="truncate text-left"
@click="
;[
(selectedFolders = []),
mediaStore.getTree(
`/${mediaStore.folderList.source}/${folder.name}`.replace(
/\/[/]+/g,
'/'
),
true
),
]
"
>
<i class="bi-folder-fill" />
{{ folder.name }}
</button>
<div v-if="!generateFromAll" class="text-center">
<input
class="checkbox checkbox-xs rounded"
type="checkbox"
@change="
setSelectedFolder(
$event,
`/${mediaStore.folderList.source}/${folder.name}`.replace(
/\/[/]+/g,
'/'
)
)
"
/>
</div>
</div>
</li>
</ul>
</div>
</div>
<input
type="radio"
name="my_tabs_2"
role="tab"
class="tab"
:aria-label="t('player.advanced')"
@change=";(advancedGenerator = true), resetCheckboxes()"
/>
<div role="tabpanel" class="tab-content pt-3">
<div class="w-full">
<div class="grid grid-cols-[auto_48px] px-3 pt-0">
<nav class="breadcrumbs pt-0">
<ul>
<li v-for="(crumb, index) in mediaStore.folderCrumbs" :key="index">
<button
v-if="
mediaStore.folderCrumbs.length > 1 &&
mediaStore.folderCrumbs.length - 1 > index
"
@click="mediaStore.getTree(crumb.path, true)"
>
<i class="bi-folder-fill me-1" />
{{ crumb.text }}
</button>
<span v-else><i class="bi-folder-fill me-1" />{{ crumb.text }}</span>
</li>
</ul>
</nav>
<div class="flex justify-end">
<button
type="button"
class="btn btn-sm btn-primary"
:title="t('player.addBlock')"
@click="addTemplate()"
>
<i class="bi bi-folder-plus" />
</button>
</div>
</div>
<div
class="h-[475px] border border-my-gray rounded grid bg-base-300 m-1"
:class="width < 740 ? 'grid-cols-1' : 'grid-cols-[300px_auto]'"
>
<Sortable
:list="mediaStore.folderList.folders"
:options="templateBrowserSortOptions"
item-key="uid"
class="overflow-auto py-1 border-my-gray"
:class="width < 740 ? 'h-[240px] border-b' : 'border-e'"
tag="ul"
>
<template #item="{ element, index }">
<li
:id="`adv_folder_${index}`"
:key="element.uid"
class="even:bg-base-200 draggable px-2 w-full"
>
<button
class="w-full truncate text-left"
@click="
;[
(selectedFolders = []),
mediaStore.getTree(
`/${mediaStore.folderList.source}/${element.name}`.replace(
/\/[/]+/g,
'/'
),
true
),
]
"
>
<i class="bi-folder-fill" />
{{ element.name }}
</button>
</li>
</template>
</Sortable>
<ul class="overflow-auto px-1 pb-1">
<li
v-for="item in template.sources"
:key="item.start"
class="flex flex-col gap-1 justify-center items-center border border-my-gray rounded mt-1 p-1"
>
<div class="flex flex-wrap xs:grid xs:grid-cols-[58px_64px_67px_64px_67px] xs:join">
<div
class="input input-sm input-bordered join-item px-1 text-center bg-base-200 leading-7"
>
{{ t('player.start') }}:
</div>
<input
v-model="item.start"
type="text"
class="input input-sm input-bordered join-item px-1 text-center"
/>
<div
class="input input-sm input-bordered join-item px-1 text-center bg-base-200 leading-7"
>
{{ t('player.duration') }}:
</div>
<input
v-model="item.duration"
type="text"
class="input input-sm input-bordered join-item px-1 text-center"
/>
<button
class="btn btn-sm input-bordered join-item"
:class="item.shuffle ? 'bg-base-100' : 'bg-base-300'"
@click="item.shuffle = !item.shuffle"
>
{{ item.shuffle ? t('player.shuffle') : t('player.sorted') }}
</button>
</div>
<Sortable
:list="item.paths"
item-key="index"
class="w-full border border-my-gray rounded"
:style="`height: ${item.paths ? item.paths.length * 23 + 31 : 300}px`"
tag="ul"
:options="templateTargetSortOptions"
@add="addFolderToTemplate($event, item)"
>
<template #item="{ element, index }">
<li
:id="`path_${index}`"
:key="index"
class="draggable grabbing py-0 even:bg-base-200 px-2"
>
<i class="bi-folder-fill" />
{{ element.split(/[\\/]+/).pop() }}
</li>
</template>
</Sortable>
<div class="w-full flex justify-end">
<button
type="button"
class="btn btn-sm bg-base-100"
@click="removeTemplate(item)"
>
<i class="bi-trash" />
</button>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="flex h-14 pt-6 justify-end items-center">
<div v-if="!advancedGenerator" class="form-control">
<label class="label cursor-pointer w-12">
<span class="label-text">{{ t('player.all') }}</span>
<input
v-model="generateFromAll"
type="checkbox"
class="checkbox checkbox-xs rounded"
@change="resetCheckboxes()"
/>
</label>
</div>
<div class="join ms-2">
<button
type="button"
class="btn btn-sm btn-primary join-item"
@click="resetCheckboxes(), resetTemplate(), close()"
>
{{ t('cancel') }}
</button>
<button type="button" class="btn btn-sm btn-primary join-item" @click="generatePlaylist(), close()">
{{ t('ok') }}
</button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
const { $dayjs } = useNuxtApp()
const { t } = useI18n()
const { width } = useWindowSize({ initialWidth: 800 })
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const mediaStore = useMedia()
const playlistStore = usePlaylist()
const { processPlaylist } = playlistOperations()
const prop = defineProps({
close: {
type: Function,
default() {
return ''
},
},
switchClass: {
type: Function,
default() {
return ''
},
},
})
const advancedGenerator = ref(false)
const selectedFolders = ref([] as string[])
const generateFromAll = ref(false)
const template = ref({
sources: [
{
start: configStore.playout.playlist.day_start,
duration: '02:00:00',
shuffle: false,
paths: [],
},
],
} as Template)
const templateBrowserSortOptions = {
group: { name: 'folder', pull: 'clone', put: false },
sort: false,
}
const templateTargetSortOptions = {
group: 'folder',
animation: 100,
handle: '.grabbing',
}
function setSelectedFolder(event: any, folder: string) {
if (event.target.checked) {
selectedFolders.value.push(folder)
} else {
const index = selectedFolders.value.indexOf(folder)
if (index > -1) {
selectedFolders.value.splice(index, 1)
}
}
}
function resetCheckboxes() {
selectedFolders.value = []
const checkboxes = document.getElementsByClassName('folder-check') as HTMLCollectionOf<HTMLInputElement>
if (checkboxes) {
for (const box of checkboxes) {
box.checked = false
}
}
}
function addFolderToTemplate(event: any, item: TemplateItem) {
const o = event.oldIndex
const n = event.newIndex
event.item.remove()
const storagePath = configStore.channels[configStore.id].storage_path
const navPath = mediaStore.folderCrumbs[mediaStore.folderCrumbs.length - 1].path
const sourcePath = `${storagePath}/${navPath}/${mediaStore.folderList.folders[o].name}`.replace(/\/[/]+/g, '/')
if (!item.paths.includes(sourcePath)) {
item.paths.splice(n, 0, sourcePath)
}
}
function resetTemplate() {
template.value.sources = []
}
function removeTemplate(item: TemplateItem) {
const index = template.value.sources.indexOf(item)
template.value.sources.splice(index, 1)
}
function addTemplate() {
const last = template.value.sources[template.value.sources.length - 1]
let start = $dayjs('2000-01-01T00:00:00')
if (last) {
const t = $dayjs(`2000-01-01T${last.duration}`)
start = $dayjs(`2000-01-01T${last.start}`)
.add(t.hour(), 'hour')
.add(t.minute(), 'minute')
.add(t.second(), 'second')
}
template.value.sources.push({
start: start.format('HH:mm:ss'),
duration: '02:00:00',
shuffle: false,
paths: [],
})
}
async function generatePlaylist() {
playlistStore.isLoading = true
let body = null as BodyObject | null
if (selectedFolders.value.length > 0 && !generateFromAll.value) {
body = { paths: selectedFolders.value }
}
if (advancedGenerator.value) {
if (body) {
body.template = template.value
} else {
body = { template: template.value }
}
}
await $fetch(`/api/playlist/${configStore.channels[configStore.id].id}/generate/${playlistStore.listDate}`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body,
})
.then((response: any) => {
playlistStore.playlist = processPlaylist(playlistStore.listDate, response.program, false)
prop.switchClass()
indexStore.msgAlert('success', t('player.generateDone'), 2)
})
.catch((e: any) => {
indexStore.msgAlert('error', e.data ? e.data : e, 4)
})
// reset selections
resetCheckboxes()
resetTemplate()
playlistStore.isLoading = false
}
</script>

View File

@ -0,0 +1,359 @@
<template>
<div
id="playlist-container"
ref="playlistContainer"
class="relative w-full h-full !bg-base-300 rounded-e overflow-auto"
>
<div v-if="playlistStore.isLoading" class="w-full h-full absolute z-10 flex justify-center bg-base-100/70">
<span class="loading loading-spinner loading-lg" />
</div>
<table class="table table-zebra table-fixed">
<thead class="top-0 sticky z-10">
<tr class="bg-base-100 rounded-tr-lg">
<th v-if="!configStore.playout.playlist.infinit" class="w-[85px] p-0 text-left">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.start') }}
</div>
</th>
<th class="w-full p-0 text-left">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.file') }}
</div>
</th>
<th class="w-[85px] p-0 text-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.play') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden md:table-cell">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.duration') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.in') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.out') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden xl:table-cell justify-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.ad') }}
</div>
</th>
<th class="w-[85px] p-0 text-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.edit') }}
</div>
</th>
<th class="w-[85px] p-0 text-center hidden md:table-cell justify-center">
<div class="border-b border-my-gray px-4 py-3 -mb-[2px]">
{{ t('player.delete') }}
</div>
</th>
</tr>
</thead>
<Sortable
id="sort-container"
ref="sortContainer"
:list="playlistStore.playlist"
item-key="uid"
tag="tbody"
:options="playlistSortOptions"
@add="addClip"
@start="addBG"
@end="moveItemInArray"
>
<template #item="{ element, index }">
<tr
:id="`clip-${index}`"
:key="element.uid"
class="draggable border-t border-b border-base-content/20 duration-1000 transition-all"
:class="{
'!bg-lime-500/30':
playlistStore.playoutIsRunning && listDate === todayDate && index === currentIndex,
'!bg-amber-600/40': element.overtime,
'text-base-content/50': element.category === 'advertisement'
}"
>
<td v-if="!configStore.playout.playlist.infinit" class="ps-4 py-2 text-left">
{{ secondsToTime(element.begin) }}
</td>
<td class="py-2 text-left truncate" :class="{ 'grabbing cursor-grab': width > 768 }">
{{ element.title || filename(element.source) }}
</td>
<td class="py-2 text-center hover:text-base-content/70">
<button @click="preview(element.source)">
<i class="bi-play-fill" />
</button>
</td>
<td class="py-2 text-center hidden md:table-cell">{{ secToHMS(element.duration) }}</td>
<td class="py-2 text-center hidden xl:table-cell">
{{ secToHMS(element.in) }}
</td>
<td class="py-2 text-center hidden xl:table-cell">
{{ secToHMS(element.out) }}
</td>
<td class="py-2 text-center hidden xl:table-cell leading-3">
<input
class="checkbox checkbox-xs rounded"
type="checkbox"
:checked="element.category && element.category === 'advertisement' ? true : false"
@change="setCategory($event, element)"
/>
</td>
<td class="py-2 text-center hover:text-base-content/70">
<button @click="editItem(index)">
<i class="bi-pencil-square" />
</button>
</td>
<td class="py-2 text-center hidden md:table-cell justify-center hover:text-base-content/70">
<button @click="deletePlaylistItem(index)">
<i class="bi-x-circle-fill" />
</button>
</td>
</tr>
</template>
</Sortable>
</table>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from 'pinia'
const { t } = useI18n()
const { $dayjs } = useNuxtApp()
const { width } = useWindowSize({ initialWidth: 800 })
const configStore = useConfig()
const mediaStore = useMedia()
const playlistStore = usePlaylist()
const { secToHMS, filename, secondsToTime } = stringFormatter()
const { processPlaylist, genUID } = playlistOperations()
const playlistContainer = ref()
const sortContainer = ref()
const todayDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
const { id } = storeToRefs(useConfig())
const { currentIndex, listDate, playoutIsRunning } = storeToRefs(usePlaylist())
const playlistSortOptions = {
group: 'playlist',
animation: 100,
handle: '.grabbing',
}
defineProps({
editItem: {
type: Function,
default() {
return ''
},
},
preview: {
type: Function,
default() {
return ''
},
},
})
onMounted(() => {
setTimeout(() => {
getPlaylist()
}, 150)
})
watch([listDate, id], () => {
setTimeout(() => {
getPlaylist()
}, 800)
})
watch([playoutIsRunning], () => {
setTimeout(() => {
scrollTo(currentIndex.value)
}, 400)
})
defineExpose({
classSwitcher,
getPlaylist,
})
function scrollTo(index: number) {
const child = document.getElementById(`clip-${index}`)
const parent = document.getElementById('playlist-container')
if (child && parent) {
const topPos = child.offsetTop
parent.scrollTop = topPos - 50
}
}
function classSwitcher() {
if (playlistStore.playlist.length === 0) {
sortContainer.value?.sortable.el.classList.add('is-empty')
} else {
const lastItem = playlistStore.playlist[playlistStore.playlist.length - 1]
if (
configStore.playout.playlist.startInSec + configStore.playout.playlist.lengthInSec >
lastItem.begin + lastItem.out - lastItem.in ||
configStore.playout.playlist.infinit
) {
sortContainer.value?.sortable.el.classList.add('add-space')
} else {
sortContainer.value?.sortable.el.classList.remove('add-space')
}
sortContainer.value?.sortable.el.classList.remove('is-empty')
}
}
async function getPlaylist() {
playlistStore.isLoading = true
await playlistStore.getPlaylist(listDate.value)
playlistStore.isLoading = false
if (listDate.value === todayDate.value) {
await until(currentIndex).toMatch((v) => v > 0, { timeout: 1500 })
scrollTo(currentIndex.value)
} else {
scrollTo(0)
}
classSwitcher()
}
function setCategory(event: any, item: PlaylistItem) {
if (event.target.checked) {
item.category = 'advertisement'
} else {
item.category = ''
}
}
function addBG(obj: any) {
if (obj.item) {
obj.item.classList.add('!bg-fuchsia-900/30')
} else {
obj?.classList?.add('!bg-fuchsia-900/30')
}
}
function removeBG(item: any) {
setTimeout(() => {
item?.classList?.remove('!bg-fuchsia-900/30')
}, 100)
}
function addClip(event: any) {
const o = event.oldIndex
const n = event.newIndex
const uid = genUID()
event.item?.remove()
const storagePath = configStore.channels[configStore.id].storage_path
const sourcePath = `${storagePath}/${mediaStore.folderTree.source}/${mediaStore.folderTree.files[o].name}`.replace(
/\/[/]+/g,
'/'
)
playlistStore.playlist.splice(n, 0, {
uid,
begin: 0,
source: sourcePath,
in: 0,
out: mediaStore.folderTree.files[o].duration,
duration: mediaStore.folderTree.files[o].duration,
})
processPlaylist(listDate.value, playlistStore.playlist, false)
classSwitcher()
nextTick(() => {
const newNode = document.getElementById(`clip-${n}`)
addBG(newNode)
removeBG(newNode)
if (n > playlistStore.playlist.length - 3) {
playlistContainer.value.scroll({ top: playlistContainer.value.scrollHeight, behavior: 'smooth' })
}
})
}
function moveItemInArray(event: any) {
playlistStore.playlist.splice(event.newIndex, 0, playlistStore.playlist.splice(event.oldIndex, 1)[0])
processPlaylist(listDate.value, playlistStore.playlist, false)
removeBG(event.item)
}
function deletePlaylistItem(index: number) {
playlistStore.playlist.splice(index, 1)
processPlaylist(listDate.value, playlistStore.playlist, false)
classSwitcher()
}
</script>
<style>
#sort-container.is-empty:not(:has(.sortable-ghost)):after {
content: '\f1bc';
font-family: 'bootstrap-icons';
opacity: 0.3;
font-size: 50px;
width: 100%;
height: 210px;
display: flex;
position: absolute;
justify-content: center;
align-items: center;
}
#sort-container.add-space:after {
content: ' ';
width: 100%;
height: 37px;
display: flex;
position: absolute;
}
#sort-container .timeHidden {
display: none !important;
}
/*
format dragging element
*/
#playlist-container .sortable-ghost {
background-color: #701a754b !important;
min-height: 37px !important;
height: 37px !important;
}
#playlist-container .sortable-ghost td {
padding-left: 1rem;
padding-right: 1rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
#playlist-container .sortable-ghost td:nth-last-child(3) {
display: table-cell !important;
}
@media (min-width: 1280px) {
#playlist-container .sortable-ghost td:nth-last-child(5),
#playlist-container .sortable-ghost td:nth-last-child(4),
#playlist-container .sortable-ghost td:nth-last-child(-n + 2) {
display: table-cell !important;
}
}
</style>

View File

@ -0,0 +1,109 @@
<template>
<svg
v-if="name === 'swap-on'"
class="swap-on fill-current"
:class="classes"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 22 22"
>
<path
d="M5.64,17l-.71.71a1,1,0,0,0,0,1.41,1,1,0,0,0,1.41,0l.71-.71A1,1,0,0,0,5.64,17ZM5,12a1,1,0,0,0-1-1H3a1,1,0,0,0,0,2H4A1,1,0,0,0,5,12Zm7-7a1,1,0,0,0,1-1V3a1,1,0,0,0-2,0V4A1,1,0,0,0,12,5ZM5.64,7.05a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.41l-.71-.71A1,1,0,0,0,4.93,6.34Zm12,.29a1,1,0,0,0,.7-.29l.71-.71a1,1,0,1,0-1.41-1.41L17,5.64a1,1,0,0,0,0,1.41A1,1,0,0,0,17.66,7.34ZM21,11H20a1,1,0,0,0,0,2h1a1,1,0,0,0,0-2Zm-9,8a1,1,0,0,0-1,1v1a1,1,0,0,0,2,0V20A1,1,0,0,0,12,19ZM18.36,17A1,1,0,0,0,17,18.36l.71.71a1,1,0,0,0,1.41,0,1,1,0,0,0,0-1.41ZM12,6.5A5.5,5.5,0,1,0,17.5,12,5.51,5.51,0,0,0,12,6.5Zm0,9A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z"
/>
</svg>
<svg
v-else-if="name === 'swap-off'"
class="swap-off fill-current"
:class="classes"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 22 22"
>
<path
d="M21.64,13a1,1,0,0,0-1.05-.14,8.05,8.05,0,0,1-3.37.73A8.15,8.15,0,0,1,9.08,5.49a8.59,8.59,0,0,1,.25-2A1,1,0,0,0,8,2.36,10.14,10.14,0,1,0,22,14.05,1,1,0,0,0,21.64,13Zm-9.5,6.69A8.14,8.14,0,0,1,7.08,5.22v.27A10.15,10.15,0,0,0,17.22,15.63a9.79,9.79,0,0,0,2.1-.22A8.11,8.11,0,0,1,12.14,19.73Z"
/>
</svg>
<svg
v-else-if="name === 'error'"
xmlns="http://www.w3.org/2000/svg"
class="stroke-current shrink-0 h-6 w-6"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
<svg
v-if="name === 'success'"
xmlns="http://www.w3.org/2000/svg"
class="stroke-current shrink-0 h-6 w-6"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
<svg
v-if="name === 'warning'"
xmlns="http://www.w3.org/2000/svg"
class="stroke-current shrink-0 h-6 w-6"
:class="classes"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
<svg
v-if="name === 'info'"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
class="stroke-current shrink-0 w-6 h-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
<svg
v-else-if="name === 'burger'"
xmlns="http://www.w3.org/2000/svg"
:class="classes"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h8m-8 6h16" />
</svg>
</template>
<script setup lang="ts">
defineProps({
name: {
type: String,
default: '',
},
classes: {
type: String,
default: '',
},
})
</script>

View File

@ -0,0 +1,160 @@
<template>
<!-- <div v-if="data">{{ systemStatus(data) }}</div> -->
<div class="grid grid-cols-1 xs:grid-cols-2 border-4 rounded-md border-primary text-left shadow min-w-[728px] max-w-[960px]">
<div class="p-4 bg-base-100">
<span class="text-3xl">{{ sysStat.system.name }} {{ sysStat.system.version }}</span>
<span v-if="sysStat.system.kernel">
<br />
{{ sysStat.system.kernel }}
</span>
</div>
<div class="p-4 bg-base-100 flex items-center">
<span v-if="sysStat.system.ffp_version">
<strong>ffplayout:</strong>
v{{ sysStat.system.ffp_version }}
</span>
</div>
<div class="p-4 border border-primary">
<div class="text-xl">{{ t('system.cpu') }}</div>
<div class="grid grid-cols-2 gap-2">
<div>
<strong>{{ t('system.cores') }}:</strong> {{ sysStat.cpu.cores }}
</div>
<div>
<strong>{{ t('system.usage') }}:</strong> {{ sysStat.cpu.usage.toFixed(2) }}%
</div>
</div>
</div>
<div class="p-4 border border-primary">
<div class="text-xl">{{ t('system.load') }}</div>
<div class="grid grid-cols-3 gap-2">
<div>{{ sysStat.load.one }}</div>
<div>{{ sysStat.load.five }}</div>
<div>{{ sysStat.load.fifteen }}</div>
</div>
</div>
<div class="p-4 border border-primary">
<div class="text-xl">{{ t('system.memory') }}</div>
<div class="grid grid-cols-2 gap-2">
<div>
<strong>{{ t('system.total') }}:</strong> {{ fileSize(sysStat.memory.total) }}
</div>
<div>
<strong>{{ t('system.usage') }}:</strong> {{ fileSize(sysStat.memory.used) }}
</div>
</div>
</div>
<div class="p-4 border border-primary">
<div class="text-xl">{{ t('system.swap') }}</div>
<div class="grid grid-cols-2 gap-2">
<div>
<strong>{{ t('system.total') }}:</strong> {{ fileSize(sysStat.swap.total) }}
</div>
<div>
<strong>{{ t('system.usage') }}:</strong> {{ fileSize(sysStat.swap.used) }}
</div>
</div>
</div>
<div class="p-4 border border-primary">
<div class="text-xl">
{{ t('system.network') }} <span v-if="sysStat.network" class="fs-6">{{ sysStat.network?.name }}</span>
</div>
<div class="grid grid-cols-2 gap-2">
<div>
<strong>{{ t('system.in') }}:</strong> {{ fileSize(sysStat.network?.current_in) }}
</div>
<div>
<strong>{{ t('system.out') }}:</strong> {{ fileSize(sysStat.network?.current_out) }}
</div>
<div>{{ fileSize(sysStat.network?.total_in) }}</div>
<div>{{ fileSize(sysStat.network?.total_out) }}</div>
</div>
</div>
<div v-if="sysStat.storage?.path" class="p-4 border border-primary">
<div class="text-xl">{{ t('system.storage') }}</div>
<div v-if="sysStat.storage" class="grid grid-cols-2 gap-2">
<div v-if="sysStat.storage" class="col-span-2">
<strong>{{ t('system.device') }}:</strong> {{ sysStat.storage?.path }}
</div>
<div>
<strong>{{ t('system.size') }}:</strong> {{ fileSize(sysStat.storage?.total) }}
</div>
<div>
<strong>{{ t('system.used') }}:</strong> {{ fileSize(sysStat.storage?.used) }}
</div>
</div>
</div>
<div v-else class="col-6 bg-primary p-2 border" />
</div>
</template>
<script setup lang="ts">
const { fileSize } = stringFormatter()
const { t } = useI18n()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const streamUrl = ref(
`/data/event/${configStore.channels[configStore.id].id}?endpoint=system&uuid=${authStore.uuid}`
)
// 'http://127.0.0.1:8787/data/event/1?endpoint=system&uuid=f2f8c29b-712a-48c5-8919-b535d3a05a3a'
const { status, data, error, close } = useEventSource(streamUrl, [], {
autoReconnect: {
retries: -1,
delay: 1000,
onFailed() {
indexStore.sseConnected = false
},
},
})
const errorCounter = ref(0)
const defaultStat = {
cpu: { cores: 1, usage: 0.0 },
load: { one: 0.0, five: 0.0, fifteen: 0.0 },
memory: { total: 0.0, used: 0.0, free: 0.0 },
network: { name: '...', current_in: 0.0, current_out: 0.0, total_in: 0.0, total_out: 0.0 },
storage: { path: '', total: 0.0, used: 0.0 },
swap: { total: 0.0, used: 0.0, free: 0.0 },
system: { name: '...', kernel: '...', version: '...', ffp_version: '...' },
} as SystemStatistics
const sysStat = ref(defaultStat)
onBeforeUnmount(() => {
close()
indexStore.sseConnected = false
})
watch([status, error], async () => {
if (status.value === 'OPEN') {
indexStore.sseConnected = true
errorCounter.value = 0
} else {
indexStore.sseConnected = false
errorCounter.value += 1
sysStat.value = defaultStat
if (errorCounter.value > 15) {
await authStore.obtainUuid()
streamUrl.value = `/data/event/${configStore.channels[configStore.id].id}?endpoint=system&uuid=${
authStore.uuid
}`
errorCounter.value = 0
}
}
})
watch([data], () => {
if (data.value) {
try {
sysStat.value = JSON.parse(data.value)
} catch {
indexStore.sseConnected = true
}
}
})
</script>

View File

@ -0,0 +1,120 @@
<template>
<div id="timeField" class="input input-sm input-bordered flex px-3 py-0">
<div class="grow">
<input
ref="timeInput"
:value="secToTime(props.modelValue)"
type="text"
pattern="([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]{1,3})?"
class="w-full px-1 py-0"
@click="setCursorPos"
@change="$emit('update:modelValue', timeToSec($event))"
/>
</div>
<div class="w-auto">
<div class="flex flex-col text-xs py-[2px]">
<button
class="bg-base-300 hover:bg-base-300/50 px-1 text-[9px] h-[13px] rounded-t"
tabindex="0"
@click="countUp"
>
<i class="bi-chevron-up" />
</button>
<button class="bg-base-300 hover:bg-base-300/50 px-1 text-[9px] h-[13px] rounded-b" @click="countDown">
<i class="bi-chevron-down" />
</button>
</div>
</div>
</div>
</template>
<script setup lang="ts">
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
modelValue: {
type: Number,
required: true,
},
})
const timeInput = ref()
const cursorPos = ref(8)
function secToTime(sec: number) {
const hours = Math.floor(sec / 3600)
sec %= 3600
const minutes = Math.floor(sec / 60)
const seconds = Math.floor(sec % 60)
const ms = Math.round((sec - Math.floor(sec)) * 1000) / 1000
const secFmt = (seconds + ms).toFixed(3)
const m = String(minutes).padStart(2, '0')
const h = String(hours).padStart(2, '0')
const s = secFmt.padStart(6, '0')
return `${h}:${m}:${s}`
}
function timeToSec(event: any) {
const time = event.target?.value ?? 0
const [h, m, s] = time.split(':').map((val: string) => Number(val) || 0)
return h * 3600 + m * 60 + s
}
function setCursorPos() {
cursorPos.value = timeInput.value?.selectionStart
}
function countUp() {
let count = 0
if (cursorPos.value && cursorPos.value >= 6) {
count = 1
} else if (cursorPos.value && cursorPos.value >= 3) {
count = 60
} else {
count = 3600
}
emit('update:modelValue', props.modelValue + count)
nextTick(() => {
timeInput.value?.focus()
timeInput.value?.setSelectionRange(cursorPos.value, cursorPos.value)
})
}
function countDown() {
let sec = props.modelValue
let count = 0
if (cursorPos.value && cursorPos.value >= 6) {
count = 1
} else if (cursorPos.value && cursorPos.value >= 3) {
count = 60
} else {
count = 3600
}
sec -= count
if (sec < 0) {
emit('update:modelValue', 0)
} else {
emit('update:modelValue', sec)
}
nextTick(() => {
timeInput.value?.focus()
timeInput.value?.setSelectionRange(cursorPos.value, cursorPos.value)
})
}
</script>
<style scoped>
#timeField:has(> div > input:invalid) {
border: red solid 1px;
}
</style>

View File

@ -0,0 +1,77 @@
<template>
<div>
<div v-if="options.sources">
<video
:id="reference"
class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9"
width="1024"
height="576"
/>
</div>
</div>
</template>
<script setup lang="ts">
import videojs from 'video.js'
import 'video.js/dist/video-js.css'
const configStore = useConfig()
const player = ref()
const props = defineProps({
options: {
type: Object,
required: true,
},
reference: {
type: String,
required: true,
},
})
onMounted(() => {
const volume = localStorage.getItem('volume')
player.value = videojs(props.reference, props.options, function onPlayerReady() {
// console.log('onPlayerReady', this);
})
if (volume !== null) {
player.value.volume(volume)
}
player.value.on('volumechange', () => {
localStorage.setItem('volume', player.value.volume())
})
player.value.on('error', () => {
setTimeout(() => {
configStore.showPlayer = false
nextTick(() => {
configStore.showPlayer = true
})
}, 2000)
})
})
onBeforeUnmount(() => {
if (player.value) {
player.value.dispose()
}
})
</script>
<style>
.video-js .vjs-volume-panel.vjs-volume-panel-horizontal {
width: 10em;
}
.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
width: 5em;
height: 3em;
margin-right: 0;
opacity: 1;
}
</style>

View File

@ -0,0 +1,254 @@
export const stringFormatter = () => {
function fileSize(bytes: number | undefined, dp = 2) {
if (!bytes) {
return 0.0
}
const thresh = 1024
if (Math.abs(bytes) < thresh) {
return bytes + ' B'
}
const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
let u = -1
const r = 10 ** dp
do {
bytes /= thresh
++u
} while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1)
return bytes.toFixed(dp) + ' ' + units[u]
}
function formatLog(text: string): string {
return text
.replace(/<yellow>(.*?)<\/>/g, '<span class="log-number">$1</span>')
.replace(/<b><magenta>(.*?)<\/><\/b>/g, '<span class="log-addr">$1</span>')
.replace(/<bright-blue>(.*?)<\/>/g, '<span class="log-cmd">$1</span>')
.replace(/\x1B\[90m(.*?)\x1B\[0m/g, '<span class="log-debug">$1</span>')
.replace(/(\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.[\d]+\])/g, '<span class="log-time">$1</span>')
.replace(/\[ INFO\]/g, '<span class="log-info">[ INFO]</span>')
.replace(/\[ WARN\]/g, '<span class="log-warning">[ WARN]</span>')
.replace(/\[ERROR\]/g, '<span class="log-error">[ERROR]</span>')
.replace(/\[DEBUG\]/g, '<span class="log-debug">[DEBUG]</span>')
.replace(/\[Decoder\]/g, '<span class="log-decoder">[Decoder]</span>')
.replace(/\[Encoder\]/g, '<span class="log-encoder">[Encoder]</span>')
.replace(/\[Server\]/g, '<span class="log-server">[Server]</span>')
.replace(/\[Validator\]/g, '<span class="log-server">[Validator]</span>')
}
function timeToSeconds(time: string) {
const t = time.split(':')
return parseInt(t[0]) * 3600 + parseInt(t[1]) * 60 + parseInt(t[2])
}
function secToHMS(sec: number) {
const sign = Math.sign(sec)
sec = Math.abs(sec)
const hours = Math.floor(sec / 3600)
sec %= 3600
const minutes = Math.floor(sec / 60)
const seconds = Math.round(sec % 60)
const m = String(minutes).padStart(2, '0')
const h = String(hours).padStart(2, '0')
const s = String(seconds).padStart(2, '0')
const hString = (sign === -1 ? '-' : '') + h
return `${hString}:${m}:${s}`
}
function numberToHex(num: number) {
return '0x' + Math.round(num * 255).toString(16)
}
function hexToNumber(num: string): number {
return parseFloat((parseFloat(parseInt(num, 16).toString()) / 255).toFixed(2))
}
function filename(path: string) {
if (path) {
const pathArr = path.split('/')
const name = pathArr[pathArr.length - 1]
if (name) {
return name
} else {
return path
}
} else {
return ''
}
}
function parent(path: string) {
if (path) {
const pathArr = path.split('/')
pathArr.pop()
if (pathArr.length > 0) {
return pathArr.join('/')
} else {
return '/'
}
} else {
return ''
}
}
function toMin(sec: number) {
if (sec) {
const minutes = Math.floor(sec / 60)
const seconds = Math.round(sec - minutes * 60)
return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')} min`
} else {
return ''
}
}
function secondsToTime(sec: number) {
return new Date(sec * 1000 || 0).toISOString().substring(11, 19)
}
function mediaType(path: string) {
const liveType = ['m3u8']
const videoType = [
'avi',
'flv',
'm2v',
'm4v',
'mkv',
'mov',
'mp4',
'mpeg',
'mpg',
'mts',
'mxf',
'ts',
'vob',
'ogv',
'webm',
'wmv',
]
const audioType = ['aac', 'aiff', 'flac', 'm4a', 'mp2', 'mp3', 'ogg', 'opus', 'wav', 'wma']
const imageType = [
'apng',
'avif',
'bmp',
'exr',
'gif',
'jpeg',
'jpg',
'png',
'psd',
'tga',
'tif',
'tiff',
'webp',
]
const ext = path.split('.').pop()
if (ext) {
if (liveType.includes(ext.toLowerCase())) {
return 'live'
} else if (videoType.includes(ext.toLowerCase())) {
return 'video'
} else if (audioType.includes(ext.toLowerCase())) {
return 'audio'
} else if (imageType.includes(ext.toLowerCase())) {
return 'image'
}
}
return null
}
return {
fileSize,
formatLog,
timeToSeconds,
secToHMS,
numberToHex,
hexToNumber,
filename,
parent,
toMin,
secondsToTime,
mediaType,
}
}
export const playlistOperations = () => {
function genUID() {
return String(Date.now().toString(32) + Math.random().toString(16)).replace(/\./g, '')
}
function processPlaylist(date: string, list: PlaylistItem[], forSave: boolean) {
const configStore = useConfig()
let begin = configStore.playout.playlist.startInSec
const newList = []
for (const item of list) {
if (configStore.playout.playlist.startInSec === begin) {
item.date = date
}
if (forSave) {
delete item.date
if (!item.audio) {
delete item.audio
}
if (!item.category) {
delete item.category
}
if (!item.custom_filter) {
delete item.custom_filter
}
if (!item.title) {
delete item.title
}
if (
begin + (item.out - item.in) >
configStore.playout.playlist.startInSec + configStore.playout.playlist.lengthInSec
) {
item.out =
configStore.playout.playlist.startInSec + configStore.playout.playlist.lengthInSec - begin
}
} else {
if (!item.uid) {
item.uid = genUID()
}
if (
begin >= configStore.playout.playlist.startInSec + configStore.playout.playlist.lengthInSec &&
!configStore.playout.playlist.infinit
) {
item.overtime = true
} else if (item.overtime) {
delete item.overtime
}
item.begin = begin
}
newList.push(item)
begin += item.out - item.in
}
return newList
}
return { processPlaylist, genUID }
}

View File

@ -0,0 +1,70 @@
export const useVariables = () => {
const multiSelectClasses = {
container: 'relative input input-bordered w-full flex items-center justify-end px-0 min-h-[32px]',
containerDisabled: 'cursor-default !bg-base-100',
containerOpen: 'rounded-b-none',
containerOpenTop: 'rounded-t-none',
containerActive: 'ring ring-green-500 ring-opacity-30',
wrapper: 'relative mx-auto w-full flex items-center justify-end box-border cursor-pointer outline-none',
singleLabel:
'flex items-center h-full max-w-full absolute left-0 top-0 pointer-events-none bg-transparent leading-snug pl-3.5 pr-16 box-border rtl:left-auto rtl:right-0 rtl:pl-0 rtl:pr-3.5',
singleLabelText: 'overflow-ellipsis overflow-hidden block whitespace-nowrap max-w-full',
multipleLabel:
'flex items-center h-full absolute left-0 top-0 pointer-events-none bg-transparent leading-snug pl-3.5 rtl:left-auto rtl:right-0 rtl:pl-0 rtl:pr-3.5',
search: 'w-full absolute inset-0 outline-none focus:ring-0 appearance-none box-border border-0 text-base font-sans bg-base-100 rounded pl-3.5 rtl:pl-0 rtl:pr-3.5',
tags: 'flex-grow flex-shrink flex flex-wrap items-center mt-0 pl-2 min-w-0 rtl:pl-0 rtl:pr-2',
tag: 'bg-base-300 h-6 text-base-content text-sm font-bold py-0.5 pl-2 rounded mr-1 my-0.5 flex items-center whitespace-nowrap min-w-0 rtl:pl-0 rtl:pr-2 rtl:mr-0 rtl:ml-1',
tagDisabled: 'pr-2 opacity-50 rtl:pl-2',
tagWrapper: 'whitespace-nowrap overflow-hidden overflow-ellipsis',
tagWrapperBreak: 'whitespace-normal break-all',
tagRemove: 'flex items-center justify-center p-1 mx-0.5 rounded-sm hover:bg-black hover:bg-opacity-10 group',
tagRemoveIcon:
'bg-multiselect-remove bg-center bg-no-repeat opacity-30 inline-block w-3 h-3 group-hover:opacity-60',
tagsSearchWrapper: 'inline-block relative mx-1 flex-grow flex-shrink h-[24px]',
tagsSearch:
'absolute inset-0 border-0 outline-none focus:ring-0 appearance-none p-0 text-base font-sans box-border w-full h-full',
tagsSearchCopy: 'invisible whitespace-pre-wrap inline-block h-px',
placeholder:
'flex items-center h-full absolute left-0 top-0 pointer-events-none bg-transparent leading-snug pl-3.5 text-gray-400 rtl:left-auto rtl:right-0 rtl:pl-0 rtl:pr-3.5',
caret: 'multiselect-caret bg-center bg-no-repeat w-2.5 h-4 py-px box-content mr-3.5 relative z-10 flex-shrink-0 flex-grow-0 transition-transform transform pointer-events-none rtl:mr-0 rtl:ml-3.5',
caretOpen: 'rotate-180 pointer-events-auto',
clear: 'pr-3.5 relative z-10 transition duration-300 flex-shrink-0 flex-grow-0 flex hover:opacity-80 rtl:pr-0 rtl:pl-3.5',
clearIcon: 'multiselect-clear-icon bg-center bg-no-repeat w-2.5 h-4 py-px box-content inline-block',
spinner:
'bg-multiselect-spinner bg-center bg-no-repeat w-4 h-4 z-10 mr-3.5 animate-spin flex-shrink-0 flex-grow-0 rtl:mr-0 rtl:ml-3.5',
infinite: 'flex items-center justify-center w-full',
infiniteSpinner:
'bg-multiselect-spinner bg-center bg-no-repeat w-4 h-4 z-10 animate-spin flex-shrink-0 flex-grow-0 m-3.5',
dropdown:
'max-h-60 absolute -left-px -right-px bottom-0 transform translate-y-full border border-gray-300 -mt-px overflow-y-scroll z-50 bg-base-100 flex flex-col rounded-b',
dropdownTop: '-translate-y-full top-px bottom-auto rounded-b-none rounded-t',
dropdownHidden: 'hidden',
options: 'flex flex-col p-0 m-0 list-none',
optionsTop: '',
group: 'p-0 m-0',
groupLabel:
'flex text-sm box-border items-center justify-start text-left py-1 px-3 font-bold bg-gray-200 cursor-default leading-normal',
groupLabelPointable: 'cursor-pointer',
groupLabelPointed: 'bg-gray-300 text-gray-700',
groupLabelSelected: 'bg-accent text-my-text',
groupLabelDisabled: 'bg-gray-100 text-gray-300 cursor-not-allowed',
groupLabelSelectedPointed: 'bg-accent text-my-text opacity-90',
groupLabelSelectedDisabled: 'text-green-100 bg-green-600 bg-opacity-50 cursor-not-allowed',
groupOptions: 'p-0 m-0',
option: 'flex items-center justify-start box-border text-left cursor-pointer text-base leading-snug py-2 px-3',
optionPointed: 'text-gray-800 bg-secondary',
optionSelected: 'text-my-text bg-accent',
optionDisabled: 'text-gray-300 cursor-not-allowed',
optionSelectedPointed: 'text-my-text bg-link-hover',
optionSelectedDisabled: 'text-green-100 bg-green-500 bg-opacity-50 cursor-not-allowed',
noOptions: 'py-2 px-3 text-gray-600 bg-base-100 text-left rtl:text-right',
noResults: 'py-2 px-3 text-gray-600 bg-base-100 text-left rtl:text-right',
fakeInput:
'bg-transparent absolute left-0 right-0 -bottom-px w-full h-px border-0 p-0 appearance-none outline-none text-transparent',
assist: 'absolute -m-px w-px h-px overflow-hidden',
spacer: 'h-6 py-px box-content',
}
return {
multiSelectClasses,
}
}

47
frontend/docs/README.md Normal file
View File

@ -0,0 +1,47 @@
# ffplayout
> web GUI for ffplayout engine
# Nuxt 3 Minimal Starter
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install the dependencies:
```bash
# yarn
yarn install
# npm
npm install
# pnpm
pnpm install --shamefully-hoist
```
## Development Server
Start the development server on http://localhost:3000
```bash
npm run dev
```
## Production
Build the application for production:
```bash
npm run build
```
Locally preview production build:
```bash
npm run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

43
frontend/error.vue Normal file
View File

@ -0,0 +1,43 @@
<template>
<NuxtLayout>
<div class="w-full h-full flex justify-center items-center mt-20">
<div v-if="props.error?.statusCode === 404">
<h1 class="text-center text-6xl">404</h1>
<p class="text-center font-bold mt-6">
{{ $t('error.notFound') }}
</p>
</div>
<div v-else-if="props.error?.statusCode === 500">
<h1 class="text-center text-6xl">{{ props.error.statusCode }}</h1>
<p class="text-center font-bold mt-6">
{{ $t('error.serverError') }}
</p>
</div>
</div>
</NuxtLayout>
</template>
<script setup lang="ts">
import type { NuxtError } from '#app'
const localePath = useLocalePath()
const props = defineProps({
error: {
type: Object,
default: {} as NuxtError,
},
})
// onMounted(() => {
// const statusCode = props.error?.statusCode || 400
// if (statusCode >= 400) {
// setTimeout(() => {
// reloadNuxtApp({
// path: localePath({ name: 'index' }),
// ttl: 1000,
// })
// }, 3000)
// }
// })
</script>

View File

@ -0,0 +1,22 @@
import withNuxt from './.nuxt/eslint.config.mjs'
export default withNuxt(
// your custom flat configs go here, for example:
// {
// files: ['**/*.ts', '**/*.tsx'],
// rules: {
// 'no-console': 'off' // allow console.log in TypeScript files
// }
// },
// {
// ...
// }
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-control-regex': 'off',
'vue/html-self-closing': 'off',
'vue/no-v-html': 'off',
},
}
)

View File

@ -0,0 +1,44 @@
## Add Language
You are very welcome to add more languages! Just copy en-US.js to the correct target Country code and modify the content.
When you are done with the translation add the filename to [nuxt.config.ts](../nuxt.config.ts), in section:
```DIFF
i18n: {
locales: [
{
code: 'de',
name: 'Deutsch',
file: 'de-DE.js',
},
{
code: 'en',
name: 'English',
file: 'en-US.js',
},
+ {
+ code: '<SHORT CODE>',
+ name: '<NAME>',
+ file: '<CODE>.js',
+ },
],
...
```
And also add the new link paths:
```DIFF
i18n: {
locales: [...],
...
pages: {
'player': {
de: '/wiedergabe',
en: '/player',
+ <CODE>: /<PATH>,
},
...
```

View File

@ -0,0 +1,228 @@
export default {
ok: 'Ok',
cancel: 'Abbrechen',
socketConnected: 'Event Stream verbunden',
socketDisconnected: 'Event Stream nicht verbunden',
alert: {
wrongLogin: 'Falsche Anmeldedaten!',
},
button: {
login: 'Anmelden',
home: 'Start',
player: 'Wiedergabe',
media: 'Medien',
message: 'Nachrichten',
logging: 'Protokollierung',
channels: 'Kanäle',
configure: 'Einstellungen',
logout: 'Abmelden',
},
error: {
notFound: 'Seite nicht gefunden',
serverError: 'Interner Server Fehler',
},
input: {
username: 'Benutzername',
password: 'Passwort',
},
system: {
cpu: 'CPU',
cores: 'Kerne',
load: 'Auslastung',
memory: 'Arbeitsspeicher',
swap: 'Auslagerungsspeicher',
total: 'Gesamt',
usage: 'Verwendung',
network: 'Netzwerk',
in: 'Eingehend',
out: 'Ausgehend',
storage: 'Speicher',
device: 'Gerät',
size: 'Größe',
used: 'Genutzt',
},
control: {
noClip: 'Es wird kein Clip abgespielt',
ingest: 'Live-Übertragung',
start: 'Playout-Dienst starten',
last: 'Zum letzten Clip springen',
stop: 'Playout-Dienst stoppen',
reset: 'Playout-Zustand zurücksetzen',
restart: 'Playout-Dienst neu starten',
next: 'Zum nächsten Clip springen',
},
player: {
start: 'Start',
file: 'Datei',
play: 'Abspielen',
title: 'Titel',
duration: 'Dauer',
in: 'Eingang',
out: 'Ausgang',
ad: 'Werbung',
edit: 'Bearbeiten',
delete: 'Löschen',
copy: 'Wiedergabeliste kopieren',
loop: 'Clips in {date} Wiedergabeliste wiederholen',
remote: 'Externe Quelle zur Wiedergabeliste hinzufügen',
import: 'Text-/m3u-Datei importieren',
generate: 'Einfacher und erweiterter Wiedergabelisten-Generator',
reset: 'Wiedergabeliste zurücksetzen',
save: 'Wiedergabeliste speichern',
deletePlaylist: 'Wiedergabeliste löschen',
unsavedProgram: 'Es existiert Programm das nicht gespeichert ist!',
copyTo: 'Kopiere aktuelles Programm nach',
addEdit: 'Quelle hinzufügen/bearbeiten',
audio: 'Audio',
customFilter: 'Benutzerdefinierter Filter',
deleteFrom: 'Programm löschen von',
deleteSuccess: 'Wiedergabeliste gelöscht...',
generateProgram: 'Programm generieren',
simple: 'Einfach',
advanced: 'Erweitert',
sorted: 'Sortiert',
shuffle: 'Zufall',
shift: 'Zeitverschiebung',
all: 'Alle',
addBlock: 'Zeitblock hinzufügen',
infinitInfo: 'Die Wiedergabe läuft im unendlichen Modus. Es sind keine zeitbasierten Informationen möglich.',
generateDone: 'Wiedergabeliste generieren erledigt...',
dateYesterday: 'Aktuelle Uhrzeit liegt vor der Playlist-Startzeit!',
},
media: {
notExists: 'Speicher existiert nicht!',
create: 'Ordner erstellen',
upload: 'Dateien hochladen',
deleteTitle: 'Datei/Ordner löschen',
deleteQuestion: 'Sind Sie sicher, dass Sie löschen möchten',
preview: 'Vorschau',
rename: 'Datei umbenennen',
newFile: 'Neuer Dateiname',
createFolder: 'Ordner erstellen',
foldername: 'Ordnername',
current: 'Aktuell',
overall: 'Insgesamt',
uploading: 'Hochladen',
moveError: 'Fehler beim Verschieben',
deleteError: 'Löschfehler',
folderExists: 'Ordner existiert bereits',
folderCreate: 'Ordner erstellen abgeschlossen...',
folderError: 'Fehler beim Erstellen des Ordners',
uploadError: 'Fehler beim Hochladen',
fileExists: 'Datei existiert bereits!',
},
message: {
savePreset: 'Voreinstellung speichern',
newPreset: 'Neue Voreinstellung',
delPreset: 'Voreinstellung löschen',
delText: 'Sind Sie sicher, dass Sie die Voreinstellung löschen möchten',
placeholder: 'Nachricht',
xAxis: 'X-Achse',
yAxis: 'Y-Achse',
showBox: 'Box anzeigen',
boxColor: 'Boxfarbe',
boxAlpha: 'Box-Transparenz',
size: 'Größe',
spacing: 'Abstand',
overallAlpha: 'Gesamttransparenz',
fontColor: 'Schriftfarbe',
fontAlpha: 'Schrifttransparenz',
borderWidth: 'Rahmenbreite',
send: 'Senden',
name: 'Name',
saveDone: 'Voreinstellung gespeichert!',
saveFailed: 'Voreinstellung speichern fehlgeschlagen!',
sendDone: 'Erfolgreich gesendet...',
sendFailed: 'Senden fehlgeschlagen...',
},
log: {
download: 'Protokoll herunterladen',
},
advanced: {
title: 'Advanced Configuration',
decoder: 'Decoder',
encoder: 'Encoder',
filter: 'Filter',
ingest: 'Ingest',
updateSuccess: 'Update advanced config success!',
updateFailed: 'Update advanced config failed!',
warning: 'Warning! These settings are experimental and only intended for advanced users who are familiar with ffmpeg. Only change the settings here if you are sure of what you are doing! The settings can make the system unstable.',
},
config: {
channel: 'Kanal',
user: 'Benutzer',
channelConf: 'Kanal-Konfiguration',
addChannel: 'Neuen Kanal hinzufügen',
name: 'Name',
previewUrl: 'Vorschau-URL',
extensions: 'Zusätzliche Erweiterungen',
save: 'Speichern',
delete: 'Löschen',
updateChannelSuccess: 'Kanal-Konfiguration erfolgreich aktualisiert!',
updateChannelFailed: 'Fehler beim Aktualisieren der Kanal-Konfiguration!',
errorChannelDelete: 'Der erste Kanal kann nicht gelöscht werden!',
deleteChannelSuccess: 'Kanal-Konfiguration erfolgreich gelöscht!',
deleteChannelFailed: 'Fehler beim Löschen der Kanal-Konfiguration!',
playoutConf: 'Playout-Konfiguration',
general: 'Allgemein',
rpcServer: 'RPC Server',
mail: 'EMail',
logging: 'Protokollierung',
processing: 'Verarbeitung',
ingest: 'Live-Eingang',
playlist: 'Wiedergabeliste',
storage: 'Speicher',
text: 'Text',
task: 'Aufgabe',
output: 'Ausgabe',
placeholderPass: 'Passwort',
help: 'Hilfe',
generalText: `Manchmal kann es vorkommen, dass eine Datei beschädigt, aber noch abspielbar ist, was einen Streaming-Fehler bei allen folgenden Dateien verursachen kann. Die einzige Möglichkeit, dies zu beheben, besteht darin, ffplayout anzuhalten und neu zu starten. Wir sagen hier nur, wann es gestoppt werden muss, der Startvorgang ist Ihnen überlassen. Der beste Weg ist ein systemd-Dienst unter Linux.
'stop_threshold' wird ffplayout stoppen, wenn es zeitlich über diesem Wert liegt. Eine Zahl kleiner als 3 kann zu unerwarteten Fehlern führen.`,
rpcText:
'Führe einen JSON-RPC-Server aus, um Informationen über die Wiedergabe und einige Kontrollfunktionen zu erhalten.',
mailText: `Senden Sie Fehlermeldungen an die E-Mail-Adresse, z. B. fehlende Playlist, ungültiges json-Format, fehlender Clip-Pfad. Lassen Sie den Empfänger leer, wenn Sie keine Benachrichtigung benötigen. 'mail_level' kann INFO, WARNING oder ERROR sein. 'interval' bedeutet Sekunden, bis eine neue E-Mail gesendet wird.`,
logText: `Wenn 'log_to_file' true ist, wird in eine Datei protokolliert, wenn false, in die Konsole. 'local_time' auf false setzt die Log-Zeitstempel auf UTC. Pfad zu /var/log/ nur, wenn Sie dies als Daemon ausführen.
'level' kann DEBUG, INFO, WARNING, ERROR sein. 'ffmpeg_level' kann INFO, WARNING, ERROR sein. 'detect_silence' protokolliert eine Fehlermeldung, wenn die Audiospur während des Validierungsprozesses 15 Sekunden lang still ist.`,
processingText: `Standardverarbeitung für alle Clips, um sie einheitlich zu machen. Modus kann "playlist" oder "folder" sein. 'aspect' muss eine Fließkommazahl sein. 'logo' wird nur verwendet, wenn der Pfad existiert.
'logo_scale' skaliert das Logo auf die Zielgröße, leer lassen, wenn keine Skalierung erforderlich ist, Format ist 'width:height', zum Beispiel '100:-1' für proportionale Skalierung. Mit 'logo_opacity' können Sie das Logo transparent machen.
Mit 'audio_tracks' kann man einstellen, wie viele Audiospuren verarbeitet werden sollen. 'audio_channels' kann verwendet werden, wenn das Audio mehr Kanäle als nur Stereo hat. Mit 'logo_position' im Format 'x:y' wird die Position des Logos festgelegt. Mit 'custom_filter' ist es möglich, zusätzliche Filter anzuwenden. Die Filterausgänge sollten mit [c_v_out] für Videofilter und [c_a_out] für Audiofilter enden.`,
ingestText: `Startet einen Server für einen Live-Eingangsstream. Dieser Stream hat Vorrang vor dem normalen Streaming, bis er fertig ist. Es gibt nur einen sehr einfachen Authentifizierungsmechanismus, um zu prüfen, ob der Streamname korrekt ist. 'custom_filter' kann auf die gleiche Weise wie im Abschnitt Verarbeitung verwendet werden.`,
playlistText: `'path' kann ein Pfad zu einer einzelnen Datei oder einem Verzeichnis sein. Bei Verzeichnissen geben Sie nur das Stammverzeichnis an, z. B. '/playlists', Unterverzeichnisse werden vom Program gelesen. Unterverzeichnisse benötigen diese Struktur '/playlists/2018/01'.
'day_start' ist die Uhrzeit, zu der die Wiedergabeliste beginnen soll; lassen Sie 'day_start' leer, wenn die Wiedergabeliste immer am Anfang beginnen soll. 'length' steht für die Ziellänge der Wiedergabeliste; wenn leer, wird die tatsächliche Länge nicht berücksichtigt. 'infinit: true' arbeitet mit einer einzelnen Wiedergabelistendatei und spielt diese in einer Endlosschleife.`,
storageText: `Spielt geordnete oder zufällige Dateien aus dem Pfad ab. 'filler_clip' ist zum Füllen des Endes, um 24 Stunden zu erreichen, es wird eine Schleife abgespielt, wenn nötig. Setzen Sie 'extensions', um nur nach Dateien mit dieser Erweiterung zu suchen. Setzen Sie 'shuffle' auf 'true', um Dateien zufällig auszuwählen.`,
textText: `Überlagernder Text in Kombination mit libzmq für die Remote-Textmanipulation. Unter Windows muss der Pfad der Schriftartdatei 'C\\:/WINDOWS/fonts/DejaVuSans.ttf' sein. 'text_from_filename' aktiviert die Textextraktion aus einem Dateinamen. Mit 'style' können Sie die Zeichentext-Parameter wie Position, Farbe, etc. festlegen. Post Text via API wird dies überschreiben. Mit 'regex' können Sie den Dateinamen formatieren, um einen Titel zu erhalten.`,
taskText: `Führt ein externes Programm mit einem bestimmten Medienobjekt aus. Das Medienobjekt liegt im json-Format vor und enthält alle Informationen über den aktuellen Clip. Das externe Programm kann ein Skript oder eine Binärdatei sein. oder eine Binärdatei, sollte aber nur für kurze Zeit laufen.`,
outputText: `Die endgültige Playout-Kompression. Passen Sie die Einstellungen entsprechend Ihren Bedürfnissen an. 'mode' hat die Optionen 'desktop', 'hls', 'null', 'stream'. Verwenden Sie 'stream' und passen Sie die 'output_param:'-Einstellungen an, wenn Sie zu einem rtmp/rtsp/srt/... Server streamen wollen. In der Produktion sollten Sie die hls-Wiedergabeliste nicht mit ffpapi ausliefern, sondern nginx oder einen anderen Webserver verwenden!`,
restartTile: 'Playout neustarten',
restartText: 'ffplayout neustarten um Einstellungen anzuwenden?',
updatePlayoutSuccess: 'Update der Playout-Konfiguration erfolgreich!',
updatePlayoutFailed: 'Update playout config fehlgeschlagen!',
forbiddenPlaylistPath: 'Zugriff untersagt: Playlist-Ordner kann nicht geöffnet werden.',
noPlayoutConfig: 'Keine Playout-Konfiguration gefunden!',
hlsPath: 'HLS-Pfad',
playlistPath: 'Wiedergabelistenpfad',
storagePath: 'Speicherpfad',
sharedStorage: 'Gemeinsamer Speicher ist aktiviert, verwende denselben Speicherstamm für alle Kanäle!',
},
user: {
title: 'Benutzer-Konfiguration',
add: 'Benutzer hinzufügen',
delete: 'Löschen',
name: 'Benutzername',
mail: 'E-Mail',
password: 'Passwort',
newPass: 'Neues Passwort',
confirmPass: 'Passwort bestätigen',
save: 'Speichern',
admin: 'Administrator',
deleteNotPossible: 'Löschen des aktuellen Benutzers nicht möglich!',
deleteSuccess: 'Benutzer erfolgreich gelöscht!',
deleteError: 'Fehler beim Löschen des Benutzers',
addSuccess: 'Benutzer erfolgreich hinzugefügt!',
addFailed: 'Fehler beim Hinzufügen des Benutzers!',
mismatch: 'Passwort stimmt nicht überein!',
updateSuccess: 'Benutzerprofil erfolgreich aktualisiert!',
updateFailed: 'Fehler beim Aktualisieren des Benutzerprofils!',
},
}

View File

@ -0,0 +1,227 @@
export default {
ok: 'Ok',
cancel: 'Cancel',
socketConnected: 'Event stream connected',
socketDisconnected: 'Event stream disconnected',
alert: {
wrongLogin: 'Incorrect login data!',
},
button: {
login: 'Login',
home: 'Home',
player: 'Player',
media: 'Media',
message: 'Message',
logging: 'Logging',
channels: 'Channels',
configure: 'Configure',
logout: 'Logout',
},
error: {
notFound: 'Page not found',
serverError: 'Internal server error',
},
input: {
username: 'Username',
password: 'Password',
},
system: {
cpu: 'CPU',
cores: 'Cores',
load: 'Load',
memory: 'Memory',
swap: 'Swap',
total: 'Total',
usage: 'Usage',
network: 'Network',
in: 'In',
out: 'Out',
storage: 'Storage',
device: 'Device',
size: 'Size',
used: 'Used',
},
control: {
noClip: 'No clip is playing',
ingest: 'Live Ingest',
start: 'Start Playout Service',
last: 'Jump to last Clip',
stop: 'Stop Playout Service',
reset: 'Reset Playout State',
restart: 'Restart Playout Service',
next: 'Jump to next Clip',
},
player: {
start: 'Start',
file: 'File',
play: 'Play',
title: 'Title',
duration: 'Duration',
in: 'In',
out: 'Out',
ad: 'Ad',
edit: 'Edit',
delete: 'Delete',
copy: 'Copy Playlist',
loop: 'Loop Clips in Playlist',
remote: 'Add (remote) Source to Playlist',
import: 'Import text/m3u file',
generate: 'Simple and advanced playlist generator',
reset: 'Reset Playlist',
save: 'Save Playlist',
deletePlaylist: 'Delete Playlist',
unsavedProgram: 'There is a program that is not saved!',
copyTo: 'Copy current Program to',
addEdit: 'Add/Edit Source',
audio: 'Audio',
customFilter: 'Custom Filter',
deleteFrom: 'Delete program from',
deleteSuccess: 'Playlist deleted...',
generateProgram: 'Generate Program',
simple: 'Simple',
advanced: 'Advanced',
sorted: 'Sorted',
shuffle: 'Shuffle',
shift: 'Shift',
all: 'All',
addBlock: 'Add time block',
infinitInfo: 'Playout runs in infinite mode. No time based information is possible.',
generateDone: 'Generate Playlist done...',
dateYesterday: 'Current time is before the playlist start time!',
},
media: {
notExists: 'Storage not exist!',
create: 'Create Folder',
upload: 'Upload Files',
deleteTitle: 'Delete File/Folder',
deleteQuestion: 'Are you sure that you want to delete',
preview: 'Preview',
rename: 'Rename File',
newFile: 'New filename',
createFolder: 'Create Folder',
foldername: 'Foldername',
current: 'Current',
overall: 'Overall',
uploading: 'Uploading',
moveError: 'Move error',
deleteError: 'Delete error',
folderExists: 'Folder exists already',
folderCreate: 'Folder create done...',
folderError: 'Folder create error',
uploadError: 'Upload error',
fileExists: 'File exists already!',
},
message: {
savePreset: 'Save Preset',
newPreset: 'New Preset',
delPreset: 'Delete Preset',
delText: 'Are you sure that you want to delete preset',
placeholder: 'Message',
xAxis: 'X Axis',
yAxis: 'Y Axis',
showBox: 'Show Box',
boxColor: 'Box Color',
boxAlpha: 'Box Alpha',
size: 'Size',
spacing: 'Spacing',
overallAlpha: 'Overall Alpha',
fontColor: 'Font Color',
fontAlpha: 'Font Alpha',
borderWidth: 'Border Width',
send: 'Send',
name: 'Name',
saveDone: 'Save Preset done!',
saveFailed: 'Save Preset failed!',
sendDone: 'Sending success...',
sendFailed: 'Sending failed...',
},
log: {
download: 'Download log file',
},
advanced: {
title: 'Advanced Configuration',
decoder: 'Decoder',
encoder: 'Encoder',
filter: 'Filter',
ingest: 'Ingest',
updateSuccess: 'Update advanced config success!',
updateFailed: 'Update advanced config failed!',
warning: 'Warning! These settings are experimental and only intended for advanced users who are familiar with ffmpeg. Only change the settings here if you are sure of what you are doing! The settings can make the system unstable.',
},
config: {
channel: 'Channel',
user: 'User',
channelConf: 'Channel Configuration',
addChannel: 'Add new Channel',
name: 'Name',
previewUrl: 'Preview URL',
extensions: 'Extra Extensions',
save: 'Save',
delete: 'Delete',
updateChannelSuccess: 'Update channel config success!',
updateChannelFailed: 'Update channel config failed!',
errorChannelDelete: 'First channel can not be deleted!',
deleteChannelSuccess: 'Delete channel config success!',
deleteChannelFailed: 'Delete channel config failed!',
playoutConf: 'Playout Configuration',
general: 'General',
rpcServer: 'RPC Server',
mail: 'Email',
logging: 'Logging',
processing: 'Processing',
ingest: 'Ingest',
playlist: 'Playlist',
storage: 'Storage',
text: 'Text',
task: 'Task',
output: 'Output',
placeholderPass: 'Password',
help: 'Help',
generalText: `Sometimes it can happen that a file is corrupted but still playable, this can cause a streaming error on all following files. The only way to fix this is to stop and restart ffplayout. Here we only say when to stop, the starting process is up to you. The best way is a systemd service on Linux.
'stop_threshold' will stop ffplayout if it is async in time above this value. A number less than 3 may cause unexpected errors.`,
rpcText: 'Run a JSON RPC server to get information about what is playing and for some control functions.',
mailText: `Send error messages to the email address, such as missing playlist; invalid json format; missing clip path. Leave the recipient blank if you don't need it. 'mail_level' can be INFO, WARNING or ERROR. 'interval' means seconds until a new mail is sent.`,
logText: `If 'log_to_file' is true, log to file, if false, log to console. 'local_time' to false will set log timestamps to UTC. Path to /var/log/ only if you are running this as a daemon.
'level' can be DEBUG, INFO, WARNING, ERROR. 'ffmpeg_level' can be INFO, WARNING, ERROR. 'detect_silence' logs an error message if the audio line is silent for 15 seconds during the validation process.`,
processingText: `Default processing for all clips to make them unique. Mode can be Playlist or Folder. 'aspect' must be a float number. 'logo' is only used if the path exists.
'logo_scale' scales the logo to the target size, leave empty if no scaling is needed, format is 'width:height', for example '100:-1' for proportional scaling. With 'logo_opacity' you can make the logo transparent.
With 'audio_tracks' it is possible to configure how many audio tracks should be processed. 'audio_channels' can be used if the audio has more channels than just stereo. With 'logo_position' in 'x:y' format you set the logo position. With 'custom_filter' it is possible to apply additional filters. The filter outputs should end with [c_v_out] for video filters and [c_a_out] for audio filters.`,
ingestText: `Run a server for an ingest stream. This stream will override the normal streaming until it is done. There is only a very simple authentication mechanism to check if the stream name is correct. 'custom_filter' can be used in the same way as in the process section.`,
playlistText: `'path' can be a path to a single file or a directory. For directory specify only the root folder, for example '/playlists', subdirectories will be read by the program. Subdirectories need this structure '/playlists/2018/01'.
'day_start' is the time at which the playlist should start, leave 'day_start' empty if the playlist should always start at the beginning. 'length' represents the target length of the playlist, if empty, real length will not be considered. 'infinit: true' works with single playlist file and loops it infinitely.`,
storageText: `Play ordered or random files from path. 'filler_clip' is for filling the end to reach 24 hours, it will loop when necessary. Set 'extensions' to search only for files with that extension. Set 'shuffle' to 'true' to select files randomly.`,
textText: `Overlay text in combination with libzmq for remote text manipulation. On Windows, the font file path must be 'C\\:/WINDOWS/fonts/DejaVuSans.ttf'. 'text_from_filename' activates text extraction from a filename. With 'style' you can set the drawtext parameters like position, color, etc. Post Text via API will override this. With 'regex' you can format the filename to get a title.`,
taskText: `Run an external program with a given media object. The media object is in json format and contains all the information about the current clip. The external program can be a script or a binary. or a binary, but should only run for a short time.`,
outputText: `The final playout compression. Adjust the settings according to your needs. 'mode' has the options 'desktop', 'hls', 'null', 'stream'. Use 'stream' and adjust the 'output_param:' settings if you want to stream to an rtmp/rtsp/srt/... server. In production don't serve hls playlist with ffpapi, use nginx or another web server!`,
restartTile: 'Restart Playout',
restartText: 'Restart ffplayout to apply changes?',
updatePlayoutSuccess: 'Update playout config success!',
updatePlayoutFailed: 'Update playout config failed!',
forbiddenPlaylistPath: 'Access forbidden: Playlist folder cannot be opened.',
noPlayoutConfig: 'No playout config found!',
hlsPath: 'HLS Path',
playlistPath: 'Playlist Path',
storagePath: 'Storage Path',
sharedStorage: 'Shared storage is enabled, use the same storage root for all channels!',
},
user: {
title: 'User Configuration',
add: 'Add User',
delete: 'Delete',
name: 'Username',
mail: 'Email',
password: 'Password',
newPass: 'New Password',
confirmPass: 'Confirm Password',
save: 'Save',
admin: 'Admin',
deleteNotPossible: 'Delete current user not possible!',
deleteSuccess: 'Delete user done!',
deleteError: 'Delete user error',
addSuccess: 'Add user success!',
addFailed: 'Add user failed!',
mismatch: 'Password mismatch!',
updateSuccess: 'Update user profile success!',
updateFailed: 'Update user profile failed!',
},
}

View File

@ -0,0 +1,227 @@
export default {
ok: 'Ok',
cancel: 'Cancelar',
socketConnected: 'Aviso! stream conectada.',
socketDisconnected: 'Aviso! stream desconectado.',
alert: {
wrongLogin: 'Dados incorretos!',
},
button: {
login: 'Logar',
home: 'Início',
player: 'Player',
media: 'Armazenamento',
message: 'Legenda',
logging: 'Registro',
channels: 'Canais',
configure: 'Configurar',
logout: 'Sair',
},
error: {
notFound: 'Página não encontrada',
serverError: 'Erro do servidor interno',
},
input: {
username: 'Usuário',
password: 'Senha',
},
system: {
cpu: 'CPU',
cores: 'Núcleos',
load: 'Carga de CPU',
memory: 'Memória',
swap: 'Swap',
total: 'Total',
usage: 'Uso',
network: 'Rede',
in: 'Entrada',
out: 'Saída',
storage: 'Armazenamento',
device: 'Dispositivo',
size: 'Tamanho total',
used: 'Disponível',
},
control: {
noClip: 'Nenhum clipe está sendo reproduzido',
ingest: 'Ingestão ao Vivo',
start: 'Iniciar Serviço do Playout',
last: 'Ir para o último Clipe',
stop: 'Parar Serviço do Playout',
reset: 'Redefinir Estado do Playout',
restart: 'Reiniciar Serviço do Playout',
next: 'Ir para o próximo Clipe',
},
player: {
start: 'Horário',
file: 'Arquivo',
play: 'Play',
title: 'Título',
duration: 'Duração',
in: 'Início',
out: 'Fim',
ad: 'Ad',
edit: 'Editar',
delete: 'Deletar',
copy: 'Copiar playlist',
loop: 'Repetir Clipes na Playlist',
remote: 'Adicionar fonte (remota) à Playlist',
import: 'Importar arquivo de texto/.m3u8',
generate: 'Gerador de Playlist simples e avançado',
reset: 'Resetar Playlist',
save: 'Salvar Playlist',
deletePlaylist: 'Deletar Playlist',
unsavedProgram: 'Existe uma Programação que não está salva!',
copyTo: 'Copiar Programação atual para',
addEdit: 'Adicionar/Editar Fonte',
audio: 'Áudio',
customFilter: 'Filtro Personalizado',
deleteFrom: 'Excluir programação de',
deleteSuccess: 'Lista de reprodução excluída...',
generateProgram: 'Gerar Programação',
simple: 'Simples',
advanced: 'Avançado',
sorted: 'Ordenado',
shuffle: 'Aleatório',
shift: 'Diferença horária',
all: 'Todos',
addBlock: 'Adicionar bloco de tempo',
infinitInfo: 'O playout é executado no modo infinito. Nenhuma informação baseada em tempo é possível',
generateDone: 'Gerar lista de reprodução concluída...',
dateYesterday: 'A hora atual é anterior à hora de início da lista de reprodução!',
},
media: {
notExists: 'O armazenamento não existe!',
create: 'Criar Pasta',
upload: 'Enviar Arquivos',
deleteTitle: 'Deletar Arquivo/Pasta',
deleteQuestion: 'Tem certeza que deseja deletar?',
preview: 'Visualizar',
rename: 'Renomear Arquivo',
newFile: 'Novo nome de arquivo',
createFolder: 'Criar Pasta',
foldername: 'Nome da Pasta',
current: 'Atual',
overall: 'Total',
uploading: 'Enviando',
moveError: 'Erro ao mover',
deleteError: 'Erro ao deletar!',
folderExists: 'A pasta já existe',
folderCreate: 'Criação da pasta concluída...',
folderError: 'Erro ao criar pasta',
uploadError: 'Erro ao carregar',
fileExists: 'O arquivo já existe!',
},
message: {
savePreset: 'Salvar predefinição',
newPreset: 'Nova predefinição',
delPreset: 'Excluir predefinição',
delText: 'Tem certeza de que deseja excluir a predefinição?',
placeholder: 'Mensagem',
xAxis: 'Eixo X',
yAxis: 'Eixo Y',
showBox: 'Mostrar caixa',
boxColor: 'Cor da caixa',
boxAlpha: 'Caixa Alfa',
size: 'Tamanho',
spacing: 'Espaçamento',
overallAlpha: 'Alfa geral',
fontColor: 'Cor da fonte',
fontAlpha: 'Fonte Alfa',
borderWidth: 'Largura da borda',
send: 'Enviar',
name: 'Nome',
saveDone: 'Salvar predefinição concluída!',
saveFailed: 'Falha ao salvar a predefinição!',
sendDone: 'Enviando com sucesso...',
sendFailed: 'O envio falhou...',
},
log: {
download: 'Baixar arquivo de registro',
},
advanced: {
title: 'Configurações avançadas',
decoder: 'Decoder',
encoder: 'Encoder',
filter: 'Filter',
ingest: 'Ingest',
updateSuccess: 'Configurações avançadas salva!',
updateFailed: 'Configurações avançadas foi falhado!',
warning: 'Aviso! Essas configurações são experimentais e destinadas apenas a usuários avançados familiarizados com o ffmpeg. Altere as configurações aqui apenas se tiver certeza do que está fazendo! As configurações podem tornar o sistema instável.',
},
config: {
channel: 'Canal',
user: 'Usuário',
channelConf: 'Configuração do Canal',
addChannel: 'Adicionar novo Canal',
name: 'Nome',
previewUrl: 'URL de Visualização',
extensions: 'Extensões Extras',
save: 'Salvar',
delete: 'Deletar',
updateChannelSuccess: 'Atualização da configuração do canal bem-sucedida!',
updateChannelFailed: 'Falha na atualização da configuração do canal!',
errorChannelDelete: 'O primeiro canal não pode ser deletado!',
deleteChannelSuccess: 'Exclusão da configuração da canal bem-sucedida!',
deleteChannelFailed: 'Falha na exclusão da configuração da canal!',
playoutConf: 'Configuração de Playout',
general: 'Geral',
rpcServer: 'RPC Server',
mail: 'Email',
logging: 'Registro',
processing: 'Processamento',
ingest: 'Ingestão',
playlist: 'Playlist',
storage: 'Armazenamento',
text: 'Texto',
task: 'Tarefa',
output: 'Saída',
placeholderPass: 'Senha',
help: 'Ajuda',
generalText: `Às vezes pode acontecer que um arquivo esteja corrompido mas ainda assim ele pode ser reproduzido, isso pode causar um erro de transmissão em todos os arquivos seguintes. A única maneira de corrigir isso é parar e reiniciar o ffplayout. Aqui só dizemos quando parar, o processo de início é por sua conta. A melhor maneira é um serviço systemd no Linux.
'stop_threshold' vai parar o ffplayout se estiver assíncrono em um tempo acima deste valor. Um número menor que 3 pode causar erros inesperados.`,
rpcText: 'Execute um servidor JSON RPC para obter informações sobre o que está sendo reproduzido e para algumas funções de controle.',
mailText: `Envie mensagens de erro para o endereço de email, como lista de reprodução faltando; formato JSON inválido; caminho do clipe ausente. Deixe o destinatário em branco se não for necessário. 'mail_level' pode ser INFO, WARNING ou ERROR. 'interval' é o tempo em segundos até que um novo e-mail seja enviado.`,
logText: `Se 'log_to_file' estiver ativado (true), o registro de log será salvo em um arquivo de texto, e se desativado (false), registrará o log no console. Se 'local_time' estiver desativado (false) o sistema definirá os carimbos de data/hora do registro para UTC. Defina o caminho para /var/log/ apenas se você estiver executando o programa como daemon.
'level' pode ser DEBUG, INFO, WARNING, ERROR. 'ffmpeg_level' pode ser INFO, WARNING, ERROR. 'detect_silence' registra uma mensagem de erro se a linha de áudio ficar silenciosa por 15 segundos durante o processo de validação.`,
processingText: `Processamento padrão para todos os clipes para torná-los únicos. O modo ('mode') pode ser Playlist ou Folder. 'aspect' deve ser um número de ponto flutuante. 'logo' é usado apenas se o caminho existir.
'logo_scale' dimensiona o logo para o tamanho desejado, deixe esse campo de configuração vazio se nenhum dimensionamento for necessário, o formato é 'largura:altura', por exemplo '100:-1' para dimensionamento proporcional. Com 'logo_opacity' você pode tornar o logo transparente.
Com 'audio_tracks' é possível configurar quantas faixas de áudio devem ser processadas. 'audio_channels' pode ser usado se o áudio tiver mais canais do que apenas estéreo. Com 'logo_position' no formato 'x:y' você define a posição do logo. Com 'custom_filter' é possível aplicar filtros adicionais. As saídas do filtro devem terminar com [c_v_out] para filtros de vídeo e [c_a_out] para filtros de áudio.`,
ingestText: `Execute um servidor de ingestão para poder receber um fluxo de stream a partir de uma fonte externa, como por exemplo um software de streaming como o OBS Studio. Este stream substituirá o streaming normal até que seja concluído. Existe apenas um mecanismo de autenticação muito simples para verificar se o nome do stream está correto. 'custom_filter' pode ser usado da mesma forma que na seção de processo.`,
playlistText: `'path' é o caminho para o arquivo de playlist. 'path' pode ser um caminho para um único arquivo ou um diretório. Se um diretório for especificado, defina apenas a pasta raiz desse diretório, por exemplo '/playlists', subdiretórios serão lidos pelo programa. Subdiretórios precisam seguir a seguinte estrutura de diretórios: '/playlists/2018/01'.
'day_start' é o horário fixo, inicial, em que a playlist será reproduzida, deixe 'day_start' vazio se a lista de reprodução sempre deve começar do início. 'length' representa a duração desejada da playlist, se vazio, a duração real não será considerada. 'infinit: true' funciona com um arquivo de lista de reprodução único e o repete infinitamente.`,
storageText: `Reproduza arquivos de mídia de maneira ordenada ou aleatória a partir de um caminho de diretório ('path') especificado. 'filler_clip' define um "clipe de preenchimento", cuja função é preencher a lacuna de tempo de uma playlist com duração inferior a 24 horas completas, esse clipe ou conjunto de clipes também será repetido quando algum arquivo de mídia não puder ser reproduzido, quando estiver indisponível ou se nenhuma playlist válida estiver sendo reproduzida. Defina 'extensions' para delimitar a busca interna de arquivos de mídia apenas por arquivos com a extensão adicionada. Defina 'shuffle' como 'true' para selecionar arquivos aleatoriamente.`,
textText: `Sobreponha texto (legenda) em combinação com o libzmq, para manipulação remota de texto. No Windows, o caminho do arquivo de fonte deve ser 'C\\:/WINDOWS/fonts/DejaVuSans.ttf'. 'text_from_filename' ativa a extração de texto (legenda) a partir de um arquivo de texto especificado. Com 'style' você pode definir os parâmetros drawtext como posição, cor, etc. Postar Texto via API irá substituir isso. Com 'regex' você pode formatar o nome do arquivo para obter um título.`,
taskText: `Execute um programa externo em conjunto com um determinado objeto de mídia. O objeto de mídia está no formato JSON e contém todas as informações sobre o clipe atual. O programa externo pode ser um script ou um binário. ou um binário, mas deve ser executado apenas por um curto período de tempo.`,
outputText: `A compressão final do stream gerado pelo playout. Ajuste as configurações de acordo com suas necessidades. 'mode' possui as opções 'desktop', 'hls', 'null', 'stream'. Use 'stream' e ajuste as configurações de 'output_param:' se você desejar retransmitir o stream para um servidor rtmp/rtsp/srt/... Em ambiente de produção não sirva a playlist hls com ffpapi, use nginx ou outro servidor web!`,
restartTile: 'Reiniciar Playout',
restartText: 'Reiniciar o ffplayout para aplicar as alterações?',
updatePlayoutSuccess: 'Sucesso na atualização da configuração do playout!',
updatePlayoutFailed: 'Falha na atualização da configuração do playout!',
forbiddenPlaylistPath: 'Acesso proibido: A pasta da lista de reprodução não pode ser aberta',
noPlayoutConfig: 'Nenhuma configuração de playout encontrada!',
hlsPath: 'HLS Path',
playlistPath: 'Playlist Path',
storagePath: 'Storage Path',
sharedStorage: 'O armazenamento compartilhado está ativado, use a mesma raiz de armazenamento para todos os canais',
},
user: {
title: 'Configuração de usuário',
add: 'Adicionar usuário',
delete: 'Deletar',
name: 'Nome de usuário',
mail: 'Email',
password: 'Senha',
newPass: 'Nova Senha',
confirmPass: 'Confirmar Senha',
save: 'Salvar',
admin: 'Administrador',
deleteNotPossible: 'Excluir o usuário atual não é possível!',
deleteSuccess: 'Usuário deletado com sucesso!',
deleteError: 'Erro ao deletar usuário',
addSuccess: 'Usuário adicionado com sucesso!',
addFailed: 'Falha ao adicionar usuário!',
mismatch: 'Senhas não coincidem!',
updateSuccess: 'Atualização do perfil do usuário bem-sucedida! ',
updateFailed: 'Atualização do perfil do usuário falhou!',
},
}

View File

@ -0,0 +1,227 @@
export default {
ok: 'ОК',
cancel: 'Отмена',
socketConnected: 'Event stream connected',
socketDisconnected: 'Event stream disconnected',
alert: {
wrongLogin: 'Неверные данные для входа!',
},
button: {
login: 'Логин',
home: 'Домашняя страница',
player: 'Плеер',
media: 'Файлы',
message: 'Сообщение',
logging: 'Логи',
channels: 'Каналы',
configure: 'Конфигурация',
logout: 'Выйти',
},
error: {
notFound: 'Страница не найдена',
serverError: 'Внутреняя серверная ошибка',
},
input: {
username: 'Логин',
password: 'Пароль',
},
system: {
cpu: 'Процессор',
cores: 'Ядра',
load: 'Нагрузка',
memory: 'Оперативная память',
swap: 'Swap',
total: 'Всего',
usage: 'Используется',
network: 'Интернет',
in: 'Прием',
out: 'Отдача',
storage: 'Хранилище',
device: 'Устройство',
size: 'Размер',
used: 'Использовано',
},
control: {
noClip: 'На данный момент ни один файл не воспроизводится',
ingest: 'Прямой эфир/Перехват эфира',
start: 'Запустить Playout Service',
last: 'Переключить на предыдущий файл',
stop: 'Остановить Playout Service',
reset: 'Сбросить Playout State',
restart: 'Перезапустить Playout Service',
next: 'Переключить на следующий файл',
},
player: {
start: 'Начало',
file: 'Файл',
play: 'Проиграть',
title: 'Название файла',
duration: 'Длительность',
in: 'Начало',
out: 'Конец',
ad: 'Реклама',
edit: 'Редактировать',
delete: 'Удалить',
copy: 'Скопировать плейлист',
loop: 'Повторить все видео в плейлисте',
remote: 'Добавить (удаленно) файл в плейлист',
import: 'Загрузить text/m3u файл',
generate: 'Простой и продвинутый генератор плейлистов',
reset: 'Сбросить плейлист',
save: 'Сохранить плейлист',
deletePlaylist: 'Удалить плейлист',
unsavedProgram: 'Этот плейлист не сохранен!',
copyTo: 'Скопировать текущую программу за',
addEdit: 'Добавить/Редактировать файл',
audio: 'Звук',
customFilter: 'Пользовательский фильтр',
deleteFrom: 'Удалить плейлист за',
deleteSuccess: 'Плейлист удален...',
generateProgram: 'Генерация плейлиста',
simple: 'Простой',
advanced: 'Расширенный',
sorted: 'Отсортировать',
shuffle: 'Перемещать/Перетасовать',
shift: 'Перемотка',
all: 'Все',
addBlock: 'Добавить время начало передачи',
infinitInfo: 'Воспроизведение работает в бесконечном режиме. Никакая информация, основанная на времени, невозможна.',
generateDone: 'Генерация плейлиста завершена...',
dateYesterday: 'Current time is before the playlist start time!',
},
media: {
notExists: 'Папки не существует!',
create: 'Сделать папку',
upload: 'Загрузить файлы',
deleteTitle: 'Удалить Файл/Папку',
deleteQuestion: 'Вы уверены что хотите это удалить',
preview: 'Просмотр',
rename: 'Переименовать файл',
newFile: 'Название нового файла',
createFolder: 'Сделать папку',
foldername: 'Имя папки',
current: 'Процесс загрузки',
overall: 'Всего',
uploading: 'Загружается',
moveError: 'Move error',
deleteError: 'Ошишка удаления',
folderExists: 'Папка уже имеется!',
folderCreate: 'Создание папки готово...',
folderError: 'Ошибка Создания папки',
uploadError: 'Ошибка Загрузки',
fileExists: 'Файл уже имеется!',
},
message: {
savePreset: 'Сохранить шаблон',
newPreset: 'Новый шаблон',
delPreset: 'Удалить шаблон',
delText: 'Вы уверены что хотите удалить шаблон',
placeholder: 'Текст',
xAxis: 'X Axis',
yAxis: 'Y Axis',
showBox: 'Текст с фоном',
boxColor: 'Цвет фона для текста',
boxAlpha: 'Прозрачность фона для текста',
size: 'Размер',
spacing: 'Spacing',
overallAlpha: 'Overall Alpha',
fontColor: 'Цвет текста',
fontAlpha: 'Font Alpha',
borderWidth: 'Border Width',
send: 'Отправить в эфир',
name: 'Название',
saveDone: 'Сохранение предустановки выполнено!',
saveFailed: 'Сохранить пресет не удалось!',
sendDone: 'Отправка успешна...',
sendFailed: 'Отправка не удалась...',
},
log: {
download: 'Скачать лог файл',
},
advanced: {
title: 'Advanced Configuration',
decoder: 'Decoder',
encoder: 'Encoder',
filter: 'Filter',
ingest: 'Ingest',
updateSuccess: 'Update advanced config success!',
updateFailed: 'Update advanced config failed!',
warning: 'Warning! These settings are experimental and only intended for advanced users who are familiar with ffmpeg. Only change the settings here if you are sure of what you are doing! The settings can make the system unstable.',
},
config: {
channel: 'Канал',
user: 'Юзер',
channelConf: 'Конфигурация канала',
addChannel: 'Сделать новый канал',
name: 'Название канала',
previewUrl: 'Предварительный просмотр эфира канала по URL',
extensions: 'Дополнительные расширения',
save: 'Сохранить',
delete: 'Удалить',
updateChannelSuccess: 'Обновление конфигурации канала успешно!',
updateChannelFailed: 'Обновление конфигурации канала не получилось!',
errorChannelDelete: 'Первый канал не может быть удален!',
deleteChannelSuccess: 'Удаление канала успешно!',
deleteChannelFailed: 'Удаление канала неуспешно!',
playoutConf: 'Настройки Конфигурации',
general: 'Главное',
rpcServer: 'RPC Сервер',
mail: 'Электронная почта',
logging: 'Логирование',
processing: 'Настройки эфира',
ingest: 'Ingest',
playlist: 'Плейлист',
storage: 'Storage',
text: 'Текст',
task: 'Task',
output: 'Out',
placeholderPass: 'Password',
help: 'Help',
generalText: `Sometimes it can happen that a file is corrupted but still playable, this can cause a streaming error on all following files. The only way to fix this is to stop and restart ffplayout. Here we only say when to stop, the starting process is up to you. The best way is a systemd service on Linux.
'stop_threshold' will stop ffplayout if it is async in time above this value. A number less than 3 may cause unexpected errors.`,
rpcText: 'Запустите сервер JSON RPC, чтобы получить информацию о том, что воспроизводится, а также о некоторых функциях управления.',
mailText: `Отправлять сообщения об ошибках на адрес электронной почты, например об отсутствии списка воспроизведения; неверный формат json; отсутствует путь к клипу. Оставьте получателя пустым, если он вам не нужен. 'mail_level' может быть ИНФОРМАЦИЯ, ПРЕДУПРЕЖДЕНИЕ или ОШИБКА. 'interval' означает секунды до отправки нового письма.`,
logText: `If 'log_to_file' is true, log to file, if false, log to console. 'local_time' to false will set log timestamps to UTC. Path to /var/log/ only if you are running this as a daemon.
'level' can be DEBUG, INFO, WARNING, ERROR. 'ffmpeg_level' can be INFO, WARNING, ERROR. 'detect_silence' logs an error message if the audio line is silent for 15 seconds during the validation process.`,
processingText: `Default processing for all clips to make them unique. Mode can be Playlist or Folder. 'aspect' must be a float number. 'logo' is only used if the path exists.
'logo_scale' scales the logo to the target size, leave empty if no scaling is needed, format is 'width:height', for example '100:-1' for proportional scaling. With 'logo_opacity' you can make the logo transparent.
With 'audio_tracks' it is possible to configure how many audio tracks should be processed. 'audio_channels' can be used if the audio has more channels than just stereo. With 'logo_position' in 'x:y' format you set the logo position. With 'custom_filter' it is possible to apply additional filters. The filter outputs should end with [c_v_out] for video filters and [c_a_out] for audio filters.`,
ingestText: `Запустите сервер для получения входящего потока. Этот поток будет переопределять обычную потоковую передачу до тех пор, пока она не будет завершена. Существует только очень простой механизм аутентификации, позволяющий проверить правильность имени потока. 'custom_filter' можно использовать так же, как в разделе "Настройки эфира".`,
playlistText: `'path' can be a path to a single file or a directory. For directory specify only the root folder, for example '/playlists', subdirectories will be read by the program. Subdirectories need this structure '/playlists/2018/01'.
'day_start' is the time at which the playlist should start, leave 'day_start' empty if the playlist should always start at the beginning. 'length' represents the target length of the playlist, if empty, real length will not be considered. 'infinit: true' works with single playlist file and loops it infinitely.`,
storageText: `Play ordered or random files from path. 'filler_clip' is for filling the end to reach 24 hours, it will loop when necessary. Set 'extensions' to search only for files with that extension. Set 'shuffle' to 'true' to select files randomly.`,
textText: `Overlay text in combination with libzmq for remote text manipulation. On Windows, the font file path must be 'C\\:/WINDOWS/fonts/DejaVuSans.ttf'. 'text_from_filename' activates text extraction from a filename. With 'style' you can set the drawtext parameters like position, color, etc. Post Text via API will override this. With 'regex' you can format the filename to get a title.`,
taskText: `Run an external program with a given media object. The media object is in json format and contains all the information about the current clip. The external program can be a script or a binary. or a binary, but should only run for a short time.`,
outputText: `The final playout compression. Adjust the settings according to your needs. 'mode' has the options 'desktop', 'hls', 'null', 'stream'. Use 'stream' and adjust the 'output_param:' settings if you want to stream to an rtmp/rtsp/srt/... server. In production don't serve hls playlist with ffpapi, use nginx or another web server!`,
restartTile: 'Перезапуск Playout',
restartText: 'Перезапустить ffplayout для применения изменений?',
updatePlayoutSuccess: 'Обновление конфигурации воспроизведения прошло успешно!',
updatePlayoutFailed: 'Обновление конфигурации воспроизведения не удалось!',
forbiddenPlaylistPath: 'Доступ запрещен: Папка плейлиста не может быть открыта.',
noPlayoutConfig: 'Конфигурация воспроизведения не найдена!',
hlsPath: 'HLS Path',
playlistPath: 'Playlist Path',
storagePath: 'Storage Path',
sharedStorage: 'Общее хранилище включено, используйте один и тот же корень хранилища для всех каналов!',
},
user: {
title: 'Конфигурация пользователя',
add: 'Добавить пользователя',
delete: 'Удалить пользователя',
name: 'Имя пользователя',
mail: 'Электронная почта',
password: 'Пароль',
newPass: 'Новый пароль',
confirmPass: 'Подтвердите пароль',
save: 'Сохранить',
admin: 'Админ',
deleteNotPossible: 'Delete current user not possible!',
deleteSuccess: 'Удаление пользователя успешно!',
deleteError: 'Удаление пользователя с ошибкой',
addSuccess: 'Добавление пользователя успешно!',
addFailed: 'Добавление пользователя не успешно!',
mismatch: 'Password mismatch!',
updateSuccess: 'Обновление данных о пользователе успешно!',
updateFailed: 'Обновление данных о пользователе не успешно!',
},
}

View File

@ -0,0 +1,27 @@
<template>
<div class="min-h-screen bg-base-200">
<div v-if="authStore.isLogin && !String(route.name).includes('index')" class="sticky top-0 z-10">
<HeaderMenu />
</div>
<main :class="authStore.isLogin && !String(route.name).includes('index') ? 'h-[calc(100%-52px)]' : 'h-full'">
<slot />
</main>
<AlertMsg />
</div>
</template>
<script setup lang="ts">
const colorMode = useColorMode()
const authStore = useAuth()
const indexStore = useIndex()
const route = useRoute()
if (colorMode.value === 'dark') {
indexStore.darkMode = true
} else {
indexStore.darkMode = false
}
</script>

View File

@ -0,0 +1,10 @@
export default defineNuxtRouteMiddleware((to) => {
const auth = useAuth()
const localePath = useLocalePath()
auth.inspectToken()
if (!auth.isLogin && !String(to.name).includes('index_')) {
return navigateTo(localePath({ name: 'index' }))
}
})

162
frontend/nuxt.config.ts Normal file
View File

@ -0,0 +1,162 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devServer: {
port: 3000, // default: 3000
host: '127.0.0.1', // default: localhost
},
nitro: {
devProxy: {
'/api': { target: 'http://127.0.0.1:8787/api' },
'/auth': { target: 'http://127.0.0.1:8787/auth' },
'/data': { target: 'http://127.0.0.1:8787/data' },
'/live': { target: 'http://127.0.0.1:8787/live' },
'/1/live': { target: 'http://127.0.0.1:8787/1/live' },
'/file': { target: 'http://127.0.0.1:8787/file' },
'/hls': { target: 'http://127.0.0.1:8787/hls' },
},
},
ignore: ['**/public/tv-media**', '**/public/Videos**', '**/public/live**', '**/public/home**'],
ssr: false,
// debug: true,
app: {
head: {
title: 'ffplayout',
meta: [
{
charset: 'utf-8',
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
{
hid: 'description',
name: 'description',
content: 'Frontend for ffplayout, the 24/7 Rust and playlist based streaming solution.',
},
],
link: [
{
rel: 'icon',
type: 'image/x-icon',
href: '/favicon.ico',
},
],
},
},
modules: [
'@nuxt/eslint',
'@nuxtjs/color-mode',
'@nuxtjs/tailwindcss',
'@nuxtjs/i18n',
'@pinia/nuxt',
'@vueuse/nuxt',
],
css: ['@/assets/scss/main.scss'],
colorMode: {
preference: 'dark', // default value of $colorMode.preference
fallback: 'system', // fallback value if not system preference found
hid: 'nuxt-color-mode-script',
globalName: '__NUXT_COLOR_MODE__',
componentName: 'ColorScheme',
classPrefix: '',
classSuffix: '',
dataValue: 'theme',
storageKey: 'theme',
},
i18n: {
locales: [
{
code: 'de',
name: 'Deutsch',
file: 'de-DE.js',
},
{
code: 'en',
name: 'English',
file: 'en-US.js',
},
{
code: 'pt-br',
name: 'Português (BR)',
file: 'pt-BR.js',
},
{
code: 'ru',
name: 'Русский язык (RU)',
file: 'ru-RU.js',
},
],
customRoutes: 'config',
pages: {
player: {
de: '/wiedergabe',
en: '/player',
'pt-br': '/player',
ru: '/player',
},
media: {
de: '/medien',
en: '/media',
'pt-br': '/armazenamento',
ru: '/media',
},
message: {
de: '/nachrichten',
en: '/message',
'pt-br': '/legenda',
ru: '/message',
},
logging: {
de: '/protokollierung',
en: '/logging',
'pt-br': '/registro',
ru: '/logging',
},
configure: {
de: '/einstellungen',
en: '/configure',
'pt-br': '/configurar',
ru: '/configure',
},
},
detectBrowserLanguage: {
useCookie: true,
alwaysRedirect: true,
},
// debug: true,
langDir: 'i18n/locales',
defaultLocale: 'en',
compilation: {
strictMessage: false,
},
},
vite: {
build: {
chunkSizeWarningLimit: 800000,
},
css: {
preprocessorOptions: {
scss: {
silenceDeprecations: ['legacy-js-api'],
},
},
},
},
experimental: {
payloadExtraction: false,
},
compatibilityDate: '2024-07-10',
})

15184
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

47
frontend/package.json Normal file
View File

@ -0,0 +1,47 @@
{
"name": "ffplayout-frontend",
"version": "0.12.1",
"description": "Web GUI for ffplayout",
"author": "Jonathan Baecker",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"reset": "rm -rf .nuxt node_modules .output package-lock.json && npm install",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxtjs/color-mode": "^3.5.1",
"@pinia/nuxt": "^0.5.4",
"@vueform/multiselect": "^2.6.10",
"@vuepic/vue-datepicker": "^9.0.3",
"@vueuse/nuxt": "^11.1.0",
"bootstrap-icons": "^1.11.3",
"dayjs": "^1.11.13",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
"mpegts.js": "^1.7.3",
"nuxt": "3.13.2",
"pinia": "^2.2.2",
"sortablejs-vue3": "^1.2.11",
"splitpanes": "^3.1.5",
"video.js": "^8.17.4"
},
"devDependencies": {
"@nuxt/eslint": "^0.5.7",
"@nuxtjs/i18n": "^8.5.5",
"@nuxtjs/tailwindcss": "^6.12.1",
"@types/lodash": "^4.17.9",
"@types/video.js": "^7.3.58",
"daisyui": "^4.12.10",
"mini-svg-data-uri": "^1.4.4",
"postcss": "^8.4.47",
"postcss-loader": "^8.1.1",
"sass": "^1.79.3",
"sass-loader": "^16.0.2",
"vue": "^3.5.8",
"vue-router": "^4.4.5"
}
}

View File

@ -0,0 +1,64 @@
<template>
<div class="flex w-full h-full ps-1">
<div class="flex-none w-[70px] join join-vertical me-3 pt-7">
<button
class="join-item w-full btn btn-sm btn-primary duration-500"
:class="activeConf === 1 && 'btn-secondary'"
@click="activeConf = 1"
>
{{ t('config.channel') }}
</button>
<button
v-if="authStore.role === 'GlobalAdmin'"
class="join-item w-full btn btn-sm btn-primary duration-500"
:class="activeConf === 2 && 'btn-secondary'"
@click="activeConf = 2"
>
Advanced
</button>
<button
class="join-item w-full btn btn-sm btn-primary mt-1 duration-500"
:class="activeConf === 3 && 'btn-secondary'"
@click="activeConf = 3"
>
Playout
</button>
<button
class="join-item w-full btn btn-sm btn-primary mt-1 duration-500"
:class="activeConf === 4 && 'btn-secondary'"
@click="activeConf = 4"
>
{{ t('config.user') }}
</button>
</div>
<div class="w-[calc(100%-70px)] mt-10 px-6">
<div v-if="activeConf === 1" class="w-full flex justify-center">
<ConfigChannel />
</div>
<div v-if="activeConf === 2" class="w-full flex justify-center">
<ConfigAdvanced />
</div>
<div v-else-if="activeConf === 3" class="w-full flex justify-center">
<ConfigPlayout />
</div>
<div v-else-if="activeConf === 4" class="w-full flex justify-center">
<ConfigUser />
</div>
</div>
</div>
</template>
<script setup lang="ts">
const { t } = useI18n()
const authStore = useAuth()
useHead({
title: `${t('button.configure')} | ffplayout`,
})
const activeConf = ref(1)
</script>

161
frontend/pages/index.vue Normal file
View File

@ -0,0 +1,161 @@
<template>
<div class="w-full min-h-screen xs:h-full flex justify-center items-center">
<div v-if="authStore.isLogin" class="flex flex-wrap justify-center text-center w-full max-w-[1024px] p-5">
<div class="absolute top-4 left-1">
<EventStatus />
</div>
<SystemStats v-if="configStore.channels.length > 0" />
<div class="flex flex-wrap justify-center gap-1 md:gap-0 md:join mt-5">
<NuxtLink :to="localePath({ name: 'player' })" class="btn join-item btn-primary px-2">
{{ t('button.player') }}
</NuxtLink>
<NuxtLink :to="localePath({ name: 'media' })" class="btn join-item btn-primary px-2">
{{ t('button.media') }}
</NuxtLink>
<NuxtLink :to="localePath({ name: 'message' })" class="btn join-item btn-primary px-2">
{{ t('button.message') }}
</NuxtLink>
<NuxtLink :to="localePath({ name: 'logging' })" class="btn join-item btn-primary px-2">
{{ t('button.logging') }}
</NuxtLink>
<NuxtLink
v-if="authStore.role.toLowerCase().includes('admin')"
:to="localePath({ name: 'configure' })"
class="btn join-item btn-primary px-2"
>
{{ t('button.configure') }}
</NuxtLink>
<button class="btn join-item btn-primary px-2" @click="logout()">
{{ t('button.logout') }}
</button>
<select
v-model="selectedLang"
class="select select-primary select-bordered join-item max-w-xs ps-2"
@change="changeLang(selectedLang)"
>
<option v-for="(loc, index) in locales" :key="index" :value="/* @ts-ignore */ loc.code">
{{
/* @ts-ignore */
loc.name
}}
</option>
</select>
<label class="join-item btn btn-primary swap swap-rotate me-2">
<input type="checkbox" :checked="indexStore.darkMode" @change="toggleDarkTheme" />
<SvgIcon name="swap-on" classes="w-5 h-5" />
<SvgIcon name="swap-off" classes="w-5 h-5" />
</label>
</div>
</div>
<div v-else class="w-96 min-w-full flex flex-col justify-center items-center px-4">
<h1 class="text-6xl xs:text-8xl">ffplayout</h1>
<form class="mt-10" @submit.prevent="login">
<input
v-model="formUsername"
type="text"
name="username"
:placeholder="t('input.username')"
class="input input-bordered w-full"
required
/>
<input
v-model="formPassword"
type="password"
name="passwort"
:placeholder="t('input.password')"
class="input input-bordered w-full mt-5"
required
/>
<div class="w-full mt-4 grid grid-flow-row-dense grid-cols-12 grid-rows-1 gap-2">
<div class="col-span-3">
<button type="submit" class="btn btn-primary">
{{ t('button.login') }}
</button>
</div>
<div class="col-span-12 sm:col-span-9">
<div
v-if="showLoginError"
role="alert"
class="alert alert-error w-auto rounded z-2 h-12 p-[0.7rem]"
>
<SvgIcon name="error" />
<span>{{ formError }}</span>
</div>
</div>
</div>
</form>
</div>
</div>
</template>
<script setup lang="ts">
const colorMode = useColorMode()
const { locale, locales, t } = useI18n()
const localePath = useLocalePath()
const switchLocalePath = useSwitchLocalePath()
const router = useRouter()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const selectedLang = ref(locale)
const formError = ref('')
const showLoginError = ref(false)
const formUsername = ref('')
const formPassword = ref('')
authStore.inspectToken()
async function login() {
try {
const status = await authStore.obtainToken(formUsername.value, formPassword.value)
formUsername.value = ''
formPassword.value = ''
formError.value = ''
if (status === 401 || status === 400 || status === 403) {
formError.value = t('alert.wrongLogin')
showLoginError.value = true
setTimeout(() => {
showLoginError.value = false
}, 3000)
}
await configStore.configInit()
} catch (e) {
formError.value = e as string
}
}
function toggleDarkTheme() {
indexStore.darkMode = !indexStore.darkMode
if (indexStore.darkMode) {
colorMode.preference = 'dark'
} else {
colorMode.preference = 'light'
}
}
async function logout() {
try {
authStore.removeToken()
} catch (e) {
formError.value = e as string
}
}
async function changeLang(code: string) {
const path = switchLocalePath(code)
const cookie = useCookie('i18n_redirected')
cookie.value = code
router.push(path)
}
</script>

194
frontend/pages/logging.vue Normal file
View File

@ -0,0 +1,194 @@
<template>
<div class="w-full flex flex-col">
<div class="flex justify-end p-3 h-14">
<div class="join">
<select v-model="errorLevel" class="join-item select select-sm select-bordered w-full max-w-xs">
<option
v-for="(index, value) in indexStore.severityLevels"
:key="index"
:value="value"
:selected="value === errorLevel"
>
{{ value }}
</option>
</select>
<VueDatePicker
v-model="listDate"
:clearable="false"
:hide-navigation="['time']"
:action-row="{ showCancel: false, showSelect: false, showPreview: false }"
:format="calendarFormat"
model-type="yyyy-MM-dd"
auto-apply
:locale="locale"
:dark="colorMode.value === 'dark'"
:ui="{ input: 'join-item input !input-sm !input-bordered !w-[300px] text-right !pe-3' }"
required
/>
<button class="btn btn-sm btn-primary join-item" :title="t('log.download')" @click="downloadLog">
<i class="bi-download" />
</button>
</div>
</div>
<div class="px-3 inline-block h-[calc(100vh-140px)] text-[13px]">
<div
class="bg-base-300 whitespace-pre h-full font-mono overflow-auto p-3"
v-html="filterLogsBySeverity(formatLog(currentLog), errorLevel)"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from 'pinia'
const colorMode = useColorMode()
const { locale, t } = useI18n()
const indexStore = useIndex()
useHead({
title: `${t('button.logging')} | ffplayout`,
})
const { id } = storeToRefs(useConfig())
const { $dayjs } = useNuxtApp()
const authStore = useAuth()
const configStore = useConfig()
const currentLog = ref('')
const listDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
const { formatLog } = stringFormatter()
const levelCookie = useCookie('error_level', {
path: '/',
maxAge: 60 * 60 * 24 * 365,
sameSite: 'lax',
})
const errorLevel = computed({
get() {
return levelCookie.value || 'INFO'
},
set(value) {
levelCookie.value = value
},
})
onMounted(async () => {
await getLog()
})
watch([listDate, id], () => {
getLog()
})
const calendarFormat = (date: Date) => {
return $dayjs(date).locale(locale.value).format('dddd - LL')
}
function filterLogsBySeverity(logString: string, minSeverity: string): string {
const minLevel = indexStore.severityLevels[minSeverity]
const logLines = logString.trim().split(/\r?\n/)
const filteredLogs = logLines.filter((log) => {
const match = log.match(/\[ ?(DEBUG|INFO|WARN|ERROR)\]/)
if (match) {
const logLevel = match[1]
return indexStore.severityLevels[logLevel] >= minLevel
}
return false
})
return filteredLogs.join('\n')
}
async function getLog() {
let date = listDate.value
if (date === $dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD')) {
date = ''
}
await fetch(`/api/log/${configStore.channels[configStore.id].id}?date=${date}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => response.text())
.then((data) => {
currentLog.value = data
})
.catch(() => {
currentLog.value = ''
})
}
function downloadLog() {
const file = new File(
[formatLog(currentLog.value).replace(/<\/?[^>]+(>|$)/g, '')],
`playout_${listDate.value}.log`,
{
type: 'text/plain',
}
)
const link = document.createElement('a')
const url = URL.createObjectURL(file)
link.href = url
link.download = file.name
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
}
</script>
<style>
.log-time {
color: #666864;
}
.log-number {
color: var(--my-yellow);
}
.log-addr {
color: var(--my-purple);
font-weight: 500;
}
.log-cmd {
color: var(--my-blue);
}
.log-info {
color: var(--my-green);
}
.log-warning {
color: #ff8700;
}
.log-error {
color: #d32828;
}
.log-debug {
color: #6e99c7;
}
.log-decoder {
color: #56efff;
}
.log-encoder {
color: #45ccee;
}
.log-server {
color: #23cbdd;
}
</style>

672
frontend/pages/media.vue Normal file
View File

@ -0,0 +1,672 @@
<template>
<div>
<div class="h-[calc(100vh-140px)] px-2">
<nav class="text-sm breadcrumbs px-3">
<ul @dragover.prevent>
<li
v-for="(crumb, index) in mediaStore.crumbs"
:key="index"
@drop="handleDrop($event, crumb.path, null)"
@dragover="handleDragOver"
@dragleave="handleDragLeave"
>
<button
v-if="mediaStore.crumbs.length > 1 && mediaStore.crumbs.length - 1 > index"
@click="mediaStore.getTree(crumb.path)"
>
<i class="bi-folder-fill me-1" />
{{ crumb.text }}
</button>
<span v-else><i class="bi-folder-fill me-1" /> {{ crumb.text }}</span>
</li>
</ul>
</nav>
<div class="relative h-[calc(100%-34px)] min-h-[300px] bg-base-100">
<div v-if="mediaStore.isLoading" class="w-full h-full absolute z-10 flex justify-center bg-base-100/70">
<span class="loading loading-spinner loading-lg" />
</div>
<splitpanes :horizontal="horizontal" class="h-full border border-my-gray rounded shadow">
<pane
min-size="14"
max-size="80"
size="20"
class="h-full bg-base-300"
:class="horizontal ? 'rounded-t' : 'rounded-s'"
>
<div class="relative h-full overflow-y-auto">
<table
v-if="mediaStore.folderTree.parent"
class="table table-zebra table-fixed"
@dragover.prevent
>
<tbody>
<template v-if="mediaStore.folderTree.parent_folders.length > 0">
<tr
v-for="folder in mediaStore.folderTree.parent_folders"
:key="folder.uid"
class="grid grid-cols-[auto_30px] border-b border-base-content/20"
:class="
filename(mediaStore.folderTree.source) === folder.name &&
'!bg-secondary text-black'
"
@drop="handleDrop($event, folder, true)"
@dragover="handleDragOver"
@dragleave="handleDragLeave"
>
<td class="px-2 py-1.5 truncate">
<span
class="cursor-pointer"
@click="
mediaStore.getTree(
`/${parent(mediaStore.folderTree.source)}/${folder.name}`
)
"
>
<i class="bi-folder-fill" />
{{ folder.name }}
</span>
</td>
<td class="px-2 py-1.5 text-center">
<button
class="opacity-30 hover:opacity-100"
@click="
;(showDeleteModal = true),
(deleteName = `/${parent(mediaStore.folderTree.source)}/${
folder.name
}`.replace(/\/[/]+/g, '/'))
"
>
<i class="bi-x-circle-fill" />
</button>
</td>
</tr>
</template>
<tr v-else>
<td class="px-2 py-1.5 border-b border-base-content/20">
<i class="bi-folder-fill" />
{{ mediaStore.folderTree.parent }}
</td>
</tr>
</tbody>
</table>
</div>
</pane>
<pane class="h-full !bg-base-300" :class="horizontal ? 'rounded-b' : 'rounded-e'">
<div class="relative h-full overflow-y-auto">
<table
v-if="mediaStore.folderTree.parent"
class="table table-zebra table-fixed"
@dragover.prevent
>
<tbody>
<tr
v-for="folder in mediaStore.folderTree.folders"
:key="folder.uid"
class="grid grid-cols-[auto_170px] border-b border-base-content/20"
@drop="handleDrop($event, folder, false)"
@dragover="handleDragOver"
@dragleave="handleDragLeave"
>
<td class="px-2 py-1.5">
<button
class="truncate"
@click="
mediaStore.getTree(
`/${mediaStore.folderTree.source}/${folder.name}`
)
"
>
<i class="bi-folder-fill" />
{{ folder.name }}
</button>
</td>
<td class="ps-2 pe-[14px] py-1.5 text-right">
<button
class="opacity-30 hover:opacity-100"
@click="
;(showDeleteModal = true),
(deleteName =
`/${mediaStore.folderTree.source}/${folder.name}`.replace(
/\/[/]+/g,
'/'
))
"
>
<i class="bi-x-circle-fill" />
</button>
</td>
</tr>
<tr
v-for="(element, index) in mediaStore.folderTree.files"
:id="`file_${index}`"
:key="element.name"
class="grid grid-cols-[auto_170px] border-b border-base-content/20"
draggable="true"
@dragstart="handleDragStart($event, element)"
>
<td class="px-2 py-1.5 truncate cursor-grab">
<i
v-if="mediaType(element.name) === 'audio'"
class="bi-music-note-beamed"
/>
<i v-else-if="mediaType(element.name) === 'video'" class="bi-film" />
<i
v-else-if="mediaType(element.name) === 'image'"
class="bi-file-earmark-image"
/>
<i v-else class="bi-file-binary" />
{{ element.name }}
</td>
<td class="px-2 py-1.5 flex">
<button
class="w-7"
@click=";(showPreviewModal = true), setPreviewData(element.name)"
>
<i class="bi-play-fill" />
</button>
<div class="inline-block w-[82px]">{{ toMin(element.duration) }}</div>
<button
class="w-7"
@click="
;(showRenameModal = true),
setRenameValues(
`/${mediaStore.folderTree.source}/${element.name}`.replace(
/\/[/]+/g,
'/'
)
)
"
>
<i class="bi-pencil-square" />
</button>
<button
class="w-7 opacity-30 hover:opacity-100"
@click="
;(showDeleteModal = true),
(deleteName =
`/${mediaStore.folderTree.source}/${element.name}`.replace(
/\/[/]+/g,
'/'
))
"
>
<i class="bi-x-circle-fill" />
</button>
</td>
</tr>
</tbody>
</table>
</div>
</pane>
</splitpanes>
</div>
<div class="flex justify-end py-4 pe-2">
<div class="join">
<button
class="btn btn-sm btn-primary join-item"
:title="t('media.create')"
@click="showCreateModal = true"
>
<i class="bi-folder-plus" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('media.upload')"
@click="showUploadModal = true"
>
<i class="bi-upload" />
</button>
</div>
</div>
</div>
<GenericModal
:show="showDeleteModal"
:title="t('media.deleteTitle')"
:text="`${t('media.deleteQuestion')}:<br /><strong>${deleteName}</strong>`"
:modal-action="deleteFileOrFolder"
/>
<GenericModal
:show="showPreviewModal"
:title="`${t('media.preview')}: ${previewName}`"
:modal-action="closePlayer"
:hide-buttons="true"
>
<div class="w-[1024px] max-w-full aspect-video">
<VideoPlayer v-if="isVideo && previewOpt" reference="previewPlayer" :options="previewOpt" />
<img v-else :src="previewUrl" class="img-fluid" :alt="previewName" />
</div>
</GenericModal>
<GenericModal :show="showRenameModal" :title="t('media.rename')" :modal-action="renameFile">
<label class="form-control w-full max-w-md">
<div class="label">
<span class="label-text">{{ t('media.newFile') }}</span>
</div>
<input v-model="renameNewName" type="text" class="input input-bordered w-full" />
</label>
</GenericModal>
<GenericModal :show="showCreateModal" :title="t('media.createFolder')" :modal-action="createFolder">
<label class="form-control w-full max-w-md">
<div class="label">
<span class="label-text">{{ t('media.foldername') }}</span>
</div>
<input v-model="folderName.name" type="text" class="input input-bordered w-full" />
</label>
</GenericModal>
<GenericModal :show="showUploadModal" :title="t('media.upload')" :modal-action="uploadFiles">
<div class="w-[700px] max-w-full">
<input
ref="fileInputName"
type="file"
class="file-input file-input-bordered w-full"
:accept="extensions"
multiple
@change="onFileChange"
/>
<label class="form-control w-full mt-3">
<div class="label">
<span class="label-text">{{ t('media.current') }}:</span>
</div>
<progress class="progress progress-accent" :value="currentProgress" max="100" />
</label>
<label class="form-control w-full mt-1">
<div class="label">
<span class="label-text"
>{{ t('media.overall') }} ({{ currentNumber }}/{{ inputFiles.length }}):</span
>
</div>
<progress class="progress progress-accent" :value="overallProgress" max="100" />
</label>
<label class="form-control w-full mt-1">
<div class="label">
<span class="label-text">{{ t('media.uploading') }}:</span>
</div>
<input v-model="uploadTask" type="text" class="input input-sm input-bordered w-full" disabled />
</label>
</div>
</GenericModal>
</div>
</template>
<script setup lang="ts">
import { storeToRefs } from 'pinia'
const { t } = useI18n()
const { width } = useWindowSize({ initialWidth: 800 })
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const mediaStore = useMedia()
const { toMin, mediaType, filename, parent } = stringFormatter()
const { id } = storeToRefs(useConfig())
useHead({
title: `${t('button.media')} | ffplayout`,
})
watch([width], () => {
if (width.value < 640) {
horizontal.value = true
} else {
horizontal.value = false
}
})
const horizontal = ref(false)
const deleteName = ref('')
const renameOldName = ref('')
const renameNewName = ref('')
const previewName = ref('')
const previewUrl = ref('')
const previewOpt = ref()
const isVideo = ref(false)
const showDeleteModal = ref(false)
const showPreviewModal = ref(false)
const showRenameModal = ref(false)
const showCreateModal = ref(false)
const showUploadModal = ref(false)
const extensions = ref('')
const folderName = ref({} as Folder)
const inputFiles = ref([] as File[])
const fileInputName = ref()
const currentNumber = ref(0)
const uploadTask = ref('')
const overallProgress = ref(0)
const currentProgress = ref(0)
const lastPath = ref('')
const xhr = ref(new XMLHttpRequest())
onMounted(async () => {
let config_extensions = configStore.playout.storage.extensions
let extra_extensions = configStore.channels[configStore.id].extra_extensions
if (typeof config_extensions === 'string') {
config_extensions = config_extensions.split(',')
}
if (typeof extra_extensions === 'string') {
extra_extensions = extra_extensions.split(',')
}
const exts = [...config_extensions, ...extra_extensions].map((ext) => {
return `.${ext}`
})
extensions.value = exts.join(', ')
if (!mediaStore.folderTree.parent || !mediaStore.currentPath) {
await mediaStore.getTree('')
}
})
watch([id], () => {
mediaStore.getTree('')
})
function handleDragStart(event: any, itemData: any) {
event.dataTransfer.setData('application/json', JSON.stringify(itemData))
}
function handleDragOver(event: any) {
event.target.style.fontWeight = 'bold'
if (event.target.firstChild && event.target.firstChild.classList.contains('bi-folder-fill')) {
event.target.firstChild.classList.remove('bi-folder-fill')
event.target.firstChild.classList.add('bi-folder2-open')
}
}
function handleDragLeave(event: any) {
if (event.target && event.target.style) {
event.target.style.fontWeight = null
}
if (event.target.firstChild && event.target.firstChild.classList.contains('bi-folder2-open')) {
event.target.firstChild.classList.remove('bi-folder2-open')
event.target.firstChild.classList.add('bi-folder-fill')
}
}
async function handleDrop(event: any, targetFolder: any, isParent: boolean | null) {
const itemData = JSON.parse(event.dataTransfer.getData('application/json'))
const source = `/${mediaStore.folderTree.source}/${itemData.name}`.replace(/\/[/]+/g, '/')
let target
if (isParent === null) {
target = `${targetFolder}/${itemData.name}`.replace(/\/[/]+/g, '/')
} else if (isParent) {
target = `/${parent(mediaStore.folderTree.source)}/${targetFolder.name}/${itemData.name}`.replace(
/\/[/]+/g,
'/'
)
} else {
target = `/${mediaStore.folderTree.source}/${targetFolder.name}/${itemData.name}`.replace(/\/[/]+/g, '/')
}
event.target.style.fontWeight = null
if (event.target.firstChild.classList.contains('bi-folder2-open')) {
event.target.firstChild.classList.remove('bi-folder2-open')
event.target.firstChild.classList.add('bi-folder-fill')
}
if (source !== target) {
await fetch(`/api/file/${configStore.channels[configStore.id].id}/rename/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source, target }),
})
.then(async (res) => {
if (res.status >= 400) {
indexStore.msgAlert('error', await res.json(), 3)
} else {
mediaStore.getTree(mediaStore.folderTree.source)
}
})
.catch((e) => {
indexStore.msgAlert('error', `${t('media.moveError')}: ${e}`, 3)
})
}
}
function setPreviewData(path: string) {
/*
Set path and player options for video preview.
*/
let fullPath = path
if (!path.includes('/')) {
fullPath = `/${mediaStore.folderTree.parent}/${mediaStore.folderTree.source}/${path}`.replace(/\/[/]+/g, '/')
}
previewName.value = fullPath.split('/').slice(-1)[0]
previewUrl.value = encodeURIComponent(`/file/${configStore.channels[configStore.id].id}${fullPath}`).replace(
/%2F/g,
'/'
)
const ext = previewName.value.split('.').slice(-1)[0].toLowerCase()
const fileType =
mediaType(previewName.value) === 'audio'
? `audio/${ext}`
: mediaType(previewName.value) === 'live'
? 'application/x-mpegURL'
: `video/${ext}`
if (configStore.playout.storage.extensions.includes(`${ext}`)) {
isVideo.value = true
previewOpt.value = {
liveui: false,
controls: true,
suppressNotSupportedError: true,
autoplay: false,
preload: 'auto',
sources: [
{
type: fileType,
src: previewUrl.value,
},
],
}
} else {
isVideo.value = false
}
}
async function deleteFileOrFolder(del: boolean) {
/*
Delete function, works for files and folders.
*/
showDeleteModal.value = false
if (del) {
await fetch(`/api/file/${configStore.channels[configStore.id].id}/remove/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: deleteName.value }),
})
.then(async (response) => {
if (response.status !== 200) {
indexStore.msgAlert('error', `${await response.text()}`, 5)
}
mediaStore.getTree(mediaStore.folderTree.source)
})
.catch((e) => {
indexStore.msgAlert('error', `${t('media.deleteError')}: ${e}`, 5)
})
}
deleteName.value = ''
}
function setRenameValues(path: string) {
renameNewName.value = path
renameOldName.value = path
}
async function renameFile(ren: boolean) {
/*
Form submit for file rename request.
*/
showRenameModal.value = false
if (ren && renameOldName.value !== renameNewName.value) {
await fetch(`/api/file/${configStore.channels[configStore.id].id}/rename/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: renameOldName.value, target: renameNewName.value }),
})
.then(async (res) => {
if (res.status >= 400) {
indexStore.msgAlert('error', await res.text(), 3)
} else {
mediaStore.getTree(mediaStore.folderTree.source)
}
})
.catch((e) => {
indexStore.msgAlert('error', `${t('media.moveError')}: ${e}`, 3)
})
}
renameOldName.value = ''
renameNewName.value = ''
}
function closePlayer() {
showPreviewModal.value = false
isVideo.value = false
}
async function createFolder(create: boolean) {
showCreateModal.value = false
if (create) {
const path = `${mediaStore.folderTree.source}/${folderName.value.name}`.replace(/\/[/]+/g, '/')
lastPath.value = mediaStore.folderTree.source
if (mediaStore.folderTree.folders.includes(folderName.value)) {
indexStore.msgAlert('warning', `${t('media.folderExists')}! "${folderName.value.name}"`, 2)
return
}
await $fetch(`/api/file/${configStore.channels[configStore.id].id}/create-folder/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: path }),
})
.then(() => {
indexStore.msgAlert('success', t('media.folderCreate'), 2)
})
.catch((e: string) => {
indexStore.msgAlert('error', `${t('media.folderError')}: ${e}`, 3)
indexStore.alertVariant = 'error'
})
mediaStore.getTree(lastPath.value)
}
folderName.value = {} as Folder
}
function onFileChange(evt: any) {
const files = evt.target.files || evt.dataTransfer.files
if (!files.length) {
return
}
inputFiles.value = files
}
async function upload(file: any): Promise<null | undefined> {
const formData = new FormData()
formData.append(file.name, file)
xhr.value = new XMLHttpRequest()
return new Promise((resolve) => {
xhr.value.open(
'PUT',
`/api/file/${configStore.channels[configStore.id].id}/upload/?path=${encodeURIComponent(
mediaStore.crumbs[mediaStore.crumbs.length - 1].path
)}`
)
xhr.value.setRequestHeader('Authorization', `Bearer ${authStore.jwtToken}`)
xhr.value.upload.onprogress = (event: any) => {
currentProgress.value = Math.round((100 * event.loaded) / event.total)
}
xhr.value.upload.onerror = () => {
indexStore.msgAlert('error', `${t('media.folderError')}: ${xhr.value.status}`, 3)
resolve(undefined)
}
// upload completed successfully
xhr.value.onload = () => {
currentProgress.value = 100
resolve(xhr.value.response)
}
xhr.value.send(formData)
})
}
async function uploadFiles(upl: boolean) {
if (upl) {
authStore.inspectToken()
lastPath.value = mediaStore.folderTree.source
for (let i = 0; i < inputFiles.value.length; i++) {
const file = inputFiles.value[i]
uploadTask.value = file.name
currentProgress.value = 0
currentNumber.value = i + 1
if (mediaStore.folderTree.files.find((f) => f.name === file.name)) {
indexStore.msgAlert('warning', t('media.fileExists'), 3)
} else {
await upload(file)
}
overallProgress.value = (currentNumber.value * 100) / inputFiles.value.length
}
uploadTask.value = 'Done...'
mediaStore.getTree(lastPath.value)
setTimeout(() => {
fileInputName.value = null
currentNumber.value = 0
currentProgress.value = 0
overallProgress.value = 0
inputFiles.value = []
uploadTask.value = ''
showUploadModal.value = false
}, 1500)
} else {
fileInputName.value = null
inputFiles.value = []
overallProgress.value = 0
currentProgress.value = 0
uploadTask.value = ''
xhr.value.abort()
showUploadModal.value = false
}
}
</script>

455
frontend/pages/message.vue Normal file
View File

@ -0,0 +1,455 @@
<template>
<div>
<div class="flex flex-col items-center pt-10 px-8">
<div class="mt-2 w-full max-w-4xl">
<div class="flex flex-col xs:flex-row w-full gap-4">
<div class="grow xs:max-w-72">
<select
v-model="selected"
class="select select-sm select-bordered w-full"
@change="onChange($event)"
>
<option v-for="item in presets" :key="item.name">{{ item.name }}</option>
</select>
</div>
<div class="join">
<button
class="btn btn-sm join-item btn-primary"
:title="t('message.savePreset')"
@click="savePreset()"
>
<i class="bi-cloud-upload" />
</button>
<button
class="btn btn-sm join-item btn-primary"
:title="t('message.newPreset')"
@click="showCreateModal = true"
>
<i class="bi-file-plus" />
</button>
<button
class="btn btn-sm join-item btn-primary"
:title="t('message.delPreset')"
@click="showDeleteModal = true"
>
<i class="bi-file-minus" />
</button>
</div>
</div>
<form class="my-6 w-full" @submit.prevent="submitMessage">
<textarea
v-model="form.text"
class="textarea textarea-bordered w-full"
rows="4"
:placeholder="t('message.placeholder')"
/>
<div class="mt-2 grid xs:grid-cols-[auto_150px_150px] gap-4">
<div class="grow">
<div class="form-control">
<label class="cursor-pointer p-0">
<div class="label">
<span class="label-text">{{ t('message.xAxis') }}</span>
</div>
<input
v-model="form.x"
class="input input-sm input-bordered w-full"
type="text"
placeholder="X"
required
/>
</label>
</div>
<div class="form-control">
<label class="cursor-pointer p-0">
<div class="label">
<span class="label-text">{{ t('message.yAxis') }}</span>
</div>
<input
v-model="form.y"
class="input input-sm input-bordered w-full"
type="text"
placeholder="Y"
required
/>
</label>
</div>
</div>
<div class="xs:mt-10">
<div class="form-control">
<label class="label cursor-pointer p-0">
<span class="label-text">{{ t('message.showBox') }}</span>
<input
v-model="form.showBox"
type="checkbox"
class="checkbox checkbox-xs rounded-sm"
/>
</label>
</div>
<label class="mt-2 form-control w-full">
<div class="label">
<span class="label-text">{{ t('message.boxColor') }}</span>
</div>
<input
v-model="form.boxColor"
type="color"
class="input input-sm input-bordered w-full p-1"
required
/>
</label>
</div>
<label class="form-control w-full xs:mt-[68px]">
<div class="label">
<span class="label-text">{{ t('message.boxAlpha') }}</span>
</div>
<input
v-model="form.boxAlpha"
type="number"
min="0"
max="1"
step="0.01"
class="input input-sm input-bordered w-full"
required
/>
</label>
</div>
<div class="grid xs:grid-cols-[150px_150px_auto] gap-4 mt-2">
<div>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{{ t('message.size') }}</span>
</div>
<input
v-model="form.fontSize"
type="number"
class="input input-sm input-bordered w-full"
required
/>
</label>
<label class="form-control w-full mt-2">
<div class="label">
<span class="label-text">{{ t('message.fontColor') }}</span>
</div>
<input
v-model="form.fontColor"
type="color"
class="input input-sm input-bordered w-full p-1"
required
/>
</label>
</div>
<div>
<label class="form-control w-full">
<div class="label">
<span class="label-text">{{ t('message.spacing') }}</span>
</div>
<input
v-model="form.fontSpacing"
type="number"
class="input input-sm input-bordered w-full"
required
/>
</label>
<label class="form-control w-full mt-2">
<div class="label">
<span class="label-text">{{ t('message.fontAlpha') }}</span>
</div>
<input
v-model="form.fontAlpha"
type="number"
class="input input-sm input-bordered w-full"
min="0"
max="1"
step="0.01"
required
/>
</label>
</div>
<div class="grow">
<label class="form-control w-full">
<div class="label">
<span class="label-text">{{ t('message.overallAlpha') }}</span>
</div>
<input
v-model="form.overallAlpha"
type="text"
class="input input-sm input-bordered w-full"
required
/>
</label>
<label class="form-control w-full xs:max-w-[150px] mt-2">
<div class="label">
<span class="label-text">{{ t('message.borderWidth') }}</span>
</div>
<input
v-model="form.border"
type="number"
class="input input-sm input-bordered w-full"
required
/>
</label>
</div>
</div>
<div class="mt-5">
<button class="btn btn-primary send-btn" type="submit">{{ t('message.send') }}</button>
</div>
</form>
</div>
</div>
<GenericModal :show="showCreateModal" :title="t('message.newPreset')" :modal-action="createNewPreset">
<label class="form-control w-full">
<div class="label">
<span class="label-text">{{ t('message.name') }}</span>
</div>
<input v-model="newPresetName" type="text" class="input input-bordered w-full" />
</label>
</GenericModal>
<GenericModal
:show="showDeleteModal"
:title="t('message.delPreset')"
:text="`${t('message.delText')}: <strong> ${selected}</strong>?`"
:modal-action="deletePreset"
/>
</div>
</template>
<script setup lang="ts">
const { t } = useI18n()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const { id } = storeToRefs(useConfig())
const { numberToHex, hexToNumber } = stringFormatter()
useHead({
title: 'Messages | ffplayout',
})
interface PresetName {
name: string
value: number
}
const form = ref({
id: 0,
name: '',
text: '',
x: '0',
y: '0',
fontSize: 24,
fontSpacing: 4,
fontColor: '#ffffff',
fontAlpha: 1.0,
showBox: true,
boxColor: '#000000',
boxAlpha: 0.8,
border: 4,
overallAlpha: '1',
})
const showCreateModal = ref(false)
const showDeleteModal = ref(false)
const selected = ref(null)
const newPresetName = ref('')
const presets = ref([] as PresetName[])
onMounted(() => {
getPreset(-1)
})
watch([id], () => {
nextTick(() => {
getPreset(-1)
})
})
async function getPreset(index: number) {
fetch(`/api/presets/${configStore.channels[configStore.id].id}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => response.json())
.then((data) => {
if (index === -1) {
presets.value = [{ value: -1, name: '' }]
for (let i = 0; i < data.length; i++) {
const elem = data[i]
presets.value.push({ value: i, name: elem.name })
}
form.value = {
id: 0,
name: '',
text: '',
x: '0',
y: '0',
fontSize: 24,
fontSpacing: 4,
fontColor: '#ffffff',
fontAlpha: 1.0,
showBox: true,
boxColor: '#000000',
boxAlpha: 0.8,
border: 4,
overallAlpha: '1',
}
} else {
const fColor = data[index].fontcolor.split('@')
const bColor = data[index].boxcolor.split('@')
form.value = {
id: data[index].id,
name: data[index].name,
text: data[index].text,
x: data[index].x,
y: data[index].y,
fontSize: data[index].fontsize,
fontSpacing: data[index].line_spacing,
fontColor: fColor[0],
fontAlpha: fColor[1] ? hexToNumber(fColor[1]) : 1.0,
showBox: data[index].box === '1' ? true : false,
boxColor: bColor[0],
boxAlpha: bColor[1] ? hexToNumber(bColor[1]) : 1.0,
border: data[index].boxborderw,
overallAlpha: data[index].alpha,
}
}
})
}
function onChange(event: any) {
selected.value = event.target.value
getPreset(event.target.selectedIndex - 1)
}
async function savePreset() {
if (selected.value) {
const preset = {
id: form.value.id,
name: form.value.name,
text: form.value.text,
x: form.value.x,
y: form.value.y,
fontsize: form.value.fontSize,
line_spacing: form.value.fontSpacing,
fontcolor:
form.value.fontAlpha === 1
? form.value.fontColor
: form.value.fontColor + '@' + numberToHex(form.value.fontAlpha),
box: form.value.showBox ? '1' : '0',
boxcolor:
form.value.boxAlpha === 1
? form.value.boxColor
: form.value.boxColor + '@' + numberToHex(form.value.boxAlpha),
boxborderw: form.value.border,
alpha: form.value.overallAlpha,
channel_id: configStore.channels[configStore.id].id,
}
const response = await fetch(`/api/presets/${configStore.channels[configStore.id].id}/${form.value.id}`, {
method: 'PUT',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify(preset),
})
if (response.status === 200) {
indexStore.msgAlert('success', t('message.saveDone'), 2)
} else {
indexStore.msgAlert('error', t('message.saveFailed'), 2)
}
}
}
async function createNewPreset(create: boolean) {
showCreateModal.value = false
if (create) {
const preset = {
name: newPresetName.value,
text: form.value.text,
x: form.value.x.toString(),
y: form.value.y.toString(),
fontsize: form.value.fontSize.toString(),
line_spacing: form.value.fontSpacing.toString(),
fontcolor:
form.value.fontAlpha === 1
? form.value.fontColor
: form.value.fontColor + '@' + numberToHex(form.value.fontAlpha),
box: form.value.showBox ? '1' : '0',
boxcolor:
form.value.boxAlpha === 1
? form.value.boxColor
: form.value.boxColor + '@' + numberToHex(form.value.boxAlpha),
boxborderw: form.value.border.toString(),
alpha: form.value.overallAlpha.toString(),
channel_id: configStore.channels[configStore.id].id,
}
const response = await fetch(`/api/presets/${configStore.channels[configStore.id].id}/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify(preset),
})
if (response.status === 200) {
indexStore.msgAlert('success', t('message.saveDone'), 2)
getPreset(-1)
} else {
indexStore.msgAlert('error', t('message.saveFailed'), 2)
}
}
newPresetName.value = ''
}
async function deletePreset(del: boolean) {
showDeleteModal.value = false
if (del && selected.value && selected.value !== '') {
await fetch(`/api/presets/${configStore.channels[configStore.id].id}/${form.value.id}`, {
method: 'DELETE',
headers: authStore.authHeader,
})
getPreset(-1)
}
}
async function submitMessage() {
const obj = {
text: form.value.text,
x: form.value.x.toString(),
y: form.value.y.toString(),
fontsize: form.value.fontSize.toString(),
line_spacing: form.value.fontSpacing.toString(),
fontcolor: form.value.fontColor + '@' + numberToHex(form.value.fontAlpha),
alpha: form.value.overallAlpha.toString(),
box: form.value.showBox ? '1' : '0',
boxcolor: form.value.boxColor + '@' + numberToHex(form.value.boxAlpha),
boxborderw: form.value.border.toString(),
}
const response = await fetch(`/api/control/${configStore.channels[configStore.id].id}/text/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify(obj),
})
if (response.status === 200) {
indexStore.msgAlert('success', t('message.sendDone'), 2)
} else {
indexStore.msgAlert('error', t('message.sendFailed'), 2)
}
}
</script>

535
frontend/pages/player.vue Normal file
View File

@ -0,0 +1,535 @@
<template>
<div class="h-full">
<PlayerControl />
<div class="flex justify-end p-1">
<div class="h-[32px] flex">
<div class="text-warning flex-none flex justify-end p-2">
<div
v-if="firstLoad && beforeDayStart"
class="tooltip tooltip-right tooltip-warning"
:data-tip="t('player.dateYesterday')"
>
<SvgIcon name="warning" />
</div>
</div>
<VueDatePicker
v-if="!configStore.playout.playlist.infinit && configStore.playout.processing.mode !== 'folder'"
v-model="listDate"
:clearable="false"
:hide-navigation="['time']"
:action-row="{ showCancel: false, showSelect: false, showPreview: false }"
:format="calendarFormat"
model-type="yyyy-MM-dd"
auto-apply
:locale="locale"
:dark="colorMode.value === 'dark'"
:ui="{ input: 'input input-sm !input-bordered !w-[300px] text-right !pe-3' }"
required
@update:model-value=";(beforeDayStart = false), (firstLoad = false)"
/>
</div>
</div>
<div class="p-1 min-h-[260px] h-[calc(100vh-800px)] xl:h-[calc(100vh-480px)]">
<splitpanes
v-if="configStore.playout.processing.mode === 'playlist'"
class="border border-my-gray rounded shadow"
>
<pane
v-if="width > 768"
class="relative h-full !bg-base-300 rounded-s"
min-size="0"
max-size="80"
size="20"
>
<MediaBrowser :preview="setPreviewData" />
</pane>
<pane>
<PlaylistTable ref="playlistTable" :edit-item="editPlaylistItem" :preview="setPreviewData" />
</pane>
</splitpanes>
<div v-else class="h-full border border-b-2 border-my-gray rounded shadow">
<MediaBrowser :preview="setPreviewData" />
</div>
</div>
<div v-if="configStore.playout.processing.mode === 'playlist'" class="h-16 join flex justify-end p-3">
<button class="btn btn-sm btn-primary join-item" :title="t('player.copy')" @click="showCopyModal = true">
<i class="bi-files" />
</button>
<button
v-if="!configStore.playout.playlist.loop"
class="btn btn-sm btn-primary join-item"
:title="t('player.loop')"
@click="loopClips()"
>
<i class="bi-view-stacked" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('player.remote')"
@click="showSourceModal = true"
>
<i class="bi-file-earmark-plus" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('player.import')"
@click="showImportModal = true"
>
<i class="bi-file-text" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('player.generate')"
@click="mediaStore.getTree('', true), (showPlaylistGenerator = true)"
>
<i class="bi-sort-down-alt" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('player.reset')"
@click=";(playlistStore.playlist.length = 0), playlistTable.getPlaylist()"
>
<i class="bi-arrow-counterclockwise" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('player.save')"
@click=";(targetDate = listDate), savePlaylist(true)"
>
<i class="bi-download" />
</button>
<button
class="btn btn-sm btn-primary join-item"
:title="t('player.deletePlaylist')"
@click="showDeleteModal = true"
>
<i class="bi-trash" />
</button>
</div>
<GenericModal
:show="showPreviewModal"
:title="`${t('media.preview')}: ${previewName}`"
:hide-buttons="true"
:modal-action="closePlayer"
>
<div class="w-[1024px] max-w-full aspect-video">
<VideoPlayer v-if="isVideo && previewOpt" reference="previewPlayer" :options="previewOpt" />
<img v-else :src="previewUrl" class="img-fluid" :alt="previewName" />
</div>
</GenericModal>
<GenericModal :show="showCopyModal" :title="t('player.copyTo')" :modal-action="savePlaylist">
<VueDatePicker
v-model="targetDate"
:clearable="false"
:hide-navigation="['time']"
:action-row="{ showCancel: false, showSelect: false, showPreview: false }"
:format="calendarFormat"
model-type="yyyy-MM-dd"
auto-apply
:locale="locale"
:dark="colorMode.value === 'dark'"
:ui="{ input: 'input input-sm !input-bordered !w-[full text-right !pe-3' }"
required
/>
</GenericModal>
<GenericModal :show="showSourceModal" :title="t('player.addEdit')" :modal-action="processSource">
<div>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.title') }}</span>
</div>
<input v-model.number="newSource.title" type="text" class="input input-sm input-bordered w-auto" />
</label>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.duration') }}</span>
</div>
<TimePicker v-model="newSource.duration" />
</label>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.in') }}</span>
</div>
<TimePicker v-model="newSource.in" />
</label>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.out') }}</span>
</div>
<TimePicker v-model="newSource.out" />
</label>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.file') }}</span>
</div>
<input
v-model="newSource.source"
type="text"
class="input input-sm input-bordered w-auto"
:disabled="newSource.source.includes(configStore.channels[configStore.id].storage_path)"
/>
</label>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.audio') }}</span>
</div>
<input v-model="newSource.audio" type="text" class="input input-sm input-bordered w-auto" />
</label>
<label class="form-control w-auto mt-auto">
<div class="label">
<span class="label-text">{{ t('player.customFilter') }}</span>
</div>
<input v-model="newSource.custom_filter" type="text" class="input input-sm input-bordered w-auto" />
</label>
<div class="form-control">
<label class="cursor-pointer label">
<span class="label-text">{{ t('player.ad') }}</span>
<input
type="checkbox"
class="checkbox checkbox-sm"
:checked="newSource.category === 'advertisement'"
@click="isAd"
/>
</label>
</div>
</div>
</GenericModal>
<GenericModal :show="showImportModal" :title="t('player.import')" :modal-action="importPlaylist">
<input
type="file"
class="file-input file-input-sm file-input-bordered w-full"
multiple
@change="onFileChange"
/>
</GenericModal>
<GenericModal :show="showDeleteModal" title="Delete Program" :modal-action="deletePlaylist">
<span>
{{ t('player.deleteFrom') }} <strong>{{ listDate }}</strong>
</span>
</GenericModal>
<PlaylistGenerator
v-if="showPlaylistGenerator"
:close="closeGenerator"
:switch-class="playlistTable.classSwitcher"
/>
</div>
</template>
<script setup lang="ts">
const colorMode = useColorMode()
const { locale, t } = useI18n()
const { $_, $dayjs } = useNuxtApp()
const { width } = useWindowSize({ initialWidth: 800 })
const { mediaType } = stringFormatter()
const { processPlaylist, genUID } = playlistOperations()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const mediaStore = useMedia()
const playlistStore = usePlaylist()
useHead({
title: `${t('button.player')} | ffplayout`,
})
const { listDate, firstLoad } = storeToRefs(usePlaylist())
const beforeDayStart = ref(false)
const targetDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
const playlistTable = ref()
const editId = ref(-1)
const textFile = ref()
const showPreviewModal = ref(false)
const showSourceModal = ref(false)
const showImportModal = ref(false)
const showCopyModal = ref(false)
const showDeleteModal = ref(false)
const showPlaylistGenerator = ref(false)
const previewName = ref('')
const previewUrl = ref('')
const previewOpt = ref()
const isVideo = ref(false)
const newSource = ref({
begin: 0,
title: null,
in: 0,
out: 0,
duration: 0,
category: '',
custom_filter: '',
source: '',
audio: '',
uid: '',
} as PlaylistItem)
onBeforeMount(() => {
const currentTime = $dayjs().utcOffset(configStore.utcOffset)
if (
firstLoad.value &&
currentTime.format('YYYY-MM-DD') === playlistStore.listDate &&
currentTime.format('HH:mm:ss') > '00:00:00' &&
currentTime.format('HH:mm:ss') < configStore.playout.playlist.day_start
) {
listDate.value = $dayjs(playlistStore.listDate).subtract(1, 'day').format('YYYY-MM-DD')
beforeDayStart.value = true
}
if (configStore.onetimeInfo && configStore.playout.playlist.infinit) {
indexStore.msgAlert('warning', t('player.infinitInfo'), 7)
configStore.onetimeInfo = false
}
})
const calendarFormat = (date: Date) => {
return $dayjs(date).locale(locale.value).format('dddd - LL')
}
function closeGenerator() {
showPlaylistGenerator.value = false
}
function closePlayer() {
showPreviewModal.value = false
isVideo.value = false
}
function setPreviewData(path: string) {
let fullPath = path
const storagePath = configStore.channels[configStore.id].storage_path
const lastIndex = storagePath.lastIndexOf('/')
if (!path.includes('/')) {
const parent = mediaStore.folderTree.parent ? mediaStore.folderTree.parent : ''
fullPath = `/${parent}/${mediaStore.folderTree.source}/${path}`.replace(/\/[/]+/g, '/')
} else if (lastIndex !== -1) {
fullPath = path.replace(storagePath.substring(0, lastIndex), '')
}
previewName.value = fullPath.split('/').slice(-1)[0]
showPreviewModal.value = true
if (path.match(/^http/)) {
previewUrl.value = path
} else {
previewUrl.value = encodeURIComponent(`/file/${configStore.channels[configStore.id].id}${fullPath}`).replace(
/%2F/g,
'/'
)
}
const ext = previewName.value.split('.').slice(-1)[0].toLowerCase()
const fileType =
mediaType(previewName.value) === 'audio'
? `audio/${ext}`
: mediaType(previewName.value) === 'live'
? 'application/x-mpegURL'
: `video/${ext}`
if (configStore.playout.storage.extensions.includes(`${ext}`)) {
isVideo.value = true
previewOpt.value = {
liveui: false,
controls: true,
suppressNotSupportedError: true,
autoplay: false,
preload: 'auto',
sources: [
{
type: fileType,
src: previewUrl.value,
},
],
}
} else {
isVideo.value = false
}
}
function processSource(process: boolean) {
showSourceModal.value = false
if (process) {
if (editId.value === -1) {
playlistStore.playlist.push(newSource.value)
} else {
playlistStore.playlist[editId.value] = newSource.value
}
processPlaylist(listDate.value, playlistStore.playlist, false)
playlistTable.value.classSwitcher()
}
editId.value = -1
newSource.value = {
begin: 0,
title: '',
in: 0,
out: 0,
duration: 0,
category: '',
custom_filter: '',
source: '',
audio: '',
uid: genUID(),
}
}
function editPlaylistItem(i: number) {
editId.value = i
showSourceModal.value = true
newSource.value = {
begin: playlistStore.playlist[i].begin,
title: playlistStore.playlist[i].title,
in: playlistStore.playlist[i].in,
out: playlistStore.playlist[i].out,
duration: playlistStore.playlist[i].duration,
category: playlistStore.playlist[i].category,
custom_filter: playlistStore.playlist[i].custom_filter,
source: playlistStore.playlist[i].source,
audio: playlistStore.playlist[i].audio,
uid: playlistStore.playlist[i].uid,
}
}
function isAd(evt: any) {
if (evt.target.checked) {
newSource.value.category = 'advertisement'
} else {
newSource.value.category = ''
}
}
function loopClips() {
const tempList = []
let length = 0
while (length < configStore.playlistLength && playlistStore.playlist.length > 0) {
for (const item of playlistStore.playlist) {
if (length < configStore.playlistLength) {
item.uid = genUID()
tempList.push($_.cloneDeep(item))
length += item.out - item.in
} else {
break
}
}
}
playlistStore.playlist = processPlaylist(listDate.value, tempList, false)
}
function onFileChange(evt: any) {
const files = evt.target.files || evt.dataTransfer.files
if (!files.length) {
return
}
textFile.value = files
}
async function importPlaylist(imp: boolean) {
showImportModal.value = false
if (imp) {
if (!textFile.value || !textFile.value[0]) {
return
}
const formData = new FormData()
formData.append(textFile.value[0].name, textFile.value[0])
playlistStore.isLoading = true
await $fetch(
`/api/file/${configStore.channels[configStore.id].id}/import/?file=${textFile.value[0].name}&date=${
listDate.value
}`,
{
method: 'PUT',
headers: authStore.authHeader,
body: formData,
}
)
.then(async (response) => {
indexStore.msgAlert('success', String(response), 2)
await playlistStore.getPlaylist(listDate.value)
playlistTable.value.classSwitcher()
})
.catch((e: string) => {
indexStore.msgAlert('error', e, 4)
})
}
playlistStore.isLoading = false
textFile.value = null
}
async function savePlaylist(save: boolean) {
showCopyModal.value = false
if (save) {
if (playlistStore.playlist.length === 0) {
return
}
const saveList = processPlaylist(listDate.value, $_.cloneDeep(playlistStore.playlist), true)
await $fetch(`/api/playlist/${configStore.channels[configStore.id].id}/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({
channel: configStore.channels[configStore.id].name,
date: targetDate.value,
program: saveList,
}),
})
.then((response: any) => {
playlistTable.value.classSwitcher()
indexStore.msgAlert('success', response, 2)
})
.catch((e: any) => {
if (e.status === 409) {
indexStore.msgAlert('warning', e.data, 2)
} else {
indexStore.msgAlert('error', e, 4)
}
})
}
}
async function deletePlaylist(del: boolean) {
showDeleteModal.value = false
if (del) {
await $fetch(`/api/playlist/${configStore.channels[configStore.id].id}/${listDate.value}`, {
method: 'DELETE',
headers: { ...configStore.contentType, ...authStore.authHeader },
}).then(() => {
playlistStore.playlist = []
playlistTable.value.classSwitcher()
indexStore.msgAlert('warning', t('player.deleteSuccess'), 2)
})
}
}
</script>

31
frontend/plugins/dayjs.ts Normal file
View File

@ -0,0 +1,31 @@
import dayjs from 'dayjs'
import customParseFormat from 'dayjs/plugin/customParseFormat.js'
import LocalizedFormat from 'dayjs/plugin/localizedFormat.js'
import timezone from 'dayjs/plugin/timezone.js'
import utc from 'dayjs/plugin/utc.js'
import 'dayjs/locale/de'
import 'dayjs/locale/en'
import 'dayjs/locale/es'
import 'dayjs/locale/pt-br'
import 'dayjs/locale/ru'
declare module '#app' {
interface NuxtApp {
$dayjs(date?: dayjs.ConfigType): dayjs.Dayjs
}
}
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$dayjs(date?: dayjs.ConfigType): dayjs.Dayjs
}
}
export default defineNuxtPlugin((nuxtApp) => {
dayjs.extend(customParseFormat)
dayjs.extend(LocalizedFormat)
dayjs.extend(timezone)
dayjs.extend(utc)
nuxtApp.provide('dayjs', dayjs)
})

View File

@ -0,0 +1,17 @@
import lodash from 'lodash'
import type { LoDashStatic } from 'lodash'
declare module '#app' {
interface NuxtApp {
$_: LoDashStatic
}
}
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$_: LoDashStatic
}
}
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.provide('_', lodash)
})

View File

@ -0,0 +1,7 @@
import { defineNuxtPlugin } from '#imports'
import Multiselect from '@vueform/multiselect'
import '@vueform/multiselect/themes/tailwind.css'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('Multiselect', Multiselect)
})

View File

@ -0,0 +1,6 @@
import { defineNuxtPlugin } from '#imports'
import { Sortable } from 'sortablejs-vue3'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('Sortable', Sortable)
})

View File

@ -0,0 +1,7 @@
import { Splitpanes, Pane } from 'splitpanes'
import 'splitpanes/dist/splitpanes.css'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('Splitpanes', Splitpanes)
nuxtApp.vueApp.component('Pane', Pane)
})

View File

@ -0,0 +1,6 @@
import VueDatePicker from '@vuepic/vue-datepicker'
import '@vuepic/vue-datepicker/dist/main.css'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('VueDatePicker', VueDatePicker)
})

BIN
frontend/public/favicon.ico Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

100
frontend/stores/auth.ts Normal file
View File

@ -0,0 +1,100 @@
import { defineStore } from 'pinia'
import { jwtDecode } from 'jwt-decode'
export const useAuth = defineStore('auth', {
state: () => ({
isLogin: false,
jwtToken: '',
authHeader: {},
channelID: 0,
role: '',
uuid: null as null | string,
}),
getters: {},
actions: {
updateToken(token: string) {
const cookie = useCookie('token', {
path: '/',
maxAge: 60 * 60 * 24 * 365,
sameSite: 'lax',
})
cookie.value = token
this.jwtToken = token
this.authHeader = { Authorization: `Bearer ${token}` }
},
removeToken() {
const cookie = useCookie('token')
cookie.value = null
this.isLogin = false
this.jwtToken = ''
this.authHeader = {}
},
async obtainToken(username: string, password: string) {
let code = 0
const payload = {
username,
password,
}
await $fetch<LoginObj>('/auth/login/', {
method: 'POST',
body: JSON.stringify(payload),
async onResponse({ response }) {
code = response.status
},
})
.then((response) => {
this.updateToken(response.user?.token)
const decodedToken = jwtDecode<JwtPayloadExt>(response.user?.token)
this.isLogin = true
this.channelID = decodedToken.channel
this.role = decodedToken.role
})
.catch(() => {})
return code
},
async obtainUuid() {
await $fetch<DataAuth>('/api/generate-uuid', {
method: 'POST',
headers: this.authHeader,
})
.then((response) => {
this.uuid = response.uuid
})
.catch(e => {
if (e.status === 401) {
this.removeToken()
}
this.uuid = null
})
},
inspectToken() {
const token = useCookie('token').value
if (token) {
this.updateToken(token)
const decodedToken = jwtDecode<JwtPayloadExt>(token)
const timestamp = Date.now() / 1000
const expireToken = decodedToken.exp
this.channelID = decodedToken.channel
this.role = decodedToken.role
if (expireToken && this.jwtToken && expireToken - timestamp > 15) {
this.isLogin = true
} else {
// Prompt user to re-login.
this.isLogin = false
}
} else {
this.isLogin = false
}
},
},
})

261
frontend/stores/config.ts Normal file
View File

@ -0,0 +1,261 @@
import _ from 'lodash'
import { defineStore } from 'pinia'
export const useConfig = defineStore('config', {
state: () => ({
id: 0,
configCount: 0,
contentType: { 'content-type': 'application/json;charset=UTF-8' },
channels: [] as Channel[],
channelsRaw: [] as Channel[],
playlistLength: 86400.0,
advanced: {} as any,
playout: {} as any,
currentUser: 0,
configUser: {} as User,
utcOffset: 0,
onetimeInfo: true,
showPlayer: true,
}),
getters: {},
actions: {
async configInit() {
const authStore = useAuth()
authStore.inspectToken()
if (authStore.isLogin) {
await authStore.obtainUuid()
await this.getChannelConfig().then(async () => {
await this.getPlayoutConfig()
await this.getUserConfig()
if (this.configUser.id === 1) {
await this.getAdvancedConfig()
}
})
}
},
logout() {
const authStore = useAuth()
const cookie = useCookie('token')
cookie.value = null
authStore.isLogin = false
navigateTo('/')
},
async getChannelConfig() {
const authStore = useAuth()
const indexStore = useIndex()
let statusCode = 0
await fetch('/api/channels', {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => {
statusCode = response.status
return response
})
.then((response) => response.json())
.then((objs) => {
if (!objs[0]) {
this.logout()
throw new Error('User not found')
}
this.utcOffset = objs[0].utc_offset
this.channels = objs
this.channelsRaw = _.cloneDeep(objs)
this.configCount = objs.length
})
.catch((e) => {
if (statusCode === 401) {
this.logout()
}
this.channels = [
{
id: 1,
extra_extensions: '',
name: 'Channel 1',
preview_url: '',
hls_path: '',
playlist_path: '',
storage_path: '',
uts_offset: 0,
},
]
indexStore.msgAlert('error', e, 3)
})
},
async setChannelConfig(obj: Channel): Promise<any> {
const authStore = useAuth()
const stringObj = _.cloneDeep(obj)
let response
if (this.channelsRaw.some((e) => e.id === stringObj.id)) {
response = await fetch(`/api/channel/${obj.id}`, {
method: 'PATCH',
headers: { ...this.contentType, ...authStore.authHeader },
body: JSON.stringify(stringObj),
})
} else {
response = await fetch('/api/channel/', {
method: 'POST',
headers: { ...this.contentType, ...authStore.authHeader },
body: JSON.stringify(stringObj),
})
const json = await response.json()
const guiConfigs = []
for (const obj of this.channels) {
if (obj.name === stringObj.name) {
guiConfigs.push(json)
} else {
guiConfigs.push(obj)
}
}
this.channels = guiConfigs
this.channelsRaw = _.cloneDeep(guiConfigs)
this.configCount = guiConfigs.length
}
await this.getPlayoutConfig()
return response
},
async getPlayoutConfig() {
const { $i18n } = useNuxtApp()
const { timeToSeconds } = stringFormatter()
const authStore = useAuth()
const indexStore = useIndex()
const channel = this.channels[this.id].id
await fetch(`/api/playout/config/${channel}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => response.json())
.then((data) => {
data.playlist.startInSec = timeToSeconds(data.playlist.day_start ?? 0)
data.playlist.lengthInSec = timeToSeconds(data.playlist.length ?? this.playlistLength)
if (data.storage.extensions) {
data.storage.extensions = data.storage.extensions.join(',')
}
this.playout = data
})
.catch(() => {
indexStore.msgAlert('error', $i18n.t('config.noPlayoutConfig'), 3)
})
},
async getAdvancedConfig() {
const { $i18n } = useNuxtApp()
const authStore = useAuth()
const indexStore = useIndex()
const channel = this.channels[this.id].id
await $fetch(`/api/playout/advanced/${channel}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((data) => {
this.advanced = data
})
.catch(() => {
indexStore.msgAlert('error', $i18n.t('config.noAdvancedConfig'), 3)
})
},
async setPlayoutConfig(obj: any) {
const { timeToSeconds } = stringFormatter()
const authStore = useAuth()
const channel = this.channels[this.id].id
this.playlistLength = timeToSeconds(obj.playlist.length)
this.playout.playlist.startInSec = timeToSeconds(obj.playlist.day_start)
this.playout.playlist.lengthInSec = timeToSeconds(obj.playlist.length)
if (typeof obj.storage.extensions === 'string') {
obj.storage.extensions = obj.storage.extensions.replace(' ', '').split(/,|;/)
}
const update = await fetch(`/api/playout/config/${channel}`, {
method: 'PUT',
headers: { ...this.contentType, ...authStore.authHeader },
body: JSON.stringify(obj),
})
return update
},
async setAdvancedConfig() {
const authStore = useAuth()
const channel = this.channels[this.id].id
const update = await fetch(`/api/playout/advanced/${channel}`, {
method: 'PUT',
headers: { ...this.contentType, ...authStore.authHeader },
body: JSON.stringify(this.advanced),
})
return update
},
async getUserConfig() {
const authStore = useAuth()
await fetch('/api/user', {
method: 'GET',
headers: authStore.authHeader,
})
.then((response) => response.json())
.then((data) => {
if (data.id === 0) {
this.logout()
throw new Error('User not found')
}
this.currentUser = data.id
this.configUser = data
})
},
async setUserConfig(obj: any) {
const authStore = useAuth()
const update = await fetch(`/api/user/${obj.id}`, {
method: 'PUT',
headers: { ...this.contentType, ...authStore.authHeader },
body: JSON.stringify(obj),
})
return update
},
async addNewUser(user: User) {
const authStore = useAuth()
delete user.confirm
const update = await fetch('/api/user/', {
method: 'Post',
headers: { ...this.contentType, ...authStore.authHeader },
body: JSON.stringify(user),
})
return update
},
},
})

32
frontend/stores/index.ts Normal file
View File

@ -0,0 +1,32 @@
import { defineStore } from 'pinia'
export const useIndex = defineStore('index', {
state: () => ({
darkMode: false,
showAlert: false,
alertVariant: 'success',
alertMsg: '',
sseConnected: false,
severityLevels: {
DEBUG: 1,
INFO: 2,
WARN: 3,
ERROR: 4,
} as { [key: string]: number }
}),
getters: {},
actions: {
msgAlert(variance: string, text: string, seconds: number = 3) {
this.alertVariant = variance
this.alertMsg = text
this.showAlert = true
setTimeout(() => {
this.showAlert = false
this.alertVariant = 'success'
this.alertMsg = ''
}, seconds * 1000)
},
},
})

83
frontend/stores/media.ts Normal file
View File

@ -0,0 +1,83 @@
import { defineStore } from 'pinia'
const { genUID } = playlistOperations()
export const useMedia = defineStore('media', {
state: () => ({
currentPath: '',
crumbs: [] as Crumb[],
folderTree: {} as FileFolderObject,
folderList: {} as FolderObject,
folderCrumbs: [] as Crumb[],
isLoading: false,
}),
getters: {},
actions: {
async getTree(path: string, foldersOnly: boolean = false) {
if (!foldersOnly) {
this.isLoading = true
}
const { $i18n } = useNuxtApp()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const channel = configStore.channels[configStore.id].id
const crumbs: Crumb[] = []
let root = '/'
await fetch(`/api/file/${channel}/browse/`, {
method: 'POST',
headers: { ...configStore.contentType, ...authStore.authHeader },
body: JSON.stringify({ source: path, folders_only: foldersOnly }),
})
.then((response) => {
if (response.status === 200) {
return response.json()
} else {
indexStore.msgAlert('error', $i18n.t('media.notExists'), 3)
return {
source: '',
parent: '',
folders: [],
files: [],
}
}
})
.then((data) => {
const pathStr = `${data.parent}/` + data.source
const pathArr = pathStr.split('/')
if (path && path !== '/') {
for (const crumb of pathArr) {
if (crumb === data.parent) {
crumbs.push({ text: crumb, path: root })
} else if (crumb) {
root += crumb + '/'
crumbs.push({ text: crumb, path: root })
}
}
} else {
crumbs.push({ text: data.parent, path: '' })
}
if (foldersOnly) {
this.folderCrumbs = crumbs
data.parent_folders = data.parent_folders?.map((i: any) => ({ uid: genUID(), name: i })) ?? []
data.folders = data.folders.map((i: any) => ({ uid: genUID(), name: i }))
this.folderList = data
} else {
this.currentPath = path
this.crumbs = crumbs
data.parent_folders = data.parent_folders?.map((i: any) => ({ uid: genUID(), name: i })) ?? []
data.folders = data.folders.map((i: any) => ({ uid: genUID(), name: i }))
this.folderTree = data
}
})
this.isLoading = false
},
},
})

View File

@ -0,0 +1,88 @@
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc.js'
import timezone from 'dayjs/plugin/timezone.js'
import { defineStore } from 'pinia'
dayjs.extend(utc)
dayjs.extend(timezone)
const { processPlaylist } = playlistOperations()
export const usePlaylist = defineStore('playlist', {
state: () => ({
playlist: [] as PlaylistItem[],
isLoading: true,
listDate: dayjs().format('YYYY-MM-DD'),
progressValue: 0,
current: {} as PlaylistItem,
currentIndex: 0,
ingestRuns: false,
elapsedSec: 0,
shift: 0,
playoutIsRunning: false,
last_channel: 0,
firstLoad: true,
}),
getters: {},
actions: {
async getPlaylist(date: string) {
const { $_, $i18n } = useNuxtApp()
const authStore = useAuth()
const configStore = useConfig()
const indexStore = useIndex()
const channel = configStore.channels[configStore.id].id
await $fetch<Playlist>(`/api/playlist/${channel}?date=${date}`, {
method: 'GET',
headers: authStore.authHeader,
})
.then((data) => {
if (data.program) {
const programData = processPlaylist(date, data.program, false)
if (
channel === this.last_channel &&
this.playlist.length > 0 &&
programData.length > 0 &&
(this.playlist[0].date === date || configStore.playout.playlist.infinit) &&
$_.differenceWith(this.playlist, programData, (a, b) => {
return $_.isEqual($_.omit(a, ['uid']), $_.omit(b, ['uid']))
}).length > 0
) {
indexStore.msgAlert('warning', $i18n.t('player.unsavedProgram'), 3)
} else {
this.playlist = programData ?? []
}
}
})
.catch((e) => {
if (e.status >= 400) {
indexStore.msgAlert('error', e.data, 5)
} else if (
channel === this.last_channel &&
this.playlist.length > 0 &&
this.playlist[0].date === date
) {
indexStore.msgAlert('warning', $i18n.t('player.unsavedProgram'), 3)
} else {
this.playlist = []
}
})
this.last_channel = channel
},
setStatus(item: PlayoutStatus) {
this.playoutIsRunning = true
this.current = item.media
this.currentIndex = item.index
this.elapsedSec = item.elapsed
this.ingestRuns = item.ingest
this.shift = item.shift
this.progressValue = (this.elapsedSec * 100) / this.current.out
},
},
})

125
frontend/tailwind.config.ts Normal file
View File

@ -0,0 +1,125 @@
import daisyui from 'daisyui'
import svgToDataUri from 'mini-svg-data-uri'
module.exports = {
theme: {
extend: {
backgroundImage: (theme: any) => ({
'multiselect-caret': `url("${svgToDataUri(
`<svg viewBox="0 0 320 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"></path></svg>`
)}")`,
'multiselect-spinner': `url("${svgToDataUri(
`<svg viewBox="0 0 512 512" fill="${theme(
'colors.green.500'
)}" xmlns="http://www.w3.org/2000/svg"><path d="M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z"></path></svg>`
)}")`,
'multiselect-remove': `url("${svgToDataUri(
`<svg viewBox="0 0 320 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"></path></svg>`
)}")`,
}),
maskImage: (theme: any) => ({
'multiselect-caret': `url("${svgToDataUri(
`<svg viewBox="0 0 320 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"></path></svg>`
)}")`,
'multiselect-spinner': `url("${svgToDataUri(
`<svg viewBox="0 0 512 512" fill="${theme(
'colors.green.500'
)}" xmlns="http://www.w3.org/2000/svg"><path d="M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z"></path></svg>`
)}")`,
'multiselect-clear-icon': `url("${svgToDataUri(
`<svg viewBox="0 0 320 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"></path></svg>`
)}")`,
'multiselect-tag-remove-icon': `url("${svgToDataUri(
`<svg viewBox="0 0 320 512" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"></path></svg>`
)}")`,
}),
borderWidth: {
title: '0.1rem',
},
boxShadow: {
'3xl': '0 1em 5em rgba(0, 0, 0, 0.3)',
glow: '0 0 10px rgba(0, 0, 0, 0.3)',
},
colors: {
'my-gray': 'var(--my-gray)',
},
fontFamily: {
sans: ['Source Sans Pro', 'Segoe UI', 'Helvetica Neue', 'Arial', 'sans-serif'],
},
fontSize: {
xxs: '10px',
sm: '14px',
base: '15px',
lg: '20px',
xl: '24px',
},
screens: {
xxs: '374px',
xs: '500px',
'2sm': '825px',
'2md': '876px',
'4xl': { min: '1971px' },
},
transitionProperty: {
height: 'height',
},
},
},
daisyui: {
themes: [
{
light: {
'color-scheme': 'light',
primary: '#e0e0e0',
'base-content': '#222222',
secondary: '#c7c7c7',
accent: '#f28c1b',
'base-100': '#ffffff',
'base-200': '#F2F5F7',
'base-300': '#E5E6E6',
neutral: '#2B3440',
'neutral-focus': '#343232',
info: '#0000ff',
success: '#008000',
warning: '#f28c1b',
error: '#ff3c00',
'--base-100': '#ffffff',
'--base-200': '#F2F5F7',
'--base-300': '#E5E6E6',
'--my-accent': '#f28c1b',
'--my-gray': '#888888',
'--my-purple': '#701a75',
'--my-yellow': '#bea203',
'--my-blue': '#436e9c',
'--my-green': '#68b31e',
},
dark: {
'color-scheme': 'dark',
primary: '#3b3b3b',
'base-content': '#DFDFDF',
secondary: '#d3d3d3',
accent: '#f28c1b',
'base-100': '#313131',
'base-200': '#222222',
'base-300': '#1c1c1c',
neutral: '#272626',
'neutral-focus': '#343232',
info: '#0000ff',
success: '#008000',
warning: '#f28c1b',
error: '#ff3c00',
'--base-100': '#313131',
'--base-200': '#222222',
'--base-300': '#1c1c1c',
'--my-accent': '#f28c1b',
'--my-gray': '#919191',
'--my-purple': '#ad7fa8;',
'--my-yellow': '#e2c317',
'--my-blue': '#6c95c2',
'--my-green': '#8ae234',
},
},
],
},
plugins: [daisyui],
}

7
frontend/tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"exclude": [
"./public"
],
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}

144
frontend/types/index.d.ts vendored Normal file
View File

@ -0,0 +1,144 @@
import type { JwtPayload } from 'jwt-decode'
export {}
declare global {
interface JwtPayloadExt extends JwtPayload {
id: number
channel: number
role: string
}
interface LoginObj {
message: string
user?: {
id: number
mail: string
username: string
token
}
}
interface DataAuth {
uuid: string
}
interface Channel {
id: number
extra_extensions: string | string[]
name: string
preview_url: string
hls_path: string
playlist_path: string
storage_path: string
uts_offset?: number
}
interface User {
id: number
username: string
mail?: string
password?: string
confirm?: string
admin?: boolean
channel_ids?: number[]
role_id?: number
}
interface Crumb {
text: string
path: string
}
interface Payload {
method: string
headers: any
body?: any
}
interface Playlist {
channel: string
date: string
program: PlaylistItem[]
}
interface PlaylistItem {
date?: string
uid: string
begin: number
title?: string | null
source: string
duration: number
in: number
out: number
audio?: string
category?: string
custom_filter?: string
overtime?: boolean
}
interface FileObject {
name: string
duration: number
}
interface Folder {
uid: string
name: string
}
interface FileFolderObject {
source: string
parent: string
parent_folders: Folder[]
folders: Folder[]
files: FileObject[]
}
interface FolderObject {
source: string
parent: string
folders: Folder[]
}
interface SourceObject {
type: string
src: string
}
interface TemplateItem {
start: string
duration: string
shuffle: boolean
paths: string[]
}
interface Template {
sources: TemplateItem[]
}
interface BodyObject {
paths?: string[]
template?: Template
}
interface SystemStatistics {
cpu: { cores: number; usage: number }
load: { one: number; five: number; fifteen: number }
memory: { total: number; used: number; free: number }
network?: { name: string; current_in: number; current_out: number; total_in: number; total_out: number }
storage?: { path: string; total: number; used: number }
swap: { total: number; used: number; free: number }
system: { name?: string; kernel?: string; version?: string; ffp_version?: string }
}
interface PlayoutStatus {
media: PlaylistItem
index: number
ingest: boolean
mode: string
elapsed: number
shift: number
title?: string
}
}