aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub')
-rw-r--r--packages/meshbay-hub/LICENSE661
-rw-r--r--packages/meshbay-hub/pyproject.toml4
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/cast-session.js220
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/crypto.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/helloworld-app-settings.js3
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/helloworld-app.js3
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/index-dock.js10
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/keyderive.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/licenses/AGPL-3.0.txt661
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/licenses/APPLICATION-EXCEPTION.txt65
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/licenses/GPL-3.0.txt674
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/licenses/LGPL-3.0.txt165
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/de.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/en.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/es.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/it.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/music-app.js3
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/music-player.js234
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/photos-app.js67
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/platform.js20
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/playlist-crypto.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/style.css18
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-admin.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-codec.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-devices.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-media.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-pins.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-rewrap.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-roster.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport-upload.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport.js2
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/vendor/LICENSES.txt268
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/vendor/PROVENANCE.md22
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/video-app.js3
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/video-player.js21
-rw-r--r--packages/meshbay-hub/tests/harness/cast_session_probe.py521
-rw-r--r--packages/meshbay-hub/tests/test_android_cast.py8
-rw-r--r--packages/meshbay-hub/tests/test_cast_files.py372
45 files changed, 4032 insertions, 37 deletions
diff --git a/packages/meshbay-hub/LICENSE b/packages/meshbay-hub/LICENSE
new file mode 100644
index 0000000..be3f7b2
--- /dev/null
+++ b/packages/meshbay-hub/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU 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 <https://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
+<https://www.gnu.org/licenses/>.
diff --git a/packages/meshbay-hub/pyproject.toml b/packages/meshbay-hub/pyproject.toml
index c927242..643363e 100644
--- a/packages/meshbay-hub/pyproject.toml
+++ b/packages/meshbay-hub/pyproject.toml
@@ -1,5 +1,5 @@
[build-system]
-requires = ["hatchling"]
+requires = ["hatchling>=1.27"] # PEP 639: SPDX `license` + `license-files`
build-backend = "hatchling.build"
[project]
@@ -7,6 +7,8 @@ name = "meshbay-hub"
version = "0.18.0"
description = "MeshBay Hub — identity authority and group registry server"
requires-python = ">=3.12"
+license = "AGPL-3.0-or-later"
+license-files = ["LICENSE"]
dependencies = [
"meshbay-common>=0.10.0",
"fastapi>=0.115",
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/cast-session.js b/packages/meshbay-hub/src/meshbay_hub/static/cast-session.js
new file mode 100644
index 0000000..9f93919
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/static/cast-session.js
@@ -0,0 +1,220 @@
+import { html, useState, useEffect, useRef } from './vendor/htm-preact.js';
+import { t } from './i18n.js';
+import { Icon } from './icon.js';
+import * as platform from './platform.js';
+
+// ── The television this session casts to ─────────────────────────────────────
+//
+// docs/MESHBAY_DESIGN.md §11.4. Chosen once, from any cast button — Videos'
+// toolbar, a photo album's bar, the lightbox, the player — and from then on a
+// film opened plays there with the player as its remote, and a photo opened
+// in the lightbox is shown there. In memory only: a television chosen
+// yesterday may be off today, and choosing it again is one tap.
+//
+// The receiver is the default media receiver, which shows one film, one
+// picture or one track at a time and nothing else; the interface itself stays
+// on this device. `owner` says which of the three the television is showing
+// now ('video', 'photo', 'music'), so that the music bar stops treating the
+// receiver as its own once a film or a photo has taken it.
+
+let current = null;
+let owner = null;
+const listeners = new Set();
+
+function notify() {
+ for (const fn of listeners) fn(current);
+}
+
+export const castSession = {
+ get device() { return current; },
+ get owner() { return owner; },
+ get supported() { return Boolean(platform.capabilities.lanCast && platform.cast.available); },
+ /** Whether a whole file (a photo, a track) can be sent: an older shell cannot. */
+ get canSendFiles() { return this.supported && platform.cast.canSendFiles; },
+ /** The television now shows what `who` sends it. */
+ claim(who) {
+ owner = who;
+ notify();
+ },
+ choose(device) {
+ current = device ? { id: device.id, name: device.name } : null;
+ notify();
+ },
+ /** Forget the television without touching it: whoever stopped it already has. */
+ forget() { this.choose(null); },
+ /** Stop casting: the television goes back to its idle screen. */
+ async end() {
+ owner = null;
+ this.choose(null);
+ photoGen++;
+ await platform.cast.chromecastDisconnect().catch(() => {});
+ await platform.cast.stop().catch(() => {});
+ },
+ subscribe(fn) {
+ listeners.add(fn);
+ return () => listeners.delete(fn);
+ },
+};
+
+export function useCastDevice() {
+ const [device, setDevice] = useState(castSession.device);
+ useEffect(() => castSession.subscribe(setDevice), []);
+ return device;
+}
+
+// ── A file on the television ─────────────────────────────────────────────────
+//
+// A photo or a music track, whole, handed to the relay and loaded on the
+// session's television — connected if it is not yet, reloaded if it is. The
+// relay, not the page, tells the receiver what the file is; the page only
+// names it (title, artist, album, cover) and says where in it to begin.
+
+export async function loadFile({ owner: who, startAt = 0, ...file }) {
+ const device = current;
+ if (!device || !castSession.canSendFiles) throw new Error('No television to cast to');
+ castSession.claim(who);
+ const sent = await platform.cast.file(file);
+ if (!sent) throw new Error('The cast relay did not take the file');
+ const status = await platform.cast.status();
+ if (status && status.chromecast && status.chromecast.connected) {
+ await platform.cast.chromecastReload({ mediaUrl: sent.url, startAt });
+ } else {
+ await platform.cast.chromecastConnect({ deviceId: device.id, mediaUrl: sent.url, startAt });
+ }
+}
+
+// ── A photo on the television ────────────────────────────────────────────────
+//
+// Scaled to fit 1920×1080 and re-encoded as JPEG before it leaves: a camera's
+// original is 20 MB and 6000 px wide, more than a receiver decodes in good
+// time, and some are formats it does not decode at all. EXIF orientation is
+// applied here, so a portrait photo arrives upright and the receiver centres
+// it. Photos asked for while one is still on its way are skipped to the
+// newest: paging quickly through an album shows where the reader stopped,
+// not every photo passed on the way.
+
+const TV_WIDTH = 1920;
+const TV_HEIGHT = 1080;
+const JPEG_QUALITY = 0.9;
+
+async function scaledForTv(blob) {
+ const bitmap = await createImageBitmap(blob, { imageOrientation: 'from-image' });
+ try {
+ const scale = Math.min(1, TV_WIDTH / bitmap.width, TV_HEIGHT / bitmap.height);
+ const canvas = document.createElement('canvas');
+ canvas.width = Math.max(1, Math.round(bitmap.width * scale));
+ canvas.height = Math.max(1, Math.round(bitmap.height * scale));
+ canvas.getContext('2d').drawImage(bitmap, 0, 0, canvas.width, canvas.height);
+ const jpeg = await new Promise((resolve, reject) => canvas.toBlob(
+ (b) => (b ? resolve(b) : reject(new Error('JPEG encoding failed'))),
+ 'image/jpeg', JPEG_QUALITY));
+ return new Uint8Array(await jpeg.arrayBuffer());
+ } finally {
+ bitmap.close();
+ }
+}
+
+let photoGen = 0;
+let photoChain = Promise.resolve();
+
+/** Show `blob` on the session's television, if there is one. */
+export function showPhoto(blob) {
+ const gen = ++photoGen;
+ photoChain = photoChain.then(async () => {
+ if (gen !== photoGen || !current || !castSession.canSendFiles) return;
+ const bytes = await scaledForTv(blob);
+ if (gen !== photoGen) return;
+ await loadFile({ owner: 'photo', bytes, type: 'image/jpeg' });
+ }).catch((err) => console.warn('[cast] photo not shown:', err));
+ return photoChain;
+}
+
+// ── The cast button ──────────────────────────────────────────────────────────
+//
+// One button, wherever it is put: with no television chosen it lists the
+// receivers as they answer; with one, it says which and offers to stop.
+// `overlay` is for the dark full-screen views (lightbox), `page` for a
+// toolbar. `cls` and `iconCls` are the button's and its icon's own classes,
+// so it matches its neighbours.
+// `onChosen` runs after a television is picked, for the view that has
+// something to show on it straight away. `up` opens the menu above the
+// button, for one at the bottom of the window.
+
+export function CastButton({
+ variant = 'page', cls = 'tb-btn tb-btn-icon', iconCls = '', onChosen, up = false,
+}) {
+ const device = useCastDevice();
+ const [open, setOpen] = useState(false);
+ const [devices, setDevices] = useState([]);
+ const [scanning, setScanning] = useState(false);
+ const wrapRef = useRef(null);
+
+ useEffect(() => {
+ if (!open || device) return undefined;
+ setDevices([]);
+ setScanning(true);
+ return platform.cast.discover((list, still) => {
+ setDevices(list || []);
+ setScanning(still);
+ });
+ }, [open, device]);
+
+ // Closed by a press anywhere else, as any menu is.
+ useEffect(() => {
+ if (!open) return undefined;
+ const outside = (e) => {
+ if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
+ };
+ document.addEventListener('pointerdown', outside);
+ return () => document.removeEventListener('pointerdown', outside);
+ }, [open]);
+
+ if (!castSession.supported) return null;
+
+ const overlay = variant === 'overlay';
+ const menuCls = `${overlay ? 'cast-picker' : 'ctx-menu cast-menu'}${up ? ' cast-menu-up' : ''}`;
+ const itemCls = overlay ? 'cast-picker-item' : 'ctx-menu-item';
+ const title = device ? `${t('cast.casting_to')} ${device.name}` : t('cast.start');
+
+ return html`
+ <div class="cast-wrapper" ref=${wrapRef}>
+ <button class="${cls} cast-btn ${device ? 'casting' : ''}"
+ onClick=${() => setOpen(!open)} title=${title} aria-label=${title}
+ aria-expanded=${open ? 'true' : 'false'}>
+ <${Icon} name="cast" cls=${iconCls} /></button>
+ ${open && html`
+ <div class=${menuCls} role="menu">
+ ${device && html`
+ <div class="${itemCls} cast-menu-current">
+ <${Icon} name="cast" /> ${t('cast.casting_to')} ${device.name}
+ </div>
+ <button class=${itemCls} role="menuitem" onClick=${() => {
+ setOpen(false);
+ castSession.end();
+ }}>
+ <${Icon} name="close" /> ${t('cast.stop')}
+ </button>
+ `}
+ ${!device && devices.map((d) => html`
+ <button class=${itemCls} role="menuitem" key=${d.id} onClick=${() => {
+ setOpen(false);
+ castSession.choose(d);
+ if (onChosen) onChosen(d);
+ }}>
+ <${Icon} name="cast" /> ${d.name}
+ </button>
+ `)}
+ ${!device && scanning && html`
+ <div class="${itemCls} cast-picker-scanning">
+ <span class="spinner" style="width:14px;height:14px"></span>
+ ${t('cast.scanning')}
+ </div>
+ `}
+ ${!device && !scanning && devices.length === 0 && html`
+ <div class="${itemCls} cast-picker-empty">${t('cast.no_devices')}</div>
+ `}
+ </div>
+ `}
+ </div>
+ `;
+}
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/crypto.js b/packages/meshbay-hub/src/meshbay_hub/static/crypto.js
index ce5ec76..11114d9 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/crypto.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/crypto.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
/**
* MeshBay Browser Crypto — AES-256-GCM, through WebCrypto's SubtleCrypto API.
* The one content cipher, for every client (meshbay_common/webcrypto.py).
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app-settings.js b/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app-settings.js
index be26fbc..f033915 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app-settings.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app-settings.js
@@ -1,3 +1,6 @@
+// SPDX-License-Identifier: 0BSD
+// The reference application: copy it to start one of your own, under any licence
+// (licenses/APPLICATION-EXCEPTION.txt).
import { html, useState, useEffect } from './vendor/htm-preact.js';
import { t } from './i18n.js';
import { useSaver } from './settings-ui.js';
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app.js b/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app.js
index 98ca8fa..8781d18 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/helloworld-app.js
@@ -1,3 +1,6 @@
+// SPDX-License-Identifier: 0BSD
+// The reference application: copy it to start one of your own, under any licence
+// (licenses/APPLICATION-EXCEPTION.txt).
import { html, useMemo } from './vendor/htm-preact.js';
import { t } from './i18n.js';
import { Icon } from './icon.js';
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/index-dock.js b/packages/meshbay-hub/src/meshbay_hub/static/index-dock.js
index 6730e60..6c89eb6 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/index-dock.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/index-dock.js
@@ -51,9 +51,18 @@ function useLoopbackActivity() {
let stopped = false;
let timer = null;
let last = '';
+ // Asked before the first operation and again after any failure: detect()
+ // answers "no node" as a value, where an operation on an absent node is a
+ // rejected IPC call that Electron prints to its terminal on every poll.
+ let present = false;
const poll = async () => {
let delay = IDLE_POLL_MS;
try {
+ if (!present) {
+ const found = await platform.node.detect();
+ if (!found || !found.detected) throw new Error('no node');
+ present = true;
+ }
const data = await platform.node.op('indexStatus');
const next = {};
for (const g of (data && data.groups) || []) next[g.group_id] = fromLoopback(g);
@@ -64,6 +73,7 @@ function useLoopbackActivity() {
if (!stopped && text !== last) { last = text; setLocal(next); }
} catch {
// No node on this machine, or one older than the route.
+ present = false;
if (!stopped && last !== '{}') { last = '{}'; setLocal({}); }
delay = ABSENT_POLL_MS;
}
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/keyderive.js b/packages/meshbay-hub/src/meshbay_hub/static/keyderive.js
index 7bbcac5..edf4df9 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/keyderive.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/keyderive.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
/**
* MeshBay Browser Key Management — keyderive.js
*
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/licenses/AGPL-3.0.txt b/packages/meshbay-hub/src/meshbay_hub/static/licenses/AGPL-3.0.txt
new file mode 100644
index 0000000..be3f7b2
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/static/licenses/AGPL-3.0.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU 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 <https://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
+<https://www.gnu.org/licenses/>.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/licenses/APPLICATION-EXCEPTION.txt b/packages/meshbay-hub/src/meshbay_hub/static/licenses/APPLICATION-EXCEPTION.txt
new file mode 100644
index 0000000..5ab0921
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/static/licenses/APPLICATION-EXCEPTION.txt
@@ -0,0 +1,65 @@
+MeshBay interface — additional permission for group applications
+under GNU AGPL version 3, section 7
+==============================================================================
+
+The MeshBay interface is free software under the GNU Affero General Public
+License, version 3 or (at your option) any later version (AGPL-3.0.txt, beside
+this file), with the following additional permission. Its protocol layer, the
+files marked SPDX-License-Identifier: LGPL-3.0-or-later, is under the GNU
+Lesser GPL instead and needs no such permission.
+
+Definitions
+
+ "The Interface" is the MeshBay web interface: the files of
+ packages/meshbay-hub/src/meshbay_hub/static/ that are under the AGPL,
+ wherever they are conveyed — served by a hub, or carried by the desktop or
+ the Android application.
+
+ "The Application Interface" is:
+ 1. the properties the Interface passes to a group application's component
+ and to its settings pane, and the fields of an entry in its application
+ registry (apps.js), as docs/MESHBAY_DESIGN.md sections 9.2 to 9.4
+ describe them;
+ 2. the names exported by these modules of the Interface:
+ i18n.js
+ icon.js
+ file-utils.js
+ settings-ui.js
+ folder-tree.js
+ 3. the CSS class names style.css defines, and the message keys of the
+ catalogues under locales/.
+
+ "An Application" is a module, or a set of modules, that the Interface loads
+ as a group application and that interacts with the Interface only through
+ the Application Interface. It may also use the protocol layer and the
+ third-party files under vendor/, each under its own licence. It contains no
+ part of the Interface itself, copied or modified.
+
+Permission
+
+ As a special exception, the copyright holders of the Interface give you
+ permission to combine an Application with the Interface, and to convey the
+ resulting combination, with the Application under terms of your choice,
+ provided that the Interface itself — including any modification of it, of
+ which registering the Application in apps.js or adding its messages to the
+ catalogues is one — remains under the GNU AGPL with this permission, and
+ that you meet the AGPL's terms for it, section 13 included. An Application
+ does not become a work based on the Interface by using the Application
+ Interface, and conveyed on its own carries no obligation from the
+ Interface's licence.
+
+ This permission covers the Interface only. The hub, the node and the
+ desktop and Android shells keep their licence unchanged: code running there
+ on an Application's behalf is a modification of them.
+
+ If you modify the Interface, you may extend this permission to your version
+ of it, but you are not obliged to do so. If you do not wish to, delete this
+ permission from your version (section 7).
+
+Why: the point of the application store is that people other than MeshBay's
+authors write applications, under the licence they choose — free or not. An
+application runs in the same page as the Interface and calls into it, which
+without this permission would make it a work based on the Interface, under the
+AGPL. The permission is limited to a named, documented surface so that what an
+application may rely on is a deliberate commitment, not whatever happens to be
+importable.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/licenses/GPL-3.0.txt b/packages/meshbay-hub/src/meshbay_hub/static/licenses/GPL-3.0.txt
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/static/licenses/GPL-3.0.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/licenses/LGPL-3.0.txt b/packages/meshbay-hub/src/meshbay_hub/static/licenses/LGPL-3.0.txt
new file mode 100644
index 0000000..0a04128
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/static/licenses/LGPL-3.0.txt
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser 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
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js
index bdc4dd5..c72de49 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/de.js
@@ -377,6 +377,8 @@ export default {
'photo.prev': 'Vorherige (←)',
'photo.next': 'Nächste (→)',
'photo.zip_album': 'Album als ZIP herunterladen',
+ 'photo.slideshow': 'Diashow',
+ 'photo.slideshow_stop': 'Diashow beenden',
'photo.zoom_in': 'Vergrößern',
'photo.zoom_out': 'Verkleinern',
'photo.zoom_fit_title': 'An Fenster anpassen',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js
index 658f388..a799b34 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/en.js
@@ -375,6 +375,8 @@ export default {
'photo.prev': 'Previous (←)',
'photo.next': 'Next (→)',
'photo.zip_album': 'Download album as zip',
+ 'photo.slideshow': 'Slideshow',
+ 'photo.slideshow_stop': 'Stop slideshow',
'photo.zoom_in': 'Zoom in',
'photo.zoom_out': 'Zoom out',
'photo.zoom_fit_title': 'Fit to window',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js
index 9e73017..8e49240 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/es.js
@@ -375,6 +375,8 @@ export default {
'photo.prev': 'Anterior (←)',
'photo.next': 'Siguiente (→)',
'photo.zip_album': 'Descargar álbum como zip',
+ 'photo.slideshow': 'Presentación',
+ 'photo.slideshow_stop': 'Detener la presentación',
'photo.zoom_in': 'Acercar',
'photo.zoom_out': 'Alejar',
'photo.zoom_fit_title': 'Ajustar a la ventana',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js
index 5d18d41..1432f11 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/fr.js
@@ -376,6 +376,8 @@ export default {
'photo.prev': 'Précédent (←)',
'photo.next': 'Suivant (→)',
'photo.zip_album': "Télécharger l'album en zip",
+ 'photo.slideshow': 'Diaporama',
+ 'photo.slideshow_stop': 'Arrêter le diaporama',
'photo.zoom_in': 'Zoomer',
'photo.zoom_out': 'Dézoomer',
'photo.zoom_fit_title': 'Ajuster à la fenêtre',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js
index c4d2acc..579f8da 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/it.js
@@ -376,6 +376,8 @@ export default {
'photo.prev': 'Precedente (←)',
'photo.next': 'Successiva (→)',
'photo.zip_album': "Scarica l'album come zip",
+ 'photo.slideshow': 'Presentazione',
+ 'photo.slideshow_stop': 'Interrompi la presentazione',
'photo.zoom_in': 'Ingrandisci',
'photo.zoom_out': 'Riduci',
'photo.zoom_fit_title': 'Adatta alla finestra',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js
index fe52bfa..cea7bfc 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/ja.js
@@ -373,6 +373,8 @@ export default {
'photo.prev': '前へ(←)',
'photo.next': '次へ(→)',
'photo.zip_album': 'アルバムをzipでダウンロード',
+ 'photo.slideshow': 'スライドショー',
+ 'photo.slideshow_stop': 'スライドショーを停止',
'photo.zoom_in': '拡大',
'photo.zoom_out': '縮小',
'photo.zoom_fit_title': 'ウィンドウに合わせる',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js
index 90b71f0..007154a 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/nl.js
@@ -377,6 +377,8 @@ export default {
'photo.prev': 'Vorige (←)',
'photo.next': 'Volgende (→)',
'photo.zip_album': 'Album downloaden als zip',
+ 'photo.slideshow': 'Diavoorstelling',
+ 'photo.slideshow_stop': 'Diavoorstelling stoppen',
'photo.zoom_in': 'Inzoomen',
'photo.zoom_out': 'Uitzoomen',
'photo.zoom_fit_title': 'Passend maken',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js
index 8c31cf3..7969cd0 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/pl.js
@@ -388,6 +388,8 @@ export default {
'photo.prev': 'Poprzednie (←)',
'photo.next': 'Następne (→)',
'photo.zip_album': 'Pobierz album jako zip',
+ 'photo.slideshow': 'Pokaz slajdów',
+ 'photo.slideshow_stop': 'Zatrzymaj pokaz slajdów',
'photo.zoom_in': 'Powiększ',
'photo.zoom_out': 'Pomniejsz',
'photo.zoom_fit_title': 'Dopasuj do okna',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js
index 2f951ee..52d9d4c 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/pt-BR.js
@@ -377,6 +377,8 @@ export default {
'photo.prev': 'Anterior (←)',
'photo.next': 'Próxima (→)',
'photo.zip_album': 'Baixar álbum como zip',
+ 'photo.slideshow': 'Apresentação de slides',
+ 'photo.slideshow_stop': 'Parar a apresentação',
'photo.zoom_in': 'Aumentar zoom',
'photo.zoom_out': 'Diminuir zoom',
'photo.zoom_fit_title': 'Ajustar à janela',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js b/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js
index ea02545..3739dcf 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/locales/zh-CN.js
@@ -370,6 +370,8 @@ export default {
'photo.prev': '上一张(←)',
'photo.next': '下一张(→)',
'photo.zip_album': '将相册下载为 zip',
+ 'photo.slideshow': '幻灯片放映',
+ 'photo.slideshow_stop': '停止幻灯片放映',
'photo.zoom_in': '放大',
'photo.zoom_out': '缩小',
'photo.zoom_fit_title': '适应窗口',
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/music-app.js b/packages/meshbay-hub/src/meshbay_hub/static/music-app.js
index 67be344..f2c4374 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/music-app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/music-app.js
@@ -10,6 +10,7 @@ import { usePager, Pager, pageSizeFrom } from './pager.js';
import { Menu, MenuDots, useMenu } from './menu.js';
import { PlaylistMenuButton, NameModal, usePlaylists } from './playlist-menu.js';
import * as P from './playlists.js';
+import { CastButton } from './cast-session.js';
// -- Music --------------------------------------------------------------------
//
@@ -747,6 +748,8 @@ function MusicApp({
lists=${playlists} reload=${reloadPlaylists}
onPlayQueue=${onPlayQueue} onSync=${syncNow} />`}
<${Pager} pager=${pager} />
+ ${/* The television the music bar plays to (cast-session.js). */''}
+ <${CastButton} />
${!hideFilter && html`<div class="tb-search">
<${Icon} name="search" />
<input type="text" placeholder="${t('group.filter')}"
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/music-player.js b/packages/meshbay-hub/src/meshbay_hub/static/music-player.js
index 500f518..4587990 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/music-player.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/music-player.js
@@ -6,7 +6,8 @@ import { t } from './i18n.js';
import { Icon } from './icon.js';
import { useStickyBand } from './sticky.js';
import { CHUNK_SIZE, pipelinedDownload } from './file-utils.js';
-import { playback } from './platform.js';
+import { playback, cast as castBridge } from './platform.js';
+import { castSession, useCastDevice, loadFile, CastButton } from './cast-session.js';
/**
* The Music app's persistent player bar (docs/MESHBAY_DESIGN.md §9.8).
@@ -30,6 +31,14 @@ import { playback } from './platform.js';
* through `transport.requestAudioTranscode` first — a node-side,
* cached-after-once AAC/M4A conversion — before the same download/blob path
* runs.
+ *
+ * With a television chosen (cast-session.js), the same decrypted track is
+ * handed to the cast relay instead of the <audio> element, with its cover,
+ * and the bar becomes the receiver's remote: its play, pause, seek, previous
+ * and next drive the television, its clock is the television's, and the end
+ * of a track there moves the queue on as `ended` does here (docs/MESHBAY_DESIGN.md
+ * §11.4). The element keeps the track's source for its duration, and never
+ * plays while casting.
*/
const MIME_BY_EXT = {
@@ -280,14 +289,22 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
for (const { url } of blobCacheRef.current.values()) URL.revokeObjectURL(url);
}, []);
- // Held for as long as a track plays, through the advance to the next one:
- // without it a phone freezes the page a minute after the screen goes off,
- // and the next track never loads.
+ // Held for as long as a track plays or loads: without it a phone freezes the
+ // page a minute after the screen goes off, and the next track never loads.
+ // Let go a few seconds late, because skipping a track that failed passes
+ // through "not playing", and Android refuses to take the hold back from the
+ // background: a playlist would stop at its first bad file.
+ const keepAliveRef = useRef({ held: false, timer: null });
+ const active = playing || loading;
useEffect(() => {
- if (!playing) return;
- playback.keepAlive(true);
- return () => playback.keepAlive(false);
- }, [playing]);
+ const k = keepAliveRef.current;
+ if (!active) return;
+ clearTimeout(k.timer);
+ if (!k.held) { k.held = true; playback.keepAlive(true); }
+ return () => {
+ k.timer = setTimeout(() => { k.held = false; playback.keepAlive(false); }, 5000);
+ };
+ }, [active]);
// Screen Wake Lock, opt-in only (Settings → music_keep_screen_on) and only
// while a track is actually playing — off by default because the ordinary
@@ -343,6 +360,64 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
}
}, []);
+ // ── Casting ──────────────────────────────────────────────────────────────
+ const castDevice = useCastDevice();
+ const remote = Boolean(castDevice) && castSession.canSendFiles;
+ const remoteRef = useRef(remote);
+ // Which track the television was last given, where it was when last
+ // polled, and which track's end has already moved the queue on: the
+ // receiver keeps reporting FINISHED until it is given something else.
+ const remoteTrackRef = useRef(null);
+ const remotePosRef = useRef(null);
+ const finishedRef = useRef(null);
+ // True while a track is on its way to the television: the receiver's
+ // status still describes the previous one until it lands.
+ const sendingRef = useRef(false);
+
+ // The track's cover, for the television to show beside it — found as the
+ // album card finds it (music-app.js): this track's own, else another queued
+ // track of the same album that carries one, else the cover the node found
+ // for the album. The node answers that last question from its cache, and
+ // asks MusicBrainz only where the group has it on and the track is tagged.
+ // A cover that cannot be had is no reason not to play the track.
+ const fetchCover = useCallback(async (entry) => {
+ try {
+ const { transport, gek } = await getConnection(entry.groupId);
+ if (!transport || !transport.connected) return null;
+ const sibling = entry.album && tracks.find((tr) => tr.thumb_hash
+ && tr.groupId === entry.groupId && tr.album === entry.album && tr.artist === entry.artist);
+ let hash = entry.thumb_hash || (sibling && sibling.thumb_hash) || null;
+ if (!hash && transport.fetchMusicMeta) {
+ const meta = await transport.fetchMusicMeta(entry.id).catch(() => null);
+ hash = (meta && meta.cover_thumb_hash) || null;
+ }
+ if (!hash) return null;
+ const chunks = await pipelinedDownload(transport, gek, hash, 1);
+ return { bytes: new Uint8Array(await new Blob(chunks).arrayBuffer()), type: 'image/jpeg' };
+ } catch {
+ return null;
+ }
+ }, [getConnection, tracks]);
+
+ const sendToTv = useCallback(async (entry, startAt = 0) => {
+ const cached = blobCacheRef.current.get(entry.id);
+ if (!cached) throw new Error(t('music.err_playback'));
+ sendingRef.current = true;
+ try {
+ const cover = await fetchCover(entry);
+ remoteTrackRef.current = entry.id;
+ remotePosRef.current = startAt;
+ finishedRef.current = null;
+ await loadFile({
+ owner: 'music', startAt,
+ bytes: new Uint8Array(await cached.blob.arrayBuffer()), type: cached.mime, cover,
+ title: entry.display_title || entry.name, artist: entry.artist || '', album: entry.album || '',
+ });
+ } finally {
+ sendingRef.current = false;
+ }
+ }, [fetchCover]);
+
const fetchTrackBlob = useCallback(async (entry) => {
const cached = blobCacheRef.current.get(entry.id);
if (cached) return cached.url;
@@ -387,7 +462,8 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
const chunks = await pipelinedDownload(transport, gek, downloadId, totalChunks);
const blob = new Blob(chunks, { type: mime });
const url = URL.createObjectURL(blob);
- blobCacheRef.current.set(entry.id, { url, order: blobInsertRef.current++ });
+ // The blob itself too: a cast hands its bytes to the relay.
+ blobCacheRef.current.set(entry.id, { url, blob, mime, order: blobInsertRef.current++ });
evictOldBlobs();
return url;
}, [getConnection, evictOldBlobs]);
@@ -512,6 +588,22 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
if (!audio) return;
audio.src = url;
audio.currentTime = 0;
+ if (remoteRef.current) {
+ // To the television; the element keeps the source for its duration.
+ audio.pause();
+ setCurrentTime(0);
+ try {
+ await sendToTv(currentTrack, 0);
+ } catch (castErr) {
+ castErr.isCast = true;
+ throw castErr;
+ }
+ if (loadTokenRef.current !== myToken) return;
+ consecutiveFailuresRef.current = 0;
+ setPlaying(true);
+ prefetchNext(pos);
+ return;
+ }
await audio.play();
consecutiveFailuresRef.current = 0;
setPlaying(true);
@@ -521,6 +613,9 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
// Autoplay refused (no recent tap): the track is loaded and fine, it
// waits for the play button. Not an error, and no reason to skip it.
if (err && err.name === 'NotAllowedError') { setPlaying(false); prefetchNext(pos); return; }
+ // The television did not take it: that says nothing about the track,
+ // so the queue stays where it is, with the reason on screen.
+ if (err && err.isCast) { setError(err.message || String(err)); setPlaying(false); return; }
if (err && err.isGroupDown && asleepOrJustWoke()) {
// Our own connection is what went, not the group: keep the spinner
// and this track, and try it again once we are back.
@@ -549,6 +644,9 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
// stream). Both paths converge on the same bounded advance, so whichever
// fires first, the queue moves on exactly once.
const handleMediaError = useCallback(() => {
+ // Casting, the element only holds the source for its duration: whether it
+ // could decode it says nothing about what the television is playing.
+ if (remoteRef.current) return;
const audio = audioRef.current;
const mediaError = audio && audio.error;
setError((mediaError && mediaError.message) || t('music.err_playback'));
@@ -575,27 +673,111 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
if (order.length === 0) return;
// A few seconds in: restart the current track, the way most players do,
// rather than always jumping to the previous one.
+ if (remoteRef.current && castSession.owner === 'music' && (remotePosRef.current || 0) > 3) {
+ castBridge.chromecastSeek(0).catch(() => {});
+ remotePosRef.current = 0;
+ setCurrentTime(0);
+ return;
+ }
const audio = audioRef.current;
- if (audio && audio.currentTime > 3) { audio.currentTime = 0; return; }
+ if (!remoteRef.current && audio && audio.currentTime > 3) { audio.currentTime = 0; return; }
if (pos > 0) { skipTo(pos - 1); return; }
if (repeat === 'all') { skipTo(order.length - 1); }
}, [pos, order.length, repeat, skipTo]);
const onEnded = useCallback(() => {
if (repeat === 'one') {
+ if (remoteRef.current && currentTrack) {
+ sendToTv(currentTrack, 0).catch((e) => { setError(e.message || String(e)); setPlaying(false); });
+ return;
+ }
const audio = audioRef.current;
if (audio) { audio.currentTime = 0; audio.play().catch(() => {}); }
return;
}
skipNext();
- }, [repeat, skipNext]);
+ }, [repeat, skipNext, currentTrack, sendToTv]);
+ const onEndedRef = useRef(onEnded);
+ onEndedRef.current = onEnded;
const togglePlaying = useCallback(() => {
+ if (remoteRef.current && currentTrack) {
+ // A film or a photo has the television: playing again gives it back
+ // the track, from where it was.
+ if (castSession.owner !== 'music') {
+ sendToTv(currentTrack, remotePosRef.current || 0)
+ .then(() => { setError(''); setPlaying(true); })
+ .catch((e) => { setError(e.message || String(e)); setPlaying(false); });
+ return;
+ }
+ (playing ? castBridge.chromecastPause() : castBridge.chromecastPlay())
+ .then(() => setPlaying(!playing)).catch(() => {});
+ return;
+ }
const audio = audioRef.current;
if (!audio) return;
if (playing) { audio.pause(); setPlaying(false); }
else { audio.play().then(() => { setError(''); setPlaying(true); }).catch(() => {}); }
- }, [playing]);
+ }, [playing, currentTrack, sendToTv]);
+
+ // A television chosen, or let go, in the middle of a track: the track goes
+ // on from where it was, on the other side.
+ useEffect(() => {
+ const was = remoteRef.current;
+ remoteRef.current = remote;
+ if (was === remote || !currentTrack) return;
+ const audio = audioRef.current;
+ if (remote) {
+ const at = audio ? audio.currentTime : 0;
+ const wasPlaying = playing;
+ if (audio) audio.pause();
+ // Still loading: the load effect sends it once it has it.
+ if (!blobCacheRef.current.has(currentTrack.id)) return;
+ sendToTv(currentTrack, at)
+ .then(async () => {
+ if (!wasPlaying) await castBridge.chromecastPause().catch(() => {});
+ setPlaying(wasPlaying);
+ })
+ .catch((e) => { setError(e.message || String(e)); setPlaying(false); });
+ } else {
+ const at = remotePosRef.current;
+ remoteTrackRef.current = null;
+ if (audio && at != null && isFinite(at)) audio.currentTime = at;
+ if (playing && audio) audio.play().catch(() => setPlaying(false));
+ }
+ // eslint-disable-next-line
+ }, [remote]);
+
+ // The television's clock and state, once a second, for as long as the
+ // track there is ours.
+ useEffect(() => {
+ if (!remote) return undefined;
+ let stopped = false;
+ const tick = async () => {
+ if (sendingRef.current || castSession.owner !== 'music' || !remoteTrackRef.current) return;
+ const s = await castBridge.status().catch(() => null);
+ const c = s && s.chromecast;
+ if (stopped || sendingRef.current || castSession.owner !== 'music' || !c) return;
+ if (!c.connected) { setPlaying(false); return; }
+ if (c.position != null) { remotePosRef.current = c.position; setCurrentTime(c.position); }
+ const state = c.playerState;
+ if (state === 'PLAYING' || state === 'BUFFERING') setPlaying(true);
+ else if (state === 'PAUSED') setPlaying(false);
+ else if (state === 'IDLE' && String(c.idleReason || '').toLowerCase() === 'finished'
+ && finishedRef.current !== remoteTrackRef.current) {
+ finishedRef.current = remoteTrackRef.current;
+ onEndedRef.current();
+ }
+ };
+ const id = setInterval(tick, 1000);
+ tick();
+ // A film or a photo took the television: the track there has stopped.
+ // Not when casting stops altogether — the track then carries on here.
+ const unsubscribe = castSession.subscribe(() => {
+ if (castSession.device && castSession.owner !== 'music') setPlaying(false);
+ });
+ return () => { stopped = true; clearInterval(id); unsubscribe(); };
+ }, [remote]);
// Reshuffling keeps the currently playing track in place — turning shuffle
// on mid-album must not interrupt what's already playing. Which track that
@@ -616,19 +798,36 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
}, []);
const seek = useCallback((e) => {
+ const to = parseFloat(e.target.value);
+ if (remoteRef.current) {
+ if (castSession.owner !== 'music') return;
+ castBridge.chromecastSeek(to).catch(() => {});
+ remotePosRef.current = to;
+ setCurrentTime(to);
+ return;
+ }
const audio = audioRef.current;
- if (audio && isFinite(audio.duration)) audio.currentTime = parseFloat(e.target.value);
+ if (audio && isFinite(audio.duration)) audio.currentTime = to;
}, []);
const handleClose = useCallback(() => {
const audio = audioRef.current;
if (audio) audio.pause();
+ // The television stops with the bar; it stays chosen for what comes next.
+ if (remoteRef.current && castSession.owner === 'music') {
+ castSession.claim(null);
+ castBridge.chromecastDisconnect().catch(() => {});
+ castBridge.stop().catch(() => {});
+ }
if (onClose) onClose();
}, [onClose]);
if (!currentTrack) return null;
const title = currentTrack.display_title || currentTrack.name;
+ // The element's, once it has read the file; the index's until then — and
+ // while casting, a file this device cannot decode still has a length.
+ const shownDuration = (isFinite(duration) && duration > 0) ? duration : (currentTrack.duration || 0);
const repeatLabel = repeat === 'off' ? t('music.player_repeat_off')
: repeat === 'all' ? t('music.player_repeat_all') : t('music.player_repeat_one');
@@ -670,17 +869,18 @@ function MusicPlayerBar({ getConnection, queue, onClose, userPrefs, onSaveQueue
</div>
<div class="music-player-seek">
<span class="music-player-time">${formatTime(currentTime)}</span>
- <input type="range" min="0" max=${duration || 0} step="1" value=${currentTime}
- disabled=${!duration} onInput=${seek} />
- <span class="music-player-time">${formatTime(duration)}</span>
+ <input type="range" min="0" max=${shownDuration} step="1" value=${currentTime}
+ disabled=${!shownDuration} onInput=${seek} />
+ <span class="music-player-time">${formatTime(shownDuration)}</span>
</div>
<div class="music-player-volume">
<${Icon} name="volume" />
<input type="range" min="0" max="1" step="0.05" value=${volume}
- title=${t('music.player_volume')}
+ title=${t('music.player_volume')} disabled=${remote}
onInput=${(e) => setVolume(parseFloat(e.target.value))} />
</div>
<div class="music-player-extra">
+ <${CastButton} cls="music-player-btn" up />
<button class="music-player-btn" title=${t('music.player_queue')} onClick=${() => setShowQueue(true)}>
<${Icon} name="menu" />
</button>
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js b/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js
index 73b8c15..00bc288 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/photos-app.js
@@ -9,6 +9,7 @@ import {
import { transfers } from './transfers.js';
import { MediaThumb, LazyTile } from './media-tiles.js';
import { SourceTag } from './group-name.js';
+import { CastButton, castSession, useCastDevice, showPhoto } from './cast-session.js';
// ── Photos ───────────────────────────────────────────────────────────────────
//
@@ -21,6 +22,8 @@ import { SourceTag } from './group-name.js';
// keyboard arrows, EXIF info when present) and a "zip this album" button
// that reuses Files' own zip mechanism unchanged (file-utils.js's
// downloadDirectory, lifted out of files-app.js for exactly this reuse).
+// With a television chosen (cast-session.js), the photo the lightbox shows
+// is the photo the television shows, and a slideshow pages through both.
function underAnyPhotoRoot(entry, photoRoots) {
const p = entry.path || '';
@@ -133,6 +136,10 @@ function PhotoTile({ entry, transportRef, gekRef, onOpen }) {
// _thumbBlobCache — clicking back and forth between two photos decrypts
// each once, not once per visit.
const _fullBlobCache = new Map();
+// The same photos as blobs, for the television: a cast scales the picture
+// itself, and reading it back through its URL would be a fetch the page's
+// content policy has no reason to allow.
+const _fullBlobs = new Map();
// Zoom is only ever meaningful for the lightbox's own full-resolution
// image — nowhere else in the app shows one, so there is nothing to gate
@@ -142,6 +149,10 @@ const ZOOM_STEP = 25;
const ZOOM_MIN = 25;
const ZOOM_MAX = 400;
+// How long a slideshow stays on a photo, counted from when it has loaded:
+// a slow node must not skip a photo nobody saw.
+const SLIDESHOW_MS = 5000;
+
function Lightbox({ photos, index, transportRef, gekRef, onClose, onNav }) {
const entry = photos[index];
const tRef = entry._tRef || transportRef;
@@ -155,7 +166,9 @@ function Lightbox({ photos, index, transportRef, gekRef, onClose, onNav }) {
// same way the browser renders the <img> itself.
const [zoomPercent, setZoomPercent] = useState(null);
const [naturalSize, setNaturalSize] = useState(null);
+ const [slideshow, setSlideshow] = useState(false);
const slotRef = useRef(null);
+ const castDevice = useCastDevice();
useEffect(() => {
const cached = _fullBlobCache.get(entry.id);
@@ -171,8 +184,10 @@ function Lightbox({ photos, index, transportRef, gekRef, onClose, onNav }) {
const chunks = await pipelinedDownload(
transport, gRef.current, entry.id, totalChunks);
if (cancelled) return;
- const url = URL.createObjectURL(new Blob(chunks));
+ const blob = new Blob(chunks);
+ const url = URL.createObjectURL(blob);
_fullBlobCache.set(entry.id, url);
+ _fullBlobs.set(entry.id, blob);
setBlobUrl(url);
} catch {
/* leave the placeholder — a transient fetch failure isn't fatal, next/close still work */
@@ -187,6 +202,23 @@ function Lightbox({ photos, index, transportRef, gekRef, onClose, onNav }) {
// level chosen for one picture saying nothing about the next.
useEffect(() => { setZoomPercent(null); setNaturalSize(null); }, [entry.id]);
+ // The television follows the lightbox, from the moment one is chosen.
+ useEffect(() => {
+ const blob = _fullBlobs.get(entry.id);
+ if (castDevice && blobUrl && blob) showPhoto(blob);
+ }, [castDevice, blobUrl, entry.id]);
+
+ // Next photo once this one has been on screen for SLIDESHOW_MS; the last
+ // photo ends the slideshow rather than wrapping round.
+ useEffect(() => {
+ if (!slideshow || !blobUrl) return undefined;
+ const id = setTimeout(() => {
+ if (index < photos.length - 1) onNav(1);
+ else setSlideshow(false);
+ }, SLIDESHOW_MS);
+ return () => clearTimeout(id);
+ }, [slideshow, blobUrl, index, photos.length, onNav]);
+
useEffect(() => {
const onKey = (e) => {
if (e.key === 'Escape') onClose();
@@ -245,6 +277,13 @@ function Lightbox({ photos, index, transportRef, gekRef, onClose, onNav }) {
<button class="photo-icon-btn photo-icon-btn-text ${zoomPercent === 100 ? 'active' : ''}"
disabled=${!blobUrl} onClick=${zoomActual} title=${t('photo.zoom_100')}>100%</button>
</div>
+ <button class="video-close ${slideshow ? 'cast-active' : ''}"
+ disabled=${photos.length < 2}
+ onClick=${() => setSlideshow(!slideshow)}
+ title=${slideshow ? t('photo.slideshow_stop') : t('photo.slideshow')}
+ aria-pressed=${slideshow ? 'true' : 'false'}>
+ <${Icon} name=${slideshow ? 'pause' : 'play'} /></button>
+ <${CastButton} variant="overlay" cls="video-close" />
<button class="video-close" onClick=${onClose} title=${t('video.close')}>
<${Icon} name="close" /></button>
</div>
@@ -300,8 +339,14 @@ function AlbumView({ album, entries, transportRef, gekRef, setError, onBack, rea
${year && html`<span class="photo-album-heading-year">${year}</span>`}
</div>
</div>
- ${!readOnly && html`<button class="photo-icon-btn" onClick=${zip} title=${t('photo.zip_album')}>
- <${Icon} name="archive" cls="photo-icon-btn-icon" /></button>`}
+ <div class="photo-album-actions">
+ ${/* Choosing a television from here shows the album on it: the first
+ photo opens, since nothing is on screen yet to send. */''}
+ <${CastButton} cls="photo-icon-btn" iconCls="photo-icon-btn-icon"
+ onChosen=${() => setLightboxIndex((i) => (i === null ? 0 : i))} />
+ ${!readOnly && html`<button class="photo-icon-btn" onClick=${zip} title=${t('photo.zip_album')}>
+ <${Icon} name="archive" cls="photo-icon-btn-icon" /></button>`}
+ </div>
</div>
<div class="photo-grid">
${album.photos.map((e, i) => html`
@@ -353,17 +398,19 @@ function PhotosApp({
<p class="page-message">${t('photo.no_roots_configured')}</p>
`}
${status === 'connected' && (photoDirectories || []).length > 0 && !openAlbum && html`
- ${/* The filter is the only thing in it, so under `hideFilter` there is
- no toolbar rather than an empty one — an empty band still pins,
- and would hold a strip of the page open under the search field
- for nothing. */
- !hideFilter && html`
+ ${/* The filter and the cast button are all it holds, so with neither —
+ Search hides the filter, a browser cannot cast — there is no
+ toolbar rather than an empty one: an empty band still pins, and
+ would hold a strip of the page open under the search field for
+ nothing. */
+ (!hideFilter || castSession.supported) && html`
<div class="photo-toolbar">
- <div class="tb-search">
+ <${CastButton} />
+ ${!hideFilter && html`<div class="tb-search">
<${Icon} name="search" />
<input type="text" placeholder="${t('group.filter')}"
value=${filter} onInput=${(e) => setFilter(e.target.value)} />
- </div>
+ </div>`}
</div>
`}
${filteredAlbums.length === 0 && html`
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/platform.js b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
index 0174edc..28817c7 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/platform.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
@@ -460,6 +460,17 @@ export const cast = {
if (!bridge || !bridge.cast || !bridge.cast.subtitle) return null;
return bridge.cast.subtitle(sub);
},
+ // A whole file for the receiver — a photo already scaled to the television,
+ // a music track — as `{ bytes, type, cover?: { bytes, type }, title?,
+ // artist?, album? }`; answers `{ url }` to load. Absent from an older
+ // shell, so callers check `canSendFiles`.
+ get canSendFiles() {
+ return Boolean(bridge && bridge.cast && bridge.cast.file);
+ },
+ async file(f) {
+ if (!this.canSendFiles) return null;
+ return bridge.cast.file(f);
+ },
async finish() {
if (!bridge || !bridge.cast) return false;
return bridge.cast.finish();
@@ -520,6 +531,15 @@ export const cast = {
if (!this.canControl) return null;
return bridge.cast.chromecastPlay();
},
+ // Seeking inside a file the receiver plays (a track); a film seeks by
+ // restarting the relay instead.
+ get canSeek() {
+ return Boolean(bridge && bridge.cast && bridge.cast.chromecastSeek);
+ },
+ async chromecastSeek(seconds) {
+ if (!this.canSeek) return null;
+ return bridge.cast.chromecastSeek(seconds);
+ },
};
/**
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/playlist-crypto.js b/packages/meshbay-hub/src/meshbay_hub/static/playlist-crypto.js
index 6323b96..2a24160 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/playlist-crypto.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/playlist-crypto.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
/**
* Sealing a playlist blob, and opening one.
*
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/style.css b/packages/meshbay-hub/src/meshbay_hub/static/style.css
index e1e152e..9383043 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/style.css
+++ b/packages/meshbay-hub/src/meshbay_hub/static/style.css
@@ -2043,7 +2043,23 @@ button:disabled { opacity: 0.5; cursor: not-allowed; }
cursor: text; outline: none;
}
.cast-url-input:focus { border-color: rgba(59, 130, 246, 0.6); }
-.cast-wrapper { display: inline-block; }
+.cast-wrapper { display: inline-block; position: relative; }
+.video-close:disabled { opacity: 0.4; cursor: default; }
+.video-close.cast-btn.casting { background: rgba(59, 130, 246, 0.35); }
+.video-close.cast-btn.casting:hover { background: rgba(59, 130, 246, 0.5); }
+.cast-picker-item.cast-menu-current { color: #94a3b8; cursor: default; }
+.cast-picker-item.cast-menu-current:hover { background: none; }
+
+/* The cast button in a page's toolbar (cast-session.js): the same panel as
+ any other menu there, hung under the button rather than at a point. */
+.cast-btn.casting { color: var(--accent); border-color: var(--accent); }
+.ctx-menu.cast-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 150; }
+/* From the music bar, at the bottom of the window: the menu opens upward. */
+.cast-menu-up { top: auto !important; bottom: calc(100% + 4px); }
+.ctx-menu-item.cast-menu-current { color: var(--text-dim); cursor: default; }
+.ctx-menu-item.cast-menu-current:hover { background: none; }
+.ctx-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
+.photo-album-actions { display: flex; align-items: center; gap: 4px; }
.cast-picker {
position: absolute; top: calc(100% + 4px); right: 0; z-index: 100;
background: rgba(28, 28, 32, 0.97); border: 1px solid rgba(255, 255, 255, 0.14);
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-admin.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-admin.js
index 63cb644..7bc77af 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-admin.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-admin.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// The operator's side: signed operations (the two-step challenge), the node's
// settings and roots, members and invitations.
//
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
index b734d44..96e06d7 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-chat.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// The group chat: history, sending, link previews, and the epoch keys that
// seal it.
//
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-codec.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-codec.js
index eba0461..b2356e8 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-codec.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-codec.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// The wire codec: the subset of msgpack MNP uses (maps, strings, integers,
// binary, arrays, null), and hex for the ids the transport mints.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-devices.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-devices.js
index 1c6fc78..8dbb6c0 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-devices.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-devices.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// An account's devices and what they hold: joining a group, linking a device,
// the identity bundles and the per-account blobs (playlists).
//
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-media.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-media.js
index b4d4048..ca015b9 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-media.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-media.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// What the media apps ask the node for: TMDB and MusicBrainz metadata, audio
// transcoding, subtitles, and the video stream.
//
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-pins.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-pins.js
index c0699dc..c32901b 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-pins.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-pins.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// Which node this browser has met under which key (trust on first use), and
// the version range a node declares at the handshake.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-rewrap.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-rewrap.js
index cdf86b0..fb2f5cf 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-rewrap.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-rewrap.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// A passphrase change, carried to every node that holds this account's
// identity bundle.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-roster.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-roster.js
index ca0769d..cac3b52 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-roster.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-roster.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// What a node says about who is in a group, checked rather than trusted: the
// roster's signatures, and the keys this browser pinned for each account.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport-upload.js b/packages/meshbay-hub/src/meshbay_hub/static/transport-upload.js
index 9f4b531..a8f039d 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport-upload.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport-upload.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
// Uploads: a whole file, sealed chunk by chunk with several in flight, and the
// folders it lands in.
//
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport.js b/packages/meshbay-hub/src/meshbay_hub/static/transport.js
index 279396a..5ed6fa9 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/transport.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/transport.js
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-later
+// Part of MeshBay's protocol layer, under the LGPL so that any client may use it.
/**
* MeshBay Browser Transport — WebRTC DataChannel client.
*
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/vendor/LICENSES.txt b/packages/meshbay-hub/src/meshbay_hub/static/vendor/LICENSES.txt
new file mode 100644
index 0000000..aa2f6a9
--- /dev/null
+++ b/packages/meshbay-hub/src/meshbay_hub/static/vendor/LICENSES.txt
@@ -0,0 +1,268 @@
+Licences of the third-party files in this directory
+====================================================
+
+Each file below is redistributed unmodified; PROVENANCE.md records exactly
+which release it was taken from. This file travels with them wherever the
+interface is copied (hub, desktop client, Android application).
+
+htm-preact.js htm 3.1.1 (Apache-2.0), with Preact 10 bundled into it (MIT)
+argon2.min.js argon2-browser 1.18.0 (MIT), compiling the Argon2 reference
+argon2.wasm implementation (CC0-1.0 OR Apache-2.0; taken under CC0-1.0)
+
+
+==============================================================================
+htm — Apache License 2.0
+==============================================================================
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2018 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+==============================================================================
+Preact — MIT License
+==============================================================================
+
+The MIT License (MIT)
+
+Copyright (c) 2015-present Jason Miller
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+==============================================================================
+argon2-browser — MIT License
+==============================================================================
+
+Copyright © 2021 Antelle
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+==============================================================================
+Argon2 reference implementation — CC0-1.0
+==============================================================================
+
+The Argon2 reference implementation (https://github.com/P-H-C/phc-winner-argon2)
+is dual-licensed under CC0 1.0 Universal or the Apache License 2.0, at the
+recipient's choice. It is used here under CC0 1.0, which waives copyright and
+asks for no notice: https://creativecommons.org/publicdomain/zero/1.0/legalcode
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/vendor/PROVENANCE.md b/packages/meshbay-hub/src/meshbay_hub/static/vendor/PROVENANCE.md
index 6935e91..53d4af3 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/vendor/PROVENANCE.md
+++ b/packages/meshbay-hub/src/meshbay_hub/static/vendor/PROVENANCE.md
@@ -34,3 +34,25 @@ The browser never requests it — `argon2.min.js` carries the same bytes inline
a data URL. It is kept because the cross-language parity test drives the vendored
library under node, where the emscripten loader takes its file path instead of the
inline copy, and a test that cannot run is a test that stops being true.
+
+## htm-preact.js
+
+| | |
+|---|---|
+| Package | `htm` 3.1.1 (npm) — Apache-2.0 |
+| Source | https://registry.npmjs.org/htm/-/htm-3.1.1.tgz |
+| Tarball sha256 | `2425b9bee11409177bcabc7f32e319926fc6690c1701c0b257c88bdff2d5ba90` |
+| Tarball sha1 (npm dist.shasum) | `49266582be0dc66ed2235d5ea892307cc0c24b78` |
+| File taken | `package/preact/standalone.module.js` |
+| File sha256 | `72284e8e9079c87817145df1110f74e8a2aa040b2fc384922e18dfcb46fc1fd7` |
+
+htm's "standalone" build: htm and Preact 10 (MIT) with its hooks, in one ES
+module, so the SPA has a component model without a bundler or a second request.
+The same bytes ship in htm 3.1.0; this entry was identified after the fact, by
+matching the committed file against both releases.
+
+## Licences
+
+`LICENSES.txt`, beside these files, carries the licence text of each of them;
+the MIT and Apache licences both ask for it to travel with every copy. A file
+added here adds its licence there.
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js
index 4757395..aa1edf2 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/video-app.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/video-app.js
@@ -7,6 +7,7 @@ import { formatSize } from './file-utils.js';
import { SourceTag } from './group-name.js';
import { usePager, Pager, pageSizeFrom } from './pager.js';
import { LazyTile, MediaThumb } from './media-tiles.js';
+import { CastButton } from './cast-session.js';
// ── Videos ───────────────────────────────────────────────────────────────────
//
@@ -1083,6 +1084,8 @@ function VideoApp({
</button>
</div>
<${Pager} pager=${pager} />
+ ${/* The television a film opened from here plays on (cast-session.js). */''}
+ <${CastButton} />
${!hideFilter && html`<div class="tb-search">
<${Icon} name="search" />
<input type="text" placeholder="${t('group.filter')}"
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
index 2c424fb..37ea727 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/video-player.js
@@ -6,6 +6,7 @@ import { Icon } from './icon.js';
import { formatSize, CHUNK_SIZE, pipelinedDownload } from './file-utils.js';
import { loadAuth } from './hub-client.js';
import * as platform from './platform.js';
+import { castSession } from './cast-session.js';
// Seconds of already-watched video kept in the SourceBuffer, and the queue depth
// past which we start making room before being forced to.
@@ -484,17 +485,22 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
// Where the stream the node is sending begins, in film time. The same number
// the SourceBuffer gets as its `timestampOffset`.
const streamStartRef = useRef(0);
- const [castActive, setCastActive] = useState(false);
+ // A television already chosen this session (cast-session.js) takes the film
+ // from its first segment: the cast starts as a restart would, pending until
+ // the init segment arrives, and the player opens as its remote. Read once —
+ // a television chosen while this film plays is chosen here, by the picker.
+ const [autoCast] = useState(() => (castSession.supported ? castSession.device : null));
+ const [castActive, setCastActive] = useState(Boolean(autoCast));
const [castUrl, setCastUrl] = useState(null);
const [castPickerOpen, setCastPickerOpen] = useState(false);
const [castDevices, setCastDevices] = useState([]);
const [castScanning, setCastScanning] = useState(false);
- const [castDeviceName, setCastDeviceName] = useState(null);
- const castActiveRef = useRef(false);
+ const [castDeviceName, setCastDeviceName] = useState(autoCast ? autoCast.name : null);
+ const castActiveRef = useRef(Boolean(autoCast));
const castCodecRef = useRef(null);
const initSegmentRef = useRef(null);
- const castRestartPendingRef = useRef(false);
- const castDeviceRef = useRef(null);
+ const castRestartPendingRef = useRef(Boolean(autoCast));
+ const castDeviceRef = useRef(autoCast);
const castRestartGenRef = useRef(0);
// The receiver as last polled: { playerState, position } with the position
// on the film's timeline, or null before it has answered.
@@ -1310,6 +1316,7 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
}).then(async (result) => {
if (castRestartGenRef.current !== gen) return;
if (!result) return;
+ if (device || castSession.device) castSession.claim('video');
setCastUrl(result.url);
const status = await platform.cast.status();
if (status && status.chromecast && status.chromecast.connected) {
@@ -1758,7 +1765,10 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
return () => { stopped = true; clearInterval(id); };
}, [remoteMode]);
+ // Stopping here is stopping for the session: the next film or photo stays
+ // on this device until a television is chosen again.
const stopCast = async () => {
+ castSession.forget();
await platform.cast.chromecastDisconnect().catch(() => {});
await platform.cast.stop();
setCastActive(false); castActiveRef.current = false;
@@ -1896,6 +1906,7 @@ function VideoPlayer({ entry, transportRef, gekRef, onClose, onDownload }) {
${castDevices.map(d => html`
<button class="cast-picker-item" onClick=${() => {
setCastPickerOpen(false);
+ castSession.choose(d);
setCastDeviceName(d.name);
setCastActive(true); castActiveRef.current = true;
castRestartPendingRef.current = true;
diff --git a/packages/meshbay-hub/tests/harness/cast_session_probe.py b/packages/meshbay-hub/tests/harness/cast_session_probe.py
new file mode 100644
index 0000000..573dd95
--- /dev/null
+++ b/packages/meshbay-hub/tests/harness/cast_session_probe.py
@@ -0,0 +1,521 @@
+#!/usr/bin/env python3
+"""
+A television chosen once, then photos and a film sent to it.
+
+Casting a photo or opening a film on a television chosen elsewhere is a claim
+about four pieces at once: the cast button (cast-session.js), the lightbox
+that follows it, the player that opens as a remote, and the native bridge the
+page talks to. This renders the shipped `GroupPage` against a stub node and a
+stub bridge that records what the page asks of it, and walks it as a reader
+would: open an album, choose the television, page on, start a slideshow,
+then open a film from Videos and stop casting from its remote.
+
+A second case renders the same page with no bridge at all — a browser — where
+no cast button may appear.
+
+ cast_session_probe.py Chrome, then Firefox
+"""
+
+import http.server
+import json
+import shutil
+import socketserver
+import subprocess
+import sys
+import tempfile
+import threading
+import time
+from pathlib import Path
+
+STATIC = Path(__file__).resolve().parents[2] / "src" / "meshbay_hub" / "static"
+PORT = 8763
+RECORDS = []
+FINISHED = threading.Event()
+socketserver.TCPServer.allow_reuse_address = True
+
+FRAME = r"""<!doctype html><html><head><meta charset=utf-8>
+<link rel="stylesheet" href="/style.css"></head><body>
+<nav class="nav"><div class="nav-left"><a class="nav-brand" href="#/">MeshBay</a></div></nav>
+<div class="layout"><main class="main"><div id="root"></div></main></div>
+<script>
+// A module that fails to load never reaches its own catch: say so.
+const report = (error) => parent.postMessage({ error }, '*');
+// Scripts only: the music case's stub track is three bytes no <audio>
+// element can decode, which is expected and is not the page failing.
+addEventListener('error', (e) => {
+ if (!(e instanceof ErrorEvent) && !(e.target && e.target.tagName === 'SCRIPT')) return;
+ report(`${e.message || 'load error'} ${e.filename || (e.target && e.target.src) || ''}`
+ + `:${e.lineno || ''}`);
+}, true);
+addEventListener('unhandledrejection',
+ (e) => report(String((e.reason && e.reason.stack) || e.reason)));
+const WITH_BRIDGE = !location.search.includes('nobridge');
+const ENTRIES = [];
+for (let i = 1; i <= 3; i++) {
+ ENTRIES.push({ id: 'p' + i, name: 'photo' + i + '.png', path: 'photos/Trip',
+ type: 'image', size: 1000, added_at: 1750000000 + i });
+}
+ENTRIES.push({ id: 'film', name: 'A.Film.mkv', display_title: 'A Film',
+ path: 'videos/films', type: 'video', duration: 6000, size: 1024, added_at: 1750000100 });
+
+const ACK = {
+ is_node_admin: false, enabled_apps: ['video', 'photo'],
+ tmdb_enabled: true, tmdb_language: 'en-US',
+ video_directories: ['videos'], music_directories: [], photo_directories: ['photos'],
+};
+
+// A camera-sized picture, made here: 4000×3000, which the television must
+// receive as 1440×1080.
+let PHOTO = null;
+async function photoBytes() {
+ if (PHOTO) return PHOTO;
+ const c = document.createElement('canvas');
+ c.width = 4000; c.height = 3000;
+ const g = c.getContext('2d');
+ g.fillStyle = '#3a7'; g.fillRect(0, 0, 4000, 3000);
+ const blob = await new Promise((r) => c.toBlob(r, 'image/png'));
+ PHOTO = new Uint8Array(await blob.arrayBuffer());
+ return PHOTO;
+}
+
+window.MeshBayCrypto = {
+ importGEK: async () => 'gek',
+ b64encode: (x) => String(x),
+ decryptChunkBin: async (_g, _f, _i, _n, ct) => ct,
+};
+
+window.MeshBayTransport = function () {
+ const self = {
+ connected: false, memberRole: 'member', supportsAppOps: true,
+ sessionKeys: null, gekRaw: 'k',
+ newNodeBundle: null, newNodeBundleRecovery: null,
+ async connect() { self.connected = true; return ACK; },
+ async fetchIndex() {
+ return { entries: ENTRIES, dirs: ['photos', 'videos'],
+ roots: [{ name: 'photos', available: true, writable: false, removable: false },
+ { name: 'videos', available: true, writable: false, removable: false }] };
+ },
+ async fetchMediaMeta() { return { confidence: 0 }; },
+ // One chunk per photo: every photo is the same picture.
+ async fetchChunk() { return { nonce: 'n', ct: await photoBytes() }; },
+ addReconnectListener() { return () => {}; },
+ close() {},
+ };
+ return new Proxy(self, {
+ get(target, prop) {
+ if (prop in target) return target[prop];
+ if (typeof prop === 'string' && prop.startsWith('on')) return undefined;
+ if (typeof prop === 'symbol') return undefined;
+ return () => new Promise(() => {});
+ },
+ set(target, prop, value) { target[prop] = value; return true; },
+ });
+};
+
+// The native side, as the Electron preload and the Android shim present it,
+// recording every cast call.
+window.CALLS = [];
+// What the stub receiver reports: the music case moves it along.
+window.TV = { state: 'IDLE', position: 0, idle: null };
+if (WITH_BRIDGE) {
+ let connected = false, v = 0;
+ const rec = (name, arg) => { CALLS.push({ name, arg }); };
+ window.meshbay = {
+ hubBase: () => '',
+ setLocale: async () => true,
+ capabilities: { lanCast: true, nodeAdmin: false, localFolders: false, nativeSave: false },
+ cast: {
+ start: async (o) => {
+ rec('start', o && { codec: o.codec });
+ return { url: 'http://tv/stream.mp4?t=x' };
+ },
+ push: async () => true,
+ stop: async () => { rec('stop'); return true; },
+ subtitle: async () => null,
+ finish: async () => true,
+ file: async (f) => {
+ let info = { type: f.type, size: f.bytes.length, title: f.title || null,
+ artist: f.artist || null, album: f.album || null, cover: !!f.cover };
+ if (f.type.startsWith('image/')) {
+ const bmp = await createImageBitmap(new Blob([f.bytes], { type: f.type }));
+ info = { ...info, width: bmp.width, height: bmp.height,
+ jpeg: f.bytes[0] === 0xff && f.bytes[1] === 0xd8 };
+ }
+ rec('file', info);
+ return { url: 'http://tv/file?t=x&v=' + (++v) };
+ },
+ status: async () => ({ active: true, url: null, chromecast: {
+ connected, playerState: TV.state, position: TV.position, idleReason: TV.idle } }),
+ scan: async () => { rec('scan'); return true; },
+ devices: async () => ({ devices: [{ id: 'tv1', name: 'Salon' }], scanning: false }),
+ chromecastConnect: async (o) => {
+ rec('connect', o); connected = true;
+ return { deviceName: 'Salon' };
+ },
+ chromecastReload: async (o) => { rec('reload', o); return { playerState: 'IDLE' }; },
+ chromecastDisconnect: async () => { rec('disconnect'); connected = false; return true; },
+ chromecastPause: async () => { rec('pause'); TV.state = 'PAUSED'; return {}; },
+ chromecastPlay: async () => { rec('play'); TV.state = 'PLAYING'; return {}; },
+ chromecastSeek: async (t) => { rec('seek', t); TV.position = t; return {}; },
+ },
+ };
+}
+</script>
+<script type="module">
+import { html, render } from '/vendor/htm-preact.js';
+import { initLocale } from '/i18n.js';
+import { GroupPage } from '/group-page.js';
+
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+const $ = (sel) => document.querySelector(sel);
+const $$ = (sel) => [...document.querySelectorAll(sel)];
+async function until(pred, what, tries = 200) {
+ for (let i = 0; i < tries; i++) { if (pred()) return; await sleep(50); }
+ throw new Error('timed out waiting for ' + what);
+}
+const calls = (name) => CALLS.filter((c) => c.name === name);
+const files = () => calls('file').map((c) => c.arg);
+// Files is always first; then the enabled apps in their registry order.
+const videosTab = () => $$('.group-tab')[1];
+const count = () => (($('.photo-lightbox-count') || {}).textContent || '').trim();
+
+// The music bar, with a television already chosen: two tracks of one album.
+async function music() {
+ const { MusicPlayerBar } = await import('/music-player.js');
+ const { castSession } = await import('/cast-session.js');
+ const out = {};
+ castSession.choose({ id: 'tv1', name: 'Salon' });
+ // Which hashes were fetched, so a cover can be traced to where it came from.
+ window.FETCHED = [];
+ const transport = { connected: true, async waitForReconnect() {},
+ async fetchChunk(id) {
+ FETCHED.push(id);
+ return { nonce: 'n', ct: new Uint8Array([1, 2, 3]) };
+ },
+ // The node's MusicBrainz answer: a cover for the other album only.
+ async fetchMusicMeta(id) {
+ CALLS.push({ name: 'musicMeta', arg: id });
+ return id === 't3' ? { confidence: 1, cover_thumb_hash: 'mb-cover' }
+ : { confidence: 0 };
+ } };
+ const getConnection = async () => ({ transport, gek: 'gek' });
+ // One has no cover of its own but Two, of the same album, has; Three is of
+ // another album whose only cover is the one the node found.
+ const track = (n, title, album, hash) => ({ id: 't' + n, name: title + '.mp3', size: 3,
+ groupId: 'g1', display_title: title, artist: 'Some Band', album, duration: 200,
+ thumb_hash: hash });
+ const queue = { tracks: [track(1, 'One', 'An Album', null), track(2, 'Two', 'An Album', 'cover2'),
+ track(3, 'Three', 'Another Album', null)], startIndex: 0, nonce: 1 };
+ render(html`<${MusicPlayerBar} getConnection=${getConnection} queue=${queue}
+ userPrefs=${{}} onClose=${() => {}} />`, document.getElementById('root'));
+
+ await until(() => calls('connect').length === 1, 'the first track on the television');
+ out.first = { file: files()[0], connect: calls('connect')[0].arg,
+ coverFetched: FETCHED.includes('cover2') };
+ TV.state = 'PLAYING'; TV.position = 12;
+ await until(() => ($$('.music-player-time')[0] || {}).textContent === '0:12',
+ "the television's clock in the bar");
+ out.barButton = !!$('.music-player-bar .cast-btn.casting');
+ out.volumeDisabled = $('.music-player-volume input').disabled;
+
+ $('.music-player-play').click();
+ await until(() => calls('pause').length === 1, 'pause on the television');
+ const slider = $('.music-player-seek input');
+ slider.value = '30';
+ slider.dispatchEvent(new Event('input', { bubbles: true }));
+ await until(() => calls('seek').length === 1, 'a seek on the television');
+ out.seek = calls('seek')[0].arg;
+
+ // The television finishes the track: the next one goes, once.
+ TV.state = 'IDLE'; TV.idle = 'FINISHED';
+ await until(() => calls('reload').length === 1, 'the next track on the television');
+ out.second = { file: files()[1], reload: calls('reload')[0].arg,
+ title: $('.music-player-title').textContent.trim() };
+ TV.state = 'PLAYING'; TV.idle = null; TV.position = 1;
+ await sleep(2500);
+ out.filesAfterSettling = files().length;
+
+ // Three: the cover comes from the node's answer for its album.
+ TV.state = 'IDLE'; TV.idle = 'FINISHED';
+ await until(() => calls('reload').length === 2, 'the third track on the television');
+ out.third = { file: files()[2], mbCover: FETCHED.includes('mb-cover'),
+ metaAsked: calls('musicMeta').map((c) => c.arg) };
+ TV.state = 'PLAYING'; TV.idle = null;
+
+ // Stopping the cast lets the television go.
+ await castSession.end();
+ await sleep(200);
+ out.afterStop = { disconnects: calls('disconnect').length,
+ barCasting: !!$('.music-player-bar .cast-btn.casting') };
+ parent.postMessage(out, '*');
+}
+
+(async () => {
+ const out = { bridge: !!window.meshbay };
+ if (location.search.includes('music')) {
+ try { await initLocale(); await music(); }
+ catch (err) {
+ parent.postMessage({ calls: CALLS, error: String((err && err.stack) || err) }, '*');
+ }
+ return;
+ }
+ try {
+ await initLocale();
+ render(html`<${GroupPage} groupId="g1" token="t" username="me" userId="u1"
+ group=${{ id: 'g1', name: 'a group', owner_username: 'me', is_admin: false }}
+ userPrefs=${{ default_tab: 'photo', media_page_size: '50' }} />`,
+ document.getElementById('root'));
+
+ await until(() => $('.photo-album-card'), 'the album card');
+ out.landingButton = !!$('.photo-toolbar .cast-btn');
+ $('.photo-album-card').click();
+ await until(() => $('.photo-album-bar'), 'the album');
+ out.albumButton = !!$('.photo-album-bar .cast-btn');
+
+ if (!window.meshbay) {
+ videosTab().click();
+ await until(() => $('.video-toolbar'), 'the videos toolbar');
+ out.videosButton = !!$('.video-toolbar .cast-btn');
+ parent.postMessage(out, '*');
+ return;
+ }
+
+ // Choose the television from the album: the first photo opens and goes.
+ $('.photo-album-bar .cast-btn').click();
+ await until(() => $$('.cast-menu .ctx-menu-item').some((b) => b.textContent.includes('Salon')),
+ 'the receiver in the menu');
+ $$('.cast-menu .ctx-menu-item').find((b) => b.textContent.includes('Salon')).click();
+ await until(() => $('.photo-lightbox'), 'the lightbox to open on choosing');
+ await until(() => calls('connect').length === 1, 'the first photo to reach the television');
+ out.first = { count: count(), image: files()[0], connect: calls('connect')[0].arg,
+ lightboxCasting: !!$('.photo-lightbox .cast-btn.casting') };
+
+ // Next photo: the receiver is connected, so it is reloaded.
+ $('.photo-nav-next').click();
+ await until(() => calls('reload').length === 1, 'the second photo');
+ out.second = { count: count(), reload: calls('reload')[0].arg, images: files().length };
+
+ // Slideshow: on by itself to the last photo, then off.
+ const play = $$('.photo-lightbox .video-top-bar .video-close')
+ .find((b) => b.getAttribute('aria-pressed') !== null);
+ play.click();
+ await until(() => count() === '3 / 3', 'the slideshow to reach the last photo', 160);
+ await until(() => play.getAttribute('aria-pressed') === 'false', 'the slideshow to end', 160);
+ out.slideshow = { count: count(), images: files().length,
+ reloads: calls('reload').length };
+
+ // Close the lightbox; Videos shows the same television; a film opens as its remote.
+ $$('.photo-lightbox .video-top-bar .video-close').pop().click();
+ await until(() => !$('.photo-lightbox'), 'the lightbox to close');
+ videosTab().click();
+ await until(() => $('.video-toolbar'), 'the videos toolbar');
+ out.videosCasting = !!$('.video-toolbar .cast-btn.casting');
+ await until(() => $('.video-card'), 'the film card');
+ $('.video-card').click();
+ await until(() => $('.video-detail .admin-btn'), 'the film modal');
+ $('.video-detail .admin-btn').click();
+ await until(() => $('.video-remote'), 'the player as a remote');
+ out.remote = { device: $('.video-remote-device').textContent.trim(),
+ pickerOpen: !!$('.video-player-overlay .cast-picker') };
+
+ // Stop from the remote: forgotten for the session.
+ $$('.video-remote button').pop().click();
+ await until(() => !$('.video-remote'), 'the remote to go');
+ $$('.video-player-overlay .video-top-bar .video-close').pop().click();
+ await until(() => !$('.video-player-overlay'), 'the player to close');
+ await sleep(100);
+ out.afterStop = { videosCasting: !!$('.video-toolbar .cast-btn.casting'),
+ disconnects: calls('disconnect').length };
+ parent.postMessage(out, '*');
+ } catch (err) {
+ parent.postMessage({ ...out, calls: CALLS, error: String((err && err.stack) || err) }, '*');
+ }
+})();
+</script></body></html>"""
+
+# Firefox headless runs a page only while taking its screenshot, which is taken
+# once the page has loaded: an image that does not answer until the case has
+# reported keeps it loading (the same hold as invitation_probe.py).
+HOLD_TAG = '<img src="/hold" style="position:fixed;left:-4px;top:-4px;width:1px">'
+
+PAGE = r"""<!doctype html><html><head><meta charset=utf-8></head>
+<body style="margin:0">
+<iframe src="/case{query}" style="width:1100px;height:800px;border:0"></iframe>
+<script>
+addEventListener('message', (e) => fetch('/log', { method: 'POST', body: JSON.stringify(e.data) }));
+</script>{hold}</body></html>"""
+
+
+class H(http.server.BaseHTTPRequestHandler):
+ def log_message(self, *a):
+ pass
+
+ def do_POST(self):
+ length = int(self.headers.get("Content-Length") or 0)
+ if self.path == "/log":
+ RECORDS.append(json.loads(self.rfile.read(length).decode()))
+ FINISHED.set()
+ else:
+ self.rfile.read(length)
+ self.send_response(204)
+ self.end_headers()
+
+ def _send(self, body: bytes, ctype: str) -> None:
+ self.send_response(200)
+ self.send_header("Content-Type", ctype)
+ self.send_header("Content-Length", str(len(body)))
+ self.end_headers()
+ self.wfile.write(body)
+
+ def do_GET(self):
+ path, _, query = self.path.partition("?")
+ if path == "/hold":
+ FINISHED.wait(90)
+ self._send(b"", "image/gif")
+ elif path == "/":
+ q = f"?{query.replace('engine=firefox', '').strip('&')}" if query else ""
+ hold = HOLD_TAG if "engine=firefox" in query else ""
+ page = PAGE.replace("{query}", q if q != "?" else "").replace("{hold}", hold)
+ self._send(page.encode(), "text/html; charset=utf-8")
+ elif path == "/case":
+ self._send(FRAME.encode(), "text/html; charset=utf-8")
+ elif path == "/v1/groups/g1/nodes":
+ self._send(b'{"nodes": [{"node_id": "n1"}]}', "application/json")
+ else:
+ asset = (STATIC / path.lstrip("/")).resolve()
+ if not str(asset).startswith(str(STATIC)) or not asset.is_file():
+ self.send_response(404)
+ self.end_headers()
+ return
+ self._send(asset.read_bytes(),
+ "text/css" if asset.suffix == ".css"
+ else "text/javascript" if asset.suffix == ".js"
+ else "application/octet-stream")
+
+
+def browse(engine: str, query: str) -> dict | None:
+ RECORDS.clear()
+ FINISHED.clear()
+ sep = "&" if query else "?"
+ url = f"http://127.0.0.1:{PORT}/{query}{sep + 'engine=firefox' if engine == 'firefox' else ''}"
+ # Firefox is a snap here, and needs its profile under $HOME (invitation_probe.py).
+ snap = Path.home() / "snap" / "firefox" / "common"
+ parent = (str(snap if snap.is_dir() else Path.home()) if engine == "firefox" else None)
+ with tempfile.TemporaryDirectory(ignore_cleanup_errors=True, prefix="meshbay-probe-",
+ dir=parent) as profile:
+ if engine == "chrome":
+ cmd = ["google-chrome", "--headless=new", "--disable-gpu", "--no-sandbox",
+ f"--user-data-dir={profile}", "--window-size=1100,900", url]
+ else:
+ cmd = ["firefox", "--headless", "--profile", profile, "--window-size=1100,900",
+ "--screenshot", str(Path(profile) / "shot.png"), url]
+ proc = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ deadline = time.time() + 90
+ while not RECORDS and time.time() < deadline:
+ time.sleep(0.2)
+ proc.terminate()
+ try:
+ proc.wait(timeout=20)
+ except subprocess.TimeoutExpired:
+ proc.kill()
+ proc.wait()
+ return RECORDS[0] if RECORDS else None
+
+
+def check(engine: str, cast: dict, plain: dict) -> list[str]:
+ bad = []
+ if "error" in cast:
+ return [f"{engine}: {cast['error']}"]
+ if not cast["landingButton"]:
+ bad.append("no cast button on the Photos landing")
+ if not cast["albumButton"]:
+ bad.append("no cast button in the album bar")
+ first = cast["first"]
+ if first["count"] != "1 / 3":
+ bad.append(f"choosing a television did not open the first photo: {first['count']}")
+ img = first["image"]
+ if not (img["type"] == "image/jpeg" and img["jpeg"] and img["width"] == 1440
+ and img["height"] == 1080):
+ bad.append(f"the photo did not leave as a 1440x1080 JPEG: {img}")
+ if first["connect"] != {"deviceId": "tv1", "mediaUrl": "http://tv/file?t=x&v=1",
+ "startAt": 0}:
+ bad.append(f"connect: {first['connect']}")
+ if not first["lightboxCasting"]:
+ bad.append("the lightbox's cast button does not say it is casting")
+ if cast["second"]["count"] != "2 / 3" or cast["second"]["reload"] != {
+ "mediaUrl": "http://tv/file?t=x&v=2", "startAt": 0}:
+ bad.append(f"next photo: {cast['second']}")
+ if cast["slideshow"]["count"] != "3 / 3" or cast["slideshow"]["images"] != 3:
+ bad.append(f"slideshow: {cast['slideshow']}")
+ if not cast["videosCasting"]:
+ bad.append("Videos does not show the television chosen in Photos")
+ if cast["remote"]["device"] != "Salon" or cast["remote"]["pickerOpen"]:
+ bad.append(f"the film did not open as the television's remote: {cast['remote']}")
+ if cast["afterStop"]["videosCasting"] or cast["afterStop"]["disconnects"] < 1:
+ bad.append(f"stopping from the remote: {cast['afterStop']}")
+ if "error" in plain:
+ bad.append(f"no bridge: {plain['error']}")
+ elif plain["landingButton"] or plain["albumButton"] or plain["videosButton"]:
+ bad.append(f"a cast button without a bridge: {plain}")
+ return [f"{engine}: {b}" for b in bad]
+
+
+def check_music(engine: str, m: dict) -> list[str]:
+ if "error" in m:
+ return [f"{engine}: music: {m['error']}"]
+ bad = []
+ f = m["first"]["file"]
+ if not (f["type"] == "audio/mpeg" and f["title"] == "One" and f["artist"] == "Some Band"
+ and f["album"] == "An Album" and f["cover"] and m["first"]["coverFetched"]):
+ bad.append(f"the first track left without its album's cover: {m['first']}")
+ third = m["third"]
+ if not (third["file"]["title"] == "Three" and third["file"]["cover"] and third["mbCover"]):
+ bad.append(f"the node's cover did not reach the television: {third}")
+ if "t1" in third["metaAsked"] or "t2" in third["metaAsked"]:
+ bad.append(f"the node was asked for a cover a track already had: {third['metaAsked']}")
+ if m["first"]["connect"] != {"deviceId": "tv1", "mediaUrl": "http://tv/file?t=x&v=1",
+ "startAt": 0}:
+ bad.append(f"connect: {m['first']['connect']}")
+ if not m["barButton"]:
+ bad.append("the music bar's cast button does not say it is casting")
+ if not m["volumeDisabled"]:
+ bad.append("the volume slider still acts while casting")
+ if m["seek"] != 30:
+ bad.append(f"seek: {m['seek']}")
+ s = m["second"]
+ if s["file"]["title"] != "Two" or s["title"] != "Two" or s["reload"] != {
+ "mediaUrl": "http://tv/file?t=x&v=2", "startAt": 0}:
+ bad.append(f"the end of a track did not move the queue on: {s}")
+ if m["filesAfterSettling"] != 2:
+ bad.append(f"a finished track moved the queue on more than once: {m['filesAfterSettling']}")
+ if m["afterStop"]["disconnects"] < 1 or m["afterStop"]["barCasting"]:
+ bad.append(f"stopping: {m['afterStop']}")
+ return [f"{engine}: music: {b}" for b in bad]
+
+
+def main() -> int:
+ failures = []
+ with socketserver.ThreadingTCPServer(("127.0.0.1", PORT), H) as srv:
+ threading.Thread(target=srv.serve_forever, daemon=True).start()
+ for engine in ("chrome", "firefox"):
+ if shutil.which("google-chrome" if engine == "chrome" else engine) is None:
+ print(f"{engine}: not installed, skipped")
+ continue
+ cast = browse(engine, "")
+ plain = browse(engine, "?nobridge")
+ music = browse(engine, "?music")
+ if cast is None or plain is None or music is None:
+ failures.append(f"{engine}: the page never reported")
+ continue
+ print(f"{engine}:", json.dumps({"photos-videos": cast, "music": music}, indent=1))
+ failures += check(engine, cast, plain)
+ failures += check_music(engine, music)
+ for f in failures:
+ print("FAIL", f, file=sys.stderr)
+ if not failures:
+ print("OK")
+ return 1 if failures else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/packages/meshbay-hub/tests/test_android_cast.py b/packages/meshbay-hub/tests/test_android_cast.py
index bc5264e..ebcdec4 100644
--- a/packages/meshbay-hub/tests/test_android_cast.py
+++ b/packages/meshbay-hub/tests/test_android_cast.py
@@ -103,12 +103,14 @@ def test_the_receiver_is_pointed_at_the_relay_and_nothing_else():
def test_relay_calls_keep_their_order():
"""The page does not await each push; on a pool they could overtake."""
channels = _read(CAST / "CastChannels.kt")
- assert '"cast:start", "cast:push", "cast:subtitle", "cast:finish", "cast:stop"' in channels
+ assert '"cast:start", "cast:push", "cast:subtitle",' in channels
+ assert ('"cast:file:begin", "cast:file:write", "cast:file:end", "cast:finish", "cast:stop"'
+ in channels)
bridge = _read(SRC / "bridge" / "Bridge.kt")
assert "Executors.newSingleThreadExecutor()" in bridge
assert "(if (ordered) serial else work).execute" in bridge
- assert "fun ordered(frame: BinaryFrame) = frame.channel == BinaryFrame.CAST_PUSH" in _read(
- SRC / "bridge" / "Channels.kt")
+ assert ("fun ordered(frame: BinaryFrame) = frame.channel == BinaryFrame.CAST_PUSH"
+ " || frame.channel == BinaryFrame.CAST_FILE") in _read(SRC / "bridge" / "Channels.kt")
def test_screen_off_survival_is_switched_on_only_while_casting_or_playing():
diff --git a/packages/meshbay-hub/tests/test_cast_files.py b/packages/meshbay-hub/tests/test_cast_files.py
new file mode 100644
index 0000000..8f51d80
--- /dev/null
+++ b/packages/meshbay-hub/tests/test_cast_files.py
@@ -0,0 +1,372 @@
+"""
+Whole files on a cast receiver — photos and music tracks — and the television
+a session casts to.
+
+A file takes a different road to the television than a film: no stream, one
+file at a time, handed to the relay in pieces (begin, writes, end), served at
+`/file` with its cover at `/cover`, and loaded by the default media receiver
+as a picture or as a music track. The page scales and re-encodes a photo
+first (cast-session.js); a track goes as it is stored.
+
+The first half runs the desktop relay itself, as test_cast_subtitles.py does:
+it is plain Node with no dependencies. The file is behind the same token as
+the stream, its address changes with every file — a receiver handed the same
+URL twice shows what it already has — ranges are honoured, because that is how
+a receiver seeks in a track, and only a picture or a sound is served as one.
+
+The second half holds the wiring: what the receiver loads is the shell's to
+say, never the page's; Android accepts no URL but the relay's own; a
+television chosen anywhere is the one a film opens on, with the player as its
+remote from the start; and the music bar drives the television once one is
+chosen.
+"""
+
+import json
+import re
+import shutil
+import subprocess
+from pathlib import Path
+
+import pytest
+
+PACKAGES = Path(__file__).resolve().parents[2]
+STATIC = PACKAGES / "meshbay-hub" / "src" / "meshbay_hub" / "static"
+DESKTOP = PACKAGES / "meshbay-client" / "src"
+RELAY = DESKTOP / "cast-relay.js"
+CHROMECAST = DESKTOP / "cast-chromecast.js"
+ANDROID_MAIN = PACKAGES / "meshbay-android" / "app" / "src" / "main"
+ANDROID_SRC = ANDROID_MAIN / "kotlin"
+CLIENT = ANDROID_SRC / "org" / "meshbay" / "client"
+CAST = CLIENT / "cast"
+SHIM = ANDROID_MAIN / "assets" / "bridge" / "meshbay-bridge.js"
+
+
+def _read(path: Path) -> str:
+ return path.read_text(encoding="utf-8")
+
+
+RELAY_SCRIPT = r"""
+const http = require('node:http');
+const CastRelay = require(process.argv[2]);
+const get = (url, headers = {}) => new Promise((resolve, reject) => {
+ http.get(url, { headers }, (res) => {
+ const parts = [];
+ res.on('data', (c) => parts.push(c));
+ res.on('end', () => resolve({ status: res.statusCode, headers: res.headers,
+ body: Buffer.concat(parts).toString('hex') }));
+ }).on('error', reject);
+});
+const refused = async (f) => { try { await f(); return false; } catch { return true; } };
+const send = async (relay, bytes, opts) => {
+ await relay.beginFile({ size: bytes.length, ...opts });
+ for (let at = 0; at < bytes.length; at += 3) relay.writeFile(bytes.subarray(at, at + 3));
+ return relay.endFile();
+};
+(async () => {
+ const relay = new CastRelay();
+ const out = {};
+ out.activeBefore = relay.active;
+ out.htmlRefused = await refused(() => relay.beginFile({ type: 'text/html', size: 3 }));
+ out.activeAfterRefusal = relay.active;
+
+ const jpeg = Buffer.from([0xff, 0xd8, 1, 2, 0xff, 0xd9]);
+ const first = await send(relay, jpeg, { type: 'image/jpeg' });
+ out.activeAfterPhoto = relay.active;
+ out.firstUrl = first.url;
+ out.photo = await get(first.url);
+ out.badToken = (await get(first.url.replace(/t=[0-9a-f]+/, 't=x'))).status;
+ out.photoMeta = relay.fileMeta;
+
+ // A track, its cover and what to show with it; read back whole and by range.
+ const track = Buffer.from([...Array(20).keys()]);
+ const second = await send(relay, track, {
+ type: 'audio/flac', title: 'A Song', artist: 'Some Band', album: 'An Album',
+ cover: { bytes: Buffer.from([0xff, 0xd8, 7, 0xff, 0xd9]), type: 'image/jpeg' } });
+ out.secondUrl = second.url;
+ out.trackType = relay.fileType;
+ out.trackMeta = relay.fileMeta;
+ out.whole = await get(second.url);
+ out.range = await get(second.url, { Range: 'bytes=5-9' });
+ out.tail = await get(second.url, { Range: 'bytes=15-' });
+ out.beyond = (await get(second.url, { Range: 'bytes=50-60' })).status;
+ out.cover = await get(relay.fileMeta.cover);
+
+ // Fewer bytes than announced is not a file; more is refused as they come.
+ await relay.beginFile({ type: 'audio/mpeg', size: 10 });
+ relay.writeFile(Buffer.from([1, 2, 3]));
+ out.shortRefused = await refused(() => relay.endFile());
+ await relay.beginFile({ type: 'audio/mpeg', size: 2 });
+ out.longRefused = await refused(() => relay.writeFile(Buffer.from([1, 2, 3])));
+ out.stillServed = (await get(second.url)).status;
+
+ await relay.start({});
+ out.fileAfterFilm = relay.fileUrl;
+ await send(relay, jpeg, { type: 'image/jpeg' });
+ await relay.stop();
+ out.fileAfterStop = relay.fileUrl;
+ console.log(JSON.stringify(out));
+})().catch((e) => { console.error(e); process.exit(1); });
+"""
+
+
+@pytest.fixture(scope="module")
+def relay_run(tmp_path_factory):
+ if shutil.which("node") is None or not RELAY.exists():
+ pytest.skip("node or the desktop client sources are not available")
+ script = tmp_path_factory.mktemp("cf") / "relay.cjs"
+ script.write_text(RELAY_SCRIPT, encoding="utf-8")
+ proc = subprocess.run(["node", str(script), str(RELAY)],
+ capture_output=True, text=True, encoding="utf-8", timeout=30)
+ assert proc.returncode == 0, proc.stderr
+ return json.loads(proc.stdout)
+
+
+def test_a_file_starts_the_relay_and_is_served_behind_its_token(relay_run):
+ assert relay_run["activeBefore"] is False
+ assert relay_run["activeAfterPhoto"] is True
+ photo = relay_run["photo"]
+ assert photo["status"] == 200
+ assert photo["headers"]["content-type"] == "image/jpeg"
+ assert photo["headers"]["cache-control"] == "no-store"
+ assert photo["body"] == "ffd80102ffd9"
+ assert relay_run["badToken"] == 403
+ assert relay_run["photoMeta"]["cover"] is None
+
+
+def test_every_file_has_its_own_address(relay_run):
+ assert re.search(r"/file\?t=[0-9a-f]{32}&v=\d+$", relay_run["firstUrl"])
+ assert relay_run["secondUrl"] != relay_run["firstUrl"]
+
+
+def test_a_track_is_served_with_its_cover_and_what_it_is(relay_run):
+ assert relay_run["trackType"] == "audio/flac"
+ meta = relay_run["trackMeta"]
+ assert (meta["title"], meta["artist"], meta["album"]) == ("A Song", "Some Band", "An Album")
+ assert re.search(r"/cover\?t=[0-9a-f]{32}&v=\d+$", meta["cover"])
+ assert relay_run["cover"]["status"] == 200
+ assert relay_run["cover"]["body"] == "ffd807ffd9"
+ assert relay_run["whole"]["body"] == bytes(range(20)).hex()
+ assert relay_run["whole"]["headers"]["accept-ranges"] == "bytes"
+
+
+def test_a_receiver_seeks_in_a_track_by_range(relay_run):
+ r = relay_run["range"]
+ assert r["status"] == 206
+ assert r["headers"]["content-range"] == "bytes 5-9/20"
+ assert r["body"] == bytes(range(5, 10)).hex()
+ tail = relay_run["tail"]
+ assert tail["status"] == 206 and tail["body"] == bytes(range(15, 20)).hex()
+ assert relay_run["beyond"] == 416
+
+
+def test_only_a_whole_picture_or_sound_is_served(relay_run):
+ assert relay_run["htmlRefused"] is True
+ assert relay_run["activeAfterRefusal"] is False, "a refused file starts nothing"
+ assert relay_run["shortRefused"] is True
+ assert relay_run["longRefused"] is True
+ assert relay_run["stillServed"] == 200, "a failed send leaves the shown file alone"
+
+
+def test_a_film_or_a_stop_takes_the_file_down(relay_run):
+ assert relay_run["fileAfterFilm"] is None
+ assert relay_run["fileAfterStop"] is None
+
+
+def test_the_receiver_loads_a_photo_as_a_picture_and_a_track_as_music():
+ if shutil.which("node") is None or not CHROMECAST.exists():
+ pytest.skip("node or the desktop client sources are not available")
+ script = (
+ "const Module = require('node:module');"
+ "const real = Module._load;"
+ "Module._load = function (r, ...a) {"
+ " if (r === 'bonjour-service') return { Bonjour: class {} };"
+ " if (r === 'castv2-client') return { Client: class {}, DefaultMediaReceiver: {} };"
+ " return real.call(this, r, ...a); };"
+ f"const {{ mediaFor, loadOptionsFor }} = require({json.dumps(str(CHROMECAST))});"
+ "const meta = { title: 'A Song', artist: 'Some Band', album: 'An Album',"
+ " cover: 'http://x/cover?t=a&v=2' };"
+ "console.log(JSON.stringify({"
+ " photo: mediaFor('http://x/file?t=a&v=1', null,"
+ " { contentType: 'image/jpeg', meta: { cover: null } }),"
+ " track: mediaFor('http://x/file?t=a&v=2', null, { contentType: 'audio/flac', meta }),"
+ " from: loadOptionsFor(null, 42.5),"
+ " film: mediaFor('http://x/stream.mp4?t=a', null, null),"
+ " filmOptions: loadOptionsFor(null, 0),"
+ " legacy: mediaFor('http://x/stream.mp4?t=a', null) }));")
+ proc = subprocess.run(["node", "-e", script], capture_output=True, text=True,
+ encoding="utf-8", timeout=30)
+ assert proc.returncode == 0, proc.stderr
+ out = json.loads(proc.stdout)
+ assert out["photo"]["contentType"] == "image/jpeg"
+ assert out["photo"]["streamType"] == "NONE"
+ assert "tracks" not in out["photo"]
+ track = out["track"]
+ assert track["contentType"] == "audio/flac" and track["streamType"] == "BUFFERED"
+ assert track["metadata"] == {"metadataType": 3, "title": "A Song", "artist": "Some Band",
+ "albumName": "An Album",
+ "images": [{"url": "http://x/cover?t=a&v=2"}]}
+ assert out["from"]["currentTime"] == 42.5
+ assert "currentTime" not in out["filmOptions"]
+ assert out["film"] == out["legacy"], "a film is loaded exactly as before"
+ assert out["film"]["streamType"] == "LIVE" and out["film"]["contentType"] == "video/mp4"
+
+
+def test_the_shell_not_the_page_says_what_the_receiver_loads():
+ """The page names a URL; what it is, is the relay's to say. A page that
+ could name the content type could have a television load the stream as
+ anything at all."""
+ main = _read(DESKTOP / "main.js")
+ load_of = main.split("const loadOf = ", 1)[1].split("\n\n", 1)[0]
+ assert "mediaUrl === castRelay.fileUrl" in load_of
+ assert "contentType: castRelay.fileType, meta: castRelay.fileMeta" in load_of
+ assert "subtitle: null" in load_of, "a file carries no subtitle"
+ assert main.count("loadOf(mediaUrl, subtitle)") == 2, "connect and reload both"
+ # A start position means something for a file only; a film starts where
+ # its relay does.
+ assert main.count("l.file ? startAt : 0") == 2
+
+
+def test_android_accepts_the_relays_file_and_nothing_else():
+ if not CAST.exists():
+ pytest.skip("android sources not present")
+ channels = _read(CAST / "CastChannels.kt")
+ check = channels.split("private fun relayUrl(", 1)[1].split("\n }", 1)[0]
+ assert "asked != ours && asked != relay.fileUrl" in check
+ assert 'put("contentType", relay.fileType).put("meta", relay.fileMeta()' in channels
+ assert "url == relay.fileUrl -> null" in channels, "a file carries no subtitle"
+ assert 'if (url == relay.fileUrl) maxOf(0.0, o.optDouble("startAt", 0.0)) else 0.0' in channels
+ # A file is not a cast that has to survive the screen going off.
+ begin = channels.split('"cast:file:begin" ->', 1)[1].split('"cast:file:end"', 1)[0]
+ assert "onCasting" not in begin
+ relay = _read(CAST / "CastRelay.kt")
+ assert '"/file" -> serveFile(out, socket, range)' in relay
+ assert '"/cover" -> serveCover(out, socket)' in relay
+ serve = relay.split("private fun serve(", 1)[1]
+ assert serve.index('query["t"] != token') < serve.index('"/file"'), "behind the token"
+ # On disk, never held: a long lossless track is a few hundred megabytes.
+ assert 'File(spoolDir, "file-${fileSeq.incrementAndGet()}.bin")' in relay
+ assert "java.io.FileOutputStream(slot.path)" in relay
+ control = _read(CAST / "CastControl.kt")
+ assert "MediaInfo.STREAM_TYPE_NONE" in control
+ assert "MediaMetadata.MEDIA_TYPE_PHOTO" in control
+ assert "MediaMetadata.MEDIA_TYPE_MUSIC_TRACK" in control
+ assert "MediaInfo.STREAM_TYPE_BUFFERED" in control
+ assert "setCurrentTime((startAt * 1000).toLong())" in control
+ assert "MediaSeekOptions.Builder().setPosition(" in control
+ # Loaded is shown: a photo never reaches PLAYING, and waiting for it
+ # would hold every photo for the full fifteen seconds.
+ load = control.split("private fun load(", 1)[1]
+ assert load.index("if (photo) return") < load.index("PLAY_WAIT_MS")
+
+
+def test_a_file_crosses_the_android_bridge_in_binary_pieces():
+ """One message the size of a lossless track would be the WebView's to
+ refuse; a file goes in pieces of a megabyte, as binary frames where the
+ WebView has them."""
+ if not SHIM.exists():
+ pytest.skip("android sources not present")
+ shim = _read(SHIM)
+ assert "const CAST_FILE = 3;" in shim
+ assert "const FILE_PIECE = 1024 * 1024;" in shim
+ assert ("BINARY ? sendBinary(CAST_FILE, 0, piece) : call('cast:file:write', base64Of(piece))"
+ in shim)
+ assert "const val CAST_FILE = 3" in _read(CLIENT / "save" / "SaveNames.kt")
+ channels = _read(CLIENT / "bridge" / "Channels.kt")
+ assert "BinaryFrame.CAST_FILE -> " in channels and ".writeFile(frame.bytes" in channels
+
+
+def test_a_television_chosen_anywhere_takes_the_next_film():
+ """The player opens as the remote of a television chosen before it, the
+ cast pending until the first segment exactly as a restart is; choosing one
+ in the player keeps it for the session, and stopping there forgets it."""
+ player = _read(STATIC / "video-player.js")
+ assert ("const [autoCast] = useState(() => "
+ "(castSession.supported ? castSession.device : null));") in player
+ assert "useState(Boolean(autoCast))" in player
+ assert "castActiveRef = useRef(Boolean(autoCast))" in player
+ assert "castRestartPendingRef = useRef(Boolean(autoCast))" in player
+ assert "castDeviceRef = useRef(autoCast)" in player
+ assert "useState(autoCast ? autoCast.name : null)" in player
+ stop = player.split("const stopCast = async () => {", 1)[1].split("};", 1)[0]
+ assert "castSession.forget()" in stop
+ assert "castSession.choose(d);" in player
+ assert "castSession.claim('video')" in player
+
+
+def test_the_cast_button_is_where_the_media_are():
+ """Videos' toolbar, the Photos landing, a photo album's bar and Music's
+ toolbar are drawn by the group page and the search page alike, so one
+ button in each covers both. On the Photos landing the button keeps a
+ toolbar Search would otherwise hide. The music bar has its own, opening
+ upward from the bottom of the window."""
+ videos = _read(STATIC / "video-app.js")
+ assert "<${CastButton} />" in videos.split('<div class="video-toolbar">', 1)[1]
+ photos = _read(STATIC / "photos-app.js")
+ landing = photos.split("function PhotosApp(", 1)[1]
+ assert "(!hideFilter || castSession.supported) && html`" in landing
+ assert "<${CastButton} />" in landing.split('<div class="photo-toolbar">', 1)[1]
+ album = photos.split("function AlbumView(", 1)[1]
+ assert "<${CastButton}" in album
+ lightbox = photos.split("function Lightbox(", 1)[1].split("function AlbumView(", 1)[0]
+ assert '<${CastButton} variant="overlay"' in lightbox
+ assert "if (castDevice && blobUrl && blob) showPhoto(blob);" in lightbox
+ music = _read(STATIC / "music-app.js")
+ assert "<${CastButton} />" in music.split('<div class="video-toolbar">', 1)[1]
+ bar = _read(STATIC / "music-player.js")
+ assert '<${CastButton} cls="music-player-btn" up />' in bar
+ # The group page draws them through the app registry, the search page
+ # imports them: the same components either way.
+ registry = _read(STATIC / "apps.js")
+ search = _read(STATIC / "search-page.js")
+ for page in (registry, search):
+ for app in ("VideoApp", "PhotosApp", "MusicApp"):
+ assert app in page
+
+
+def test_the_music_bar_drives_the_television():
+ """With a television chosen, the decrypted track goes to the relay instead
+ of the element, and the bar's controls and clock are the receiver's. The
+ receiver keeps saying FINISHED until it is given something else, so the
+ end of a track moves the queue on once; and a television a film or a
+ photo has taken is not the bar's to read."""
+ bar = _read(STATIC / "music-player.js")
+ assert "const remote = Boolean(castDevice) && castSession.canSendFiles;" in bar
+ send = bar.split("const sendToTv = useCallback(", 1)[1].split("}, [fetchCover]);", 1)[0]
+ assert "owner: 'music', startAt," in send
+ assert "type: cached.mime, cover," in send
+ assert "sendingRef.current = true;" in send
+ load = bar.split("if (remoteRef.current) {\n // To the television", 1)[1]
+ assert "audio.pause();" in load.split("await audio.play();", 1)[0]
+ tick = bar.split("const tick = async () => {", 1)[1].split("const id = setInterval", 1)[0]
+ assert "castSession.owner !== 'music'" in tick
+ assert "sendingRef.current" in tick
+ assert "finishedRef.current !== remoteTrackRef.current" in tick
+ assert "String(c.idleReason || '').toLowerCase() === 'finished'" in tick
+ # The cover is found as the album card finds it, not only on the track.
+ cover = bar.split("const fetchCover = useCallback(", 1)[1]
+ cover = cover.split("}, [getConnection, tracks]);", 1)[0]
+ assert "entry.thumb_hash || (sibling && sibling.thumb_hash)" in cover
+ assert "transport.fetchMusicMeta(entry.id)" in cover
+ assert "meta.cover_thumb_hash" in cover
+ assert "castBridge.chromecastSeek(to)" in bar
+ assert "castBridge.chromecastPause() : castBridge.chromecastPlay()" in bar
+ # Stopping the cast carries the track on here; a film taking the
+ # television pauses the bar.
+ assert "if (castSession.device && castSession.owner !== 'music') setPlaying(false);" in bar
+
+
+def test_a_photo_leaves_scaled_and_upright():
+ session = _read(STATIC / "cast-session.js")
+ assert "imageOrientation: 'from-image'" in session
+ assert "const TV_WIDTH = 1920;" in session and "const TV_HEIGHT = 1080;" in session
+ assert "Math.min(1, TV_WIDTH / bitmap.width, TV_HEIGHT / bitmap.height)" in session
+ assert "await loadFile({ owner: 'photo', bytes, type: 'image/jpeg' });" in session
+ # Only the newest photo asked for is sent.
+ assert session.count("gen !== photoGen") >= 2
+
+
+def test_every_locale_names_the_slideshow():
+ for f in sorted((STATIC / "locales").glob("*.js")):
+ text = f.read_text(encoding="utf-8")
+ for key in ("photo.slideshow", "photo.slideshow_stop"):
+ assert f"'{key}':" in text, f"{f.name} lacks {key}"