diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-05-22 12:46:00 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-05-23 22:13:00 +1000 |
| commit | 4ea3ddb38d010c2f85c22b7f1c3f2d7e0c1355e3 (patch) | |
| tree | 90af9203059d645eb77216f1a091722ee9702438 /Pages/Component | |
| parent | 6de5d7f5364fe1d54703da6d6b7cb08ea26e939f (diff) | |
Initial commitwasm-oldserver
Diffstat (limited to 'Pages/Component')
26 files changed, 0 insertions, 1740 deletions
diff --git a/Pages/Component/AboutDialog.razor b/Pages/Component/AboutDialog.razor deleted file mode 100644 index 1229dc7..0000000 --- a/Pages/Component/AboutDialog.razor +++ /dev/null @@ -1,736 +0,0 @@ -@using System.Reflection -@using Microsoft.AspNetCore.Hosting -@inject IDbContextFactory<HBContext> dbFactory -@inject IHostingEnvironment hostingEnvironment -@implements IDialog - -<Dialog @ref=dialog> - <p id="title">@Title</p> - <p id="author">Created by Jake Mannens</p> - <div id="license"> - <center>GNU AFFERO GENERAL PUBLIC LICENSE</center><br/> - <center>Version 3, 19 November 2007</center> - <br/><br/> - Copyright (C) 2007 Free Software Foundation, Inc. - <<a href="https://fsf.org/" target="_blank">https://fsf.org/</a>> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - <br/><br/> - <center>Preamble</center> - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - The precise terms and conditions for copying, distribution and - modification follow. - <br/><br/> - <center>TERMS AND CONDITIONS</center> - <br/><br/> - 0. Definitions. - <br/><br/> - "This License" refers to version 3 of the GNU Affero General Public License. - <br/><br/> - "Copyright" also means copyright-like laws that apply to other kinds of - works, such as semiconductor masks. - <br/><br/> - "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. - <br/><br/> - 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. - <br/><br/> - A "covered work" means either the unmodified Program or a work based - on the Program. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 1. Source Code. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - The Corresponding Source need not include anything that users - can regenerate automatically from other parts of the Corresponding - Source. - <br/><br/> - The Corresponding Source for a work in source code form is that - same work. - <br/><br/> - 2. Basic Permissions. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - Conveying under any other circumstances is permitted solely under - the conditions stated below. Sublicensing is not allowed; section 10 - makes it unnecessary. - <br/><br/> - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 4. Conveying Verbatim Copies. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 5. Conveying Modified Source Versions. - <br/><br/> - 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: - <br/><br/> - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - <br/><br/> - 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". - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 6. Conveying Non-Source Forms. - <br/><br/> - 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: - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - "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. - <br/><br/> - 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). - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 7. Additional Terms. - <br/><br/> - "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. - <br/><br/> - 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. - <br/><br/> - 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: - <br/><br/> - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - <br/><br/> - 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 - <br/><br/> - 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 - <br/><br/> - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - <br/><br/> - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 8. Termination. - <br/><br/> - 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). - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 9. Acceptance Not Required for Having Copies. - <br/><br/> - 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. - <br/><br/> - 10. Automatic Licensing of Downstream Recipients. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 11. Patents. - <br/><br/> - 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". - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 12. No Surrender of Others' Freedom. - <br/><br/> - 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. - <br/><br/> - 13. Remote Network Interaction; Use with the GNU General Public License. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 14. Revised Versions of this License. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - 15. Disclaimer of Warranty. - <br/><br/> - 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. - <br/><br/> - 16. Limitation of Liability. - <br/><br/> - 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. - <br/><br/> - 17. Interpretation of Sections 15 and 16. - <br/><br/> - 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. - <br/><br/> - <center>END OF TERMS AND CONDITIONS</center> - <br/><br/> - <center>How to Apply These Terms to Your New Programs</center> - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - <br/><br/> - 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. - <br/><br/> - 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. - <br/><br/> - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see - <<a href="https://www.gnu.org/licenses/" target="_blank">https://www.gnu.org/licenses/</a>>. - <br/><br/> - Also add information on how to contact you by electronic and paper mail. - <br/><br/> - 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. - <br/><br/> - 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 - <<a href="https://www.gnu.org/licenses/" target="_blank">https://www.gnu.org/licenses/</a>>. - </div> - <a href="https://gitlab.com/plasmicplexus/HyperBooru-Server" target="_blank">Source</a> - <div id="progressContainer"> - @if(progress.HasValue) { - var untagged = progress.Value.Untagged.ToString("N0"); - var total = progress.Value.Total.ToString("N0"); - var percent = (progress.Value.Untagged * 100f / progress.Value.Total).ToString("f1"); - <p id="progress">Untagged: @($"{untagged}/{total} ({percent}%)")</p> - } - <ProgressBar @ref=progressBar /> - </div> - <ButtonContainer> - <button @onclick=Hide>Close</button> - </ButtonContainer> -</Dialog> - -@code { - private Dialog dialog; - - private ProgressBar progressBar; - - private (long Untagged, long Total)? progress; - - public bool Visible { - get => dialog.Visible; - set { - dialog.Visible = value; - if(value) { - using var db = dbFactory.CreateDbContext(); - progress = ( - Untagged: db.Media - .Where(m => m.Tags.Any(t => t.TagDefinition.ObjectId == (int) HBObjectId.IngestTag)) - .Count(), - Total: db.Media.Count() - ); - progressBar.Progress = (float) progress.Value!.Untagged / (float) progress.Value!.Total; - InvokeAsync(() => StateHasChanged()); - } - } - } - - public void Show() => Visible = true; - public void Hide() => Visible = false; - - public string Title => - $"HyperBooru v{Version} {Development}"; - - public string? Version => - GetType() - .Assembly - .GetCustomAttribute<AssemblyInformationalVersionAttribute>()? - .InformationalVersion; - - public string? Development { - get { - #if DEBUG - return "(Development)"; - #else - return hostingEnvironment.IsDevelopment() ? "(Development)" : null; - #endif - } - } -} diff --git a/Pages/Component/AboutDialog.razor.css b/Pages/Component/AboutDialog.razor.css deleted file mode 100644 index cbc4b59..0000000 --- a/Pages/Component/AboutDialog.razor.css +++ /dev/null @@ -1,29 +0,0 @@ -p#title { - margin-bottom: 0; -} - -p#author { - font-size: 8pt; -} - -p#progress { - flex: 1 0 auto; - font-size: 8pt; - margin-right: 10px; -} - -div#license { - background: #222; - border-radius: 10px; - box-sizing: border-box; - font-family: 'Lucida Console'; - font-size: 8pt; - max-height: 300px; - overflow-y: auto; - padding: 20px; -} - -div#progressContainer { - align-items: center; - display: flex; -} diff --git a/Pages/Component/ButtonContainer.razor b/Pages/Component/ButtonContainer.razor deleted file mode 100644 index a631dcc..0000000 --- a/Pages/Component/ButtonContainer.razor +++ /dev/null @@ -1,8 +0,0 @@ -<div> - @ChildContent -</div> - -@code { - [Parameter] - public RenderFragment ChildContent { get; set; } -} diff --git a/Pages/Component/ButtonContainer.razor.css b/Pages/Component/ButtonContainer.razor.css deleted file mode 100644 index c2d5d25..0000000 --- a/Pages/Component/ButtonContainer.razor.css +++ /dev/null @@ -1,10 +0,0 @@ -div { - display: flex; - justify-content: flex-end; -} - -@media (hover: none) and (pointer: coarse) { - div { - justify-content: center; - } -} diff --git a/Pages/Component/Dialog.razor b/Pages/Component/Dialog.razor deleted file mode 100644 index 673ec2f..0000000 --- a/Pages/Component/Dialog.razor +++ /dev/null @@ -1,70 +0,0 @@ -@inject IJSRuntime jsRuntime -@implements IDialog - -<div - class="dialog" - onmousedown="dialogMouseDown(event)" - style="opacity:0;visibility:hidden;@(heightStyle)" - @ref=dialogDiv> - @if(Title is not null) { - <div class="titlebar" onmousedown="dialogTitleMouseDown(event)"> - <p class="title">@Title</p> - <hr/> - </div> - } - <div class="content"> - @ChildContent - </div> -</div> - -@code { - [Parameter] - public string? Title { get; set; } - - [Parameter] - public RenderFragment ChildContent { get; set; } - - [Parameter] - public int HeightPixels { set => height = $"{value}px"; } - [Parameter] - public int HeightPercent { set => height = $"{value}%"; } - - public bool Visible { - get => visible; - set { - visible = value; - jsRuntime.InvokeVoidAsync( - "setDialogVisibility", - new object?[] { dialogDiv, value }); - } - } - - private bool visible = false; - - private string? height; - - private ElementReference dialogDiv; - - public void Show() => Visible = true; - public void Hide() => Visible = false; - - protected override async void OnAfterRender(bool firstRender) { - if(firstRender) { - await jsRuntime.InvokeVoidAsync("dialogAddObjectReference", new object[] { - dialogDiv, - DotNetObjectReference.Create(this) - }); - } - } - - [JSInvokable("KeyHandler")] - public void KeyHandler(string key) { - if(key == "Escape") { - Hide(); - return; - } - } - - private string heightStyle => - $"{(height is null ? "" : $"max-height:{height};")}"; -} diff --git a/Pages/Component/Dialog.razor.css b/Pages/Component/Dialog.razor.css deleted file mode 100644 index 93680c5..0000000 --- a/Pages/Component/Dialog.razor.css +++ /dev/null @@ -1,35 +0,0 @@ -div.dialog { - background: var(--col-dialog-bg); - border-radius: 20px; - box-shadow: 0px 5px 10px 10px rgb(0 0 0 / 25%); - display: flex; - flex-direction: column; - left: 50%; - padding: 0; - position: absolute; - top: 50%; - transform: translate(-50%, -50%); - transition: visibility 0.1s, opacity 0.1s linear; - width: min(450px, 100%); - z-index: 1000; -} - -hr { - margin: 0; -} - -div.titlebar { - cursor: grab; -} - -div.titlebar p.title { - font-size: 10pt; - margin: 0; - padding: 10px 20px 10px 20px; -} - -div.content { - display: flex; - flex-direction: column; - padding: 20px; -} diff --git a/Pages/Component/MediaTagTable.razor b/Pages/Component/MediaTagTable.razor deleted file mode 100644 index e687529..0000000 --- a/Pages/Component/MediaTagTable.razor +++ /dev/null @@ -1,72 +0,0 @@ -@inject IDbContextFactory<HBContext> dbFactory -@inject ITagService tagService - -<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> - -<table class="data-table"> - <tr> - <th>Namespace</th> - <th>Tag Name</th> - <th></th> - </tr> - @foreach(var e in tagDefs) { - <tr> - <td> - @if(e.isImplicit) { - <i>@e.tagDef.Namespace</i> - } else { - @e.tagDef.Namespace - } - </td> - <td> - <a href="/Gallery?t=@(e.tagDef.Guid)" class="nondecorated"> - @if(e.isImplicit) { - <i>@e.tagDef.Name</i> - } else { - @e.tagDef.Name - } - </a> - </td> - <td> - @if(!e.isImplicit) { - <a href="javascript:;" @onclick=@(() => Delete(e.tagDef))>Delete</a> - } else { - <a href="javascript:;" @onclick=@(() => MakeExplicit(e.tagDef))>Make Explicit</a> - } - </td> - </tr> - } -</table> - -@code { - [Parameter] - public Media Media { get; set; } - - private (TagDefinition tagDef, bool isImplicit)[] tagDefs; - - protected override void OnInitialized() => LoadTagDefs(); - - public void Refresh() { - LoadTagDefs(); - StateHasChanged(); - } - - private void Delete(TagDefinition tagDef) { - tagService.RemoveTag(Media.Guid, tagDef.Guid); - Refresh(); - } - - private void LoadTagDefs() { - using var db = dbFactory.CreateDbContext(); - var media = db.Media.First(m => m.ObjectId == Media.ObjectId); - - tagDefs = tagService.GetAllTags(Media) - .Where(e => e.tagDefinition.Source == TagSource.UserTag) - .ToArray(); - } - - private void MakeExplicit(TagDefinition tagDef) { - tagService.AddTag(Media, tagDef); - Refresh(); - } -} diff --git a/Pages/Component/MediaTagTable.razor.css b/Pages/Component/MediaTagTable.razor.css deleted file mode 100644 index 4dedb3f..0000000 --- a/Pages/Component/MediaTagTable.razor.css +++ /dev/null @@ -1,9 +0,0 @@ -th, td { - font-size: 8pt; -} - -@media (hover: none) and (pointer: coarse) { - th, td { - font-size: 7pt; - } -} diff --git a/Pages/Component/MobileMenu.razor b/Pages/Component/MobileMenu.razor deleted file mode 100644 index 49c45d5..0000000 --- a/Pages/Component/MobileMenu.razor +++ /dev/null @@ -1,26 +0,0 @@ -@inject NavigationManager navigationManager -@inject IJSRuntime jsRuntime -@implements IDisposable - -<div id="mobile-menu" class="hidden"> - <a href="/">Home</a> - <a href="/TagDefinitions">Tags</a> - <a href="/Gallery?ingest=true">Ingest</a> - <a href="/Upload">Upload</a> - <div id="nsfw-switch"> - <p id="nsfw-label">NSFW</p> - <NsfwSwitch/> - </div> - <a href="javascript:logout();">Logout</a> -</div> - -@code { - protected override void OnInitialized() => - navigationManager.LocationChanged += LocationChanged; - - public async void LocationChanged(object? sender, LocationChangedEventArgs e) => - await jsRuntime.InvokeVoidAsync("hideMobileMenu"); - - public void Dispose() => - navigationManager.LocationChanged -= LocationChanged; -} diff --git a/Pages/Component/MobileMenu.razor.css b/Pages/Component/MobileMenu.razor.css deleted file mode 100644 index 0237cf1..0000000 --- a/Pages/Component/MobileMenu.razor.css +++ /dev/null @@ -1,46 +0,0 @@ -div#mobile-menu { - background: var(--col-bg); - display: none; - flex-direction: column; - flex: 1 1 calc(100vh - 59px); - height: 100%; - overflow-y: auto; - position: relative; - width: 100%; -} - -body.mobile-menu-visible div#mobile-menu { - display: flex; -} - -div#mobile-menu > a { - color: #fff; - padding: 20px; -} - -div#mobile-menu > a:not(:last-of-type) { - border-bottom: 1px solid var(--col-hr); -} - -div#mobile-menu > a:hover { - background: var(--col-dialog-bg); - filter: none; -} - -div#mobile-menu > a:active { - background: #fff; - color: var(--col-bg); - filter: none; -} - -div#nsfw-switch { - align-items: center; - border-bottom: 1px solid var(--col-hr); - display: flex; - flex-direction: row; - padding: 5px 20px 5px 20px; -} - -div#nsfw-switch > p#nsfw-label { - margin-right: auto; -} diff --git a/Pages/Component/NsfwSwitch.razor b/Pages/Component/NsfwSwitch.razor deleted file mode 100644 index b96606d..0000000 --- a/Pages/Component/NsfwSwitch.razor +++ /dev/null @@ -1,8 +0,0 @@ -@inject IUserService userService - -<Switch InitialValue=userService.UserSessionState.ShowNsfw OnToggle=ToggleNsfw/> - -@code { - private void ToggleNsfw(bool showNsfw) => - userService.UserSessionState.ShowNsfw = showNsfw; -}
\ No newline at end of file diff --git a/Pages/Component/ProgressBar.razor b/Pages/Component/ProgressBar.razor deleted file mode 100644 index aa22194..0000000 --- a/Pages/Component/ProgressBar.razor +++ /dev/null @@ -1,17 +0,0 @@ -<div id="outer"> - <div id="inner" style="width:@(Progress * 100)%"> - </div> -</div> - -@code { - private float progress = 0; - - [Parameter] - public float Progress { - get => progress; - set { - progress = value; - InvokeAsync(() => StateHasChanged()); - } - } -} diff --git a/Pages/Component/ProgressBar.razor.css b/Pages/Component/ProgressBar.razor.css deleted file mode 100644 index f49c982..0000000 --- a/Pages/Component/ProgressBar.razor.css +++ /dev/null @@ -1,17 +0,0 @@ -div#outer { - background: var(--col-progbar-bg); - border-radius: 15px; - height: 15px; - margin: 0; - padding: 0; - width: 100%; -} - -div#inner { - background: var(--col-progbar-fg); - border-radius: 15px; - height: 100%; - margin: 0; - padding: 0; - transition: width 0.5s ease; -} diff --git a/Pages/Component/RedirectLogin.razor b/Pages/Component/RedirectLogin.razor deleted file mode 100644 index 290a7ac..0000000 --- a/Pages/Component/RedirectLogin.razor +++ /dev/null @@ -1,6 +0,0 @@ -@inject NavigationManager navigationManager - -@code { - protected override void OnInitialized() => - navigationManager.NavigateTo("/Login", true); -}
\ No newline at end of file diff --git a/Pages/Component/Switch.razor b/Pages/Component/Switch.razor deleted file mode 100644 index d11ac81..0000000 --- a/Pages/Component/Switch.razor +++ /dev/null @@ -1,20 +0,0 @@ -<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> - -<label> - <input - type="checkbox" - checked=@InitialValue - @onchange=@(e => OnToggle.InvokeAsync((e.Value as bool?) ?? false)) - hidden/> - <div class="switch-outer"> - <div class="switch-inner"/> - </div> -</label> - -@code { - [Parameter] - public bool InitialValue { get; set; } = false; - - [Parameter] - public EventCallback<bool> OnToggle { get; set; } -} diff --git a/Pages/Component/Switch.razor.css b/Pages/Component/Switch.razor.css deleted file mode 100644 index 6b1f5d5..0000000 --- a/Pages/Component/Switch.razor.css +++ /dev/null @@ -1,25 +0,0 @@ -div.switch-outer { - background: var(--col-switch-bg); - border-radius: 20px; - border: 1px solid var(--col-switch-fg); - cursor: pointer; - height: 20px; - transition: background 0.1s linear; - width: 40px; -} - -div.switch-inner { - background: var(--col-switch-fg); - border-radius: 20px; - height: 20px; - transition: margin-left 0.1s linear; - width: 20px; -} - -input:checked + div.switch-outer { - background: var(--col-switch-bg-hl); -} - -input:checked + div.switch-outer > div.switch-inner { - margin-left: 20px; -} diff --git a/Pages/Component/TabContainer.razor b/Pages/Component/TabContainer.razor deleted file mode 100644 index 3caab0b..0000000 --- a/Pages/Component/TabContainer.razor +++ /dev/null @@ -1,35 +0,0 @@ -<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> - -<div class="tabs"> - @foreach(var pane in Panes) { - <a href="javascript:;" @onclick=@(() => ActivePane = pane) class="@(pane == ActivePane ? "selected" : "")"> - @pane.Title - </a> - } -</div> - -<CascadingValue Value="this"> - @ChildContent -</CascadingValue> - -@code { - [Parameter] - public RenderFragment ChildContent { get; set; } - - public TabPane? ActivePane { get; set; } - List<TabPane> Panes = new(); - - public void AddPane(TabPane tabPane) { - Panes.Add(tabPane); - if(Panes.Count == 1) - ActivePane = tabPane; - StateHasChanged(); - } - - public void RemovePane(TabPane tabPane) { - if(ActivePane == tabPane) - ActivePane = Panes.ElementAtOrDefault(0); - Panes.Remove(tabPane); - StateHasChanged(); - } -}
\ No newline at end of file diff --git a/Pages/Component/TabContainer.razor.css b/Pages/Component/TabContainer.razor.css deleted file mode 100644 index bfb5694..0000000 --- a/Pages/Component/TabContainer.razor.css +++ /dev/null @@ -1,27 +0,0 @@ -div.tabs { - display: inherit !important; - border-bottom: 1px solid white; -} - -div.tabs > a { - display: inline-block; - padding: 10px 10px 9px 10px; -} - -div.tabs > a.selected { - border-bottom: 4px solid white; - padding-bottom: 5px; -} - -@media (hover: hover) { - div.tabs > a:hover { - background: rgba(255, 255, 255, 0.4); - filter: none; - } -} - -@media (hover: none) and (pointer: coarse) { - div.tabs > a { - font-size: 8pt; - } -} diff --git a/Pages/Component/TabPane.razor b/Pages/Component/TabPane.razor deleted file mode 100644 index ba4a13a..0000000 --- a/Pages/Component/TabPane.razor +++ /dev/null @@ -1,29 +0,0 @@ -@implements IDisposable - -<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> - -@if(Parent.ActivePane == this) { - @ChildContent -} - -@code { - [CascadingParameter] - private TabContainer Parent { get; set; } - - [Parameter] - public string Title { get; set; } - - [Parameter] - public RenderFragment ChildContent { get; set; } - - protected override void OnInitialized() { - if (Parent is null) - throw new ArgumentNullException(nameof(Parent), "TabPane must exist within a TabContainer"); - - Parent.AddPane(this); - } - - public void Dispose() { - Parent.RemovePane(this); - } -}
\ No newline at end of file diff --git a/Pages/Component/TabPane.razor.css b/Pages/Component/TabPane.razor.css deleted file mode 100644 index 5f28270..0000000 --- a/Pages/Component/TabPane.razor.css +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/Pages/Component/TagEditDialog.razor b/Pages/Component/TagEditDialog.razor deleted file mode 100644 index afa312e..0000000 --- a/Pages/Component/TagEditDialog.razor +++ /dev/null @@ -1,96 +0,0 @@ -@inject IDbContextFactory<HBContext> dbFactory; -@inject ITagService tagService -@implements IDialog - -<Dialog Title=@Title @ref=dialog> - <label> - Name - @if(nameExists) { - <p class="error">Tag with that name already exists!</p> - } - </label> - <input type="text" @bind=tagName required/> - <label>Namespace</label> - <input type="text" @bind=tagNamespace/> - <label> - Alias - @if(aliasExists) { - <p class="error">Tag with that alias already exists!</p> - } - </label> - <input type="text" @bind=tagAlias/> - <ButtonContainer> - <button @onclick=Hide class="secondary">Cancel</button> - <button @onclick=Submit>@(TagDefinition is null ? "Create" : "Apply")</button> - </ButtonContainer> -</Dialog> - -@code { - [Parameter] - public TagDefinition? TagDefinition { get; set; } - - [Parameter] - public EventHandler OnTagUpdate { get; set; } - - public bool Visible { - get => visible; - set { - if(value) - Load(); - visible = dialog.Visible = value; - } - } - - private string Title => - TagDefinition is null ? "Create a new tag definition" : "Edit tag definition"; - - private Dialog dialog; - - private string? tagName; - private string? tagNamespace; - private string? tagAlias; - - private bool nameExists = false; - private bool aliasExists = false; - - private bool visible = false; - - public void Show() => Visible = true; - public void Hide() => Visible = false; - - public void Show(TagDefinition? toEdit) { - TagDefinition = toEdit; - Visible = true; - } - - public void Show(string? @namespace) { - TagDefinition = null; - Visible = true; - tagNamespace = @namespace; - } - - private void Load() { - tagName = TagDefinition?.Name; - tagNamespace = TagDefinition?.Namespace; - tagAlias = TagDefinition?.Alias; - nameExists = false; - aliasExists = false; - } - - private void Submit() { - try { - if(TagDefinition is null) { - tagService.CreateTagDefinition(tagName, tagNamespace, tagAlias); - } else { - tagService.UpdateTagDefinition(TagDefinition, tagName, tagNamespace, tagAlias); - } - } catch(ApiModels.TagDuplicateException e) { - nameExists = e.NameExists; - aliasExists = e.AliasExists; - return; - } - - OnTagUpdate.Invoke(this, new EventArgs()); - Hide(); - } -} diff --git a/Pages/Component/TagEditDialog.razor.css b/Pages/Component/TagEditDialog.razor.css deleted file mode 100644 index 02781c0..0000000 --- a/Pages/Component/TagEditDialog.razor.css +++ /dev/null @@ -1,11 +0,0 @@ -p.error { - color: var(--col-error-pri); - display: inline; - font-size: 8pt; - margin-left: 5px; - vertical-align: middle; -} - -input { - width: 100%; -} diff --git a/Pages/Component/TagSelectDialog.razor b/Pages/Component/TagSelectDialog.razor deleted file mode 100644 index 87065d7..0000000 --- a/Pages/Component/TagSelectDialog.razor +++ /dev/null @@ -1,192 +0,0 @@ -@inject IDbContextFactory<HBContext> dbFactory -@inject ITagService tagService -@inject IUserService userService -@implements IDisposable -@implements IDialog - -<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> - -<Dialog Title=@(Title ?? "Select one or more tag(s)") @ref=dialog> - <input - type="text" - placeholder="Search" - autocorrect="off" - autocapitalize="off" - autocomplete="off" - @ref=queryInput - @oninput=QueryInput - @onkeypress=QueryKey - value=@query/> - <div class="tag-definitions"> - @for(int i = 0; i < tagDefinitions.Count(); i++) { - if(!MatchesQuery(tagDefinitions[i].tagDefinition)) - continue; - var local = i; - var ns = tagDefinitions[i].tagDefinition.Namespace; - var alias = tagDefinitions[i].tagDefinition.Alias; - var title = string.Join(" ", new[] { - ns, - alias is not null ? $"({alias})" : null - }); - <input - type="checkbox" - id="tagDef-@tagDefinitions[i].tagDefinition.Guid" - @bind=tagDefinitions[local].selected /> - <label - for="tagDef-@tagDefinitions[i].tagDefinition.Guid" - title=@title> - @tagDefinitions[i].tagDefinition.Name - </label> - } - </div> - <ButtonContainer> - <button @onclick=@(() => dialog.Hide()) class="secondary">Cancel</button> - <button @onclick=@(() => Submit())>Accept</button> - </ButtonContainer> -</Dialog> - -@code { - [Parameter] - public string? Title { get; set; } - - [Parameter] - public EventCallback<TagDefinition[]> OnSubmit { get; set; } - - public TagDefinition[] SelectedTags { get; set; } = - Array.Empty<TagDefinition>(); - - public bool Visible { - get => visible; - set { - if(value) - LoadTags(); - query = null; - visible = dialog.Visible = value; - } - } - - private (TagDefinition tagDefinition, bool selected)[] tagDefinitions; - - private HBContext db; - - private Dialog dialog; - - private bool visible; - - private string? query; - private ElementReference queryInput; - - public void Show() => Visible = true; - public void Hide() => Visible = false; - - protected override void OnInitialized() { - userService.UserSessionState.OnStateChange += ShowNsfwChanged; - LoadTags(); - } - - private void LoadTags() { - db = dbFactory.CreateDbContext(); - - var selected = SelectedTags.Select(td => td.Guid); - - int[] nsfwTags = Array.Empty<int>(); - if(!userService.UserSessionState.ShowNsfw) - nsfwTags = tagService.TagsThatImply(HBContext.NsfwTag) - .Select(td => td.ObjectId) - .ToArray(); - - tagDefinitions = db.TagDefinitions - .Include(td => td.ImplicitTags) - .Where(td => td.Source == TagSource.UserTag) - .OrderBy(td => td.Name) - .AsEnumerable() - .Where(td => userService.UserSessionState.ShowNsfw || !td.ImplicitTags - .IntersectBy(nsfwTags, td => td.ObjectId) - .Any()) - .Select(td => new Tuple<TagDefinition, bool>( - td, - selected.Contains(td.Guid)).ToValueTuple()) - .ToArray(); - } - - private void QueryInput(ChangeEventArgs e) { - query = (string?) e.Value; - StateHasChanged(); - } - - private void QueryKey(KeyboardEventArgs e) { - if(e.Code != "Enter" && e.Code != "NumpadEnter") - return; - - if(string.IsNullOrEmpty(query)) { - Submit(); - return; - } - - int c = 0; - int? last = null; - for(int i = 0; i < tagDefinitions.Count(); i++) { - if(!MatchesQuery(tagDefinitions[i].tagDefinition)) - continue; - last = i; - c++; - } - - if(c == 1 && last is not null) - tagDefinitions[(int) last].selected = - !tagDefinitions[(int) last].selected; - - query = null; - StateHasChanged(); - } - - private bool MatchesQuery(TagDefinition tagDef) { - TagDefinition? singleTag = null; - - if(string.IsNullOrEmpty(query)) - return true; - - singleTag = tagDefinitions.FirstOrDefault( - e => string.Equals( - e.tagDefinition.Alias, - query, - StringComparison.OrdinalIgnoreCase)).tagDefinition; - - if(singleTag is not null) - return tagDef.Guid == singleTag.Guid; - - singleTag = tagDefinitions.FirstOrDefault( - e => string.Equals( - e.tagDefinition.Name, - query, - StringComparison.OrdinalIgnoreCase)).tagDefinition; - - if(singleTag is not null) - return tagDef.Guid == singleTag.Guid; - - return tagDef.Name.ToLower().Contains(query.ToLower()); - } - - private async void Submit() { - await OnSubmit.InvokeAsync( - tagDefinitions - .Where(e => e.selected) - .Select(e => e.tagDefinition) - .ToArray()); - for(int i = 0; i < tagDefinitions.Count(); i++) - tagDefinitions[i].selected = false; - Hide(); - StateHasChanged(); - } - - public async void ShowNsfwChanged(UserSessionState userSessionState) => - await InvokeAsync(() => { - LoadTags(); - StateHasChanged(); - }); - - public void Dispose() { - db.Dispose(); - userService.UserSessionState.OnStateChange -= ShowNsfwChanged; - } -} diff --git a/Pages/Component/TagSelectDialog.razor.css b/Pages/Component/TagSelectDialog.razor.css deleted file mode 100644 index dadd0c4..0000000 --- a/Pages/Component/TagSelectDialog.razor.css +++ /dev/null @@ -1,29 +0,0 @@ -div.tag-definitions { - max-height: 450px; - overflow-y: auto; - user-select: none; -} - -div.tag-definitions label { - background: #555; - border-radius: 10px; - display: inline-block; - font-size: 10pt; - margin: 0 5px 5px 0; - padding: 5px 7px 5px 7px; - transition: background 0.1s linear; -} - -@media(hover: hover) { - div.tag-definitions label:hover { - background: #777; - } -} - -div.tag-definitions input:checked + label { - background: #aaa; -} - -div.tag-definitions input { - display: none; -} diff --git a/Pages/Component/Titlebar.razor b/Pages/Component/Titlebar.razor deleted file mode 100644 index 48257b2..0000000 --- a/Pages/Component/Titlebar.razor +++ /dev/null @@ -1,87 +0,0 @@ -@inject IJSRuntime jsRuntime -@inject IUserService userService - -<script suppress-error="BL9992"> - async function login() { - var username = document.querySelector('input#username'); - var password = document.querySelector('input#password'); - - var formData = new FormData(); - formData.append('username', username.value); - formData.append('password', password.value); - - var resp = await fetch('/Login', { - method: 'POST', - body: formData - }); - - if(resp.ok) { - window.location.href = '/'; - } else if(resp.status == 403) { - var form = document.querySelector('form.login'); - form.classList.remove('bad-login'); - @* TODO: improve this hacky method of triggering reflow *@ - form.offsetWidth; - form.classList.add('bad-login'); - username.value = password.value = null; - username.focus(); - } else { - alert('Unknown error while attempting to login!'); - } - } - - async function logout() { - var resp = await fetch('/Logout', { method: 'POST' }); - if(resp.ok) { - window.location.href = '/Login'; - } else { - alert('Error logging out!'); - } - } -</script> - -<AuthorizeView> - <Authorized> - <div id="navbar"> - <p class="mobile">HyperBooru</p> - <a class="mobile menu-button" href="javascript:toggleMobileMenu();">☰</a> - - <a class="desktop" href="/">Home</a> - <a class="desktop" href="/TagDefinitions">Tags</a> - <a class="desktop" href="/Gallery?ingest=true">Ingest</a> - <a class="desktop" href="/Upload">Upload</a> - <a class="desktop" href="javascript:;" @onclick=@(() => aboutDialog.Show())>About</a> - - <p class="desktop" id="nsfw-label">NSFW</p> - <div id="nsfw-switch" class="desktop"> - <NsfwSwitch/> - </div> - <form action="/Gallery" method="get" class="desktop"> - <input type="text" name="q" placeholder="Search"/> - </form> - <a class="desktop" href="javascript:logout();">Logout</a> - </div> - <AboutDialog @ref=aboutDialog/> - </Authorized> - <NotAuthorized> - <div id="navbar"> - <h2>Login</h2> - <form class="login" action="javascript:login();"> - <input - id="username" - placeholder="Username" - type="text" - autocorrect="off" - autocapitalize="off" - autocomplete="off" - autofocus/> - <input id="password" placeholder="Password" type="password"/> - </form> - <a href="javascript:login();">Login</a> - </div> - </NotAuthorized> -</AuthorizeView> - -@code { - private AboutDialog aboutDialog; -} diff --git a/Pages/Component/Titlebar.razor.css b/Pages/Component/Titlebar.razor.css deleted file mode 100644 index 58a1c0c..0000000 --- a/Pages/Component/Titlebar.razor.css +++ /dev/null @@ -1,99 +0,0 @@ -div#navbar { - align-items: center; - background: var(--col-navbar-bg); - box-shadow: rgba(0, 0, 0, 0.5) 0px 10px 10px; - display: flex; - height: 59px; - z-index: 100; -} - -div#navbar > h2 { - margin-left: 20px; -} - -div#navbar > a, div#navbar > p { - align-items: center; - color: white; - display: flex; - height: 100%; - padding: 0 20px 0 20px; - user-select: none; -} - -@media (hover: hover) and (pointer: fine) { - div#navbar > a:hover { - background: rgba(255, 255, 255, 0.4); - filter: none; - } -} - -div#navbar > a:active { - background: #fff; - color: var(--col-navbar-bg); -} - -div#navbar > a.menu-button { - font-size: 18pt; - margin-left: auto; -} - -p#nsfw-label { - align-self: center; - font-size: 9pt; - margin-left: auto; -} - -div#nsfw-switch { - align-self: center; - margin-left: 10px; -} - -form { - display: flex; - margin: 0 20px 0 20px; - min-width: 30%; -} - -form.login { - margin-left: auto; -} - -form.login.bad-login { - animation-iteration-count: 3; - animation-timing-function: linear; - animation: bad-login 0.2s; -} - -@keyframes bad-login { - 0% { transform: translateX(0); } - 33% { transform: translateX(-20px); } - 66% { transform: translateX(+20px); } - 100% { transform: translateX(0); } -} - -input[type="text"], input[type="password"] { - align-self: center; - background: var(--col-bg); - border-radius: 0; - color: white; - font-size: 12pt; - height: 40px !important; - margin: 0; - width: 100%; -} - -input[type="password"] { - margin-left: 20px; -} - -@media (hover: none) and (pointer: coarse) { - .desktop { - display: none !important; - } -} - -@media (hover: hover) and (pointer: fine) { - .mobile { - display: none !important; - } -} |
