feat: forged-plugs — 17 plugins for Forge Panel
Separated from pelican-dev/plugins, rebranded for Forge. Includes manifest.json for in-panel store browsing.
This commit is contained in:
commit
a43d377930
261 changed files with 23786 additions and 0 deletions
40
README.md
Normal file
40
README.md
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# 🔧 Forged Plugs
|
||||
|
||||
Official plugin repository for [Forge Panel](https://github.com/everestmcarthur/panel).
|
||||
|
||||
## Plugins
|
||||
|
||||
| Plugin | Author | Description |
|
||||
|--------|--------|-------------|
|
||||
| [Announcements](./announcements) | Boy132 | Create panel-wide announcements |
|
||||
| [Billing](./billing) | Boy132 | Purchase servers via Stripe (PoC) |
|
||||
| [Generic OIDC Providers](./generic-oidc-providers) | Boy132 | Create generic OIDC authentication providers |
|
||||
| [Legal Pages](./legal-pages) | Boy132 | Imprint, Privacy Policy, ToS pages |
|
||||
| [MCLogs Uploader](./mclogs-uploader) | Boy132 | Upload console logs to mclo.gs |
|
||||
| [Minecraft Modrinth](./minecraft-modrinth) | Boy132 | Download mods & plugins from Modrinth |
|
||||
| [Pirate Language](./pirate-language) | Boy132 | Arrr, matey! |
|
||||
| [Player Counter](./player-counter) | Boy132 | Show connected player count |
|
||||
| [Register](./register) | Boy132 | User self-registration |
|
||||
| [Robo Avatars](./robo-avatars) | Boy132 | RoboHash avatar provider |
|
||||
| [Rust uMod](./rust-umod) | Boy132 | Download Rust plugins from uMod |
|
||||
| [Snowflakes](./snowflakes) | Boy132 | CSS snowflake effects |
|
||||
| [Subdomains](./subdomains) | Boy132 | Cloudflare subdomains for servers |
|
||||
| [Tawk.to Widget](./tawkto-widget) | Boy132 | Live chat widget |
|
||||
| [Theme Customizer](./theme-customizer) | Boy132 | Customize panel font and colors |
|
||||
| [Tickets](./tickets) | Boy132 | Simple ticket system |
|
||||
| [User Creatable Servers](./user-creatable-servers) | Boy132 | Let users create their own servers |
|
||||
|
||||
## Installation
|
||||
|
||||
Plugins can be installed directly from the Forge Panel admin area:
|
||||
|
||||
**Admin → Plugins → Plugin Store → Browse & Install**
|
||||
|
||||
Or manually:
|
||||
1. Download the plugin folder
|
||||
2. Place it in `/var/www/forge/plugins/`
|
||||
3. Go to Admin → Plugins → Install
|
||||
|
||||
## For Themes
|
||||
|
||||
See [forged-themes](https://github.com/everestmcarthur/forged-themes) for panel themes.
|
||||
674
announcements/LICENSE
Normal file
674
announcements/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
11
announcements/README.md
Normal file
11
announcements/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Announcements (by Boy132)
|
||||
|
||||
Create panel-wide announcements to inform your users about important updates, maintenance schedules, or any other information.
|
||||
|
||||
## Features
|
||||
|
||||
- Create announcements with customizable titles and body text
|
||||
- Support for different announcement types (info, warning, danger, success)
|
||||
- Target specific panels (admin, app, server) or display on all panels
|
||||
- Schedule announcements with valid from/to dates
|
||||
- Announcements are displayed as alert banners across the panel
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('announcements', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title');
|
||||
$table->string('body')->nullable();
|
||||
$table->string('type')->default('info');
|
||||
$table->json('panels')->nullable();
|
||||
$table->timestamp('valid_from')->nullable();
|
||||
$table->timestamp('valid_to')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('announcements');
|
||||
}
|
||||
};
|
||||
16
announcements/lang/en/strings.php
Normal file
16
announcements/lang/en/strings.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'no_announcements' => 'No Announcements',
|
||||
'announcement' => 'Announcement|Announcements',
|
||||
'title' => 'Title',
|
||||
'body' => 'Body',
|
||||
'no_body' => 'No Body',
|
||||
'type' => 'Type',
|
||||
'panels' => 'Panels',
|
||||
'all_panels' => 'All Panels',
|
||||
'valid_from' => 'Valid from',
|
||||
'no_valid_from' => 'No valid from',
|
||||
'valid_to' => 'Valid to',
|
||||
'no_valid_to' => 'No valid to',
|
||||
];
|
||||
15
announcements/plugin.json
Normal file
15
announcements/plugin.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"id": "announcements",
|
||||
"name": "Announcements",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Create panel wide announcements to inform your users about stuff",
|
||||
"category": "plugin",
|
||||
"url": "https://github.com/everestmcarthur/forged-plugs/tree/main/announcements",
|
||||
"update_url": null,
|
||||
"namespace": "Boy132\\Announcements",
|
||||
"class": "AnnouncementsPlugin",
|
||||
"panels": null,
|
||||
"panel_version": null,
|
||||
"composer_packages": null
|
||||
}
|
||||
38
announcements/src/AnnouncementsPlugin.php
Normal file
38
announcements/src/AnnouncementsPlugin.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Announcements;
|
||||
|
||||
use App\Livewire\AlertBanner;
|
||||
use Boy132\Announcements\Models\Announcement;
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
|
||||
class AnnouncementsPlugin implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'announcements';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
$id = str($panel->getId())->title();
|
||||
|
||||
$panel->discoverResources(plugin_path($this->getId(), "src/Filament/$id/Resources"), "Boy132\\Announcements\\Filament\\$id\\Resources");
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void
|
||||
{
|
||||
foreach (Announcement::all() as $announcement) {
|
||||
if (!$announcement->shouldDisplay($panel)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AlertBanner::make('announcement_' . $announcement->id)
|
||||
->title($announcement->title)
|
||||
->body($announcement->body)
|
||||
->status($announcement->type)
|
||||
->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Announcements\Filament\Admin\Resources\Announcements;
|
||||
|
||||
use Boy132\Announcements\Filament\Admin\Resources\Announcements\Pages\ManageAnnouncements;
|
||||
use Boy132\Announcements\Models\Announcement;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class AnnouncementResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Announcement::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-speakerphone';
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return trans_choice('announcements::strings.announcement', 2);
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return trans_choice('announcements::strings.announcement', 1);
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return trans_choice('announcements::strings.announcement', 2);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('title')
|
||||
->label(trans('announcements::strings.title')),
|
||||
TextColumn::make('body')
|
||||
->label(trans('announcements::strings.body'))
|
||||
->placeholder(trans('announcements::strings.no_body')),
|
||||
TextColumn::make('type')
|
||||
->label(trans('announcements::strings.type'))
|
||||
->color(fn ($state) => $state)
|
||||
->badge(),
|
||||
TextColumn::make('panels')
|
||||
->label(trans('announcements::strings.panels'))
|
||||
->placeholder(trans('announcements::strings.all_panels'))
|
||||
->badge(),
|
||||
TextColumn::make('valid_from')
|
||||
->label(trans('announcements::strings.valid_from'))
|
||||
->placeholder(trans('announcements::strings.no_valid_from'))
|
||||
->dateTime(),
|
||||
TextColumn::make('valid_to')
|
||||
->label(trans('announcements::strings.valid_to'))
|
||||
->placeholder(trans('announcements::strings.no_valid_to'))
|
||||
->dateTime(),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make()
|
||||
->hidden(fn ($record) => static::getEditAuthorizationResponse($record)->allowed()),
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false),
|
||||
])
|
||||
->emptyStateIcon('tabler-speakerphone')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateHeading(trans('announcements::strings.no_announcements'));
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('title')
|
||||
->label(trans('announcements::strings.title'))
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('body')
|
||||
->label(trans('announcements::strings.body'))
|
||||
->placeholder(trans('announcements::strings.no_body'))
|
||||
->nullable()
|
||||
->columnSpanFull(),
|
||||
Select::make('type')
|
||||
->label(trans('announcements::strings.type'))
|
||||
->selectablePlaceholder(false)
|
||||
->default('info')
|
||||
->options([
|
||||
'info' => 'Info',
|
||||
'success' => 'Success',
|
||||
'warning' => 'Warning',
|
||||
'danger' => 'Danger',
|
||||
]),
|
||||
Select::make('panels')
|
||||
->label(trans('announcements::strings.panels'))
|
||||
->multiple()
|
||||
->options([
|
||||
'admin' => 'Admin Area',
|
||||
'server' => 'Client Area',
|
||||
'app' => 'Server List',
|
||||
]),
|
||||
DateTimePicker::make('valid_from')
|
||||
->label(trans('announcements::strings.valid_from'))
|
||||
->placeholder(trans('announcements::strings.no_valid_from'))
|
||||
->nullable(),
|
||||
DateTimePicker::make('valid_to')
|
||||
->label(trans('announcements::strings.valid_to'))
|
||||
->placeholder(trans('announcements::strings.no_valid_to'))
|
||||
->nullable(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('title')
|
||||
->label(trans('announcements::strings.title'))
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('body')
|
||||
->label(trans('announcements::strings.body'))
|
||||
->placeholder(trans('announcements::strings.no_body'))
|
||||
->columnSpanFull(),
|
||||
TextEntry::make('type')
|
||||
->label(trans('announcements::strings.type'))
|
||||
->color(fn ($state) => $state)
|
||||
->badge(),
|
||||
TextEntry::make('panels')
|
||||
->label(trans('announcements::strings.panels'))
|
||||
->placeholder(trans('announcements::strings.all_panels'))
|
||||
->badge(),
|
||||
TextEntry::make('valid_from')
|
||||
->label(trans('announcements::strings.valid_from'))
|
||||
->placeholder(trans('announcements::strings.no_valid_from')),
|
||||
TextEntry::make('valid_to')
|
||||
->label(trans('announcements::strings.valid_to'))
|
||||
->placeholder(trans('announcements::strings.no_valid_to')),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageAnnouncements::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Announcements\Filament\Admin\Resources\Announcements\Pages;
|
||||
|
||||
use Boy132\Announcements\Filament\Admin\Resources\Announcements\AnnouncementResource;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageAnnouncements extends ManageRecords
|
||||
{
|
||||
protected static string $resource = AnnouncementResource::class;
|
||||
}
|
||||
58
announcements/src/Models/Announcement.php
Normal file
58
announcements/src/Models/Announcement.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Announcements\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property string|null $body
|
||||
* @property string $type
|
||||
* @property string[]|null $panels
|
||||
* @property Carbon|null $valid_from
|
||||
* @property Carbon|null $valid_to
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*/
|
||||
class Announcement extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'body',
|
||||
'type',
|
||||
'panels',
|
||||
'valid_from',
|
||||
'valid_to',
|
||||
];
|
||||
|
||||
protected $attributes = [
|
||||
'panels' => '[]',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'panels' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
public function shouldDisplay(Panel $panel): bool
|
||||
{
|
||||
if (!empty($this->panels) && !in_array($panel->getId(), $this->panels)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->valid_from) && now() < $this->valid_from) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->valid_to) && now() > $this->valid_to) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
12
announcements/src/Policies/AnnouncementPolicy.php
Normal file
12
announcements/src/Policies/AnnouncementPolicy.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Announcements\Policies;
|
||||
|
||||
use App\Policies\DefaultAdminPolicies;
|
||||
|
||||
class AnnouncementPolicy
|
||||
{
|
||||
use DefaultAdminPolicies;
|
||||
|
||||
protected string $modelName = 'announcement';
|
||||
}
|
||||
17
announcements/src/Providers/AnnouncementsPluginProvider.php
Normal file
17
announcements/src/Providers/AnnouncementsPluginProvider.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Announcements\Providers;
|
||||
|
||||
use App\Models\Role;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AnnouncementsPluginProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
Role::registerCustomDefaultPermissions('announcement');
|
||||
Role::registerCustomModelIcon('announcement', 'tabler-speakerphone');
|
||||
}
|
||||
|
||||
public function boot(): void {}
|
||||
}
|
||||
674
billing/LICENSE
Normal file
674
billing/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
16
billing/README.md
Normal file
16
billing/README.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Billing (by Boy132)
|
||||
|
||||
A simple billing plugin that allows users to purchase servers using Stripe as the payment processor.
|
||||
|
||||
**WARNING: This plugin is incomplete! Do NOT use this plugin in production!**
|
||||
|
||||
## Features
|
||||
|
||||
- Stripe integration for payment processing
|
||||
- Product management with customizable pricing intervals (monthly, yearly, etc.)
|
||||
- Coupon system with percentage and fixed amount discounts
|
||||
- Customer management linked to user accounts
|
||||
- Order tracking and management
|
||||
- Dashboard widget for users to view and purchase products
|
||||
- Multi-currency support (USD, EUR, GBP)
|
||||
- Configurable deployment tags for automatic server provisioning
|
||||
10
billing/config/billing.php
Normal file
10
billing/config/billing.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'key' => env('STRIPE_KEY'),
|
||||
'secret' => env('STRIPE_SECRET'),
|
||||
|
||||
'currency' => env('BILLING_CURRENCY', 'USD'),
|
||||
|
||||
'deployment_tags' => env('BILLING_DEPLOYMENT_TAGS'),
|
||||
];
|
||||
29
billing/database/migrations/001_create_coupons_table.php
Normal file
29
billing/database/migrations/001_create_coupons_table.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('coupons', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('stripe_coupon_id')->nullable();
|
||||
$table->string('stripe_promotion_id')->nullable();
|
||||
$table->string('name');
|
||||
$table->string('code')->unique();
|
||||
$table->integer('amount_off')->nullable();
|
||||
$table->integer('percent_off')->nullable();
|
||||
$table->integer('max_redemptions')->nullable();
|
||||
$table->dateTime('redeem_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('coupons');
|
||||
}
|
||||
};
|
||||
26
billing/database/migrations/002_create_customers_table.php
Normal file
26
billing/database/migrations/002_create_customers_table.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->integer('balance')->default(0);
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
};
|
||||
37
billing/database/migrations/003_create_products_table.php
Normal file
37
billing/database/migrations/003_create_products_table.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('stripe_id')->nullable();
|
||||
$table->string('name');
|
||||
$table->text('description');
|
||||
$table->unsignedInteger('cpu')->default(0);
|
||||
$table->unsignedInteger('memory')->default(0);
|
||||
$table->unsignedInteger('disk')->default(0);
|
||||
$table->unsignedInteger('swap')->default(0);
|
||||
$table->json('ports');
|
||||
$table->json('tags');
|
||||
$table->unsignedInteger('allocation_limit')->default(0);
|
||||
$table->unsignedInteger('database_limit')->default(0);
|
||||
$table->unsignedInteger('backup_limit')->default(0);
|
||||
|
||||
$table->unsignedInteger('egg_id');
|
||||
$table->foreign('egg_id')->references('id')->on('eggs')->cascadeOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Boy132\Billing\Enums\PriceInterval;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('product_prices', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('stripe_id')->nullable();
|
||||
$table->string('name');
|
||||
$table->float('cost', 2);
|
||||
$table->boolean('renewable')->default(true);
|
||||
$table->string('interval_type')->default(PriceInterval::Month);
|
||||
$table->unsignedInteger('interval_value')->default(1);
|
||||
|
||||
$table->unsignedInteger('product_id');
|
||||
$table->foreign('product_id')->references('id')->on('products')->cascadeOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('product_prices');
|
||||
}
|
||||
};
|
||||
36
billing/database/migrations/005_create_orders_table.php
Normal file
36
billing/database/migrations/005_create_orders_table.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('orders', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('stripe_checkout_id')->nullable();
|
||||
$table->string('stripe_payment_id')->nullable();
|
||||
$table->string('status')->default(OrderStatus::Pending);
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
|
||||
$table->unsignedInteger('customer_id');
|
||||
$table->foreign('customer_id')->references('id')->on('customers')->cascadeOnDelete();
|
||||
|
||||
$table->unsignedInteger('product_price_id');
|
||||
$table->foreign('product_price_id')->references('id')->on('product_prices')->cascadeOnDelete();
|
||||
|
||||
$table->unsignedInteger('server_id')->nullable();
|
||||
$table->foreign('server_id')->references('id')->on('servers')->nullOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('orders');
|
||||
}
|
||||
};
|
||||
17
billing/plugin.json
Normal file
17
billing/plugin.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"id": "billing",
|
||||
"name": "Billing",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple billing plugin which allows users to purchase servers.",
|
||||
"category": "plugin",
|
||||
"url": "https://github.com/everestmcarthur/forged-plugs/tree/main/billing",
|
||||
"update_url": null,
|
||||
"namespace": "Boy132\\Billing",
|
||||
"class": "BillingPlugin",
|
||||
"panels": null,
|
||||
"panel_version": null,
|
||||
"composer_packages": {
|
||||
"stripe/stripe-php": "^20.1"
|
||||
}
|
||||
}
|
||||
3
billing/resources/views/widget.blade.php
Normal file
3
billing/resources/views/widget.blade.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<x-filament-widgets::widget>
|
||||
{{ $this->content }}
|
||||
</x-filament-widgets::widget>
|
||||
98
billing/src/BillingPlugin.php
Normal file
98
billing/src/BillingPlugin.php
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing;
|
||||
|
||||
use App\Contracts\Plugins\HasPluginSettings;
|
||||
use App\Enums\CustomizationKey;
|
||||
use App\Filament\App\Resources\Servers\ServerResource;
|
||||
use App\Filament\Pages\Auth\EditProfile;
|
||||
use App\Traits\EnvironmentWriterTrait;
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Navigation\NavigationItem;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Panel;
|
||||
|
||||
class BillingPlugin implements HasPluginSettings, Plugin
|
||||
{
|
||||
use EnvironmentWriterTrait;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return 'billing';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
$id = str($panel->getId())->title();
|
||||
|
||||
if ($panel->getId() === 'app') {
|
||||
ServerResource::embedServerList();
|
||||
|
||||
$panel->navigation(true);
|
||||
$panel->topbar(function () {
|
||||
$navigationType = user()?->getCustomization(CustomizationKey::TopNavigation);
|
||||
|
||||
return $navigationType === 'topbar' || $navigationType === 'mixed' || $navigationType === true;
|
||||
});
|
||||
|
||||
$panel->navigationItems([
|
||||
NavigationItem::make(fn () => trans('filament-panels::auth/pages/edit-profile.label'))
|
||||
->icon('tabler-user-circle')
|
||||
->url(fn () => EditProfile::getUrl(panel: 'app'))
|
||||
->isActiveWhen(fn () => request()->routeIs(EditProfile::getRouteName()))
|
||||
->sort(99),
|
||||
]);
|
||||
|
||||
$panel->clearCachedComponents();
|
||||
}
|
||||
|
||||
$panel->discoverResources(plugin_path($this->getId(), "src/Filament/$id/Resources"), "Boy132\\Billing\\Filament\\$id\\Resources");
|
||||
$panel->discoverPages(plugin_path($this->getId(), "src/Filament/$id/Pages"), "Boy132\\Billing\\Filament\\$id\\Pages");
|
||||
$panel->discoverWidgets(plugin_path($this->getId(), "src/Filament/$id/Widgets"), "Boy132\\Billing\\Filament\\$id\\Widgets");
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void {}
|
||||
|
||||
public function getSettingsForm(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('key')
|
||||
->label('Stripe Key')
|
||||
->required()
|
||||
->default(fn () => config('billing.key')),
|
||||
TextInput::make('secret')
|
||||
->label('Stripe Secret')
|
||||
->required()
|
||||
->default(fn () => config('billing.secret')),
|
||||
Select::make('currency')
|
||||
->label('Currency')
|
||||
->required()
|
||||
->default(fn () => config('billing.currency'))
|
||||
->options([
|
||||
'USD' => 'US Dollar',
|
||||
'EUR' => 'Euro',
|
||||
'GBP' => 'British Pound',
|
||||
]),
|
||||
TagsInput::make('deployment_tags')
|
||||
->label('Default node tags for deployment'),
|
||||
];
|
||||
}
|
||||
|
||||
public function saveSettings(array $data): void
|
||||
{
|
||||
$this->writeToEnvironment([
|
||||
'STRIPE_KEY' => $data['key'],
|
||||
'STRIPE_SECRET' => $data['secret'],
|
||||
'BILLING_CURRENCY' => $data['currency'],
|
||||
'BILLING_DEPLOYMENT_TAGS' => implode(',', $data['deployment_tags']),
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Settings saved')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
61
billing/src/Console/Commands/CheckOrdersCommand.php
Normal file
61
billing/src/Console/Commands/CheckOrdersCommand.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Console\Commands;
|
||||
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Boy132\Billing\Filament\App\Resources\Orders\Pages\ListOrders;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class CheckOrdersCommand extends Command
|
||||
{
|
||||
protected $signature = 'p:billing:check-orders';
|
||||
|
||||
protected $description = 'Checks the expire date for orders.';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$orders = Order::all();
|
||||
|
||||
if ($orders->count() < 1) {
|
||||
$this->line('No orders');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
$bar = $this->output->createProgressBar($orders->count());
|
||||
foreach ($orders as $order) {
|
||||
$bar->clear();
|
||||
|
||||
if ($order->checkExpire()) {
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Order expired')
|
||||
->body($order->getLabel())
|
||||
->actions([
|
||||
Action::make('goto_orders')
|
||||
->label('Go to orders')
|
||||
->markAsRead()
|
||||
->url(ListOrders::getUrl(panel: 'app')),
|
||||
Action::make('renew')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Expired && $order->productPrice->renewable)
|
||||
->label('Renew')
|
||||
->color('warning')
|
||||
->requiresConfirmation()
|
||||
->markAsRead()
|
||||
->action(fn (Order $order) => redirect($order->getCheckoutSession()->url)),
|
||||
])
|
||||
->sendToDatabase($order->customer->user);
|
||||
}
|
||||
|
||||
$bar->advance();
|
||||
$bar->display();
|
||||
}
|
||||
|
||||
$this->line('');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
16
billing/src/Enums/CouponType.php
Normal file
16
billing/src/Enums/CouponType.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum CouponType: string implements HasLabel
|
||||
{
|
||||
case Amount = 'amount';
|
||||
case Percentage = 'percentage';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
40
billing/src/Enums/OrderStatus.php
Normal file
40
billing/src/Enums/OrderStatus.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasColor;
|
||||
use Filament\Support\Contracts\HasIcon;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum OrderStatus: string implements HasColor, HasIcon, HasLabel
|
||||
{
|
||||
case Pending = 'pending';
|
||||
case Active = 'active';
|
||||
case Expired = 'expired';
|
||||
case Closed = 'closed';
|
||||
|
||||
public function getColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Pending => 'warning',
|
||||
self::Active => 'success',
|
||||
self::Expired => 'warning',
|
||||
self::Closed => 'danger',
|
||||
};
|
||||
}
|
||||
|
||||
public function getIcon(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Pending => 'tabler-circle-dotted',
|
||||
self::Active => 'tabler-circle-check',
|
||||
self::Expired => 'tabler-clock-hour-4',
|
||||
self::Closed => 'tabler-circle-x',
|
||||
};
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
18
billing/src/Enums/PriceInterval.php
Normal file
18
billing/src/Enums/PriceInterval.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum PriceInterval: string implements HasLabel
|
||||
{
|
||||
case Day = 'day';
|
||||
case Week = 'week';
|
||||
case Month = 'month';
|
||||
case Year = 'year';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
129
billing/src/Filament/Admin/Resources/Coupons/CouponResource.php
Normal file
129
billing/src/Filament/Admin/Resources/Coupons/CouponResource.php
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Coupons;
|
||||
|
||||
use App\Filament\Components\Tables\Columns\DateTimeColumn;
|
||||
use Boy132\Billing\Enums\CouponType;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Coupons\Pages\CreateCoupon;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Coupons\Pages\EditCoupon;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Coupons\Pages\ListCoupons;
|
||||
use Boy132\Billing\Models\Coupon;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\ToggleButtons;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CouponResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Coupon::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-receipt-tax';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Billing';
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('code')
|
||||
->placeholder('Leave empty to generate random code')
|
||||
->unique(),
|
||||
ToggleButtons::make('coupon_type')
|
||||
->dehydrated()
|
||||
->live()
|
||||
->inline()
|
||||
->options(CouponType::class)
|
||||
->default(CouponType::Amount)
|
||||
->afterStateUpdated(function (Set $set) {
|
||||
$set('amount_off', null);
|
||||
$set('percent_off', null);
|
||||
}),
|
||||
TextInput::make('amount_off')
|
||||
->visible(fn (Get $get) => $get('coupon_type') === CouponType::Amount)
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(1)
|
||||
->suffix(config('billing.currency')),
|
||||
TextInput::make('percent_off')
|
||||
->visible(fn (Get $get) => $get('coupon_type') === CouponType::Percentage)
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(1)
|
||||
->maxValue(100)
|
||||
->suffix('%'),
|
||||
TextInput::make('max_redemptions')
|
||||
->placeholder('Leave empty for no redemption limit')
|
||||
->nullable()
|
||||
->numeric()
|
||||
->minValue(1),
|
||||
DateTimePicker::make('redeem_by')
|
||||
->placeholder('Leave empty for no time constraint')
|
||||
->native(false)
|
||||
->nullable(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('code')
|
||||
->badge()
|
||||
->sortable(),
|
||||
TextColumn::make('coupon')
|
||||
->badge()
|
||||
->state(fn (Coupon $coupon) => $coupon->amount_off ? $coupon->amount_off . ' ' . config('billing.currency') : $coupon->percent_off . ' %'),
|
||||
TextColumn::make('max_redemptions')
|
||||
->placeholder('No redemption limit')
|
||||
->sortable(),
|
||||
DateTimeColumn::make('redeem_by')
|
||||
->placeholder('No time constraint')
|
||||
->sortable()
|
||||
->since(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false),
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make('exclude_bulk_delete'),
|
||||
]),
|
||||
])
|
||||
->emptyStateHeading('No Coupons')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateIcon('tabler-receipt-tax');
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListCoupons::route('/'),
|
||||
'create' => CreateCoupon::route('/create'),
|
||||
'edit' => EditCoupon::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Coupons\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Coupons\CouponResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCoupon extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CouponResource::class;
|
||||
|
||||
protected static bool $canCreateAnother = false;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCreateFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-plus'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Coupons\Pages;
|
||||
|
||||
use Boy132\Billing\Enums\CouponType;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Coupons\CouponResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCoupon extends EditRecord
|
||||
{
|
||||
protected static string $resource = CouponResource::class;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCancelFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-arrow-left'),
|
||||
DeleteAction::make(),
|
||||
$this->getSaveFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-device-floppy'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$data['coupon_type'] = $data['amount_off'] ? CouponType::Amount : CouponType::Percentage;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Coupons\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Coupons\CouponResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCoupons extends ListRecords
|
||||
{
|
||||
protected static string $resource = CouponResource::class;
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Customers;
|
||||
|
||||
use App\Models\User;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\Pages\CreateCustomer;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\Pages\EditCustomer;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\Pages\ListCustomers;
|
||||
use Boy132\Billing\Models\Customer;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use NumberFormatter;
|
||||
|
||||
class CustomerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Customer::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-user-dollar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Billing';
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('user_id')
|
||||
->prefixIcon('tabler-user')
|
||||
->label('User')
|
||||
->required()
|
||||
->selectablePlaceholder(false)
|
||||
->relationship('user', 'username')
|
||||
->searchable(['username', 'email'])
|
||||
->getOptionLabelFromRecordUsing(fn (User $user) => $user->email . ' | ' . $user->username)
|
||||
->preload(),
|
||||
TextInput::make('balance')
|
||||
->required()
|
||||
->suffix(config('billing.currency'))
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0),
|
||||
TextInput::make('first_name')
|
||||
->required(),
|
||||
TextInput::make('last_name')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('first_name')
|
||||
->sortable(),
|
||||
TextColumn::make('last_name')
|
||||
->sortable(),
|
||||
TextColumn::make('user.email')
|
||||
->label('E-Mail')
|
||||
->sortable(),
|
||||
TextColumn::make('balance')
|
||||
->numeric()
|
||||
->formatStateUsing(function ($state) {
|
||||
$formatter = new NumberFormatter(auth()->user()->language, NumberFormatter::CURRENCY);
|
||||
|
||||
return $formatter->formatCurrency($state, config('billing.currency'));
|
||||
}),
|
||||
TextColumn::make('orders_count')
|
||||
->label('Orders')
|
||||
->counts('orders')
|
||||
->badge(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false),
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make('exclude_bulk_delete'),
|
||||
]),
|
||||
])
|
||||
->emptyStateHeading('No Customers')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateIcon('tabler-user-dollar');
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListCustomers::route('/'),
|
||||
'create' => CreateCustomer::route('/create'),
|
||||
'edit' => EditCustomer::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Customers\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\CustomerResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCustomer extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CustomerResource::class;
|
||||
|
||||
protected static bool $canCreateAnother = false;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCreateFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-plus'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Customers\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\CustomerResource;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\RelationManagers\OrderRelationManager;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCustomer extends EditRecord
|
||||
{
|
||||
protected static string $resource = CustomerResource::class;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCancelFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-arrow-left'),
|
||||
DeleteAction::make(),
|
||||
$this->getSaveFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-device-floppy'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getRelationManagers(): array
|
||||
{
|
||||
return [
|
||||
OrderRelationManager::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Customers\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\CustomerResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCustomers extends ListRecords
|
||||
{
|
||||
protected static string $resource = CustomerResource::class;
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Customers\RelationManagers;
|
||||
|
||||
use App\Filament\Admin\Resources\Servers\Pages\EditServer;
|
||||
use App\Filament\Components\Tables\Columns\DateTimeColumn;
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\Pages\EditProduct;
|
||||
use Boy132\Billing\Models\Customer;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Exception;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use NumberFormatter;
|
||||
|
||||
/**
|
||||
* @method Customer getOwnerRecord()
|
||||
*/
|
||||
class OrderRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'orders';
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')
|
||||
->label('ID')
|
||||
->sortable(),
|
||||
TextColumn::make('status')
|
||||
->sortable()
|
||||
->badge(),
|
||||
TextColumn::make('server.name')
|
||||
->label('Server')
|
||||
->placeholder('No server')
|
||||
->icon('tabler-brand-docker')
|
||||
->sortable()
|
||||
->url(fn (Order $order): ?string => $order->server ? EditServer::getUrl(['record' => $order->server]) : null),
|
||||
TextColumn::make('productPrice.product.name')
|
||||
->label('Product')
|
||||
->icon('tabler-package')
|
||||
->sortable()
|
||||
->url(fn (Order $order): string => EditProduct::getUrl(['record' => $order->productPrice->product])),
|
||||
TextColumn::make('productPrice.name')
|
||||
->label('Price')
|
||||
->sortable(),
|
||||
TextColumn::make('productPrice.cost')
|
||||
->label('Cost')
|
||||
->sortable()
|
||||
->formatStateUsing(function ($state) {
|
||||
$formatter = new NumberFormatter(auth()->user()->language, NumberFormatter::CURRENCY);
|
||||
|
||||
return $formatter->formatCurrency($state, config('billing.currency'));
|
||||
}),
|
||||
DateTimeColumn::make('expires_at')
|
||||
->label('Expires')
|
||||
->placeholder('No expire')
|
||||
->color(fn ($state) => $state <= now('UTC') ? 'danger' : null)
|
||||
->since(),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('activate')
|
||||
->visible(fn (Order $order) => $order->status !== OrderStatus::Active)
|
||||
->color('success')
|
||||
->requiresConfirmation()
|
||||
->action(function (Order $order) {
|
||||
$order->activate(null);
|
||||
|
||||
Notification::make()
|
||||
->title('Order activated')
|
||||
->body($order->getLabel())
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
Action::make('create_server')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Active && !$order->server)
|
||||
->color('primary')
|
||||
->requiresConfirmation()
|
||||
->action(function (Order $order) {
|
||||
try {
|
||||
$order->createServer();
|
||||
} catch (Exception $exception) {
|
||||
Notification::make()
|
||||
->title('Could not create server')
|
||||
->body($exception->getMessage())
|
||||
->danger()
|
||||
->persistent()
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
Action::make('close')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Active)
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->action(function (Order $order) {
|
||||
$order->close();
|
||||
|
||||
Notification::make()
|
||||
->title('Order closed')
|
||||
->body($order->getLabel())
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
])
|
||||
->emptyStateHeading('No Orders')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateIcon('tabler-truck-delivery');
|
||||
}
|
||||
}
|
||||
168
billing/src/Filament/Admin/Resources/Orders/OrderResource.php
Normal file
168
billing/src/Filament/Admin/Resources/Orders/OrderResource.php
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Orders;
|
||||
|
||||
use App\Filament\Admin\Resources\Servers\Pages\EditServer;
|
||||
use App\Filament\Components\Tables\Columns\DateTimeColumn;
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Customers\Pages\EditCustomer;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Orders\Pages\ListOrders;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\Pages\EditProduct;
|
||||
use Boy132\Billing\Models\Customer;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Boy132\Billing\Models\ProductPrice;
|
||||
use Exception;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use NumberFormatter;
|
||||
|
||||
class OrderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Order::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-truck-delivery';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Billing';
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('customer_id')
|
||||
->label('Customer')
|
||||
->required()
|
||||
->selectablePlaceholder(false)
|
||||
->relationship('customer')
|
||||
->getOptionLabelFromRecordUsing(fn (Customer $customer) => $customer->getLabel())
|
||||
->preload(),
|
||||
Select::make('product_price_id')
|
||||
->label('Product')
|
||||
->required()
|
||||
->selectablePlaceholder(false)
|
||||
->relationship('productPrice')
|
||||
->getOptionLabelFromRecordUsing(fn (ProductPrice $productPrice) => $productPrice->product->getLabel() . ' (' . $productPrice->getLabel() . ')')
|
||||
->preload(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id')
|
||||
->label('ID')
|
||||
->sortable(),
|
||||
TextColumn::make('status')
|
||||
->sortable()
|
||||
->badge()
|
||||
->visible(fn ($livewire) => $livewire->activeTab === 'all'),
|
||||
TextColumn::make('customer')
|
||||
->label('Customer')
|
||||
->icon('tabler-user-dollar')
|
||||
->sortable()
|
||||
->url(fn (Order $order) => EditCustomer::getUrl(['record' => $order->customer])),
|
||||
TextColumn::make('server.name')
|
||||
->label('Server')
|
||||
->placeholder('No server')
|
||||
->icon('tabler-brand-docker')
|
||||
->sortable()
|
||||
->url(fn (Order $order) => $order->server ? EditServer::getUrl(['record' => $order->server]) : null),
|
||||
TextColumn::make('productPrice.product.name')
|
||||
->label('Product')
|
||||
->icon('tabler-package')
|
||||
->sortable()
|
||||
->url(fn (Order $order) => EditProduct::getUrl(['record' => $order->productPrice->product])),
|
||||
TextColumn::make('productPrice.name')
|
||||
->label('Price')
|
||||
->sortable(),
|
||||
TextColumn::make('productPrice.cost')
|
||||
->label('Cost')
|
||||
->sortable()
|
||||
->formatStateUsing(function ($state) {
|
||||
$formatter = new NumberFormatter(auth()->user()->language, NumberFormatter::CURRENCY);
|
||||
|
||||
return $formatter->formatCurrency($state, config('billing.currency'));
|
||||
}),
|
||||
DateTimeColumn::make('expires_at')
|
||||
->label('Expires')
|
||||
->placeholder('No expire')
|
||||
->color(fn ($state) => $state <= now('UTC') ? 'danger' : null)
|
||||
->since(),
|
||||
])
|
||||
->recordActions([
|
||||
Action::make('activate')
|
||||
->visible(fn (Order $order) => $order->status !== OrderStatus::Active)
|
||||
->tooltip('Activate')
|
||||
->color('success')
|
||||
->icon('tabler-check')
|
||||
->requiresConfirmation()
|
||||
->action(function (Order $order) {
|
||||
$order->activate(null);
|
||||
|
||||
Notification::make()
|
||||
->title('Order activated')
|
||||
->body($order->getLabel())
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
Action::make('create_server')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Active && !$order->server)
|
||||
->tooltip('Create server')
|
||||
->color('primary')
|
||||
->icon('tabler-brand-docker')
|
||||
->requiresConfirmation()
|
||||
->action(function (Order $order) {
|
||||
try {
|
||||
$order->createServer();
|
||||
} catch (Exception $exception) {
|
||||
Notification::make()
|
||||
->title('Could not create server')
|
||||
->body($exception->getMessage())
|
||||
->danger()
|
||||
->persistent()
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
Action::make('close')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Active)
|
||||
->tooltip('Close')
|
||||
->color('danger')
|
||||
->icon('tabler-x')
|
||||
->requiresConfirmation()
|
||||
->action(function (Order $order) {
|
||||
$order->close();
|
||||
|
||||
Notification::make()
|
||||
->title('Order closed')
|
||||
->body($order->getLabel())
|
||||
->success()
|
||||
->send();
|
||||
}),
|
||||
])
|
||||
->toolbarActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false),
|
||||
])
|
||||
->emptyStateHeading('No Orders')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateIcon('tabler-truck-delivery');
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListOrders::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Orders\Pages;
|
||||
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Orders\OrderResource;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListOrders extends ListRecords
|
||||
{
|
||||
protected static string $resource = OrderResource::class;
|
||||
|
||||
public function getDefaultActiveTab(): string
|
||||
{
|
||||
return OrderStatus::Active->value;
|
||||
}
|
||||
|
||||
public function getTabs(): array
|
||||
{
|
||||
$tabs = [];
|
||||
|
||||
foreach (OrderStatus::cases() as $orderStatus) {
|
||||
$tabs[$orderStatus->value] = Tab::make($orderStatus->getLabel())
|
||||
->modifyQueryUsing(fn (Builder $query) => $query->where('status', $orderStatus->value))
|
||||
->badge(fn () => Order::where('status', $orderStatus->value)->count())
|
||||
->icon(fn () => $orderStatus->getIcon());
|
||||
}
|
||||
|
||||
$tabs['all'] = Tab::make('All')->badge(fn () => Order::count());
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Products\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\ProductResource;
|
||||
use Boy132\Billing\Models\Product;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
/**
|
||||
* @property Product $record
|
||||
*/
|
||||
class CreateProduct extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ProductResource::class;
|
||||
|
||||
protected static bool $canCreateAnother = false;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCreateFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-plus'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Products\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\ProductResource;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\RelationManagers\PriceRelationManager;
|
||||
use Boy132\Billing\Models\Product;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
/**
|
||||
* @property Product $record
|
||||
*/
|
||||
class EditProduct extends EditRecord
|
||||
{
|
||||
protected static string $resource = ProductResource::class;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCancelFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-arrow-left'),
|
||||
DeleteAction::make(),
|
||||
$this->getSaveFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-device-floppy'),
|
||||
];
|
||||
}
|
||||
|
||||
public function getRelationManagers(): array
|
||||
{
|
||||
return [
|
||||
PriceRelationManager::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Products\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\ProductResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListProducts extends ListRecords
|
||||
{
|
||||
protected static string $resource = ProductResource::class;
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Products;
|
||||
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\Pages\CreateProduct;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\Pages\EditProduct;
|
||||
use Boy132\Billing\Filament\Admin\Resources\Products\Pages\ListProducts;
|
||||
use Boy132\Billing\Models\Product;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TagsInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Fieldset;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Number;
|
||||
|
||||
class ProductResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Product::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-package';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Billing';
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
Textarea::make('description')
|
||||
->required()
|
||||
->autosize(),
|
||||
Fieldset::make('Server')
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Select::make('egg_id')
|
||||
->prefixIcon('tabler-egg')
|
||||
->label('Egg')
|
||||
->required()
|
||||
->relationship('egg', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('cpu')
|
||||
->prefixIcon('tabler-cpu')
|
||||
->label('CPU')
|
||||
->required()
|
||||
->suffix('%')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->hint('Set to 0 for unlimited.'),
|
||||
TextInput::make('memory')
|
||||
->prefixIcon('tabler-database')
|
||||
->required()
|
||||
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->hint('Set to 0 for unlimited.'),
|
||||
TextInput::make('disk')
|
||||
->prefixIcon('tabler-folder')
|
||||
->required()
|
||||
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->hint('Set to 0 for unlimited.'),
|
||||
TextInput::make('swap')
|
||||
->prefixIcon('tabler-file-database')
|
||||
->required()
|
||||
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->hint('Set to -1 for unlimited or 0 for no swap.'),
|
||||
]),
|
||||
Fieldset::make('Deployment')
|
||||
->columnSpanFull()
|
||||
->columns(2)
|
||||
->schema([
|
||||
TagsInput::make('ports')
|
||||
->placeholder('New port or port range'),
|
||||
TagsInput::make('tags')
|
||||
->placeholder('New tag for deployment')
|
||||
->default(array_filter(explode(',', config('billing.deployment_tags', '')))),
|
||||
]),
|
||||
Fieldset::make('Limits')
|
||||
->columnSpanFull()
|
||||
->columns(3)
|
||||
->schema([
|
||||
TextInput::make('allocation_limit')
|
||||
->prefixIcon('tabler-network')
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0),
|
||||
TextInput::make('database_limit')
|
||||
->prefixIcon('tabler-database')
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0),
|
||||
TextInput::make('backup_limit')
|
||||
->prefixIcon('tabler-copy-check')
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->description(fn (Product $product) => $product->description)
|
||||
->sortable()
|
||||
->searchable(),
|
||||
TextColumn::make('egg.name')
|
||||
->sortable()
|
||||
->icon('tabler-egg')
|
||||
->url(fn (Product $product): string => route('filament.admin.resources.eggs.edit', ['record' => $product->egg])),
|
||||
TextColumn::make('cpu')
|
||||
->label('CPU')
|
||||
->numeric()
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'Unlimited' : $state . ' %'),
|
||||
TextColumn::make('memory')
|
||||
->numeric()
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'Unlimited' : Number::format($state / (config('panel.use_binary_prefix') ? 1024 : 1000), 2, locale: auth()->user()->language) . (config('panel.use_binary_prefix') ? ' GiB' : ' GB')),
|
||||
TextColumn::make('disk')
|
||||
->numeric()
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'Unlimited' : Number::format($state / (config('panel.use_binary_prefix') ? 1024 : 1000), 2, locale: auth()->user()->language) . (config('panel.use_binary_prefix') ? ' GiB' : ' GB')),
|
||||
TextColumn::make('swap')
|
||||
->numeric()
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'No Swap' : Number::format($state / (config('panel.use_binary_prefix') ? 1024 : 1000), 2, locale: auth()->user()->language) . (config('panel.use_binary_prefix') ? ' GiB' : ' GB')),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false),
|
||||
])
|
||||
->emptyStateHeading('No Products')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateIcon('tabler-package');
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListProducts::route('/'),
|
||||
'create' => CreateProduct::route('/create'),
|
||||
'edit' => EditProduct::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\Admin\Resources\Products\RelationManagers;
|
||||
|
||||
use Boy132\Billing\Enums\PriceInterval;
|
||||
use Boy132\Billing\Models\Product;
|
||||
use Boy132\Billing\Models\ProductPrice;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
/**
|
||||
* @method Product getOwnerRecord()
|
||||
*/
|
||||
class PriceRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'prices';
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->label('Internal Name')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('cost')
|
||||
->required()
|
||||
->suffix(config('billing.currency'))
|
||||
->numeric()
|
||||
->minValue(0),
|
||||
Toggle::make('renewable')
|
||||
->label('Can be renewed?')
|
||||
->inline(false),
|
||||
Select::make('interval_type')
|
||||
->required()
|
||||
->selectablePlaceholder(false)
|
||||
->options(PriceInterval::class),
|
||||
TextInput::make('interval_value')
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(1),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label('Internal Name')
|
||||
->sortable(),
|
||||
TextColumn::make('cost')
|
||||
->sortable()
|
||||
->state(fn (ProductPrice $price) => $price->formatCost()),
|
||||
IconColumn::make('renewable')
|
||||
->label('Can be renewed?')
|
||||
->boolean(),
|
||||
TextColumn::make('interval')
|
||||
->state(fn (ProductPrice $price) => $price->interval_value . ' ' . $price->interval_type->name),
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->emptyStateHeading('No Prices')
|
||||
->emptyStateDescription('');
|
||||
}
|
||||
}
|
||||
27
billing/src/Filament/App/Pages/Dashboard.php
Normal file
27
billing/src/Filament/App/Pages/Dashboard.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\App\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\App\Widgets\ProductWidget;
|
||||
use Boy132\Billing\Filament\App\Widgets\WelcomeWidget;
|
||||
use Boy132\Billing\Models\Product;
|
||||
use Filament\Pages\Dashboard as BaseDashboard;
|
||||
use Filament\Widgets\WidgetConfiguration;
|
||||
|
||||
class Dashboard extends BaseDashboard
|
||||
{
|
||||
public function getWidgets(): array
|
||||
{
|
||||
$widgets = [new WidgetConfiguration(WelcomeWidget::class)];
|
||||
|
||||
foreach (Product::all() as $product) {
|
||||
if ($product->prices->count() <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$widgets[] = new WidgetConfiguration(ProductWidget::class, ['product' => $product]);
|
||||
}
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
}
|
||||
113
billing/src/Filament/App/Resources/Orders/OrdersResource.php
Normal file
113
billing/src/Filament/App/Resources/Orders/OrdersResource.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\App\Resources\Orders;
|
||||
|
||||
use App\Filament\Components\Tables\Columns\DateTimeColumn;
|
||||
use App\Filament\Server\Pages\Console;
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Boy132\Billing\Filament\App\Resources\Orders\Pages\ListOrders;
|
||||
use Boy132\Billing\Models\Customer;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use NumberFormatter;
|
||||
|
||||
class OrdersResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Order::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-truck-delivery';
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
/** @var Customer $customer */
|
||||
$customer = Customer::firstOrCreate([
|
||||
'user_id' => user()->id,
|
||||
], [
|
||||
'first_name' => user()->username,
|
||||
'last_name' => user()->username,
|
||||
]);
|
||||
|
||||
return parent::getEloquentQuery()->where('customer_id', $customer->id);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('status')
|
||||
->sortable()
|
||||
->badge(),
|
||||
TextColumn::make('server.name')
|
||||
->label('Server')
|
||||
->placeholder('No server')
|
||||
->icon('tabler-brand-docker')
|
||||
->sortable(),
|
||||
TextColumn::make('productPrice.product.name')
|
||||
->label('Product')
|
||||
->icon('tabler-package')
|
||||
->sortable(),
|
||||
TextColumn::make('productPrice.name')
|
||||
->label('Price')
|
||||
->sortable(),
|
||||
TextColumn::make('productPrice.cost')
|
||||
->label('Cost')
|
||||
->sortable()
|
||||
->formatStateUsing(function ($state) {
|
||||
$formatter = new NumberFormatter(user()->language, NumberFormatter::CURRENCY);
|
||||
|
||||
return $formatter->formatCurrency($state, config('billing.currency'));
|
||||
}),
|
||||
DateTimeColumn::make('expires_at')
|
||||
->label('Expires')
|
||||
->placeholder('No expire')
|
||||
->color(fn ($state) => $state <= now('UTC') ? 'danger' : null)
|
||||
->since(),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make()
|
||||
->hidden(fn (Order $order) => !$order->server)
|
||||
->url(fn (Order $order) => Console::getUrl(panel: 'server', tenant: $order->server)),
|
||||
Action::make('activate')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Pending)
|
||||
->tooltip('Activate')
|
||||
->color('success')
|
||||
->icon('tabler-check')
|
||||
->requiresConfirmation()
|
||||
->action(fn (Order $order) => redirect($order->getCheckoutSession()->url)),
|
||||
Action::make('cancel')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Pending || $order->status === OrderStatus::Active)
|
||||
->tooltip('Cancel')
|
||||
->color('danger')
|
||||
->icon('tabler-x')
|
||||
->requiresConfirmation()
|
||||
->action(fn (Order $order) => $order->close()),
|
||||
Action::make('renew')
|
||||
->visible(fn (Order $order) => $order->status === OrderStatus::Expired && $order->productPrice->renewable)
|
||||
->tooltip('Renew')
|
||||
->color('warning')
|
||||
->icon('tabler-refresh')
|
||||
->requiresConfirmation()
|
||||
->action(fn (Order $order) => redirect($order->getCheckoutSession()->url)),
|
||||
])
|
||||
->emptyStateHeading('No Orders')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateIcon('tabler-truck-delivery');
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListOrders::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\App\Resources\Orders\Pages;
|
||||
|
||||
use Boy132\Billing\Filament\App\Resources\Orders\OrdersResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListOrders extends ListRecords
|
||||
{
|
||||
protected static string $resource = OrdersResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
102
billing/src/Filament/App/Widgets/ProductWidget.php
Normal file
102
billing/src/Filament/App/Widgets/ProductWidget.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\App\Widgets;
|
||||
|
||||
use App\Filament\Server\Pages\Console;
|
||||
use Boy132\Billing\Models\Customer;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Boy132\Billing\Models\Product;
|
||||
use Boy132\Billing\Models\ProductPrice;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Concerns\InteractsWithActions;
|
||||
use Filament\Actions\Contracts\HasActions;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Actions;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Concerns\InteractsWithSchemas;
|
||||
use Filament\Schemas\Contracts\HasSchemas;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Widgets\Widget;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Number;
|
||||
|
||||
class ProductWidget extends Widget implements HasActions, HasSchemas
|
||||
{
|
||||
use InteractsWithActions;
|
||||
use InteractsWithSchemas;
|
||||
|
||||
protected string $view = 'billing::widget'; // @phpstan-ignore property.defaultValue
|
||||
|
||||
public ?Product $product = null;
|
||||
|
||||
public function content(Schema $schema): Schema
|
||||
{
|
||||
$actions = [];
|
||||
|
||||
/** @var Collection<int, ProductPrice> $prices */
|
||||
$prices = $this->product->prices()->orderBy('cost')->get();
|
||||
|
||||
foreach ($prices as $price) {
|
||||
$actions[] = Action::make('exclude_' . str_slug($price->name))
|
||||
->label($price->getLabel())
|
||||
->action(function () use ($price) {
|
||||
$price->sync();
|
||||
|
||||
/** @var Customer $customer */
|
||||
$customer = Customer::firstOrCreate([
|
||||
'user_id' => user()->id,
|
||||
]);
|
||||
|
||||
/** @var Order $order */
|
||||
$order = Order::create([
|
||||
'customer_id' => $customer->id,
|
||||
'product_price_id' => $price->id,
|
||||
]);
|
||||
|
||||
if ($price->isFree()) {
|
||||
$order->activate(null);
|
||||
$order->refresh();
|
||||
|
||||
return redirect(Console::getUrl(panel: 'server', tenant: $order->server));
|
||||
}
|
||||
|
||||
return $this->redirect($order->getCheckoutSession()->url);
|
||||
});
|
||||
}
|
||||
|
||||
return $schema
|
||||
->record($this->product)
|
||||
->components([
|
||||
Section::make()
|
||||
->heading($this->product->getLabel())
|
||||
->description($this->product->description)
|
||||
->columns(6)
|
||||
->schema([
|
||||
TextEntry::make('cpu')
|
||||
->label('CPU')
|
||||
->icon('tabler-cpu')
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'Unlimited' : $state . ' %')
|
||||
->columnSpan(2),
|
||||
TextEntry::make('memory')
|
||||
->icon('tabler-database')
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'Unlimited' : Number::format($state / (config('panel.use_binary_prefix') ? 1024 : 1000), 2, locale: auth()->user()->language) . (config('panel.use_binary_prefix') ? ' GiB' : ' GB'))
|
||||
->columnSpan(2),
|
||||
TextEntry::make('disk')
|
||||
->icon('tabler-folder')
|
||||
->formatStateUsing(fn ($state) => $state === 0 ? 'Unlimited' : Number::format($state / (config('panel.use_binary_prefix') ? 1024 : 1000), 2, locale: auth()->user()->language) . (config('panel.use_binary_prefix') ? ' GiB' : ' GB'))
|
||||
->columnSpan(2),
|
||||
TextEntry::make('backup_limit')
|
||||
->inlineLabel()
|
||||
->columnSpan(3)
|
||||
->visible(fn ($state) => $state > 0),
|
||||
TextEntry::make('database_limit')
|
||||
->inlineLabel()
|
||||
->columnSpan(3)
|
||||
->visible(fn ($state) => $state > 0),
|
||||
Actions::make($actions)
|
||||
->columnSpanFull()
|
||||
->fullWidth(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
10
billing/src/Filament/App/Widgets/WelcomeWidget.php
Normal file
10
billing/src/Filament/App/Widgets/WelcomeWidget.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Filament\App\Widgets;
|
||||
|
||||
use Filament\Widgets\AccountWidget;
|
||||
|
||||
class WelcomeWidget extends AccountWidget
|
||||
{
|
||||
protected int|string|array $columnSpan = 'full';
|
||||
}
|
||||
60
billing/src/Http/Controllers/Api/CheckoutController.php
Normal file
60
billing/src/Http/Controllers/Api/CheckoutController.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Http\Controllers\Api;
|
||||
|
||||
use App\Filament\Server\Pages\Console;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Boy132\Billing\Filament\App\Resources\Orders\Pages\ListOrders;
|
||||
use Boy132\Billing\Models\Order;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Stripe\Checkout\Session;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
class CheckoutController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private StripeClient $stripeClient
|
||||
) {}
|
||||
|
||||
public function success(Request $request): RedirectResponse
|
||||
{
|
||||
$sessionId = $request->get('session_id');
|
||||
|
||||
if ($sessionId === null) {
|
||||
return redirect(Filament::getPanel('app')->getUrl());
|
||||
}
|
||||
|
||||
$session = $this->stripeClient->checkout->sessions->retrieve($sessionId);
|
||||
|
||||
if ($session->payment_status === Session::PAYMENT_STATUS_UNPAID) {
|
||||
return redirect(ListOrders::getUrl(panel: 'app'));
|
||||
}
|
||||
|
||||
/** @var ?Order $order */
|
||||
$order = Order::where('stripe_checkout_id', $session->id)->first();
|
||||
|
||||
if (!$order) {
|
||||
return redirect(ListOrders::getUrl(panel: 'app'));
|
||||
}
|
||||
|
||||
$order->activate($session->payment_intent);
|
||||
$order->refresh();
|
||||
|
||||
return redirect(Console::getUrl(panel: 'server', tenant: $order->server));
|
||||
}
|
||||
|
||||
public function cancel(Request $request): RedirectResponse
|
||||
{
|
||||
$sessionId = $request->get('session_id');
|
||||
|
||||
if ($sessionId) {
|
||||
/** @var ?Order $order */
|
||||
$order = Order::where('stripe_checkout_id', $sessionId)->first();
|
||||
$order?->close();
|
||||
}
|
||||
|
||||
return redirect(ListOrders::getUrl(panel: 'app'));
|
||||
}
|
||||
}
|
||||
119
billing/src/Models/Coupon.php
Normal file
119
billing/src/Models/Coupon.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property ?string $stripe_coupon_id
|
||||
* @property ?string $stripe_promotion_id
|
||||
* @property string $name
|
||||
* @property string $code
|
||||
* @property ?int $amount_off
|
||||
* @property ?int $percent_off
|
||||
* @property ?int $max_redemptions
|
||||
* @property ?Carbon $redeem_by
|
||||
*/
|
||||
class Coupon extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'stripe_coupon_id',
|
||||
'stripe_promotion_id',
|
||||
'name',
|
||||
'code',
|
||||
'amount_off',
|
||||
'percent_off',
|
||||
'max_redemptions',
|
||||
'redeem_by',
|
||||
];
|
||||
|
||||
protected static function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function (self $model) {
|
||||
$model->code ??= Str::random(8);
|
||||
});
|
||||
|
||||
static::created(function (self $model) {
|
||||
$model->sync();
|
||||
});
|
||||
|
||||
static::updating(function (self $model) {
|
||||
$model->code ??= Str::random(8);
|
||||
});
|
||||
|
||||
static::updated(function (self $model) {
|
||||
$model->sync();
|
||||
});
|
||||
|
||||
static::deleted(function (self $model) {
|
||||
if (!is_null($model->stripe_coupon_id)) {
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
$stripeClient->coupons->delete($model->stripe_coupon_id);
|
||||
$stripeClient->coupons->delete($model->stripe_promotion_id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function sync(): void
|
||||
{
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
if (is_null($this->stripe_coupon_id)) {
|
||||
$data = [
|
||||
'name' => $this->name,
|
||||
];
|
||||
|
||||
if ($this->amount_off) {
|
||||
$data['currency'] = config('billing.currency');
|
||||
$data['amount_off'] = $this->amount_off;
|
||||
}
|
||||
|
||||
if ($this->percent_off) {
|
||||
$data['percent_off'] = $this->percent_off;
|
||||
}
|
||||
|
||||
if ($this->max_redemptions) {
|
||||
$data['max_redemptions'] = $this->max_redemptions;
|
||||
}
|
||||
|
||||
if ($this->redeem_by) {
|
||||
$data['redeem_by'] = $this->redeem_by->timestamp;
|
||||
}
|
||||
|
||||
$stripeCoupon = $stripeClient->coupons->create($data);
|
||||
|
||||
$stripePromotionCode = $stripeClient->promotionCodes->create([
|
||||
'code' => $this->code,
|
||||
'promotion' => [
|
||||
'type' => 'coupon',
|
||||
'coupon' => $stripeCoupon->id,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->updateQuietly([
|
||||
'stripe_coupon_id' => $stripeCoupon->id,
|
||||
'stripe_promotion_id' => $stripePromotionCode->id,
|
||||
]);
|
||||
} else {
|
||||
$stripeCoupon = $stripeClient->coupons->retrieve($this->stripe_coupon_id);
|
||||
|
||||
// You can't update coupon objects on stripe, so check for changes and recreate the coupon if needed
|
||||
if ($stripeCoupon->amount_off !== $this->amount_off || $stripeCoupon->percent_off !== $this->percent_off || $stripeCoupon->max_redemptions !== $this->max_redemptions || $stripeCoupon->redeem_by !== $this->redeem_by) {
|
||||
$stripeClient->coupons->delete($this->stripe_coupon_id);
|
||||
$stripeClient->coupons->delete($this->stripe_promotion_id);
|
||||
|
||||
$this->stripe_coupon_id = null;
|
||||
$this->sync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
billing/src/Models/Customer.php
Normal file
44
billing/src/Models/Customer.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property int $balance
|
||||
* @property int $user_id
|
||||
* @property User $user
|
||||
* @property Collection|Order[] $orders
|
||||
*/
|
||||
class Customer extends Model implements HasLabel
|
||||
{
|
||||
protected $fillable = [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'balance',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
return $this->hasMany(Order::class, 'customer_id');
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->first_name . ' ' . $this->last_name;
|
||||
}
|
||||
}
|
||||
239
billing/src/Models/Order.php
Normal file
239
billing/src/Models/Order.php
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Models;
|
||||
|
||||
use App\Enums\SuspendAction;
|
||||
use App\Models\Objects\DeploymentObject;
|
||||
use App\Models\Server;
|
||||
use App\Services\Servers\ServerCreationService;
|
||||
use App\Services\Servers\SuspensionService;
|
||||
use Boy132\Billing\Enums\OrderStatus;
|
||||
use Boy132\Billing\Enums\PriceInterval;
|
||||
use Exception;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Stripe\Checkout\Session;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property ?string $stripe_checkout_id
|
||||
* @property ?string $stripe_payment_id
|
||||
* @property OrderStatus $status
|
||||
* @property ?Carbon $expires_at
|
||||
* @property int $customer_id
|
||||
* @property Customer $customer
|
||||
* @property int $product_price_id
|
||||
* @property ProductPrice $productPrice
|
||||
* @property ?int $server_id
|
||||
* @property ?Server $server
|
||||
*/
|
||||
class Order extends Model implements HasLabel
|
||||
{
|
||||
protected $fillable = [
|
||||
'stripe_checkout_id',
|
||||
'stripe_payment_id',
|
||||
'status',
|
||||
'expires_at',
|
||||
'customer_id',
|
||||
'product_price_id',
|
||||
'server_id',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => OrderStatus::class,
|
||||
'expires_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Customer::class, 'customer_id');
|
||||
}
|
||||
|
||||
public function productPrice(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(ProductPrice::class, 'product_price_id');
|
||||
}
|
||||
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Server::class, 'server_id');
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return "Order #{$this->id}";
|
||||
}
|
||||
|
||||
public function checkExpire(): bool
|
||||
{
|
||||
if ($this->status === OrderStatus::Active && !is_null($this->expires_at) && now('UTC') >= $this->expires_at) {
|
||||
try {
|
||||
if ($this->server) {
|
||||
app(SuspensionService::class)->handle($this->server, SuspendAction::Suspend);
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
report($exception);
|
||||
}
|
||||
|
||||
$this->expireCheckoutSession();
|
||||
|
||||
$this->update([
|
||||
'stripe_checkout_id' => null,
|
||||
'status' => OrderStatus::Expired,
|
||||
]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function expireCheckoutSession(): void
|
||||
{
|
||||
if (!is_null($this->stripe_checkout_id)) {
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
$session = $stripeClient->checkout->sessions->retrieve($this->stripe_checkout_id);
|
||||
|
||||
if ($session->status === Session::STATUS_OPEN) {
|
||||
$stripeClient->checkout->sessions->expire($session->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getCheckoutSession(): Session
|
||||
{
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
if (is_null($this->stripe_checkout_id)) {
|
||||
$session = $stripeClient->checkout->sessions->create([
|
||||
'customer_email' => $this->customer->user->email,
|
||||
'success_url' => route('billing.checkout.success') . '?session_id={CHECKOUT_SESSION_ID}',
|
||||
'cancel_url' => route('billing.checkout.cancel') . '?session_id={CHECKOUT_SESSION_ID}',
|
||||
'line_items' => [
|
||||
[
|
||||
'price' => $this->productPrice->stripe_id,
|
||||
'quantity' => 1,
|
||||
],
|
||||
],
|
||||
'mode' => 'payment',
|
||||
'allow_promotion_codes' => true,
|
||||
'branding_settings' => [
|
||||
'display_name' => config('app.name'),
|
||||
'logo' => [
|
||||
'type' => 'url',
|
||||
'url' => asset(config('app.logo') ?? 'pelican.svg'),
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->update([
|
||||
'stripe_checkout_id' => $session->id,
|
||||
]);
|
||||
|
||||
return $session;
|
||||
}
|
||||
|
||||
return $stripeClient->checkout->sessions->retrieve($this->stripe_checkout_id);
|
||||
}
|
||||
|
||||
public function activate(?string $stripePaymentId): void
|
||||
{
|
||||
$expireDate = match ($this->productPrice->interval_type) {
|
||||
PriceInterval::Day => now('UTC')->addDays($this->productPrice->interval_value),
|
||||
PriceInterval::Week => now('UTC')->addWeeks($this->productPrice->interval_value),
|
||||
PriceInterval::Month => now('UTC')->addMonths($this->productPrice->interval_value),
|
||||
PriceInterval::Year => now('UTC')->addYears($this->productPrice->interval_value),
|
||||
};
|
||||
|
||||
$this->expireCheckoutSession();
|
||||
|
||||
$this->update([
|
||||
'stripe_checkout_id' => null,
|
||||
'stripe_payment_id' => $stripePaymentId,
|
||||
'status' => OrderStatus::Active,
|
||||
'expires_at' => $expireDate,
|
||||
]);
|
||||
|
||||
try {
|
||||
if ($this->server) {
|
||||
app(SuspensionService::class)->handle($this->server, SuspendAction::Unsuspend);
|
||||
} else {
|
||||
$this->createServer();
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
report($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function close(): void
|
||||
{
|
||||
try {
|
||||
if ($this->server) {
|
||||
app(SuspensionService::class)->handle($this->server, SuspendAction::Suspend);
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
report($exception);
|
||||
}
|
||||
|
||||
$this->expireCheckoutSession();
|
||||
|
||||
$this->update([
|
||||
'stripe_checkout_id' => null,
|
||||
'status' => OrderStatus::Closed,
|
||||
]);
|
||||
}
|
||||
|
||||
public function createServer(): Server
|
||||
{
|
||||
if ($this->server) {
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
$product = $this->productPrice->product;
|
||||
|
||||
$environment = [];
|
||||
foreach ($product->egg->variables as $variable) {
|
||||
$environment[$variable->env_variable] = $variable->default_value;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'name' => $this->getLabel() . ' (' . $this->productPrice->product->getLabel() . ')',
|
||||
'owner_id' => $this->customer->user->id,
|
||||
'egg_id' => $product->egg->id,
|
||||
'cpu' => $product->cpu,
|
||||
'memory' => $product->memory,
|
||||
'disk' => $product->disk,
|
||||
'swap' => $product->swap,
|
||||
'io' => 500,
|
||||
'environment' => $environment,
|
||||
'skip_scripts' => false,
|
||||
'start_on_completion' => true,
|
||||
'oom_killer' => false,
|
||||
'database_limit' => $product->database_limit,
|
||||
'allocation_limit' => $product->allocation_limit,
|
||||
'backup_limit' => $product->backup_limit,
|
||||
];
|
||||
|
||||
$object = new DeploymentObject();
|
||||
$object->setDedicated(false);
|
||||
$object->setTags($product->tags);
|
||||
$object->setPorts($product->ports);
|
||||
|
||||
$server = app(ServerCreationService::class)->handle($data, $object);
|
||||
|
||||
$this->update([
|
||||
'server_id' => $server->id,
|
||||
]);
|
||||
|
||||
return $server;
|
||||
}
|
||||
}
|
||||
120
billing/src/Models/Product.php
Normal file
120
billing/src/Models/Product.php
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Models;
|
||||
|
||||
use App\Models\Egg;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property ?string $stripe_id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property int $cpu
|
||||
* @property int $memory
|
||||
* @property int $disk
|
||||
* @property int $swap
|
||||
* @property array<int|string> $ports
|
||||
* @property string[] $tags
|
||||
* @property int $allocation_limit
|
||||
* @property int $database_limit
|
||||
* @property int $backup_limit
|
||||
* @property int $egg_id
|
||||
* @property Egg $egg
|
||||
* @property Collection|ProductPrice[] $prices
|
||||
*/
|
||||
class Product extends Model implements HasLabel
|
||||
{
|
||||
protected $fillable = [
|
||||
'stripe_id',
|
||||
'name',
|
||||
'description',
|
||||
'egg_id',
|
||||
'cpu',
|
||||
'memory',
|
||||
'disk',
|
||||
'swap',
|
||||
'ports',
|
||||
'tags',
|
||||
'allocation_limit',
|
||||
'database_limit',
|
||||
'backup_limit',
|
||||
];
|
||||
|
||||
protected $attributes = [
|
||||
'ports' => '[]',
|
||||
'tags' => '[]',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'ports' => 'array',
|
||||
'tags' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
protected static function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::created(function (self $model) {
|
||||
$model->sync();
|
||||
});
|
||||
|
||||
static::updated(function (self $model) {
|
||||
$model->sync();
|
||||
});
|
||||
|
||||
static::deleted(function (self $model) {
|
||||
if (!is_null($model->stripe_id)) {
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
$stripeClient->products->delete($model->stripe_id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function prices(): HasMany
|
||||
{
|
||||
return $this->hasMany(ProductPrice::class, 'product_id');
|
||||
}
|
||||
|
||||
public function egg(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Egg::class, 'egg_id');
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function sync(): void
|
||||
{
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
if (is_null($this->stripe_id)) {
|
||||
$stripeProduct = $stripeClient->products->create([
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
]);
|
||||
|
||||
$this->updateQuietly([
|
||||
'stripe_id' => $stripeProduct->id,
|
||||
]);
|
||||
} else {
|
||||
$stripeClient->products->update($this->stripe_id, [
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
110
billing/src/Models/ProductPrice.php
Normal file
110
billing/src/Models/ProductPrice.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Models;
|
||||
|
||||
use Boy132\Billing\Enums\PriceInterval;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use NumberFormatter;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property ?string $stripe_id
|
||||
* @property string $name
|
||||
* @property int $cost
|
||||
* @property bool $renewable
|
||||
* @property PriceInterval $interval_type
|
||||
* @property int $interval_value
|
||||
* @property int $product_id
|
||||
* @property Product $product
|
||||
*/
|
||||
class ProductPrice extends Model implements HasLabel
|
||||
{
|
||||
protected $fillable = [
|
||||
'stripe_id',
|
||||
'product_id',
|
||||
'name',
|
||||
'cost',
|
||||
'renewable',
|
||||
'interval_type',
|
||||
'interval_value',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'renewable' => 'bool',
|
||||
'interval_type' => PriceInterval::class,
|
||||
];
|
||||
}
|
||||
|
||||
protected static function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::created(function (self $model) {
|
||||
$model->sync();
|
||||
});
|
||||
|
||||
static::updated(function (self $model) {
|
||||
$model->sync();
|
||||
});
|
||||
}
|
||||
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class, 'product_id');
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return $this->interval_value . ' ' . str_plural($this->interval_type->getLabel(), $this->interval_value) . ' - ' . $this->formatCost();
|
||||
}
|
||||
|
||||
public function sync(): void
|
||||
{
|
||||
$this->product->sync();
|
||||
|
||||
/** @var StripeClient $stripeClient */
|
||||
$stripeClient = app(StripeClient::class);
|
||||
|
||||
if (is_null($this->stripe_id)) {
|
||||
$stripePrice = $stripeClient->prices->create([
|
||||
'currency' => config('billing.currency'),
|
||||
'nickname' => $this->name,
|
||||
'product' => $this->product->stripe_id,
|
||||
'unit_amount' => $this->cost * 100, // Stripe needs cent/ penny price
|
||||
]);
|
||||
|
||||
$this->updateQuietly([
|
||||
'stripe_id' => $stripePrice->id,
|
||||
]);
|
||||
} else {
|
||||
$stripePrice = $stripeClient->prices->retrieve($this->stripe_id);
|
||||
|
||||
// You can't update price objects on stripe, so check for changes and recreate the price if needed
|
||||
if ($stripePrice->product !== $this->product->stripe_id || $stripePrice->unit_amount !== $this->cost * 100) {
|
||||
$this->stripe_id = null;
|
||||
$this->sync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isFree(): bool
|
||||
{
|
||||
return !$this->cost;
|
||||
}
|
||||
|
||||
public function formatCost(): string
|
||||
{
|
||||
if ($this->isFree()) {
|
||||
return 'Free';
|
||||
}
|
||||
|
||||
$formatter = new NumberFormatter(user()->language ?? 'en', NumberFormatter::CURRENCY);
|
||||
|
||||
return $formatter->formatCurrency($this->cost, config('billing.currency'));
|
||||
}
|
||||
}
|
||||
12
billing/src/Policies/CustomerPolicy.php
Normal file
12
billing/src/Policies/CustomerPolicy.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Policies;
|
||||
|
||||
use App\Policies\DefaultAdminPolicies;
|
||||
|
||||
class CustomerPolicy
|
||||
{
|
||||
use DefaultAdminPolicies;
|
||||
|
||||
protected string $modelName = 'customer';
|
||||
}
|
||||
12
billing/src/Policies/OrderPolicy.php
Normal file
12
billing/src/Policies/OrderPolicy.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Policies;
|
||||
|
||||
use App\Policies\DefaultAdminPolicies;
|
||||
|
||||
class OrderPolicy
|
||||
{
|
||||
use DefaultAdminPolicies;
|
||||
|
||||
protected string $modelName = 'order';
|
||||
}
|
||||
12
billing/src/Policies/ProductPolicy.php
Normal file
12
billing/src/Policies/ProductPolicy.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Policies;
|
||||
|
||||
use App\Policies\DefaultAdminPolicies;
|
||||
|
||||
class ProductPolicy
|
||||
{
|
||||
use DefaultAdminPolicies;
|
||||
|
||||
protected string $modelName = 'product';
|
||||
}
|
||||
28
billing/src/Providers/BillingPluginProvider.php
Normal file
28
billing/src/Providers/BillingPluginProvider.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Providers;
|
||||
|
||||
use App\Models\Role;
|
||||
use Boy132\Billing\Console\Commands\CheckOrdersCommand;
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
class BillingPluginProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(StripeClient::class, fn () => new StripeClient(config('billing.secret')));
|
||||
|
||||
Role::registerCustomDefaultPermissions('customer');
|
||||
Role::registerCustomModelIcon('customer', 'tabler-user-dollar');
|
||||
|
||||
Role::registerCustomDefaultPermissions('product');
|
||||
Role::registerCustomModelIcon('product', 'tabler-package');
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
Schedule::command(CheckOrdersCommand::class)->everyMinute()->withoutOverlapping();
|
||||
}
|
||||
}
|
||||
20
billing/src/Providers/BillingRoutesProvider.php
Normal file
20
billing/src/Providers/BillingRoutesProvider.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\Billing\Providers;
|
||||
|
||||
use Boy132\Billing\Http\Controllers\Api\CheckoutController;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class BillingRoutesProvider extends RouteServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
$this->routes(function () {
|
||||
Route::prefix('checkout')->withoutMiddleware(['auth'])->group(function () {
|
||||
Route::get('/success', [CheckoutController::class, 'success'])->name('billing.checkout.success');
|
||||
Route::get('/cancel', [CheckoutController::class, 'cancel'])->name('billing.checkout.cancel');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
674
generic-oidc-providers/LICENSE
Normal file
674
generic-oidc-providers/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
9
generic-oidc-providers/README.md
Normal file
9
generic-oidc-providers/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Generic OIDC Providers (by Boy132)
|
||||
|
||||
Allows administrators to create and configure generic OpenID Connect (OIDC) providers for authentication.
|
||||
|
||||
## Features
|
||||
|
||||
- Create custom OIDC providers through the admin panel
|
||||
- Configure client ID, client secret, and authorization endpoints
|
||||
- Support for multiple OIDC providers simultaneously
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('generic_oidc_providers', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->boolean('create_missing_users')->default(false);
|
||||
$table->boolean('link_missing_users')->default(false);
|
||||
$table->string('display_name');
|
||||
$table->string('display_icon')->nullable();
|
||||
$table->string('display_color', 7)->nullable();
|
||||
$table->string('base_url');
|
||||
$table->string('client_id');
|
||||
$table->text('client_secret');
|
||||
$table->boolean('verify_jwt')->default(false);
|
||||
$table->text('jwt_public_key')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('generic_oidc_providers');
|
||||
}
|
||||
};
|
||||
13
generic-oidc-providers/lang/en/strings.php
Normal file
13
generic-oidc-providers/lang/en/strings.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'no_generic_oidc_providers' => 'No Generic OIDC Providers',
|
||||
'generic_oidc_provider' => 'Generic OIDC Provider|Generic OIDC Providers',
|
||||
'display_name' => 'Display Name',
|
||||
'display_color' => 'Display Color',
|
||||
'display_icon' => 'Display Icon',
|
||||
'base_url' => 'Base URL',
|
||||
'redirect_url' => 'Redirect URL',
|
||||
'verify_jwt' => 'Verify JWT?',
|
||||
'jwt_public_key' => 'JWT Public Key',
|
||||
];
|
||||
17
generic-oidc-providers/plugin.json
Normal file
17
generic-oidc-providers/plugin.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"id": "generic-oidc-providers",
|
||||
"name": "Generic OIDC Providers",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Allows to create generic OIDC providers.",
|
||||
"category": "plugin",
|
||||
"url": "https://github.com/everestmcarthur/forged-plugs/tree/main/generic-oidc-providers",
|
||||
"update_url": null,
|
||||
"namespace": "Boy132\\GenericOIDCProviders",
|
||||
"class": "GenericOIDCProvidersPlugin",
|
||||
"panels": null,
|
||||
"panel_version": null,
|
||||
"composer_packages": {
|
||||
"kovah/laravel-socialite-oidc": "^0.8"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Extensions\OAuth\Schemas;
|
||||
|
||||
use App\Extensions\OAuth\Schemas\OAuthSchema;
|
||||
use App\Models\User;
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages\EditGenericOIDCProvider;
|
||||
use Boy132\GenericOIDCProviders\Models\GenericOIDCProvider;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Components\Wizard\Step;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Socialite\Contracts\User as OAuthUser;
|
||||
use SocialiteProviders\OIDC\Provider;
|
||||
|
||||
final class GenericOIDCProviderSchema extends OAuthSchema
|
||||
{
|
||||
public function __construct(private readonly GenericOIDCProvider $model) {}
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->model->id;
|
||||
}
|
||||
|
||||
public function getSocialiteProvider(): string
|
||||
{
|
||||
return Provider::class;
|
||||
}
|
||||
|
||||
public function getServiceConfig(): array
|
||||
{
|
||||
return [
|
||||
'client_id' => $this->model->client_id,
|
||||
'client_secret' => $this->model->client_secret,
|
||||
'base_url' => $this->model->base_url,
|
||||
'verify_jwt' => $this->model->verify_jwt,
|
||||
'jwt_public_key' => $this->model->jwt_public_key,
|
||||
];
|
||||
}
|
||||
|
||||
public function getSetupSteps(): array
|
||||
{
|
||||
return [
|
||||
Step::make('Generic OIDC Provider')
|
||||
->schema([
|
||||
TextEntry::make('info')
|
||||
->hiddenLabel()
|
||||
->state('This a generic OIDC provider and doesn\'t require any setup!'),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
public function getSettingsForm(): array
|
||||
{
|
||||
return [
|
||||
TextEntry::make('info')
|
||||
->label('Generic OIDC Provider')
|
||||
->state('Click here to configure this generic OIDC provider.')
|
||||
->url(EditGenericOIDCProvider::getUrl(['record' => $this->model], panel: 'admin'))
|
||||
->columnSpanFull(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->model->display_name;
|
||||
}
|
||||
|
||||
public function getIcon(): ?string
|
||||
{
|
||||
return $this->model->display_icon;
|
||||
}
|
||||
|
||||
public function getHexColor(): ?string
|
||||
{
|
||||
return $this->model->display_color;
|
||||
}
|
||||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
$id = Str::upper($this->getId());
|
||||
|
||||
return env("OAUTH_{$id}_ENABLED", true);
|
||||
}
|
||||
|
||||
public function shouldCreateMissingUser(OAuthUser $user): bool
|
||||
{
|
||||
return $this->model->create_missing_users;
|
||||
}
|
||||
|
||||
public function shouldLinkMissingUser(User $user, OAuthUser $oauthUser): bool
|
||||
{
|
||||
return $this->model->link_missing_users;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,215 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders;
|
||||
|
||||
use App\Enums\TablerIcon;
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages\CreateGenericOIDCProvider;
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages\EditGenericOIDCProvider;
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages\ListGenericOIDCProviders;
|
||||
use Boy132\GenericOIDCProviders\Models\GenericOIDCProvider;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\ColorPicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Group;
|
||||
use Filament\Schemas\Components\StateCasts\BooleanStateCast;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class GenericOIDCProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = GenericOIDCProvider::class;
|
||||
|
||||
protected static ?string $slug = 'generic-oidc-providers';
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-brand-oauth';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'id';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return trans('admin/dashboard.advanced');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return trans_choice('generic-oidc-providers::strings.generic_oidc_provider', 2);
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return trans_choice('generic-oidc-providers::strings.generic_oidc_provider', 1);
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return trans_choice('generic-oidc-providers::strings.generic_oidc_provider', 2);
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return (string) static::getEloquentQuery()->count() ?: null;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('id')
|
||||
->label('ID')
|
||||
->required()
|
||||
->live(debounce: 500)
|
||||
->afterStateUpdated(function ($state, Set $set) {
|
||||
$state = Str::slug($state, '_');
|
||||
|
||||
$set('id', $state);
|
||||
$set('display_name', Str::studly($state));
|
||||
})
|
||||
->disabledOn('edit'),
|
||||
TextInput::make('display_name')
|
||||
->label(trans('generic-oidc-providers::strings.display_name'))
|
||||
->required(),
|
||||
ColorPicker::make('display_color')
|
||||
->label(trans('generic-oidc-providers::strings.display_color'))
|
||||
->placeholder('Default color')
|
||||
->hex(),
|
||||
Select::make('display_icon')
|
||||
->label(trans('generic-oidc-providers::strings.display_icon'))
|
||||
->live()
|
||||
->options(TablerIcon::class)
|
||||
->suffixIcon(fn ($state) => $state)
|
||||
->searchable(),
|
||||
TextInput::make('base_url')
|
||||
->label(trans('generic-oidc-providers::strings.base_url'))
|
||||
->required()
|
||||
->url()
|
||||
->autocomplete(false)
|
||||
->columnSpan(fn ($operation) => $operation === 'create' ? 2 : 1),
|
||||
TextInput::make('redirect_url')
|
||||
->label(trans('generic-oidc-providers::strings.redirect_url'))
|
||||
->saved(false)
|
||||
->formatStateUsing(fn (Get $get) => url('/auth/oauth/callback/' . $get('id')))
|
||||
->disabled()
|
||||
->hiddenOn('create'),
|
||||
TextInput::make('client_id')
|
||||
->label(trans('admin/setting.oauth.client_id'))
|
||||
->required()
|
||||
->password()
|
||||
->revealable()
|
||||
->autocomplete(false),
|
||||
TextInput::make('client_secret')
|
||||
->label(trans('admin/setting.oauth.client_secret'))
|
||||
->required()
|
||||
->password()
|
||||
->revealable()
|
||||
->autocomplete(false),
|
||||
Group::make()
|
||||
->columns(3)
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Toggle::make('create_missing_users')
|
||||
->label(trans('admin/setting.oauth.create_missing_users'))
|
||||
->inline(false)
|
||||
->onIcon('tabler-check')
|
||||
->offIcon('tabler-x')
|
||||
->onColor('success')
|
||||
->offColor('danger')
|
||||
->stateCast(new BooleanStateCast(false)),
|
||||
Toggle::make('link_missing_users')
|
||||
->label(trans('admin/setting.oauth.link_missing_users'))
|
||||
->inline(false)
|
||||
->onIcon('tabler-check')
|
||||
->offIcon('tabler-x')
|
||||
->onColor('success')
|
||||
->offColor('danger')
|
||||
->stateCast(new BooleanStateCast(false)),
|
||||
Toggle::make('verify_jwt')
|
||||
->label(trans('generic-oidc-providers::strings.verify_jwt'))
|
||||
->inline(false)
|
||||
->onIcon('tabler-check')
|
||||
->offIcon('tabler-x')
|
||||
->onColor('success')
|
||||
->offColor('danger')
|
||||
->stateCast(new BooleanStateCast(false))
|
||||
->live(),
|
||||
]),
|
||||
Textarea::make('jwt_public_key')
|
||||
->label(trans('generic-oidc-providers::strings.jwt_public_key'))
|
||||
->visible(fn (Get $get) => $get('verify_jwt'))
|
||||
->columnSpanFull()
|
||||
->rows(3)
|
||||
->autosize()
|
||||
->placeholder('-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
|
||||
-----END PUBLIC KEY-----'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('id')
|
||||
->label('ID')
|
||||
->sortable()
|
||||
->searchable()
|
||||
->badge(),
|
||||
TextColumn::make('display_name')
|
||||
->label(trans('generic-oidc-providers::strings.display_name'))
|
||||
->sortable()
|
||||
->searchable()
|
||||
->badge()
|
||||
->icon(fn (GenericOIDCProvider $provider) => $provider->display_icon ?? 'tabler-brand-oauth')
|
||||
->color(fn (GenericOIDCProvider $provider) => $provider->display_color ? Color::hex($provider->display_color) : null),
|
||||
TextColumn::make('base_url')
|
||||
->label(trans('generic-oidc-providers::strings.base_url'))
|
||||
->sortable()
|
||||
->searchable(),
|
||||
IconColumn::make('verify_jwt')
|
||||
->label(trans('generic-oidc-providers::strings.verify_jwt'))
|
||||
->boolean(),
|
||||
IconColumn::make('create_missing_users')
|
||||
->label(trans('admin/setting.oauth.create_missing_users'))
|
||||
->boolean(),
|
||||
IconColumn::make('link_missing_users')
|
||||
->label(trans('admin/setting.oauth.link_missing_users'))
|
||||
->boolean(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
CreateAction::make(),
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make('exclude_bulk_delete'),
|
||||
]),
|
||||
])
|
||||
->emptyStateIcon('tabler-brand-oauth')
|
||||
->emptyStateDescription('')
|
||||
->emptyStateHeading(trans('generic-oidc-providers::strings.no_generic_oidc_providers'));
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListGenericOIDCProviders::route('/'),
|
||||
'create' => CreateGenericOIDCProvider::route('/create'),
|
||||
'edit' => EditGenericOIDCProvider::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages;
|
||||
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\GenericOIDCProviderResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CreateGenericOIDCProvider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GenericOIDCProviderResource::class;
|
||||
|
||||
protected static bool $canCreateAnother = false;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCreateFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-plus'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['id'] = Str::slug($data['id'], '_');
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages;
|
||||
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\GenericOIDCProviderResource;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditGenericOIDCProvider extends EditRecord
|
||||
{
|
||||
protected static string $resource = GenericOIDCProviderResource::class;
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCancelFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-arrow-left'),
|
||||
DeleteAction::make(),
|
||||
$this->getSaveFormAction()->formId('form')
|
||||
->tooltip(fn (Action $action) => $action->getLabel())
|
||||
->hiddenLabel()
|
||||
->icon('tabler-device-floppy'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\Pages;
|
||||
|
||||
use Boy132\GenericOIDCProviders\Filament\Admin\Resources\GenericOIDCProviders\GenericOIDCProviderResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListGenericOIDCProviders extends ListRecords
|
||||
{
|
||||
protected static string $resource = GenericOIDCProviderResource::class;
|
||||
}
|
||||
23
generic-oidc-providers/src/GenericOIDCProvidersPlugin.php
Normal file
23
generic-oidc-providers/src/GenericOIDCProvidersPlugin.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders;
|
||||
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
|
||||
class GenericOIDCProvidersPlugin implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'generic-oidc-providers';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
$id = str($panel->getId())->title();
|
||||
|
||||
$panel->discoverResources(plugin_path($this->getId(), "src/Filament/$id/Resources"), "Boy132\\GenericOIDCProviders\\Filament\\$id\\Resources");
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void {}
|
||||
}
|
||||
50
generic-oidc-providers/src/Models/GenericOIDCProvider.php
Normal file
50
generic-oidc-providers/src/Models/GenericOIDCProvider.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property string $id
|
||||
* @property bool $create_missing_users
|
||||
* @property bool $link_missing_users
|
||||
* @property string $display_name
|
||||
* @property ?string $display_icon
|
||||
* @property ?string $display_color
|
||||
* @property string $base_url
|
||||
* @property string $client_id
|
||||
* @property string $client_secret
|
||||
* @property bool $verify_jwt
|
||||
* @property ?string $jwt_public_key
|
||||
*/
|
||||
class GenericOIDCProvider extends Model
|
||||
{
|
||||
public $incrementing = false;
|
||||
|
||||
protected $table = 'generic_oidc_providers';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'create_missing_users',
|
||||
'link_missing_users',
|
||||
'display_name',
|
||||
'display_icon',
|
||||
'display_color',
|
||||
'base_url',
|
||||
'client_id',
|
||||
'client_secret',
|
||||
'verify_jwt',
|
||||
'jwt_public_key',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'create_missing_users' => 'bool',
|
||||
'link_missing_users' => 'bool',
|
||||
'client_id' => 'encrypted',
|
||||
'client_secret' => 'encrypted',
|
||||
'verify_jwt' => 'bool',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\GenericOIDCProviders\Providers;
|
||||
|
||||
use App\Extensions\OAuth\OAuthService;
|
||||
use Boy132\GenericOIDCProviders\Extensions\OAuth\Schemas\GenericOIDCProviderSchema;
|
||||
use Boy132\GenericOIDCProviders\Models\GenericOIDCProvider;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class GenericOIDCProvidersPluginProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
$service = $this->app->make(OAuthService::class);
|
||||
|
||||
$providers = GenericOIDCProvider::all();
|
||||
foreach ($providers as $provider) {
|
||||
$service->register(new GenericOIDCProviderSchema($provider));
|
||||
}
|
||||
}
|
||||
}
|
||||
674
legal-pages/LICENSE
Normal file
674
legal-pages/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
10
legal-pages/README.md
Normal file
10
legal-pages/README.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Legal Pages (by Boy132)
|
||||
|
||||
Adds essential legal pages (Imprint, Privacy Policy, Terms of Service) to the panel for compliance with legal requirements.
|
||||
|
||||
## Features
|
||||
|
||||
- Pre-configured legal page types (Imprint, Privacy Policy, Terms of Service)
|
||||
- Admin interface for editing legal page content
|
||||
- Accessible pages in the user-facing app panel
|
||||
- Markdown support for page content
|
||||
17
legal-pages/lang/en/strings.php
Normal file
17
legal-pages/lang/en/strings.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'legal_page' => 'Legal Page|Legal Pages',
|
||||
'clear' => 'Clear',
|
||||
|
||||
'pages' => [
|
||||
'imprint' => 'Imprint',
|
||||
'terms-of-service' => 'Terms of Service',
|
||||
'privacy-policy' => 'Privacy Policy',
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
'saved' => 'Legal Pages saved',
|
||||
'saved_error' => 'Could not save Legal Pages',
|
||||
],
|
||||
];
|
||||
18
legal-pages/plugin.json
Normal file
18
legal-pages/plugin.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"id": "legal-pages",
|
||||
"name": "Legal Pages",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Adds some legal pages (like an Imprint) to the panel",
|
||||
"category": "plugin",
|
||||
"url": "https://github.com/everestmcarthur/forged-plugs/tree/main/legal-pages",
|
||||
"update_url": null,
|
||||
"namespace": "Boy132\\LegalPages",
|
||||
"class": "LegalPagesPlugin",
|
||||
"panels": [
|
||||
"admin",
|
||||
"app"
|
||||
],
|
||||
"panel_version": null,
|
||||
"composer_packages": null
|
||||
}
|
||||
3
legal-pages/resources/views/base-page.blade.php
Normal file
3
legal-pages/resources/views/base-page.blade.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<x-filament-panels::page>
|
||||
{{ $this->form }}
|
||||
</x-filament-panels::page>
|
||||
37
legal-pages/src/Enums/LegalPageType.php
Normal file
37
legal-pages/src/Enums/LegalPageType.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Enums;
|
||||
|
||||
use Boy132\LegalPages\Filament\App\Pages\Imprint;
|
||||
use Boy132\LegalPages\Filament\App\Pages\PrivacyPolicy;
|
||||
use Boy132\LegalPages\Filament\App\Pages\TermsOfService;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
enum LegalPageType: string implements HasLabel
|
||||
{
|
||||
case Imprint = Imprint::class;
|
||||
case TermsOfService = TermsOfService::class;
|
||||
case PrivacyPolicy = PrivacyPolicy::class;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return Str::snake($this->name, '-');
|
||||
}
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return trans('legal-pages::strings.pages.' . $this->getId());
|
||||
}
|
||||
|
||||
public function getUrl(): string
|
||||
{
|
||||
return '/' . Str::slug($this->getId());
|
||||
}
|
||||
|
||||
/** @return class-string */
|
||||
public function getClass(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
135
legal-pages/src/Filament/Admin/Pages/LegalPages.php
Normal file
135
legal-pages/src/Filament/Admin/Pages/LegalPages.php
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Filament\Admin\Pages;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Boy132\LegalPages\LegalPagesPlugin;
|
||||
use Exception;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\MarkdownEditor;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Concerns\InteractsWithFormActions;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Component;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
/**
|
||||
* @property Schema $form
|
||||
*/
|
||||
class LegalPages extends Page
|
||||
{
|
||||
use InteractsWithFormActions;
|
||||
use InteractsWithForms;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'tabler-gavel';
|
||||
|
||||
protected string $view = 'filament.server.pages.server-form-page';
|
||||
|
||||
/** @var array<mixed>|null */
|
||||
public ?array $data = [];
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return trans_choice('legal-pages::strings.legal_page', 2);
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return trans_choice('legal-pages::strings.legal_page', 2);
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return trans('admin/dashboard.advanced');
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return user()?->can('view legalPage');
|
||||
}
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$data = [];
|
||||
|
||||
foreach (LegalPageType::cases() as $legalPageType) {
|
||||
$data[$legalPageType->getId()] = LegalPagesPlugin::Load($legalPageType);
|
||||
}
|
||||
|
||||
$this->form->fill($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Component[]
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getFormSchema(): array
|
||||
{
|
||||
$schema = [];
|
||||
|
||||
foreach (LegalPageType::cases() as $legalPageType) {
|
||||
$schema[] = MarkdownEditor::make($legalPageType->getId())
|
||||
->label($legalPageType->getLabel())
|
||||
->disabled(fn () => !user()?->can('update legalPage'))
|
||||
->hintActions([
|
||||
Action::make('hint_view')
|
||||
->label(trans('filament-actions::view.single.label'))
|
||||
->icon('tabler-eye')
|
||||
->url($legalPageType->getUrl(), true)
|
||||
->visible(fn (Get $get) => $get($legalPageType->getId())),
|
||||
Action::make('hint_clear')
|
||||
->label(trans('legal-pages::strings.clear'))
|
||||
->authorize(fn () => user()?->can('update legalPage'))
|
||||
->color('danger')
|
||||
->icon('tabler-trash')
|
||||
->action(fn (Set $set) => $set($legalPageType->getId(), null)),
|
||||
]);
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
protected function getFormStatePath(): ?string
|
||||
{
|
||||
return 'data';
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('save')
|
||||
->authorize(fn () => user()?->can('update legalPage'))
|
||||
->hiddenLabel()
|
||||
->action('save')
|
||||
->keyBindings(['mod+s'])
|
||||
->tooltip(trans('filament-panels::resources/pages/edit-record.form.actions.save.label'))
|
||||
->icon('tabler-device-floppy'),
|
||||
];
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
try {
|
||||
$data = $this->form->getState();
|
||||
|
||||
foreach ($data as $legalPageType => $contents) {
|
||||
LegalPagesPlugin::Save($legalPageType, $contents);
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title(trans('legal-pages::strings.notifications.saved'))
|
||||
->success()
|
||||
->send();
|
||||
} catch (Exception $exception) {
|
||||
Notification::make()
|
||||
->title(trans('legal-pages::strings.notifications.saved_error'))
|
||||
->body($exception->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
64
legal-pages/src/Filament/App/Pages/BaseLegalPage.php
Normal file
64
legal-pages/src/Filament/App/Pages/BaseLegalPage.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Filament\App\Pages;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Boy132\LegalPages\LegalPagesPlugin;
|
||||
use Exception;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Component;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
abstract class BaseLegalPage extends Page implements HasForms
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
public array $data = [];
|
||||
|
||||
protected string $view = 'legal-pages::base-page';
|
||||
|
||||
protected ?string $content = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->getPageType()->getLabel();
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string
|
||||
{
|
||||
return Width::SevenExtraLarge;
|
||||
}
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->content = LegalPagesPlugin::Load($this->getPageType());
|
||||
|
||||
abort_if(!$this->content, 404);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Component[]
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getFormSchema(): array
|
||||
{
|
||||
return [
|
||||
TextEntry::make('content')
|
||||
->hiddenLabel()
|
||||
->markdown()
|
||||
->state(fn () => $this->content),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getFormStatePath(): ?string
|
||||
{
|
||||
return 'data';
|
||||
}
|
||||
|
||||
abstract public function getPageType(): LegalPageType;
|
||||
}
|
||||
19
legal-pages/src/Filament/App/Pages/Imprint.php
Normal file
19
legal-pages/src/Filament/App/Pages/Imprint.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Filament\App\Pages;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Filament\Panel;
|
||||
|
||||
class Imprint extends BaseLegalPage
|
||||
{
|
||||
public static function getSlug(?Panel $panel = null): string
|
||||
{
|
||||
return LegalPageType::Imprint->getId();
|
||||
}
|
||||
|
||||
public function getPageType(): LegalPageType
|
||||
{
|
||||
return LegalPageType::Imprint;
|
||||
}
|
||||
}
|
||||
19
legal-pages/src/Filament/App/Pages/PrivacyPolicy.php
Normal file
19
legal-pages/src/Filament/App/Pages/PrivacyPolicy.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Filament\App\Pages;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Filament\Panel;
|
||||
|
||||
class PrivacyPolicy extends BaseLegalPage
|
||||
{
|
||||
public static function getSlug(?Panel $panel = null): string
|
||||
{
|
||||
return LegalPageType::PrivacyPolicy->getId();
|
||||
}
|
||||
|
||||
public function getPageType(): LegalPageType
|
||||
{
|
||||
return LegalPageType::PrivacyPolicy;
|
||||
}
|
||||
}
|
||||
19
legal-pages/src/Filament/App/Pages/TermsOfService.php
Normal file
19
legal-pages/src/Filament/App/Pages/TermsOfService.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Filament\App\Pages;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Filament\Panel;
|
||||
|
||||
class TermsOfService extends BaseLegalPage
|
||||
{
|
||||
public static function getSlug(?Panel $panel = null): string
|
||||
{
|
||||
return LegalPageType::TermsOfService->getId();
|
||||
}
|
||||
|
||||
public function getPageType(): LegalPageType
|
||||
{
|
||||
return LegalPageType::TermsOfService;
|
||||
}
|
||||
}
|
||||
49
legal-pages/src/LegalPagesPlugin.php
Normal file
49
legal-pages/src/LegalPagesPlugin.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class LegalPagesPlugin implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'legal-pages';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void
|
||||
{
|
||||
$id = str($panel->getId())->title();
|
||||
|
||||
$panel->discoverPages(plugin_path($this->getId(), "src/Filament/$id/Pages"), "Boy132\\LegalPages\\Filament\\$id\\Pages");
|
||||
}
|
||||
|
||||
public function boot(Panel $panel): void {}
|
||||
|
||||
public static function Save(LegalPageType|string $type, ?string $contents): bool
|
||||
{
|
||||
if ($type instanceof LegalPageType) {
|
||||
$type = $type->getId();
|
||||
}
|
||||
|
||||
$path = $type . '.md';
|
||||
|
||||
if (!$contents) {
|
||||
return Storage::delete($path);
|
||||
}
|
||||
|
||||
return Storage::put($path, $contents);
|
||||
}
|
||||
|
||||
public static function Load(LegalPageType|string $type): ?string
|
||||
{
|
||||
if ($type instanceof LegalPageType) {
|
||||
$type = $type->getId();
|
||||
}
|
||||
|
||||
return Storage::get($type . '.md');
|
||||
}
|
||||
}
|
||||
46
legal-pages/src/Providers/LegalPagesPluginProvider.php
Normal file
46
legal-pages/src/Providers/LegalPagesPluginProvider.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Providers;
|
||||
|
||||
use App\Enums\CustomRenderHooks;
|
||||
use App\Models\Role;
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Boy132\LegalPages\LegalPagesPlugin;
|
||||
use Filament\Support\Facades\FilamentView;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class LegalPagesPluginProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
Role::registerCustomPermissions([
|
||||
'legalPage' => [
|
||||
'view',
|
||||
'update',
|
||||
],
|
||||
]);
|
||||
Role::registerCustomModelIcon('legalPage', 'tabler-gavel');
|
||||
|
||||
$footer = null;
|
||||
|
||||
foreach (LegalPageType::cases() as $legalPageType) {
|
||||
$content = LegalPagesPlugin::Load($legalPageType);
|
||||
|
||||
if ($content) {
|
||||
$label = $legalPageType->getLabel();
|
||||
$url = $legalPageType->getUrl();
|
||||
|
||||
if (!$footer) {
|
||||
$footer = "<x-filament::link href=\"$url\" target='_blank'>$label</x-filament::link>";
|
||||
} else {
|
||||
$footer = "$footer | <x-filament::link href=\"$url\" target='_blank'>$label</x-filament::link>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($footer) {
|
||||
FilamentView::registerRenderHook(CustomRenderHooks::FooterEnd->value, fn () => Blade::render("<div>$footer</div>"));
|
||||
}
|
||||
}
|
||||
}
|
||||
19
legal-pages/src/Providers/LegalPagesRouteProvider.php
Normal file
19
legal-pages/src/Providers/LegalPagesRouteProvider.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\LegalPages\Providers;
|
||||
|
||||
use Boy132\LegalPages\Enums\LegalPageType;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class LegalPagesRouteProvider extends RouteServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
$this->routes(function () {
|
||||
foreach (LegalPageType::cases() as $legalPageType) {
|
||||
Route::get($legalPageType->getId(), $legalPageType->getClass())->name('legal-pages.' . $legalPageType->getId())->withoutMiddleware(['auth']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
227
manifest.json
Normal file
227
manifest.json
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
{
|
||||
"plugins": [
|
||||
{
|
||||
"id": "announcements",
|
||||
"name": "Announcements",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Create panel wide announcements to inform your users about stuff",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/announcements/",
|
||||
"readme": "# Announcements (by Boy132)\n\nCreate panel-wide announcements to inform your users about important updates, maintenance schedules, or any other information.\n\n## Features\n\n- Create announcements with customizable titles and body text\n- Support for different announcement types (info, warning, danger, success)\n- Target specific panels (admin, app, server) or display on all panels\n- Schedule announcements with valid from/to dates\n- Announcements are displayed as alert banners across the panel\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "billing",
|
||||
"name": "Billing",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple billing plugin which allows users to purchase servers.",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/billing/",
|
||||
"readme": "# Billing (by Boy132)\n\nA simple billing plugin that allows users to purchase servers using Stripe as the payment processor.\n\n**WARNING: This plugin is incomplete! Do NOT use this plugin in production!**\n\n## Features\n\n- Stripe integration for payment processing\n- Product management with customizable pricing intervals (monthly, yearly, etc.)\n- Coupon system with percentage and fixed amount discounts\n- Customer management linked to user accounts\n- Order tracking and management\n- Dashboard widget fo",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "generic-oidc-providers",
|
||||
"name": "Generic OIDC Providers",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Allows to create generic OIDC providers.",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/generic-oidc-providers/",
|
||||
"readme": "# Generic OIDC Providers (by Boy132)\n\nAllows administrators to create and configure generic OpenID Connect (OIDC) providers for authentication.\n\n## Features\n\n- Create custom OIDC providers through the admin panel\n- Configure client ID, client secret, and authorization endpoints\n- Support for multiple OIDC providers simultaneously\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "legal-pages",
|
||||
"name": "Legal Pages",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Adds some legal pages (like an Imprint) to the panel",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/legal-pages/",
|
||||
"readme": "# Legal Pages (by Boy132)\n\nAdds essential legal pages (Imprint, Privacy Policy, Terms of Service) to the panel for compliance with legal requirements.\n\n## Features\n\n- Pre-configured legal page types (Imprint, Privacy Policy, Terms of Service)\n- Admin interface for editing legal page content\n- Accessible pages in the user-facing app panel\n- Markdown support for page content\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "mclogs-uploader",
|
||||
"name": "Mclogs Uploader",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Upload console logs to mclo.gs",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/mclogs-uploader/",
|
||||
"readme": "# MCLogs Uploader (by Boy132)\n\nUpload server console logs to mclo.gs for easy sharing and troubleshooting.\n\n## Features\n\n- One-click upload of console logs to mclo.gs\n- Integrated action button in the server console\n- Perfect for (but not limited to) Minecraft server\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "minecraft-modrinth",
|
||||
"name": "Minecraft Modrinth",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Easily download minecraft mods & plugins from modrinth",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/minecraft-modrinth/",
|
||||
"readme": "# Minecraft Modrinth (by Boy132)\n\nEasily download and install Minecraft mods and plugins directly from Modrinth within the server panel.\n\n## Setup\n\nAdd `modrinth_mods` or `modrinth_plugins` to the _features_ of your egg to enable the mod/plugins page. \nAlso make sure your egg has the `minecraft` _tag_ and a _tag_ for the [mod loader](https://github.com/pelican-dev/plugins/blob/main/minecraft-modrinth/src/Enums/MinecraftLoader.php#L10-L16). (e.g. `paper` or `neoforge`)\n\n## Features\n\n- Browse and",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "pirate-language",
|
||||
"name": "Pirate Language",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Turns yer site's lingo into pirate talk, matey!",
|
||||
"category": "language",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/pirate-language/",
|
||||
"readme": "# Pirate Language (by Boy132)\n\nTurns yer site's lingo into pirate talk, matey! A fun language pack that transforms the entire panel interface into pirate speak.\n\n_Not all sites are translated yet!_\n\n## Features\n\n- Complete translation of panel interface to pirate speak\n- Covers admin, server, and profile sections\n- Fun and thematic for gaming communities\n- Easy to enable through language settings\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "player-counter",
|
||||
"name": "Player Counter",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Show the amount of connected players to the server",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/player-counter/",
|
||||
"readme": "# Player Counter (by Boy132)\n\nShow the amount of connected players to game servers with real-time querying capabilities.\n\n## Setup\n\nMake sure your server has an allocation with a public ip. Alternatively, if you use local ips you can put the public ip in the allocation alias and enable \"Use allocation alias?\" in the plugin settings.\n\nMinecraft servers will first try the query (which requires you to set `enable-query` to true and `query-port` to your server port in `server.properties`) and will f",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "register",
|
||||
"name": "Register",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple way for users to register themselves",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/register/",
|
||||
"readme": "# Register (by Boy132)\n\nA simple way for users to register themselves on the panel without administrator intervention.\n\n## Features\n\n- Self-service user registration\n- Seamless integration with existing login flow\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "robo-avatars",
|
||||
"name": "Robo Avatars",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Adds RoboHash as avatar provider",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/robo-avatars/",
|
||||
"readme": "# Robo Avatars (by Boy132)\n\nAdds [RoboHash](https://robohash.org/) as an avatar provider, generating unique robot avatars for users based on their email address.\n\n## Features\n\n- Automatic robot avatar generation for all users\n- Fun and distinctive visual identity for users\n- Unique avatars based on email hash\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "rust-umod",
|
||||
"name": "Rust uMod",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Easily download rust plugins from uMod",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/rust-umod/",
|
||||
"readme": "# Rust uMod (by Boy132)\n\nEasily download and install Rust plugins directly from uMod (formerly Oxide) within the server panel.\n\n## Setup\n\nAdd `umod_plugins` to the _features_ of your egg to enable the mod page. \nAlso make sure you use `oxide` or `umod` as modding framework. (`FRAMEWORK` startup variable)\n\n## Features\n\n- Browse and search uMod's Rust plugin library\n- One-click installation to the correct directory\n- Search and filter plugins by name\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "snowflakes",
|
||||
"name": "Snowflakes",
|
||||
"author": "Boy132 & notCharles",
|
||||
"version": "1.0.0",
|
||||
"description": "Let it snow, let it snow, let it snow",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/snowflakes/",
|
||||
"readme": "# Snowflakes (by Boy132 & notCharles)\n\nLet it snow, let it snow, let it snow! Adds a festive snowfall animation to the panel.\n\n## Features\n\n- Animated falling snowflakes across all panels\n- Non-intrusive - doesn't affect panel functionality\n- Perfect for holiday seasons or winter themes\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "subdomains",
|
||||
"name": "Subdomains",
|
||||
"author": "Boy132 & HarlequinSin",
|
||||
"version": "1.0.0",
|
||||
"description": "Allows users to create subdomains for their servers",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/subdomains/",
|
||||
"readme": "# Subdomains (by Boy132 & HarlequinSin)\n\nAllows users to create and manage custom subdomains (A/AAAA or SRV) for their game servers using Cloudflare DNS.\n\n## Setup\n\n[Create a Cloudflare API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/) and enter it via the plugin settings. \nThe token needs to have read permissions for `Zone.Zone` and write for `Zone.Dns`. For better security you can also set the `Zone Resources` to exclude certain domains and add the panel",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "tawkto-widget",
|
||||
"name": "Tawk.to Widget",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Adds a Tawk.to widget to all panels",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/tawkto-widget/",
|
||||
"readme": "# Tawk.to Widget (by Boy132)\n\nAdds a Tawk.to live chat widget to all panels for real-time customer support.\n\n## Features\n\n- Tawk.to live chat integration\n- Configurable through plugin settings\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "theme-customizer",
|
||||
"name": "Theme Customizer",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Allows to customize the panel font and colors",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/theme-customizer/",
|
||||
"readme": "# Theme Customizer (by Boy132)\n\nAllows administrators to customize the panel font and colors through an intuitive settings interface.\n\n## Features\n\n- Custom font support (upload TTF files)\n- Customizable color palette\n- Live preview of changes\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "tickets",
|
||||
"name": "Tickets",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Simple ticket system",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/tickets/",
|
||||
"readme": "# Tickets (by Boy132)\n\nA simple ticket system for users to submit support requests and for administrators to manage them.\n\n## Features\n\n- User ticket submission from server panel\n- Ticket categories and priorities\n- Ticket assignment to administrators\n- Admin ticket management and responses\n",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
},
|
||||
{
|
||||
"id": "user-creatable-servers",
|
||||
"name": "User Creatable Servers",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Allow users to create their own servers",
|
||||
"category": "plugin",
|
||||
"download_url": "https://github.com/everestmcarthur/forged-plugs/archive/refs/heads/main.zip",
|
||||
"plugin_download_url": "https://raw.githubusercontent.com/everestmcarthur/forged-plugs/main/user-creatable-servers/",
|
||||
"readme": "# User Creatable Servers (by Boy132)\n\nAllow users to create their own servers within defined resource limits set by administrators.\n\n## Setup\n\nAdd the deployment tag (`user_creatable_servers` by default) to the nodes that should be used for creating servers.\n\n## Features\n\n- Users can create servers without admin intervention\n- Configurable resource limits per user (CPU, RAM, disk, etc.)\n- Admin management of user resource allocations\n- Resource usage overview widget for users\n- Integration with ",
|
||||
"has_preview": false,
|
||||
"preview_url": null
|
||||
}
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"repo": "everestmcarthur/forged-plugs"
|
||||
}
|
||||
674
mclogs-uploader/LICENSE
Normal file
674
mclogs-uploader/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
9
mclogs-uploader/README.md
Normal file
9
mclogs-uploader/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# MCLogs Uploader (by Boy132)
|
||||
|
||||
Upload server console logs to mclo.gs for easy sharing and troubleshooting.
|
||||
|
||||
## Features
|
||||
|
||||
- One-click upload of console logs to mclo.gs
|
||||
- Integrated action button in the server console
|
||||
- Perfect for (but not limited to) Minecraft server
|
||||
5
mclogs-uploader/config/mclogs-uploader.php
Normal file
5
mclogs-uploader/config/mclogs-uploader.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'only_minecraft_eggs' => env('MCLOGS_UPLOADER_ONLY_MINECRAFT_EGGS', false),
|
||||
];
|
||||
14
mclogs-uploader/lang/en/upload.php
Normal file
14
mclogs-uploader/lang/en/upload.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'upload_logs' => 'Upload logs',
|
||||
'uploaded' => 'Console logs uploaded',
|
||||
'upload_failed' => 'Could not upload logs',
|
||||
|
||||
'only_minecraft_eggs' => 'Only for Minecraft eggs?',
|
||||
'only_minecraft_eggs_hint' => 'If enabled the button to upload logs will only be displayed on eggs that have the "minecraft" tag.',
|
||||
|
||||
'notifications' => [
|
||||
'settings_saved' => 'Settings saved',
|
||||
],
|
||||
];
|
||||
17
mclogs-uploader/plugin.json
Normal file
17
mclogs-uploader/plugin.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"id": "mclogs-uploader",
|
||||
"name": "Mclogs Uploader",
|
||||
"author": "Boy132",
|
||||
"version": "1.0.0",
|
||||
"description": "Upload console logs to mclo.gs",
|
||||
"category": "plugin",
|
||||
"url": "https://github.com/everestmcarthur/forged-plugs/tree/main/mclogs-uploader",
|
||||
"update_url": null,
|
||||
"namespace": "Boy132\\MclogsUploader",
|
||||
"class": "MclogsUploaderPlugin",
|
||||
"panels": [
|
||||
"server"
|
||||
],
|
||||
"panel_version": null,
|
||||
"composer_packages": null
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\MclogsUploader\Filament\Components\Actions;
|
||||
|
||||
use App\Models\Server;
|
||||
use Exception;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\Size;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class UploadLogsAction extends Action
|
||||
{
|
||||
public static function getDefaultName(): ?string
|
||||
{
|
||||
return 'upload_logs';
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->hidden(function () {
|
||||
/** @var Server $server */
|
||||
$server = Filament::getTenant();
|
||||
|
||||
if (config('mclogs-uploader.only_minecraft_eggs')) {
|
||||
if (!in_array('minecraft', $server->egg->tags ?? [])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return $server->retrieveStatus()->isOffline();
|
||||
});
|
||||
|
||||
$this->hiddenLabel();
|
||||
|
||||
$this->tooltip(fn () => trans('mclogs-uploader::upload.upload_logs'));
|
||||
|
||||
$this->icon('tabler-upload');
|
||||
|
||||
$this->color('primary');
|
||||
|
||||
$this->size(Size::ExtraLarge);
|
||||
|
||||
$this->action(function () {
|
||||
/** @var Server $server */
|
||||
$server = Filament::getTenant();
|
||||
|
||||
try {
|
||||
$logs = Http::daemon($server->node)
|
||||
->get("/api/servers/{$server->uuid}/logs")
|
||||
->throw()
|
||||
->json('data');
|
||||
|
||||
$logs = is_array($logs) ? implode(PHP_EOL, $logs) : $logs;
|
||||
|
||||
$response = Http::asForm()
|
||||
->timeout(15)
|
||||
->connectTimeout(5)
|
||||
->throw()
|
||||
->post('https://api.mclo.gs/1/log', [
|
||||
'content' => $logs,
|
||||
])
|
||||
->json();
|
||||
|
||||
if ($response['success']) {
|
||||
Notification::make()
|
||||
->title(trans('mclogs-uploader::upload.uploaded'))
|
||||
->body($response['url'])
|
||||
->persistent()
|
||||
->success()
|
||||
->send();
|
||||
} else {
|
||||
Notification::make()
|
||||
->title(trans('mclogs-uploader::upload.upload_failed'))
|
||||
->body($response['error'])
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
report($exception);
|
||||
|
||||
Notification::make()
|
||||
->title(trans('mclogs-uploader::upload.upload_failed'))
|
||||
->body($exception->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
48
mclogs-uploader/src/MclogsUploaderPlugin.php
Normal file
48
mclogs-uploader/src/MclogsUploaderPlugin.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\MclogsUploader;
|
||||
|
||||
use App\Contracts\Plugins\HasPluginSettings;
|
||||
use App\Traits\EnvironmentWriterTrait;
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Panel;
|
||||
|
||||
class MclogsUploaderPlugin implements HasPluginSettings, Plugin
|
||||
{
|
||||
use EnvironmentWriterTrait;
|
||||
|
||||
public function getId(): string
|
||||
{
|
||||
return 'mclogs-uploader';
|
||||
}
|
||||
|
||||
public function register(Panel $panel): void {}
|
||||
|
||||
public function boot(Panel $panel): void {}
|
||||
|
||||
public function getSettingsForm(): array
|
||||
{
|
||||
return [
|
||||
Toggle::make('only_minecraft_eggs')
|
||||
->label(trans('mclogs-uploader::upload.only_minecraft_eggs'))
|
||||
->hintIcon('tabler-question-mark')
|
||||
->hintIconTooltip(trans('mclogs-uploader::upload.only_minecraft_eggs_hint'))
|
||||
->inline(false)
|
||||
->default(fn () => config('mclogs-uploader.only_minecraft_eggs')),
|
||||
];
|
||||
}
|
||||
|
||||
public function saveSettings(array $data): void
|
||||
{
|
||||
$this->writeToEnvironment([
|
||||
'MCLOGS_UPLOADER_ONLY_MINECRAFT_EGGS' => $data['only_minecraft_eggs'],
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title(trans('mclogs-uploader::upload.notifications.settings_saved'))
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Boy132\MclogsUploader\Providers;
|
||||
|
||||
use App\Enums\HeaderActionPosition;
|
||||
use App\Filament\Server\Pages\Console;
|
||||
use Boy132\MclogsUploader\Filament\Components\Actions\UploadLogsAction;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class MclogsUploaderPluginProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
Console::registerCustomHeaderActions(HeaderActionPosition::Before, UploadLogsAction::make());
|
||||
}
|
||||
|
||||
public function boot(): void {}
|
||||
}
|
||||
674
minecraft-modrinth/LICENSE
Normal file
674
minecraft-modrinth/LICENSE
Normal file
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
15
minecraft-modrinth/README.md
Normal file
15
minecraft-modrinth/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Minecraft Modrinth (by Boy132)
|
||||
|
||||
Easily download and install Minecraft mods and plugins directly from Modrinth within the server panel.
|
||||
|
||||
## Setup
|
||||
|
||||
Add `modrinth_mods` or `modrinth_plugins` to the _features_ of your egg to enable the mod/plugins page.
|
||||
Also make sure your egg has the `minecraft` _tag_ and a _tag_ for the [mod loader](https://github.com/pelican-dev/plugins/blob/main/minecraft-modrinth/src/Enums/MinecraftLoader.php#L10-L16). (e.g. `paper` or `neoforge`)
|
||||
|
||||
## Features
|
||||
|
||||
- Browse and search Modrinth's extensive mod library
|
||||
- Download mods and plugins directly to your server
|
||||
- Automatic version compatibility checking
|
||||
- Seamless installation to the correct server directory
|
||||
5
minecraft-modrinth/config/minecraft-modrinth.php
Normal file
5
minecraft-modrinth/config/minecraft-modrinth.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'latest_minecraft_version' => env('LATEST_MINECRAFT_VERSION', '26.1.2'),
|
||||
];
|
||||
46
minecraft-modrinth/lang/de/strings.php
Normal file
46
minecraft-modrinth/lang/de/strings.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'plugin_name' => 'Modrinth',
|
||||
'minecraft_mods' => 'Minecraft Mods',
|
||||
'minecraft_plugins' => 'Minecraft Plugins',
|
||||
|
||||
'settings' => [
|
||||
'latest_minecraft_version' => 'Neueste Minecraft-Version',
|
||||
'settings_saved' => 'Einstellungen gespeichert',
|
||||
],
|
||||
|
||||
'page' => [
|
||||
'open_folder' => ':folder-Ordner öffnen',
|
||||
'minecraft_version' => 'Minecraft-Version',
|
||||
'loader' => 'Loader',
|
||||
'installed' => 'Installiert :type',
|
||||
'unknown' => 'Unbekannt',
|
||||
],
|
||||
|
||||
'table' => [
|
||||
'columns' => [
|
||||
'title' => 'Titel',
|
||||
'author' => 'Autor',
|
||||
'downloads' => 'Downloads',
|
||||
'date_modified' => 'Geändert',
|
||||
],
|
||||
],
|
||||
|
||||
'version' => [
|
||||
'type' => 'Typ',
|
||||
'downloads' => 'Downloads',
|
||||
'published' => 'Veröffentlicht',
|
||||
'changelog' => 'Änderungsprotokoll',
|
||||
'no_file_found' => 'Keine Datei gefunden',
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
'download' => 'Herunterladen',
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
'download_started' => 'Download gestartet',
|
||||
'download_failed' => 'Download konnte nicht gestartet werden',
|
||||
],
|
||||
];
|
||||
46
minecraft-modrinth/lang/en/strings.php
Normal file
46
minecraft-modrinth/lang/en/strings.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'plugin_name' => 'Modrinth',
|
||||
'minecraft_mods' => 'Minecraft Mods',
|
||||
'minecraft_plugins' => 'Minecraft Plugins',
|
||||
|
||||
'settings' => [
|
||||
'latest_minecraft_version' => 'Latest Minecraft Version',
|
||||
'settings_saved' => 'Settings saved',
|
||||
],
|
||||
|
||||
'page' => [
|
||||
'open_folder' => 'Open :folder folder',
|
||||
'minecraft_version' => 'Minecraft Version',
|
||||
'loader' => 'Loader',
|
||||
'installed' => 'Installed :type',
|
||||
'unknown' => 'Unknown',
|
||||
],
|
||||
|
||||
'table' => [
|
||||
'columns' => [
|
||||
'title' => 'Title',
|
||||
'author' => 'Author',
|
||||
'downloads' => 'Downloads',
|
||||
'date_modified' => 'Modified',
|
||||
],
|
||||
],
|
||||
|
||||
'version' => [
|
||||
'type' => 'Type',
|
||||
'downloads' => 'Downloads',
|
||||
'published' => 'Published',
|
||||
'changelog' => 'Changelog',
|
||||
'no_file_found' => 'No file found',
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
'download' => 'Download',
|
||||
],
|
||||
|
||||
'notifications' => [
|
||||
'download_started' => 'Download started',
|
||||
'download_failed' => 'Download could not be started',
|
||||
],
|
||||
];
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue