Runway 1.0.1
This commit is contained in:
1 parent
dcf819146b
commit
ce217fc952
259 files changed
+22226
-206
No files matched your search
@@ -0,0 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes are recorded here. Versions follow [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [2.1.0] — 2026-10-21
|
||||
|
||||
First public release of `carousel-manager`: an image/slide carousel content widget — slides configured per site,
|
||||
placed on any page with a `data-widget` anchor; self-contained CSS and JavaScript, no external libraries. Requires SPI `1.0.0` (Runway `1.0.0` or later). Licensed under the GNU AGPL v3.0 with an additional permission for
|
||||
plugins (`LICENSE`, `LICENSE-EXCEPTION`).
|
||||
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
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 AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,44 @@
|
||||
Runway — additional permission for plugins
|
||||
(an additional permission under section 7 of the GNU Affero General Public License, version 3)
|
||||
|
||||
Copyright (C) 2026 Quest ICT SAS de CV
|
||||
|
||||
Runway is free software: you can redistribute it and/or modify it under the terms of the
|
||||
GNU Affero General Public License as published by the Free Software Foundation, version 3
|
||||
(the file LICENSE), with the additional permission below. Runway 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 Affero General Public
|
||||
License for more details.
|
||||
|
||||
1. Definitions
|
||||
|
||||
"Runway" means the Runway kernel and every Runway plugin whose source carries this file.
|
||||
|
||||
"Published SPI" means the public classes and interfaces of the runway-spi artifact
|
||||
(the package mx.quest.runway.spi and its subpackages), together with the public classes
|
||||
and interfaces of any package named "spi" that a part of Runway publishes for other
|
||||
plugins to use (for example mx.quest.search.spi).
|
||||
|
||||
"Plugin" means an independent module that Runway loads as a plugin, that interacts with
|
||||
Runway only through the Published SPI, and that is not based on any part of Runway other
|
||||
than the Published SPI.
|
||||
|
||||
2. Permission
|
||||
|
||||
As an additional permission, the copyright holder gives you permission to combine Runway
|
||||
with Plugins, and to convey and run the resulting combination, without the terms of the
|
||||
GNU Affero General Public License applying to those Plugins. You may license, convey and
|
||||
run your Plugins under terms of your choice, provided that you continue to meet the terms
|
||||
of the GNU Affero General Public License for Runway itself, including offering the
|
||||
Corresponding Source of Runway, and of any modification you make to it, as that license
|
||||
requires.
|
||||
|
||||
3. Testing
|
||||
|
||||
Compiling a Plugin's tests against the runway-spi-testkit artifact, and running them, does
|
||||
not by itself make the Plugin subject to the GNU Affero General Public License.
|
||||
|
||||
4. Modified versions
|
||||
|
||||
If you modify Runway, you may extend this additional permission to your version, but you
|
||||
are not obliged to do so. If you do not wish to, delete this file from your version.
|
||||
@@ -0,0 +1,39 @@
|
||||
# Runway Carousel Manager plugin
|
||||
|
||||
An image/slide **carousel** content widget for [Runway](../README.md): configure slides per site, then drop the
|
||||
carousel onto any page with a `data-widget` anchor. Self-contained CSS + JS, no external libraries.
|
||||
|
||||
- **Plugin id:** `carousel-manager` — install folder `external/plugins/carousel-manager/`
|
||||
- **Java package:** `mx.quest.carousel` · **SPI:** `ContentWidget` (`key = "carousel"`) and the service
|
||||
`PluginSettings` — it links **only the SPI**, no kernel class
|
||||
- **Version 2.1.0** · built against Runway 1.0.0; needs a kernel whose SPI is **1.0.0 or later**
|
||||
(`requiresSpi: ">=1.0.0"`; an older kernel blocks it with a reason). What changed: [`CHANGELOG.md`](CHANGELOG.md).
|
||||
|
||||
## Use it
|
||||
|
||||
1. On the carousel settings page, add slides (one per line): `imageUrl | caption | link`.
|
||||
2. Put an anchor on a page: `<div id="hero" data-widget="carousel/hero"></div>`.
|
||||
|
||||
Settings: auto-advance interval (0 = off), show captions, show controls. See
|
||||
[`docs/CAROUSEL-PLUGIN.md`](docs/CAROUSEL-PLUGIN.md).
|
||||
|
||||
> Note: this plugin does not yet declare a `widgetSettings:` schema, so the host's per-placement widget config
|
||||
> (`/__admin/widgets`) does not apply to it and every `carousel/*` anchor on a site shows the same configured
|
||||
> slides (one carousel per site).
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
export JAVA_HOME=/path/to/jdk-25
|
||||
mvn -q verify # jar + target/carousel-manager/ + the .zip
|
||||
HOST_JAR=/path/to/runway-app-<ver>-exec.jar scripts/verify-against-host.sh # boot a packaged host with it
|
||||
```
|
||||
|
||||
The first build downloads its Maven dependencies, and needs the `runway-spi` jars installed in `~/.m2` as the
|
||||
[authoring guide §2](../docs/PLUGIN-AUTHORING-GUIDE.md#2-prerequisites) describes.
|
||||
|
||||
## License
|
||||
|
||||
GNU Affero General Public License v3.0 with an additional permission for plugins (`LICENSE`, `LICENSE-EXCEPTION`),
|
||||
copyright Quest ICT SAS de CV. The permission means that a plugin which uses only the published SPI may carry any
|
||||
license.
|
||||
@@ -0,0 +1,83 @@
|
||||
# Runway Carousel Manager — design & reference
|
||||
|
||||
> The reference for a **`ContentWidget`** plugin with **per-tenant content config** and bundled
|
||||
> front-end assets. Grounded in the Runway kernel as built.
|
||||
|
||||
## 1. What it does
|
||||
|
||||
A `ContentWidget` (`key = "carousel"`) that renders an image carousel from the site's per-tenant configuration
|
||||
wherever a page carries `<div id="…" data-widget="carousel/…"></div>`. It emits self-contained markup that pulls
|
||||
in its own stylesheet and script (`/__plugin/carousel-manager/static/carousel.{css,js}`); the JS handles
|
||||
auto-advance, prev/next, and pause-on-hover, and is idempotent so multiple carousels on a page don't double-bind.
|
||||
With no slides configured the widget renders nothing.
|
||||
|
||||
## 2. Configuration (per-tenant, applied immediately)
|
||||
|
||||
| Key | Type | Default | Notes |
|
||||
|---|---|---|---|
|
||||
| `slides` | **text** | — | One slide per line: `imageUrl \| caption \| link`. `text` (not `list`) so a caption with a comma survives. Image required; caption/link optional. |
|
||||
| `intervalSeconds` | int (0–60) | `5` | Auto-advance interval; `0` disables auto-play. |
|
||||
| `showCaptions` | boolean | `true` | Overlay captions on slides. |
|
||||
| `showControls` | boolean | `true` | Show prev/next controls (only when >1 slide). |
|
||||
|
||||
Read live through the SPI service **`PluginSettings.site(siteId)`**, which answers a `SettingsView`: the
|
||||
descriptor defaults above overlaid by what the site saved. A save applies immediately (the host evicts the cached
|
||||
view on every node). The code fallbacks equal the descriptor defaults, so the widget renders the same either way;
|
||||
`intervalSeconds` is clamped to `0..60`; a hand-edited value that does not parse falls back to the default. The
|
||||
`settings` control point gates the editor. Every emitted value (image URL, caption, link) is HTML-escaped by
|
||||
`Html.escape`.
|
||||
|
||||
## 3. One slide set per site (documented)
|
||||
|
||||
The host supports per-placement widget config (a `widgetSettings:` schema in `plugin.yml`, edited per anchor at
|
||||
`/__admin/widgets`, delivered in `WidgetView.config()`), but this plugin does not declare a schema yet — so
|
||||
`config()` is empty for it and every `carousel/*` anchor on a site renders the **same** configured slides from the
|
||||
flat per-tenant `siteSettings` (one carousel per site). Distinct carousels per placement need this plugin to
|
||||
declare a `widgetSettings:` schema and read `config()`; the widget already threads `instanceId` through for that.
|
||||
|
||||
## 4. Inventory
|
||||
|
||||
| Piece | Type | File |
|
||||
|---|---|---|
|
||||
| `mainClass` `@Configuration` | `CarouselConfig` | wires the widget (`carouselManagerWidget`) + admin model (`carouselManagerAdminModel`), each given the injected `PluginSettings` |
|
||||
| Widget | `CarouselWidget` (`ContentWidget` `carousel`) | parse slides → render markup |
|
||||
| Slide model | `Slide` | parse `imageUrl \| caption \| link` |
|
||||
| Console model | `CarouselAdminModel` + `templates/` | dashboard card + admin status, read as `${@carouselManagerAdminModel.slideCount(tenantSiteId)}` |
|
||||
| Front-end | `static/carousel.css`, `static/carousel.js`, `static/carousel-help.html` | self-contained assets |
|
||||
| i18n (EN/ES) | `i18n/` | settings + console labels |
|
||||
|
||||
## 5. What it links: the SPI only
|
||||
|
||||
The plugin's compiled classes reference nothing of the kernel outside `mx.quest.runway.spi`, which is the contract
|
||||
the Runway kernel enforces (its loader refuses a non-essential plugin that links host classes). Concretely:
|
||||
|
||||
- **Settings:** `mx.quest.runway.spi.service.PluginSettings`, injected as a `@Bean` method parameter of
|
||||
`CarouselConfig`. The host binds it to `carousel-manager` by the jar `CarouselConfig` was loaded from — no id is
|
||||
passed, so the plugin can only read its own settings.
|
||||
- **Bean names** start with the plugin id in lowerCamelCase (`carouselManager…`): plugins share the host's bean
|
||||
namespace, and the kernel refuses other names.
|
||||
- **Descriptor:** `requiresSpi: ">=1.0.0"` — the plugin is built against the Runway 1.0.0 SPI. An older kernel
|
||||
blocks the plugin with a reason rather than failing to wire it.
|
||||
- **Build:** `pom.xml` depends on `runway-spi` (and `runway-spi-testkit` for tests), never on `runway-app`, so a
|
||||
host import does not compile. `CarouselConfigTest` also scans the compiled classes' constant pools for any
|
||||
`mx/quest/runway/` name outside `spi/`, checks every bean name's prefix, and checks that every
|
||||
`${@bean…}` the templates use is one of the plugin's own beans.
|
||||
|
||||
## 6. Verify
|
||||
|
||||
`HOST_JAR=… scripts/verify-against-host.sh` builds the plugin offline (run `mvn verify` once first, so that its
|
||||
dependencies are in the local Maven repository), boots the packaged host (wizard, then ACTIVE) with it installed,
|
||||
and asserts:
|
||||
|
||||
- it loads — `plugins: 1 registered, 0 blocked` — with **zero** host-linkage findings and zero
|
||||
bean-name/surface findings, and no WARN/ERROR line names it;
|
||||
- it serves its static assets;
|
||||
- signed in as the site owner, a slide set saved on its settings page is counted on the status fragment and
|
||||
on the dashboard card, and renders (both slides, the comma caption intact, the saved interval) on the seeded
|
||||
About page, into which the script plants a `data-widget="carousel/hero"` anchor before the ACTIVE boot.
|
||||
|
||||
Without `HOST_JAR` it takes the jar matching the host pom's version from the `runway-app/target` of the kernel
|
||||
this plugin sits in (`HOST_TARGET` names another build directory); `JAVA_HOME` must name a JDK 25 and `MVN` names
|
||||
Maven (default: `mvn` on the PATH). It never runs `mvn install`. `VERIFY_TMPDIR` sets where the throwaway deployment goes, `VERIFY_LOG_DIR` keeps the host
|
||||
logs. The widget's rendering rules (parsing, escaping, flags, clamping, defaults, per-site isolation) are covered
|
||||
by `CarouselWidgetTest`. Never `spring-boot:run`.
|
||||
@@ -0,0 +1,19 @@
|
||||
# Runway Carousel Manager plugin — English strings.
|
||||
|
||||
# Grantable permission (permissions matrix label)
|
||||
carousel.perm.settings=Configure carousel
|
||||
|
||||
# Per-tenant settings form labels
|
||||
carousel.set.slides=Slides (one per line: imageUrl | caption | link)
|
||||
carousel.set.interval=Auto-advance seconds (0 = off)
|
||||
carousel.set.captions=Show captions
|
||||
carousel.set.controls=Show previous/next controls
|
||||
|
||||
# Dashboard card
|
||||
carousel.card.title=Carousel
|
||||
carousel.card.slides=slides
|
||||
|
||||
# Admin status fragment
|
||||
carousel.admin.title=Carousel status
|
||||
carousel.admin.slides=Configured slides
|
||||
carousel.admin.help=Carousel help & reference
|
||||
@@ -0,0 +1,19 @@
|
||||
# Runway Carousel Manager plugin — cadenas en español.
|
||||
|
||||
# Permiso otorgable (etiqueta de la matriz de permisos)
|
||||
carousel.perm.settings=Configurar carrusel
|
||||
|
||||
# Etiquetas del formulario de configuración por sitio
|
||||
carousel.set.slides=Diapositivas (una por línea: urlImagen | leyenda | enlace)
|
||||
carousel.set.interval=Segundos de avance automático (0 = desactivado)
|
||||
carousel.set.captions=Mostrar leyendas
|
||||
carousel.set.controls=Mostrar controles anterior/siguiente
|
||||
|
||||
# Tarjeta del panel
|
||||
carousel.card.title=Carrusel
|
||||
carousel.card.slides=diapositivas
|
||||
|
||||
# Fragmento de estado (admin)
|
||||
carousel.admin.title=Estado del carrusel
|
||||
carousel.admin.slides=Diapositivas configuradas
|
||||
carousel.admin.help=Ayuda y referencia del carrusel
|
||||
@@ -0,0 +1,35 @@
|
||||
# =============================================================================
|
||||
# Runway Carousel Manager plugin — descriptor
|
||||
# An image/slide carousel a site manager configures per site and drops onto any
|
||||
# page with a data-widget anchor. Content widget + per-tenant slide config.
|
||||
# The install folder name MUST equal this `id`: external/plugins/carousel-manager/.
|
||||
# =============================================================================
|
||||
id: carousel-manager
|
||||
name: Carousel Manager
|
||||
version: 2.1.0
|
||||
|
||||
# The @Configuration registered before refresh. Package mx.quest.carousel lives OUTSIDE mx.quest.runway.
|
||||
mainClass: mx.quest.carousel.CarouselConfig
|
||||
|
||||
# Built against the Runway 1.0.0 SPI (service tier: PluginSettings). A kernel below SPI 1.0.0 BLOCKS this
|
||||
# plugin at startup with a reason, instead of failing to wire it (no PluginSettings bean to inject).
|
||||
requiresSpi: ">=1.0.0"
|
||||
|
||||
# No hard dependency (always loads); NOT essential.
|
||||
|
||||
# --- Grantable control-point permission (gates the per-tenant slide editor) ------------------------------
|
||||
permissions:
|
||||
- { id: settings, realm: tenant, label: carousel.perm.settings, defaultRoles: [] }
|
||||
|
||||
# --- Per-tenant settings (tenant-owned content; over sites/<id>/plugins/carousel-manager.yml) ------------
|
||||
# `slides` is a `text` (verbatim, multi-line) field — one "imageUrl | caption | link" per line — NOT a
|
||||
# `list`, whose comma-splitting would break a caption containing a comma.
|
||||
siteSettings:
|
||||
- { key: slides, type: text, label: carousel.set.slides }
|
||||
- { key: intervalSeconds, type: int, default: 5, range: "0..60", label: carousel.set.interval }
|
||||
- { key: showCaptions, type: boolean, default: true, label: carousel.set.captions }
|
||||
- { key: showControls, type: boolean, default: true, label: carousel.set.controls }
|
||||
|
||||
# --- Tenant dashboard card (fragment resolves to __plugin__/carousel-manager/dashboard) ------------------
|
||||
dashboardCards:
|
||||
- { realm: tenant, order: 50, fragment: dashboard, permission: "carousel-manager|settings" }
|
||||
@@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!-- Inherit the SAME managed versions the kernel uses (Spring Boot 4.0.6) so every `provided` platform type
|
||||
is byte-identical at runtime. NOT a Boot app — no repackage; `mvn package` produces a THIN jar. -->
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>4.0.6</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<groupId>mx.quest</groupId>
|
||||
<artifactId>runway-plugin-carousel-manager</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Runway Carousel Manager Plugin</name>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU Affero General Public License v3.0, with the Runway additional permission for plugins</name>
|
||||
<url>https://www.gnu.org/licenses/agpl-3.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>See LICENSE and LICENSE-EXCEPTION.</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
<description>
|
||||
An image/slide carousel content widget for Runway: a site manager configures slides per site and drops
|
||||
the carousel onto any page with a data-widget anchor. Self-contained CSS + JS, no external libraries.
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<java.version>25</java.version>
|
||||
<maven.compiler.release>25</maven.compiler.release>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- Reproducible builds: pins every archive entry's timestamp so two builds of the same source
|
||||
produce byte-identical artifacts. Without it a jar embeds the build time, so a rebuild can
|
||||
never match what was published — which silently broke the "the tree holds what was shipped"
|
||||
invariant that releases are checked against. Bump at each release. -->
|
||||
<project.build.outputTimestamp>2026-10-21T18:56:00Z</project.build.outputTimestamp>
|
||||
<runway.version>1.0.0</runway.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>mx.quest</groupId>
|
||||
<artifactId>runway-spi</artifactId>
|
||||
<version>${runway.version}</version>
|
||||
</dependency>
|
||||
<!-- NO runway-app dependency, in any scope: the plugin links only the SPI, so a host
|
||||
import no longer compiles and the kernel's host-linkage scanner finds nothing to report. -->
|
||||
<dependency>
|
||||
<groupId>mx.quest</groupId>
|
||||
<artifactId>runway-spi-testkit</artifactId>
|
||||
<version>${runway.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>runway-plugin-carousel-manager</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assemble-plugin-folder</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>
|
||||
<property name="stage" value="${project.build.directory}/carousel-manager"/>
|
||||
<delete dir="${stage}"/>
|
||||
<mkdir dir="${stage}"/>
|
||||
<copy file="${project.basedir}/plugin.yml" todir="${stage}"/>
|
||||
<copy file="${project.basedir}/LICENSE" todir="${stage}"/>
|
||||
<copy file="${project.basedir}/LICENSE-EXCEPTION" todir="${stage}"/>
|
||||
<copy file="${project.build.directory}/runway-plugin-carousel-manager.jar" todir="${stage}"/>
|
||||
<copy todir="${stage}/static">
|
||||
<fileset dir="${project.basedir}/static"/>
|
||||
</copy>
|
||||
<copy todir="${stage}/templates">
|
||||
<fileset dir="${project.basedir}/templates"/>
|
||||
</copy>
|
||||
<copy todir="${stage}/i18n">
|
||||
<fileset dir="${project.basedir}/i18n"/>
|
||||
</copy>
|
||||
<!-- Ant's <zip> stamps each entry from the staged file's mtime, and the stage
|
||||
is re-copied every build — so without this the zip differs on every run
|
||||
even when the jar inside is byte-identical. Pin the stage to the same
|
||||
instant as project.build.outputTimestamp so the archive is reproducible. -->
|
||||
<!-- file="${stage}" is the STAGE ROOT itself: it becomes the archive's own
|
||||
"carousel-manager/" entry, and neither <fileset> nor <dirset> covers the
|
||||
base directory. Without it the archive differed by exactly two bytes —
|
||||
that entry's DOS time in the local header and again in the central
|
||||
directory. -->
|
||||
<touch datetime="${project.build.outputTimestamp}"
|
||||
pattern="yyyy-MM-dd'T'HH:mm:ss'Z'">
|
||||
<fileset dir="${stage}"/>
|
||||
<!-- DIRECTORIES TOO. A <fileset> matches files only, and the zip carries
|
||||
an entry per directory whose DOS timestamp comes from the directory's
|
||||
own mtime — so with files alone the archive still differed on every
|
||||
build. `unzip -lv` hides this: it rounds the displayed time to the
|
||||
minute, so the entry listings compare equal while the bytes do not. -->
|
||||
<dirset dir="${stage}"/>
|
||||
<!-- and the stage ROOT itself, which becomes the archive's own
|
||||
"carousel-manager/" entry. Neither of the collections above covers a
|
||||
base directory, and Ant refuses `file=` for a directory ("Use a
|
||||
resource collection to touch directories") — so name it from its
|
||||
PARENT. Without this the archive differed by exactly two bytes: that
|
||||
entry's DOS time in the local header and again in the central dir. -->
|
||||
<dirset dir="${project.build.directory}" includes="carousel-manager"/>
|
||||
</touch>
|
||||
<zip destfile="${project.build.directory}/runway-plugin-carousel-manager-${project.version}.zip">
|
||||
<!-- Zip the REAL staged directory rather than synthesising the folder
|
||||
with prefix=. Ant stamps a prefix-synthesised directory entry with
|
||||
the CURRENT time and ignores the touched directory's mtime, so the
|
||||
archive stayed irreproducible by exactly those two bytes however the
|
||||
stage was touched. Including the directory itself in the fileset
|
||||
makes Ant use its (pinned) mtime. -->
|
||||
<zipfileset dir="${project.build.directory}" includes="carousel-manager/**"/>
|
||||
</zip>
|
||||
<echo message="Staged install folder: ${stage}"/>
|
||||
<echo message="UI-uploadable archive: ${project.build.directory}/runway-plugin-carousel-manager-${project.version}.zip"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build this plugin, drop it into a throwaway Runway deployment, boot the PACKAGED host in ACTIVE mode, and
|
||||
# smoke-test it end to end: it loads with ZERO host-linkage and bean-name/surface findings (the SPI 1.0.0
|
||||
# contract), serves its static assets, and — signed in as the site owner — a slide set saved on its settings
|
||||
# page shows on the console card and renders on a page carrying a data-widget anchor (the anchor is planted in
|
||||
# the seeded About page before the ACTIVE boot). Verify ONLY against the packaged jar — never spring-boot:run
|
||||
# (its restart classloader loads ZERO plugins).
|
||||
#
|
||||
# Usage: scripts/verify-against-host.sh [--keep] [--port N]
|
||||
# JAVA_HOME=/path/to/jdk-25 required: the JDK that builds the plugin and runs the host
|
||||
# MVN=/path/to/mvn Maven (default: mvn on the PATH)
|
||||
# HOST_TARGET=/path/to/runway/runway-app/target the host build (default: the kernel this plugin sits in, else ../runway)
|
||||
# HOST_JAR=/path/to/runway-app-<ver>-exec.jar the kernel to verify against (default: the HOST_TARGET jar
|
||||
# MATCHING the host pom's version)
|
||||
# VERIFY_TMPDIR=/dir where the throwaway deployment goes (default: $TMPDIR or /tmp)
|
||||
# VERIFY_LOG_DIR=/dir keep copies of the host's wizard/ACTIVE logs there (evidence)
|
||||
# The script never runs `mvn install` (nothing is written to ~/.m2): it packages this plugin offline against
|
||||
# whatever runway-spi is already in the local repository.
|
||||
set -uo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)"
|
||||
# JAVA_HOME must name a JDK 25. MVN (default: `mvn` on the PATH) and HOST_TARGET (default: see above) can be set in the environment.
|
||||
if [ -z "${JAVA_HOME:-}" ] || [ ! -x "$JAVA_HOME/bin/java" ]; then echo "set JAVA_HOME to a JDK 25"; exit 2; fi
|
||||
export JAVA_HOME
|
||||
JAVA="$JAVA_HOME/bin/java"
|
||||
MVN="${MVN:-mvn}"
|
||||
# Default host: the kernel at the root of the repository this plugin sits in (plugins/<name>/), else a kernel
|
||||
# checkout named `runway` beside the plugins checkout.
|
||||
if [ -z "${HOST_TARGET:-}" ]; then
|
||||
if [ -f "$HERE/../../runway-app/pom.xml" ]; then HOST_TARGET="$HERE/../../runway-app/target"
|
||||
else HOST_TARGET="$HERE/../../runway/runway-app/target"; fi
|
||||
fi
|
||||
|
||||
KEEP="no"; PORT=""
|
||||
while [ $# -gt 0 ]; do case "$1" in
|
||||
--keep) KEEP="yes"; shift ;;
|
||||
--port) PORT="${2:?}"; shift 2 ;;
|
||||
*) echo "unknown arg: $1"; exit 2 ;;
|
||||
esac; done
|
||||
|
||||
APP_USER=root; APP_PW=Carousel-Admin-2026; SITE_USER=owner; SITE_PW=Carousel-Site-2026
|
||||
[ -n "$PORT" ] || PORT="$(python3 -c 'import socket;s=socket.socket();s.bind(("",0));print(s.getsockname()[1]);s.close()')"
|
||||
BASE="http://localhost:$PORT"
|
||||
|
||||
echo "[verify] building the plugin ..."
|
||||
( cd "$HERE" && "$MVN" -o -q -DskipTests package ) || { echo "plugin build failed"; exit 1; }
|
||||
|
||||
# The host jar MATCHING the host pom's version — never "the newest file": every reproducible jar carries the same
|
||||
# fixed timestamp, so `ls -t` cannot tell a leftover release jar from the SNAPSHOT under test.
|
||||
if [ -n "${HOST_JAR:-}" ]; then
|
||||
JAR="$HOST_JAR"
|
||||
else
|
||||
HOST_VERSION="$(sed -n 's:.*<version>\(.*\)</version>.*:\1:p' "$HOST_TARGET/../pom.xml" | head -1)"
|
||||
JAR="$HOST_TARGET/runway-app-$HOST_VERSION-exec.jar"
|
||||
fi
|
||||
[ -f "$JAR" ] || { echo "no host exec jar $JAR — build the host (mvn -pl runway-app package) or set HOST_JAR"; exit 1; }
|
||||
echo "[verify] host jar: $JAR"
|
||||
|
||||
SCRATCH="$(mktemp -d "${VERIFY_TMPDIR:-${TMPDIR:-/tmp}}/carousel-verify.XXXXXX")"
|
||||
cleanup() {
|
||||
[ -z "${VERIFY_LOG_DIR:-}" ] || { mkdir -p "$VERIFY_LOG_DIR" && cp "$SCRATCH"/*.log "$VERIFY_LOG_DIR"/ 2>/dev/null; }
|
||||
# Wait for the host to exit before deleting: a JVM still shutting down rewrites files under external/ and
|
||||
# makes `rm -rf` leave the scratch folder behind.
|
||||
[ "$KEEP" = "yes" ] || { kill "${PID:-0}" 2>/dev/null; wait "${PID:-0}" 2>/dev/null; rm -rf "$SCRATCH"; }
|
||||
}
|
||||
trap cleanup EXIT
|
||||
mkdir -p "$SCRATCH/external/plugins"
|
||||
cp -r "$HERE/target/carousel-manager" "$SCRATCH/external/plugins/carousel-manager"
|
||||
|
||||
wait_for() { for _ in $(seq 1 "$3"); do grep -q "$2" "$1" 2>/dev/null && return 0; sleep 1; done; return 1; }
|
||||
PASS=0; FAIL=0
|
||||
ck() { if eval "$2" >/dev/null 2>&1; then echo " PASS $1"; PASS=$((PASS+1)); else echo " FAIL $1"; FAIL=$((FAIL+1)); fi; }
|
||||
boot() { ( cd "$SCRATCH" && exec "$JAVA" -jar "$JAR" --server.port="$PORT" --runway.storage.external="$SCRATCH/external" ) >"$1" 2>&1 & PID=$!; }
|
||||
|
||||
echo "[verify] booting host (wizard) on :$PORT ..."
|
||||
boot "$SCRATCH/wizard.log"
|
||||
wait_for "$SCRATCH/wizard.log" "Started RunwayApplication" 90 || { echo "wizard did not start"; tail -20 "$SCRATCH/wizard.log"; exit 1; }
|
||||
curl -s -o /dev/null -X POST "$BASE/setup" --data-urlencode "username=$APP_USER" --data-urlencode "password=$APP_PW" \
|
||||
--data-urlencode "displayName=Root" --data-urlencode "siteAdminUsername=$SITE_USER" --data-urlencode "siteAdminPassword=$SITE_PW"
|
||||
for _ in $(seq 1 30); do kill -0 "$PID" 2>/dev/null || break; sleep 1; done
|
||||
|
||||
# A page carrying the widget anchor: the seeded About page, edited on disk before the ACTIVE boot reads it.
|
||||
ABOUT="$SCRATCH/external/sites/default/templates/about.html"
|
||||
[ -f "$ABOUT" ] || { echo "the wizard did not seed $ABOUT"; exit 1; }
|
||||
sed -i 's|<main id="content">|<main id="content"><div id="hero" data-widget="carousel/hero"></div>|' "$ABOUT"
|
||||
|
||||
echo "[verify] booting host (ACTIVE) ..."
|
||||
boot "$SCRATCH/active.log"
|
||||
wait_for "$SCRATCH/active.log" "Started RunwayApplication" 90 || { echo "ACTIVE did not start"; tail -20 "$SCRATCH/active.log"; exit 1; }
|
||||
|
||||
LOG="$SCRATCH/active.log"
|
||||
echo "== plugin load (SPI 1.0.0 contract) =="
|
||||
ck "plugin registered, 0 blocked" "grep -qE 'plugins: 1 registered, 0 blocked' '$LOG'"
|
||||
ck "not blocked / quarantined" "! grep -qE \"plugin 'carousel-manager' is blocked|plugin-quarantine\" '$LOG'"
|
||||
# Host linkage and the surface rules: the kernel BLOCKS such a plugin and logs "linkage scan: <reason>" / the surface
|
||||
# reason; the patterns also match the warning wording ("uses host internals", "… allowed until Runway 1.0"), so
|
||||
# either form fails the check.
|
||||
ck "ZERO host-linkage findings" "! grep -qE \"uses host internals|plugin 'carousel-manager' linkage scan\" '$LOG'"
|
||||
ck "ZERO bean-name/surface findings" "! grep -qE \"plugin 'carousel-manager'.*(allowed until Runway 1.0|bean name|may not contribute)\" '$LOG'"
|
||||
ck "no WARN/ERROR names the plugin" "! grep -E ' (WARN|ERROR) ' '$LOG' | grep -q 'carousel'"
|
||||
ck "no key collision / degraded" "! grep -qiE 'collision|duplicate key|degraded' '$LOG'"
|
||||
|
||||
echo "== static assets =="
|
||||
ck "carousel.css served" "curl -s -o /dev/null -w '%{http_code}' '$BASE/__plugin/carousel-manager/static/carousel.css' | grep -q 200"
|
||||
ck "carousel.js served" "curl -s -o /dev/null -w '%{http_code}' '$BASE/__plugin/carousel-manager/static/carousel.js' | grep -q 200"
|
||||
ck "help page served" "curl -s -o /dev/null -w '%{http_code}' '$BASE/__plugin/carousel-manager/static/carousel-help.html' | grep -q 200"
|
||||
|
||||
echo "== settings → console card → widget (PluginSettings in the real host) =="
|
||||
JAR_C="$SCRATCH/cookies.txt"
|
||||
SETTINGS="$BASE/__admin/plugins/carousel-manager/settings"
|
||||
c() { curl -s -H 'Accept-Language: en' -c "$JAR_C" -b "$JAR_C" "$@"; }
|
||||
token() { grep -o 'name="_csrf" value="[^"]*"' | head -1 | sed 's/.*value="//; s/"$//'; }
|
||||
ck "unconfigured: the anchor renders nothing" "! curl -s '$BASE/about' | grep -q 'rw-carousel'"
|
||||
LOGIN_TOKEN="$(c "$BASE/login" | token)"
|
||||
c -o /dev/null -X POST "$BASE/login" --data-urlencode "username=$SITE_USER" --data-urlencode "password=$SITE_PW" \
|
||||
--data-urlencode "_csrf=$LOGIN_TOKEN"
|
||||
c "$SETTINGS" > "$SCRATCH/settings-1.html"
|
||||
ck "settings page renders the status card (0 slides)" "grep -q 'id=\"ca-slides\">0<' '$SCRATCH/settings-1.html'"
|
||||
c -o /dev/null -X POST "$SETTINGS" \
|
||||
--data-urlencode $'slides=/img/one.jpg | Fast, fresh | /menu\n/img/two.jpg | Second' \
|
||||
--data-urlencode "intervalSeconds=7" --data-urlencode "showCaptions=true" --data-urlencode "showControls=true" \
|
||||
--data-urlencode "_csrf=$(token < "$SCRATCH/settings-1.html")"
|
||||
c "$SETTINGS" > "$SCRATCH/settings-2.html"
|
||||
ck "after save: the status card counts 2 slides" "grep -q 'id=\"ca-slides\">2<' '$SCRATCH/settings-2.html'"
|
||||
c "$BASE/__admin" > "$SCRATCH/dashboard.html"
|
||||
ck "the dashboard card counts 2 slides" "grep -q 'id=\"cc-slides\">2<' '$SCRATCH/dashboard.html'"
|
||||
curl -s "$BASE/about" > "$SCRATCH/about.html"
|
||||
ck "the widget renders both slides" "grep -q 'src=\"/img/one.jpg\"' '$SCRATCH/about.html' && grep -q 'src=\"/img/two.jpg\"' '$SCRATCH/about.html'"
|
||||
ck "…with the comma caption intact" "grep -q '>Fast, fresh</figcaption>' '$SCRATCH/about.html'"
|
||||
ck "…and the saved interval" "grep -q 'data-interval=\"7\"' '$SCRATCH/about.html'"
|
||||
|
||||
echo; echo "RESULT: $PASS passed, $FAIL failed"
|
||||
if [ "$KEEP" = "yes" ]; then echo "[verify] kept at $BASE (scratch $SCRATCH; kill $PID to stop)"; wait "$PID"; fi
|
||||
exit "$FAIL"
|
||||
@@ -0,0 +1,21 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
import mx.quest.runway.spi.service.PluginSettings;
|
||||
|
||||
/**
|
||||
* Read-only status model for the console surfaces (dashboard card + admin fragment), read by template bean name,
|
||||
* e.g. {@code ${@carouselManagerAdminModel.slideCount(tenantSiteId)}}.
|
||||
*/
|
||||
public class CarouselAdminModel {
|
||||
|
||||
private final PluginSettings settings;
|
||||
|
||||
public CarouselAdminModel(PluginSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
/** How many valid slides the site has configured (the same count the widget would render). */
|
||||
public int slideCount(String siteId) {
|
||||
return CarouselWidget.slides(settings.site(siteId)).size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
import mx.quest.runway.spi.ContentWidget;
|
||||
import mx.quest.runway.spi.service.PluginSettings;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* The plugin's {@code mainClass} — the single {@code @Configuration} registered into the host context before
|
||||
* refresh. Beans are wired EXPLICITLY (no {@code @ComponentScan}). The package {@code mx.quest.carousel} lives
|
||||
* OUTSIDE {@code mx.quest.runway} so the host never double-scans it, and the plugin links nothing but the SPI.
|
||||
*
|
||||
* <p><b>Bean names start with the plugin id in lowerCamelCase</b> ({@code carouselManager…}): plugins share the
|
||||
* host's bean namespace, and the host refuses any other name. The templates read
|
||||
* the admin model by that name ({@code ${@carouselManagerAdminModel…}}).
|
||||
*
|
||||
* <p>{@link PluginSettings} is injected as a {@code @Bean} method parameter of this class, which comes from the
|
||||
* plugin's own jar — that is what binds the instance to {@code carousel-manager}'s settings; no id is passed.
|
||||
* The {@link CarouselWidget} is a list-collected {@code ContentWidget} SPI — a plain {@code @Bean}, NEVER
|
||||
* {@code @Primary}.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class CarouselConfig {
|
||||
|
||||
@Bean
|
||||
public ContentWidget carouselManagerWidget(PluginSettings settings) {
|
||||
return new CarouselWidget(settings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CarouselAdminModel carouselManagerAdminModel(PluginSettings settings) {
|
||||
return new CarouselAdminModel(settings);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mx.quest.runway.spi.ContentWidget;
|
||||
import mx.quest.runway.spi.model.Capabilities;
|
||||
import mx.quest.runway.spi.model.RenderFragment;
|
||||
import mx.quest.runway.spi.model.SettingsView;
|
||||
import mx.quest.runway.spi.model.WidgetView;
|
||||
import mx.quest.runway.spi.service.PluginSettings;
|
||||
|
||||
/**
|
||||
* The {@code carousel} content widget: a site manager drops
|
||||
* {@code <div id="hero" data-widget="carousel/hero"></div>} on a page and the host asks this widget to render an
|
||||
* image carousel from the site's per-tenant configuration. It emits self-contained markup that references the
|
||||
* plugin's own stylesheet and script ({@code /__plugin/carousel-manager/static/carousel.{css,js}}) — the script
|
||||
* is idempotent, so multiple carousels on a page are fine.
|
||||
*
|
||||
* <p><b>One slide set per site:</b> this plugin declares no {@code widgetSettings:} schema, so the host's
|
||||
* per-placement config ({@code WidgetView.config()}, edited at {@code /__admin/widgets}) stays empty for it and
|
||||
* every {@code carousel/*} anchor on a site renders the SAME configured slide set. Distinct carousels per
|
||||
* placement need this plugin to declare such a schema and read {@code config()}; the {@code instanceId} is
|
||||
* already carried through for that. With no slides configured the widget renders nothing
|
||||
* ({@link RenderFragment#empty()}).
|
||||
*
|
||||
* <p><b>Settings</b> come from {@link PluginSettings#site(String)}: the descriptor's {@code siteSettings:}
|
||||
* defaults overlaid by what the site saved. The code fallbacks below equal the descriptor defaults
|
||||
* ({@code intervalSeconds: 5}, {@code showCaptions: true}, {@code showControls: true}), so the widget renders the
|
||||
* same whether or not the host applied them; {@code intervalSeconds} is clamped to the declared {@code 0..60}.
|
||||
*/
|
||||
public class CarouselWidget implements ContentWidget {
|
||||
|
||||
private static final String STATIC = "/__plugin/carousel-manager/static";
|
||||
|
||||
private final PluginSettings settings;
|
||||
|
||||
public CarouselWidget(PluginSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String key() {
|
||||
return "carousel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderFragment render(WidgetView view) {
|
||||
SettingsView cfg = settings.site(view.site().id());
|
||||
List<Slide> slides = slides(cfg);
|
||||
if (slides.isEmpty()) {
|
||||
return RenderFragment.empty();
|
||||
}
|
||||
long interval = cfg.integer("intervalSeconds", 5, 0, 60);
|
||||
boolean captions = cfg.bool("showCaptions", true);
|
||||
boolean controls = cfg.bool("showControls", true);
|
||||
|
||||
StringBuilder b = new StringBuilder(512);
|
||||
b.append("<link rel=\"stylesheet\" href=\"").append(STATIC).append("/carousel.css\">")
|
||||
.append("<div class=\"rw-carousel\" data-interval=\"").append(interval)
|
||||
.append("\" data-controls=\"").append(controls).append("\"><div class=\"rw-carousel-track\">");
|
||||
for (int i = 0; i < slides.size(); i++) {
|
||||
Slide s = slides.get(i);
|
||||
b.append("<figure class=\"rw-carousel-slide").append(i == 0 ? " is-active" : "").append("\">");
|
||||
boolean linked = !s.link().isBlank();
|
||||
if (linked) {
|
||||
b.append("<a class=\"rw-carousel-link\" href=\"").append(Html.escape(s.link())).append("\">");
|
||||
}
|
||||
b.append("<img class=\"rw-carousel-img\" src=\"").append(Html.escape(s.imageUrl()))
|
||||
.append("\" alt=\"").append(Html.escape(s.caption())).append("\" loading=\"lazy\">");
|
||||
if (linked) {
|
||||
b.append("</a>");
|
||||
}
|
||||
if (captions && !s.caption().isBlank()) {
|
||||
b.append("<figcaption class=\"rw-carousel-caption\">").append(Html.escape(s.caption()))
|
||||
.append("</figcaption>");
|
||||
}
|
||||
b.append("</figure>");
|
||||
}
|
||||
b.append("</div>");
|
||||
if (controls && slides.size() > 1) {
|
||||
b.append("<button type=\"button\" class=\"rw-carousel-prev\" aria-label=\"Previous\">‹</button>")
|
||||
.append("<button type=\"button\" class=\"rw-carousel-next\" aria-label=\"Next\">›</button>");
|
||||
}
|
||||
b.append("</div><script src=\"").append(STATIC).append("/carousel.js\" defer></script>");
|
||||
return RenderFragment.of(b.toString());
|
||||
}
|
||||
|
||||
/** Parses the per-tenant {@code slides} text (one {@code imageUrl | caption | link} per line). */
|
||||
static List<Slide> slides(SettingsView cfg) {
|
||||
List<Slide> out = new ArrayList<>();
|
||||
for (String line : cfg.string("slides", "").split("\\R")) {
|
||||
Slide slide = Slide.parse(line);
|
||||
if (slide != null) {
|
||||
out.add(slide);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Capabilities capabilities() {
|
||||
return Capabilities.of("widget.carousel");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
/**
|
||||
* Minimal HTML escaping for the values the carousel widget interpolates (image URLs, captions, links from the
|
||||
* per-tenant config). The plugin owns escaping of its own output so a hand-entered caption or URL can never
|
||||
* inject markup into a rendered page.
|
||||
*/
|
||||
final class Html {
|
||||
|
||||
private Html() {
|
||||
}
|
||||
|
||||
static String escape(String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return value.replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
.replace("\"", """).replace("'", "'");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
/**
|
||||
* One carousel slide, parsed from a per-tenant {@code slides} list entry of the form
|
||||
* {@code imageUrl | caption | linkUrl} (caption and link optional). Immutable; all fields already trimmed and
|
||||
* HTML-escaped at render time by the widget.
|
||||
*
|
||||
* @param imageUrl the slide image URL (required — a slide with no image is dropped)
|
||||
* @param caption the optional caption text ({@code ""} if none)
|
||||
* @param link the optional link the slide navigates to when clicked ({@code ""} if none)
|
||||
*/
|
||||
record Slide(String imageUrl, String caption, String link) {
|
||||
|
||||
/** Parses one {@code imageUrl | caption | linkUrl} entry; returns {@code null} if it has no usable image. */
|
||||
static Slide parse(String entry) {
|
||||
if (entry == null || entry.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
String[] parts = entry.split("\\|", 3);
|
||||
String image = parts[0].strip();
|
||||
if (image.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
String caption = parts.length > 1 ? parts[1].strip() : "";
|
||||
String link = parts.length > 2 ? parts[2].strip() : "";
|
||||
return new Slide(image, caption, link);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.Map;
|
||||
import mx.quest.runway.spi.testkit.FakePluginSettings;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** The console status model counts the slides the widget would render, per site. */
|
||||
class CarouselAdminModelTest {
|
||||
|
||||
@Test
|
||||
void countsOnlyRenderableSlidesPerSite() {
|
||||
FakePluginSettings settings = new FakePluginSettings()
|
||||
.site("acme", Map.of("slides", "/img/a.jpg | A\n\n | no image | /x\n/img/b.jpg"))
|
||||
.site("other", Map.of("slides", "/img/c.jpg"));
|
||||
CarouselAdminModel model = new CarouselAdminModel(settings);
|
||||
assertEquals(2, model.slideCount("acme"), "blank lines and image-less lines are not slides");
|
||||
assertEquals(1, model.slideCount("other"));
|
||||
assertEquals(0, model.slideCount("unconfigured"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import mx.quest.runway.spi.ContentWidget;
|
||||
import mx.quest.runway.spi.service.PluginSettings;
|
||||
import mx.quest.runway.spi.testkit.FakePluginSettings;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* The plugin's contract with the host, checked at build time: the wiring, the bean-name rule, the bean names the
|
||||
* templates reference, the descriptor floor, and that the compiled classes link nothing of the host but the SPI —
|
||||
* the same things the kernel's load-time checks refuse.
|
||||
*/
|
||||
class CarouselConfigTest {
|
||||
|
||||
private static final String PREFIX = "carouselManager";
|
||||
|
||||
private static Set<String> beanMethodNames() {
|
||||
return Arrays.stream(CarouselConfig.class.getDeclaredMethods())
|
||||
.filter(m -> m.isAnnotationPresent(Bean.class))
|
||||
.map(Method::getName)
|
||||
.collect(Collectors.toCollection(TreeSet::new));
|
||||
}
|
||||
|
||||
@Test
|
||||
void wiresTheWidgetAndTheAdminModelUnderPrefixedNames() {
|
||||
try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext()) {
|
||||
ctx.registerBean(PluginSettings.class,
|
||||
() -> new FakePluginSettings().site("acme", Map.of("slides", "/img/a.jpg\n/img/b.jpg")));
|
||||
ctx.register(CarouselConfig.class);
|
||||
ctx.refresh();
|
||||
assertInstanceOf(CarouselWidget.class, ctx.getBean("carouselManagerWidget", ContentWidget.class));
|
||||
assertEquals(2, ctx.getBean("carouselManagerAdminModel", CarouselAdminModel.class).slideCount("acme"),
|
||||
"the admin model reads the injected settings");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void everyBeanNameStartsWithThePluginIdInLowerCamelCase() {
|
||||
Set<String> names = beanMethodNames();
|
||||
assertEquals(Set.of("carouselManagerWidget", "carouselManagerAdminModel"), names);
|
||||
for (Method m : CarouselConfig.class.getDeclaredMethods()) {
|
||||
Bean bean = m.getAnnotation(Bean.class);
|
||||
if (bean != null) {
|
||||
for (String alias : bean.name()) {
|
||||
assertTrue(alias.startsWith(PREFIX), "an explicit bean name must start with " + PREFIX + ": " + alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void everyBeanTheTemplatesReferenceIsOneOfOurs() throws IOException {
|
||||
Set<String> referenced = new TreeSet<>();
|
||||
try (Stream<Path> files = Files.list(Path.of("templates"))) {
|
||||
for (Path file : files.filter(p -> p.toString().endsWith(".th.xml")).toList()) {
|
||||
String text = Files.readString(file, StandardCharsets.UTF_8);
|
||||
Matcher m = Pattern.compile("\\$\\{\\s*@(\\w+)").matcher(text);
|
||||
while (m.find()) {
|
||||
referenced.add(m.group(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
assertFalse(referenced.isEmpty(), "the console templates read the admin model");
|
||||
assertTrue(beanMethodNames().containsAll(referenced), "templates reference unknown beans: " + referenced);
|
||||
}
|
||||
|
||||
@Test
|
||||
void theDescriptorDeclaresTheSpiFloorAndTheReleaseVersion() throws IOException {
|
||||
String yml = Files.readString(Path.of("plugin.yml"), StandardCharsets.UTF_8);
|
||||
assertTrue(yml.contains("\nrequiresSpi: \">=1.0.0\"\n"), "built for the frozen SPI 1.0.0 contract");
|
||||
String pom = Files.readString(Path.of("pom.xml"), StandardCharsets.UTF_8);
|
||||
Matcher version = Pattern.compile("<artifactId>runway-plugin-carousel-manager</artifactId>\\s*<version>([^<]+)")
|
||||
.matcher(pom);
|
||||
assertTrue(version.find());
|
||||
assertTrue(yml.contains("\nversion: " + version.group(1) + "\n"), "plugin.yml and pom.xml agree on the version");
|
||||
assertFalse(pom.contains("<artifactId>runway-app</artifactId>"), "no runway-app dependency in any scope");
|
||||
}
|
||||
|
||||
@Test
|
||||
void theCompiledClassesLinkNoHostInternals() throws IOException {
|
||||
Path classes = Path.of("target", "classes");
|
||||
Pattern host = Pattern.compile("mx[/.]quest[/.]runway[/.](?!spi[/.])[\\w/.$]*");
|
||||
List<String> problems = new ArrayList<>();
|
||||
int scanned = 0;
|
||||
try (Stream<Path> files = Files.walk(classes)) {
|
||||
for (Path file : files.filter(p -> p.toString().endsWith(".class")).toList()) {
|
||||
scanned++;
|
||||
String rel = classes.relativize(file).toString().replace('\\', '/');
|
||||
if (rel.startsWith("mx/quest/runway/")) {
|
||||
problems.add(rel + " lives under mx.quest.runway");
|
||||
}
|
||||
// The constant pool holds class names and descriptors as (modified) UTF-8; Latin-1 keeps every
|
||||
// byte as one char, so an ASCII pattern finds them without parsing the class file.
|
||||
Matcher m = host.matcher(new String(Files.readAllBytes(file), StandardCharsets.ISO_8859_1));
|
||||
while (m.find()) {
|
||||
problems.add(rel + " → " + m.group());
|
||||
}
|
||||
}
|
||||
}
|
||||
assertTrue(scanned >= 4, "the compiled classes were found (" + scanned + ")");
|
||||
assertTrue(problems.isEmpty(), "host linkage: " + problems);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
package mx.quest.carousel;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import mx.quest.runway.spi.model.PageMeta;
|
||||
import mx.quest.runway.spi.model.RenderFragment;
|
||||
import mx.quest.runway.spi.model.SiteView;
|
||||
import mx.quest.runway.spi.model.WidgetView;
|
||||
import mx.quest.runway.spi.testkit.FakePluginSettings;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* The carousel widget: slide parsing, rendering, escaping, setting gating, defaults and clamping, and the
|
||||
* empty-when-unconfigured case — against the SPI testkit's {@link FakePluginSettings}, configured with the
|
||||
* descriptor's real {@code siteSettings:} defaults (read from {@code plugin.yml}) the way the kernel applies them.
|
||||
*/
|
||||
class CarouselWidgetTest {
|
||||
|
||||
private FakePluginSettings settings;
|
||||
private CarouselWidget widget;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws IOException {
|
||||
settings = new FakePluginSettings().defaults(descriptorDefaults());
|
||||
widget = new CarouselWidget(settings);
|
||||
}
|
||||
|
||||
/** The {@code default:} of every {@code siteSettings:} entry in {@code plugin.yml}, typed as the kernel types them. */
|
||||
static Map<String, Object> descriptorDefaults() throws IOException {
|
||||
String yml = Files.readString(Path.of("plugin.yml"), StandardCharsets.UTF_8);
|
||||
Matcher m = Pattern.compile("\\{\\s*key:\\s*(\\w+)\\s*,\\s*type:\\s*(\\w+)[^}]*?default:\\s*([^,}]+?)\\s*[,}]")
|
||||
.matcher(yml);
|
||||
Map<String, Object> out = new LinkedHashMap<>();
|
||||
while (m.find()) {
|
||||
String raw = m.group(3);
|
||||
Object value = switch (m.group(2)) {
|
||||
case "boolean" -> Boolean.valueOf(raw);
|
||||
case "int" -> Long.valueOf(raw);
|
||||
default -> raw;
|
||||
};
|
||||
out.put(m.group(1), value);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private String html(String siteId) {
|
||||
SiteView site = new SiteView(siteId, "Acme", Locale.ENGLISH, List.of(Locale.ENGLISH), null);
|
||||
PageMeta page = new PageMeta("home", "Home", "", List.of(Locale.ENGLISH), Locale.ENGLISH, true, false);
|
||||
RenderFragment fragment = widget.render(new WidgetView(site, page, Locale.ENGLISH, "hero", false, Map.of()));
|
||||
return fragment.isEmpty() ? "" : fragment.html();
|
||||
}
|
||||
|
||||
private String render(Map<String, ?> stored) {
|
||||
settings.site("acme", stored);
|
||||
return html("acme");
|
||||
}
|
||||
|
||||
private static String attr(String html, String name) {
|
||||
Matcher m = Pattern.compile(name + "=\"([^\"]*)\"").matcher(html);
|
||||
return m.find() ? m.group(1) : null;
|
||||
}
|
||||
|
||||
@Test
|
||||
void keyIsCarousel() {
|
||||
assertEquals("carousel", widget.key());
|
||||
}
|
||||
|
||||
@Test
|
||||
void rendersConfiguredSlidesWithCaptionsAndLinks() {
|
||||
String html = render(Map.of("slides", "/img/a.jpg | Welcome | /about\n/img/b.jpg | Our work | /work"));
|
||||
assertTrue(html.contains("src=\"/img/a.jpg\""), "first slide image");
|
||||
assertTrue(html.contains("src=\"/img/b.jpg\""), "second slide image");
|
||||
assertTrue(html.contains(">Welcome</figcaption>"), "caption rendered");
|
||||
assertTrue(html.contains("href=\"/about\""), "link rendered");
|
||||
assertTrue(html.contains("/__plugin/carousel-manager/static/carousel.css"), "references the plugin CSS");
|
||||
assertTrue(html.contains("/__plugin/carousel-manager/static/carousel.js"), "references the plugin JS");
|
||||
assertEquals(1, html.split("is-active", -1).length - 1, "exactly the first slide is active");
|
||||
assertTrue(html.indexOf("is-active") < html.indexOf("/img/a.jpg"), "…and it is the first one");
|
||||
}
|
||||
|
||||
@Test
|
||||
void anImageOnlySlideNeedsNoCaptionOrLink() {
|
||||
String html = render(Map.of("slides", "/img/solo.jpg"));
|
||||
assertTrue(html.contains("src=\"/img/solo.jpg\""));
|
||||
assertFalse(html.contains("<a class=\"rw-carousel-link\""), "no link element when none configured");
|
||||
assertFalse(html.contains("rw-carousel-caption"), "no caption element when none configured");
|
||||
}
|
||||
|
||||
@Test
|
||||
void noSlidesRendersEmpty() {
|
||||
assertTrue(render(Map.of()).isEmpty(), "an unconfigured carousel renders nothing");
|
||||
assertTrue(render(Map.of("slides", " \n ")).isEmpty(), "blank slide lines render nothing");
|
||||
assertTrue(render(Map.of("slides", " | caption only | /x")).isEmpty(), "a line with no image is dropped");
|
||||
}
|
||||
|
||||
@Test
|
||||
void aCaptionWithACommaSurvivesAndWindowsLineEndingsSplit() {
|
||||
String html = render(Map.of("slides", "/img/a.jpg | Fast, fresh, local | /x\r\n/img/b.jpg"));
|
||||
assertTrue(html.contains(">Fast, fresh, local</figcaption>"), "the text setting is never comma-split");
|
||||
assertTrue(html.contains("src=\"/img/b.jpg\""), "a CRLF line ending separates slides");
|
||||
}
|
||||
|
||||
@Test
|
||||
void captionsAndControlsHonorTheirFlags() {
|
||||
String noCaptions = render(Map.of("slides", "/img/a.jpg | Hi | /x\n/img/b.jpg | Yo | /y",
|
||||
"showCaptions", false));
|
||||
assertFalse(noCaptions.contains("rw-carousel-caption"), "captions off ⇒ no caption element");
|
||||
assertTrue(noCaptions.contains("alt=\"Hi\""), "…the caption still serves as the image's alt text");
|
||||
String noControls = render(Map.of("slides", "/img/a.jpg\n/img/b.jpg", "showControls", false));
|
||||
assertFalse(noControls.contains("rw-carousel-next"), "controls off ⇒ no next button");
|
||||
assertEquals("false", attr(noControls, "data-controls"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void flagsStoredAsTextAreReadToo() {
|
||||
String html = render(Map.of("slides", "/img/a.jpg | Hi\n/img/b.jpg", "showCaptions", "off",
|
||||
"showControls", "no"));
|
||||
assertFalse(html.contains("rw-carousel-caption"), "\"off\" turns captions off");
|
||||
assertFalse(html.contains("rw-carousel-next"), "\"no\" turns controls off");
|
||||
}
|
||||
|
||||
@Test
|
||||
void theDefaultsShowCaptionsAndControlsAndAdvanceEveryFiveSeconds() {
|
||||
String html = render(Map.of("slides", "/img/a.jpg | Hi | /x\n/img/b.jpg"));
|
||||
assertEquals("5", attr(html, "data-interval"));
|
||||
assertEquals("true", attr(html, "data-controls"));
|
||||
assertTrue(html.contains("rw-carousel-prev") && html.contains("rw-carousel-next"), "two slides ⇒ controls");
|
||||
assertTrue(html.contains("rw-carousel-caption"), "captions on by default");
|
||||
}
|
||||
|
||||
@Test
|
||||
void controlsNeedMoreThanOneSlide() {
|
||||
String html = render(Map.of("slides", "/img/a.jpg"));
|
||||
assertFalse(html.contains("rw-carousel-prev"), "a single slide has nothing to step through");
|
||||
}
|
||||
|
||||
@Test
|
||||
void theIntervalIsReadAndClampedToTheDeclaredRange() {
|
||||
assertEquals("12", attr(render(Map.of("slides", "/img/a.jpg", "intervalSeconds", 12L)), "data-interval"));
|
||||
assertEquals("12", attr(render(Map.of("slides", "/img/a.jpg", "intervalSeconds", "12")), "data-interval"));
|
||||
assertEquals("0", attr(render(Map.of("slides", "/img/a.jpg", "intervalSeconds", 0L)), "data-interval"),
|
||||
"0 = auto-advance off");
|
||||
assertEquals("60", attr(render(Map.of("slides", "/img/a.jpg", "intervalSeconds", 600L)), "data-interval"));
|
||||
assertEquals("0", attr(render(Map.of("slides", "/img/a.jpg", "intervalSeconds", -3L)), "data-interval"));
|
||||
assertEquals("5", attr(render(Map.of("slides", "/img/a.jpg", "intervalSeconds", "soon")), "data-interval"),
|
||||
"an unparsable hand-edited value falls back to the default");
|
||||
}
|
||||
|
||||
@Test
|
||||
void codeFallbacksEqualTheDescriptorDefaults() throws IOException {
|
||||
Map<String, Object> declared = descriptorDefaults();
|
||||
assertEquals(Map.of("intervalSeconds", 5L, "showCaptions", true, "showControls", true), declared,
|
||||
"plugin.yml declares the defaults this test (and the docs) assume");
|
||||
String slides = "/img/a.jpg | Hi | /x\n/img/b.jpg | Yo";
|
||||
String withDefaults = render(Map.of("slides", slides));
|
||||
widget = new CarouselWidget(new FakePluginSettings().site("acme", Map.of("slides", slides)));
|
||||
assertEquals(withDefaults, html("acme"), "the widget renders the same with or without the host's defaults");
|
||||
}
|
||||
|
||||
@Test
|
||||
void eachSiteRendersItsOwnSlides() {
|
||||
settings.site("acme", Map.of("slides", "/img/acme.jpg"));
|
||||
settings.site("other", Map.of("slides", "/img/other.jpg"));
|
||||
assertTrue(html("acme").contains("/img/acme.jpg") && !html("acme").contains("/img/other.jpg"));
|
||||
assertTrue(html("other").contains("/img/other.jpg") && !html("other").contains("/img/acme.jpg"));
|
||||
assertTrue(html("nobody").isEmpty(), "a site with nothing saved renders nothing");
|
||||
}
|
||||
|
||||
@Test
|
||||
void aCraftedCaptionOrUrlIsEscaped() {
|
||||
String html = render(Map.of("slides", "/img/a.jpg\" onerror=\"x | <script>x</script> | javascript:\"x"));
|
||||
assertFalse(html.contains("<script>x</script>"), "the caption is HTML-escaped, never injected");
|
||||
assertTrue(html.contains("<script>"), "…it appears escaped");
|
||||
assertFalse(html.contains("\" onerror=\""), "an image URL cannot break out of its attribute");
|
||||
assertTrue(html.contains("src=\"/img/a.jpg" onerror="x\""));
|
||||
assertTrue(html.contains("href=\"javascript:"x\""), "the link's quote is escaped too");
|
||||
}
|
||||
|
||||
@Test
|
||||
void anUnsafeSiteIdIsRefusedNotRead() {
|
||||
SiteView site = new SiteView("../etc", "x", Locale.ENGLISH, List.of(Locale.ENGLISH), null);
|
||||
PageMeta page = new PageMeta("home", "Home", "", List.of(Locale.ENGLISH), Locale.ENGLISH, true, false);
|
||||
assertThrows(IllegalArgumentException.class,
|
||||
() -> widget.render(new WidgetView(site, page, Locale.ENGLISH, "hero", false, Map.of())),
|
||||
"the settings service refuses it; the host's containment turns that into an empty widget");
|
||||
}
|
||||
|
||||
@Test
|
||||
void declaresItsCapability() {
|
||||
assertTrue(widget.capabilities().toString().contains("widget.carousel"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Carousel plugin — help & reference</title>
|
||||
<style>
|
||||
body { max-width: 46rem; margin: 2rem auto; padding: 0 1rem;
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1a1a1a; line-height: 1.5; }
|
||||
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; margin-top: 1.75rem; }
|
||||
code { background: #f3f3f3; padding: .1rem .3rem; border-radius: .25rem; }
|
||||
pre { background: #f6f8fa; padding: .75rem 1rem; border-radius: .375rem; overflow: auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Carousel — help & reference</h1>
|
||||
<p>The Carousel Manager plugin adds a configurable image/slide carousel you can place on any page.</p>
|
||||
|
||||
<h2>1. Configure the slides</h2>
|
||||
<p>On the carousel settings page, fill <strong>Slides</strong> — one slide per line, fields separated by a pipe
|
||||
(<code>|</code>):</p>
|
||||
<pre>/static/img/hero1.jpg | Welcome to Acme | /about
|
||||
/static/img/hero2.jpg | Our latest work | /work
|
||||
/static/img/hero3.jpg</pre>
|
||||
<p>Only the image URL is required; the caption and the click-through link are optional. Other settings: the
|
||||
auto-advance interval (seconds; <code>0</code> disables auto-play), whether to show captions, and whether to
|
||||
show the previous/next controls.</p>
|
||||
|
||||
<h2>2. Place the carousel on a page</h2>
|
||||
<p>Add an anchor where the carousel should appear (the <code>id</code> and <code>data-widget</code> must be on the
|
||||
<em>same</em> element):</p>
|
||||
<pre><div id="hero" data-widget="carousel/hero"></div></pre>
|
||||
<p>The widget renders your configured slides there, pulling in its own stylesheet and script automatically. With
|
||||
no slides configured it renders nothing.</p>
|
||||
|
||||
<h2>Note: one carousel per site (for now)</h2>
|
||||
<p>This plugin does not yet declare a per-placement widget configuration (Runway supports one), so every
|
||||
<code>carousel/*</code> anchor on a site shows the <strong>same</strong> configured slides. Distinct carousels per
|
||||
page need that declaration in a later version — the widget already carries the instance id for it.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
/* Runway Carousel Manager — styles. Served at /__plugin/carousel-manager/static/carousel.css.
|
||||
Neutral defaults so it inherits the site's look; override any .rw-carousel* rule from your own CSS. */
|
||||
|
||||
.rw-carousel {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
max-width: 100%;
|
||||
border-radius: .5rem;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.rw-carousel-track {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rw-carousel-slide {
|
||||
margin: 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.rw-carousel-slide.is-active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.rw-carousel-img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.rw-carousel-caption {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
padding: .75rem 1rem;
|
||||
color: #fff;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, .6));
|
||||
font: 500 1rem/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
}
|
||||
|
||||
.rw-carousel-link {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.rw-carousel-prev,
|
||||
.rw-carousel-next {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
border: 0;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
border-radius: 50%;
|
||||
background: rgba(0, 0, 0, .4);
|
||||
color: #fff;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rw-carousel-prev { left: .5rem; }
|
||||
.rw-carousel-next { right: .5rem; }
|
||||
|
||||
.rw-carousel-prev:hover,
|
||||
.rw-carousel-next:hover {
|
||||
background: rgba(0, 0, 0, .65);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/* Runway Carousel Manager — behaviour. Served at /__plugin/carousel-manager/static/carousel.js.
|
||||
Idempotent: initializes every .rw-carousel not already initialized, so the widget can include this script
|
||||
once per instance without double-binding. No dependencies. */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function init(root) {
|
||||
if (root.dataset.rwInit === "1") { return; }
|
||||
root.dataset.rwInit = "1";
|
||||
|
||||
var slides = Array.prototype.slice.call(root.querySelectorAll(".rw-carousel-slide"));
|
||||
if (slides.length === 0) { return; }
|
||||
var index = slides.findIndex(function (s) { return s.classList.contains("is-active"); });
|
||||
if (index < 0) { index = 0; }
|
||||
|
||||
function show(i) {
|
||||
index = (i + slides.length) % slides.length;
|
||||
slides.forEach(function (s, k) { s.classList.toggle("is-active", k === index); });
|
||||
}
|
||||
|
||||
var prev = root.querySelector(".rw-carousel-prev");
|
||||
var next = root.querySelector(".rw-carousel-next");
|
||||
if (prev) { prev.addEventListener("click", function () { show(index - 1); pause(); }); }
|
||||
if (next) { next.addEventListener("click", function () { show(index + 1); pause(); }); }
|
||||
|
||||
var interval = parseInt(root.dataset.interval, 10);
|
||||
var timer = null;
|
||||
function play() {
|
||||
if (!(interval > 0) || slides.length < 2) { return; }
|
||||
timer = window.setInterval(function () { show(index + 1); }, interval * 1000);
|
||||
}
|
||||
function pause() { if (timer) { window.clearInterval(timer); timer = null; } }
|
||||
|
||||
root.addEventListener("mouseenter", pause);
|
||||
root.addEventListener("mouseleave", play);
|
||||
show(index);
|
||||
play();
|
||||
}
|
||||
|
||||
function scan() {
|
||||
Array.prototype.forEach.call(document.querySelectorAll(".rw-carousel"), init);
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", scan);
|
||||
} else {
|
||||
scan();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
<!-- Admin status fragment — rendered below this plugin's per-tenant settings form. Bare fragment. -->
|
||||
<div class="card mt-3">
|
||||
<div class="card-header"><h3 class="card-title" id="ca-title">Carousel status</h3></div>
|
||||
<div class="card-body">
|
||||
<div class="datagrid">
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title" id="ca-l-slides">Configured slides</div>
|
||||
<div class="datagrid-content" id="ca-slides">0</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-secondary small mt-2 mb-0" id="ca-usage">
|
||||
Add the carousel to a page with a data-widget anchor, e.g.
|
||||
<code><div id="hero" data-widget="carousel/hero"></div></code>.</p>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a id="ca-help" href="/__plugin/carousel-manager/static/carousel-help.html" target="_blank" rel="noopener">
|
||||
<i class="fa-solid fa-circle-question me-1"></i><span id="ca-help-label">Carousel help & reference</span></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Admin fragment logic. Values from ${@carouselManagerAdminModel...(tenantSiteId)}. The usage line keeps its literal
|
||||
HTML example (no binding) so it renders verbatim. -->
|
||||
<thlogic>
|
||||
<attr sel="#ca-title" th:text="#{carousel.admin.title}"/>
|
||||
<attr sel="#ca-l-slides" th:text="#{carousel.admin.slides}"/>
|
||||
<attr sel="#ca-slides" th:text="${@carouselManagerAdminModel.slideCount(tenantSiteId)}"/>
|
||||
<attr sel="#ca-help-label" th:text="#{carousel.admin.help}"/>
|
||||
</thlogic>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- Tenant dashboard card fragment — __plugin__/carousel-manager/dashboard. Bare fragment; binding in .th.xml. -->
|
||||
<div class="card">
|
||||
<div class="card-status-start bg-pink"></div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex align-items-center">
|
||||
<span class="bg-pink-lt avatar"><i class="fa-solid fa-images"></i></span>
|
||||
<div class="ms-3">
|
||||
<div class="fw-bold" id="cc-title">Carousel</div>
|
||||
<div class="text-secondary small">
|
||||
<span id="cc-slides">0</span> <span id="cc-slides-lbl">slides</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Dashboard card logic. Values from ${@carouselManagerAdminModel...(tenantSiteId)}. -->
|
||||
<thlogic>
|
||||
<attr sel="#cc-title" th:text="#{carousel.card.title}"/>
|
||||
<attr sel="#cc-slides" th:text="${@carouselManagerAdminModel.slideCount(tenantSiteId)}"/>
|
||||
<attr sel="#cc-slides-lbl" th:text="#{carousel.card.slides}"/>
|
||||
</thlogic>
|
||||
Reference in new issue
Block a user