Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
722b7b9a73
|
||
|
|
0169937741 | ||
|
|
3d9efe626d
|
||
|
|
754fbfaa74 | ||
|
|
134c920318
|
||
|
|
2f99f7c9d3
|
||
|
|
b160d26ec9
|
||
|
|
9a47eb728c | ||
|
|
ba094f22c8 | ||
|
|
116af0f554
|
||
|
|
6c3181f893
|
||
|
|
4e378daa22
|
||
|
|
72c27735b8 | ||
|
|
b0f0da1d20 | ||
|
|
903d0877c4
|
||
|
|
dd9b9dc3cf
|
||
|
|
f66a267eca
|
||
|
|
4e819cda14
|
||
|
|
f0454bd7bc | ||
|
|
e3e48c6f30 | ||
|
|
93ccb0f8c6 | ||
|
|
ba1f2aae77 | ||
|
|
64f5fb7b5d | ||
|
|
f04397355e | ||
|
|
366ce014de | ||
|
|
dfcf6d733e
|
||
|
|
7bb1f0aba4 | ||
|
|
f914c4fade | ||
|
|
6e1751fcd1
|
||
|
|
f81f47ee90 | ||
|
|
484d87d82a | ||
|
|
17a8b6d310
|
||
|
|
7ba497b218 | ||
|
|
99bb0d0327 | ||
|
|
1b64aa9cdc | ||
|
|
4fab4771ea | ||
|
|
19ee2a8b97
|
||
|
|
9e7667f090 | ||
|
|
aec5e31465
|
||
|
|
409e546ab6
|
||
|
|
9df885ceaf | ||
|
|
7ddacf0edf | ||
|
|
e395dcec67 | ||
|
|
5536ea02f3 | ||
|
|
113dffece7
|
||
|
|
c4537295a8
|
@@ -1,20 +1,232 @@
|
||||
Copyright (c) 2016 The Gitea Authors
|
||||
Copyright (c) 2015 The Gogs Authors
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
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:
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
vphash
|
||||
Copyright (C) 2026 d
|
||||
|
||||
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:
|
||||
|
||||
vphash Copyright (C) 2026 d
|
||||
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/philosophy/why-not-lgpl.html>.
|
||||
|
||||
@@ -1,199 +1,58 @@
|
||||
# Gitea
|
||||
|
||||
[](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml?query=branch%3Amain "Release Nightly")
|
||||
[](https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea")
|
||||
[](https://goreportcard.com/report/gitea.dev "Go Report Card")
|
||||
[](https://pkg.go.dev/gitea.dev "GoDoc")
|
||||
[](https://github.com/go-gitea/gitea/releases/latest "GitHub release")
|
||||
[](https://www.codetriage.com/go-gitea/gitea "Help Contribute to Open Source")
|
||||
[](https://opencollective.com/gitea "Become a backer/sponsor of gitea")
|
||||
[](https://opensource.org/licenses/MIT "License: MIT")
|
||||
[](https://translate.gitea.com "Crowdin")
|
||||
|
||||
[繁體中文](./README.zh-tw.md) | [简体中文](./README.zh-cn.md)
|
||||
|
||||
## Purpose
|
||||
|
||||
The goal of Gitea is to make the easiest, fastest, and most painless way of
|
||||
setting up a self-hosted all-in-one software development service,
|
||||
including Git hosting, code management, code review, issue tracking, project kanban, wiki,
|
||||
team collaboration, package registry and CI/CD which can reuse GitHub Actions.
|
||||
|
||||
As Gitea is written in Go, it works across **all** the platforms and
|
||||
architectures that are supported by Go, including Linux, macOS, FreeBSD/OpenBSD and Windows
|
||||
on x86, amd64, ARM, RISC-V 64 and PowerPC architectures.
|
||||
|
||||
For online demonstrations, you can visit [demo.gitea.com](https://demo.gitea.com).
|
||||
|
||||
For accessing free Gitea service (with a limited number of repositories), you can visit [gitea.com](https://gitea.com/user/login).
|
||||
|
||||
To quickly deploy your own dedicated Gitea instance on Gitea Cloud, you can start a free trial at [cloud.gitea.com](https://cloud.gitea.com),
|
||||
or use container (docker/podman/etc) to deploy on your own server with the [official image](https://hub.docker.com/r/gitea/gitea).
|
||||
|
||||
## Documentation
|
||||
|
||||
You can find comprehensive documentation on our official [documentation website](https://docs.gitea.com/).
|
||||
|
||||
It includes installation, administration, usage, development, contributing guides, and more to help you get started and explore all features effectively.
|
||||
|
||||
If you have any suggestions or would like to contribute to it, you can visit the [documentation repository](https://gitea.com/gitea/docs)
|
||||
|
||||
## Building
|
||||
|
||||
See [docs/build-setup.md](docs/build-setup.md) for prerequisites
|
||||
and [docs/development.md](docs/development.md) for setting up a local development environment, linting, and testing.
|
||||
|
||||
If you'd like to build from source or make a distribution package, see [docs/build-source.md](docs/build-source.md) for more information.
|
||||
|
||||
After building, you can run `./gitea web` to start the server, or `./gitea help` to see all available commands.
|
||||
|
||||
## Contributing
|
||||
|
||||
Expected workflow is: Fork -> Patch -> Push -> Pull Request
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> 1. **YOU MUST READ THE [CONTRIBUTORS GUIDE](CONTRIBUTING.md) BEFORE STARTING TO WORK ON A PULL REQUEST.**
|
||||
> 2. New to the codebase? The [development guide](docs/development.md) walks through setting up a local environment and building from source.
|
||||
> 3. If you have found a vulnerability in the project, please write privately to **security@gitea.io**. Thanks!
|
||||
|
||||
## Translating
|
||||
|
||||
[](https://translate.gitea.com)
|
||||
|
||||
Translations are done through [Crowdin](https://translate.gitea.com). If you want to translate to a new language, ask one of the managers in the Crowdin project to add a new language there.
|
||||
|
||||
You can also just create an issue for adding a language or ask on Discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty, but we hope to fill it as questions pop up.
|
||||
|
||||
Get more information from [documentation](https://docs.gitea.com/contributing/localization).
|
||||
|
||||
## Official and Third-Party Projects
|
||||
|
||||
We provide an official [go-sdk](https://gitea.com/gitea/go-sdk), a CLI tool called [tea](https://gitea.com/gitea/tea) and an [action runner](https://gitea.com/gitea/act_runner) for Gitea Action.
|
||||
|
||||
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea), where you can discover more third-party projects, including SDKs, plugins, themes, and more.
|
||||
|
||||
## Communication
|
||||
|
||||
[](https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea")
|
||||
|
||||
If you have questions that are not covered by the [documentation](https://docs.gitea.com/), you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://forum.gitea.com/).
|
||||
|
||||
## Authors
|
||||
|
||||
- [Maintainers](https://github.com/orgs/go-gitea/people)
|
||||
- [Contributors](https://github.com/go-gitea/gitea/graphs/contributors)
|
||||
- [Translators](options/locale/TRANSLATORS)
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/gitea#backer)]
|
||||
|
||||
<a href="https://opencollective.com/gitea#backers" target="_blank"><img src="https://opencollective.com/gitea/backers.svg?width=890"></a>
|
||||
|
||||
## Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/gitea#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/gitea/sponsor/0/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/1/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/2/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/3/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/4/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/5/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/6/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/7/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/8/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/gitea/sponsor/9/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/9/avatar.svg"></a>
|
||||
|
||||
## FAQ
|
||||
|
||||
**How do you pronounce Gitea?**
|
||||
|
||||
Gitea is pronounced [/ɡɪ’ti:/](https://youtu.be/EM71-2uDAoY) as in "gi-tea" with a hard g.
|
||||
|
||||
**How do I configure Gitea?**
|
||||
|
||||
For dynamic config options, you can change it on your admin panel's configuration section.
|
||||
|
||||
For static config options, you can edit your `app.ini` file and resart the instance.
|
||||
See [app.example.ini](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini) or [configuration documentation](https://docs.gitea.com/administration/config-cheat-sheet) for more details.
|
||||
|
||||
**Where can I find the security patches?**
|
||||
|
||||
In the [release log](https://github.com/go-gitea/gitea/releases) or the [change log](https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md), search for the keyword `SECURITY` to find the security patches.
|
||||
|
||||
(more FAQs are listed in [FAQ documentation](https://docs.gitea.com/help/faq))
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License.
|
||||
See the [LICENSE](https://github.com/go-gitea/gitea/blob/main/LICENSE) file
|
||||
for the full license text.
|
||||
|
||||
## Further information
|
||||
|
||||
<details>
|
||||
<summary>Looking for an overview of the interface? Check it out the screenshots!</summary>
|
||||
|
||||
### Login/Register Page
|
||||
|
||||

|
||||

|
||||
|
||||
### User Dashboard
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
### User Profile
|
||||
|
||||

|
||||
|
||||
### Explore
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
### Repository
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
#### Repository Issue
|
||||
|
||||

|
||||

|
||||
|
||||
#### Repository Pull Requests
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
#### Repository Actions
|
||||
|
||||

|
||||

|
||||
|
||||
#### Repository Activity
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
### Organization
|
||||
|
||||

|
||||
|
||||
</details>
|
||||
# M8SH - decentralized swiss knife
|
||||
|
||||
Project is under development.
|
||||
|
||||
Roadmap:
|
||||
|
||||
- decentralized GPG-based registration, authorization and authentication (further when clients are developed - GPG would be integrated into client and invoked via secure bridge for fully password-less and input-less flow, preseving security level of GPG) (usage of external email domain assumes it's an external user and decetralized features will be disabled)
|
||||
- integrated email server (ui, rest)
|
||||
- integrated messenger (ui, rest)
|
||||
- integrated search engine (seach over external gitea instances repositories, specific tags for repos to be indexed, view external things from home instance)
|
||||
- integrated posts, articles
|
||||
- integrated videos, reels
|
||||
- integrated music player
|
||||
- integrated VPN (amnesia)
|
||||
|
||||
---
|
||||
|
||||
### Licensing
|
||||
|
||||
Project is published under GPLv3 license. If you modify GPLv3 code and distribute the resulting software, your entire application must also be licensed under GPLv3.
|
||||
|
||||
<!--
|
||||
- integrated cloud storage
|
||||
- integrated calls
|
||||
- integrated video-conferences
|
||||
- integrated stickers
|
||||
- integrated NFT assets, crypto-wallets
|
||||
|
||||
TRANSLATIONS:
|
||||
cs-CZ
|
||||
de-DE
|
||||
el-GR
|
||||
en-US
|
||||
es-ES
|
||||
fa-IR
|
||||
fi-FI
|
||||
fr-FR
|
||||
ga-IE
|
||||
hu-HU
|
||||
id-ID
|
||||
is-IS
|
||||
it-IT
|
||||
ja-JP
|
||||
ko-KR
|
||||
lv-LV
|
||||
nl-NL
|
||||
pl-PL
|
||||
pt-BR
|
||||
pt-PT
|
||||
ru-RU
|
||||
si-LK
|
||||
sk-SK
|
||||
sv-SE
|
||||
tr-TR
|
||||
uk-UA
|
||||
zh-CN
|
||||
zh-TW
|
||||
-->
|
||||
|
||||
@@ -120,6 +120,17 @@ func (err ErrGPGInvalidTokenSignature) Error() string {
|
||||
return "the provided signature does not sign the token with the provided key"
|
||||
}
|
||||
|
||||
type ErrGPGLastKey struct{}
|
||||
|
||||
func (e ErrGPGLastKey) Error() string {
|
||||
return "cannot delete last GPG key"
|
||||
}
|
||||
|
||||
func IsErrGPGLastKey(err error) bool {
|
||||
_, ok := err.(ErrGPGLastKey)
|
||||
return ok
|
||||
}
|
||||
|
||||
// ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.
|
||||
type ErrGPGKeyParsing struct {
|
||||
ParseError error
|
||||
|
||||
@@ -228,12 +228,49 @@ func DeleteGPGKey(ctx context.Context, doer *user_model.User, id int64) (err err
|
||||
return fmt.Errorf("GetPublicKeyByID: %w", err)
|
||||
}
|
||||
|
||||
count, err := db.GetEngine(ctx).Where("owner_id = ?", doer.ID).Count(new(GPGKey))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if count <= 1 {
|
||||
return ErrGPGLastKey{}
|
||||
}
|
||||
|
||||
return db.WithTx(ctx, func(ctx context.Context) error {
|
||||
_, err = deleteGPGKey(ctx, key.KeyID)
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
// ExtractGPGKeyIdentity returns the primary name and email from the first UID of an armored key
|
||||
func ExtractGPGKeyIdentity(armoredKey string) (name, email string, err error) {
|
||||
keys, err := CheckArmoredGPGKeyString(armoredKey)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
if len(keys) == 0 {
|
||||
return "", "", errors.New("no keys found")
|
||||
}
|
||||
for _, uid := range keys[0].Identities {
|
||||
if uid.UserId != nil {
|
||||
return uid.UserId.Name, uid.UserId.Email, nil
|
||||
}
|
||||
}
|
||||
return "", "", errors.New("no identity found in key")
|
||||
}
|
||||
|
||||
// ExtractGPGKeyID returns the key ID string from an armored key
|
||||
func ExtractGPGKeyID(armoredKey string) (string, error) {
|
||||
keys, err := CheckArmoredGPGKeyString(armoredKey)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(keys) == 0 {
|
||||
return "", errors.New("no keys found")
|
||||
}
|
||||
return fmt.Sprintf("%016X", keys[0].PrimaryKey.KeyId), nil
|
||||
}
|
||||
|
||||
func FindGPGKeyWithSubKeys(ctx context.Context, keyID string) ([]*GPGKey, error) {
|
||||
return db.Find[GPGKey](ctx, FindGPGKeyOptions{
|
||||
KeyID: keyID,
|
||||
|
||||
@@ -5,7 +5,6 @@ package asymkey
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/log"
|
||||
@@ -78,15 +77,9 @@ func AddGPGKey(ctx context.Context, ownerID int64, content, token, signature str
|
||||
verified := false
|
||||
// Handle provided signature
|
||||
if signature != "" {
|
||||
signer, err := openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token), strings.NewReader(signature), nil)
|
||||
signer, err := checkSignatureWithClearsign(ekeys, token, signature)
|
||||
if err != nil {
|
||||
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\n"), strings.NewReader(signature), nil)
|
||||
}
|
||||
if err != nil {
|
||||
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
|
||||
}
|
||||
if err != nil {
|
||||
log.Debug("AddGPGKey CheckArmoredDetachedSignature failed: %v", err)
|
||||
log.Debug("AddGPGKey checkSignatureWithClearsign failed: %v", err)
|
||||
return nil, ErrGPGInvalidTokenSignature{
|
||||
ID: ekeys[0].PrimaryKey.KeyIdString(),
|
||||
Wrapped: err,
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
|
||||
"github.com/ProtonMail/go-crypto/openpgp"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/armor"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/clearsign"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/packet"
|
||||
)
|
||||
|
||||
@@ -121,21 +122,89 @@ func readArmoredSign(r io.Reader) (body io.Reader, err error) {
|
||||
}
|
||||
|
||||
func ExtractSignature(s string) (*packet.Signature, error) {
|
||||
s = strings.TrimSpace(s)
|
||||
|
||||
if strings.HasPrefix(s, "-----BEGIN PGP SIGNED MESSAGE-----") {
|
||||
block, _ := clearsign.Decode([]byte(s))
|
||||
if block == nil {
|
||||
return nil, errors.New("failed to decode clearsign block")
|
||||
}
|
||||
p, err := packet.Read(block.ArmoredSignature.Body)
|
||||
if err != nil {
|
||||
return nil, errors.New("failed to read signature packet from clearsign")
|
||||
}
|
||||
sig, ok := p.(*packet.Signature)
|
||||
if !ok {
|
||||
return nil, errors.New("packet is not a signature")
|
||||
}
|
||||
return sig, nil
|
||||
}
|
||||
|
||||
r, err := readArmoredSign(strings.NewReader(s))
|
||||
if err != nil {
|
||||
return nil, errors.New("Failed to read signature armor")
|
||||
return nil, errors.New("failed to read signature armor")
|
||||
}
|
||||
p, err := packet.Read(r)
|
||||
if err != nil {
|
||||
return nil, errors.New("Failed to read signature packet")
|
||||
return nil, errors.New("failed to read signature packet")
|
||||
}
|
||||
sig, ok := p.(*packet.Signature)
|
||||
if !ok {
|
||||
return nil, errors.New("Packet is not a signature")
|
||||
return nil, errors.New("packet is not a signature")
|
||||
}
|
||||
return sig, nil
|
||||
}
|
||||
|
||||
func extractSignatureAndPayload(signature string) (*packet.Signature, string, error) {
|
||||
s := strings.TrimSpace(signature)
|
||||
|
||||
if strings.HasPrefix(s, "-----BEGIN PGP SIGNED MESSAGE-----") {
|
||||
block, _ := clearsign.Decode([]byte(s))
|
||||
if block == nil {
|
||||
return nil, "", errors.New("failed to decode clearsign block")
|
||||
}
|
||||
p, err := packet.Read(block.ArmoredSignature.Body)
|
||||
if err != nil {
|
||||
return nil, "", errors.New("failed to read signature packet from clearsign")
|
||||
}
|
||||
sig, ok := p.(*packet.Signature)
|
||||
if !ok {
|
||||
return nil, "", errors.New("packet is not a signature")
|
||||
}
|
||||
return sig, string(block.Bytes), nil
|
||||
}
|
||||
|
||||
sig, err := ExtractSignature(s)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return sig, "", nil
|
||||
}
|
||||
|
||||
func checkSignatureWithClearsign(ekeys openpgp.EntityList, token, signature string) (*openpgp.Entity, error) {
|
||||
s := strings.TrimSpace(signature)
|
||||
|
||||
if strings.HasPrefix(s, "-----BEGIN PGP SIGNED MESSAGE-----") {
|
||||
block, _ := clearsign.Decode([]byte(s))
|
||||
if block == nil {
|
||||
return nil, errors.New("failed to decode clearsign block")
|
||||
}
|
||||
if !strings.Contains(string(block.Bytes), token) {
|
||||
return nil, errors.New("clearsign body does not contain token")
|
||||
}
|
||||
return openpgp.CheckDetachedSignature(ekeys, bytes.NewReader(block.Bytes), block.ArmoredSignature.Body, nil)
|
||||
}
|
||||
|
||||
signer, err := openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token), strings.NewReader(signature), nil)
|
||||
if err != nil {
|
||||
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\n"), strings.NewReader(signature), nil)
|
||||
}
|
||||
if err != nil {
|
||||
signer, err = openpgp.CheckArmoredDetachedSignature(ekeys, strings.NewReader(token+"\r\n"), strings.NewReader(signature), nil)
|
||||
}
|
||||
return signer, err
|
||||
}
|
||||
|
||||
func TryGetKeyIDFromSignature(sig *packet.Signature) string {
|
||||
if sig.IssuerKeyId != nil && (*sig.IssuerKeyId) != 0 {
|
||||
return fmt.Sprintf("%016X", *sig.IssuerKeyId)
|
||||
|
||||
@@ -5,94 +5,180 @@ package asymkey
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/base"
|
||||
"gitea.dev/modules/cache"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/setting"
|
||||
)
|
||||
|
||||
// This file provides functions relating verifying gpg keys
|
||||
// VerifyNonce returns true if nonce is valid (not seen before, not expired)
|
||||
// and marks it as used. It strictly validates that the nonce was generated
|
||||
// for the exact domain this instance is running on.
|
||||
func VerifyNonce(nonce string) bool {
|
||||
parts := strings.Split(nonce, ":")
|
||||
if len(parts) < 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
// VerifyGPGKey marks a GPG key as verified
|
||||
func VerifyGPGKey(ctx context.Context, ownerID int64, keyID, token, signature string) (string, error) {
|
||||
return db.WithTx2(ctx, func(ctx context.Context) (string, error) {
|
||||
key := new(GPGKey)
|
||||
var (
|
||||
tsHex = parts[0]
|
||||
domain = parts[1]
|
||||
)
|
||||
|
||||
has, err := db.GetEngine(ctx).Where("owner_id = ? AND key_id = ?", ownerID, keyID).Get(key)
|
||||
if err != nil {
|
||||
return "", err
|
||||
} else if !has {
|
||||
return "", ErrGPGKeyNotExist{}
|
||||
}
|
||||
// Validate timestamp
|
||||
if len(tsHex) != 8 {
|
||||
return false
|
||||
}
|
||||
ts, err := strconv.ParseInt(tsHex, 16, 64)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if err := key.LoadSubKeys(ctx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
const nonceTTL = 5 * time.Minute
|
||||
|
||||
sig, err := ExtractSignature(signature)
|
||||
if err != nil {
|
||||
return "", ErrGPGInvalidTokenSignature{
|
||||
ID: key.KeyID,
|
||||
Wrapped: err,
|
||||
}
|
||||
}
|
||||
now := time.Now().Unix()
|
||||
age := now - ts
|
||||
if age < 0 || age > int64(nonceTTL.Seconds()) {
|
||||
return false // expired or future timestamp
|
||||
}
|
||||
|
||||
signer, err := hashAndVerifyWithSubKeys(sig, token, key)
|
||||
if err != nil {
|
||||
return "", ErrGPGInvalidTokenSignature{
|
||||
ID: key.KeyID,
|
||||
Wrapped: err,
|
||||
}
|
||||
}
|
||||
if signer == nil {
|
||||
signer, err = hashAndVerifyWithSubKeys(sig, token+"\n", key)
|
||||
if err != nil {
|
||||
return "", ErrGPGInvalidTokenSignature{
|
||||
ID: key.KeyID,
|
||||
Wrapped: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
if signer == nil {
|
||||
signer, err = hashAndVerifyWithSubKeys(sig, token+"\n\n", key)
|
||||
if err != nil {
|
||||
return "", ErrGPGInvalidTokenSignature{
|
||||
ID: key.KeyID,
|
||||
Wrapped: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
if domain != setting.Domain && domain != setting.AppURL {
|
||||
return false
|
||||
}
|
||||
|
||||
if signer == nil {
|
||||
log.Debug("VerifyGPGKey failed: no signer")
|
||||
return "", ErrGPGInvalidTokenSignature{
|
||||
ID: key.KeyID,
|
||||
}
|
||||
}
|
||||
key := fmt.Sprintf("gpg_nonce:%s", nonce)
|
||||
|
||||
if signer.PrimaryKeyID != key.KeyID && signer.KeyID != key.KeyID {
|
||||
return "", ErrGPGKeyNotExist{}
|
||||
}
|
||||
_, exists := cache.GetCache().Get(key)
|
||||
if exists {
|
||||
return false
|
||||
}
|
||||
|
||||
key.Verified = true
|
||||
if _, err := db.GetEngine(ctx).ID(key.ID).Cols("verified").Update(key); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err = cache.GetCache().Put(key, "1", int64(nonceTTL.Seconds())); err != nil {
|
||||
log.Error("failed to store nonce into cache: %v", err)
|
||||
return false
|
||||
}
|
||||
|
||||
return key.KeyID, nil
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
// VerificationToken returns token for the user that will be valid in minutes (time)
|
||||
func VerificationToken(user *user_model.User, minutes int) string {
|
||||
return base.EncodeSha256(
|
||||
time.Now().Truncate(1*time.Minute).Add(time.Duration(minutes)*time.Minute).Format(
|
||||
time.RFC1123Z) + ":" +
|
||||
user.CreatedUnix.Format(time.RFC1123Z) + ":" +
|
||||
user.Name + ":" +
|
||||
user.Email + ":" +
|
||||
strconv.FormatInt(user.ID, 10))
|
||||
func VerifyGPGSignature(ctx context.Context, nonce, signature string) (*user_model.User, error) {
|
||||
if !VerifyNonce(nonce) {
|
||||
return nil, ErrGPGInvalidTokenSignature{}
|
||||
}
|
||||
|
||||
sig, clearsignPayload, err := extractSignatureAndPayload(signature)
|
||||
if err != nil {
|
||||
return nil, ErrGPGInvalidTokenSignature{Wrapped: err}
|
||||
}
|
||||
|
||||
if sig.IssuerKeyId == nil {
|
||||
return nil, ErrGPGInvalidTokenSignature{}
|
||||
}
|
||||
keyID := fmt.Sprintf("%016X", *sig.IssuerKeyId)
|
||||
|
||||
key := new(GPGKey)
|
||||
has, err := db.GetEngine(ctx).Where("key_id = ?", keyID).Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, ErrGPGKeyNotExist{}
|
||||
}
|
||||
|
||||
if err := key.LoadSubKeys(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var signer *GPGKey
|
||||
if clearsignPayload != "" {
|
||||
if !strings.Contains(clearsignPayload, nonce) {
|
||||
return nil, ErrGPGInvalidTokenSignature{}
|
||||
}
|
||||
signer, err = hashAndVerifyWithSubKeys(sig, clearsignPayload, key)
|
||||
} else {
|
||||
signer, err = hashAndVerifyWithSubKeys(sig, nonce, key)
|
||||
if signer == nil {
|
||||
signer, err = hashAndVerifyWithSubKeys(sig, nonce+"\n", key)
|
||||
}
|
||||
if signer == nil {
|
||||
signer, err = hashAndVerifyWithSubKeys(sig, nonce+"\n\n", key)
|
||||
}
|
||||
}
|
||||
if signer == nil {
|
||||
return nil, ErrGPGInvalidTokenSignature{ID: key.KeyID, Wrapped: err}
|
||||
}
|
||||
|
||||
user, err := user_model.GetUserByID(ctx, key.OwnerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
func VerifyGPGSignatureWithKey(nonce, signature, armoredKey string) (bool, error) {
|
||||
if !VerifyNonce(nonce) {
|
||||
return false, ErrGPGInvalidTokenSignature{}
|
||||
}
|
||||
|
||||
sig, clearsignPayload, err := extractSignatureAndPayload(signature)
|
||||
if err != nil {
|
||||
return false, ErrGPGInvalidTokenSignature{Wrapped: err}
|
||||
}
|
||||
|
||||
if clearsignPayload != "" && !strings.Contains(clearsignPayload, nonce) {
|
||||
return false, ErrGPGInvalidTokenSignature{}
|
||||
}
|
||||
|
||||
keys, err := CheckArmoredGPGKeyString(armoredKey)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
for _, k := range keys {
|
||||
content, err := Base64EncPubKey(k.PrimaryKey)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
gpgKey := &GPGKey{
|
||||
KeyID: fmt.Sprintf("%016X", k.PrimaryKey.KeyId),
|
||||
Content: content,
|
||||
CanSign: k.PrimaryKey.CanSign(),
|
||||
}
|
||||
|
||||
for _, sub := range k.Subkeys {
|
||||
subContent, err := Base64EncPubKey(sub.PublicKey)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
gpgKey.SubsKey = append(gpgKey.SubsKey, &GPGKey{
|
||||
KeyID: fmt.Sprintf("%016X", sub.PublicKey.KeyId),
|
||||
Content: subContent,
|
||||
CanSign: sub.PublicKey.CanSign(),
|
||||
})
|
||||
}
|
||||
|
||||
var signer *GPGKey
|
||||
if clearsignPayload != "" {
|
||||
signer, _ = hashAndVerifyWithSubKeys(sig, clearsignPayload, gpgKey)
|
||||
} else {
|
||||
signer, _ = hashAndVerifyWithSubKeys(sig, nonce, gpgKey)
|
||||
if signer == nil {
|
||||
signer, _ = hashAndVerifyWithSubKeys(sig, nonce+"\n", gpgKey)
|
||||
}
|
||||
if signer == nil {
|
||||
signer, _ = hashAndVerifyWithSubKeys(sig, nonce+"\n\n", gpgKey)
|
||||
}
|
||||
}
|
||||
if signer != nil {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
return false, ErrGPGInvalidTokenSignature{}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,13 @@ package asymkey
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/base"
|
||||
"gitea.dev/modules/log"
|
||||
|
||||
"github.com/42wim/sshsig"
|
||||
@@ -45,3 +49,14 @@ func VerifySSHKey(ctx context.Context, ownerID int64, fingerprint, token, signat
|
||||
return key.Fingerprint, nil
|
||||
})
|
||||
}
|
||||
|
||||
// VerificationToken returns token for the user that will be valid in minutes (time)
|
||||
func VerificationToken(user *user_model.User, minutes int) string {
|
||||
return base.EncodeSha256(
|
||||
time.Now().Truncate(1*time.Minute).Add(time.Duration(minutes)*time.Minute).Format(
|
||||
time.RFC1123Z) + ":" +
|
||||
user.CreatedUnix.Format(time.RFC1123Z) + ":" +
|
||||
user.Name + ":" +
|
||||
user.Email + ":" +
|
||||
strconv.FormatInt(user.ID, 10))
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ type CreateGPGKeyOption struct {
|
||||
ArmoredKey string `json:"armored_public_key" binding:"Required"`
|
||||
// An optional armored signature for the GPG key
|
||||
Signature string `json:"armored_signature,omitempty"`
|
||||
// Nonce for signature
|
||||
Nonce string `json:"nonce,omitempty"`
|
||||
}
|
||||
|
||||
// VerifyGPGKeyOption options verifies user GPG key
|
||||
@@ -68,4 +70,6 @@ type VerifyGPGKeyOption struct {
|
||||
KeyID string `json:"key_id" binding:"Required"`
|
||||
// The armored signature to verify the GPG key
|
||||
Signature string `json:"armored_signature" binding:"Required"`
|
||||
// Nonce for signature
|
||||
Nonce string `json:"nonce,omitempty"`
|
||||
}
|
||||
|
||||
@@ -341,6 +341,9 @@
|
||||
"auth.invalid_code": "Tento potvrzující kód je neplatný nebo mu vypršela platnost.",
|
||||
"auth.invalid_code_forgot_password": "Váš potvrzovací kód je neplatný nebo mu vypršela platnost. <a href=\"%s\">Klikněte zde</a> pro vytvoření nového kódu.",
|
||||
"auth.invalid_password": "Vaše heslo se neshoduje s heslem, které bylo použito k vytvoření účtu.",
|
||||
"auth.gpg_invalid_token_signature": "Neplatný GPG podpis nebo nonce",
|
||||
"auth.invalid_gpg_identity": "Nepodařilo se extrahovat identitu z GPG klíče",
|
||||
"auth.invalid_gpg_key_email": "Nepodařilo se extrahovat e-mailovou adresu z GPG klíče",
|
||||
"auth.reset_password_helper": "Obnovit účet",
|
||||
"auth.reset_password_wrong_user": "Jste přihlášen/a jako %s, ale odkaz pro obnovení účtu je pro %s",
|
||||
"auth.password_too_short": "Délka hesla musí být minimálně %d znaků.",
|
||||
@@ -685,6 +688,7 @@
|
||||
"settings.gpg_token_required": "Musíte zadat podpis pro níže uvedený token",
|
||||
"settings.gpg_token_help": "Podpis můžete vygenerovat pomocí:",
|
||||
"settings.gpg_token_signature": "Zakódovaný podpis GPG",
|
||||
"settings.gpg_last_key_delete": "Nelze smazat váš jediný klíč",
|
||||
"settings.key_signature_gpg_placeholder": "Začíná s „-----BEGIN PGP SIGNATURE-----“",
|
||||
"settings.verify_gpg_key_success": "GPG klíč „%s“ byl ověřen.",
|
||||
"settings.ssh_key_verified": "Ověřený klíč",
|
||||
@@ -3057,6 +3061,16 @@
|
||||
"gpg.error.no_gpg_keys_found": "V databázi nebyl nalezen žádný známý klíč pro tento podpis",
|
||||
"gpg.error.not_signed_commit": "Nepodepsaná revize",
|
||||
"gpg.error.failed_retrieval_gpg_keys": "Nelze získat žádný klíč propojený s účtem přispěvatele",
|
||||
"gpg.signin.title": "Přihlásit se",
|
||||
"gpg.signin.nonce_label": "Podepište tento nonce svým soukromým klíčem",
|
||||
"gpg.signin.command_hint": "Spusťte tento příkaz a vložte výstup níže:",
|
||||
"gpg.signin.signed_output": "Podepsaný výstup",
|
||||
"gpg.signin.submit": "Přihlásit se",
|
||||
"gpg.signup.title": "Vytvořit účet",
|
||||
"gpg.signup.paste_key": "Vložte svůj veřejný GPG klíč",
|
||||
"gpg.signup.proceed": "Pokračovat",
|
||||
"gpg.signup.submit": "Ověřit a vytvořit účet",
|
||||
"gpg.signup.already_have_account": "Již máte účet?",
|
||||
"units.unit": "Jednotka",
|
||||
"units.error.no_unit_allowed_repo": "Nejste oprávněni přistupovat k žádné části tohoto repozitáře.",
|
||||
"units.error.unit_not_allowed": "Nejste oprávněni přistupovat k této části repozitáře.",
|
||||
@@ -3306,5 +3320,6 @@
|
||||
"git.filemode.normal_file": "Normální soubor",
|
||||
"git.filemode.executable_file": "Spustitelný soubor",
|
||||
"git.filemode.symbolic_link": "Symbolický odkaz",
|
||||
"git.filemode.submodule": "Submodul"
|
||||
}
|
||||
"git.filemode.submodule": "Submodul",
|
||||
"settings.oauth_applications_disabled": "OAuth aplikace jsou v <code>m8sh</code> zakázány, použijte osobní přístupový token."
|
||||
}
|
||||
@@ -334,6 +334,9 @@
|
||||
"auth.invalid_code": "Dein Bestätigungs-Code ist ungültig oder abgelaufen.",
|
||||
"auth.invalid_code_forgot_password": "Dein Bestätigungscode ist ungültig oder abgelaufen. Klicke <a href=\"%s\">hier</a>, um eine neue Sitzung zu starten.",
|
||||
"auth.invalid_password": "Ihr Passwort stimmt nicht mit dem Passwort überein, das zur Erstellung des Kontos verwendet wurde.",
|
||||
"auth.gpg_invalid_token_signature": "Ungültige GPG-Signatur oder Nonce",
|
||||
"auth.invalid_gpg_identity": "Identität konnte nicht aus dem GPG-Schlüssel extrahiert werden",
|
||||
"auth.invalid_gpg_key_email": "E-Mail-Adresse konnte nicht aus dem GPG-Schlüssel extrahiert werden",
|
||||
"auth.reset_password_helper": "Konto wiederherstellen",
|
||||
"auth.reset_password_wrong_user": "Du bist angemeldet als %s, aber der Link zur Kontowiederherstellung ist für %s",
|
||||
"auth.password_too_short": "Das Passwort muss mindestens %d Zeichen lang sein.",
|
||||
@@ -676,6 +679,7 @@
|
||||
"settings.gpg_token_required": "Du musst eine Signatur für das folgende Token angeben",
|
||||
"settings.gpg_token_help": "Du kannst eine Signatur wie folgt generieren:",
|
||||
"settings.gpg_token_signature": "GPG Textsignatur (armored signature)",
|
||||
"settings.gpg_last_key_delete": "Du kannst deinen einzigen Schlüssel nicht löschen",
|
||||
"settings.key_signature_gpg_placeholder": "Beginnt mit '-----BEGIN PGP SIGNATURE-----'",
|
||||
"settings.verify_gpg_key_success": "GPG-Schlüssel \"%s\" wurde verifiziert.",
|
||||
"settings.ssh_key_verified": "Verifizierter Schlüssel",
|
||||
@@ -3005,6 +3009,16 @@
|
||||
"gpg.error.no_gpg_keys_found": "Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden",
|
||||
"gpg.error.not_signed_commit": "Kein signierter Commit",
|
||||
"gpg.error.failed_retrieval_gpg_keys": "Fehler beim Abrufen eines Keys des Commiter-Kontos",
|
||||
"gpg.signin.title": "Anmelden",
|
||||
"gpg.signin.nonce_label": "Signiere diesen Nonce mit deinem privaten Schlüssel",
|
||||
"gpg.signin.command_hint": "Führe diesen Befehl aus und füge die Ausgabe unten ein:",
|
||||
"gpg.signin.signed_output": "Signierte Ausgabe",
|
||||
"gpg.signin.submit": "Anmelden",
|
||||
"gpg.signup.title": "Konto erstellen",
|
||||
"gpg.signup.paste_key": "Füge deinen öffentlichen GPG-Schlüssel ein",
|
||||
"gpg.signup.proceed": "Weiter",
|
||||
"gpg.signup.submit": "Verifizieren & Konto erstellen",
|
||||
"gpg.signup.already_have_account": "Bereits ein Konto?",
|
||||
"units.unit": "Einheit",
|
||||
"units.error.no_unit_allowed_repo": "Du hast keine Berechtigung, auf etwas in diesem Repository zuzugreifen.",
|
||||
"units.error.unit_not_allowed": "Du hast keine Berechtigung, um auf diesen Repository-Bereich zuzugreifen.",
|
||||
@@ -3248,5 +3262,6 @@
|
||||
"git.filemode.normal_file": "Normale Datei",
|
||||
"git.filemode.executable_file": "Ausführbare Datei",
|
||||
"git.filemode.symbolic_link": "Softlink",
|
||||
"git.filemode.submodule": "Submodul"
|
||||
}
|
||||
"git.filemode.submodule": "Submodul",
|
||||
"settings.oauth_applications_disabled": "OAuth-Anwendungen sind in <code>m8sh</code> deaktiviert, verwenden Sie einen persönlichen Zugriffstoken."
|
||||
}
|
||||
@@ -3000,5 +3000,20 @@
|
||||
"git.filemode.directory": "Φάκελος",
|
||||
"git.filemode.normal_file": "Κανονικό αρχείο",
|
||||
"git.filemode.executable_file": "Εκτελέσιμο αρχείο",
|
||||
"git.filemode.submodule": "Υπομονάδα"
|
||||
}
|
||||
"git.filemode.submodule": "Υπομονάδα",
|
||||
"auth.gpg_invalid_token_signature": "Μη έγκυρη υπογραφή GPG ή nonce",
|
||||
"auth.invalid_gpg_identity": "Δεν ήταν δυνατή η εξαγωγή ταυτότητας από το κλειδί GPG",
|
||||
"auth.invalid_gpg_key_email": "Δεν ήταν δυνατή η εξαγωγή διεύθυνσης email από το κλειδί GPG",
|
||||
"settings.gpg_last_key_delete": "Δεν μπορείτε να διαγράψετε το μοναδικό σας κλειδί",
|
||||
"gpg.signin.title": "Σύνδεση",
|
||||
"gpg.signin.nonce_label": "Υπογράψτε αυτό το nonce με το ιδιωτικό σας κλειδί",
|
||||
"gpg.signin.command_hint": "Εκτελέστε αυτήν την εντολή και επικολλήστε το αποτέλεσμα παρακάτω:",
|
||||
"gpg.signin.signed_output": "Υπογεγραμμένη έξοδος",
|
||||
"gpg.signin.submit": "Σύνδεση",
|
||||
"gpg.signup.title": "Δημιουργία λογαριασμού",
|
||||
"gpg.signup.paste_key": "Επικολλήστε το δημόσιο κλειδί GPG σας",
|
||||
"gpg.signup.proceed": "Συνέχεια",
|
||||
"gpg.signup.submit": "Επαλήθευση & Δημιουργία λογαριασμού",
|
||||
"gpg.signup.already_have_account": "Έχετε ήδη λογαριασμό;",
|
||||
"settings.oauth_applications_disabled": "Οι εφαρμογές OAuth είναι απενεργοποιημένες στο <code>m8sh</code>, χρησιμοποιήστε προσωπικό διακριτικό πρόσβασης."
|
||||
}
|
||||
@@ -407,6 +407,9 @@
|
||||
"auth.invalid_code": "Your confirmation code is invalid or has expired.",
|
||||
"auth.invalid_code_forgot_password": "Your confirmation code is invalid or has expired. Click <a href=\"%s\">here</a> to start a new session.",
|
||||
"auth.invalid_password": "Your password does not match the password that was used to create the account.",
|
||||
"auth.gpg_invalid_token_signature": "Invalid GPG signature or nonce",
|
||||
"auth.invalid_gpg_identity": "Could not extract identity from GPG key",
|
||||
"auth.invalid_gpg_key_email": "Could not extract email address from GPG key",
|
||||
"auth.reset_password_helper": "Recover Account",
|
||||
"auth.reset_password_wrong_user": "You are signed in as %s, but the account recovery link is meant for %s",
|
||||
"auth.password_too_short": "Password length cannot be less than %d characters.",
|
||||
@@ -793,6 +796,7 @@
|
||||
"settings.gpg_token": "Token",
|
||||
"settings.gpg_token_help": "You can generate a signature using:",
|
||||
"settings.gpg_token_signature": "Armored GPG signature",
|
||||
"settings.gpg_last_key_delete": "Cannot delete your only key",
|
||||
"settings.key_signature_gpg_placeholder": "Begins with '-----BEGIN PGP SIGNATURE-----'",
|
||||
"settings.verify_gpg_key_success": "GPG key \"%s\" has been verified.",
|
||||
"settings.ssh_key_verified": "Verified Key",
|
||||
@@ -3511,6 +3515,16 @@
|
||||
"gpg.error.failed_retrieval_gpg_keys": "Failed to retrieve any key attached to the committer's account",
|
||||
"gpg.error.probable_bad_signature": "WARNING! Although there is a key with this ID in the database, it does not verify this commit! This commit is SUSPICIOUS.",
|
||||
"gpg.error.probable_bad_default_signature": "WARNING! Although the default key has this ID, it does not verify this commit! This commit is SUSPICIOUS.",
|
||||
"gpg.signin.title": "Sign In",
|
||||
"gpg.signin.nonce_label": "Sign this nonce with your private key",
|
||||
"gpg.signin.command_hint": "Run this command, then paste the output below:",
|
||||
"gpg.signin.signed_output": "Signed output",
|
||||
"gpg.signin.submit": "Sign In",
|
||||
"gpg.signup.title": "Create your account",
|
||||
"gpg.signup.paste_key": "Paste your GPG public key",
|
||||
"gpg.signup.proceed": "Proceed",
|
||||
"gpg.signup.submit": "Verify & Create Account",
|
||||
"gpg.signup.already_have_account": "Already have an account?",
|
||||
"units.unit": "Unit",
|
||||
"units.error.no_unit_allowed_repo": "You are not allowed to access any section of this repository.",
|
||||
"units.error.unit_not_allowed": "You are not allowed to access this repository section.",
|
||||
@@ -3895,5 +3909,6 @@
|
||||
"actions.general.cross_repo_desc": "Allow the selected repositories to be accessed (read-only) by all the repositories in this owner with GITEA_TOKEN when running Actions jobs.",
|
||||
"actions.general.cross_repo_selected": "Selected repositories",
|
||||
"actions.general.cross_repo_target_repos": "Target Repositories",
|
||||
"actions.general.cross_repo_add": "Add Target Repository"
|
||||
"actions.general.cross_repo_add": "Add Target Repository",
|
||||
"settings.oauth_applications_disabled": "OAuth applications are disabled in <code>m8sh</code>, use personal access token."
|
||||
}
|
||||
|
||||
@@ -300,6 +300,9 @@
|
||||
"auth.invalid_code": "Su código de confirmación no es válido o ha caducado.",
|
||||
"auth.invalid_code_forgot_password": "Su código de confirmación no es válido o ha caducado. Haga clic <a href=\"%s\">aquí</a> para iniciar una nueva sesión.",
|
||||
"auth.invalid_password": "Su contraseña no coincide con la contraseña utilizada para crear la cuenta.",
|
||||
"auth.gpg_invalid_token_signature": "Firma GPG o nonce inválido",
|
||||
"auth.invalid_gpg_identity": "No se pudo extraer la identidad de la clave GPG",
|
||||
"auth.invalid_gpg_key_email": "No se pudo extraer el correo electrónico de la clave GPG",
|
||||
"auth.reset_password_helper": "Recuperar cuenta",
|
||||
"auth.reset_password_wrong_user": "Has iniciado sesión como %s, pero el enlace de recuperación de la cuenta está destinado a %s",
|
||||
"auth.password_too_short": "La longitud de la contraseña no puede ser menor a %d caracteres.",
|
||||
@@ -608,6 +611,7 @@
|
||||
"settings.gpg_token_required": "Debe proporcionar una firma para el token de abajo",
|
||||
"settings.gpg_token_help": "Puede generar una firma de la siguiente manera:",
|
||||
"settings.gpg_token_signature": "Firma GPG armadura",
|
||||
"settings.gpg_last_key_delete": "No puedes eliminar tu única clave",
|
||||
"settings.key_signature_gpg_placeholder": "Comienza con '-----BEGIN PGP SIGNATURE-----'",
|
||||
"settings.verify_gpg_key_success": "La clave GPG \"%s\" ha sido verificada.",
|
||||
"settings.ssh_key_verified": "Clave verificada",
|
||||
@@ -2732,6 +2736,16 @@
|
||||
"gpg.error.no_gpg_keys_found": "No se encontró ninguna clave conocida en la base de datos para esta firma",
|
||||
"gpg.error.not_signed_commit": "No es un commit firmado",
|
||||
"gpg.error.failed_retrieval_gpg_keys": "No se pudo recuperar cualquier clave adjunta a la cuenta del committer",
|
||||
"gpg.signin.title": "Iniciar sesión",
|
||||
"gpg.signin.nonce_label": "Firma este nonce con tu clave privada",
|
||||
"gpg.signin.command_hint": "Ejecuta este comando y pega el resultado abajo:",
|
||||
"gpg.signin.signed_output": "Salida firmada",
|
||||
"gpg.signin.submit": "Iniciar sesión",
|
||||
"gpg.signup.title": "Crear tu cuenta",
|
||||
"gpg.signup.paste_key": "Pega tu clave pública GPG",
|
||||
"gpg.signup.proceed": "Continuar",
|
||||
"gpg.signup.submit": "Verificar y crear cuenta",
|
||||
"gpg.signup.already_have_account": "¿Ya tienes una cuenta?",
|
||||
"units.unit": "Unidad",
|
||||
"units.error.no_unit_allowed_repo": "No tiene permisos para acceder a ninguna sección de este repositorio.",
|
||||
"units.error.unit_not_allowed": "No tiene permisos para acceder a esta sección del repositorio.",
|
||||
@@ -2959,5 +2973,6 @@
|
||||
"git.filemode.normal_file": "Archivo normal",
|
||||
"git.filemode.executable_file": "Archivo ejecutable",
|
||||
"git.filemode.symbolic_link": "Enlace simbólico",
|
||||
"git.filemode.submodule": "Submódulo"
|
||||
}
|
||||
"git.filemode.submodule": "Submódulo",
|
||||
"settings.oauth_applications_disabled": "Las aplicaciones OAuth están deshabilitadas en <code>m8sh</code>, usa un token de acceso personal."
|
||||
}
|
||||
@@ -2228,5 +2228,20 @@
|
||||
"actions.runners.status.active": "فعال",
|
||||
"actions.runners.version": "نسخه",
|
||||
"actions.runs.commit": "کامیت",
|
||||
"git.filemode.symbolic_link": "پیوند نمادین"
|
||||
}
|
||||
"git.filemode.symbolic_link": "پیوند نمادین",
|
||||
"auth.gpg_invalid_token_signature": "امضای GPG یا nonce نامعتبر است",
|
||||
"auth.invalid_gpg_identity": "استخراج هویت از کلید GPG امکانپذیر نبود",
|
||||
"auth.invalid_gpg_key_email": "استخراج آدرس ایمیل از کلید GPG امکانپذیر نبود",
|
||||
"settings.gpg_last_key_delete": "نمیتوانید تنها کلید خود را حذف کنید",
|
||||
"gpg.signin.title": "ورود",
|
||||
"gpg.signin.nonce_label": "این nonce را با کلید خصوصی خود امضا کنید",
|
||||
"gpg.signin.command_hint": "این دستور را اجرا کنید و خروجی را در زیر جایگذاری کنید:",
|
||||
"gpg.signin.signed_output": "خروجی امضاشده",
|
||||
"gpg.signin.submit": "ورود",
|
||||
"gpg.signup.title": "ایجاد حساب کاربری",
|
||||
"gpg.signup.paste_key": "کلید عمومی GPG خود را جایگذاری کنید",
|
||||
"gpg.signup.proceed": "ادامه",
|
||||
"gpg.signup.submit": "تأیید و ایجاد حساب",
|
||||
"gpg.signup.already_have_account": "قبلاً حساب دارید؟",
|
||||
"settings.oauth_applications_disabled": "برنامههای OAuth در <code>m8sh</code> غیرفعال هستند، از توکن دسترسی شخصی استفاده کنید."
|
||||
}
|
||||
@@ -1474,5 +1474,20 @@
|
||||
"actions.runners.labels": "Tunnisteet",
|
||||
"actions.runners.task_list.run": "Suorita",
|
||||
"actions.runners.task_list.repository": "Repo",
|
||||
"actions.runners.version": "Versio"
|
||||
}
|
||||
"actions.runners.version": "Versio",
|
||||
"auth.gpg_invalid_token_signature": "Virheellinen GPG-allekirjoitus tai nonce",
|
||||
"auth.invalid_gpg_identity": "Henkilöllisyyttä ei voitu poimia GPG-avaimesta",
|
||||
"auth.invalid_gpg_key_email": "Sähköpostiosoitetta ei voitu poimia GPG-avaimesta",
|
||||
"settings.gpg_last_key_delete": "Et voi poistaa ainoaa avainta",
|
||||
"gpg.signin.title": "Kirjaudu sisään",
|
||||
"gpg.signin.nonce_label": "Allekirjoita tämä nonce yksityisellä avaimellasi",
|
||||
"gpg.signin.command_hint": "Suorita tämä komento ja liitä tulos alle:",
|
||||
"gpg.signin.signed_output": "Allekirjoitettu tulos",
|
||||
"gpg.signin.submit": "Kirjaudu sisään",
|
||||
"gpg.signup.title": "Luo tili",
|
||||
"gpg.signup.paste_key": "Liitä GPG-julkinen avaimesi",
|
||||
"gpg.signup.proceed": "Jatka",
|
||||
"gpg.signup.submit": "Vahvista ja luo tili",
|
||||
"gpg.signup.already_have_account": "Onko sinulla jo tili?",
|
||||
"settings.oauth_applications_disabled": "OAuth-sovellukset on poistettu käytöstä <code>m8sh</code>-järjestelmässä, käytä henkilökohtaista käyttöoikeustunnusta."
|
||||
}
|
||||
@@ -407,6 +407,9 @@
|
||||
"auth.invalid_code": "Votre code de confirmation est invalide ou a expiré.",
|
||||
"auth.invalid_code_forgot_password": "Votre code de confirmation est invalide ou a expiré. Cliquez <a href=\"%s\">ici</a> pour démarrer une nouvelle session.",
|
||||
"auth.invalid_password": "Votre mot de passe ne correspond pas à celui utilisé pour créer le compte.",
|
||||
"auth.gpg_invalid_token_signature": "Signature GPG ou nonce invalide",
|
||||
"auth.invalid_gpg_identity": "Impossible d'extraire l'identité de la clé GPG",
|
||||
"auth.invalid_gpg_key_email": "Impossible d'extraire l'adresse e-mail de la clé GPG",
|
||||
"auth.reset_password_helper": "Récupérer un compte",
|
||||
"auth.reset_password_wrong_user": "Vous êtes connecté en tant que %s, mais le lien de récupération est pour %s",
|
||||
"auth.password_too_short": "Le mot de passe doit contenir %d caractères minimum.",
|
||||
@@ -793,6 +796,7 @@
|
||||
"settings.gpg_token": "Jeton",
|
||||
"settings.gpg_token_help": "Vous pouvez générer une signature en utilisant :",
|
||||
"settings.gpg_token_signature": "Signature GPG renforcée",
|
||||
"settings.gpg_last_key_delete": "Impossible de supprimer votre seule clé",
|
||||
"settings.key_signature_gpg_placeholder": "Commence par '-----BEGIN PGP SIGNATURE-----'",
|
||||
"settings.verify_gpg_key_success": "La clé GPG \"%s\" a été vérifiée.",
|
||||
"settings.ssh_key_verified": "Clé vérifiée",
|
||||
@@ -3498,6 +3502,16 @@
|
||||
"gpg.error.failed_retrieval_gpg_keys": "Impossible de récupérer la clé liée au compte de l'auteur",
|
||||
"gpg.error.probable_bad_signature": "AVERTISSEMENT ! Bien qu’il y ait une clé avec cet ID dans la base de données, elle ne vérifie pas cette révision ! Cette révision est SUSPECTE.",
|
||||
"gpg.error.probable_bad_default_signature": "AVERTISSEMENT ! Bien que la clé par défaut ait cet ID, elle ne vérifie pas cette révision ! Cette révision est SUSPECTE.",
|
||||
"gpg.signin.title": "Se connecter",
|
||||
"gpg.signin.nonce_label": "Signez ce nonce avec votre clé privée",
|
||||
"gpg.signin.command_hint": "Exécutez cette commande puis collez le résultat ci-dessous :",
|
||||
"gpg.signin.signed_output": "Sortie signée",
|
||||
"gpg.signin.submit": "Se connecter",
|
||||
"gpg.signup.title": "Créer votre compte",
|
||||
"gpg.signup.paste_key": "Collez votre clé publique GPG",
|
||||
"gpg.signup.proceed": "Continuer",
|
||||
"gpg.signup.submit": "Vérifier & créer le compte",
|
||||
"gpg.signup.already_have_account": "Vous avez déjà un compte ?",
|
||||
"units.unit": "Ressource",
|
||||
"units.error.no_unit_allowed_repo": "Vous n'êtes pas autorisé à accéder à n'importe quelle section de ce dépôt.",
|
||||
"units.error.unit_not_allowed": "Vous n'êtes pas autorisé à accéder à cette section du dépôt.",
|
||||
@@ -3865,5 +3879,6 @@
|
||||
"actions.general.cross_repo_desc": "Permet aux dépôts sélectionnés d’être visible en lecture-seule par tous les dépôts de ce propriétaire à l’aide de GITEA_TOKEN lors de l’exécution des tâches d’actions.",
|
||||
"actions.general.cross_repo_selected": "Dépôts sélectionnés",
|
||||
"actions.general.cross_repo_target_repos": "Dépôts cibles",
|
||||
"actions.general.cross_repo_add": "Ajouter un dépôt cible"
|
||||
}
|
||||
"actions.general.cross_repo_add": "Ajouter un dépôt cible",
|
||||
"settings.oauth_applications_disabled": "Les applications OAuth sont désactivées dans <code>m8sh</code>, utilisez un jeton d'accès personnel."
|
||||
}
|
||||
@@ -3895,5 +3895,20 @@
|
||||
"actions.general.cross_repo_desc": "Ceadaigh rochtain (léamh amháin) a bheith ag na stórtha uile san úinéir seo ar na stórtha roghnaithe le GITEA_TOKEN agus poist Gníomhartha á reáchtáil.",
|
||||
"actions.general.cross_repo_selected": "Stórtha roghnaithe",
|
||||
"actions.general.cross_repo_target_repos": "Stórtha Spriocdhírithe",
|
||||
"actions.general.cross_repo_add": "Cuir Stór Sprioc leis"
|
||||
}
|
||||
"actions.general.cross_repo_add": "Cuir Stór Sprioc leis",
|
||||
"auth.gpg_invalid_token_signature": "Síniú GPG nó nonce neamhbhailí",
|
||||
"auth.invalid_gpg_identity": "Níorbh fhéidir céannacht a bhaint as an eochair GPG",
|
||||
"auth.invalid_gpg_key_email": "Níorbh fhéidir seoladh ríomhphoist a bhaint as an eochair GPG",
|
||||
"settings.gpg_last_key_delete": "Ní féidir leat d'aon eochair amháin a scriosadh",
|
||||
"gpg.signin.title": "Sínigh isteach",
|
||||
"gpg.signin.nonce_label": "Sínigh an nonce seo le d'eochair phríobháideach",
|
||||
"gpg.signin.command_hint": "Rith an t-ordú seo agus greamaigh an t-aschur thíos:",
|
||||
"gpg.signin.signed_output": "Aschur sínithe",
|
||||
"gpg.signin.submit": "Sínigh isteach",
|
||||
"gpg.signup.title": "Cruthaigh do chuntas",
|
||||
"gpg.signup.paste_key": "Greamaigh d'eochair phoiblí GPG",
|
||||
"gpg.signup.proceed": "Ar aghaidh",
|
||||
"gpg.signup.submit": "Fíoraigh & cruthaigh cuntas",
|
||||
"gpg.signup.already_have_account": "An bhfuil cuntas agat cheana?",
|
||||
"settings.oauth_applications_disabled": "Tá feidhmchláir OAuth díchumasaithe i <code>m8sh</code>, bain úsáid as comhartha rochtana pearsanta."
|
||||
}
|
||||
@@ -1383,5 +1383,20 @@
|
||||
"actions.runners.task_list.repository": "Tároló",
|
||||
"actions.runners.status.active": "Aktív",
|
||||
"actions.runners.version": "Verzió",
|
||||
"git.filemode.symbolic_link": "Szimbolikus hivatkozás"
|
||||
}
|
||||
"git.filemode.symbolic_link": "Szimbolikus hivatkozás",
|
||||
"auth.gpg_invalid_token_signature": "Érvénytelen GPG aláírás vagy nonce",
|
||||
"auth.invalid_gpg_identity": "Nem sikerült azonosságot kinyerni a GPG kulcsból",
|
||||
"auth.invalid_gpg_key_email": "Nem sikerült e-mail címet kinyerni a GPG kulcsból",
|
||||
"settings.gpg_last_key_delete": "Nem törölheted az egyetlen kulcsodat",
|
||||
"gpg.signin.title": "Bejelentkezés",
|
||||
"gpg.signin.nonce_label": "Írd alá ezt a nonce-t a privát kulcsoddal",
|
||||
"gpg.signin.command_hint": "Futtasd ezt a parancsot, majd illeszd be az eredményt alább:",
|
||||
"gpg.signin.signed_output": "Aláírt kimenet",
|
||||
"gpg.signin.submit": "Bejelentkezés",
|
||||
"gpg.signup.title": "Fiók létrehozása",
|
||||
"gpg.signup.paste_key": "Illeszd be a GPG nyilvános kulcsodat",
|
||||
"gpg.signup.proceed": "Tovább",
|
||||
"gpg.signup.submit": "Ellenőrzés & fiók létrehozása",
|
||||
"gpg.signup.already_have_account": "Már van fiókod?",
|
||||
"settings.oauth_applications_disabled": "Az OAuth-alkalmazások le vannak tiltva a <code>m8sh</code>-ban, használjon személyes hozzáférési tokent."
|
||||
}
|
||||
@@ -1198,5 +1198,20 @@
|
||||
"actions.variables.update.success": "Variabel telah diedit.",
|
||||
"projects.type-1.display_name": "Proyek Individu",
|
||||
"projects.type-2.display_name": "Proyek Repositori",
|
||||
"projects.type-3.display_name": "Proyek Organisasi"
|
||||
}
|
||||
"projects.type-3.display_name": "Proyek Organisasi",
|
||||
"auth.gpg_invalid_token_signature": "Tanda tangan GPG atau nonce tidak valid",
|
||||
"auth.invalid_gpg_identity": "Gagal mengekstrak identitas dari kunci GPG",
|
||||
"auth.invalid_gpg_key_email": "Gagal mengekstrak alamat email dari kunci GPG",
|
||||
"settings.gpg_last_key_delete": "Anda tidak dapat menghapus satu-satunya kunci",
|
||||
"gpg.signin.title": "Masuk",
|
||||
"gpg.signin.nonce_label": "Tandatangani nonce ini dengan kunci pribadi Anda",
|
||||
"gpg.signin.command_hint": "Jalankan perintah ini lalu tempel hasilnya di bawah:",
|
||||
"gpg.signin.signed_output": "Output yang ditandatangani",
|
||||
"gpg.signin.submit": "Masuk",
|
||||
"gpg.signup.title": "Buat akun",
|
||||
"gpg.signup.paste_key": "Tempel kunci publik GPG Anda",
|
||||
"gpg.signup.proceed": "Lanjutkan",
|
||||
"gpg.signup.submit": "Verifikasi & buat akun",
|
||||
"gpg.signup.already_have_account": "Sudah punya akun?",
|
||||
"settings.oauth_applications_disabled": "Aplikasi OAuth dinonaktifkan di <code>m8sh</code>, gunakan token akses pribadi."
|
||||
}
|
||||
@@ -1116,5 +1116,20 @@
|
||||
"actions.runners.task_list.commit": "Framlag",
|
||||
"actions.runners.status.active": "Virkt",
|
||||
"actions.runners.version": "Útgáfa",
|
||||
"actions.runs.commit": "Framlag"
|
||||
}
|
||||
"actions.runs.commit": "Framlag",
|
||||
"auth.gpg_invalid_token_signature": "Ógilt GPG undirskrift eða nonce",
|
||||
"auth.invalid_gpg_identity": "Tókst ekki að draga út auðkenni úr GPG lykli",
|
||||
"auth.invalid_gpg_key_email": "Tókst ekki að draga út netfang úr GPG lykli",
|
||||
"settings.gpg_last_key_delete": "Þú getur ekki eytt eina lyklinum þínum",
|
||||
"gpg.signin.title": "Skrá inn",
|
||||
"gpg.signin.nonce_label": "Undirritaðu þetta nonce með leynilyklinum þínum",
|
||||
"gpg.signin.command_hint": "Keyrðu þessa skipun og límdu niðurstöðuna hér að neðan:",
|
||||
"gpg.signin.signed_output": "Undirrituð úttak",
|
||||
"gpg.signin.submit": "Skrá inn",
|
||||
"gpg.signup.title": "Búa til reikning",
|
||||
"gpg.signup.paste_key": "Límdu GPG opinbera lykilinn þinn",
|
||||
"gpg.signup.proceed": "Halda áfram",
|
||||
"gpg.signup.submit": "Staðfesta & búa til reikning",
|
||||
"gpg.signup.already_have_account": "Áttu nú þegar reikning?",
|
||||
"settings.oauth_applications_disabled": "OAuth forrit eru óvirk í <code>m8sh</code>, notaðu persónulegan aðgangstákn."
|
||||
}
|
||||
@@ -2377,5 +2377,20 @@
|
||||
"actions.runners.task_list.run": "Esegui",
|
||||
"actions.runners.status.active": "Attivo",
|
||||
"actions.runners.version": "Versione",
|
||||
"git.filemode.symbolic_link": "Link Simbolico"
|
||||
}
|
||||
"git.filemode.symbolic_link": "Link Simbolico",
|
||||
"auth.gpg_invalid_token_signature": "Firma GPG o nonce non validi",
|
||||
"auth.invalid_gpg_identity": "Impossibile estrarre l'identità dalla chiave GPG",
|
||||
"auth.invalid_gpg_key_email": "Impossibile estrarre l'indirizzo email dalla chiave GPG",
|
||||
"settings.gpg_last_key_delete": "Non puoi eliminare l'unica tua chiave",
|
||||
"gpg.signin.title": "Accedi",
|
||||
"gpg.signin.nonce_label": "Firma questo nonce con la tua chiave privata",
|
||||
"gpg.signin.command_hint": "Esegui questo comando e incolla l'output qui sotto:",
|
||||
"gpg.signin.signed_output": "Output firmato",
|
||||
"gpg.signin.submit": "Accedi",
|
||||
"gpg.signup.title": "Crea il tuo account",
|
||||
"gpg.signup.paste_key": "Incolla la tua chiave pubblica GPG",
|
||||
"gpg.signup.proceed": "Continua",
|
||||
"gpg.signup.submit": "Verifica e crea account",
|
||||
"gpg.signup.already_have_account": "Hai già un account?",
|
||||
"settings.oauth_applications_disabled": "Le applicazioni OAuth sono disabilitate in <code>m8sh</code>, usa un token di accesso personale."
|
||||
}
|
||||
@@ -407,6 +407,9 @@
|
||||
"auth.invalid_code": "確認コードが無効か期限切れです。",
|
||||
"auth.invalid_code_forgot_password": "確認コードは無効または期限切れです。 新しいセッションを開始するには<a href=\"%s\">ここ</a>をクリックしてください。",
|
||||
"auth.invalid_password": "アカウントの作成に使用されたパスワードと一致しません。",
|
||||
"auth.gpg_invalid_token_signature": "GPG署名またはnonceが無効です",
|
||||
"auth.invalid_gpg_identity": "GPGキーからIDを抽出できませんでした",
|
||||
"auth.invalid_gpg_key_email": "GPGキーからメールアドレスを抽出できませんでした",
|
||||
"auth.reset_password_helper": "アカウント回復",
|
||||
"auth.reset_password_wrong_user": "あなたは %s でサインイン中ですが、アカウント回復のリンクは %s のものです。",
|
||||
"auth.password_too_short": "%d文字未満のパスワードは設定できません。",
|
||||
@@ -793,6 +796,7 @@
|
||||
"settings.gpg_token": "トークン",
|
||||
"settings.gpg_token_help": "署名はこの方法で生成できます:",
|
||||
"settings.gpg_token_signature": "Armor形式のGPG署名",
|
||||
"settings.gpg_last_key_delete": "唯一の鍵は削除できません",
|
||||
"settings.key_signature_gpg_placeholder": "先頭は '-----BEGIN PGP SIGNATURE-----'",
|
||||
"settings.verify_gpg_key_success": "GPG鍵 \"%s\" を確認しました。",
|
||||
"settings.ssh_key_verified": "確認済みの鍵",
|
||||
@@ -3861,5 +3865,6 @@
|
||||
"actions.general.cross_repo_desc": "Actionsジョブの実行時に、このオーナーのすべてのリポジトリから選択したリポジトリへ、GITEA_TOKENを使用して(読み取り専用で)アクセスすることを許可します。",
|
||||
"actions.general.cross_repo_selected": "選択したリポジトリ",
|
||||
"actions.general.cross_repo_target_repos": "対象リポジトリ",
|
||||
"actions.general.cross_repo_add": "対象リポジトリの追加"
|
||||
}
|
||||
"actions.general.cross_repo_add": "対象リポジトリの追加",
|
||||
"settings.oauth_applications_disabled": "<code>m8sh</code> では OAuth アプリケーションは無効です。個人用アクセストークンを使用してください。"
|
||||
}
|
||||
@@ -407,6 +407,9 @@
|
||||
"auth.invalid_code": "검증 코드가 유효하지 않거나 만료되었습니다.",
|
||||
"auth.invalid_code_forgot_password": "확인 코드가 유효하지 않거나 만료되었습니다. <a href=\"%s\">여기</a>를 눌러 새로운 세션을 시작하세요.",
|
||||
"auth.invalid_password": "비밀번호가 계정을 만들 때 사용한 비밀번호와 일치하지 않습니다.",
|
||||
"auth.gpg_invalid_token_signature": "유효하지 않은 GPG 서명 또는 nonce",
|
||||
"auth.invalid_gpg_identity": "GPG 키에서 신원을 추출할 수 없습니다",
|
||||
"auth.invalid_gpg_key_email": "GPG 키에서 이메일 주소를 추출할 수 없습니다",
|
||||
"auth.reset_password_helper": "계정 복구",
|
||||
"auth.reset_password_wrong_user": "%s로 로그인했지만 계정 복구 링크는 %s를 위한 것입니다",
|
||||
"auth.password_too_short": "비밀번호의 길이는 최소 %d 자가 되어야 합니다.",
|
||||
@@ -793,6 +796,7 @@
|
||||
"settings.gpg_token": "토큰",
|
||||
"settings.gpg_token_help": "서명은 다음 명령어로 생성할 수 있습니다:",
|
||||
"settings.gpg_token_signature": "아머드 GPG 서명",
|
||||
"settings.gpg_last_key_delete": "유일한 키는 삭제할 수 없습니다",
|
||||
"settings.key_signature_gpg_placeholder": "'-----BEGIN PGP PUBLIC KEY BLOCK-----' 로 시작",
|
||||
"settings.verify_gpg_key_success": "GPG 키 \"%s\"가 검증되었습니다.",
|
||||
"settings.ssh_key_verified": "검증된 키",
|
||||
@@ -3499,6 +3503,16 @@
|
||||
"gpg.error.failed_retrieval_gpg_keys": "커미터 계정에 연결된 키를 가져오지 못함",
|
||||
"gpg.error.probable_bad_signature": "경고! 이 ID를 가진 키가 데이터베이스에 있지만 이 커밋을 검증하지 않습니다! 이 커밋은 의심스럽습니다.",
|
||||
"gpg.error.probable_bad_default_signature": "경고! 기본 키는 이 ID를 가지지만 이 커밋을 검증하지 않습니다! 이 커밋은 의심스럽습니다.",
|
||||
"gpg.signin.title": "로그인",
|
||||
"gpg.signin.nonce_label": "개인 키로 이 nonce에 서명하세요",
|
||||
"gpg.signin.command_hint": "이 명령을 실행하고 아래에 출력을 붙여넣으세요:",
|
||||
"gpg.signin.signed_output": "서명된 출력",
|
||||
"gpg.signin.submit": "로그인",
|
||||
"gpg.signup.title": "계정 만들기",
|
||||
"gpg.signup.paste_key": "GPG 공개 키를 붙여넣으세요",
|
||||
"gpg.signup.proceed": "계속",
|
||||
"gpg.signup.submit": "확인 및 계정 생성",
|
||||
"gpg.signup.already_have_account": "이미 계정이 있으신가요?",
|
||||
"units.unit": "단위",
|
||||
"units.error.no_unit_allowed_repo": "이 리포지토리의 어떤 섹션에도 접근할 수 없습니다.",
|
||||
"units.error.unit_not_allowed": "이 리포지토리 섹션에 접근할 수 없습니다.",
|
||||
@@ -3878,5 +3892,6 @@
|
||||
"actions.general.cross_repo_desc": "선택된 저장소가 이 소유자의 모든 저장소에서 액션 작업을 실행할 때 GITEA_TOKEN을 사용하여 (읽기 전용으로) 액세스할 수 있도록 허용합니다.",
|
||||
"actions.general.cross_repo_selected": "선택된 리포지토리",
|
||||
"actions.general.cross_repo_target_repos": "대상 리포지토리",
|
||||
"actions.general.cross_repo_add": "대상 리포지토리 추가"
|
||||
}
|
||||
"actions.general.cross_repo_add": "대상 리포지토리 추가",
|
||||
"settings.oauth_applications_disabled": "<code>m8sh</code>에서 OAuth 애플리케이션이 비활성화되었습니다. 개인 액세스 토큰을 사용하세요."
|
||||
}
|
||||
@@ -3042,5 +3042,20 @@
|
||||
"git.filemode.normal_file": "Parasts fails",
|
||||
"git.filemode.executable_file": "Izpildāmais fails",
|
||||
"git.filemode.symbolic_link": "Simboliska saite",
|
||||
"git.filemode.submodule": "Apakšmodulis"
|
||||
}
|
||||
"git.filemode.submodule": "Apakšmodulis",
|
||||
"auth.gpg_invalid_token_signature": "Nederīgs GPG paraksts vai nonce",
|
||||
"auth.invalid_gpg_identity": "Neizdevās iegūt identitāti no GPG atslēgas",
|
||||
"auth.invalid_gpg_key_email": "Neizdevās iegūt e-pasta adresi no GPG atslēgas",
|
||||
"settings.gpg_last_key_delete": "Nevar dzēst vienīgo atslēgu",
|
||||
"gpg.signin.title": "Pierakstīties",
|
||||
"gpg.signin.nonce_label": "Parakstiet šo nonce ar savu privāto atslēgu",
|
||||
"gpg.signin.command_hint": "Izpildiet šo komandu un ielīmējiet rezultātu zemāk:",
|
||||
"gpg.signin.signed_output": "Parakstīts rezultāts",
|
||||
"gpg.signin.submit": "Pierakstīties",
|
||||
"gpg.signup.title": "Izveidot kontu",
|
||||
"gpg.signup.paste_key": "Ielīmējiet savu GPG publisko atslēgu",
|
||||
"gpg.signup.proceed": "Turpināt",
|
||||
"gpg.signup.submit": "Verificēt un izveidot kontu",
|
||||
"gpg.signup.already_have_account": "Jums jau ir konts?",
|
||||
"settings.oauth_applications_disabled": "OAuth lietotnes ir atspējotas <code>m8sh</code>, izmantojiet personīgo piekļuves tokenu."
|
||||
}
|
||||
@@ -2093,5 +2093,20 @@
|
||||
"actions.runners.task_list.run": "Uitvoeren",
|
||||
"actions.runners.task_list.repository": "Opslagplaats",
|
||||
"actions.runners.status.active": "Actief",
|
||||
"actions.runners.version": "Versie"
|
||||
}
|
||||
"actions.runners.version": "Versie",
|
||||
"auth.gpg_invalid_token_signature": "Ongeldige GPG-handtekening of nonce",
|
||||
"auth.invalid_gpg_identity": "Kon identiteit niet extraheren uit GPG-sleutel",
|
||||
"auth.invalid_gpg_key_email": "Kon e-mailadres niet extraheren uit GPG-sleutel",
|
||||
"settings.gpg_last_key_delete": "Je kunt je enige sleutel niet verwijderen",
|
||||
"gpg.signin.title": "Inloggen",
|
||||
"gpg.signin.nonce_label": "Onderteken deze nonce met je privésleutel",
|
||||
"gpg.signin.command_hint": "Voer dit commando uit en plak de uitvoer hieronder:",
|
||||
"gpg.signin.signed_output": "Ondertekende uitvoer",
|
||||
"gpg.signin.submit": "Inloggen",
|
||||
"gpg.signup.title": "Account aanmaken",
|
||||
"gpg.signup.paste_key": "Plak je GPG publieke sleutel",
|
||||
"gpg.signup.proceed": "Doorgaan",
|
||||
"gpg.signup.submit": "Verifiëren & account aanmaken",
|
||||
"gpg.signup.already_have_account": "Heb je al een account?",
|
||||
"settings.oauth_applications_disabled": "OAuth-applicaties zijn uitgeschakeld in <code>m8sh</code>, gebruik een persoonlijk toegangstoken."
|
||||
}
|
||||
@@ -2110,5 +2110,20 @@
|
||||
"actions.runners.task_list.repository": "Repozytorium",
|
||||
"actions.runners.status.active": "Aktywne",
|
||||
"actions.runners.version": "Wersja",
|
||||
"git.filemode.symbolic_link": "Dowiązanie symboliczne"
|
||||
}
|
||||
"git.filemode.symbolic_link": "Dowiązanie symboliczne",
|
||||
"auth.gpg_invalid_token_signature": "Nieprawidłowy podpis GPG lub nonce",
|
||||
"auth.invalid_gpg_identity": "Nie udało się wyodrębnić tożsamości z klucza GPG",
|
||||
"auth.invalid_gpg_key_email": "Nie udało się wyodrębnić adresu e-mail z klucza GPG",
|
||||
"settings.gpg_last_key_delete": "Nie możesz usunąć jedynego klucza",
|
||||
"gpg.signin.title": "Zaloguj się",
|
||||
"gpg.signin.nonce_label": "Podpisz ten nonce swoim kluczem prywatnym",
|
||||
"gpg.signin.command_hint": "Uruchom to polecenie i wklej wynik poniżej:",
|
||||
"gpg.signin.signed_output": "Podpisane wyjście",
|
||||
"gpg.signin.submit": "Zaloguj się",
|
||||
"gpg.signup.title": "Utwórz konto",
|
||||
"gpg.signup.paste_key": "Wklej swój publiczny klucz GPG",
|
||||
"gpg.signup.proceed": "Kontynuuj",
|
||||
"gpg.signup.submit": "Zweryfikuj i utwórz konto",
|
||||
"gpg.signup.already_have_account": "Masz już konto?",
|
||||
"settings.oauth_applications_disabled": "Aplikacje OAuth są wyłączone w <code>m8sh</code>, użyj osobistego tokena dostępu."
|
||||
}
|
||||
@@ -3286,5 +3286,20 @@
|
||||
"git.filemode.normal_file": "Arquivo normal",
|
||||
"git.filemode.executable_file": "Arquivo executável",
|
||||
"git.filemode.symbolic_link": "Link simbólico",
|
||||
"git.filemode.submodule": "Submódulo"
|
||||
}
|
||||
"git.filemode.submodule": "Submódulo",
|
||||
"auth.gpg_invalid_token_signature": "Assinatura GPG ou nonce inválidos",
|
||||
"auth.invalid_gpg_identity": "Não foi possível extrair a identidade da chave GPG",
|
||||
"auth.invalid_gpg_key_email": "Não foi possível extrair o endereço de e-mail da chave GPG",
|
||||
"settings.gpg_last_key_delete": "Você não pode excluir sua única chave",
|
||||
"gpg.signin.title": "Entrar",
|
||||
"gpg.signin.nonce_label": "Assine este nonce com sua chave privada",
|
||||
"gpg.signin.command_hint": "Execute este comando e cole o resultado abaixo:",
|
||||
"gpg.signin.signed_output": "Saída assinada",
|
||||
"gpg.signin.submit": "Entrar",
|
||||
"gpg.signup.title": "Criar conta",
|
||||
"gpg.signup.paste_key": "Cole sua chave pública GPG",
|
||||
"gpg.signup.proceed": "Continuar",
|
||||
"gpg.signup.submit": "Verificar e criar conta",
|
||||
"gpg.signup.already_have_account": "Já tem uma conta?",
|
||||
"settings.oauth_applications_disabled": "Aplicativos OAuth estão desabilitados no <code>m8sh</code>, use um token de acesso pessoal."
|
||||
}
|
||||
@@ -3724,5 +3724,20 @@
|
||||
"git.filemode.normal_file": "Ficheiro normal",
|
||||
"git.filemode.executable_file": "Ficheiro executável",
|
||||
"git.filemode.symbolic_link": "Ligação simbólica",
|
||||
"git.filemode.submodule": "Submódulo"
|
||||
}
|
||||
"git.filemode.submodule": "Submódulo",
|
||||
"auth.gpg_invalid_token_signature": "Assinatura GPG ou nonce inválidos",
|
||||
"auth.invalid_gpg_identity": "Não foi possível extrair a identidade da chave GPG",
|
||||
"auth.invalid_gpg_key_email": "Não foi possível extrair o endereço de e-mail da chave GPG",
|
||||
"settings.gpg_last_key_delete": "Não pode eliminar a sua única chave",
|
||||
"gpg.signin.title": "Iniciar sessão",
|
||||
"gpg.signin.nonce_label": "Assine este nonce com a sua chave privada",
|
||||
"gpg.signin.command_hint": "Execute este comando e cole o resultado abaixo:",
|
||||
"gpg.signin.signed_output": "Saída assinada",
|
||||
"gpg.signin.submit": "Iniciar sessão",
|
||||
"gpg.signup.title": "Criar conta",
|
||||
"gpg.signup.paste_key": "Cole a sua chave pública GPG",
|
||||
"gpg.signup.proceed": "Continuar",
|
||||
"gpg.signup.submit": "Verificar e criar conta",
|
||||
"gpg.signup.already_have_account": "Já tem uma conta?",
|
||||
"settings.oauth_applications_disabled": "As aplicações OAuth estão desativadas em <code>m8sh</code>, utilize um token de acesso pessoal."
|
||||
}
|
||||
@@ -307,6 +307,9 @@
|
||||
"auth.invalid_code": "Код подтверждения недействителен или истёк.",
|
||||
"auth.invalid_code_forgot_password": "Ваш код подтверждения недействителен или истек. Нажмите <a href=\"%s\">здесь</a> для начала новой сессии.",
|
||||
"auth.invalid_password": "Ваш пароль не совпадает с паролем, который был использован для создания учётной записи.",
|
||||
"auth.gpg_invalid_token_signature": "Неверная GPG-подпись или nonce",
|
||||
"auth.invalid_gpg_identity": "Не удалось извлечь идентификатор из GPG-ключа",
|
||||
"auth.invalid_gpg_key_email": "Не удалось извлечь адрес электронной почты из GPG-ключа",
|
||||
"auth.reset_password_helper": "Восстановить аккаунт",
|
||||
"auth.reset_password_wrong_user": "Вы вошли как %s, но ссылка для восстановления учётной записи предназначена для %s",
|
||||
"auth.password_too_short": "Пароль не может быть короче %d символов.",
|
||||
@@ -618,6 +621,7 @@
|
||||
"settings.gpg_token": "Токен",
|
||||
"settings.gpg_token_help": "Вы можете сгенерировать подпись с помощью:",
|
||||
"settings.gpg_token_signature": "Текстовая подпись GPG",
|
||||
"settings.gpg_last_key_delete": "Невозможно удалить единственный ключ",
|
||||
"settings.key_signature_gpg_placeholder": "Начинается с '-----BEGIN PGP SIGNATURE-----'",
|
||||
"settings.verify_gpg_key_success": "Ключ GPG «%s» верифицирован.",
|
||||
"settings.ssh_key_verified": "Проверенный ключ",
|
||||
@@ -2755,6 +2759,16 @@
|
||||
"gpg.error.no_gpg_keys_found": "Не найден ключ, соответствующий данной подписи",
|
||||
"gpg.error.not_signed_commit": "Неподписанный коммит",
|
||||
"gpg.error.failed_retrieval_gpg_keys": "Не удалось получить ни одного ключа GPG автора коммита",
|
||||
"gpg.signin.title": "Войти",
|
||||
"gpg.signin.nonce_label": "Подпишите этот nonce своим приватным ключом",
|
||||
"gpg.signin.command_hint": "Выполните команду и вставьте результат ниже:",
|
||||
"gpg.signin.signed_output": "Подписанный вывод",
|
||||
"gpg.signin.submit": "Войти",
|
||||
"gpg.signup.title": "Создать аккаунт",
|
||||
"gpg.signup.paste_key": "Вставьте ваш публичный GPG-ключ",
|
||||
"gpg.signup.proceed": "Продолжить",
|
||||
"gpg.signup.submit": "Подтвердить и создать аккаунт",
|
||||
"gpg.signup.already_have_account": "Уже есть аккаунт?",
|
||||
"units.unit": "Элемент",
|
||||
"units.error.no_unit_allowed_repo": "У вас нет доступа ни к одному разделу этого репозитория.",
|
||||
"units.error.unit_not_allowed": "У вас нет доступа к этому разделу репозитория.",
|
||||
@@ -2982,5 +2996,6 @@
|
||||
"git.filemode.normal_file": "Обычный файл",
|
||||
"git.filemode.executable_file": "Исполняемый файл",
|
||||
"git.filemode.symbolic_link": "Символическая ссылка",
|
||||
"git.filemode.submodule": "Подмодуль"
|
||||
}
|
||||
"git.filemode.submodule": "Подмодуль",
|
||||
"settings.oauth_applications_disabled": "Приложения OAuth отключены в <code>m8sh</code>, используйте персональный токен доступа."
|
||||
}
|
||||
@@ -2189,5 +2189,20 @@
|
||||
"actions.runners.status.active": "ක්රියාකාරී",
|
||||
"actions.runners.version": "අනුවාදය",
|
||||
"actions.runs.commit": "කැප",
|
||||
"git.filemode.symbolic_link": "සංකේතාත්මක සබැඳිය"
|
||||
}
|
||||
"git.filemode.symbolic_link": "සංකේතාත්මක සබැඳිය",
|
||||
"auth.gpg_invalid_token_signature": "අවලංගු GPG අත්සන හෝ nonce",
|
||||
"auth.invalid_gpg_identity": "GPG යතුරෙන් හඳුනාගැනීම් ලබා ගැනීමට නොහැකි විය",
|
||||
"auth.invalid_gpg_key_email": "GPG යතුරෙන් විද්යුත් තැපැල් ලිපිනය ලබා ගැනීමට නොහැකි විය",
|
||||
"settings.gpg_last_key_delete": "ඔබේ එකම යතුර මකා දැමිය නොහැක",
|
||||
"gpg.signin.title": "පිවිසෙන්න",
|
||||
"gpg.signin.nonce_label": "ඔබේ පෞද්ගලික යතුර සමඟ මෙම nonce අත්සන් කරන්න",
|
||||
"gpg.signin.command_hint": "මෙම විධානය ක්රියාත්මක කර ප්රතිඵලය පහතින් අලවන්න:",
|
||||
"gpg.signin.signed_output": "අත්සන් කළ ප්රතිදානය",
|
||||
"gpg.signin.submit": "පිවිසෙන්න",
|
||||
"gpg.signup.title": "ගිණුමක් සාදන්න",
|
||||
"gpg.signup.paste_key": "ඔබේ GPG පොදු යතුර අලවන්න",
|
||||
"gpg.signup.proceed": "ඉදිරියට යන්න",
|
||||
"gpg.signup.submit": "තහවුරු කර ගිණුම සාදන්න",
|
||||
"gpg.signup.already_have_account": "දැනටමත් ගිණුමක් තිබේද?",
|
||||
"settings.oauth_applications_disabled": "<code>m8sh</code> හි OAuth යෙදුම් අක්රිය කර ඇත, පෞද්ගලික ප්රවේශ ටෝකනය භාවිතා කරන්න."
|
||||
}
|
||||
@@ -1160,5 +1160,20 @@
|
||||
"actions.runners.task_list.repository": "Repozitár",
|
||||
"actions.runners.status.unspecified": "Neznámy",
|
||||
"actions.runners.version": "Verzia",
|
||||
"git.filemode.symbolic_link": "Symbolický odkaz"
|
||||
}
|
||||
"git.filemode.symbolic_link": "Symbolický odkaz",
|
||||
"auth.gpg_invalid_token_signature": "Neplatný GPG podpis alebo nonce",
|
||||
"auth.invalid_gpg_identity": "Nepodarilo sa extrahovať identitu z GPG kľúča",
|
||||
"auth.invalid_gpg_key_email": "Nepodarilo sa extrahovať e-mailovú adresu z GPG kľúča",
|
||||
"settings.gpg_last_key_delete": "Nemôžete vymazať jediný kľúč",
|
||||
"gpg.signin.title": "Prihlásiť sa",
|
||||
"gpg.signin.nonce_label": "Podpíšte tento nonce svojím súkromným kľúčom",
|
||||
"gpg.signin.command_hint": "Spustite tento príkaz a vložte výstup nižšie:",
|
||||
"gpg.signin.signed_output": "Podpísaný výstup",
|
||||
"gpg.signin.submit": "Prihlásiť sa",
|
||||
"gpg.signup.title": "Vytvoriť účet",
|
||||
"gpg.signup.paste_key": "Vložte váš verejný GPG kľúč",
|
||||
"gpg.signup.proceed": "Pokračovať",
|
||||
"gpg.signup.submit": "Overiť a vytvoriť účet",
|
||||
"gpg.signup.already_have_account": "Už máte účet?",
|
||||
"settings.oauth_applications_disabled": "OAuth aplikácie sú v <code>m8sh</code> zakázané, použite osobný prístupový token."
|
||||
}
|
||||
@@ -1733,5 +1733,20 @@
|
||||
"actions.runners.task_list.run": "Kör",
|
||||
"actions.runners.task_list.repository": "Utvecklingskatalog",
|
||||
"actions.runners.status.active": "Aktiv",
|
||||
"git.filemode.symbolic_link": "Symbolisk länk"
|
||||
}
|
||||
"git.filemode.symbolic_link": "Symbolisk länk",
|
||||
"auth.gpg_invalid_token_signature": "Ogiltig GPG-signatur eller nonce",
|
||||
"auth.invalid_gpg_identity": "Kunde inte extrahera identitet från GPG-nyckel",
|
||||
"auth.invalid_gpg_key_email": "Kunde inte extrahera e-postadress från GPG-nyckel",
|
||||
"settings.gpg_last_key_delete": "Du kan inte ta bort din enda nyckel",
|
||||
"gpg.signin.title": "Logga in",
|
||||
"gpg.signin.nonce_label": "Signera denna nonce med din privata nyckel",
|
||||
"gpg.signin.command_hint": "Kör detta kommando och klistra in resultatet nedan:",
|
||||
"gpg.signin.signed_output": "Signerad utdata",
|
||||
"gpg.signin.submit": "Logga in",
|
||||
"gpg.signup.title": "Skapa konto",
|
||||
"gpg.signup.paste_key": "Klistra in din GPG publika nyckel",
|
||||
"gpg.signup.proceed": "Fortsätt",
|
||||
"gpg.signup.submit": "Verifiera och skapa konto",
|
||||
"gpg.signup.already_have_account": "Har du redan ett konto?",
|
||||
"settings.oauth_applications_disabled": "OAuth-applikationer är inaktiverade i <code>m8sh</code>, använd personlig åtkomsttoken."
|
||||
}
|
||||
@@ -3743,5 +3743,20 @@
|
||||
"git.filemode.normal_file": "Normal dosya",
|
||||
"git.filemode.executable_file": "Çalıştırılabilir dosya",
|
||||
"git.filemode.symbolic_link": "Sembolik Bağlantı",
|
||||
"git.filemode.submodule": "Alt modül"
|
||||
}
|
||||
"git.filemode.submodule": "Alt modül",
|
||||
"auth.gpg_invalid_token_signature": "Geçersiz GPG imzası veya nonce",
|
||||
"auth.invalid_gpg_identity": "GPG anahtarından kimlik çıkarılamadı",
|
||||
"auth.invalid_gpg_key_email": "GPG anahtarından e-posta adresi çıkarılamadı",
|
||||
"settings.gpg_last_key_delete": "Tek anahtarınızı silemezsiniz",
|
||||
"gpg.signin.title": "Giriş yap",
|
||||
"gpg.signin.nonce_label": "Bu nonce'u özel anahtarınızla imzalayın",
|
||||
"gpg.signin.command_hint": "Bu komutu çalıştırın ve çıktıyı aşağıya yapıştırın:",
|
||||
"gpg.signin.signed_output": "İmzalanmış çıktı",
|
||||
"gpg.signin.submit": "Giriş yap",
|
||||
"gpg.signup.title": "Hesap oluştur",
|
||||
"gpg.signup.paste_key": "GPG açık anahtarınızı yapıştırın",
|
||||
"gpg.signup.proceed": "Devam et",
|
||||
"gpg.signup.submit": "Doğrula ve hesap oluştur",
|
||||
"gpg.signup.already_have_account": "Zaten hesabınız var mı?",
|
||||
"settings.oauth_applications_disabled": "<code>m8sh</code> içinde OAuth uygulamaları devre dışı bırakıldı, kişisel erişim tokeni kullanın."
|
||||
}
|
||||
@@ -3182,5 +3182,20 @@
|
||||
"git.filemode.normal_file": "Звичайний файл",
|
||||
"git.filemode.executable_file": "Виконуваний файл",
|
||||
"git.filemode.symbolic_link": "Символічне посилання",
|
||||
"git.filemode.submodule": "Підмодуль"
|
||||
}
|
||||
"git.filemode.submodule": "Підмодуль",
|
||||
"auth.gpg_invalid_token_signature": "Недійсний GPG підпис або nonce",
|
||||
"auth.invalid_gpg_identity": "Не вдалося витягти ідентичність з GPG ключа",
|
||||
"auth.invalid_gpg_key_email": "Не вдалося витягти адресу електронної пошти з GPG ключа",
|
||||
"settings.gpg_last_key_delete": "Неможливо видалити єдиний ключ",
|
||||
"gpg.signin.title": "Увійти",
|
||||
"gpg.signin.nonce_label": "Підпишіть цей nonce своїм приватним ключем",
|
||||
"gpg.signin.command_hint": "Виконайте цю команду та вставте результат нижче:",
|
||||
"gpg.signin.signed_output": "Підписаний вивід",
|
||||
"gpg.signin.submit": "Увійти",
|
||||
"gpg.signup.title": "Створити акаунт",
|
||||
"gpg.signup.paste_key": "Вставте ваш публічний GPG ключ",
|
||||
"gpg.signup.proceed": "Продовжити",
|
||||
"gpg.signup.submit": "Підтвердити та створити акаунт",
|
||||
"gpg.signup.already_have_account": "Вже маєте акаунт?",
|
||||
"settings.oauth_applications_disabled": "Програми OAuth вимкнено в <code>m8sh</code>, використовуйте персональний токен доступу."
|
||||
}
|
||||
@@ -407,6 +407,9 @@
|
||||
"auth.invalid_code": "此确认密钥无效或已过期。",
|
||||
"auth.invalid_code_forgot_password": "您的确认码无效或已过期,点击 <a href=\"%s\">这里</a> 开始新的会话。",
|
||||
"auth.invalid_password": "您的密码与用于创建账户的密码不匹配。",
|
||||
"auth.gpg_invalid_token_signature": "GPG 签名或随机数无效",
|
||||
"auth.invalid_gpg_identity": "无法从 GPG 密钥中提取身份信息",
|
||||
"auth.invalid_gpg_key_email": "无法从 GPG 密钥中提取电子邮件地址",
|
||||
"auth.reset_password_helper": "恢复账户",
|
||||
"auth.reset_password_wrong_user": "您以 %s 登录,但恢复账号链接是用于 %s。",
|
||||
"auth.password_too_short": "密码长度不能少于 %d 位。",
|
||||
@@ -793,6 +796,7 @@
|
||||
"settings.gpg_token": "令牌",
|
||||
"settings.gpg_token_help": "您可以使用以下方式生成签名:",
|
||||
"settings.gpg_token_signature": "GPG 增强签名",
|
||||
"settings.gpg_last_key_delete": "无法删除您的唯一密钥",
|
||||
"settings.key_signature_gpg_placeholder": "以 '-----BEGIN PGP SIGNATURE-----' 开头",
|
||||
"settings.verify_gpg_key_success": "GPG 密钥「%s」已验证。",
|
||||
"settings.ssh_key_verified": "已验证的密钥",
|
||||
@@ -3511,6 +3515,16 @@
|
||||
"gpg.error.failed_retrieval_gpg_keys": "找不到任何与该提交者账号相关的密钥",
|
||||
"gpg.error.probable_bad_signature": "警告!虽然数据库中有一个此 ID 的密钥,但它没有验证此提交!此提交是可疑的。",
|
||||
"gpg.error.probable_bad_default_signature": "警告!虽然默认密钥拥有此 ID,但它没有验证此提交!此提交是可疑的。",
|
||||
"gpg.signin.title": "登录",
|
||||
"gpg.signin.nonce_label": "使用您的私钥签署此随机数",
|
||||
"gpg.signin.command_hint": "运行此命令,然后将输出粘贴到下方:",
|
||||
"gpg.signin.signed_output": "签名输出",
|
||||
"gpg.signin.submit": "登录",
|
||||
"gpg.signup.title": "创建账户",
|
||||
"gpg.signup.paste_key": "粘贴您的 GPG 公钥",
|
||||
"gpg.signup.proceed": "继续",
|
||||
"gpg.signup.submit": "验证并创建账户",
|
||||
"gpg.signup.already_have_account": "已有账户?",
|
||||
"units.unit": "单元",
|
||||
"units.error.no_unit_allowed_repo": "您没有被允许访问此仓库的任何单元。",
|
||||
"units.error.unit_not_allowed": "您没有权限访问此仓库单元",
|
||||
@@ -3895,5 +3909,6 @@
|
||||
"actions.general.cross_repo_desc": "允许此所有者下的所有仓库在运行工作流任务时,通过 GITEA_TOKEN 以只读方式访问所选仓库。",
|
||||
"actions.general.cross_repo_selected": "选择的仓库",
|
||||
"actions.general.cross_repo_target_repos": "目标仓库",
|
||||
"actions.general.cross_repo_add": "添加目标仓库"
|
||||
}
|
||||
"actions.general.cross_repo_add": "添加目标仓库",
|
||||
"settings.oauth_applications_disabled": "<code>m8sh</code> 中已禁用 OAuth 应用,请使用个人访问令牌。"
|
||||
}
|
||||
@@ -3297,5 +3297,20 @@
|
||||
"git.filemode.normal_file": "一般檔案",
|
||||
"git.filemode.executable_file": "可執行檔",
|
||||
"git.filemode.symbolic_link": "符號連結",
|
||||
"git.filemode.submodule": "子模組"
|
||||
}
|
||||
"git.filemode.submodule": "子模組",
|
||||
"auth.gpg_invalid_token_signature": "GPG 簽名或隨機數無效",
|
||||
"auth.invalid_gpg_identity": "無法從 GPG 金鑰中提取身份資訊",
|
||||
"auth.invalid_gpg_key_email": "無法從 GPG 金鑰中提取電子郵件地址",
|
||||
"settings.gpg_last_key_delete": "無法刪除您的唯一金鑰",
|
||||
"gpg.signin.title": "登入",
|
||||
"gpg.signin.nonce_label": "使用您的私密金鑰簽署此隨機數",
|
||||
"gpg.signin.command_hint": "執行此命令,然後將輸出貼到下方:",
|
||||
"gpg.signin.signed_output": "已簽署的輸出",
|
||||
"gpg.signin.submit": "登入",
|
||||
"gpg.signup.title": "建立帳戶",
|
||||
"gpg.signup.paste_key": "貼上您的 GPG 公開金鑰",
|
||||
"gpg.signup.proceed": "繼續",
|
||||
"gpg.signup.submit": "驗證並建立帳戶",
|
||||
"gpg.signup.already_have_account": "已有帳戶?",
|
||||
"settings.oauth_applications_disabled": "<code>m8sh</code> 中已停用 OAuth 應用程式,請使用個人存取權杖。"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 508 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 2.6 KiB |
@@ -1 +1,21 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 640 640" width="32" height="32"><path d="m395.9 484.2-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8 17.2 8.3 27.1 13 27.1 13l-.1-109.2 16.7-.1.1 117.1s57.4 24.2 83.1 40.1c3.7 2.3 10.2 6.8 12.9 14.4 2.1 6.1 2 13.1-1 19.3l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12" style="fill:#fff"/><path d="M622.7 149.8c-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.3.3-26.5.6-39.6.7v117.2c-5.5-2.6-11.1-5.3-16.6-7.9 0-36.4-.1-109.2-.1-109.2-29 .4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5c-9.8-.6-22.5-2.1-39 1.5-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6M125.6 353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1s7.1 59.4 15.7 94.2c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1m300.3 107.6s-6.1 14.5-19.6 15.4c-5.8.4-10.3-1.2-10.3-1.2s-.3-.1-5.3-2.1l-112.9-55s-10.9-5.7-12.8-15.6c-2.2-8.1 2.7-18.1 2.7-18.1L322 273s4.8-9.7 12.2-13c.6-.3 2.3-1 4.5-1.5 8.1-2.1 18 2.8 18 2.8L467.4 315s12.6 5.7 15.3 16.2c1.9 7.4-.5 14-1.8 17.2-6.3 15.4-55 113.1-55 113.1" style="fill:#609926"/><path d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8s2 16.3 9.1 20c7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3s17.4 1.7 22.5-5.3c5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8z" style="fill:#609926"/></svg>
|
||||
<svg width="400" height="400" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<g stroke="#67D3FD" stroke-width="22" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="60" y1="115" x2="200" y2="75" />
|
||||
<line x1="200" y1="75" x2="340" y2="135" />
|
||||
<line x1="60" y1="115" x2="90" y2="300" />
|
||||
<line x1="200" y1="75" x2="230" y2="240" />
|
||||
<line x1="340" y1="135" x2="230" y2="240" />
|
||||
<line x1="230" y1="240" x2="290" y2="355" />
|
||||
<line x1="90" y1="300" x2="290" y2="355" />
|
||||
</g>
|
||||
|
||||
<g fill="#67D3FD">
|
||||
<circle cx="60" cy="115" r="42" />
|
||||
<circle cx="200" cy="75" r="55" />
|
||||
<circle cx="340" cy="135" r="48" />
|
||||
<circle cx="90" cy="300" r="50" />
|
||||
<circle cx="230" cy="240" r="40" />
|
||||
<circle cx="290" cy="355" r="38" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 794 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 21 KiB |
@@ -1 +1,21 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 640 640" width="32" height="32"><path d="m395.9 484.2-126.9-61c-12.5-6-17.9-21.2-11.8-33.8l61-126.9c6-12.5 21.2-17.9 33.8-11.8 17.2 8.3 27.1 13 27.1 13l-.1-109.2 16.7-.1.1 117.1s57.4 24.2 83.1 40.1c3.7 2.3 10.2 6.8 12.9 14.4 2.1 6.1 2 13.1-1 19.3l-61 126.9c-6.2 12.7-21.4 18.1-33.9 12" style="fill:#fff"/><path d="M622.7 149.8c-4.1-4.1-9.6-4-9.6-4s-117.2 6.6-177.9 8c-13.3.3-26.5.6-39.6.7v117.2c-5.5-2.6-11.1-5.3-16.6-7.9 0-36.4-.1-109.2-.1-109.2-29 .4-89.2-2.2-89.2-2.2s-141.4-7.1-156.8-8.5c-9.8-.6-22.5-2.1-39 1.5-8.7 1.8-33.5 7.4-53.8 26.9C-4.9 212.4 6.6 276.2 8 285.8c1.7 11.7 6.9 44.2 31.7 72.5 45.8 56.1 144.4 54.8 144.4 54.8s12.1 28.9 30.6 55.5c25 33.1 50.7 58.9 75.7 62 63 0 188.9-.1 188.9-.1s12 .1 28.3-10.3c14-8.5 26.5-23.4 26.5-23.4S547 483 565 451.5c5.5-9.7 10.1-19.1 14.1-28 0 0 55.2-117.1 55.2-231.1-1.1-34.5-9.6-40.6-11.6-42.6M125.6 353.9c-25.9-8.5-36.9-18.7-36.9-18.7S69.6 321.8 60 295.4c-16.5-44.2-1.4-71.2-1.4-71.2s8.4-22.5 38.5-30c13.8-3.7 31-3.1 31-3.1s7.1 59.4 15.7 94.2c7.2 29.2 24.8 77.7 24.8 77.7s-26.1-3.1-43-9.1m300.3 107.6s-6.1 14.5-19.6 15.4c-5.8.4-10.3-1.2-10.3-1.2s-.3-.1-5.3-2.1l-112.9-55s-10.9-5.7-12.8-15.6c-2.2-8.1 2.7-18.1 2.7-18.1L322 273s4.8-9.7 12.2-13c.6-.3 2.3-1 4.5-1.5 8.1-2.1 18 2.8 18 2.8L467.4 315s12.6 5.7 15.3 16.2c1.9 7.4-.5 14-1.8 17.2-6.3 15.4-55 113.1-55 113.1" style="fill:#609926"/><path d="M326.8 380.1c-8.2.1-15.4 5.8-17.3 13.8s2 16.3 9.1 20c7.7 4 17.5 1.8 22.7-5.4 5.1-7.1 4.3-16.9-1.8-23.1l24-49.1c1.5.1 3.7.2 6.2-.5 4.1-.9 7.1-3.6 7.1-3.6 4.2 1.8 8.6 3.8 13.2 6.1 4.8 2.4 9.3 4.9 13.4 7.3.9.5 1.8 1.1 2.8 1.9 1.6 1.3 3.4 3.1 4.7 5.5 1.9 5.5-1.9 14.9-1.9 14.9-2.3 7.6-18.4 40.6-18.4 40.6-8.1-.2-15.3 5-17.7 12.5-2.6 8.1 1.1 17.3 8.9 21.3s17.4 1.7 22.5-5.3c5-6.8 4.6-16.3-1.1-22.6 1.9-3.7 3.7-7.4 5.6-11.3 5-10.4 13.5-30.4 13.5-30.4.9-1.7 5.7-10.3 2.7-21.3-2.5-11.4-12.6-16.7-12.6-16.7-12.2-7.9-29.2-15.2-29.2-15.2s0-4.1-1.1-7.1c-1.1-3.1-2.8-5.1-3.9-6.3 4.7-9.7 9.4-19.3 14.1-29-4.1-2-8.1-4-12.2-6.1-4.8 9.8-9.7 19.7-14.5 29.5-6.7-.1-12.9 3.5-16.1 9.4-3.4 6.3-2.7 14.1 1.9 19.8z" style="fill:#609926"/></svg>
|
||||
<svg width="400" height="400" viewBox="0 0 400 400" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<g stroke="#67D3FD" stroke-width="22" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="60" y1="115" x2="200" y2="75" />
|
||||
<line x1="200" y1="75" x2="340" y2="135" />
|
||||
<line x1="60" y1="115" x2="90" y2="300" />
|
||||
<line x1="200" y1="75" x2="230" y2="240" />
|
||||
<line x1="340" y1="135" x2="230" y2="240" />
|
||||
<line x1="230" y1="240" x2="290" y2="355" />
|
||||
<line x1="90" y1="300" x2="290" y2="355" />
|
||||
</g>
|
||||
|
||||
<g fill="#67D3FD">
|
||||
<circle cx="60" cy="115" r="42" />
|
||||
<circle cx="200" cy="75" r="55" />
|
||||
<circle cx="340" cy="135" r="48" />
|
||||
<circle cx="90" cy="300" r="50" />
|
||||
<circle cx="230" cy="240" r="40" />
|
||||
<circle cx="290" cy="355" r="38" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 794 B |
@@ -1177,7 +1177,6 @@ func Routes() *web.Router {
|
||||
m.Combo("/{id}").Get(user.GetGPGKey).
|
||||
Delete(user.DeleteGPGKey)
|
||||
}, rejectPublicOnly())
|
||||
m.Get("/gpg_key_token", rejectPublicOnly(), user.GetVerificationToken)
|
||||
m.Post("/gpg_key_verify", rejectPublicOnly(), bind(api.VerifyGPGKeyOption{}), user.VerifyUserGPGKey)
|
||||
|
||||
// (repo scope)
|
||||
|
||||
@@ -5,7 +5,6 @@ package user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
asymkey_model "gitea.dev/models/asymkey"
|
||||
"gitea.dev/models/db"
|
||||
@@ -44,77 +43,16 @@ func listGPGKeys(ctx *context.APIContext, uid int64, listOptions db.ListOptions)
|
||||
|
||||
// ListGPGKeys get the GPG key list of a user
|
||||
func ListGPGKeys(ctx *context.APIContext) {
|
||||
// swagger:operation GET /users/{username}/gpg_keys user userListGPGKeys
|
||||
// ---
|
||||
// summary: List the given user's GPG keys
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: username
|
||||
// in: path
|
||||
// description: username of the user whose GPG key list is to be obtained
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: page
|
||||
// in: query
|
||||
// description: page number of results to return (1-based)
|
||||
// type: integer
|
||||
// - name: limit
|
||||
// in: query
|
||||
// description: page size of results
|
||||
// type: integer
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GPGKeyList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
listGPGKeys(ctx, ctx.ContextUser.ID, utils.GetListOptions(ctx))
|
||||
}
|
||||
|
||||
// ListMyGPGKeys get the GPG key list of the authenticated user
|
||||
func ListMyGPGKeys(ctx *context.APIContext) {
|
||||
// swagger:operation GET /user/gpg_keys user userCurrentListGPGKeys
|
||||
// ---
|
||||
// summary: List the authenticated user's GPG keys
|
||||
// parameters:
|
||||
// - name: page
|
||||
// in: query
|
||||
// description: page number of results to return (1-based)
|
||||
// type: integer
|
||||
// - name: limit
|
||||
// in: query
|
||||
// description: page size of results
|
||||
// type: integer
|
||||
// produces:
|
||||
// - application/json
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GPGKeyList"
|
||||
|
||||
listGPGKeys(ctx, ctx.Doer.ID, utils.GetListOptions(ctx))
|
||||
}
|
||||
|
||||
// GetGPGKey get the GPG key based on a id
|
||||
func GetGPGKey(ctx *context.APIContext) {
|
||||
// swagger:operation GET /user/gpg_keys/{id} user userCurrentGetGPGKey
|
||||
// ---
|
||||
// summary: Get a GPG key
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: id
|
||||
// in: path
|
||||
// description: id of key to get
|
||||
// type: integer
|
||||
// format: int64
|
||||
// required: true
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GPGKey"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
key, err := asymkey_model.GetGPGKeyForUserByID(ctx, ctx.Doer.ID, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
if asymkey_model.IsErrGPGKeyNotExist(err) {
|
||||
@@ -138,148 +76,76 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
|
||||
return
|
||||
}
|
||||
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
lastToken := asymkey_model.VerificationToken(ctx.Doer, 0)
|
||||
|
||||
keys, err := asymkey_model.AddGPGKey(ctx, uid, form.ArmoredKey, token, form.Signature)
|
||||
if err != nil && asymkey_model.IsErrGPGInvalidTokenSignature(err) {
|
||||
keys, err = asymkey_model.AddGPGKey(ctx, uid, form.ArmoredKey, lastToken, form.Signature)
|
||||
if !asymkey_model.VerifyNonce(form.Nonce) {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "Invalid or expired nonce")
|
||||
return
|
||||
}
|
||||
|
||||
keys, err := asymkey_model.AddGPGKey(ctx, uid, form.ArmoredKey, form.Nonce, form.Signature)
|
||||
if err != nil {
|
||||
HandleAddGPGKeyError(ctx, err, token)
|
||||
HandleAddGPGKeyError(ctx, err, form.Nonce)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusCreated, convert.ToGPGKey(keys[0]))
|
||||
}
|
||||
|
||||
// GetVerificationToken returns the current token to be signed for this user
|
||||
func GetVerificationToken(ctx *context.APIContext) {
|
||||
// swagger:operation GET /user/gpg_key_token user getVerificationToken
|
||||
// ---
|
||||
// summary: Get a Token to verify
|
||||
// produces:
|
||||
// - text/plain
|
||||
// parameters:
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/string"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
ctx.PlainText(http.StatusOK, token)
|
||||
}
|
||||
|
||||
// VerifyUserGPGKey creates new GPG key to given user by ID.
|
||||
// VerifyUserGPGKey verifies a GPG key by signature
|
||||
func VerifyUserGPGKey(ctx *context.APIContext) {
|
||||
// swagger:operation POST /user/gpg_key_verify user userVerifyGPGKey
|
||||
// ---
|
||||
// summary: Verify a GPG key
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/GPGKey"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm(ctx).(*api.VerifyGPGKeyOption)
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
lastToken := asymkey_model.VerificationToken(ctx.Doer, 0)
|
||||
|
||||
form.KeyID = strings.TrimLeft(form.KeyID, "0")
|
||||
if form.KeyID == "" {
|
||||
user, err := asymkey_model.VerifyGPGSignature(ctx, form.Nonce, form.Signature)
|
||||
if err != nil {
|
||||
if asymkey_model.IsErrGPGInvalidTokenSignature(err) {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "Invalid signature or nonce")
|
||||
return
|
||||
}
|
||||
if asymkey_model.IsErrGPGKeyNotExist(err) {
|
||||
ctx.APIErrorNotFound()
|
||||
return
|
||||
}
|
||||
ctx.APIErrorInternal(err)
|
||||
return
|
||||
}
|
||||
|
||||
// make sure the verified key belongs to the authenticated user
|
||||
if user.ID != ctx.Doer.ID {
|
||||
ctx.APIErrorNotFound()
|
||||
return
|
||||
}
|
||||
|
||||
_, err := asymkey_model.VerifyGPGKey(ctx, ctx.Doer.ID, form.KeyID, token, form.Signature)
|
||||
if err != nil && asymkey_model.IsErrGPGInvalidTokenSignature(err) {
|
||||
_, err = asymkey_model.VerifyGPGKey(ctx, ctx.Doer.ID, form.KeyID, lastToken, form.Signature)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if asymkey_model.IsErrGPGInvalidTokenSignature(err) {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "The provided GPG key, signature and token do not match or token is out of date. Provide a valid signature for the token: "+token)
|
||||
return
|
||||
}
|
||||
ctx.APIErrorInternal(err)
|
||||
}
|
||||
|
||||
keys, err := db.Find[asymkey_model.GPGKey](ctx, asymkey_model.FindGPGKeyOptions{
|
||||
KeyID: form.KeyID,
|
||||
OwnerID: ctx.Doer.ID,
|
||||
IncludeSubKeys: true,
|
||||
})
|
||||
if err != nil {
|
||||
if asymkey_model.IsErrGPGKeyNotExist(err) {
|
||||
ctx.APIErrorNotFound()
|
||||
} else {
|
||||
ctx.APIErrorInternal(err)
|
||||
}
|
||||
ctx.APIErrorInternal(err)
|
||||
return
|
||||
}
|
||||
if len(keys) == 0 {
|
||||
ctx.APIErrorNotFound()
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, convert.ToGPGKey(keys[0]))
|
||||
}
|
||||
|
||||
// swagger:parameters userCurrentPostGPGKey
|
||||
type swaggerUserCurrentPostGPGKey struct {
|
||||
// in:body
|
||||
Form api.CreateGPGKeyOption
|
||||
}
|
||||
|
||||
// CreateGPGKey create a GPG key belonging to the authenticated user
|
||||
func CreateGPGKey(ctx *context.APIContext) {
|
||||
// swagger:operation POST /user/gpg_keys user userCurrentPostGPGKey
|
||||
// ---
|
||||
// summary: Create a GPG key
|
||||
// consumes:
|
||||
// - application/json
|
||||
// produces:
|
||||
// - application/json
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/GPGKey"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm(ctx).(*api.CreateGPGKeyOption)
|
||||
CreateUserGPGKey(ctx, *form, ctx.Doer.ID)
|
||||
}
|
||||
|
||||
// DeleteGPGKey remove a GPG key belonging to the authenticated user
|
||||
func DeleteGPGKey(ctx *context.APIContext) {
|
||||
// swagger:operation DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
|
||||
// ---
|
||||
// summary: Remove a GPG key
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: id
|
||||
// in: path
|
||||
// description: id of key to delete
|
||||
// type: integer
|
||||
// format: int64
|
||||
// required: true
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageGPGKeys) {
|
||||
ctx.APIErrorNotFound("gpg keys setting is not allowed to be changed")
|
||||
return
|
||||
}
|
||||
|
||||
if err := asymkey_model.DeleteGPGKey(ctx, ctx.Doer, ctx.PathParamInt64("id")); err != nil {
|
||||
if asymkey_model.IsErrGPGLastKey(err) {
|
||||
ctx.APIError(http.StatusForbidden, err.Error())
|
||||
return
|
||||
}
|
||||
ctx.APIErrorInternal(err)
|
||||
return
|
||||
}
|
||||
@@ -288,16 +154,16 @@ func DeleteGPGKey(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
// HandleAddGPGKeyError handle add GPGKey error
|
||||
func HandleAddGPGKeyError(ctx *context.APIContext, err error, token string) {
|
||||
func HandleAddGPGKeyError(ctx *context.APIContext, err error, nonce string) {
|
||||
switch {
|
||||
case asymkey_model.IsErrGPGKeyIDAlreadyUsed(err):
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "A key with the same id already exists")
|
||||
case asymkey_model.IsErrGPGKeyParsing(err):
|
||||
ctx.APIError(http.StatusUnprocessableEntity, err.Error())
|
||||
case asymkey_model.IsErrGPGNoEmailFound(err):
|
||||
ctx.APIError(http.StatusNotFound, "None of the emails attached to the GPG key could be found. It may still be added if you provide a valid signature for the token: "+token)
|
||||
ctx.APIError(http.StatusNotFound, "None of the emails attached to the GPG key could be found")
|
||||
case asymkey_model.IsErrGPGInvalidTokenSignature(err):
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "The provided GPG key, signature and token do not match or token is out of date. Provide a valid signature for the token: "+token)
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "The provided GPG key, signature and nonce do not match")
|
||||
default:
|
||||
ctx.APIErrorInternal(err)
|
||||
}
|
||||
|
||||
@@ -22,14 +22,11 @@ import (
|
||||
"gitea.dev/modules/generate"
|
||||
"gitea.dev/modules/graceful"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/optional"
|
||||
"gitea.dev/modules/setting"
|
||||
"gitea.dev/modules/templates"
|
||||
"gitea.dev/modules/timeutil"
|
||||
"gitea.dev/modules/web"
|
||||
"gitea.dev/modules/web/middleware"
|
||||
"gitea.dev/routers/common"
|
||||
auth_service "gitea.dev/services/auth"
|
||||
"gitea.dev/services/context"
|
||||
"gitea.dev/services/forms"
|
||||
"gitea.dev/services/versioned_migration"
|
||||
@@ -104,10 +101,6 @@ func Install(ctx *context.Context) {
|
||||
form.RegisterConfirm = setting.Service.RegisterEmailConfirm
|
||||
form.MailNotify = setting.Service.EnableNotifyMail
|
||||
|
||||
form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn
|
||||
form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp
|
||||
form.DisableRegistration = setting.Service.DisableRegistration
|
||||
form.AllowOnlyExternalRegistration = setting.Service.AllowOnlyExternalRegistration
|
||||
form.EnableCaptcha = setting.Service.EnableCaptcha
|
||||
form.RequireSignInView = setting.Service.RequireSignInViewStrict
|
||||
form.DefaultKeepEmailPrivate = setting.Service.DefaultKeepEmailPrivate
|
||||
@@ -258,52 +251,6 @@ func SubmitInstall(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check logic loophole between disable self-registration and no admin account.
|
||||
if form.DisableRegistration && len(form.AdminName) == 0 {
|
||||
ctx.Data["Err_Services"] = true
|
||||
ctx.Data["Err_Admin"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.no_admin_and_disable_registration"), tplInstall, form)
|
||||
return
|
||||
}
|
||||
|
||||
// Check admin user creation
|
||||
if len(form.AdminName) > 0 {
|
||||
// Ensure AdminName is valid
|
||||
if err := user_model.IsUsableUsername(form.AdminName); err != nil {
|
||||
ctx.Data["Err_Admin"] = true
|
||||
ctx.Data["Err_AdminName"] = true
|
||||
if db.IsErrNameReserved(err) {
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.err_admin_name_is_reserved"), tplInstall, form)
|
||||
return
|
||||
} else if db.IsErrNamePatternNotAllowed(err) {
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.err_admin_name_pattern_not_allowed"), tplInstall, form)
|
||||
return
|
||||
}
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.err_admin_name_is_invalid"), tplInstall, form)
|
||||
return
|
||||
}
|
||||
// Check Admin email
|
||||
if len(form.AdminEmail) == 0 {
|
||||
ctx.Data["Err_Admin"] = true
|
||||
ctx.Data["Err_AdminEmail"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.err_empty_admin_email"), tplInstall, form)
|
||||
return
|
||||
}
|
||||
// Check admin password.
|
||||
if len(form.AdminPasswd) == 0 {
|
||||
ctx.Data["Err_Admin"] = true
|
||||
ctx.Data["Err_AdminPasswd"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.err_empty_admin_password"), tplInstall, form)
|
||||
return
|
||||
}
|
||||
if form.AdminPasswd != form.AdminConfirmPasswd {
|
||||
ctx.Data["Err_Admin"] = true
|
||||
ctx.Data["Err_AdminPasswd"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("form.password_not_match"), tplInstall, form)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Init the engine with migration
|
||||
if err = db.InitEngineWithMigration(ctx, versioned_migration.Migrate); err != nil {
|
||||
db.UnsetDefaultEngine()
|
||||
@@ -377,10 +324,6 @@ func SubmitInstall(ctx *context.Context) {
|
||||
cfg.Section("service").Key("REGISTER_EMAIL_CONFIRM").SetValue(strconv.FormatBool(form.RegisterConfirm))
|
||||
cfg.Section("service").Key("ENABLE_NOTIFY_MAIL").SetValue(strconv.FormatBool(form.MailNotify))
|
||||
|
||||
cfg.Section("openid").Key("ENABLE_OPENID_SIGNIN").SetValue(strconv.FormatBool(form.EnableOpenIDSignIn))
|
||||
cfg.Section("openid").Key("ENABLE_OPENID_SIGNUP").SetValue(strconv.FormatBool(form.EnableOpenIDSignUp))
|
||||
cfg.Section("service").Key("DISABLE_REGISTRATION").SetValue(strconv.FormatBool(form.DisableRegistration))
|
||||
cfg.Section("service").Key("ALLOW_ONLY_EXTERNAL_REGISTRATION").SetValue(strconv.FormatBool(form.AllowOnlyExternalRegistration))
|
||||
cfg.Section("service").Key("ENABLE_CAPTCHA").SetValue(strconv.FormatBool(form.EnableCaptcha))
|
||||
cfg.Section("service").Key("REQUIRE_SIGNIN_VIEW").SetValue(strconv.FormatBool(form.RequireSignInView))
|
||||
cfg.Section("service").Key("DEFAULT_KEEP_EMAIL_PRIVATE").SetValue(strconv.FormatBool(form.DefaultKeepEmailPrivate))
|
||||
@@ -468,55 +411,6 @@ func SubmitInstall(ctx *context.Context) {
|
||||
log.Fatal("ORM engine initialization failed: %v", err)
|
||||
}
|
||||
|
||||
// Create admin account
|
||||
if len(form.AdminName) > 0 {
|
||||
u := &user_model.User{
|
||||
Name: form.AdminName,
|
||||
Email: form.AdminEmail,
|
||||
Passwd: form.AdminPasswd,
|
||||
IsAdmin: true,
|
||||
}
|
||||
overwriteDefault := &user_model.CreateUserOverwriteOptions{
|
||||
IsRestricted: optional.Some(false),
|
||||
IsActive: optional.Some(true),
|
||||
}
|
||||
|
||||
if err = user_model.CreateUser(ctx, u, &user_model.Meta{}, overwriteDefault); err != nil {
|
||||
if !user_model.IsErrUserAlreadyExist(err) {
|
||||
setting.InstallLock = false
|
||||
ctx.Data["Err_AdminName"] = true
|
||||
ctx.Data["Err_AdminEmail"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.invalid_admin_setting", err), tplInstall, &form)
|
||||
return
|
||||
}
|
||||
log.Info("Admin account already exist")
|
||||
u, _ = user_model.GetUserByName(ctx, u.Name)
|
||||
}
|
||||
|
||||
nt, token, err := auth_service.CreateAuthTokenForUserID(ctx, u.ID)
|
||||
if err != nil {
|
||||
ctx.ServerError("CreateAuthTokenForUserID", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.SetSiteCookie(setting.CookieRememberName, nt.ID+":"+token, setting.LogInRememberDays*timeutil.Day)
|
||||
|
||||
// Auto-login for admin
|
||||
if err = ctx.Session.Set("uid", u.ID); err != nil {
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||
return
|
||||
}
|
||||
if err = ctx.Session.Set("uname", u.Name); err != nil {
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||
return
|
||||
}
|
||||
|
||||
if err = ctx.Session.Release(); err != nil {
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
setting.ClearEnvConfigKeys()
|
||||
log.Info("First-time run install finished!")
|
||||
InstallDone(ctx)
|
||||
|
||||
@@ -8,10 +8,13 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
asymkey_model "gitea.dev/models/asymkey"
|
||||
"gitea.dev/models/auth"
|
||||
"gitea.dev/models/db"
|
||||
user_model "gitea.dev/models/user"
|
||||
@@ -35,6 +38,7 @@ import (
|
||||
"gitea.dev/services/mailer"
|
||||
user_service "gitea.dev/services/user"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/markbates/goth"
|
||||
)
|
||||
|
||||
@@ -952,3 +956,167 @@ func updateSession(ctx *context.Context, deletes []string, updates map[string]an
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SignInGPGPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.SignInGPGForm)
|
||||
|
||||
user, err := asymkey_model.VerifyGPGSignature(ctx, form.Nonce, form.Signature)
|
||||
if err != nil {
|
||||
ctx.Data["Err_GPGSign"] = true
|
||||
ctx.Data["Flash"] = &middleware.Flash{
|
||||
ErrorMsg: ctx.Locale.TrString("auth.gpg_invalid_token_signature"),
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplSignIn)
|
||||
return
|
||||
}
|
||||
|
||||
if !user.IsActive {
|
||||
ctx.Data["Err_GPGSign"] = true
|
||||
ctx.Data["Flash"] = &middleware.Flash{
|
||||
ErrorMsg: ctx.Locale.TrString("auth.active_your_account"),
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplSignIn)
|
||||
return
|
||||
}
|
||||
|
||||
if user.ProhibitLogin {
|
||||
ctx.Data["Err_GPGSign"] = true
|
||||
ctx.Data["Flash"] = &middleware.Flash{
|
||||
ErrorMsg: ctx.Locale.TrString("auth.prohibit_login"),
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplSignIn)
|
||||
return
|
||||
}
|
||||
|
||||
handleSignIn(ctx, user, false)
|
||||
}
|
||||
|
||||
func SignUpGPGPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.RegisterGPGForm)
|
||||
|
||||
if setting.Service.DisableRegistration {
|
||||
ctx.HTTPError(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
// verify signature against the provided key before anything else
|
||||
ok, err := asymkey_model.VerifyGPGSignatureWithKey(form.Nonce, form.Signature, form.GPGKey)
|
||||
if err != nil || !ok {
|
||||
ctx.Data["Err_GPGSign"] = true
|
||||
ctx.Data["Flash"] = &middleware.Flash{
|
||||
ErrorMsg: ctx.Locale.TrString("auth.gpg_invalid_token_signature"),
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplSignUp)
|
||||
return
|
||||
}
|
||||
|
||||
// extract identity from key
|
||||
name, email, err := asymkey_model.ExtractGPGKeyIdentity(form.GPGKey)
|
||||
if err != nil {
|
||||
ctx.Data["Err_GPGSign"] = true
|
||||
ctx.Data["Flash"] = &middleware.Flash{
|
||||
ErrorMsg: ctx.Locale.TrString("auth.invalid_gpg_identity"),
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplSignUp)
|
||||
return
|
||||
}
|
||||
|
||||
// determine username and activation based on domain
|
||||
instanceDomain := setting.Domain
|
||||
emailParts := strings.SplitN(email, "@", 2)
|
||||
if len(emailParts) != 2 {
|
||||
ctx.Data["Err_GPGSign"] = true
|
||||
ctx.Data["Flash"] = &middleware.Flash{
|
||||
ErrorMsg: ctx.Locale.TrString("auth.invalid_gpg_key_email"),
|
||||
}
|
||||
ctx.HTML(http.StatusOK, tplSignUp)
|
||||
return
|
||||
}
|
||||
localPart := emailParts[0]
|
||||
emailDomain := emailParts[1]
|
||||
|
||||
var username string
|
||||
var isActive bool
|
||||
var isRestricted bool
|
||||
|
||||
if emailDomain == instanceDomain {
|
||||
// domestic user
|
||||
username = localPart
|
||||
isActive = true
|
||||
isRestricted = false
|
||||
} else {
|
||||
// external user — try federated key check
|
||||
username = localPart + "." + emailDomain
|
||||
isRestricted = true
|
||||
|
||||
federatedVerified := tryFederatedKeyVerify(email, emailDomain, form.GPGKey)
|
||||
if federatedVerified {
|
||||
isActive = true
|
||||
} else {
|
||||
isActive = false // will require email activation
|
||||
}
|
||||
}
|
||||
|
||||
pwdrand := []string{uuid.NewString(), uuid.NewString(), uuid.NewString(), uuid.NewString()}
|
||||
|
||||
u := &user_model.User{
|
||||
Name: username,
|
||||
FullName: name,
|
||||
Email: email,
|
||||
IsActive: isActive,
|
||||
IsRestricted: isRestricted,
|
||||
MustChangePassword: false,
|
||||
Passwd: strings.Join(pwdrand, "-"), // random unused password
|
||||
}
|
||||
|
||||
overwrites := &user_model.CreateUserOverwriteOptions{
|
||||
IsActive: optional.Some(isActive),
|
||||
IsRestricted: optional.Some(isRestricted),
|
||||
}
|
||||
|
||||
if !createUserInContext(ctx, tplSignUp, form, u, overwrites, nil) {
|
||||
return
|
||||
}
|
||||
|
||||
// attach the GPG key to the new user — skip nonce verify, already done above
|
||||
if _, err := asymkey_model.AddGPGKey(ctx, u.ID, form.GPGKey, form.Nonce, form.Signature); err != nil {
|
||||
log.Error("AddGPGKey failed after user creation: %v", err)
|
||||
}
|
||||
|
||||
if handleUserCreated(ctx, u, nil) {
|
||||
ctx.Flash.Success(ctx.Tr("auth.sign_up_successful"))
|
||||
handleSignIn(ctx, u, false)
|
||||
}
|
||||
}
|
||||
|
||||
// tryFederatedKeyVerify attempts to download the user's GPG key from their
|
||||
// home instance and checks if the registration key is present in the chain.
|
||||
func tryFederatedKeyVerify(email, domain, armoredKey string) bool {
|
||||
localPart, _, _ := strings.Cut(email, "@")
|
||||
url := fmt.Sprintf("https://%s/%s.gpg", domain, localPart)
|
||||
|
||||
client := &http.Client{Timeout: 3 * time.Second}
|
||||
resp, err := client.Get(url)
|
||||
if err != nil || resp.StatusCode != http.StatusOK {
|
||||
return false
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
remoteArmor, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20)) // 1MB limit
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// check if our key fingerprint appears in the remote key material
|
||||
ourKeyID, err := asymkey_model.ExtractGPGKeyID(armoredKey)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
remoteKeyID, err := asymkey_model.ExtractGPGKeyID(string(remoteArmor))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return ourKeyID == remoteKeyID
|
||||
}
|
||||
|
||||
@@ -182,7 +182,8 @@ func AuthorizeOAuth(ctx *context.Context) {
|
||||
if len(errs) > 0 {
|
||||
var errstring strings.Builder
|
||||
for _, e := range errs {
|
||||
errstring.WriteString(e.Error() + "\n")
|
||||
errstring.WriteString(e.Error())
|
||||
errstring.WriteString("\n")
|
||||
}
|
||||
ctx.ServerError("AuthorizeOAuth: Validate: ", fmt.Errorf("errors occurred during validation: %s", errstring.String()))
|
||||
return
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2026 The M8SH Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: GPL
|
||||
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.dev/modules/templates"
|
||||
"gitea.dev/services/context"
|
||||
)
|
||||
|
||||
const tplMail templates.TplName = "mail"
|
||||
|
||||
// Mail renders the M8SH Mail frontend page. The page itself is a thin shell;
|
||||
// all UI and mock state live client-side in the Vue MailApp component.
|
||||
func Mail(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("mail_title")
|
||||
ctx.Data["PageIsMail"] = true
|
||||
ctx.HTML(http.StatusOK, tplMail)
|
||||
}
|
||||
@@ -52,10 +52,10 @@ func KeysPost(ctx *context.Context) {
|
||||
|
||||
if ctx.HasError() {
|
||||
loadKeysData(ctx)
|
||||
|
||||
ctx.HTML(http.StatusOK, tplSettingsKeys)
|
||||
return
|
||||
}
|
||||
|
||||
switch form.Type {
|
||||
case "principal":
|
||||
content, err := asymkey_model.CheckPrincipalKeyString(ctx, ctx.Doer, form.Content)
|
||||
@@ -73,7 +73,6 @@ func KeysPost(ctx *context.Context) {
|
||||
switch {
|
||||
case asymkey_model.IsErrKeyAlreadyExist(err), asymkey_model.IsErrKeyNameAlreadyUsed(err):
|
||||
loadKeysData(ctx)
|
||||
|
||||
ctx.Data["Err_Content"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.ssh_principal_been_used"), tplSettingsKeys, &form)
|
||||
default:
|
||||
@@ -83,19 +82,31 @@ func KeysPost(ctx *context.Context) {
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.add_principal_success", form.Content))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
|
||||
case "gpg":
|
||||
if form.Signature == "" {
|
||||
loadKeysData(ctx)
|
||||
ctx.Data["HasGPGError"] = true
|
||||
ctx.Data["Err_Signature"] = true
|
||||
ctx.Data["Err_Content"] = false
|
||||
ctx.HTML(http.StatusOK, tplSettingsKeys)
|
||||
return
|
||||
}
|
||||
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageGPGKeys) {
|
||||
ctx.NotFound(errors.New("gpg keys setting is not allowed to be visited"))
|
||||
return
|
||||
}
|
||||
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
lastToken := asymkey_model.VerificationToken(ctx.Doer, 0)
|
||||
|
||||
keys, err := asymkey_model.AddGPGKey(ctx, ctx.Doer.ID, form.Content, token, form.Signature)
|
||||
if err != nil && asymkey_model.IsErrGPGInvalidTokenSignature(err) {
|
||||
keys, err = asymkey_model.AddGPGKey(ctx, ctx.Doer.ID, form.Content, lastToken, form.Signature)
|
||||
if !asymkey_model.VerifyNonce(form.Nonce) {
|
||||
loadKeysData(ctx)
|
||||
ctx.Data["HasGPGError"] = true
|
||||
ctx.Data["Err_Signature"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.gpg_invalid_token_signature"), tplSettingsKeys, &form)
|
||||
return
|
||||
}
|
||||
|
||||
keys, err := asymkey_model.AddGPGKey(ctx, ctx.Doer.ID, form.Content, form.Nonce, form.Signature)
|
||||
if err != nil {
|
||||
ctx.Data["HasGPGError"] = true
|
||||
switch {
|
||||
@@ -104,7 +115,6 @@ func KeysPost(ctx *context.Context) {
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
case asymkey_model.IsErrGPGKeyIDAlreadyUsed(err):
|
||||
loadKeysData(ctx)
|
||||
|
||||
ctx.Data["Err_Content"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.gpg_key_id_used"), tplSettingsKeys, &form)
|
||||
case asymkey_model.IsErrGPGInvalidTokenSignature(err):
|
||||
@@ -117,7 +127,6 @@ func KeysPost(ctx *context.Context) {
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.gpg_invalid_token_signature"), tplSettingsKeys, &form)
|
||||
case asymkey_model.IsErrGPGNoEmailFound(err):
|
||||
loadKeysData(ctx)
|
||||
|
||||
ctx.Data["Err_Content"] = true
|
||||
ctx.Data["Err_Signature"] = true
|
||||
keyID := err.(asymkey_model.ErrGPGNoEmailFound).ID
|
||||
@@ -131,22 +140,25 @@ func KeysPost(ctx *context.Context) {
|
||||
}
|
||||
keyIDs := ""
|
||||
for _, key := range keys {
|
||||
keyIDs += key.KeyID
|
||||
keyIDs += ", "
|
||||
keyIDs += key.KeyID + ", "
|
||||
}
|
||||
if len(keyIDs) > 0 {
|
||||
keyIDs = keyIDs[:len(keyIDs)-2]
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.add_gpg_key_success", keyIDs))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
case "verify_gpg":
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
lastToken := asymkey_model.VerificationToken(ctx.Doer, 0)
|
||||
|
||||
keyID, err := asymkey_model.VerifyGPGKey(ctx, ctx.Doer.ID, form.KeyID, token, form.Signature)
|
||||
if err != nil && asymkey_model.IsErrGPGInvalidTokenSignature(err) {
|
||||
keyID, err = asymkey_model.VerifyGPGKey(ctx, ctx.Doer.ID, form.KeyID, lastToken, form.Signature)
|
||||
case "verify_gpg":
|
||||
if !asymkey_model.VerifyNonce(form.Nonce) {
|
||||
loadKeysData(ctx)
|
||||
ctx.Data["HasGPGVerifyError"] = true
|
||||
ctx.Data["VerifyingID"] = form.KeyID
|
||||
ctx.Data["Err_Signature"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.gpg_invalid_token_signature"), tplSettingsKeys, &form)
|
||||
return
|
||||
}
|
||||
|
||||
user, err := asymkey_model.VerifyGPGSignature(ctx, form.Nonce, form.Signature)
|
||||
if err != nil {
|
||||
ctx.Data["HasGPGVerifyError"] = true
|
||||
switch {
|
||||
@@ -161,9 +173,18 @@ func KeysPost(ctx *context.Context) {
|
||||
default:
|
||||
ctx.ServerError("VerifyGPG", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.verify_gpg_key_success", keyID))
|
||||
|
||||
// make sure verified key belongs to current user
|
||||
if user.ID != ctx.Doer.ID {
|
||||
ctx.ServerError("VerifyGPG", errors.New("key does not belong to current user"))
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("settings.verify_gpg_key_success", form.KeyID))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
|
||||
case "ssh":
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageSSHKeys) {
|
||||
ctx.NotFound(errors.New("ssh keys setting is not allowed to be visited"))
|
||||
@@ -190,12 +211,10 @@ func KeysPost(ctx *context.Context) {
|
||||
switch {
|
||||
case asymkey_model.IsErrKeyAlreadyExist(err):
|
||||
loadKeysData(ctx)
|
||||
|
||||
ctx.Data["Err_Content"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.ssh_key_been_used"), tplSettingsKeys, &form)
|
||||
case asymkey_model.IsErrKeyNameAlreadyUsed(err):
|
||||
loadKeysData(ctx)
|
||||
|
||||
ctx.Data["Err_Title"] = true
|
||||
ctx.RenderWithErrDeprecated(ctx.Tr("settings.ssh_key_name_used"), tplSettingsKeys, &form)
|
||||
case asymkey_model.IsErrKeyUnableVerify(err):
|
||||
@@ -208,6 +227,7 @@ func KeysPost(ctx *context.Context) {
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.add_key_success", form.Title))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
|
||||
case "verify_ssh":
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageSSHKeys) {
|
||||
ctx.NotFound(errors.New("ssh keys setting is not allowed to be visited"))
|
||||
@@ -232,6 +252,7 @@ func KeysPost(ctx *context.Context) {
|
||||
default:
|
||||
ctx.ServerError("VerifySSH", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("settings.verify_ssh_key_success", fingerprint))
|
||||
ctx.Redirect(setting.AppSubURL + "/user/settings/keys")
|
||||
@@ -260,7 +281,6 @@ func DeleteKey(ctx *context.Context) {
|
||||
ctx.JSONError("ssh keys setting is not allowed to be visited")
|
||||
return
|
||||
}
|
||||
|
||||
keyID := ctx.FormInt64("id")
|
||||
external, err := asymkey_model.PublicKeyIsExternallyManaged(ctx, keyID)
|
||||
if err != nil {
|
||||
@@ -320,10 +340,6 @@ func loadKeysData(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
ctx.Data["GPGKeys"] = gpgkeys
|
||||
tokenToSign := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
|
||||
// generate a new aes cipher using the token
|
||||
ctx.Data["TokenToSign"] = tokenToSign
|
||||
|
||||
principals, err := db.Find[asymkey_model.PublicKey](ctx, asymkey_model.FindPublicKeyOptions{
|
||||
ListOptions: db.ListOptionsAll,
|
||||
@@ -338,4 +354,8 @@ func loadKeysData(ctx *context.Context) {
|
||||
|
||||
ctx.Data["VerifyingID"] = ctx.FormString("verify_gpg")
|
||||
ctx.Data["VerifyingFingerprint"] = ctx.FormString("verify_ssh")
|
||||
|
||||
if fp := ctx.FormString("verify_ssh"); fp != "" {
|
||||
ctx.Data["TokenToSign"] = asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,13 +343,6 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
|
||||
}
|
||||
}
|
||||
|
||||
openIDSignUpEnabled := func(ctx *context.Context) {
|
||||
if !setting.Service.EnableOpenIDSignUp {
|
||||
ctx.HTTPError(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
oauth2Enabled := func(ctx *context.Context) {
|
||||
if !setting.OAuth2.Enabled {
|
||||
ctx.HTTPError(http.StatusForbidden)
|
||||
@@ -549,76 +542,27 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
|
||||
m.Get("/pulls", reqSignIn, user.Pulls)
|
||||
m.Get("/milestones", reqSignIn, reqMilestonesDashboardPageEnabled, user.Milestones)
|
||||
|
||||
// M8SH Mail: messenger-style mail UI, mock-only frontend, requires sign-in.
|
||||
m.Get("/mail", reqSignIn, Mail)
|
||||
|
||||
// ***** START: User *****
|
||||
// "user/login" doesn't need signOut, then logged-in users can still access this route for redirection purposes by "/user/login?redirec_to=..."
|
||||
m.Get("/user/login", auth.SignIn)
|
||||
m.Group("/user", func() {
|
||||
m.Post("/login", web.Bind(forms.SignInForm{}), auth.SignInPost)
|
||||
m.Group("", func() {
|
||||
m.Combo("/login/openid").
|
||||
Get(auth.SignInOpenID).
|
||||
Post(web.Bind(forms.SignInOpenIDForm{}), auth.SignInOpenIDPost)
|
||||
}, openIDSignInEnabled)
|
||||
m.Group("/openid", func() {
|
||||
m.Combo("/connect").
|
||||
Get(auth.ConnectOpenID).
|
||||
Post(web.Bind(forms.ConnectOpenIDForm{}), auth.ConnectOpenIDPost)
|
||||
m.Group("/register", func() {
|
||||
m.Combo("").
|
||||
Get(auth.RegisterOpenID, openIDSignUpEnabled).
|
||||
Post(web.Bind(forms.SignUpOpenIDForm{}), auth.RegisterOpenIDPost)
|
||||
}, openIDSignUpEnabled)
|
||||
}, openIDSignInEnabled)
|
||||
m.Post("/login", web.Bind(forms.SignInGPGForm{}), auth.SignInGPGPost)
|
||||
m.Get("/sign_up", auth.SignUp)
|
||||
m.Post("/sign_up", web.Bind(forms.RegisterForm{}), auth.SignUpPost)
|
||||
m.Get("/link_account", auth.LinkAccount)
|
||||
m.Post("/link_account_signin", web.Bind(forms.SignInForm{}), auth.LinkAccountPostSignIn)
|
||||
m.Post("/link_account_signup", web.Bind(forms.RegisterForm{}), auth.LinkAccountPostRegister)
|
||||
m.Group("/two_factor", func() {
|
||||
m.Get("", auth.TwoFactor)
|
||||
m.Post("", web.Bind(forms.TwoFactorAuthForm{}), auth.TwoFactorPost)
|
||||
m.Get("/scratch", auth.TwoFactorScratch)
|
||||
m.Post("/scratch", web.Bind(forms.TwoFactorScratchAuthForm{}), auth.TwoFactorScratchPost)
|
||||
})
|
||||
m.Group("/webauthn", func() {
|
||||
m.Get("", auth.WebAuthn)
|
||||
m.Get("/passkey/assertion", auth.WebAuthnPasskeyAssertion)
|
||||
m.Post("/passkey/login", auth.WebAuthnPasskeyLogin)
|
||||
m.Get("/assertion", auth.WebAuthnLoginAssertion)
|
||||
m.Post("/assertion", auth.WebAuthnLoginAssertionPost)
|
||||
})
|
||||
m.Post("/sign_up", web.Bind(forms.RegisterGPGForm{}), auth.SignUpGPGPost)
|
||||
}, reqSignOut)
|
||||
|
||||
m.Any("/user/events", routing.MarkLongPolling(), events.Events)
|
||||
|
||||
m.Group("/login/oauth", func() {
|
||||
m.Group("", func() {
|
||||
m.Get("/authorize", web.Bind(forms.AuthorizationForm{}), auth.AuthorizeOAuth)
|
||||
m.Post("/grant", web.Bind(forms.GrantApplicationForm{}), auth.GrantApplicationOAuth)
|
||||
// TODO manage redirection
|
||||
m.Post("/authorize", web.Bind(forms.AuthorizationForm{}), auth.AuthorizeOAuth)
|
||||
}, reqSignIn)
|
||||
|
||||
m.Group("", func() {
|
||||
m.Methods("GET, POST, OPTIONS", "/userinfo", auth.InfoOAuth)
|
||||
m.Methods("POST, OPTIONS", "/access_token", web.Bind(forms.AccessTokenForm{}), auth.AccessTokenOAuth)
|
||||
m.Methods("GET, OPTIONS", "/keys", auth.OIDCKeys)
|
||||
m.Methods("POST, OPTIONS", "/introspect", web.Bind(forms.IntrospectTokenForm{}), auth.IntrospectOAuth)
|
||||
}, optionsCorsHandler(), webAuth.AllowOAuth2, optSignInFromAnyOrigin)
|
||||
}, oauth2Enabled)
|
||||
|
||||
m.Group("/user/settings", func() {
|
||||
m.Get("", user_setting.Profile)
|
||||
m.Post("", web.Bind(forms.UpdateProfileForm{}), user_setting.ProfilePost)
|
||||
m.Post("/update_preferences", user_setting.UpdatePreferences)
|
||||
m.Get("/change_password", auth.MustChangePassword)
|
||||
m.Post("/change_password", web.Bind(forms.MustChangePasswordForm{}), auth.MustChangePasswordPost)
|
||||
m.Post("/avatar", web.Bind(forms.AvatarForm{}), user_setting.AvatarPost)
|
||||
m.Post("/avatar/delete", user_setting.DeleteAvatar)
|
||||
m.Group("/account", func() {
|
||||
m.Combo("").Get(user_setting.Account).Post(web.Bind(forms.ChangePasswordForm{}), user_setting.AccountPost)
|
||||
m.Post("/email", web.Bind(forms.AddEmailForm{}), user_setting.EmailPost)
|
||||
m.Post("/email/delete", user_setting.DeleteEmail)
|
||||
m.Post("/delete", user_setting.DeleteAccount)
|
||||
})
|
||||
m.Group("/appearance", func() {
|
||||
@@ -726,21 +670,10 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
|
||||
}, reqSignIn, user_setting.SettingsCtxData)
|
||||
|
||||
m.Group("/user", func() {
|
||||
m.Get("/activate", auth.Activate)
|
||||
m.Post("/activate", auth.ActivatePost)
|
||||
m.Any("/activate_email", auth.ActivateEmail)
|
||||
m.Get("/avatar/{username}/{size}", user.AvatarByUsernameSize)
|
||||
m.Get("/recover_account", auth.ResetPasswd)
|
||||
m.Post("/recover_account", auth.ResetPasswdPost)
|
||||
m.Get("/forgot_password", auth.ForgotPasswd)
|
||||
m.Post("/forgot_password", auth.ForgotPasswdPost)
|
||||
m.Get("/logout", auth.SignOut)
|
||||
m.Get("/stopwatches", reqSignIn, user.GetStopwatches)
|
||||
m.Get("/search_candidates", optExploreSignIn, user.SearchCandidates)
|
||||
m.Group("/oauth2", func() {
|
||||
m.Get("/{provider}", auth.SignInOAuth)
|
||||
m.Get("/{provider}/callback", auth.SignInOAuthCallback)
|
||||
})
|
||||
})
|
||||
// ***** END: User *****
|
||||
|
||||
|
||||
@@ -102,3 +102,14 @@ func (f *AuthenticationForm) Validate(req *http.Request, errs binding.Errors) bi
|
||||
ctx := context.GetValidateContext(req)
|
||||
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
|
||||
}
|
||||
|
||||
type SignInGPGForm struct {
|
||||
Nonce string `form:"nonce" binding:"Required"`
|
||||
Signature string `form:"gpg_signature" binding:"Required"`
|
||||
}
|
||||
|
||||
type RegisterGPGForm struct {
|
||||
Nonce string `form:"nonce" binding:"Required"`
|
||||
GPGKey string `form:"gpg_key" binding:"Required"`
|
||||
Signature string `form:"gpg_signature" binding:"Required"`
|
||||
}
|
||||
|
||||
@@ -49,10 +49,6 @@ type InstallForm struct {
|
||||
RegisterConfirm bool
|
||||
MailNotify bool
|
||||
|
||||
EnableOpenIDSignIn bool
|
||||
EnableOpenIDSignUp bool
|
||||
DisableRegistration bool
|
||||
AllowOnlyExternalRegistration bool
|
||||
EnableCaptcha bool
|
||||
RequireSignInView bool
|
||||
DefaultKeepEmailPrivate bool
|
||||
@@ -63,11 +59,6 @@ type InstallForm struct {
|
||||
|
||||
PasswordAlgorithm string
|
||||
|
||||
AdminName string `binding:"OmitEmpty;Username;MaxSize(30)" locale:"install.admin_name"`
|
||||
AdminPasswd string `binding:"OmitEmpty;MaxSize(255)" locale:"install.admin_password"`
|
||||
AdminConfirmPasswd string
|
||||
AdminEmail string `binding:"OmitEmpty;MinSize(3);MaxSize(254);Include(@)" locale:"install.admin_email"`
|
||||
|
||||
// ReinstallConfirmFirst we can not use 1/2/3 or A/B/C here, there is a framework bug, can not parse "reinstall_confirm_1" or "reinstall_confirm_a"
|
||||
ReinstallConfirmFirst bool
|
||||
ReinstallConfirmSecond bool
|
||||
@@ -313,6 +304,7 @@ type AddKeyForm struct {
|
||||
Signature string `binding:"OmitEmpty"`
|
||||
KeyID string `binding:"OmitEmpty"`
|
||||
Fingerprint string `binding:"OmitEmpty"`
|
||||
Nonce string `binding:"OmitEmpty"`
|
||||
IsWritable bool
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@ package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
@@ -22,98 +21,19 @@ import (
|
||||
"gitea.dev/modules/storage"
|
||||
"gitea.dev/modules/structs"
|
||||
"gitea.dev/modules/util"
|
||||
"gitea.dev/services/agit"
|
||||
asymkey_service "gitea.dev/services/asymkey"
|
||||
org_service "gitea.dev/services/org"
|
||||
"gitea.dev/services/packages"
|
||||
container_service "gitea.dev/services/packages/container"
|
||||
repo_service "gitea.dev/services/repository"
|
||||
)
|
||||
|
||||
// RenameUser renames a user
|
||||
func RenameUser(ctx context.Context, u *user_model.User, newUserName string, doer *user_model.User) error {
|
||||
if newUserName == u.Name {
|
||||
if u.Name == newUserName {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Non-local users are not allowed to change their own username, but admins are
|
||||
isExternalUser := !u.IsOrganization() && !u.IsLocal()
|
||||
if isExternalUser && !doer.IsAdmin {
|
||||
return user_model.ErrUserIsNotLocal{UID: u.ID, Name: u.Name}
|
||||
}
|
||||
|
||||
if err := user_model.IsUsableUsername(newUserName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
onlyCapitalization := strings.EqualFold(newUserName, u.Name)
|
||||
oldUserName := u.Name
|
||||
|
||||
if onlyCapitalization {
|
||||
u.Name = newUserName
|
||||
if err := user_model.UpdateUserCols(ctx, u, "name"); err != nil {
|
||||
u.Name = oldUserName
|
||||
return err
|
||||
}
|
||||
return repo_model.UpdateRepositoryOwnerNames(ctx, u.ID, newUserName)
|
||||
}
|
||||
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer committer.Close()
|
||||
|
||||
isExist, err := user_model.IsUserExist(ctx, u.ID, newUserName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if isExist {
|
||||
return user_model.ErrUserAlreadyExist{
|
||||
Name: newUserName,
|
||||
}
|
||||
}
|
||||
|
||||
if err = repo_model.UpdateRepositoryOwnerName(ctx, oldUserName, newUserName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = user_model.NewUserRedirect(ctx, u.ID, oldUserName, newUserName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := agit.UserNameChanged(ctx, u, newUserName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := container_service.UpdateRepositoryNames(ctx, u, newUserName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u.Name = newUserName
|
||||
u.LowerName = strings.ToLower(newUserName)
|
||||
if err := user_model.UpdateUserCols(ctx, u, "name", "lower_name"); err != nil {
|
||||
u.Name = oldUserName
|
||||
u.LowerName = strings.ToLower(oldUserName)
|
||||
return err
|
||||
}
|
||||
|
||||
// Do not fail if directory does not exist
|
||||
if err = util.Rename(user_model.UserPath(oldUserName), user_model.UserPath(newUserName)); err != nil && !os.IsNotExist(err) {
|
||||
u.Name = oldUserName
|
||||
u.LowerName = strings.ToLower(oldUserName)
|
||||
return fmt.Errorf("rename user directory: %w", err)
|
||||
}
|
||||
|
||||
if err = committer.Commit(); err != nil {
|
||||
u.Name = oldUserName
|
||||
u.LowerName = strings.ToLower(oldUserName)
|
||||
if err2 := util.Rename(user_model.UserPath(newUserName), user_model.UserPath(oldUserName)); err2 != nil && !os.IsNotExist(err2) {
|
||||
log.Error("Unable to rollback directory change during failed username change from: %s to: %s. DB Error: %v. Filesystem Error: %v", oldUserName, newUserName, err, err2)
|
||||
return fmt.Errorf("failed to rollback directory change during failed username change from: %s to: %s. DB Error: %w. Filesystem Error: %v", oldUserName, newUserName, err, err2)
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return errors.New("username change is disabled in m8sh")
|
||||
}
|
||||
|
||||
// DeleteUser completely and permanently deletes everything of a user,
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
<details class="item" {{if or .PageIsAdminUsers .PageIsAdminBadges .PageIsAdminEmails .PageIsAdminOrganizations .PageIsAdminAuthentications}}open{{end}}>
|
||||
<summary>{{ctx.Locale.Tr "admin.identity_access"}}</summary>
|
||||
<div class="menu">
|
||||
<a class="{{if .PageIsAdminAuthentications}}active {{end}}item" href="{{AppSubUrl}}/-/admin/auths">
|
||||
<!-- <a class="{{if .PageIsAdminAuthentications}}active {{end}}item" href="{{AppSubUrl}}/-/admin/auths">
|
||||
{{ctx.Locale.Tr "admin.authentication"}}
|
||||
</a>
|
||||
</a> -->
|
||||
<a class="{{if .PageIsAdminOrganizations}}active {{end}}item" href="{{AppSubUrl}}/-/admin/orgs">
|
||||
{{ctx.Locale.Tr "admin.organizations"}}
|
||||
</a>
|
||||
@@ -51,9 +51,9 @@
|
||||
<details class="item" {{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks .PageIsAdminApplications}}open{{end}}>
|
||||
<summary>{{ctx.Locale.Tr "admin.integrations"}}</summary>
|
||||
<div class="menu">
|
||||
<a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/-/admin/applications">
|
||||
<!-- <a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/-/admin/applications">
|
||||
{{ctx.Locale.Tr "settings.applications"}}
|
||||
</a>
|
||||
</a> -->
|
||||
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/-/admin/hooks">
|
||||
{{ctx.Locale.Tr "admin.hooks"}}
|
||||
</a>
|
||||
@@ -65,11 +65,11 @@
|
||||
{{ctx.Locale.Tr "admin.hooks"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .EnableOAuth2}}
|
||||
<!-- {{if .EnableOAuth2}}
|
||||
<a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/-/admin/applications">
|
||||
{{ctx.Locale.Tr "settings.applications"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}} -->
|
||||
{{end}}
|
||||
{{if .EnableActions}}
|
||||
<details class="item" {{if or .PageIsSharedSettingsRunners .PageIsSharedSettingsVariables}}open{{end}}>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<footer class="page-footer" role="group" aria-label="{{ctx.Locale.Tr "aria.footer"}}">
|
||||
<div class="left-links" role="contentinfo" aria-label="{{ctx.Locale.Tr "aria.footer.software"}}">
|
||||
{{if ShowFooterPoweredBy}}
|
||||
<a target="_blank" href="https://about.gitea.com">{{ctx.Locale.Tr "powered_by" "Gitea"}}</a>
|
||||
<a target="_blank" href="https://m8sh.su/">{{ctx.Locale.Tr "powered_by" "M8SH"}}</a>
|
||||
{{end}}
|
||||
{{if (or .ShowFooterVersion .PageIsAdmin)}}
|
||||
<span>
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
{{end}}
|
||||
{{end}}
|
||||
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{ctx.Locale.Tr "explore_title"}}</a>
|
||||
<!-- M8SH Mail: "Messages" link to the right of explore, always visible when signed in -->
|
||||
{{if and .IsSigned (not .MustChangePassword)}}
|
||||
<a class="item{{if .PageIsMail}} active{{end}}" href="{{AppSubUrl}}/mail">Chats</a>
|
||||
{{end}}
|
||||
{{else if .IsLandingPageOrganizations}}
|
||||
<a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{ctx.Locale.Tr "explore_title"}}</a>
|
||||
{{else}}
|
||||
@@ -34,10 +38,6 @@
|
||||
{{end}}
|
||||
|
||||
{{template "custom/extra_links" .}}
|
||||
|
||||
{{if not .IsSigned}}
|
||||
<a class="item" target="_blank" href="https://docs.gitea.com">{{ctx.Locale.Tr "help"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<!-- the full dropdown menus -->
|
||||
@@ -119,10 +119,6 @@
|
||||
{{svg "octicon-tools"}}
|
||||
{{ctx.Locale.Tr "your_settings"}}
|
||||
</a>
|
||||
<a class="item" target="_blank" href="https://docs.gitea.com">
|
||||
{{svg "octicon-question"}}
|
||||
{{ctx.Locale.Tr "help"}}
|
||||
</a>
|
||||
{{if .IsAdmin}}
|
||||
<div class="divider"></div>
|
||||
<a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/-/admin">
|
||||
|
||||
@@ -1,50 +1,66 @@
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{if .IsSigned}}{{ctx.Locale.Tr "dashboard"}}{{else}}{{ctx.Locale.Tr "home_title"}}{{end}}" class="page-content home">
|
||||
<div class="tw-mb-8 tw-px-8">
|
||||
<div class="center">
|
||||
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}">
|
||||
<div class="hero">
|
||||
<h1 class="ui icon header title tw-text-balance">
|
||||
{{AppName}}
|
||||
</h1>
|
||||
<h2 class="tw-text-balance">{{ctx.Locale.Tr "startpage.app_desc"}}</h2>
|
||||
<div role="main" aria-label="M8SH Project" class="page-content home">
|
||||
<div class="tw-max-w-3xl tw-mx-auto tw-px-6 tw-py-16">
|
||||
<div class="tw-mb-12">
|
||||
<h1 style="font-size: 3rem; font-weight: 700; letter-spacing: -2px; margin: 0 0 0.25rem;">
|
||||
M8SH
|
||||
</h1>
|
||||
<p style="color: var(--color-primary); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 2px; margin: 0 0 1rem;">
|
||||
Work in progress
|
||||
</p>
|
||||
<p style="font-size: 1.15rem; color: var(--color-text-secondary); margin: 0;">
|
||||
A heavily extended Gitea fork with integrated GPG-based auth, email, messenger, media streaming, VPN, and later —
|
||||
clients for secure interaction with the network.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui stackable middle very relaxed page grid">
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-flame"}} {{ctx.Locale.Tr "startpage.install"}}
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
{{ctx.Locale.Tr "startpage.install_desc" "https://docs.gitea.com/installation/install-from-binary" "https://github.com/go-gitea/gitea/tree/master/docker" "https://docs.gitea.com/installation/install-from-package"}}
|
||||
<div style="border-top: 1px solid var(--color-border-primary); padding-top: 2rem; margin-bottom: 2rem;">
|
||||
<p style="line-height: 1.8; margin-bottom: 1rem;">
|
||||
M8SH is what email should have evolved into, but didn't.
|
||||
</p>
|
||||
<p style="line-height: 1.8; margin-bottom: 1rem; color: var(--color-text-secondary);">
|
||||
What email got right was simplicity alongside decentralization: anyone could run a server and communicate freely, without a
|
||||
central controlling institution. What it got catastrophically wrong was everything else — cryptography, security, protocols, user experience.
|
||||
</p>
|
||||
<p style="line-height: 1.8; margin-bottom: 1rem; color: var(--color-text-secondary);">
|
||||
In M8SH the naming convention stays the same — <code>name@example.com</code> — but it provides a full-fledged modernized API for different
|
||||
forms of interaction between users on the network: sharing music, videos, subscribing to each other, posting articles, sending private
|
||||
messages, all reusing that simple email naming — <code>neo@m8sh.su</code>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-device-desktop"}} {{ctx.Locale.Tr "startpage.platform"}}
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
{{ctx.Locale.Tr "startpage.platform_desc" "https://go.dev/"}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui stackable middle very relaxed page grid">
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-rocket"}} {{ctx.Locale.Tr "startpage.lightweight"}}
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
{{ctx.Locale.Tr "startpage.lightweight_desc"}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="eight wide center column">
|
||||
<h1 class="hero ui icon header">
|
||||
{{svg "octicon-code"}} {{ctx.Locale.Tr "startpage.license"}}
|
||||
</h1>
|
||||
<p class="large tw-text-balance">
|
||||
{{ctx.Locale.Tr "startpage.license_desc" "https://gitea.dev" "gitea.dev" "https://github.com/go-gitea/gitea"}}
|
||||
</p>
|
||||
<div>
|
||||
<h3 style="font-size: 0.75rem; text-transform: uppercase; letter-spacing: 2px; color: var(--color-text-secondary); margin-bottom: 1rem;">
|
||||
Roadmap
|
||||
</h3>
|
||||
<ol style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem;">
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">01</span>
|
||||
<span>GPG-based registration, auth and authentication - decentralized by design</span>
|
||||
</li>
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">02</span>
|
||||
<span>Integrated email server - for compatibility with legacy systems</span>
|
||||
</li>
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">03</span>
|
||||
<span>Integrated messenger - end-to-end encrypted via GPG public keys</span>
|
||||
</li>
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">04</span>
|
||||
<span>Federated search - indexed across M8SH nodes, accessible via API</span>
|
||||
</li>
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">05</span>
|
||||
<span>Posts, articles, videos, reels, music, reactions, comments</span>
|
||||
</li>
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">06</span>
|
||||
<span>Integrated VPN</span>
|
||||
</li>
|
||||
<li style="display: flex; gap: 1rem; align-items: baseline;">
|
||||
<span style="font-size: 0.75rem; color: var(--color-text-secondary); min-width: 1.5rem; font-variant-numeric: tabular-nums;">07</span>
|
||||
<span>Encrypted cloud storage</span>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -204,31 +204,7 @@
|
||||
{{ctx.Locale.Tr "install.server_service_title"}}
|
||||
</summary>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox" id="enable-openid-signin">
|
||||
<label data-tooltip-content="{{ctx.Locale.Tr "install.openid_signin_popup"}}">{{ctx.Locale.Tr "install.openid_signin"}}</label>
|
||||
<input name="enable_open_id_sign_in" type="checkbox" {{if .enable_open_id_sign_in}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox" id="disable-registration">
|
||||
<label data-tooltip-content="{{ctx.Locale.Tr "install.disable_registration_popup"}}">{{ctx.Locale.Tr "install.disable_registration"}}</label>
|
||||
<input name="disable_registration" type="checkbox" {{if .disable_registration}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox" id="allow-only-external-registration">
|
||||
<label data-tooltip-content="{{ctx.Locale.Tr "install.allow_only_external_registration_popup"}}">{{ctx.Locale.Tr "install.allow_only_external_registration_popup"}}</label>
|
||||
<input name="allow_only_external_registration" type="checkbox" {{if .allow_only_external_registration}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox" id="enable-openid-signup">
|
||||
<label data-tooltip-content="{{ctx.Locale.Tr "install.openid_signup_popup"}}">{{ctx.Locale.Tr "install.openid_signup"}}</label>
|
||||
<input name="enable_open_id_sign_up" type="checkbox" {{if .enable_open_id_sign_up}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox" id="enable-captcha">
|
||||
<div class="ui checkbox">
|
||||
<label data-tooltip-content="{{ctx.Locale.Tr "install.enable_captcha_popup"}}">{{ctx.Locale.Tr "install.enable_captcha"}}</label>
|
||||
<input name="enable_captcha" type="checkbox" {{if .enable_captcha}}checked{{end}}>
|
||||
</div>
|
||||
@@ -277,30 +253,6 @@
|
||||
<span class="help">{{ctx.Locale.Tr "install.password_algorithm_helper"}}</span>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<!-- Admin -->
|
||||
<details class="optional field">
|
||||
<summary class="right-content tw-py-2{{if .Err_Admin}} tw-text-red{{end}}">
|
||||
{{ctx.Locale.Tr "install.admin_title"}}
|
||||
</summary>
|
||||
<p class="center">{{ctx.Locale.Tr "install.admin_setting_desc"}}</p>
|
||||
<div class="inline field {{if .Err_AdminName}}error{{end}}">
|
||||
<label for="admin_name">{{ctx.Locale.Tr "install.admin_name"}}</label>
|
||||
<input id="admin_name" name="admin_name" value="{{.admin_name}}">
|
||||
</div>
|
||||
<div class="inline field {{if .Err_AdminEmail}}error{{end}}">
|
||||
<label for="admin_email">{{ctx.Locale.Tr "install.admin_email"}}</label>
|
||||
<input id="admin_email" name="admin_email" type="email" value="{{.admin_email}}">
|
||||
</div>
|
||||
<div class="inline field {{if .Err_AdminPasswd}}error{{end}}">
|
||||
<label for="admin_passwd">{{ctx.Locale.Tr "install.admin_password"}}</label>
|
||||
<input id="admin_passwd" name="admin_passwd" type="password" autocomplete="new-password" value="{{.admin_passwd}}">
|
||||
</div>
|
||||
<div class="inline field {{if .Err_AdminPasswd}}error{{end}}">
|
||||
<label for="admin_confirm_passwd">{{ctx.Locale.Tr "install.confirm_password"}}</label>
|
||||
<input id="admin_confirm_passwd" name="admin_confirm_passwd" autocomplete="new-password" type="password" value="{{.admin_confirm_passwd}}">
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{{template "base/head" .}}
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content mail-page">
|
||||
<div id="mail-app"></div>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
@@ -1,9 +1,12 @@
|
||||
{{template "org/settings/layout_head" (dict "pageClass" "organization settings options")}}
|
||||
<div class="org-setting-content">
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "settings.applications"}}
|
||||
</h4>
|
||||
|
||||
{{template "user/settings/applications_oauth2_list" .}}
|
||||
</div>
|
||||
<div class="org-setting-content">
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "settings.applications"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<div class="ui info">
|
||||
<p>{{ctx.Locale.Tr "settings.oauth_applications_disabled"}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "org/settings/layout_footer" .}}
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
{{end}}
|
||||
{{if $.RenderedDescription}}
|
||||
<li>
|
||||
{{svg "octicon-info"}}
|
||||
<div class="render-content markup">{{$.RenderedDescription}}</div>
|
||||
</li>
|
||||
{{end}}
|
||||
|
||||
@@ -1,76 +1,48 @@
|
||||
<div class="ui container fluid">
|
||||
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}}
|
||||
{{template "base/alert" .}}
|
||||
{{end}}
|
||||
<h4 class="ui top attached header center">
|
||||
{{if .LinkAccountMode}}
|
||||
{{ctx.Locale.Tr "auth.oauth_signin_title"}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "auth.login_userpass"}}
|
||||
{{end}}
|
||||
{{ctx.Locale.Tr "gpg.signin.title"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
{{if .EnablePasswordSignInForm}}
|
||||
<form class="ui form" action="{{.SignInLink}}" method="post">
|
||||
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
|
||||
<label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label>
|
||||
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required tabindex="1">
|
||||
</div>
|
||||
{{if or (not .DisablePassword) .LinkAccountMode}}
|
||||
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
|
||||
<div class="tw-flex tw-mb-1">
|
||||
<label for="password" class="tw-flex-1">{{ctx.Locale.Tr "password"}}</label>
|
||||
<a href="{{AppSubUrl}}/user/forgot_password" tabindex="4">{{ctx.Locale.Tr "auth.forgot_password"}}</a>
|
||||
</div>
|
||||
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="current-password" required tabindex="2">
|
||||
</div>
|
||||
{{end}}
|
||||
{{if not .LinkAccountMode}}
|
||||
<div class="inline field">
|
||||
<div class="ui checkbox">
|
||||
<label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
|
||||
<input name="remember" type="checkbox" tabindex="5">
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{template "user/auth/captcha" .}}
|
||||
<form class="ui form" action="{{.SignInLink}}" method="post" id="signin-form">
|
||||
{{.CsrfTokenHtml}}
|
||||
{{template "base/alert" .}}
|
||||
<input type="hidden" id="hidden-nonce" name="nonce">
|
||||
|
||||
<div class="field">
|
||||
<button class="ui primary button tw-w-full" tabindex="3">
|
||||
{{if .LinkAccountMode}}
|
||||
{{ctx.Locale.Tr "auth.oauth_signin_submit"}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "sign_in"}}
|
||||
{{end}}
|
||||
</button>
|
||||
<label>{{ctx.Locale.Tr "gpg.signin.nonce_label"}}</label>
|
||||
<div style="display: flex; gap: 6px;">
|
||||
<input id="token-field" type="text" readonly style="font-family: monospace; min-width: 0; flex: 1;">
|
||||
<button class="ui button" type="button" id="btn-copy-nonce">{{ctx.Locale.Tr "copy"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui info message">
|
||||
<p>{{ctx.Locale.Tr "gpg.signin.command_hint"}}</p>
|
||||
<div style="display: flex; gap: 6px;">
|
||||
<input id="sign-command" type="text" readonly
|
||||
style="font-family: monospace; min-width: 0; flex: 1;">
|
||||
<button class="ui button" type="button" id="btn-copy-cmd">{{ctx.Locale.Tr "copy"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="required field {{if .Err_GPGSign}}error{{end}}">
|
||||
<label for="gpg_signature">{{ctx.Locale.Tr "gpg.signin.signed_output"}}</label>
|
||||
<textarea id="gpg_signature" name="gpg_signature" rows="7"
|
||||
placeholder="-----BEGIN PGP SIGNED MESSAGE-----" style="font-family: monospace;"
|
||||
required>{{.gpg_signature}}</textarea>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<button class="ui primary button tw-w-full" type="submit">{{ctx.Locale.Tr "gpg.signin.submit"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
{{end}}{{/*end if .EnablePasswordSignInForm*/}}
|
||||
{{$showExternalAuthMethods := or .OAuth2Providers .EnableOpenIDSignIn .EnableSSPI}}
|
||||
{{if and $showExternalAuthMethods .EnablePasswordSignInForm}}
|
||||
<div class="divider divider-text">{{ctx.Locale.Tr "sign_in_or"}}</div>
|
||||
{{end}}
|
||||
{{if $showExternalAuthMethods}}
|
||||
{{template "user/auth/external_auth_methods" .}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if or .EnablePasskeyAuth .ShowRegistrationButton}}
|
||||
{{if .ShowRegistrationButton}}
|
||||
<div class="ui container fluid">
|
||||
<div class="ui attached segment header top tw-max-w-2xl tw-m-auto tw-flex tw-flex-col tw-items-center">
|
||||
{{if .EnablePasskeyAuth}}
|
||||
{{template "user/auth/webauthn_error" .}}
|
||||
<a class="signin-passkey">{{ctx.Locale.Tr "auth.signin_passkey"}}</a>
|
||||
{{end}}
|
||||
|
||||
{{if .ShowRegistrationButton}}
|
||||
<div class="field">
|
||||
<span>{{ctx.Locale.Tr "auth.need_account"}}</span>
|
||||
<a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now"}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="ui attached segment header top tw-flex tw-flex-col tw-items-center">
|
||||
<div class="field">
|
||||
<span>{{ctx.Locale.Tr "auth.need_account"}}</span>
|
||||
<a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now"}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@@ -1,70 +1,57 @@
|
||||
<div class="ui container fluid{{if .LinkAccountMode}} icon{{end}}">
|
||||
<div class="ui container fluid">
|
||||
<h4 class="ui top attached header center">
|
||||
{{if .LinkAccountMode}}
|
||||
{{ctx.Locale.Tr "auth.oauth_signup_title"}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "sign_up"}}
|
||||
{{end}}
|
||||
{{ctx.Locale.Tr "gpg.signup.title"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
{{if .IsFirstTimeRegistration}}
|
||||
<p>{{ctx.Locale.Tr "auth.sign_up_tip"}}</p>
|
||||
{{end}}
|
||||
<form class="ui form" action="{{.SignUpLink}}" method="post">
|
||||
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
|
||||
{{template "base/alert" .}}
|
||||
{{end}}
|
||||
{{if .DisableRegistration}}
|
||||
<p>{{ctx.Locale.Tr "auth.disable_register_prompt"}}</p>
|
||||
{{else}}
|
||||
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
|
||||
<label for="user_name">{{ctx.Locale.Tr "username"}}</label>
|
||||
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required>
|
||||
<form class="ui form" action="{{.SignUpLink}}" method="post" id="signup-form">
|
||||
{{.CsrfTokenHtml}}
|
||||
<input type="hidden" id="hidden-gpg-key" name="gpg_key">
|
||||
<input type="hidden" id="hidden-nonce" name="nonce">
|
||||
|
||||
<div id="step-key" {{if .Err_GPGSign}}style="display: none;"{{end}}>
|
||||
{{template "base/alert" .}}
|
||||
<div class="required field {{if .Err_GPGKey}}error{{end}}">
|
||||
<label>{{ctx.Locale.Tr "gpg.signup.paste_key"}}</label>
|
||||
<textarea id="gpg_key" rows="7" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----" style="font-family: monospace;" required>{{.gpg_key}}</textarea>
|
||||
</div>
|
||||
<div class="required field {{if .Err_Email}}error{{end}}">
|
||||
<label for="email">{{ctx.Locale.Tr "email"}}</label>
|
||||
<input id="email" name="email" type="email" value="{{.email}}" required>
|
||||
</div>
|
||||
|
||||
{{if not .DisablePassword}}
|
||||
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
|
||||
<label for="password">{{ctx.Locale.Tr "password"}}</label>
|
||||
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" required>
|
||||
</div>
|
||||
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
|
||||
<label for="retype">{{ctx.Locale.Tr "re_type"}}</label>
|
||||
<input id="retype" name="retype" type="password" value="{{.retype}}" autocomplete="new-password" required>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{template "user/auth/captcha" .}}
|
||||
|
||||
<div class="inline field">
|
||||
<button class="ui primary button tw-w-full">
|
||||
{{if .LinkAccountMode}}
|
||||
{{ctx.Locale.Tr "auth.oauth_signup_submit"}}
|
||||
{{else}}
|
||||
{{ctx.Locale.Tr "auth.create_new_account"}}
|
||||
{{end}}
|
||||
</button>
|
||||
<button class="ui primary button tw-w-full" type="button" id="btn-proceed">{{ctx.Locale.Tr "gpg.signup.proceed"}}</button>
|
||||
</div>
|
||||
{{end}}
|
||||
{{$showExternalAuthMethods := or .OAuth2Providers .EnableOpenIDSignIn .EnableSSPI}}
|
||||
{{if $showExternalAuthMethods}}
|
||||
<div class="divider divider-text">{{ctx.Locale.Tr "sign_in_or"}}</div>
|
||||
{{template "user/auth/external_auth_methods" .}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div id="step-sign" {{if not .Err_GPGSign}}style="display: none;"{{end}}>
|
||||
{{template "base/alert" .}}
|
||||
<div class="field">
|
||||
<label>{{ctx.Locale.Tr "gpg.signin.nonce_label"}}</label>
|
||||
<div style="display: flex; gap: 6px;">
|
||||
<input id="token-field" type="text" readonly style="font-family: monospace; min-width: 0; flex: 1;">
|
||||
<button class="ui button" type="button" id="btn-copy-nonce">{{ctx.Locale.Tr "copy"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui info message">
|
||||
<p>{{ctx.Locale.Tr "gpg.signin.command_hint"}}</p>
|
||||
<div style="display: flex; gap: 6px;">
|
||||
<input id="sign-command" type="text" readonly style="font-family: monospace; min-width: 0; flex: 1;">
|
||||
<button class="ui button" type="button" id="btn-copy-cmd">{{ctx.Locale.Tr "copy"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="required field {{if .Err_GPGSign}}error{{end}}">
|
||||
<label for="gpg_signature">{{ctx.Locale.Tr "gpg.signin.signed_output"}}</label>
|
||||
<textarea id="gpg_signature" name="gpg_signature" rows="7" placeholder="-----BEGIN PGP SIGNED MESSAGE-----" style="font-family: monospace;" required>{{.gpg_signature}}</textarea>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<button class="ui primary button tw-w-full" type="submit">{{ctx.Locale.Tr "gpg.signup.submit"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui container fluid">
|
||||
{{if not .LinkAccountMode}}
|
||||
<div class="ui attached segment header top tw-flex tw-flex-col tw-items-center">
|
||||
<div class="field">
|
||||
<span>{{ctx.Locale.Tr "auth.already_have_account"}}</span>
|
||||
<a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "auth.sign_in_now"}}</a>
|
||||
<span>{{ctx.Locale.Tr "gpg.signup.already_have_account"}}</span>
|
||||
<a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "gpg.signin.title"}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@@ -56,9 +56,9 @@
|
||||
</div>
|
||||
<div class="flex-text-block">
|
||||
{{if not .IsPrimary}}
|
||||
<button class="ui red tiny button link-action" data-modal-confirm="#delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete?id={{.ID}}">
|
||||
<!-- <button class="ui red tiny button delete-button" data-modal-id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}">
|
||||
{{ctx.Locale.Tr "settings.delete_email"}}
|
||||
</button>
|
||||
</button> m8sh automatically removes emails when related keys are removed -->
|
||||
{{if .CanBePrimary}}
|
||||
<form action="{{AppSubUrl}}/user/settings/account/email" method="post">
|
||||
<input name="_method" type="hidden" value="PRIMARY">
|
||||
@@ -74,7 +74,7 @@
|
||||
{{if $.ActivationsPending}}
|
||||
<button disabled class="ui primary tiny button">{{ctx.Locale.Tr "settings.activations_pending"}}</button>
|
||||
{{else}}
|
||||
<button class="ui primary tiny button">{{ctx.Locale.Tr "settings.activate_email"}}</button>
|
||||
<!-- <button class="ui primary tiny button">{{ctx.Locale.Tr "settings.activate_email"}}</button> -->
|
||||
{{end}}
|
||||
</form>
|
||||
{{end}}
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if not ($.UserDisabledFeatures.Contains "manage_credentials")}}
|
||||
<!-- {{if not ($.UserDisabledFeatures.Contains "manage_credentials")}}
|
||||
<div class="ui bottom attached segment">
|
||||
<form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post">
|
||||
<div class="required field {{if .Err_Email}}error{{end}}">
|
||||
@@ -102,7 +102,7 @@
|
||||
<div class="ui warning message">{{ctx.Locale.Tr "settings.can_not_add_email_activations_pending"}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}} in m8sh emails added via GPG keys, containing them -->
|
||||
|
||||
{{if not ($.UserDisabledFeatures.Contains "deletion")}}
|
||||
<h4 class="ui top attached error header">
|
||||
|
||||
@@ -86,10 +86,10 @@
|
||||
</details>
|
||||
</div>
|
||||
|
||||
{{if .EnableOAuth2}}
|
||||
<!-- {{if .EnableOAuth2}}
|
||||
{{template "user/settings/grants_oauth2" .}}
|
||||
{{template "user/settings/applications_oauth2" .}}
|
||||
{{end}}
|
||||
{{end}} OAuth disabled in m8sh... -->
|
||||
</div>
|
||||
|
||||
<div class="ui small modal" id="delete-token">
|
||||
|
||||
@@ -1,6 +1 @@
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "settings.manage_oauth2_applications"}}
|
||||
</h4>
|
||||
|
||||
{{template "user/settings/applications_oauth2_list" .}}
|
||||
|
||||
{{/* OAuth disabled */}}
|
||||
|
||||
@@ -1,57 +1 @@
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "settings.edit_oauth2_application"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<p>{{ctx.Locale.Tr "settings.oauth2_application_create_description"}}</p>
|
||||
</div>
|
||||
<div class="ui attached segment form ignore-dirty">
|
||||
<div class="field">
|
||||
<label for="client-id">{{ctx.Locale.Tr "settings.oauth2_client_id"}}</label>
|
||||
<input id="client-id" readonly value="{{.App.ClientID}}">
|
||||
</div>
|
||||
{{if .ClientSecret}}
|
||||
<div class="field">
|
||||
<label for="client-secret">{{ctx.Locale.Tr "settings.oauth2_client_secret"}}</label>
|
||||
<input id="client-secret" type="text" readonly value="{{.ClientSecret}}">
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="field">
|
||||
<label for="client-secret">{{ctx.Locale.Tr "settings.oauth2_client_secret"}}</label>
|
||||
<input id="client-secret" type="password" readonly value="averysecuresecret">
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="item">
|
||||
<!-- TODO add regenerate secret functionality */ -->
|
||||
<form class="ui form ignore-dirty" action="{{.FormActionPath}}/regenerate_secret" method="post">
|
||||
{{ctx.Locale.Tr "settings.oauth2_regenerate_secret_hint"}}
|
||||
<button class="ui mini button tw-ml-2" type="submit">{{ctx.Locale.Tr "settings.oauth2_regenerate_secret"}}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui bottom attached segment">
|
||||
<form class="ui form ignore-dirty" action="{{.FormActionPath}}" method="post">
|
||||
<div class="field {{if .Err_AppName}}error{{end}}">
|
||||
<label for="application-name">{{ctx.Locale.Tr "settings.oauth2_application_name"}}</label>
|
||||
<input id="application-name" value="{{.App.Name}}" name="application_name" required maxlength="255">
|
||||
</div>
|
||||
<div class="field {{if .Err_RedirectURI}}error{{end}}">
|
||||
<label for="redirect-uris">{{ctx.Locale.Tr "settings.oauth2_redirect_uris"}}</label>
|
||||
<textarea name="redirect_uris" id="redirect-uris" required>{{StringUtils.Join .App.RedirectURIs "\n"}}</textarea>
|
||||
</div>
|
||||
<div class="field {{if .Err_ConfidentialClient}}error{{end}}">
|
||||
<div class="ui checkbox">
|
||||
<label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label>
|
||||
<input class="disable-setting" type="checkbox" name="confidential_client" data-target="#skip-secondary-authorization" {{if .App.ConfidentialClient}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field {{if .Err_SkipSecondaryAuthorization}}error{{end}} {{if .App.ConfidentialClient}}disabled{{end}}" id="skip-secondary-authorization">
|
||||
<div class="ui checkbox">
|
||||
<label>{{ctx.Locale.Tr "settings.oauth2_skip_secondary_authorization"}}</label>
|
||||
<input type="checkbox" name="skip_secondary_authorization" {{if .App.SkipSecondaryAuthorization}}checked{{end}}>
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui primary button">
|
||||
{{ctx.Locale.Tr "settings.save_application"}}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{{/* OAuth disabled */}}
|
||||
|
||||
@@ -1,79 +1 @@
|
||||
<div class="ui attached segment">
|
||||
<div class="flex-divided-list items-with-main">
|
||||
<div class="item">
|
||||
{{ctx.Locale.Tr "settings.oauth2_application_create_description"}}
|
||||
</div>
|
||||
{{range .Applications}}
|
||||
<div class="item tw-items-center">
|
||||
<div class="item-leading">
|
||||
{{svg "octicon-apps" 32}}
|
||||
</div>
|
||||
<div class="item-main">
|
||||
<div class="item-title">{{.Name}}</div>
|
||||
<div class="item-body">
|
||||
{{ctx.Locale.Tr "settings.oauth2_client_id"}}
|
||||
<span class="ui label">{{.ClientID}}</span>
|
||||
</div>
|
||||
</div>
|
||||
{{$isBuiltin := and $.BuiltinApplications (index $.BuiltinApplications .ClientID)}}
|
||||
<div class="item-trailing">
|
||||
{{if $isBuiltin}}
|
||||
<span class="ui basic label" data-tooltip-content="{{ctx.Locale.Tr "settings.oauth2_application_locked"}}">{{ctx.Locale.Tr "locked"}}</span>
|
||||
{{else}}
|
||||
<a href="{{$.Link}}/oauth2/{{.ID}}" class="ui primary tiny button">
|
||||
{{svg "octicon-pencil"}}
|
||||
{{ctx.Locale.Tr "settings.oauth2_application_edit"}}
|
||||
</a>
|
||||
<button class="ui red tiny button link-action" data-modal-confirm="#remove-gitea-oauth2-application"
|
||||
data-url="{{$.Link}}/oauth2/{{.ID}}/delete">
|
||||
{{svg "octicon-trash"}}
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="ui small modal" id="remove-gitea-oauth2-application">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
{{ctx.Locale.Tr "settings.remove_oauth2_application"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{ctx.Locale.Tr "settings.oauth2_application_remove_description"}}</p>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ui bottom attached segment">
|
||||
<details {{if .application_name}}open{{end}}>
|
||||
<summary><h4 class="ui header tw-inline-block tw-my-2">{{ctx.Locale.Tr "settings.create_oauth2_application"}}</h4></summary>
|
||||
<form class="ui form ignore-dirty" action="{{.Link}}/oauth2" method="post">
|
||||
<div class="field {{if .Err_AppName}}error{{end}}">
|
||||
<label for="application-name">{{ctx.Locale.Tr "settings.oauth2_application_name"}}</label>
|
||||
<input id="application-name" name="application_name" value="{{.application_name}}" required maxlength="255">
|
||||
</div>
|
||||
<div class="field {{if .Err_RedirectURI}}error{{end}}">
|
||||
<label for="redirect-uris">{{ctx.Locale.Tr "settings.oauth2_redirect_uris"}}</label>
|
||||
<textarea name="redirect_uris" id="redirect-uris"></textarea>
|
||||
</div>
|
||||
<div class="field {{if .Err_ConfidentialClient}}error{{end}}">
|
||||
<div class="ui checkbox">
|
||||
<label>{{ctx.Locale.Tr "settings.oauth2_confidential_client"}}</label>
|
||||
<input class="disable-setting" type="checkbox" name="confidential_client" data-target="#skip-secondary-authorization" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field {{if .Err_SkipSecondaryAuthorization}}error{{end}} disabled" id="skip-secondary-authorization">
|
||||
<div class="ui checkbox">
|
||||
<label>{{ctx.Locale.Tr "settings.oauth2_skip_secondary_authorization"}}</label>
|
||||
<input type="checkbox" name="skip_secondary_authorization">
|
||||
</div>
|
||||
</div>
|
||||
<button class="ui primary button">
|
||||
{{ctx.Locale.Tr "settings.create_oauth2_application_button"}}
|
||||
</button>
|
||||
</form>
|
||||
</details>
|
||||
</div>
|
||||
{{/* OAuth2 applications completely disabled in m8sh */}}
|
||||
|
||||
@@ -1,40 +1 @@
|
||||
<h4 class="ui top attached header">
|
||||
{{ctx.Locale.Tr "settings.authorized_oauth2_applications"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<div class="flex-divided-list items-with-main">
|
||||
<div class="item">
|
||||
{{ctx.Locale.Tr "settings.authorized_oauth2_applications_description"}}
|
||||
</div>
|
||||
{{range .Grants}}
|
||||
<div class="item">
|
||||
<div class="item-leading">
|
||||
{{svg "octicon-key" 32}}
|
||||
</div>
|
||||
<div class="item-main">
|
||||
<div class="item-title">{{.Application.Name}}</div>
|
||||
<div class="item-body">
|
||||
<i>{{ctx.Locale.Tr "settings.added_on" (DateUtils.AbsoluteShort .CreatedUnix)}}</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-trailing">
|
||||
<button class="ui red tiny button link-action" data-modal-confirm="#revoke-gitea-oauth2-grant"
|
||||
data-url="{{AppSubUrl}}/user/settings/applications/oauth2/{{.ApplicationID}}/revoke/{{.ID}}">
|
||||
{{ctx.Locale.Tr "settings.revoke_key"}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="ui small modal" id="revoke-gitea-oauth2-grant">
|
||||
<div class="header">
|
||||
{{svg "octicon-shield" 16 "tw-mr-1"}}
|
||||
{{ctx.Locale.Tr "settings.revoke_oauth2_grant"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{ctx.Locale.Tr "settings.revoke_oauth2_grant_description"}}</p>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
</div>
|
||||
{{/* OAuth2 grants completely disabled in m8sh (GPG auth only) */}}
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<div class="{{if not .HasGPGError}}tw-hidden{{end}} tw-mb-4" id="add-gpg-key-panel">
|
||||
<form class="ui form{{if .HasGPGError}} error{{end}}" action="{{.Link}}" method="post">
|
||||
<form class="ui form{{if .HasGPGError}} error{{end}}" id="add-key-form" action="{{.Link}}" method="post">
|
||||
<input type="hidden" name="title" value="none">
|
||||
<input type="hidden" id="add-key-hidden-nonce" name="nonce">
|
||||
<div class="field {{if .Err_Content}}error{{end}}">
|
||||
<label for="gpg-key-content">{{ctx.Locale.Tr "settings.key_content"}}</label>
|
||||
<textarea id="gpg-key-content" name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_gpg_placeholder"}}" required>{{.content}}</textarea>
|
||||
@@ -17,16 +18,19 @@
|
||||
<p>{{ctx.Locale.Tr "settings.gpg_token_required"}}</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="token">{{ctx.Locale.Tr "settings.gpg_token"}}</label>
|
||||
<input readonly="" value="{{.TokenToSign}}">
|
||||
<div class="help">
|
||||
{{ctx.Locale.Tr "settings.gpg_token_help"}}
|
||||
<pre class="command-block">{{printf `echo "%s" | gpg -a --default-key %s --detach-sig` .TokenToSign .PaddedKeyID}}</pre>
|
||||
<label>{{ctx.Locale.Tr "settings.gpg_token"}}</label>
|
||||
<input id="add-key-token-field" type="text" readonly style="font-family: monospace;">
|
||||
</div>
|
||||
<div class="ui info message">
|
||||
<p>{{ctx.Locale.Tr "settings.gpg_token_help"}}</p>
|
||||
<div style="display: flex; gap: 6px;">
|
||||
<input id="add-key-sign-command" type="text" readonly style="font-family: monospace; min-width: 0; flex: 1;">
|
||||
<button class="ui button" type="button" id="add-key-btn-copy-cmd">{{ctx.Locale.Tr "copy"}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="gpg-key-signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label>
|
||||
<textarea id="gpg-key-signature" name="signature" placeholder="{{ctx.Locale.Tr "settings.key_signature_gpg_placeholder"}}" required>{{.signature}}</textarea>
|
||||
<textarea id="gpg-key-signature" name="signature" placeholder="-----BEGIN PGP SIGNATURE-----" style="font-family: monospace;" required>{{.signature}}</textarea>
|
||||
</div>
|
||||
{{end}}
|
||||
<input name="type" type="hidden" value="gpg">
|
||||
@@ -68,9 +72,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-trailing">
|
||||
<button class="ui red tiny button link-action" data-modal-confirm="#delete-gpg" data-url="{{$.Link}}/delete?type=gpg&id={{.ID}}">
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
</button>
|
||||
{{if gt (len $.GPGKeys) 1}}
|
||||
<button class="ui red tiny button delete-button" data-modal-id="delete-gpg" data-url="{{$.Link}}/delete?type=gpg" data-id="{{.ID}}">
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
</button>
|
||||
{{else}}
|
||||
<button class="ui red tiny button disabled" disabled title="{{ctx.Locale.Tr "settings.gpg_last_key_delete"}}">
|
||||
{{ctx.Locale.Tr "settings.delete_key"}}
|
||||
</button>
|
||||
{{end}}
|
||||
{{if and (not .Verified) (ne $.VerifyingID .KeyID)}}
|
||||
<a class="ui primary tiny button" href="?verify_gpg={{.KeyID}}">{{ctx.Locale.Tr "settings.gpg_key_verify"}}</a>
|
||||
{{end}}
|
||||
@@ -79,22 +89,25 @@
|
||||
{{if and (not .Verified) (eq $.VerifyingID .KeyID)}}
|
||||
<div class="ui segment">
|
||||
<h4>{{ctx.Locale.Tr "settings.gpg_token_required"}}</h4>
|
||||
<form class="ui form{{if $.HasGPGVerifyError}} error{{end}}" action="{{$.Link}}" method="post">
|
||||
<form class="ui form{{if $.HasGPGVerifyError}} error{{end}}" id="verify-key-form" data-key-id="{{.PaddedKeyID}}" action="{{$.Link}}" method="post">
|
||||
<input type="hidden" name="title" value="none">
|
||||
<input type="hidden" name="content" value="{{.KeyID}}">
|
||||
<input type="hidden" name="key_id" value="{{.KeyID}}">
|
||||
<input type="hidden" id="verify-key-hidden-nonce" name="nonce">
|
||||
<div class="field">
|
||||
<label for="token">{{ctx.Locale.Tr "settings.gpg_token"}}</label>
|
||||
<input readonly="" value="{{$.TokenToSign}}">
|
||||
<div class="help">
|
||||
{{ctx.Locale.Tr "settings.gpg_token_help"}}
|
||||
<pre class="command-block">{{printf `echo "%s" | gpg -a --default-key %s --detach-sig` $.TokenToSign .PaddedKeyID}}</pre>
|
||||
<label>{{ctx.Locale.Tr "settings.gpg_token"}}</label>
|
||||
<input id="verify-key-token-field" type="text" readonly style="font-family: monospace;">
|
||||
</div>
|
||||
<div class="ui info message">
|
||||
<p>{{ctx.Locale.Tr "settings.gpg_token_help"}}</p>
|
||||
<div style="display: flex; gap: 6px;">
|
||||
<input id="verify-key-sign-command" type="text" readonly style="font-family: monospace; min-width: 0; flex: 1;">
|
||||
<button class="ui button" type="button" id="verify-key-btn-copy-cmd">{{ctx.Locale.Tr "copy"}}</button>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label>
|
||||
<textarea id="gpg-key-signature" name="signature" placeholder="{{ctx.Locale.Tr "settings.key_signature_gpg_placeholder"}}" required>{{$.signature}}</textarea>
|
||||
<label for="gpg-key-signature">{{ctx.Locale.Tr "settings.gpg_token_signature"}}</label>
|
||||
<textarea id="gpg-key-signature" name="signature" placeholder="-----BEGIN PGP SIGNATURE-----" style="font-family: monospace;" required>{{$.signature}}</textarea>
|
||||
</div>
|
||||
<input name="type" type="hidden" value="verify_gpg">
|
||||
<button class="ui primary button">
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
{{ctx.Locale.Tr "settings.profile"}}
|
||||
</a>
|
||||
{{if not ($.UserDisabledFeatures.Contains "manage_credentials" "deletion")}}
|
||||
<a class="{{if .PageIsSettingsAccount}}active {{end}}item" href="{{AppSubUrl}}/user/settings/account">
|
||||
<!-- <a class="{{if .PageIsSettingsAccount}}active {{end}}item" href="{{AppSubUrl}}/user/settings/account">
|
||||
{{ctx.Locale.Tr "settings.account"}}
|
||||
</a>
|
||||
</a> m8sh doesn't support email changes/other account related actions except deletion -->
|
||||
{{end}}
|
||||
{{if $.EnableNotifyMail}}
|
||||
<a class="{{if .PageIsSettingsNotifications}}active {{end}}item" href="{{AppSubUrl}}/user/settings/notifications">
|
||||
@@ -17,11 +17,11 @@
|
||||
<a class="{{if .PageIsSettingsAppearance}}active {{end}}item" href="{{AppSubUrl}}/user/settings/appearance">
|
||||
{{ctx.Locale.Tr "settings.appearance"}}
|
||||
</a>
|
||||
{{if not ($.UserDisabledFeatures.Contains "manage_mfa" "manage_credentials")}}
|
||||
<!-- {{if not ($.UserDisabledFeatures.Contains "manage_mfa" "manage_credentials")}}
|
||||
<a class="{{if .PageIsSettingsSecurity}}active {{end}}item" href="{{AppSubUrl}}/user/settings/security">
|
||||
{{ctx.Locale.Tr "settings.security"}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}} m8sh has GPG security by default -->
|
||||
<a class="{{if .PageIsSettingsBlockedUsers}}active {{end}}item" href="{{AppSubUrl}}/user/settings/blocked_users">
|
||||
{{ctx.Locale.Tr "user.block.list"}}
|
||||
</a>
|
||||
|
||||
@@ -6,22 +6,13 @@
|
||||
<div class="ui attached segment">
|
||||
<p>{{ctx.Locale.Tr "settings.profile_desc"}}</p>
|
||||
<form class="ui form" action="{{.Link}}" method="post">
|
||||
<div class="required field {{if .Err_Name}}error{{end}}">
|
||||
<label for="username">{{ctx.Locale.Tr "username"}}
|
||||
<span class="tw-text-red tw-hidden" id="name-change-prompt"> {{ctx.Locale.Tr "settings.change_username_prompt"}}</span>
|
||||
<span class="tw-text-red tw-hidden" id="name-change-redirect-prompt"> {{ctx.Locale.Tr "settings.change_username_redirect_prompt"}}</span>
|
||||
</label>
|
||||
<input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" required {{if or (not .SignedUser.IsLocal) ($.UserDisabledFeatures.Contains "change_username") .IsReverseProxy}}disabled{{end}} maxlength="40">
|
||||
{{if or (not .SignedUser.IsLocal) ($.UserDisabledFeatures.Contains "change_username") .IsReverseProxy}}
|
||||
<p class="help tw-text-blue">{{ctx.Locale.Tr "settings.password_username_disabled"}}</p>
|
||||
{{end}}
|
||||
<div class="required field">
|
||||
<label for="username">{{ctx.Locale.Tr "username"}}</label>
|
||||
<input id="username" name="name" value="{{.SignedUser.Name}}" disabled maxlength="40">
|
||||
</div>
|
||||
<div class="field {{if .Err_FullName}}error{{end}}">
|
||||
<label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label>
|
||||
<input id="full_name" name="full_name" value="{{.SignedUser.FullName}}" {{if ($.UserDisabledFeatures.Contains "change_full_name")}}disabled{{end}} maxlength="100">
|
||||
{{if ($.UserDisabledFeatures.Contains "change_full_name")}}
|
||||
<p class="help tw-text-blue">{{ctx.Locale.Tr "settings.password_full_name_disabled"}}</p>
|
||||
{{end}}
|
||||
<input id="full_name" name="full_name" value="{{.SignedUser.FullName}}" maxlength="100">
|
||||
</div>
|
||||
<div class="field {{if .Err_Email}}error{{end}}">
|
||||
<label>{{ctx.Locale.Tr "email"}}</label>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
@import "./explore.css";
|
||||
@import "./review.css";
|
||||
@import "./actions.css";
|
||||
@import "./mail.css";
|
||||
|
||||
@import "./helpers.css";
|
||||
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
/* Copyright 2026 The M8SH Authors. */
|
||||
/* SPDX-License-Identifier: GPL-3.0 */
|
||||
|
||||
/* The mail page fills the viewport below the navbar and above the footer.
|
||||
The body is a flex column: [navbar wrapper .full.height] then [footer].
|
||||
.full.height has flex-grow:1, so it already fills everything except the footer.
|
||||
We make it a flex container so the mail page can flex:1 within it, sitting below the navbar. */
|
||||
|
||||
/* When the mail page is active, make .full.height a column flex container so
|
||||
the navbar stays fixed at top and the mail page fills the remaining height. */
|
||||
.full.height:has(.mail-page) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
padding-bottom: 0; /* mail manages its own bottom spacing */
|
||||
}
|
||||
|
||||
.page-content.mail-page {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.page-content.mail-page > #mail-app {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* On mobile, hide the footer so the mail app uses the full viewport height. */
|
||||
@media (max-width: 639.98px) {
|
||||
.full.height:has(.mail-page) ~ .page-footer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* In-thread search highlight. Global (not scoped) because it must reach
|
||||
<mark> nodes produced via v-html inside bubbles and html cards. */
|
||||
#mail-app mark.search-hit {
|
||||
background: var(--color-highlight-bg);
|
||||
color: var(--color-text);
|
||||
border-radius: 2px;
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
#mail-app mark.search-hit.current {
|
||||
outline: 1px solid var(--color-highlight-fg);
|
||||
}
|
||||
|
||||
/* Thread context menu. It is teleported to <body> (outside the Vue scoped
|
||||
component subtree), so its styles live here, unscoped. */
|
||||
body > .ctx-menu {
|
||||
position: fixed;
|
||||
z-index: 1002;
|
||||
min-width: 140px;
|
||||
background: var(--color-menu);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
body > .ctx-menu .ctx-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text);
|
||||
font-size: 13px;
|
||||
padding: 7px 10px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
body > .ctx-menu .ctx-item:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
body > .ctx-menu .ctx-item.danger:hover {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
/* Delete conversation confirmation dialog (teleported, so unscoped). */
|
||||
body > .confirm-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1003;
|
||||
background: var(--color-overlay-backdrop);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-modal {
|
||||
width: 100%;
|
||||
max-width: 360px;
|
||||
background: var(--color-menu);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: var(--border-radius-full);
|
||||
background: var(--color-red-badge-bg);
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-title {
|
||||
font-size: 15px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-desc {
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
color: var(--color-text-light-2);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-cancel {
|
||||
flex: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
background: var(--color-body);
|
||||
color: var(--color-text);
|
||||
font-size: 13px;
|
||||
padding: 8px 12px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
cursor: pointer;
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-cancel:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-delete {
|
||||
flex: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
border: none;
|
||||
background: var(--color-danger);
|
||||
color: var(--color-white);
|
||||
font-size: 13px;
|
||||
padding: 8px 12px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
cursor: pointer;
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
body > .confirm-overlay .confirm-delete:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Block toggle row: a right-aligned chevron that flips up when expanded. */
|
||||
body > .ctx-menu .ctx-toggle .ctx-chev {
|
||||
margin-left: auto;
|
||||
color: var(--color-text-light-2);
|
||||
transition: transform 0.12s ease;
|
||||
}
|
||||
body > .ctx-menu .ctx-toggle .ctx-chev.up {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* Expandable Block panel: its option buttons go edge-to-edge on hover so the
|
||||
whole row is the target, not just the centered label. */
|
||||
body > .ctx-menu .ctx-expand {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
padding-top: 2px;
|
||||
border-top: 0.5px solid var(--color-secondary-alpha-30);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
body > .ctx-menu .ctx-expand .ctx-opt {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
padding-left: 10px; /* flush with the other menu items' text, no icon column */
|
||||
}
|
||||
body > .ctx-menu .ctx-expand .ctx-opt:hover {
|
||||
width: 100%;
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
/* Rename group dialog input */
|
||||
body > .confirm-overlay .rename-input {
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 8px 10px;
|
||||
outline: none;
|
||||
}
|
||||
body > .confirm-overlay .rename-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
body > .confirm-overlay .rename-modal {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/* Mobile overflow menu: transparent full-screen click catcher with the menu
|
||||
positioned in the top-right corner, just like the context menu (no darkening). */
|
||||
body > .overflow-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1002;
|
||||
}
|
||||
|
||||
body > .overflow-backdrop .overflow-menu {
|
||||
position: absolute;
|
||||
top: 56px;
|
||||
right: 8px;
|
||||
min-width: 160px;
|
||||
background: var(--color-menu);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
body > .overflow-backdrop .ctx-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text);
|
||||
font-size: 13px;
|
||||
padding: 7px 10px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
body > .overflow-backdrop .ctx-item:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
body > .overflow-backdrop .ctx-item.danger:hover {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
|
||||
/* Audio player buttons: instant hover, no delay (overrides all inherited transitions) */
|
||||
#mail-app .audio-player a.ap-btn,
|
||||
#mail-app .audio-player button.ap-btn,
|
||||
#mail-app .audio-player a.ap-download,
|
||||
#mail-app .audio-player .ap-download,
|
||||
#mail-app .audio-player .ap-close,
|
||||
#mail-app .audio-player .ap-btn,
|
||||
#mail-app .audio-player .ap-btn:hover {
|
||||
transition: none !important;
|
||||
transition-property: none !important;
|
||||
transition-duration: 0s !important;
|
||||
transition-delay: 0s !important;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export function makeNonce(): string {
|
||||
const ts = Math.floor(Date.now() / 1000).toString(16).padStart(8, '0');
|
||||
|
||||
const arr = new Uint8Array(24);
|
||||
crypto.getRandomValues(arr);
|
||||
const randomHex = Array.from(arr, (b) => b.toString(16).padStart(2, '0')).join('');
|
||||
|
||||
return `${ts}:${window.location.host}:${randomHex}`;
|
||||
}
|
||||
|
||||
export function buildSignCommand(nonce: string, keyID?: string): string {
|
||||
if (keyID) return `echo "${nonce}" | gpg -a --default-key ${keyID} --detach-sig`;
|
||||
return `echo "${nonce}" | gpg -a --detach-sig`;
|
||||
}
|
||||
|
||||
export function validateSignature(sig: string): boolean {
|
||||
return sig.startsWith('-----BEGIN PGP SIGNED MESSAGE-----') ||
|
||||
sig.startsWith('-----BEGIN PGP SIGNATURE-----');
|
||||
}
|
||||
@@ -27,14 +27,12 @@ function initPreInstall() {
|
||||
const dbUser = document.querySelector<HTMLInputElement>('#db_user')!;
|
||||
const dbName = document.querySelector<HTMLInputElement>('#db_name')!;
|
||||
|
||||
// Database type change detection.
|
||||
document.querySelector<HTMLInputElement>('#db_type')!.addEventListener('change', function () {
|
||||
const dbType = this.value;
|
||||
hideElem('div[data-db-setting-for]');
|
||||
showElem(`div[data-db-setting-for=${dbType}]`);
|
||||
|
||||
if (dbType !== 'sqlite3') {
|
||||
// for most remote database servers
|
||||
showElem('div[data-db-setting-for=common-host]');
|
||||
const lastDbHost = dbHost.value;
|
||||
const isDbHostDefault = !lastDbHost || Object.values(defaultDbHosts).includes(lastDbHost);
|
||||
@@ -45,7 +43,7 @@ function initPreInstall() {
|
||||
dbUser.value = defaultDbUser;
|
||||
dbName.value = defaultDbName;
|
||||
}
|
||||
} // else: for SQLite3, the default path is always prepared by backend code (setting)
|
||||
}
|
||||
});
|
||||
document.querySelector('#db_type')!.dispatchEvent(new Event('change'));
|
||||
|
||||
@@ -59,28 +57,8 @@ function initPreInstall() {
|
||||
domain.value = window.location.hostname;
|
||||
}
|
||||
|
||||
// TODO: better handling of exclusive relations.
|
||||
document.querySelector<HTMLInputElement>('#enable-openid-signin input')!.addEventListener('change', function () {
|
||||
if (this.checked) {
|
||||
if (!document.querySelector<HTMLInputElement>('#disable-registration input')!.checked) {
|
||||
document.querySelector<HTMLInputElement>('#enable-openid-signup input')!.checked = true;
|
||||
}
|
||||
} else {
|
||||
document.querySelector<HTMLInputElement>('#enable-openid-signup input')!.checked = false;
|
||||
}
|
||||
});
|
||||
document.querySelector<HTMLInputElement>('#disable-registration input')!.addEventListener('change', function () {
|
||||
if (this.checked) {
|
||||
document.querySelector<HTMLInputElement>('#enable-captcha input')!.checked = false;
|
||||
document.querySelector<HTMLInputElement>('#enable-openid-signup input')!.checked = false;
|
||||
} else {
|
||||
document.querySelector<HTMLInputElement>('#enable-openid-signup input')!.checked = true;
|
||||
}
|
||||
});
|
||||
document.querySelector<HTMLInputElement>('#enable-captcha input')!.addEventListener('change', function () {
|
||||
if (this.checked) {
|
||||
document.querySelector<HTMLInputElement>('#disable-registration input')!.checked = false;
|
||||
}
|
||||
document.querySelector<HTMLInputElement>('#enable-captcha input')?.addEventListener('change', () => {
|
||||
// captcha toggle logic if needed
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, ref, computed, onMounted, onBeforeUnmount} from 'vue';
|
||||
import {SvgIcon} from '../../svg.ts';
|
||||
import {cloneMock, domainOf, type Attachment, type BlockEntry, type BlockScope, type Message, type ForwardedContent, type Thread} from './types.ts';
|
||||
import {otherParticipant} from './threadTitle.ts';
|
||||
import ThreadList from './components/ThreadList.vue';
|
||||
import ChatPane from './components/ChatPane.vue';
|
||||
import ComposePanel from './components/ComposePanel.vue';
|
||||
|
||||
// Root component: holds the in-memory thread store, the responsive two-column
|
||||
// layout (full-screen list / chat on mobile), and wires all child events.
|
||||
export default defineComponent({
|
||||
name: 'MailApp',
|
||||
components: {SvgIcon, ThreadList, ChatPane, ComposePanel},
|
||||
setup() {
|
||||
// All session state lives in memory only; no localStorage/cookies.
|
||||
const threads = ref<Thread[]>(cloneMock());
|
||||
const activeId = ref<string>('');
|
||||
const view = ref<'list' | 'chat'>('list'); // mobile navigation toggle
|
||||
const searchQuery = ref('');
|
||||
const composeOpen = ref(false);
|
||||
|
||||
// Block list (in-memory, mock-only). Stored as a reactive array of entries.
|
||||
const blocked = ref<BlockEntry[]>([]);
|
||||
|
||||
const isMobile = ref(false);
|
||||
function updateMobile() {
|
||||
isMobile.value = window.innerWidth < 640;
|
||||
}
|
||||
updateMobile();
|
||||
|
||||
const activeThread = computed(() => threads.value.find((t) => t.id === activeId.value) ?? null);
|
||||
|
||||
// blockEntryForEmail reports whether an email is blocked, either by exact
|
||||
// address ('user') or by domain ('domain'). Returns the entry or undefined.
|
||||
function blockEntryForEmail(email: string): BlockEntry | undefined {
|
||||
const lower = email.toLowerCase();
|
||||
const dom = domainOf(email);
|
||||
return blocked.value.find((b) => {
|
||||
if (b.scope === 'user') return b.email.toLowerCase() === lower;
|
||||
return b.scope === 'domain' && b.email.toLowerCase() === dom;
|
||||
});
|
||||
}
|
||||
|
||||
function isThreadBlocked(t: Thread): boolean {
|
||||
if (t.isGroup) return false;
|
||||
return !!blockEntryForEmail(otherParticipant(t).email);
|
||||
}
|
||||
|
||||
// blockScopeOf returns the active block scope for a thread's participant,
|
||||
// or null when not blocked. Used to show "Blocked" vs "Blocked (domain)".
|
||||
function blockScopeOf(t: Thread): BlockScope | null {
|
||||
if (t.isGroup) return null;
|
||||
const entry = blockEntryForEmail(otherParticipant(t).email);
|
||||
return entry ? entry.scope : null;
|
||||
}
|
||||
|
||||
function selectThread(id: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (!t) return;
|
||||
activeId.value = id;
|
||||
t.unread = false;
|
||||
if (isMobile.value) view.value = 'chat';
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
view.value = 'list';
|
||||
}
|
||||
|
||||
function togglePin(id: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (t) t.pinned = !t.pinned;
|
||||
}
|
||||
|
||||
function markUnread(id: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (t) t.unread = true;
|
||||
}
|
||||
|
||||
function deleteThread(id: string) {
|
||||
const idx = threads.value.findIndex((x) => x.id === id);
|
||||
if (idx < 0) return;
|
||||
threads.value.splice(idx, 1);
|
||||
if (activeId.value === id) {
|
||||
activeId.value = '';
|
||||
if (isMobile.value) view.value = 'list';
|
||||
}
|
||||
}
|
||||
|
||||
// blockThread adds a block entry; optionally deletes the conversation and any
|
||||
// other conversation sharing the blocked user/domain.
|
||||
function blockThread(id: string, scope: BlockScope, alsoDelete: boolean) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (!t || t.isGroup) return;
|
||||
const other = otherParticipant(t);
|
||||
const key = scope === 'domain' ? domainOf(other.email) : other.email;
|
||||
if (!key) return;
|
||||
if (!blocked.value.some((b) => b.scope === scope && b.email === key)) {
|
||||
blocked.value.push({email: key, scope});
|
||||
}
|
||||
if (alsoDelete) {
|
||||
// remove all DM threads whose other participant is now blocked
|
||||
const surviving: Thread[] = [];
|
||||
for (const th of threads.value) {
|
||||
if (th.isGroup) { surviving.push(th); continue; }
|
||||
if (blockEntryForEmail(otherParticipant(th).email)) continue;
|
||||
surviving.push(th);
|
||||
}
|
||||
threads.value = surviving;
|
||||
if (activeId.value && !threads.value.some((x) => x.id === activeId.value)) {
|
||||
activeId.value = '';
|
||||
if (isMobile.value) view.value = 'list';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unblockThread removes both user- and domain-level entries matching the
|
||||
// thread's other participant, so the "Blocked" indicator clears.
|
||||
function unblockThread(id: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (!t || t.isGroup) return;
|
||||
const other = otherParticipant(t);
|
||||
const dom = domainOf(other.email);
|
||||
blocked.value = blocked.value.filter((b) => {
|
||||
if (b.scope === 'user') return b.email.toLowerCase() !== other.email.toLowerCase();
|
||||
return b.email.toLowerCase() !== dom;
|
||||
});
|
||||
}
|
||||
|
||||
// onForward appends forwarded messages to a target thread. When multiple
|
||||
// messages are selected they are merged into a SINGLE forwarded message:
|
||||
// each source becomes a nested ForwardedContent layer (in selection order),
|
||||
// so the target receives one envelope whose `forwarded` chain contains all
|
||||
// of them. An optional note becomes the envelope's body text. The forwarder
|
||||
// is the current user (self).
|
||||
function onForward(targetId: string, msgs: Message[], note?: string) {
|
||||
const target = threads.value.find((x) => x.id === targetId);
|
||||
if (!target) return;
|
||||
const self = target.participants.find((p) => p.self) ?? {email: 'd@m8sh.su', name: 'Danila', self: true};
|
||||
|
||||
// Build forwarded content for each selected message. When multiple
|
||||
// messages are selected they become SIBLINGS in a `quotes` array (flat,
|
||||
// same-level group) rather than a deep nested chain. A single forward
|
||||
// still uses `forwarded` for backward compatibility.
|
||||
const quotes: ForwardedContent[] = msgs.map((m) => ({
|
||||
from: m.sender,
|
||||
subject: m.subject,
|
||||
body: m.body,
|
||||
timestamp: m.timestamp,
|
||||
forwarded: m.forwarded,
|
||||
}));
|
||||
|
||||
const envelope: {forwarded?: ForwardedContent; quotes?: ForwardedContent[]} = {};
|
||||
if (quotes.length === 1) envelope.forwarded = quotes[0];
|
||||
else if (quotes.length > 1) envelope.quotes = quotes;
|
||||
|
||||
target.messages.push({
|
||||
id: 'fwd-' + Date.now() + '-' + Math.random().toString(36).slice(2, 6),
|
||||
sender: self,
|
||||
kind: 'text',
|
||||
subject: target.subject,
|
||||
body: note || (msgs.length > 1 ? `Forwarded ${msgs.length} messages` : 'Forwarded message'),
|
||||
timestamp: Date.now(),
|
||||
...envelope,
|
||||
});
|
||||
target.unread = false;
|
||||
}
|
||||
|
||||
// onDeleteSelected removes the given message ids from the active thread.
|
||||
function onDeleteSelected(ids: string[]) {
|
||||
const t = activeThread.value;
|
||||
if (!t) return;
|
||||
const set = new Set(ids);
|
||||
t.messages = t.messages.filter((m) => !set.has(m.id));
|
||||
}
|
||||
|
||||
// renameGroup updates a group thread's subject to the new name and pushes a
|
||||
// name-change meta message so the conversation reflects the rename inline.
|
||||
function renameGroup(id: string, newName: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (!t || !t.isGroup) return;
|
||||
const self = t.participants.find((p) => p.self) ?? {email: 'd@m8sh.su', name: 'Danila', self: true};
|
||||
t.messages.push({
|
||||
id: 'rename-' + Date.now(),
|
||||
sender: self,
|
||||
kind: 'name-change',
|
||||
subject: newName,
|
||||
body: newName,
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
t.subject = newName;
|
||||
}
|
||||
|
||||
// addMemberToGroup adds a participant to a group thread by email.
|
||||
function addMemberToGroup(id: string, email: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (!t || !t.isGroup) return;
|
||||
if (t.participants.some((p) => p.email === email)) return;
|
||||
const name = email.slice(0, email.indexOf('@'));
|
||||
t.participants.push({email, name});
|
||||
}
|
||||
|
||||
// removeMemberFromGroup removes a participant from a group thread.
|
||||
function removeMemberFromGroup(id: string, email: string) {
|
||||
const t = threads.value.find((x) => x.id === id);
|
||||
if (!t || !t.isGroup) return;
|
||||
t.participants = t.participants.filter((p) => p.email !== email);
|
||||
}
|
||||
|
||||
function onSend(body: string, attachments?: Attachment[]) {
|
||||
const t = activeThread.value;
|
||||
if (!t) return;
|
||||
const self = t.participants.find((p) => p.self) ?? {email: 'd@m8sh.su', name: 'Danila', self: true};
|
||||
t.messages.push({
|
||||
id: 'msg-' + Date.now(),
|
||||
sender: self,
|
||||
kind: 'text',
|
||||
subject: t.subject,
|
||||
body,
|
||||
timestamp: Date.now(),
|
||||
attachments: attachments && attachments.length ? attachments : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
function onCreateThread(newThread: Thread) {
|
||||
threads.value.unshift(newThread);
|
||||
selectThread(newThread.id);
|
||||
composeOpen.value = false;
|
||||
}
|
||||
|
||||
// Close compose on Escape / outside click (outside handled here, inside stops propagation).
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') composeOpen.value = false;
|
||||
}
|
||||
function onWindowClick() {
|
||||
composeOpen.value = false;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', updateMobile);
|
||||
window.addEventListener('keydown', onKeydown);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('resize', updateMobile);
|
||||
window.removeEventListener('keydown', onKeydown);
|
||||
});
|
||||
|
||||
return {
|
||||
threads, activeId, activeThread, view, searchQuery, composeOpen, isMobile,
|
||||
selectThread, goBack, togglePin, markUnread, deleteThread, onSend, onCreateThread,
|
||||
onWindowClick, blocked, isThreadBlocked, blockScopeOf, blockThread, unblockThread,
|
||||
onForward, onDeleteSelected,
|
||||
renameGroup,
|
||||
addMemberToGroup, removeMemberFromGroup,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mail-app" :class="{'view-chat': view === 'chat'}" @click="onWindowClick">
|
||||
<aside class="left-panel">
|
||||
<div class="search-bar" @click.stop>
|
||||
<input v-model="searchQuery" class="search-input" placeholder="Filter conversations…">
|
||||
<i
|
||||
class="compose-toggle"
|
||||
:class="{open: composeOpen}"
|
||||
:title="composeOpen ? 'Close composer' : 'New conversation'"
|
||||
@click="composeOpen = !composeOpen"
|
||||
>
|
||||
<SvgIcon name="octicon-chevron-up" :size="22"/>
|
||||
</i>
|
||||
</div>
|
||||
|
||||
<ComposePanel v-if="composeOpen" @create="onCreateThread" @close="composeOpen = false"/>
|
||||
|
||||
<ThreadList
|
||||
:threads="threads"
|
||||
:active-id="activeId"
|
||||
:query="searchQuery"
|
||||
:blocked="blocked"
|
||||
:is-thread-blocked="isThreadBlocked"
|
||||
:block-scope-of="blockScopeOf"
|
||||
@select="selectThread"
|
||||
@toggle-pin="togglePin"
|
||||
@mark-unread="markUnread"
|
||||
@delete="deleteThread"
|
||||
@block="blockThread"
|
||||
@unblock="unblockThread"
|
||||
/>
|
||||
</aside>
|
||||
|
||||
<main class="right-panel">
|
||||
<ChatPane
|
||||
v-if="activeThread"
|
||||
:key="activeThread.id"
|
||||
:thread="activeThread"
|
||||
:is-mobile="isMobile"
|
||||
:all-threads="threads"
|
||||
@back="goBack"
|
||||
@toggle-pin="togglePin(activeThread!.id)"
|
||||
@delete="deleteThread(activeThread!.id)"
|
||||
@send="onSend"
|
||||
@forward="onForward"
|
||||
@delete-selected="onDeleteSelected"
|
||||
@rename-group="renameGroup(activeThread!.id, $event)"
|
||||
@add-member="addMemberToGroup(activeThread!.id, $event)"
|
||||
@remove-member="removeMemberFromGroup(activeThread!.id, $event)"
|
||||
/>
|
||||
<div v-else class="empty-chat">
|
||||
<SvgIcon name="octicon-mail" :size="32"/>
|
||||
<p>Select a conversation to start reading</p>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.mail-app {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
background: var(--color-body);
|
||||
}
|
||||
|
||||
/* Desktop: two columns side by side */
|
||||
.left-panel {
|
||||
width: 272px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-right: 0.5px solid var(--color-secondary-alpha-30);
|
||||
background: var(--color-body);
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.right-panel {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 7px 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.search-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.compose-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: var(--color-text-light-2);
|
||||
flex-shrink: 0;
|
||||
padding: 4px;
|
||||
border-radius: var(--border-radius);
|
||||
transform: rotate(180deg); /* chevron-up pointing down = "closed, tap to fold open" */
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
|
||||
.compose-toggle.open {
|
||||
transform: rotate(0deg); /* pointing up = "open, tap to fold back up" */
|
||||
}
|
||||
|
||||
.compose-toggle:hover {
|
||||
color: var(--color-text);
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
.empty-chat {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Mobile: stack and slide */
|
||||
@media (max-width: 639.98px) {
|
||||
.mail-app {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.left-panel,
|
||||
.right-panel {
|
||||
width: 100%;
|
||||
flex-shrink: 0;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.left-panel {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
transform: translateX(0);
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
|
||||
.right-panel {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
transform: translateX(100%);
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
|
||||
.mail-app.view-chat .left-panel {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.mail-app.view-chat .right-panel {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,435 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType, ref, computed, watch, onMounted, onBeforeUnmount} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {Attachment} from '../types.ts';
|
||||
|
||||
// Floating audio player bar. Layout: prev/play/next | [name / seek] | download/close
|
||||
export default defineComponent({
|
||||
name: 'AudioPlayer',
|
||||
components: {SvgIcon},
|
||||
props: {
|
||||
tracks: {type: Array as PropType<Attachment[]>, required: true},
|
||||
startIndex: {type: Number, default: 0},
|
||||
},
|
||||
emits: ['close', 'playing-track'],
|
||||
setup(props, {emit}) {
|
||||
const audio = ref<HTMLAudioElement | null>(null);
|
||||
const index = ref(props.startIndex);
|
||||
const playing = ref(false);
|
||||
const currentTime = ref(0);
|
||||
const duration = ref(0);
|
||||
|
||||
const current = computed(() => props.tracks[index.value] ?? null);
|
||||
|
||||
const progress = computed(() => {
|
||||
if (!duration.value) return 0;
|
||||
return Math.min(100, (currentTime.value / duration.value) * 100);
|
||||
});
|
||||
|
||||
function formatTime(s: number): string {
|
||||
if (!s || isNaN(s)) return '0:00';
|
||||
const m = Math.floor(s / 60);
|
||||
const sec = Math.floor(s % 60);
|
||||
return `${m}:${sec.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function togglePlay() {
|
||||
const el = audio.value;
|
||||
if (!el) return;
|
||||
if (playing.value) { el.pause(); playing.value = false; }
|
||||
else { el.play().then(() => { playing.value = true; }).catch(() => {}); }
|
||||
}
|
||||
|
||||
function prev() {
|
||||
if (props.tracks.length === 0) return;
|
||||
index.value = (index.value - 1 + props.tracks.length) % props.tracks.length;
|
||||
currentTime.value = 0;
|
||||
}
|
||||
function next() {
|
||||
if (props.tracks.length === 0) return;
|
||||
index.value = (index.value + 1) % props.tracks.length;
|
||||
currentTime.value = 0;
|
||||
}
|
||||
|
||||
function onTimeUpdate() {
|
||||
const el = audio.value;
|
||||
if (!el) return;
|
||||
currentTime.value = el.currentTime;
|
||||
}
|
||||
function onLoaded() {
|
||||
const el = audio.value;
|
||||
if (!el) return;
|
||||
duration.value = el.duration;
|
||||
}
|
||||
function onEnded() {
|
||||
playing.value = false;
|
||||
if (index.value < props.tracks.length - 1) {
|
||||
next();
|
||||
setTimeout(() => {
|
||||
const el2 = audio.value;
|
||||
if (el2) { el2.play().then(() => { playing.value = true; }).catch(() => {}); }
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
function onSeek(e: Event) {
|
||||
const el = audio.value;
|
||||
if (!el) return;
|
||||
const val = Number((e.target as HTMLInputElement).value);
|
||||
el.currentTime = val;
|
||||
currentTime.value = val;
|
||||
}
|
||||
|
||||
// downloadTrack: create a temporary <a> to trigger download without the
|
||||
// hover lag that <a data-href> causes with large base64 data URLs.
|
||||
function downloadTrack() {
|
||||
const t = current.value;
|
||||
if (!t) return;
|
||||
const a = document.createElement('a');
|
||||
a.href = t.url;
|
||||
a.download = t.name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
|
||||
// onSeekClick: click anywhere on the seek bar to jump to that position.
|
||||
function onSeekClick(e: MouseEvent) {
|
||||
const el = audio.value;
|
||||
if (!el || !duration.value) return;
|
||||
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
|
||||
const pct = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
||||
const val = pct * duration.value;
|
||||
el.currentTime = val;
|
||||
currentTime.value = val;
|
||||
}
|
||||
|
||||
// Emit the current track id so the gallery can highlight it
|
||||
function emitTrack() {
|
||||
const t = current.value;
|
||||
if (t) emit('playing-track', t.id);
|
||||
}
|
||||
|
||||
watch(index, () => {
|
||||
currentTime.value = 0;
|
||||
playing.value = false;
|
||||
emitTrack();
|
||||
setTimeout(() => {
|
||||
const el = audio.value;
|
||||
if (el) {
|
||||
el.load();
|
||||
el.play().then(() => { playing.value = true; }).catch(() => {});
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
|
||||
// Auto-play on mount — the watch above only fires on changes, not initial value
|
||||
onMounted(() => {
|
||||
emitTrack();
|
||||
setTimeout(() => {
|
||||
const el = audio.value;
|
||||
if (el) {
|
||||
el.load();
|
||||
el.play().then(() => { playing.value = true; }).catch(() => {});
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// Watch the startIndex prop so clicking a different audio tile switches the
|
||||
// player to that track even when the player is already open.
|
||||
watch(() => props.startIndex, (newIdx) => {
|
||||
if (newIdx !== index.value) {
|
||||
index.value = newIdx;
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (audio.value) {
|
||||
audio.value.pause();
|
||||
audio.value = null;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
audio, index, current, playing, currentTime, duration, progress,
|
||||
formatTime, togglePlay, prev, next,
|
||||
onTimeUpdate, onLoaded, onEnded, onSeek, onSeekClick, emitTrack, downloadTrack,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="audio-player">
|
||||
<audio
|
||||
ref="audio"
|
||||
:src="current?.url"
|
||||
@timeupdate="onTimeUpdate"
|
||||
@loadedmetadata="onLoaded"
|
||||
@ended="onEnded"
|
||||
@canplay="onLoaded"
|
||||
/>
|
||||
|
||||
<div class="ap-controls">
|
||||
<!-- Left: prev/play/next -->
|
||||
<div class="ap-buttons">
|
||||
<button v-if="tracks.length > 1" type="button" class="ap-btn" title="Previous" style="transition:none!important" @click="prev">
|
||||
<SvgIcon name="octicon-triangle-down" :size="20" class="ap-prev-icon"/>
|
||||
</button>
|
||||
<button type="button" class="ap-play-btn" :title="playing ? 'Pause' : 'Play'" @click="togglePlay">
|
||||
<span v-if="playing" class="ap-icon-stop"/>
|
||||
<span v-else class="ap-icon-play"/>
|
||||
</button>
|
||||
<button v-if="tracks.length > 1" type="button" class="ap-btn" title="Next" style="transition:none!important" @click="next">
|
||||
<SvgIcon name="octicon-triangle-down" :size="20" class="ap-next-icon"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Center: name on top, seek bar below -->
|
||||
<div class="ap-center">
|
||||
<span class="ap-name">{{ current?.name ?? '' }}</span>
|
||||
<div class="ap-seek-row">
|
||||
<span class="ap-time">{{ formatTime(currentTime) }}</span>
|
||||
<div class="ap-seek-wrap" @click="onSeekClick">
|
||||
<div class="ap-seek-track">
|
||||
<div class="ap-seek-fill" :style="{width: progress + '%'}"/>
|
||||
<div class="ap-seek-handle" :style="{left: progress + '%'}"/>
|
||||
</div>
|
||||
</div>
|
||||
<span class="ap-time">{{ formatTime(duration) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Download (left on mobile) -->
|
||||
<div class="ap-download-wrap">
|
||||
<button v-if="current" type="button" class="ap-btn" title="Download" style="transition:none!important" @click="downloadTrack">
|
||||
<SvgIcon name="octicon-download" :size="16"/>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Close (right always) -->
|
||||
<div class="ap-close-wrap">
|
||||
<button type="button" class="ap-btn" title="Close" style="transition:none!important" @click="$emit('close')">
|
||||
<SvgIcon name="octicon-x" :size="16"/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.audio-player,
|
||||
.audio-player *,
|
||||
.audio-player *::before,
|
||||
.audio-player *::after {
|
||||
transition-duration: 0s !important;
|
||||
transition-delay: 0s !important;
|
||||
}
|
||||
|
||||
.audio-player {
|
||||
display: flex;
|
||||
padding: 8px 14px;
|
||||
background: var(--color-secondary-bg);
|
||||
border-top: 0.5px solid var(--color-secondary-alpha-30);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ap-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Left buttons group */
|
||||
.ap-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Center: name + seek stacked */
|
||||
.ap-center {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.ap-name {
|
||||
font-size: 12px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ap-seek-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ap-download-wrap {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ap-close-wrap {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ap-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text-light-2);
|
||||
transition-duration: 0s !important;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
flex-shrink: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ap-btn:hover {
|
||||
background: var(--color-hover);
|
||||
color: var(--color-text);
|
||||
transition-duration: 0s !important;
|
||||
}
|
||||
|
||||
.ap-prev-icon {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.ap-next-icon {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
/* Play button: bare triangle, no circle */
|
||||
.ap-play-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: var(--color-primary);
|
||||
transition-duration: 0s !important;
|
||||
color: var(--color-white);
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
flex-shrink: 0;
|
||||
transition-duration: 0s !important;
|
||||
}
|
||||
|
||||
.ap-play-btn:hover {
|
||||
background: var(--color-primary);
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.ap-icon-play {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 8px 0 8px 12px;
|
||||
border-color: transparent transparent transparent var(--color-white);
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.ap-icon-stop {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.ap-icon-stop::before,
|
||||
.ap-icon-stop::after {
|
||||
content: '';
|
||||
width: 5px;
|
||||
height: 16px;
|
||||
background: var(--color-white);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.ap-time {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-light-2);
|
||||
font-variant-numeric: tabular-nums;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Seek bar with blue progress fill */
|
||||
.ap-seek-wrap {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
height: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ap-seek-track {
|
||||
width: 100%;
|
||||
height: 6px;
|
||||
background: var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-full);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ap-seek-fill {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
background: var(--color-primary);
|
||||
border-radius: var(--border-radius-full);
|
||||
}
|
||||
|
||||
.ap-seek-handle {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: var(--border-radius-full);
|
||||
background: var(--color-primary);
|
||||
transform: translate(-50%, -50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Mobile: download on far left, close on far right, controls in between */
|
||||
@media (max-width: 639.98px) {
|
||||
.ap-controls {
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.ap-download-wrap {
|
||||
order: 1;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.ap-buttons {
|
||||
order: 2;
|
||||
flex: 0 0 auto;
|
||||
margin: 0 auto; /* center the prev/play/next group */
|
||||
}
|
||||
.ap-close-wrap {
|
||||
order: 3;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.ap-center {
|
||||
flex-basis: 100%;
|
||||
order: 10;
|
||||
margin-top: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,112 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, computed, ref} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import {useAvatarResolver, DEFAULT_AVATAR_URL} from '../useAvatarResolver.ts';
|
||||
|
||||
// Renders an avatar for an email or a group. Always renders immediately with
|
||||
// the fallback letter/icon circle and reactively swaps to an <img> once the
|
||||
// avatar URL resolves. When resolution fails, the instance default gopher avatar is shown.
|
||||
export default defineComponent({
|
||||
name: 'AvatarCircle',
|
||||
components: {SvgIcon},
|
||||
props: {
|
||||
email: {type: String, default: ''}, // for DM participants
|
||||
name: {type: String, default: ''}, // display name, falls back to localpart
|
||||
isGroup: {type: Boolean, default: false},
|
||||
size: {type: Number, default: 36}, // px
|
||||
},
|
||||
setup(props) {
|
||||
const {get, resolve} = useAvatarResolver();
|
||||
|
||||
// Kick off resolution on first render for an email (idempotent, non-blocking).
|
||||
if (props.email && !props.isGroup) resolve(props.email);
|
||||
|
||||
const hue = computed(() => {
|
||||
const source = (props.email || props.name || '?').toLowerCase();
|
||||
let sum = 0;
|
||||
for (let i = 0; i < source.length; i++) sum += source.charCodeAt(i);
|
||||
return sum % 360;
|
||||
});
|
||||
|
||||
const letter = computed(() => {
|
||||
const label = props.name || localpart(props.email) || '?';
|
||||
return label.charAt(0).toUpperCase();
|
||||
});
|
||||
|
||||
const imgError = ref(false);
|
||||
|
||||
// The URL to render: real avatar if resolved, instance default gopher on fallback.
|
||||
// '' from the resolver means "resolved-to-fallback" -> use the default gopher image.
|
||||
const resolvedUrl = computed(() => {
|
||||
if (props.isGroup || imgError.value) return undefined;
|
||||
const url = get(props.email);
|
||||
if (url === undefined) return undefined; // still pending -> letter circle
|
||||
return url || DEFAULT_AVATAR_URL; // '' -> default gopher
|
||||
});
|
||||
|
||||
return {hue, letter, resolvedUrl, imgError};
|
||||
},
|
||||
});
|
||||
|
||||
function localpart(email: string): string {
|
||||
const at = email.indexOf('@');
|
||||
return at < 0 ? email : email.slice(0, at);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="avatar-circle"
|
||||
:class="{group: isGroup}"
|
||||
:style="{
|
||||
width: size + 'px',
|
||||
height: size + 'px',
|
||||
fontSize: Math.round(size * 0.42) + 'px',
|
||||
background: isGroup ? `hsl(${hue}, 55%, 45%)` : resolvedUrl ? undefined : `hsl(${hue}, 55%, 45%)`,
|
||||
}"
|
||||
:aria-label="isGroup ? name : (name || email)"
|
||||
role="img"
|
||||
>
|
||||
<SvgIcon v-if="isGroup" name="octicon-organization" :size="Math.round(size * 0.5)"/>
|
||||
<img
|
||||
v-else-if="resolvedUrl"
|
||||
:src="resolvedUrl"
|
||||
:alt="name || email"
|
||||
class="avatar-img"
|
||||
@error="imgError = true"
|
||||
>
|
||||
<span v-else class="avatar-letter">{{ letter }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.avatar-circle {
|
||||
flex-shrink: 0;
|
||||
border-radius: var(--border-radius-full);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
color: #fff;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.avatar-circle.group {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.avatar-letter {
|
||||
font-weight: var(--font-weight-medium);
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,411 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, ref, computed, onMounted, onBeforeUnmount} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {Thread} from '../types.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
|
||||
type Tab = 'direct' | 'group';
|
||||
|
||||
// Compose panel: toggled below the search bar. Closes on Escape or outside click.
|
||||
// Emits "create" with a fully-formed Thread to be inserted into the list, and "close".
|
||||
export default defineComponent({
|
||||
name: 'ComposePanel',
|
||||
components: {SvgIcon, AvatarCircle},
|
||||
emits: ['create', 'close'],
|
||||
setup(_props, {emit}) {
|
||||
const tab = ref<Tab>('direct');
|
||||
|
||||
// Direct tab state
|
||||
const directEmail = ref('');
|
||||
const directBody = ref('');
|
||||
const directSubject = ref('');
|
||||
const editingSubject = ref(false);
|
||||
|
||||
const autoSubject = computed(() => {
|
||||
const first = directBody.value.trim().split(/[.!?\n]/)[0] ?? '';
|
||||
return first.slice(0, 60).trim();
|
||||
});
|
||||
const effectiveSubject = computed(() => directSubject.value || autoSubject.value);
|
||||
|
||||
// Group tab state
|
||||
const groupName = ref('');
|
||||
const groupEmailInput = ref('');
|
||||
const groupChips = ref<string[]>([]);
|
||||
const groupBody = ref('');
|
||||
|
||||
function setTab(t: Tab) {
|
||||
tab.value = t;
|
||||
}
|
||||
|
||||
function autoGrow(e: Event) {
|
||||
const el = e.target as HTMLTextAreaElement;
|
||||
el.style.height = 'auto';
|
||||
el.style.height = Math.min(el.scrollHeight, 140) + 'px';
|
||||
}
|
||||
|
||||
function commitSubjectIfEditing() {
|
||||
editingSubject.value = false;
|
||||
}
|
||||
|
||||
function addChip() {
|
||||
// Trim and strip any trailing delimiter (comma, semicolon, space) the user may have typed
|
||||
const v = groupEmailInput.value.trim().replace(/[,;\s]+$/, '');
|
||||
if (v && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) && !groupChips.value.includes(v)) {
|
||||
groupChips.value.push(v);
|
||||
}
|
||||
groupEmailInput.value = '';
|
||||
}
|
||||
|
||||
function onGroupInputKeydown(e: KeyboardEvent) {
|
||||
// Delimiters that commit the current input as a chip
|
||||
if (e.key === 'Enter' || e.key === ',' || e.key === ';' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
addChip();
|
||||
} else if (e.key === 'Backspace' && groupEmailInput.value === '' && groupChips.value.length) {
|
||||
groupChips.value.pop();
|
||||
}
|
||||
}
|
||||
|
||||
function removeChip(idx: number) {
|
||||
groupChips.value.splice(idx, 1);
|
||||
}
|
||||
|
||||
function createDirect() {
|
||||
const email = directEmail.value.trim();
|
||||
if (!email || !directBody.value.trim()) return;
|
||||
const name = email.slice(0, email.indexOf('@'));
|
||||
const thread: Thread = {
|
||||
id: 'dm-' + email.toLowerCase() + '-' + Date.now(),
|
||||
isGroup: false,
|
||||
subject: effectiveSubject.value || 'New conversation',
|
||||
pinned: false,
|
||||
unread: false,
|
||||
participants: [
|
||||
{email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
{email, name},
|
||||
],
|
||||
messages: [{
|
||||
id: 'c-' + Date.now(),
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: effectiveSubject.value,
|
||||
body: directBody.value.trim(),
|
||||
timestamp: Date.now(),
|
||||
}],
|
||||
};
|
||||
emit('create', thread);
|
||||
reset();
|
||||
}
|
||||
|
||||
function createGroup() {
|
||||
if (!groupName.value.trim() || groupChips.value.length === 0 || !groupBody.value.trim()) return;
|
||||
const participants = [
|
||||
{email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
...groupChips.value.map((email) => ({email, name: email.slice(0, email.indexOf('@'))})),
|
||||
];
|
||||
const thread: Thread = {
|
||||
id: 'group-' + Date.now(),
|
||||
isGroup: true,
|
||||
subject: groupName.value.trim(),
|
||||
pinned: false,
|
||||
unread: false,
|
||||
participants,
|
||||
messages: [{
|
||||
id: 'c-' + Date.now(),
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: groupName.value.trim(),
|
||||
body: groupBody.value.trim(),
|
||||
timestamp: Date.now(),
|
||||
}],
|
||||
};
|
||||
emit('create', thread);
|
||||
reset();
|
||||
}
|
||||
|
||||
function reset() {
|
||||
directEmail.value = '';
|
||||
directBody.value = '';
|
||||
directSubject.value = '';
|
||||
editingSubject.value = false;
|
||||
groupName.value = '';
|
||||
groupEmailInput.value = '';
|
||||
groupChips.value = [];
|
||||
groupBody.value = '';
|
||||
emit('close');
|
||||
}
|
||||
|
||||
// Close on Escape; outside click handled by parent via backdrop.
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') emit('close');
|
||||
}
|
||||
|
||||
onMounted(() => window.addEventListener('keydown', onKeydown));
|
||||
onBeforeUnmount(() => window.removeEventListener('keydown', onKeydown));
|
||||
|
||||
return {
|
||||
tab, setTab,
|
||||
directEmail, directBody, directSubject, editingSubject,
|
||||
autoSubject, effectiveSubject, commitSubjectIfEditing,
|
||||
groupName, groupEmailInput, groupChips, groupBody,
|
||||
autoGrow, addChip, onGroupInputKeydown, removeChip,
|
||||
createDirect, createGroup, reset,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="compose-panel" @click.stop>
|
||||
<div class="compose-tabs">
|
||||
<button type="button" class="compose-tab" :class="{active: tab === 'direct'}" @click="setTab('direct')">
|
||||
Direct
|
||||
</button>
|
||||
<button type="button" class="compose-tab" :class="{active: tab === 'group'}" @click="setTab('group')">
|
||||
Group
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="tab === 'direct'" class="compose-body">
|
||||
<input v-model="directEmail" class="compose-input" type="email" placeholder="To: email address">
|
||||
|
||||
<div class="compose-subject">
|
||||
<template v-if="!editingSubject">
|
||||
<span
|
||||
v-if="effectiveSubject"
|
||||
class="subject-preview"
|
||||
title="Click to edit"
|
||||
@click="editingSubject = true; directSubject = effectiveSubject"
|
||||
>Subject: {{ effectiveSubject }}</span>
|
||||
</template>
|
||||
<input
|
||||
v-else
|
||||
v-model="directSubject"
|
||||
class="compose-input subject-input"
|
||||
placeholder="Subject"
|
||||
@blur="commitSubjectIfEditing"
|
||||
@keydown.enter="commitSubjectIfEditing"
|
||||
>
|
||||
</div>
|
||||
|
||||
<textarea
|
||||
v-model="directBody"
|
||||
class="compose-textarea"
|
||||
placeholder="Write a message…"
|
||||
rows="2"
|
||||
@input="autoGrow"
|
||||
/>
|
||||
|
||||
<div class="compose-actions">
|
||||
<button type="button" class="compose-send" :disabled="!directEmail || !directBody" @click="createDirect">Send</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="compose-body">
|
||||
<input v-model="groupName" class="compose-input" placeholder="Group name">
|
||||
|
||||
<div class="chip-field">
|
||||
<span v-for="(chip, idx) in groupChips" :key="chip" class="chip">
|
||||
<AvatarCircle :email="chip" :size="16"/>
|
||||
<span class="chip-email">{{ chip }}</span>
|
||||
<button type="button" class="chip-remove" :title="'Remove ' + chip" @click="removeChip(idx)">
|
||||
<SvgIcon name="octicon-x" :size="12"/>
|
||||
</button>
|
||||
</span>
|
||||
<input
|
||||
v-model="groupEmailInput"
|
||||
class="chip-input"
|
||||
type="email"
|
||||
placeholder="Add member email (Enter, comma, semicolon, space)"
|
||||
@keydown="onGroupInputKeydown"
|
||||
@blur="addChip"
|
||||
>
|
||||
</div>
|
||||
|
||||
<textarea
|
||||
v-model="groupBody"
|
||||
class="compose-textarea"
|
||||
placeholder="Write a message…"
|
||||
rows="2"
|
||||
@input="autoGrow"
|
||||
/>
|
||||
|
||||
<div class="compose-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="compose-send"
|
||||
:disabled="!groupName || !groupChips.length || !groupBody"
|
||||
@click="createGroup"
|
||||
>
|
||||
Create group
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.compose-panel {
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
background: var(--color-body);
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.compose-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.compose-tab {
|
||||
flex: 1;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text-light-2);
|
||||
font-size: 13px;
|
||||
padding: 6px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.compose-tab.active {
|
||||
background: var(--color-secondary-bg);
|
||||
color: var(--color-text);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.compose-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.compose-input,
|
||||
.compose-textarea {
|
||||
width: 100%;
|
||||
font-size: 13px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 8px 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.compose-input:focus,
|
||||
.compose-textarea:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.chip-input {
|
||||
flex: 1;
|
||||
min-width: 140px;
|
||||
font-size: 13px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.compose-textarea {
|
||||
resize: none;
|
||||
overflow-y: auto;
|
||||
min-height: 36px;
|
||||
max-height: 140px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.compose-subject {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.subject-preview {
|
||||
font-size: 11px;
|
||||
font-style: italic;
|
||||
color: var(--color-text-light-2);
|
||||
cursor: text;
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.subject-input {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.chip-field {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 4px 6px;
|
||||
}
|
||||
|
||||
.chip-field:focus-within {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: var(--border-radius-full);
|
||||
padding: 1px 4px 1px 2px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.chip-email {
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.chip-remove {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text-light-2);
|
||||
cursor: pointer;
|
||||
padding: 2px;
|
||||
display: inline-flex;
|
||||
border-radius: var(--border-radius-full);
|
||||
}
|
||||
|
||||
.chip-remove:hover {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.compose-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.compose-send {
|
||||
border: none;
|
||||
background: hsl(214, 70%, 93%);
|
||||
color: hsl(214, 70%, 30%);
|
||||
font-size: 13px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
padding: 6px 14px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.compose-send:disabled {
|
||||
opacity: var(--opacity-disabled);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,341 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType, ref, nextTick} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {Thread} from '../types.ts';
|
||||
import {threadDisplayName, threadAvatarEmail} from '../threadTitle.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
|
||||
// Modal dialog for picking a target thread to forward selected messages into.
|
||||
// Two-step: first pick a target, then (optionally) add a note that accompanies
|
||||
// the forwarded content. Emits `pick(target, note)` with the chosen target and
|
||||
// note, or `close` to cancel.
|
||||
export default defineComponent({
|
||||
name: 'ForwardDialog',
|
||||
components: {SvgIcon, AvatarCircle},
|
||||
props: {
|
||||
threads: {type: Array as PropType<Thread[]>, required: true},
|
||||
currentId: {type: String, default: ''},
|
||||
selectedCount: {type: Number, default: 0},
|
||||
},
|
||||
emits: ['pick', 'close'],
|
||||
setup(_, {emit}) {
|
||||
const query = ref('');
|
||||
const step = ref<'target' | 'note'>('target');
|
||||
const chosen = ref<Thread | null>(null);
|
||||
const note = ref('');
|
||||
const noteInput = ref<HTMLTextAreaElement | null>(null);
|
||||
|
||||
function chooseTarget(t: Thread) {
|
||||
chosen.value = t;
|
||||
step.value = 'note';
|
||||
nextTick(() => noteInput.value?.focus());
|
||||
}
|
||||
function backToTargets() {
|
||||
step.value = 'target';
|
||||
chosen.value = null;
|
||||
}
|
||||
function confirm() {
|
||||
if (!chosen.value) return;
|
||||
emit('pick', chosen.value, note.value.trim());
|
||||
}
|
||||
return {query, step, chosen, note, noteInput, chooseTarget, backToTargets, confirm};
|
||||
},
|
||||
computed: {
|
||||
targets(): Thread[] {
|
||||
const q = this.query.trim().toLowerCase();
|
||||
return this.threads.filter((t) => {
|
||||
if (t.id === this.currentId) return false;
|
||||
if (!q) return true;
|
||||
return threadDisplayName(t).toLowerCase().includes(q);
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
nameOf: threadDisplayName,
|
||||
avatarOf: threadAvatarEmail,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div class="fwd-overlay" @click.self="$emit('close')">
|
||||
<div class="fwd-modal">
|
||||
<!-- Step 1: pick target -->
|
||||
<template v-if="step === 'target'">
|
||||
<header class="fwd-modal-head">
|
||||
<div class="fwd-modal-title">
|
||||
<SvgIcon name="octicon-link" :size="16"/>
|
||||
Forward {{ selectedCount }} to
|
||||
</div>
|
||||
<button type="button" class="head-icon" title="Cancel" @click="$emit('close')">
|
||||
<SvgIcon name="octicon-x" :size="18"/>
|
||||
</button>
|
||||
</header>
|
||||
<div class="fwd-modal-search">
|
||||
<SvgIcon name="octicon-search" :size="16" class="fwd-search-icon"/>
|
||||
<input v-model="query" type="text" class="fwd-search-input" placeholder="Filter conversations…">
|
||||
</div>
|
||||
<div class="fwd-modal-list">
|
||||
<button
|
||||
v-for="t in targets" :key="t.id"
|
||||
type="button"
|
||||
class="fwd-target"
|
||||
@click="chooseTarget(t)"
|
||||
>
|
||||
<AvatarCircle :email="avatarOf(t)" :name="nameOf(t)" :is-group="t.isGroup" :size="32"/>
|
||||
<div class="fwd-target-name">{{ nameOf(t) }}</div>
|
||||
<SvgIcon name="octicon-chevron-right" :size="14" class="fwd-target-chev"/>
|
||||
</button>
|
||||
<div v-if="!targets.length" class="fwd-empty">No conversations to forward to</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Step 2: add a note -->
|
||||
<template v-else>
|
||||
<header class="fwd-modal-head">
|
||||
<button type="button" class="head-icon" title="Back" @click="backToTargets">
|
||||
<SvgIcon name="octicon-arrow-left" :size="18"/>
|
||||
</button>
|
||||
<div class="fwd-modal-title">
|
||||
<SvgIcon name="octicon-link" :size="16"/>
|
||||
Add a note
|
||||
</div>
|
||||
<button type="button" class="head-icon" title="Cancel" @click="$emit('close')">
|
||||
<SvgIcon name="octicon-x" :size="18"/>
|
||||
</button>
|
||||
</header>
|
||||
<div class="fwd-note-body">
|
||||
<div class="fwd-note-target">
|
||||
<AvatarCircle
|
||||
v-if="chosen"
|
||||
:email="avatarOf(chosen)"
|
||||
:name="nameOf(chosen)"
|
||||
:is-group="chosen.isGroup"
|
||||
:size="24"
|
||||
/>
|
||||
<span class="fwd-note-target-name">{{ chosen ? nameOf(chosen) : '' }}</span>
|
||||
</div>
|
||||
<textarea
|
||||
ref="noteInput"
|
||||
v-model="note"
|
||||
class="fwd-note-input"
|
||||
placeholder="Add a message to accompany the forwarded content…"
|
||||
rows="4"
|
||||
/>
|
||||
</div>
|
||||
<div class="fwd-note-foot">
|
||||
<button type="button" class="fwd-send" @click="confirm">
|
||||
<SvgIcon name="octicon-paper-airplane" :size="16"/>
|
||||
Forward
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.fwd-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1003;
|
||||
background: var(--color-overlay-backdrop);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.fwd-modal {
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
max-height: 70vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--color-menu);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fwd-modal-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
.fwd-modal-title {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.head-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text-light-2);
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.head-icon:hover {
|
||||
background: var(--color-hover);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.fwd-modal-search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
.fwd-search-icon {
|
||||
flex-shrink: 0;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.fwd-search-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 6px 8px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.fwd-search-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.fwd-modal-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.fwd-target {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 10px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
border-radius: var(--border-radius);
|
||||
text-align: left;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
.fwd-target:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
.fwd-target-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fwd-target-chev {
|
||||
color: var(--color-text-light-2);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.fwd-empty {
|
||||
padding: 24px 14px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
/* Note step */
|
||||
.fwd-note-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.fwd-note-target {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.fwd-note-target-name {
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.fwd-note-input {
|
||||
resize: none;
|
||||
font-family: var(--fonts-regular);
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
padding: 8px 10px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.fwd-note-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.fwd-note-foot {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 10px 12px;
|
||||
border-top: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
.fwd-send {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border: none;
|
||||
background: var(--color-primary);
|
||||
color: var(--color-white);
|
||||
font-size: 13px;
|
||||
padding: 8px 14px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
cursor: pointer;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.fwd-send:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,170 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import {type ForwardedContent, forwardedDepth, MAX_FORWARD_DEPTH} from '../types.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
|
||||
// Recursive forwarded-content renderer. Order is reversed vs. a flat thread:
|
||||
// the NESTED forwarded content renders on top, then this layer's body below it.
|
||||
// Each layer indents by a left vertical hairline (so a forward-of-a-forward shows
|
||||
// two nested hairlines, etc.). Up to MAX_FORWARD_DEPTH layers render fully; the
|
||||
// first layer beyond the limit renders as a static, non-clickable mention noting
|
||||
// how many nested layers are folded. It does NOT unfold or link anywhere.
|
||||
export default defineComponent({
|
||||
name: 'ForwardedBubble',
|
||||
components: {SvgIcon, AvatarCircle},
|
||||
props: {
|
||||
content: {type: Object as PropType<ForwardedContent>, required: true},
|
||||
depth: {type: Number, default: 1}, // 1-based: the outermost forward is depth 1
|
||||
},
|
||||
emits: ['jump'],
|
||||
setup(props) {
|
||||
// A layer beyond the visible depth limit renders as a single reference card.
|
||||
const overLimit = props.depth > MAX_FORWARD_DEPTH;
|
||||
const extraLayers = overLimit ? forwardedDepth(props.content) : 0;
|
||||
return {overLimit, extraLayers, MAX_FORWARD_DEPTH};
|
||||
},
|
||||
computed: {
|
||||
fromName(): string {
|
||||
return this.content.from.name || this.content.from.email;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
formatTime(ts: number): string {
|
||||
return new Date(ts).toLocaleString([], {
|
||||
month: 'short', day: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit',
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="fwd" :class="['fwd-depth-' + depth]">
|
||||
<!-- Static mention (non-clickable) for layers beyond the visible depth limit.
|
||||
It just notes how many nested layers are folded; no author, no jump. -->
|
||||
<div v-if="overLimit" class="fwd-ref">
|
||||
<span class="fwd-ref-text">
|
||||
{{ extraLayers }} more forwarded layer{{ extraLayers === 1 ? '' : 's' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Full render of an in-limit layer: nested forwarded content first, then body. -->
|
||||
<template v-else>
|
||||
<!-- Recurse into the nested forwarded content FIRST (it renders on top). -->
|
||||
<ForwardedBubble
|
||||
v-if="content.forwarded"
|
||||
:content="content.forwarded"
|
||||
:depth="depth + 1"
|
||||
@jump="(c: ForwardedContent) => $emit('jump', c)"
|
||||
/>
|
||||
|
||||
<!-- This layer's header + body (below the nested chain). -->
|
||||
<div class="fwd-layer">
|
||||
<div class="fwd-header">
|
||||
<AvatarCircle :email="content.from.email" :name="fromName" :size="20"/>
|
||||
<div class="fwd-meta">
|
||||
<span class="fwd-from">Forwarded from {{ fromName }}</span>
|
||||
<span class="fwd-subject" v-if="content.subject">{{ content.subject }}</span>
|
||||
</div>
|
||||
<span class="fwd-time">{{ formatTime(content.timestamp) }}</span>
|
||||
</div>
|
||||
<div class="fwd-body">{{ content.body }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.fwd {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
/* Each nesting level adds a left vertical hairline via border, so a
|
||||
forward-of-a-forward shows two nested lines, etc. */
|
||||
border-left: 2px solid var(--color-secondary-alpha-30);
|
||||
padding-left: 10px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
/* Deeper nesting renders the hairline slightly fainter to keep hierarchy readable. */
|
||||
.fwd-depth-2 {
|
||||
border-left-color: var(--color-secondary-alpha-30);
|
||||
opacity: 0.96;
|
||||
}
|
||||
|
||||
.fwd-layer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.fwd-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
.fwd-meta {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.fwd-from {
|
||||
font-size: 11px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.fwd-subject {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-light-3);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fwd-time {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.fwd-body {
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
color: var(--color-text);
|
||||
padding: 8px 10px;
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius);
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* Static mention for layers beyond MAX_FORWARD_DEPTH. Non-clickable. */
|
||||
.fwd-ref {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius);
|
||||
font-size: 12px;
|
||||
color: var(--color-text-light-2);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.fwd-ref-text {
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,199 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType, computed, ref} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {Message} from '../types.ts';
|
||||
import {sanitizeHtml} from '../sanitize.ts';
|
||||
import {highlightHtml} from '../highlight.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
|
||||
// Full-width HTML email card. Header bar with sender + timestamp + expand,
|
||||
// sanitized body rendered with v-html, <pre> styled with mono font. When a
|
||||
// search `query` is set, matches inside text nodes are highlighted.
|
||||
export default defineComponent({
|
||||
name: 'HtmlMailCard',
|
||||
components: {SvgIcon, AvatarCircle},
|
||||
props: {
|
||||
message: {type: Object as PropType<Message>, required: true},
|
||||
query: {type: String, default: ''},
|
||||
},
|
||||
setup(props) {
|
||||
const expanded = ref(false);
|
||||
const safeBody = computed(() => {
|
||||
const clean = sanitizeHtml(props.message.body);
|
||||
return highlightHtml(clean, props.query);
|
||||
});
|
||||
|
||||
function formatTime(ts: number): string {
|
||||
return new Date(ts).toLocaleString([], {
|
||||
month: 'short', day: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit',
|
||||
});
|
||||
}
|
||||
|
||||
return {expanded, safeBody, formatTime};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="html-card">
|
||||
<div class="html-header">
|
||||
<AvatarCircle
|
||||
:email="message.sender.email"
|
||||
:name="message.sender.name || message.sender.email"
|
||||
:size="22"
|
||||
/>
|
||||
<span class="html-sender">{{ message.sender.name || message.sender.email }}</span>
|
||||
<span class="html-time">{{ formatTime(message.timestamp) }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="html-expand"
|
||||
:title="expanded ? 'Collapse' : 'Expand'"
|
||||
@click="expanded = !expanded"
|
||||
>
|
||||
<SvgIcon name="octicon-screen-full" :size="16"/>
|
||||
</button>
|
||||
</div>
|
||||
<!-- v-html content is sanitized via sanitizeHtml() allowlist in safeBody -->
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div class="html-body" v-html="safeBody"/>
|
||||
|
||||
<Teleport to="body">
|
||||
<div v-if="expanded" class="html-overlay" @click.self="expanded = false">
|
||||
<div class="html-overlay-card">
|
||||
<div class="html-header">
|
||||
<AvatarCircle
|
||||
:email="message.sender.email"
|
||||
:name="message.sender.name || message.sender.email"
|
||||
:size="22"
|
||||
/>
|
||||
<span class="html-sender">{{ message.sender.name || message.sender.email }}</span>
|
||||
<span class="html-time">{{ formatTime(message.timestamp) }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="html-expand"
|
||||
title="Collapse"
|
||||
@click="expanded = false"
|
||||
>
|
||||
<SvgIcon name="octicon-x" :size="16"/>
|
||||
</button>
|
||||
</div>
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div class="html-body overlay-body" v-html="safeBody"/>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.html-card {
|
||||
width: 100%;
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
overflow: hidden;
|
||||
background: var(--color-body);
|
||||
}
|
||||
|
||||
.html-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--color-secondary-bg);
|
||||
border-bottom: 0.5px solid var(--color-secondary-alpha-30);
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
.html-sender {
|
||||
font-size: 13px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.html-time {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.html-expand {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text-light-2);
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
.html-expand:hover {
|
||||
background: var(--color-hover);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.html-body {
|
||||
padding: 12px 16px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.html-body :deep(pre) {
|
||||
font-family: var(--fonts-monospace);
|
||||
background: var(--color-secondary-bg);
|
||||
padding: 8px;
|
||||
border-radius: var(--border-radius);
|
||||
overflow-x: auto;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.html-body :deep(h1),
|
||||
.html-body :deep(h2),
|
||||
.html-body :deep(h3) {
|
||||
margin: 8px 0 4px;
|
||||
}
|
||||
|
||||
.html-body :deep(table) {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.html-body :deep(img) {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* full-screen overlay on mobile (and desktop expand) */
|
||||
.html-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1001;
|
||||
background: var(--color-overlay-backdrop);
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.html-overlay-card {
|
||||
width: 100%;
|
||||
max-width: 720px;
|
||||
background: var(--color-body);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.overlay-body {
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,356 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType, ref} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {Thread, Participant} from '../types.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
|
||||
// Right sidebar showing group info: avatar, editable name, member list with
|
||||
// add/remove. Emits `close`, `rename(newName)`, `add-member(email)`,
|
||||
// `remove-member(email)`. On desktop it takes ~28% width sliding from the right;
|
||||
// on mobile it fills the screen.
|
||||
export default defineComponent({
|
||||
name: 'MembersPanel',
|
||||
components: {SvgIcon, AvatarCircle},
|
||||
props: {
|
||||
thread: {type: Object as PropType<Thread>, required: true},
|
||||
},
|
||||
emits: ['close', 'rename', 'add-member', 'remove-member'],
|
||||
setup(props) {
|
||||
const editingName = ref(false);
|
||||
const nameValue = ref('');
|
||||
const addingMember = ref(false);
|
||||
const newEmail = ref('');
|
||||
|
||||
function startRename() {
|
||||
nameValue.value = props.thread.subject;
|
||||
editingName.value = true;
|
||||
}
|
||||
function saveRename() {
|
||||
const name = nameValue.value.trim();
|
||||
if (name) {
|
||||
this.$emit('rename', name);
|
||||
}
|
||||
editingName.value = false;
|
||||
}
|
||||
function cancelRename() { editingName.value = false; }
|
||||
|
||||
function toggleAdd() {
|
||||
addingMember.value = !addingMember.value;
|
||||
newEmail.value = '';
|
||||
}
|
||||
function confirmAdd() {
|
||||
const email = newEmail.value.trim();
|
||||
if (email) {
|
||||
this.$emit('add-member', email);
|
||||
}
|
||||
addingMember.value = false;
|
||||
newEmail.value = '';
|
||||
}
|
||||
|
||||
return {editingName, nameValue, addingMember, newEmail, startRename, saveRename, cancelRename, toggleAdd, confirmAdd};
|
||||
},
|
||||
methods: {
|
||||
labelOf(p: Participant): string {
|
||||
return p.name || p.email.slice(0, p.email.indexOf('@'));
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="members-panel">
|
||||
<header class="members-head">
|
||||
<button type="button" class="head-icon" title="Close" @click="$emit('close')">
|
||||
<SvgIcon name="octicon-x" :size="18"/>
|
||||
</button>
|
||||
<div class="members-title">Group info</div>
|
||||
</header>
|
||||
|
||||
<div class="members-body">
|
||||
<!-- Group avatar + editable name -->
|
||||
<div class="group-id">
|
||||
<AvatarCircle :email="''" :name="thread.subject" :is-group="true" :size="56"/>
|
||||
<div class="group-name-wrap">
|
||||
<div v-if="!editingName" class="group-name-row">
|
||||
<span class="group-name">{{ thread.subject }}</span>
|
||||
<button type="button" class="head-icon sm" title="Rename" @click="startRename">
|
||||
<SvgIcon name="octicon-tag" :size="14"/>
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="group-rename">
|
||||
<input v-model="nameValue" class="rename-inline" placeholder="Group name…" @keydown.enter="saveRename" @keydown.escape="cancelRename">
|
||||
<button type="button" class="head-icon sm" title="Save" @click="saveRename">
|
||||
<SvgIcon name="octicon-check" :size="14"/>
|
||||
</button>
|
||||
<button type="button" class="head-icon sm" title="Cancel" @click="cancelRename">
|
||||
<SvgIcon name="octicon-x" :size="14"/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Members section -->
|
||||
<div class="members-section">
|
||||
<div class="members-label">
|
||||
<span>Members ({{ thread.participants.length }})</span>
|
||||
<button type="button" class="head-icon sm" title="Add member" @click="toggleAdd">
|
||||
<SvgIcon name="octicon-plus" :size="16"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Add member input -->
|
||||
<div v-if="addingMember" class="add-member">
|
||||
<input v-model="newEmail" class="add-input" placeholder="email@example.com" @keydown.enter="confirmAdd" @keydown.escape="toggleAdd">
|
||||
<button type="button" class="head-icon sm" title="Add" @click="confirmAdd">
|
||||
<SvgIcon name="octicon-check" :size="16"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Member list -->
|
||||
<div class="members-list">
|
||||
<div v-for="p in thread.participants" :key="p.email" class="member-item">
|
||||
<AvatarCircle :email="p.email" :name="labelOf(p)" :size="32"/>
|
||||
<div class="member-info">
|
||||
<div class="member-name">
|
||||
{{ labelOf(p) }}
|
||||
<span v-if="p.self" class="member-self">you</span>
|
||||
</div>
|
||||
<div class="member-email">{{ p.email }}</div>
|
||||
</div>
|
||||
<button
|
||||
v-if="!p.self"
|
||||
type="button"
|
||||
class="head-icon sm danger"
|
||||
title="Remove member"
|
||||
@click="$emit('remove-member', p.email)"
|
||||
>
|
||||
<SvgIcon name="octicon-x" :size="14"/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.members-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 320px;
|
||||
z-index: 10;
|
||||
background: var(--color-body);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-left: 0.5px solid var(--color-secondary-alpha-30);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* On mobile, take the full screen as an overlay */
|
||||
@media (max-width: 639.98px) {
|
||||
.members-panel {
|
||||
width: 100%;
|
||||
border-left: none;
|
||||
}
|
||||
}
|
||||
|
||||
.members-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 0.5px solid var(--color-secondary-alpha-30);
|
||||
min-height: 52px;
|
||||
}
|
||||
|
||||
.members-title {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.head-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--color-text-light-2);
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.head-icon.sm {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.head-icon:hover {
|
||||
background: var(--color-hover);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.head-icon.danger:hover {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.members-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
padding: 16px 12px;
|
||||
}
|
||||
|
||||
/* Group identity section */
|
||||
.group-id {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.group-name-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.group-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.group-name {
|
||||
font-size: 15px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.group-rename {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.rename-inline {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 5px 8px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.rename-inline:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* Members section */
|
||||
.members-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.members-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 11px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text-light-2);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.add-member {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.add-input {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
font-family: var(--fonts-regular);
|
||||
color: var(--color-text);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 6px 8px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.add-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.members-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.member-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 8px;
|
||||
border-radius: var(--border-radius);
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.member-item:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
.member-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.member-name {
|
||||
font-size: 13px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.member-self {
|
||||
font-size: 10px;
|
||||
color: var(--color-primary);
|
||||
background: var(--color-primary-alpha-10);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0 4px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.member-email {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-light-2);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,760 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType, computed, ref} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {ForwardedContent, Message} from '../types.ts';
|
||||
import {highlightPlainText} from '../highlight.ts';
|
||||
import {formatFileSize} from '../types.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
import ForwardedBubble from './ForwardedBubble.vue';
|
||||
|
||||
// Plain text message bubble. Others: left aligned with avatar + sender name.
|
||||
// Self: right aligned, no name, blue-ish bubble. When the message has forwarded
|
||||
// content, the forwarded panel renders ON TOP and the message body below it.
|
||||
// A deeper-than-limit forwarded layer emits `jump` so the parent can open the
|
||||
// origin thread at that message. When `selectable`, a checkbox appears.
|
||||
export default defineComponent({
|
||||
name: 'MessageBubble',
|
||||
components: {SvgIcon, AvatarCircle, ForwardedBubble},
|
||||
props: {
|
||||
message: {type: Object as PropType<Message>, required: true},
|
||||
query: {type: String, default: ''},
|
||||
selectable: {type: Boolean, default: false},
|
||||
selected: {type: Boolean, default: false},
|
||||
playingTrackId: {type: String, default: ''},
|
||||
},
|
||||
emits: ['toggle-select', 'jump', 'play-audio'],
|
||||
setup(props) {
|
||||
const bubbleHtml = computed(() => highlightPlainText(props.message.body, props.query));
|
||||
|
||||
// Lightbox gallery: stores all image URLs for the lightbox
|
||||
const galleryImages = computed(() => {
|
||||
if (!props.message.attachments) return [];
|
||||
return props.message.attachments.filter((a) => a.kind === 'image').map((a) => a.url);
|
||||
});
|
||||
|
||||
// Media items for the gallery grid: ALL attachments
|
||||
const mediaItems = computed(() => {
|
||||
return props.message.attachments ?? [];
|
||||
});
|
||||
|
||||
// Show the grid gallery when: 2+ images, or any non-image attachment exists.
|
||||
// A single image-only message shows a large preview instead.
|
||||
const shouldShowGallery = computed(() => {
|
||||
const atts = props.message.attachments ?? [];
|
||||
if (atts.length === 0) return false;
|
||||
// Only single image or single video get natural-size preview;
|
||||
// single audio and single file still render as square grid tiles.
|
||||
if (atts.length === 1 && (atts[0].kind === 'image' || atts[0].kind === 'video')) return false;
|
||||
return true;
|
||||
});
|
||||
const lightboxIndex = ref(-1);
|
||||
const lightboxOpen = computed(() => lightboxIndex.value >= 0 && lightboxIndex.value < galleryImages.value.length);
|
||||
const lightboxSrc = computed(() => lightboxOpen.value ? galleryImages.value[lightboxIndex.value] : null);
|
||||
function openLightbox(url: string) {
|
||||
const idx = galleryImages.value.indexOf(url);
|
||||
lightboxIndex.value = idx >= 0 ? idx : 0;
|
||||
}
|
||||
function closeLightbox() { lightboxIndex.value = -1; }
|
||||
function lightboxPrev() {
|
||||
const n = galleryImages.value.length;
|
||||
if (n > 0) lightboxIndex.value = (lightboxIndex.value - 1 + n) % n;
|
||||
}
|
||||
function lightboxNext() {
|
||||
const n = galleryImages.value.length;
|
||||
if (n > 0) lightboxIndex.value = (lightboxIndex.value + 1) % n;
|
||||
}
|
||||
return {bubbleHtml, galleryImages, mediaItems, shouldShowGallery, lightboxIndex, lightboxOpen, lightboxSrc, openLightbox, closeLightbox, lightboxPrev, lightboxNext};
|
||||
},
|
||||
methods: {
|
||||
formatFileSize,
|
||||
downloadFile(att: {url: string, name: string}) {
|
||||
const a = document.createElement('a');
|
||||
a.href = att.url;
|
||||
a.download = att.name;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
},
|
||||
formatTime(ts: number): string {
|
||||
const d = new Date(ts);
|
||||
return d.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="msg-row" :class="{self: message.sender.self, selectable}">
|
||||
<!-- Selection checkbox always renders at the leftmost edge of the row,
|
||||
independent of the self/others alignment. It's a circular check. -->
|
||||
<label v-if="selectable" class="msg-check">
|
||||
<input type="checkbox" :checked="selected" @change="$emit('toggle-select')">
|
||||
<span class="msg-check-box" :class="{checked: selected}">
|
||||
<SvgIcon v-if="selected" name="octicon-check" :size="12" class="msg-check-icon"/>
|
||||
</span>
|
||||
</label>
|
||||
<AvatarCircle
|
||||
v-if="!message.sender.self"
|
||||
:email="message.sender.email"
|
||||
:name="message.sender.name || message.sender.email"
|
||||
:size="22"
|
||||
class="msg-avatar"
|
||||
/>
|
||||
<div class="msg-content">
|
||||
<div v-if="!message.sender.self" class="msg-sender">
|
||||
{{ message.sender.name || message.sender.email }}
|
||||
</div>
|
||||
<div class="msg-bubble-wrap" :class="{'atts-only': !message.body}">
|
||||
<!-- Forwarded panel renders ON TOP of the body (reversed order). -->
|
||||
<div v-if="message.forwarded || (message.quotes && message.quotes.length)" class="msg-forwarded">
|
||||
<ForwardedBubble
|
||||
v-if="message.forwarded"
|
||||
:content="message.forwarded"
|
||||
:depth="1"
|
||||
@jump="(c: ForwardedContent) => $emit('jump', c)"
|
||||
/>
|
||||
<ForwardedBubble
|
||||
v-for="(q, qi) in message.quotes ?? []" :key="qi"
|
||||
:content="q"
|
||||
:depth="1"
|
||||
:class="{'fwd-sibling': qi > 0}"
|
||||
@jump="(c: ForwardedContent) => $emit('jump', c)"
|
||||
/>
|
||||
</div>
|
||||
<!-- Single image: large natural preview -->
|
||||
<a
|
||||
v-if="mediaItems.length === 1 && mediaItems[0].kind === 'image'"
|
||||
href="#"
|
||||
class="att-single-image"
|
||||
@click.prevent="openLightbox(mediaItems[0].url)"
|
||||
>
|
||||
<img :src="mediaItems[0].url" :alt="mediaItems[0].name" loading="lazy">
|
||||
</a>
|
||||
|
||||
<!-- Single video: natural-size inline player -->
|
||||
<div
|
||||
v-if="mediaItems.length === 1 && mediaItems[0].kind === 'video'"
|
||||
class="att-single-video"
|
||||
>
|
||||
<video :src="mediaItems[0].url" controls preload="metadata"/>
|
||||
<span class="att-gallery-label">{{ mediaItems[0].name }}</span>
|
||||
</div>
|
||||
|
||||
<!-- All attachments as uniform square gallery tiles -->
|
||||
<div
|
||||
v-if="shouldShowGallery"
|
||||
class="att-gallery"
|
||||
:class="'att-gallery-' + Math.min(mediaItems.length, 3)"
|
||||
>
|
||||
<template v-for="att in message.attachments ?? []" :key="att.id">
|
||||
<a v-if="att.kind === 'image'" href="#" class="att-gallery-item" @click.prevent="openLightbox(att.url)">
|
||||
<img :src="att.url" :alt="att.name" loading="lazy">
|
||||
</a>
|
||||
<button v-else-if="att.kind === 'audio'" type="button" class="att-gallery-item att-gallery-audio"
|
||||
:class="{'att-gallery-playing': playingTrackId === att.id}" @click.stop="$emit('play-audio', att)">
|
||||
<span v-if="playingTrackId === att.id" class="att-audio-pause-icon"/>
|
||||
<span v-else class="att-audio-play-icon"/>
|
||||
<span class="att-gallery-label att-gallery-audio-label">{{ att.name }}</span>
|
||||
</button>
|
||||
<div v-else-if="att.kind === 'video'" class="att-gallery-item att-gallery-video">
|
||||
<video :src="att.url" controls preload="metadata"/>
|
||||
<span class="att-gallery-label">{{ att.name }}</span>
|
||||
</div>
|
||||
<button v-else type="button" class="att-gallery-item att-gallery-file" @click.stop="downloadFile(att)">
|
||||
<SvgIcon name="octicon-file" :size="40"/>
|
||||
<span class="att-gallery-file-info">
|
||||
<span class="att-gallery-file-name">{{ att.name }}</span>
|
||||
<span class="att-gallery-file-size">{{ formatFileSize(att.size) }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<!-- bubbleHtml is escaped+highlighted output, safe for v-html -->
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div v-if="message.body" class="msg-bubble" :class="{searching: !!query}" v-html="bubbleHtml"/>
|
||||
</div>
|
||||
<div class="msg-time">{{ formatTime(message.timestamp) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Image lightbox gallery with navigation -->
|
||||
<Teleport to="body">
|
||||
<div v-if="lightboxOpen" class="att-lightbox" @click="closeLightbox" @keydown.escape="closeLightbox">
|
||||
<button type="button" class="att-lightbox-close" title="Close (Esc)" @click.stop="closeLightbox">
|
||||
<SvgIcon name="octicon-x" :size="24"/>
|
||||
</button>
|
||||
<img v-if="lightboxSrc" :src="lightboxSrc" class="att-lightbox-img" alt="" @click.stop>
|
||||
<!-- Navigation arrows (only when multiple images) -->
|
||||
<button
|
||||
v-if="galleryImages.length > 1"
|
||||
type="button"
|
||||
class="att-lightbox-nav att-lightbox-prev"
|
||||
title="Previous (←)"
|
||||
@click.stop="lightboxPrev"
|
||||
>
|
||||
<SvgIcon name="octicon-chevron-left" :size="28"/>
|
||||
</button>
|
||||
<button
|
||||
v-if="galleryImages.length > 1"
|
||||
type="button"
|
||||
class="att-lightbox-nav att-lightbox-next"
|
||||
title="Next (→)"
|
||||
@click.stop="lightboxNext"
|
||||
>
|
||||
<SvgIcon name="octicon-chevron-right" :size="28"/>
|
||||
</button>
|
||||
<!-- Counter -->
|
||||
<span v-if="galleryImages.length > 1" class="att-lightbox-count" @click.stop>
|
||||
{{ lightboxIndex + 1 }} / {{ galleryImages.length }}
|
||||
</span>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.msg-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Self-messages align content to the right via margin-left:auto rather than
|
||||
row-reverse. This keeps the checkbox (first child) anchored at the far-left
|
||||
edge for BOTH incoming and outgoing, on the same vertical line. */
|
||||
.msg-row.self .msg-content {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.msg-row.selectable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.msg-avatar {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.msg-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: min(75%, 520px);
|
||||
}
|
||||
|
||||
/* Attachments can be wider than the text bubble */
|
||||
.msg-content .msg-attachments {
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.msg-row.self .msg-content {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.msg-sender {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-light-2);
|
||||
margin: 0 0 2px 2px;
|
||||
}
|
||||
|
||||
.msg-bubble-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
overflow: visible;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.msg-bubble {
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
padding: 7px 11px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-top: none;
|
||||
border-bottom-left-radius: 3px;
|
||||
word-break: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.msg-row.self .msg-bubble {
|
||||
background: hsl(214, 70%, 93%);
|
||||
color: hsl(214, 70%, 30%);
|
||||
border: 0.5px solid hsl(214, 70%, 88%);
|
||||
border-top: none;
|
||||
border-bottom-left-radius: var(--border-radius-medium);
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
/* When a message carries forwarded content, the forwarded panel sits on top and
|
||||
the bubble drops its TOP radius so it visually attaches below the panel. */
|
||||
.msg-forwarded {
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-bottom: none;
|
||||
border-top-left-radius: var(--border-radius-medium);
|
||||
border-top-right-radius: var(--border-radius-medium);
|
||||
background: var(--color-body);
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.msg-row.self .msg-forwarded {
|
||||
border-color: hsl(214, 70%, 88%);
|
||||
}
|
||||
|
||||
/* When multiple forwarded messages are grouped as siblings, a hairline separates
|
||||
them so each quote reads as its own block at the same nesting level. */
|
||||
.msg-forwarded :deep(.fwd-sibling) {
|
||||
margin-top: 6px;
|
||||
padding-top: 6px;
|
||||
border-top: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
.msg-time {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
margin: 2px 2px 0;
|
||||
}
|
||||
|
||||
/* Selection checkbox: visually a custom box since the native input is hidden.
|
||||
It centers vertically against the bubble content via align-self on the row. */
|
||||
.msg-check {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-self: center;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
width: 22px;
|
||||
margin-left: 4px; /* small breathing room from the left edge of the messages area */
|
||||
}
|
||||
|
||||
.msg-check input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.msg-check-box {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-full);
|
||||
background: var(--color-secondary-bg);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--color-white);
|
||||
}
|
||||
|
||||
.msg-check-box.checked {
|
||||
background: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.msg-check-icon {
|
||||
color: var(--color-white);
|
||||
}
|
||||
|
||||
/* Attachments */
|
||||
.msg-attachments {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.att-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* When message is attachment-only (no body text), remove border constraints */
|
||||
.msg-bubble-wrap.atts-only .msg-attachments {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.att-image img {
|
||||
max-width: 280px;
|
||||
max-height: 280px;
|
||||
min-width: 80px;
|
||||
min-height: 80px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
cursor: pointer;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
background: var(--color-secondary-bg);
|
||||
}
|
||||
|
||||
.att-video video {
|
||||
max-width: 280px;
|
||||
max-height: 200px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
/* Audio tile in gallery grid — same square shape as image tiles */
|
||||
.att-gallery-audio {
|
||||
display: flex !important;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 8px;
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30) !important;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
aspect-ratio: 1 !important;
|
||||
}
|
||||
|
||||
.att-gallery-audio:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* Highlight the currently playing audio tile */
|
||||
.att-gallery-playing {
|
||||
background: var(--color-primary-alpha-10) !important;
|
||||
border-color: var(--color-primary) !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Audio icon: grey, centered */
|
||||
/* CSS play triangle (matches player) */
|
||||
.att-audio-play-icon {
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
border-width: 16px 0 16px 26px;
|
||||
border-color: transparent transparent transparent var(--color-text-light-2);
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
/* CSS pause bars (two fat vertical lines) */
|
||||
.att-audio-pause-icon {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.att-audio-pause-icon::before,
|
||||
.att-audio-pause-icon::after {
|
||||
content: '';
|
||||
width: 6px;
|
||||
height: 24px;
|
||||
background: var(--color-primary);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* Filename: bottom-right with padding, slightly bigger */
|
||||
.att-gallery-audio-label {
|
||||
position: absolute;
|
||||
bottom: 4px;
|
||||
right: 4px;
|
||||
font-size: 11px;
|
||||
color: var(--color-text-light-2);
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: calc(100% - 8px);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.att-gallery-label {
|
||||
font-size: 10px;
|
||||
color: var(--color-text);
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.att-gallery-sub {
|
||||
font-size: 9px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
/* Video tile: fills the square with the video player */
|
||||
.att-gallery-video {
|
||||
background: var(--color-body);
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.att-gallery-video video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: inherit;
|
||||
}
|
||||
|
||||
/* File tile: centered icon + filename */
|
||||
.att-gallery-file {
|
||||
display: flex !important;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 8px;
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30) !important;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
aspect-ratio: 1 !important;
|
||||
}
|
||||
|
||||
.att-gallery-file:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.att-gallery-file svg {
|
||||
flex-shrink: 0;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.att-gallery-file-info {
|
||||
position: absolute;
|
||||
bottom: 4px;
|
||||
left: 4px;
|
||||
right: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 10px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.att-gallery-file-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: var(--color-text-light-2);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.att-gallery-file-size {
|
||||
flex-shrink: 0;
|
||||
color: var(--color-text-light-3);
|
||||
}
|
||||
|
||||
/* Single image: large non-square preview */
|
||||
.att-single-image {
|
||||
aspect-ratio: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.att-single-image img {
|
||||
max-width: 280px;
|
||||
max-height: 280px;
|
||||
min-width: 80px;
|
||||
min-height: 80px;
|
||||
object-fit: contain;
|
||||
background: var(--color-secondary-bg);
|
||||
}
|
||||
|
||||
/* Single video: natural-size player */
|
||||
.att-single-video video {
|
||||
max-width: 280px;
|
||||
max-height: 240px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
}
|
||||
|
||||
.att-single-video .att-gallery-label {
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
text-align: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.att-audio-name {
|
||||
font-size: 13px;
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.att-label {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.att-file {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
background: var(--color-secondary-bg);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
border-radius: var(--border-radius-medium);
|
||||
text-decoration: none;
|
||||
color: var(--color-text);
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.att-file:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
.att-file-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.att-file-name {
|
||||
font-size: 13px;
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 160px;
|
||||
}
|
||||
|
||||
.att-file-size {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
/* Image gallery grid — multiple images in a compact grid */
|
||||
.att-gallery {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.att-gallery-item {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
border-radius: var(--border-radius-medium);
|
||||
border: 0.5px solid var(--color-secondary-alpha-30);
|
||||
cursor: pointer;
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.att-gallery-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Gallery with 1 image: no aspect ratio constraint, show full size */
|
||||
.att-gallery-1 .att-gallery-item {
|
||||
aspect-ratio: auto;
|
||||
}
|
||||
|
||||
.att-gallery-1 .att-gallery-item img {
|
||||
max-width: 280px;
|
||||
max-height: 280px;
|
||||
min-width: 80px;
|
||||
min-height: 80px;
|
||||
object-fit: contain;
|
||||
background: var(--color-secondary-bg);
|
||||
}
|
||||
|
||||
/* Image lightbox — full-screen overlay with the image centered and navigation */
|
||||
.att-lightbox {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1004;
|
||||
background: var(--color-overlay-backdrop);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.att-lightbox-img {
|
||||
max-width: 90vw;
|
||||
max-height: 90vh;
|
||||
border-radius: var(--border-radius-medium);
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.att-lightbox-close {
|
||||
position: absolute;
|
||||
top: 16px;
|
||||
right: 16px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: var(--color-overlay-backdrop);
|
||||
color: #fff;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: var(--border-radius-full);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.att-lightbox-close:hover {
|
||||
background: var(--color-overlay-backdrop);
|
||||
}
|
||||
|
||||
.att-lightbox-nav {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: var(--color-overlay-backdrop);
|
||||
color: #fff;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: var(--border-radius-full);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.att-lightbox-nav:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.att-lightbox-prev {
|
||||
left: 16px;
|
||||
}
|
||||
|
||||
.att-lightbox-next {
|
||||
right: 16px;
|
||||
}
|
||||
|
||||
.att-lightbox-count {
|
||||
position: absolute;
|
||||
bottom: 16px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-size: 13px;
|
||||
color: #fff;
|
||||
background: var(--color-overlay-backdrop);
|
||||
padding: 4px 12px;
|
||||
border-radius: var(--border-radius-full);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,429 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent, type PropType, computed, ref, onMounted, onBeforeUnmount} from 'vue';
|
||||
import {SvgIcon} from '../../../svg.ts';
|
||||
import type {BlockEntry, BlockScope, Thread} from '../types.ts';
|
||||
import {threadDisplayName, threadAvatarEmail} from '../threadTitle.ts';
|
||||
import AvatarCircle from './AvatarCircle.vue';
|
||||
|
||||
// Left panel thread list with pinned + messages sections, search filtering,
|
||||
// and a right-click / long-press context menu with an expandable Block group.
|
||||
export default defineComponent({
|
||||
name: 'ThreadList',
|
||||
components: {SvgIcon, AvatarCircle},
|
||||
props: {
|
||||
threads: {type: Array as PropType<Thread[]>, required: true},
|
||||
activeId: {type: String, default: ''},
|
||||
query: {type: String, default: ''},
|
||||
blocked: {type: Array as PropType<BlockEntry[]>, default: () => []},
|
||||
isThreadBlocked: {type: Function as PropType<(t: Thread) => boolean>, required: true},
|
||||
blockScopeOf: {type: Function as PropType<(t: Thread) => BlockScope | null>, required: true},
|
||||
},
|
||||
emits: ['select', 'toggle-pin', 'mark-unread', 'delete', 'block', 'unblock'],
|
||||
setup(props, {emit}) {
|
||||
// Name/email resolution is centralised in threadTitle.ts for the backend merge.
|
||||
const threadName = threadDisplayName;
|
||||
const threadEmail = threadAvatarEmail;
|
||||
|
||||
function lastMessage(t: Thread) {
|
||||
for (let i = t.messages.length - 1; i >= 0; i--) {
|
||||
const m = t.messages[i];
|
||||
if (m.kind === 'text' || m.kind === 'html') return m;
|
||||
}
|
||||
return t.messages[t.messages.length - 1];
|
||||
}
|
||||
|
||||
function lastPreview(t: Thread): string {
|
||||
const m = lastMessage(t);
|
||||
if (!m) return '';
|
||||
if (m.kind === 'html') return 'HTML message';
|
||||
return m.body;
|
||||
}
|
||||
|
||||
function lastTimestamp(t: Thread): number {
|
||||
const m = lastMessage(t);
|
||||
return m ? m.timestamp : 0;
|
||||
}
|
||||
|
||||
function formatRelative(ts: number): string {
|
||||
const diff = Date.now() - ts;
|
||||
const min = 60_000, hour = 60 * min, day = 24 * hour;
|
||||
if (diff < min) return 'now';
|
||||
if (diff < hour) return Math.floor(diff / min) + 'm';
|
||||
if (diff < day) return Math.floor(diff / hour) + 'h';
|
||||
if (diff < 7 * day) return Math.floor(diff / day) + 'd';
|
||||
return new Date(ts).toLocaleDateString([], {month: 'short', day: 'numeric'});
|
||||
}
|
||||
|
||||
const filtered = computed<Thread[]>(() => {
|
||||
const q = props.query.trim().toLowerCase();
|
||||
if (!q) return props.threads;
|
||||
return props.threads.filter((t) => {
|
||||
return threadName(t).toLowerCase().includes(q) || lastPreview(t).toLowerCase().includes(q);
|
||||
});
|
||||
});
|
||||
|
||||
const pinned = computed(() => filtered.value.filter((t) => t.pinned));
|
||||
const others = computed(() => filtered.value.filter((t) => !t.pinned));
|
||||
|
||||
// Context menu. Delete sits at the top; Block is an expandable toggle whose
|
||||
// options render below it when open.
|
||||
const menu = ref<{threadId: string, x: number, y: number} | null>(null);
|
||||
const submenuOpen = ref(false);
|
||||
let longPressTimer: number | undefined;
|
||||
// Guard timestamp: some browsers (e.g. Firefox) fire a `click` on right-click;
|
||||
// ignore clicks within this window so the menu doesn't close instantly.
|
||||
let menuOpenedAt = 0;
|
||||
|
||||
function openMenu(t: Thread, x: number, y: number) {
|
||||
// clamp so the menu never renders off the right/bottom edge, where it
|
||||
// would appear "missing" to the user.
|
||||
const w = window.innerWidth;
|
||||
const h = window.innerHeight;
|
||||
const maxX = Math.max(0, w - 180);
|
||||
const maxY = Math.max(0, h - 320);
|
||||
menu.value = {threadId: t.id, x: Math.min(x, maxX), y: Math.min(y, maxY)};
|
||||
submenuOpen.value = false;
|
||||
menuOpenedAt = Date.now();
|
||||
}
|
||||
|
||||
function onContextMenu(e: MouseEvent, t: Thread) {
|
||||
e.preventDefault();
|
||||
openMenu(t, e.clientX, e.clientY);
|
||||
}
|
||||
|
||||
function onTouchStart(e: TouchEvent, t: Thread) {
|
||||
const touch = e.touches[0];
|
||||
longPressTimer = window.setTimeout(() => {
|
||||
openMenu(t, touch.clientX, touch.clientY);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function clearLongPress() {
|
||||
if (longPressTimer) {
|
||||
clearTimeout(longPressTimer);
|
||||
longPressTimer = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function closeMenu() {
|
||||
menu.value = null;
|
||||
submenuOpen.value = false;
|
||||
}
|
||||
|
||||
function menuThread(): Thread | undefined {
|
||||
return props.threads.find((t) => t.id === menu.value?.threadId);
|
||||
}
|
||||
|
||||
function pinFromMenu() {
|
||||
if (menu.value) emit('toggle-pin', menu.value.threadId);
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
function unreadFromMenu() {
|
||||
if (menu.value) emit('mark-unread', menu.value.threadId);
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
function deleteFromMenu() {
|
||||
if (menu.value) emit('delete', menu.value.threadId);
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
function toggleSubmenu() {
|
||||
submenuOpen.value = !submenuOpen.value;
|
||||
}
|
||||
|
||||
function blockFromMenu(scope: BlockScope, alsoDelete: boolean) {
|
||||
if (menu.value) emit('block', menu.value.threadId, scope, alsoDelete);
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
function unblockFromMenu() {
|
||||
if (menu.value) emit('unblock', menu.value.threadId);
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
function onWindowClickClose(e: MouseEvent) {
|
||||
// ignore the synthesized click that some browsers fire right after contextmenu
|
||||
if (Date.now() - menuOpenedAt < 350) return;
|
||||
// ignore clicks inside the menu itself
|
||||
if ((e.target as HTMLElement)?.closest('.ctx-menu')) return;
|
||||
closeMenu();
|
||||
}
|
||||
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') {
|
||||
if (submenuOpen.value) submenuOpen.value = false;
|
||||
else closeMenu();
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('click', onWindowClickClose);
|
||||
window.addEventListener('keydown', onKeydown);
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('click', onWindowClickClose);
|
||||
window.removeEventListener('keydown', onKeydown);
|
||||
clearLongPress();
|
||||
});
|
||||
|
||||
return {
|
||||
filtered, pinned, others,
|
||||
threadName, threadEmail, lastPreview, lastTimestamp, formatRelative,
|
||||
menu, submenuOpen, onContextMenu, onTouchStart, clearLongPress, closeMenu, menuThread,
|
||||
pinFromMenu, unreadFromMenu, deleteFromMenu, toggleSubmenu, blockFromMenu, unblockFromMenu,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="thread-list">
|
||||
<!-- pinned section -->
|
||||
<template v-if="pinned.length">
|
||||
<div class="list-section-label">
|
||||
<SvgIcon name="octicon-pin" :size="12"/>
|
||||
Pinned
|
||||
</div>
|
||||
<div
|
||||
v-for="t in pinned" :key="t.id"
|
||||
class="thread-item"
|
||||
:class="{active: t.id === activeId, unread: t.unread, blocked: isThreadBlocked(t)}"
|
||||
@click="$emit('select', t.id)"
|
||||
@contextmenu="onContextMenu($event, t)"
|
||||
@touchstart.passive="onTouchStart($event, t)"
|
||||
@touchend="clearLongPress"
|
||||
@touchmove="clearLongPress"
|
||||
>
|
||||
<AvatarCircle :email="threadEmail(t)" :name="threadName(t)" :is-group="t.isGroup" :size="36"/>
|
||||
<div class="ti-center">
|
||||
<div class="ti-name">
|
||||
{{ threadName(t) }}
|
||||
<span v-if="isThreadBlocked(t)" class="ti-blocked-tag">
|
||||
{{ blockScopeOf(t) === 'domain' ? 'Blocked (domain)' : 'Blocked' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="ti-preview">{{ lastPreview(t) }}</div>
|
||||
</div>
|
||||
<div class="ti-right">
|
||||
<div class="ti-time">{{ formatRelative(lastTimestamp(t)) }}</div>
|
||||
<SvgIcon v-if="t.pinned" name="octicon-pin" :size="14" class="ti-pin"/>
|
||||
<span v-else-if="t.unread" class="ti-dot"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="list-section-label">Messages</div>
|
||||
<div
|
||||
v-for="t in others" :key="t.id"
|
||||
class="thread-item"
|
||||
:class="{active: t.id === activeId, unread: t.unread, blocked: isThreadBlocked(t)}"
|
||||
@click="$emit('select', t.id)"
|
||||
@contextmenu="onContextMenu($event, t)"
|
||||
@touchstart.passive="onTouchStart($event, t)"
|
||||
@touchend="clearLongPress"
|
||||
@touchmove="clearLongPress"
|
||||
>
|
||||
<AvatarCircle :email="threadEmail(t)" :name="threadName(t)" :is-group="t.isGroup" :size="36"/>
|
||||
<div class="ti-center">
|
||||
<div class="ti-name">
|
||||
{{ threadName(t) }}
|
||||
<span v-if="isThreadBlocked(t)" class="ti-blocked-tag">
|
||||
{{ blockScopeOf(t) === 'domain' ? 'Blocked (domain)' : 'Blocked' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="ti-preview">{{ lastPreview(t) }}</div>
|
||||
</div>
|
||||
<div class="ti-right">
|
||||
<div class="ti-time">{{ formatRelative(lastTimestamp(t)) }}</div>
|
||||
<SvgIcon v-if="t.pinned" name="octicon-pin" :size="14" class="ti-pin"/>
|
||||
<span v-else-if="t.unread" class="ti-dot"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!filtered.length" class="empty">No conversations found</div>
|
||||
|
||||
<!-- context menu (teleported; styles live unscoped in mail.css).
|
||||
Order: Pin, Mark unread, Delete, then an expandable Block toggle. -->
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="menu"
|
||||
class="ctx-menu"
|
||||
:style="{left: menu.x + 'px', top: menu.y + 'px'}"
|
||||
@click.stop
|
||||
>
|
||||
<button type="button" class="ctx-item" @click="pinFromMenu">
|
||||
<SvgIcon name="octicon-pin" :size="14"/>
|
||||
{{ menuThread()?.pinned ? 'Unpin' : 'Pin' }}
|
||||
</button>
|
||||
<button type="button" class="ctx-item" @click="unreadFromMenu">
|
||||
<SvgIcon name="octicon-dot-fill" :size="14"/>
|
||||
Mark unread
|
||||
</button>
|
||||
<button type="button" class="ctx-item danger" @click="deleteFromMenu">
|
||||
<SvgIcon name="octicon-trash" :size="14"/>
|
||||
Delete
|
||||
</button>
|
||||
|
||||
<!-- Block: expandable toggle (DMs only). Renders its options below. -->
|
||||
<button
|
||||
v-if="menuThread() && !menuThread()!.isGroup && !isThreadBlocked(menuThread()!)"
|
||||
type="button"
|
||||
class="ctx-item danger ctx-toggle"
|
||||
:class="{expanded: submenuOpen}"
|
||||
@click="toggleSubmenu"
|
||||
>
|
||||
<SvgIcon name="octicon-blocked" :size="14"/>
|
||||
Block
|
||||
<SvgIcon
|
||||
name="octicon-chevron-down"
|
||||
:size="12"
|
||||
class="ctx-chev"
|
||||
:class="{up: submenuOpen}"
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
v-else-if="menuThread() && !menuThread()!.isGroup && isThreadBlocked(menuThread()!)"
|
||||
type="button" class="ctx-item danger" @click="unblockFromMenu"
|
||||
>
|
||||
<SvgIcon name="octicon-blocked" :size="14"/>
|
||||
Unblock sender
|
||||
</button>
|
||||
|
||||
<!-- Expandable Block options (no icons; text flush left) -->
|
||||
<div v-if="submenuOpen && menuThread() && !menuThread()!.isGroup" class="ctx-expand">
|
||||
<button type="button" class="ctx-item danger ctx-opt" @click="blockFromMenu('user', false)">
|
||||
Block sender
|
||||
</button>
|
||||
<button type="button" class="ctx-item danger ctx-opt" @click="blockFromMenu('user', true)">
|
||||
Block & delete
|
||||
</button>
|
||||
<button type="button" class="ctx-item danger ctx-opt" @click="blockFromMenu('domain', true)">
|
||||
Block domain
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.thread-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.list-section-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 10px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text-light-2);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
padding: 12px 14px 4px;
|
||||
}
|
||||
|
||||
.thread-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 14px;
|
||||
cursor: pointer;
|
||||
min-height: 56px; /* >= 44px touch target */
|
||||
}
|
||||
|
||||
.thread-item:hover {
|
||||
background: var(--color-hover);
|
||||
}
|
||||
|
||||
.thread-item.active {
|
||||
background: var(--color-secondary-bg);
|
||||
}
|
||||
|
||||
.thread-item.blocked {
|
||||
opacity: var(--opacity-disabled);
|
||||
}
|
||||
|
||||
.ti-center {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.ti-name {
|
||||
font-size: 13px;
|
||||
font-weight: var(--font-weight-normal);
|
||||
color: var(--color-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.thread-item.unread .ti-name {
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.ti-blocked-tag {
|
||||
font-size: 10px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-danger);
|
||||
background: var(--color-red-badge-bg);
|
||||
border: 0.5px solid var(--color-red-badge);
|
||||
border-radius: var(--border-radius);
|
||||
padding: 0 4px;
|
||||
line-height: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ti-preview {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-light-2);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ti-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ti-time {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.ti-pin {
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
.ti-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: var(--border-radius-full);
|
||||
background: var(--color-primary);
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 24px 14px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,103 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
// Highlighting helpers for the in-thread search. All user-controlled text is
|
||||
// HTML-escaped before being wrapped, so the produced markup is safe to v-html.
|
||||
|
||||
// Built from char codes so the entity strings are never decoded by tooling.
|
||||
const AMP = String.fromCharCode(38);
|
||||
const ENT_AMP = `${AMP}amp;`;
|
||||
const ENT_LT = `${AMP}lt;`;
|
||||
const ENT_GT = `${AMP}gt;`;
|
||||
const ENT_QUOT = `${AMP}quot;`;
|
||||
const ENT_SQUOT = `${AMP}#39;`;
|
||||
|
||||
export function escapeHtml(s: string): string {
|
||||
return s.replace(/[&<>"']/g, (c) => {
|
||||
switch (c) {
|
||||
case '&': return ENT_AMP;
|
||||
case '<': return ENT_LT;
|
||||
case '>': return ENT_GT;
|
||||
case '"': return ENT_QUOT;
|
||||
default: return ENT_SQUOT; // '
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function escapeRegExp(s: string): string {
|
||||
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
// Wraps case-insensitive occurrences of `query` in <mark> inside the plain
|
||||
// text `text`. Returns HTML safe for v-html. Empty query returns escaped text.
|
||||
export function highlightPlainText(text: string, query: string): string {
|
||||
const escaped = escapeHtml(text);
|
||||
const q = query.trim();
|
||||
if (!q) return escaped;
|
||||
const pattern = new RegExp(`(${escapeRegExp(escapeHtml(q))})`, 'gi');
|
||||
// Trusted wrapper literal around already-escaped content.
|
||||
// eslint-disable-next-line gitea/unescaped-html-literal
|
||||
return escaped.replace(pattern, '<mark class="search-hit">$1</mark>');
|
||||
}
|
||||
|
||||
// Returns true if `text` contains `query` (case-insensitive). Used to build
|
||||
// the match list without constructing HTML.
|
||||
export function textMatches(text: string, query: string): boolean {
|
||||
const q = query.trim();
|
||||
if (!q) return false;
|
||||
return text.toLowerCase().includes(q.toLowerCase());
|
||||
}
|
||||
|
||||
// Visible text of an HTML fragment, used for match counting and searching.
|
||||
export function htmlTextContent(html: string): string {
|
||||
// Wrapping root is a trusted fixed literal.
|
||||
// eslint-disable-next-line gitea/unescaped-html-literal
|
||||
const doc = new DOMParser().parseFromString(`<div id="root">${html}</div>`, 'text/html');
|
||||
return doc.querySelector<HTMLElement>('#root')!.textContent ?? '';
|
||||
}
|
||||
|
||||
// Wraps occurrences of `query` inside the text nodes of an HTML string,
|
||||
// leaving tags/attributes untouched. Returns HTML safe for v-html. The input
|
||||
// is assumed already-sanized; this only mutates TEXT_NODE children.
|
||||
export function highlightHtml(html: string, query: string): string {
|
||||
const q = query.trim();
|
||||
if (!q) return html;
|
||||
// Wrapping root is a trusted fixed literal.
|
||||
// eslint-disable-next-line gitea/unescaped-html-literal
|
||||
const doc = new DOMParser().parseFromString(`<div id="root">${html}</div>`, 'text/html');
|
||||
const root = doc.querySelector<HTMLElement>('#root')!;
|
||||
const walker = doc.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
||||
const targets: Text[] = [];
|
||||
let node = walker.nextNode();
|
||||
while (node) {
|
||||
targets.push(node as Text);
|
||||
node = walker.nextNode();
|
||||
}
|
||||
const pattern = new RegExp(escapeRegExp(q), 'gi');
|
||||
for (const textNode of targets) {
|
||||
const value = textNode.nodeValue ?? '';
|
||||
if (!pattern.test(value)) continue;
|
||||
pattern.lastIndex = 0;
|
||||
const frag = splitAndMark(doc, value, pattern);
|
||||
textNode.replaceWith(frag);
|
||||
}
|
||||
return root.innerHTML;
|
||||
}
|
||||
|
||||
function splitAndMark(doc: Document, value: string, pattern: RegExp): DocumentFragment {
|
||||
const frag = doc.createDocumentFragment();
|
||||
let last = 0;
|
||||
let match: RegExpExecArray | null;
|
||||
pattern.lastIndex = 0;
|
||||
while ((match = pattern.exec(value)) !== null) {
|
||||
if (match.index > last) frag.append(doc.createTextNode(value.slice(last, match.index)));
|
||||
const mark = doc.createElement('mark');
|
||||
mark.className = 'search-hit';
|
||||
mark.textContent = match[0];
|
||||
frag.append(mark);
|
||||
last = match.index + match[0].length;
|
||||
if (match[0].length === 0) pattern.lastIndex++; // avoid zero-width loop
|
||||
}
|
||||
if (last < value.length) frag.append(doc.createTextNode(value.slice(last)));
|
||||
return frag;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
import {createApp} from 'vue';
|
||||
import MailApp from './MailApp.vue';
|
||||
|
||||
// Mounts the M8SH Mail Vue app into the #mail-app element rendered by mail.tmpl.
|
||||
export function initMailApp(): void {
|
||||
const el = document.querySelector('#mail-app');
|
||||
if (el) {
|
||||
createApp(MailApp).mount(el);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
// Pure-TypeScript MD5 implementation (RFC 1321) returning a lowercase hex digest.
|
||||
// No external library, used only for building Gravatar URLs.
|
||||
|
||||
function safeAdd(x: number, y: number): number {
|
||||
const lsw = (x & 0xffff) + (y & 0xffff);
|
||||
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xffff);
|
||||
}
|
||||
|
||||
function rol(num: number, cnt: number): number {
|
||||
return (num << cnt) | (num >>> (32 - cnt));
|
||||
}
|
||||
|
||||
function cmn(q: number, a: number, b: number, x: number, s: number, t: number): number {
|
||||
return safeAdd(rol(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
||||
}
|
||||
|
||||
function ff(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number {
|
||||
return cmn((b & c) | (~b & d), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function gg(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number {
|
||||
return cmn((b & d) | (c & ~d), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function hh(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number {
|
||||
return cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
|
||||
function ii(a: number, b: number, c: number, d: number, x: number, s: number, t: number): number {
|
||||
return cmn(c ^ (b | ~d), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function coreMD5(x: number[], len: number): number[] {
|
||||
x[len >> 5] |= 0x80 << (len % 32);
|
||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||||
|
||||
let a = 1732584193;
|
||||
let b = -271733879;
|
||||
let c = -1732584194;
|
||||
let d = 271733878;
|
||||
|
||||
for (let i = 0; i < x.length; i += 16) {
|
||||
const olda = a;
|
||||
const oldb = b;
|
||||
const oldc = c;
|
||||
const oldd = d;
|
||||
|
||||
a = ff(a, b, c, d, x[i], 7, -680876936);
|
||||
d = ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||
c = ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||
b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||
a = ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||
d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||
c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||
b = ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||
a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||
d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||
c = ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||
b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||
a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||
d = ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||
c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||
b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||
|
||||
a = gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||
d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||
c = gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||
b = gg(b, c, d, a, x[i], 20, -373897302);
|
||||
a = gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||
d = gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||
c = gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||
b = gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||
a = gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||
d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||
c = gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||
b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||
a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||
d = gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||
c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||
b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||
|
||||
a = hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||
d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||
c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||
b = hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||
a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||
d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||
c = hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||
b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||
a = hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||
d = hh(d, a, b, c, x[i], 11, -358537222);
|
||||
c = hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||
b = hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||
a = hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||
d = hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||
c = hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||
b = hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||
|
||||
a = ii(a, b, c, d, x[i], 6, -198630844);
|
||||
d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||
c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||
b = ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||
a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||
d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||
c = ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||
b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||
a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||
d = ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||
c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||
b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||
a = ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||
d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||
c = ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||
b = ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||
|
||||
a = safeAdd(a, olda);
|
||||
b = safeAdd(b, oldb);
|
||||
c = safeAdd(c, oldc);
|
||||
d = safeAdd(d, oldd);
|
||||
}
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
// Pack the 4 state words into a binary-style string (16 chars, one per byte, big-endian per word).
|
||||
function binl2rstr(input: number[]): string {
|
||||
let output = '';
|
||||
for (let i = 0; i < input.length * 32; i += 8) {
|
||||
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function bytes2binl(bytes: Uint8Array): number[] {
|
||||
const output: number[] = [];
|
||||
for (let i = 0; i < bytes.length * 8; i += 8) {
|
||||
output[i >> 5] |= (bytes[i / 8] & 0xff) << (i % 32);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
function digestBytes(bytes: Uint8Array): string {
|
||||
return binl2rstr(coreMD5(bytes2binl(bytes), bytes.length * 8));
|
||||
}
|
||||
|
||||
function utf8Bytes(input: string): Uint8Array {
|
||||
return new TextEncoder().encode(input);
|
||||
}
|
||||
|
||||
function rstr2hex(input: string): string {
|
||||
const hexTab = '0123456789abcdef';
|
||||
let output = '';
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
const x = input.charCodeAt(i);
|
||||
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
// Public entry point: MD5 hex digest of a UTF-8 encoded string.
|
||||
export function md5(s: string): string {
|
||||
return rstr2hex(digestBytes(utf8Bytes(s)));
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
// Minimal HTML allowlist sanitizer for the mock HTML email card.
|
||||
// Strips <script>, <iframe>, on* attributes and a small denylist of tags.
|
||||
// This is NOT a full sanitizer, only a "simple allowlist" as requested for the mock UI.
|
||||
|
||||
const ALLOWED_TAGS = new Set([
|
||||
'a', 'b', 'i', 'u', 's', 'em', 'strong', 'p', 'br', 'hr',
|
||||
'ul', 'ol', 'li', 'blockquote', 'pre', 'code',
|
||||
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
||||
'div', 'span', 'table', 'thead', 'tbody', 'tr', 'th', 'td',
|
||||
'img', 'hr',
|
||||
]);
|
||||
|
||||
export function sanitizeHtml(input: string): string {
|
||||
// Wrapping root container is a fixed trusted literal, not user input.
|
||||
// eslint-disable-next-line gitea/unescaped-html-literal
|
||||
const doc = new DOMParser().parseFromString(`<div id="root">${input}</div>`, 'text/html');
|
||||
const root = doc.querySelector<HTMLElement>('#root')!;
|
||||
cleanNode(root);
|
||||
return root.innerHTML;
|
||||
}
|
||||
|
||||
function cleanNode(node: HTMLElement): void {
|
||||
// iterate over a static snapshot since we mutate during traversal
|
||||
const children = Array.from(node.children) as HTMLElement[];
|
||||
for (const child of children) {
|
||||
const tag = child.tagName.toLowerCase();
|
||||
|
||||
// drop forbidden elements entirely (including children) by spec: script/iframe/object/embed
|
||||
if (tag === 'script' || tag === 'iframe' || tag === 'object' || tag === 'embed' || tag === 'style') {
|
||||
child.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
// for tags not on the allowlist, unwrap: keep children, drop the wrapper
|
||||
if (!ALLOWED_TAGS.has(tag)) {
|
||||
unwrap(child);
|
||||
continue;
|
||||
}
|
||||
|
||||
// scrub attributes: remove on* handlers and javascript: URLs
|
||||
for (const attr of Array.from(child.attributes)) {
|
||||
const name = attr.name.toLowerCase();
|
||||
const value = attr.value.trim().toLowerCase();
|
||||
if (name.startsWith('on')) {
|
||||
child.removeAttribute(attr.name);
|
||||
continue;
|
||||
}
|
||||
// Block javascript: navigation/handlers; the literal below is a denylist prefix, not a URL.
|
||||
// eslint-disable-next-line no-script-url
|
||||
if ((name === 'href' || name === 'src') && value.startsWith('javascript:')) {
|
||||
child.removeAttribute(attr.name);
|
||||
}
|
||||
}
|
||||
|
||||
// recurse into surviving element
|
||||
cleanNode(child);
|
||||
}
|
||||
}
|
||||
|
||||
function unwrap(el: HTMLElement): void {
|
||||
const parent = el.parentNode;
|
||||
if (!parent) return;
|
||||
// move children before the element, then remove the element
|
||||
while (el.firstChild) parent.insertBefore(el.firstChild, el);
|
||||
el.remove();
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
import type {Thread} from './types.ts';
|
||||
|
||||
// ---- Thread display-name resolution ---------------------------------------
|
||||
// Centralised so the backend merge is obvious: swap these functions with
|
||||
// API-derived fields without touching component templates.
|
||||
|
||||
// otherParticipant returns the non-self participant for a DM thread.
|
||||
export function otherParticipant(t: Thread) {
|
||||
return t.participants.find((p) => !p.self) ?? t.participants[0];
|
||||
}
|
||||
|
||||
// lastGroupTheme returns the most recent name for a group thread, derived from
|
||||
// the last "name-change" message, falling back to the thread subject. This makes
|
||||
// the list title track renames that happened mid-conversation.
|
||||
export function lastGroupTheme(t: Thread): string {
|
||||
for (let i = t.messages.length - 1; i >= 0; i--) {
|
||||
const m = t.messages[i];
|
||||
if (m.kind === 'name-change') return m.body;
|
||||
}
|
||||
return t.subject;
|
||||
}
|
||||
|
||||
// participantLabel returns the display name for a DM participant, falling back
|
||||
// to the email localpart. This maps to the email "From:" field for the backend merge.
|
||||
export function participantLabel(t: Thread): string {
|
||||
const other = otherParticipant(t);
|
||||
return other.name || other.email.slice(0, other.email.indexOf('@'));
|
||||
}
|
||||
|
||||
// threadDisplayName returns the compact label for the thread list (left bar):
|
||||
// name only, no email address. Group: last theme; DM: participant label.
|
||||
export function threadDisplayName(t: Thread): string {
|
||||
if (t.isGroup) return lastGroupTheme(t);
|
||||
return participantLabel(t);
|
||||
}
|
||||
|
||||
// threadHeaderTitle returns the full label for the chat header (right panel):
|
||||
// includes the email address for DMs. Group: last theme; DM: "Name <email>".
|
||||
export function threadHeaderTitle(t: Thread): string {
|
||||
if (t.isGroup) return lastGroupTheme(t);
|
||||
const other = otherParticipant(t);
|
||||
return `${participantLabel(t)} <${other.email}>`;
|
||||
}
|
||||
|
||||
// threadAvatarEmail returns the email used for avatar resolution.
|
||||
export function threadAvatarEmail(t: Thread): string {
|
||||
if (t.isGroup) return '';
|
||||
return otherParticipant(t).email;
|
||||
}
|
||||
@@ -0,0 +1,420 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
// Core domain types for the M8SH Mail frontend. All data is mock-only,
|
||||
// there is no real backend yet, so everything lives in the MOCK constant below.
|
||||
|
||||
export type Participant = {
|
||||
email: string;
|
||||
name?: string; // display name override, otherwise derived from localpart
|
||||
self?: boolean; // marks the current user (Danila)
|
||||
};
|
||||
|
||||
export type MessageKind = 'text' | 'html' | 'subject-change' | 'name-change';
|
||||
|
||||
// Attachment is a pure-frontend mock: the data URL lives in memory for the session.
|
||||
// In a real app this would be a server-uploaded blob reference.
|
||||
export type Attachment = {
|
||||
id: string;
|
||||
name: string;
|
||||
mime: string;
|
||||
size: number; // bytes
|
||||
url: string; // object URL or data URL (in-memory, valid for the session)
|
||||
kind: 'image' | 'video' | 'audio' | 'file'; // derived from mime for rendering
|
||||
};
|
||||
|
||||
// ForwardedContent is a recursive tree: a forwarded message can itself contain
|
||||
// forwarded content (a forward of a forward). The UI renders up to MAX_FORWARD_DEPTH
|
||||
// layers visibly; deeper layers collapse into a folded "N more layers" card.
|
||||
export type ForwardedContent = {
|
||||
from: Participant; // original sender of the forwarded message
|
||||
subject?: string; // subject at the time of the original
|
||||
body: string; // original body (plain text; HTML forwards keep kind='html' on the carrier)
|
||||
timestamp: number; // original timestamp
|
||||
forwarded?: ForwardedContent; // nested forwarded content (one level deeper)
|
||||
};
|
||||
|
||||
export type Message = {
|
||||
id: string;
|
||||
sender: Participant; // ignored for subject/name change meta messages
|
||||
kind: MessageKind;
|
||||
body: string; // plain text for 'text', sanitized HTML for 'html', the new value for changes
|
||||
subject?: string; // subject in effect at this message (for DM context)
|
||||
timestamp: number; // unix ms
|
||||
attachments?: Attachment[]; // attached files (images, videos, audio, documents)
|
||||
forwarded?: ForwardedContent; // present when this message is a forward envelope (single)
|
||||
quotes?: ForwardedContent[]; // multiple forwarded messages grouped together (siblings, same level)
|
||||
};
|
||||
|
||||
export type Thread = {
|
||||
id: string;
|
||||
isGroup: boolean;
|
||||
subject: string; // current subject (DM) or group title
|
||||
participants: Participant[]; // for DM: [self, other]; for group: [self, ...members]
|
||||
messages: Message[];
|
||||
pinned: boolean;
|
||||
unread: boolean;
|
||||
};
|
||||
|
||||
export type AvatarCache = {
|
||||
// resolved avatar URL per email ('' means resolved-but-fallback, undefined = pending)
|
||||
get(email: string): string | undefined;
|
||||
set(email: string, url: string): void;
|
||||
};
|
||||
|
||||
// ---- Block feature -------------------------------------------------------
|
||||
// Mock-only: the block list lives in memory for this session. A real backend
|
||||
// would persist this. 'user' blocks an email; 'domain' blocks the whole domain.
|
||||
|
||||
export type BlockScope = 'user' | 'domain';
|
||||
|
||||
export type BlockEntry = {
|
||||
email: string; // exact address for 'user', the domain (no @) for 'domain'
|
||||
scope: BlockScope;
|
||||
};
|
||||
|
||||
// domainOf returns the part after '@', lowercased, or '' if none.
|
||||
export function domainOf(email: string): string {
|
||||
const at = email.indexOf('@');
|
||||
return at < 0 ? '' : email.slice(at + 1).toLowerCase();
|
||||
}
|
||||
|
||||
// ---- Forwarding feature --------------------------------------------------
|
||||
// Forwarded messages render recursively. We show up to MAX_FORWARD_DEPTH
|
||||
// nested layers visibly; anything deeper collapses into a folded "N more
|
||||
// forwarded layers" card that can be expanded inline.
|
||||
export const MAX_FORWARD_DEPTH = 2;
|
||||
|
||||
// forwardedDepth counts how many nested ForwardedContent layers exist.
|
||||
export function forwardedDepth(fc: ForwardedContent): number {
|
||||
let depth = 1;
|
||||
let cur: ForwardedContent | undefined = fc.forwarded;
|
||||
while (cur) { depth++; cur = cur.forwarded }
|
||||
return depth;
|
||||
}
|
||||
|
||||
// ---- Mock data ----------------------------------------------------------
|
||||
// Hardcoded exactly as specified. Timestamps are fixed offsets from a base so
|
||||
// the relative ordering reads naturally in the UI.
|
||||
|
||||
const now = Date.UTC(2026, 5, 25, 7, 0, 0); // stable base for reproducible previews
|
||||
const min = 60_000;
|
||||
const hour = 60 * min;
|
||||
const day = 24 * hour;
|
||||
|
||||
const self: Participant = {email: 'd@m8sh.su', name: 'Danila', self: true};
|
||||
|
||||
// The HTML body for the OpenAI mock email. It is a fixture string that is later
|
||||
// passed through the allowlist sanitizer (sanitizeHtml) before v-html rendering,
|
||||
// so the literals here are trusted input, not rendered directly.
|
||||
/* eslint-disable gitea/unescaped-html-literal */
|
||||
const openaiHtmlBody = [
|
||||
'<div style="font-family: var(--fonts-regular, sans-serif);">',
|
||||
'<h2 style="margin:0 0 8px;">Your weekly summary</h2>',
|
||||
'<p style="margin:0 0 12px;">Here is what happened across your workspace this week.</p>',
|
||||
'<table style="width:100%;border-collapse:collapse;">',
|
||||
'<tr><th style="text-align:left;border-bottom:0.5px solid #ccc;padding:6px 0;">Metric</th>',
|
||||
'<th style="text-align:right;border-bottom:0.5px solid #ccc;padding:6px 0;">Value</th></tr>',
|
||||
'<tr><td style="padding:6px 0;">Messages sent</td><td style="text-align:right;">128</td></tr>',
|
||||
'<tr><td style="padding:6px 0;">Replies received</td><td style="text-align:right;">42</td></tr>',
|
||||
'</table>',
|
||||
'<pre style="background:#f2f5f8;padding:8px;border-radius:4px;">commit a1b2c3d\nAuthor: you\nDate: Mon\n ship it</pre>',
|
||||
'<p style="margin:12px 0 0;">Reply to this email if you have questions.</p>',
|
||||
'</div>',
|
||||
].join('');
|
||||
/* eslint-enable gitea/unescaped-html-literal */
|
||||
|
||||
const MOCK: Thread[] = [
|
||||
{
|
||||
id: 'dm-danila',
|
||||
isGroup: false,
|
||||
subject: 'Weekend plans',
|
||||
pinned: false,
|
||||
unread: false,
|
||||
participants: [
|
||||
self,
|
||||
{email: 'd@m8sh.su', name: 'Danila'}, // echoed as the other side is also danila here per spec
|
||||
],
|
||||
messages: [
|
||||
{
|
||||
id: 'm1',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila'},
|
||||
kind: 'text',
|
||||
subject: 'Weekend plans',
|
||||
body: 'Hey, are you free this Saturday? Thinking about a hike up the ridge.',
|
||||
timestamp: now - 3 * day,
|
||||
},
|
||||
{
|
||||
id: 'm2',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: 'Weekend plans',
|
||||
body: 'Saturday works. Bring water and the old map, the trailhead signal is bad.',
|
||||
timestamp: now - 3 * day + 12 * min,
|
||||
},
|
||||
{
|
||||
id: 'm3',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila'},
|
||||
kind: 'subject-change',
|
||||
subject: 'Sunday backup plan',
|
||||
body: 'Sunday backup plan',
|
||||
timestamp: now - 3 * day + 40 * min,
|
||||
},
|
||||
{
|
||||
id: 'm4',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila'},
|
||||
kind: 'text',
|
||||
subject: 'Sunday backup plan',
|
||||
body: 'If it rains we reschedule to Sunday morning, same time. Sound good?',
|
||||
timestamp: now - 3 * day + 42 * min,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dm-d1nch8g',
|
||||
isGroup: false,
|
||||
subject: 'Server logs',
|
||||
pinned: false,
|
||||
unread: false,
|
||||
participants: [
|
||||
self,
|
||||
{email: 'd1nch8g@gmail.com', name: 'd1nch8g'},
|
||||
],
|
||||
messages: [
|
||||
{
|
||||
id: 'd1',
|
||||
sender: {email: 'd1nch8g@gmail.com', name: 'd1nch8g'},
|
||||
kind: 'text',
|
||||
subject: 'Server logs',
|
||||
body: 'Pulled last nights logs, the worker pool is OOMing around 03:00.',
|
||||
timestamp: now - day,
|
||||
},
|
||||
{
|
||||
id: 'd2',
|
||||
sender: {email: 'd1nch8g@gmail.com', name: 'd1nch8g'},
|
||||
kind: 'text',
|
||||
subject: 'Server logs',
|
||||
body: 'Looks like the queue depth spike lines up with the backup job. Coincidence?',
|
||||
timestamp: now - day + 9 * min,
|
||||
},
|
||||
{
|
||||
id: 'd3',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: 'Server logs',
|
||||
body: 'Not a coincidence. I will cap the backup concurrency tonight and watch it.',
|
||||
timestamp: now - day + 25 * min,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dm-openai',
|
||||
isGroup: false,
|
||||
subject: 'Your weekly summary',
|
||||
pinned: true,
|
||||
unread: true,
|
||||
participants: [
|
||||
self,
|
||||
{email: 'noreply@email.anthropic.com', name: 'OpenAI'},
|
||||
],
|
||||
messages: [
|
||||
{
|
||||
id: 'o1',
|
||||
sender: {email: 'noreply@email.openai.com', name: 'OpenAI'},
|
||||
kind: 'html',
|
||||
subject: 'Your weekly summary',
|
||||
body: openaiHtmlBody,
|
||||
timestamp: now - 6 * hour,
|
||||
},
|
||||
{
|
||||
id: 'o2',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: 'Your weekly summary',
|
||||
body: 'Thanks, the reply count looks lower than usual, any known issue?',
|
||||
timestamp: now - 5 * hour,
|
||||
},
|
||||
{
|
||||
id: 'o3',
|
||||
sender: {email: 'noreply@email.openai.com', name: 'OpenAI'},
|
||||
kind: 'text',
|
||||
subject: 'Your weekly summary',
|
||||
body: 'No known issue, counts exclude automated traffic by design.',
|
||||
timestamp: now - 4 * hour,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'group-backend-sync',
|
||||
isGroup: true,
|
||||
subject: 'Backend sync',
|
||||
pinned: false,
|
||||
unread: false,
|
||||
participants: [
|
||||
self,
|
||||
{email: 'mem@first.com', name: 'mem'},
|
||||
{email: 'jam@second.com', name: 'jam'},
|
||||
],
|
||||
messages: [
|
||||
{
|
||||
id: 'g1',
|
||||
sender: {email: 'mem@first.com', name: 'mem'},
|
||||
kind: 'text',
|
||||
subject: 'Backend sync',
|
||||
body: 'Standup in 5. I am blocked on the auth migration, need a second pair of eyes.',
|
||||
timestamp: now - 2 * day,
|
||||
},
|
||||
{
|
||||
id: 'g2',
|
||||
sender: {email: 'jam@second.com', name: 'jam'},
|
||||
kind: 'text',
|
||||
subject: 'Backend sync',
|
||||
body: 'I can pair after standup. Do you have a failing test I can reproduce?',
|
||||
timestamp: now - 2 * day + 5 * min,
|
||||
},
|
||||
{
|
||||
id: 'g3',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: 'Backend sync',
|
||||
body: 'Pushed a repro branch: backend/auth-migration-repro. CI is red, logs attached.',
|
||||
timestamp: now - 2 * day + 11 * min,
|
||||
},
|
||||
{
|
||||
id: 'g4',
|
||||
sender: {email: 'mem@first.com', name: 'mem'},
|
||||
kind: 'name-change',
|
||||
subject: 'Backend sync',
|
||||
body: 'Backend sync',
|
||||
timestamp: now - 2 * day + 30 * min,
|
||||
},
|
||||
{
|
||||
id: 'g5',
|
||||
sender: {email: 'jam@second.com', name: 'jam'},
|
||||
kind: 'text',
|
||||
subject: 'Backend sync',
|
||||
body: 'Found it, the migration was missing a NOT NULL default. Fix incoming.',
|
||||
timestamp: now - 2 * day + 48 * min,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dm-random',
|
||||
isGroup: false,
|
||||
subject: 'Hello',
|
||||
pinned: false,
|
||||
unread: false,
|
||||
participants: [
|
||||
self,
|
||||
{email: 'random@example.com', name: 'random'},
|
||||
],
|
||||
messages: [
|
||||
{
|
||||
id: 'r1',
|
||||
sender: {email: 'random@example.com', name: 'random'},
|
||||
kind: 'text',
|
||||
subject: 'Hello',
|
||||
body: 'Hi, found your project through search. Is it open to external contributors?',
|
||||
timestamp: now - 5 * hour,
|
||||
},
|
||||
{
|
||||
id: 'r2',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: 'Hello',
|
||||
body: 'Yes, always. Open an issue first so we can scope it together.',
|
||||
timestamp: now - 4 * hour,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// Forwarding demo: shows a deeply-nested forward chain. The outer message is
|
||||
// forwarded (layer 1), which itself contains a forwarded message (layer 2),
|
||||
// which contains another (layer 3) and another (layer 4). Per spec, only the
|
||||
// first MAX_FORWARD_DEPTH (2) layers render openly; the rest collapse into a
|
||||
// "N more forwarded layers" card.
|
||||
id: 'dm-forward-demo',
|
||||
isGroup: false,
|
||||
subject: 'FW: nested context',
|
||||
pinned: false,
|
||||
unread: true,
|
||||
participants: [
|
||||
self,
|
||||
{email: 'forward@example.com', name: 'forward'},
|
||||
],
|
||||
messages: [
|
||||
{
|
||||
id: 'f0',
|
||||
sender: {email: 'forward@example.com', name: 'forward'},
|
||||
kind: 'text',
|
||||
subject: 'FW: nested context',
|
||||
body: 'Here is the full chain for context, see the nested forwards below.',
|
||||
timestamp: now - 30 * min,
|
||||
// depth 4: forward(forward(forward(forward(original))))
|
||||
forwarded: {
|
||||
from: {email: 'layer1@example.com', name: 'Alice'},
|
||||
subject: 'Re: spec clarification',
|
||||
body: 'Layer 1 forward: agreed, let me pull in the original discussion.',
|
||||
timestamp: now - 2 * hour,
|
||||
forwarded: {
|
||||
from: {email: 'layer2@example.com', name: 'Bob'},
|
||||
subject: 'Re: spec clarification',
|
||||
body: 'Layer 2 forward: here is the thread that started this, for reference.',
|
||||
timestamp: now - 5 * hour,
|
||||
forwarded: {
|
||||
from: {email: 'layer3@example.com', name: 'Carol'},
|
||||
subject: 'spec clarification',
|
||||
body: 'Layer 3 forward: the original question was about depth limits.',
|
||||
timestamp: now - 9 * hour,
|
||||
forwarded: {
|
||||
from: {email: 'layer4@example.com', name: 'Dave'},
|
||||
subject: 'spec clarification',
|
||||
body: 'Layer 4 (original): how deep should forwarded nesting render?',
|
||||
timestamp: now - day,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'f1',
|
||||
sender: {email: 'd@m8sh.su', name: 'Danila', self: true},
|
||||
kind: 'text',
|
||||
subject: 'FW: nested context',
|
||||
body: 'Got it. The depth-2 collapse looks right, the rest stays folded.',
|
||||
timestamp: now - 10 * min,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function cloneMock(): Thread[] {
|
||||
// deep clone so in-memory mutations during the session never leak back into MOCK
|
||||
return structuredClone(MOCK);
|
||||
}
|
||||
|
||||
export const SELF_EMAIL = 'd@m8sh.su';
|
||||
|
||||
// attachmentKindOf classifies a mime type (or filename extension) into a rendering category.
|
||||
// Falls back to extension parsing when the browser doesn't provide a useful mime.
|
||||
export function attachmentKindOf(mime: string, filename?: string): Attachment['kind'] {
|
||||
const m = mime.toLowerCase();
|
||||
if (m.startsWith('image/')) return 'image';
|
||||
if (m.startsWith('video/')) return 'video';
|
||||
if (m.startsWith('audio/')) return 'audio';
|
||||
// extension fallback for files where browser reports empty/generic mime
|
||||
if (filename) {
|
||||
const ext = filename.toLowerCase().split('.').pop() ?? '';
|
||||
if (['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'ico', 'avif'].includes(ext)) return 'image';
|
||||
if (['mp4', 'webm', 'ogv', 'mov', 'avi', 'mkv', 'm4v'].includes(ext)) return 'video';
|
||||
if (['mp3', 'ogg', 'wav', 'flac', 'aac', 'm4a', 'oga', 'opus'].includes(ext)) return 'audio';
|
||||
}
|
||||
return 'file';
|
||||
}
|
||||
|
||||
// formatFileSize formats bytes into a human-readable string.
|
||||
export function formatFileSize(bytes: number): string {
|
||||
if (bytes < 1024) return `${bytes} B`;
|
||||
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
||||
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Copyright 2026 The M8SH Authors.
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
|
||||
import {reactive} from 'vue';
|
||||
import {md5} from './md5.ts';
|
||||
|
||||
// Resolution state per email: undefined = pending, '' = resolved-to-fallback, otherwise the URL.
|
||||
export type ResolvedAvatar = string | undefined;
|
||||
|
||||
// Module-level shared reactive cache so all AvatarCircle instances reuse results
|
||||
// and re-render automatically when a resolution lands in the same session.
|
||||
const cache = reactive(new Map<string, ResolvedAvatar>());
|
||||
// Track in-flight promises to avoid duplicate network work for the same email.
|
||||
const inflight = new Map<string, Promise<void>>();
|
||||
|
||||
// Kick off (idempotent) resolution for an email. Safe to call repeatedly.
|
||||
export function resolveAvatar(email: string): void {
|
||||
const key = email.toLowerCase();
|
||||
if (cache.has(key) || inflight.has(key)) return;
|
||||
const p = runChain(key).finally(() => inflight.delete(key));
|
||||
inflight.set(key, p);
|
||||
}
|
||||
|
||||
export function getAvatar(email: string): ResolvedAvatar {
|
||||
return cache.get(email.toLowerCase());
|
||||
}
|
||||
|
||||
// Composable returning the reactive cache for components that read many avatars.
|
||||
export function useAvatarResolver() {
|
||||
return {cache, resolve: resolveAvatar, get: getAvatar};
|
||||
}
|
||||
|
||||
// The instance default avatar URL (served from the standard Gitea assets path).
|
||||
// Shown immediately as the fallback; a real avatar replaces it once confirmed.
|
||||
export const DEFAULT_AVATAR_URL = `${window.config?.assetUrlPrefix ?? ''}/img/avatar_default.png`;
|
||||
|
||||
// Avatar resolution pipeline: Gitea -> Gravatar -> Favicon -> Instance default.
|
||||
async function runChain(email: string): Promise<void> {
|
||||
const [localpart, domain] = splitEmail(email);
|
||||
|
||||
// 1. Gitea avatar: https://<domain>/<localpart>.png (303-redirects to real avatar on m8sh.su).
|
||||
if (domain && localpart) {
|
||||
const giteaUrl = `https://${domain}/${localpart}.png`;
|
||||
if (await probeImage(giteaUrl)) {
|
||||
cache.set(email, giteaUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Gravatar (d=404: only real avatars return 200).
|
||||
const gravatarUrl = `https://www.gravatar.com/avatar/${md5(email)}?d=404&s=72`;
|
||||
if (await probeImage(gravatarUrl)) {
|
||||
cache.set(email, gravatarUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Company favicon via DuckDuckGo on the registrable domain.
|
||||
// DDG returns 404 for non-existent domains (<img> fires onerror -> probeImage fails)
|
||||
// and 200 for real domains (<img> fires onload -> probeImage succeeds).
|
||||
// No CORS issue: <img> loads cross-origin images regardless of CORS headers.
|
||||
if (domain) {
|
||||
const ddgUrl = `https://${registrableDomain(domain)}/favicon.ico`;
|
||||
if (await probeImage(ddgUrl)) {
|
||||
cache.set(email, ddgUrl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Fallback: the instance's default avatar (the gopher).
|
||||
cache.set(email, '');
|
||||
}
|
||||
|
||||
function splitEmail(email: string): [string, string] {
|
||||
const at = email.indexOf('@');
|
||||
if (at < 0) return ['', ''];
|
||||
return [email.slice(0, at), email.slice(at + 1)];
|
||||
}
|
||||
|
||||
// Load a URL as an Image and resolve to true only if it actually renders.
|
||||
// <img> tags follow redirects and can display cross-origin images without CORS headers.
|
||||
function probeImage(url: string): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const img = new Image();
|
||||
img.addEventListener('load', () => resolve(true));
|
||||
img.addEventListener('error', () => resolve(false));
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
// registrableDomain extracts the last two labels of a domain (e.g. "openai.com" from "email.openai.com").
|
||||
function registrableDomain(domain: string): string {
|
||||
const parts = domain.split('.');
|
||||
if (parts.length <= 2) return domain;
|
||||
return parts.slice(-2).join('.');
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { makeNonce, buildSignCommand, validateSignature } from './gpg-nonce.ts';
|
||||
import { copyToClipboard } from './../modules/clipboard.ts'
|
||||
|
||||
export function initGpgSignin() {
|
||||
const tokenField = document.querySelector<HTMLInputElement>('#token-field');
|
||||
if (!tokenField) return;
|
||||
|
||||
const nonce = makeNonce();
|
||||
const cmd = buildSignCommand(nonce);
|
||||
|
||||
tokenField.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#hidden-nonce')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#sign-command')!.value = cmd;
|
||||
|
||||
document.querySelector('#btn-copy-cmd')?.addEventListener('click', () => {
|
||||
copyToClipboard(document.querySelector<HTMLInputElement>('#sign-command')!.value);
|
||||
});
|
||||
|
||||
document.querySelector('#signin-form')?.addEventListener('submit', (e) => {
|
||||
const sig = document.querySelector<HTMLTextAreaElement>('#gpg_signature')!.value.trim();
|
||||
if (!validateSignature(sig)) {
|
||||
e.preventDefault();
|
||||
alert('Paste the GPG signed output.');
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector('#btn-copy-nonce')?.addEventListener('click', () => {
|
||||
copyToClipboard(document.querySelector<HTMLInputElement>('#token-field')!.value);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { makeNonce, buildSignCommand, validateSignature } from './gpg-nonce.ts';
|
||||
import { copyToClipboard } from './../modules/clipboard.ts'
|
||||
|
||||
export function initGpgSignup() {
|
||||
const btnProceed = document.querySelector('#btn-proceed');
|
||||
if (!btnProceed) return;
|
||||
|
||||
const nonce = makeNonce();
|
||||
|
||||
const stepSign = document.querySelector<HTMLElement>('#step-sign');
|
||||
if (stepSign && stepSign.style.display !== 'none') {
|
||||
document.querySelector<HTMLInputElement>('#token-field')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#hidden-nonce')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#sign-command')!.value = buildSignCommand(nonce);
|
||||
}
|
||||
|
||||
btnProceed.addEventListener('click', () => {
|
||||
const key = document.querySelector<HTMLTextAreaElement>('#gpg_key')!.value
|
||||
.trim()
|
||||
.replace(/\r\n/g, '\n')
|
||||
.replace(/\r/g, '\n');
|
||||
|
||||
if (!key || !key.startsWith('-----BEGIN PGP PUBLIC KEY BLOCK-----')) {
|
||||
alert('Paste a valid armored GPG public key.');
|
||||
return;
|
||||
}
|
||||
|
||||
document.querySelector<HTMLInputElement>('#token-field')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#hidden-nonce')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#hidden-gpg-key')!.value = key;
|
||||
document.querySelector<HTMLInputElement>('#sign-command')!.value = buildSignCommand(nonce);
|
||||
document.querySelector<HTMLElement>('#step-key')!.style.display = 'none';
|
||||
document.querySelector<HTMLElement>('#step-sign')!.style.display = 'block';
|
||||
});
|
||||
|
||||
document.querySelector('#btn-copy-cmd')?.addEventListener('click', () => {
|
||||
copyToClipboard(document.querySelector<HTMLInputElement>('#sign-command')!.value);
|
||||
});
|
||||
|
||||
document.querySelector('#signup-form')?.addEventListener('submit', (e) => {
|
||||
const sig = document.querySelector<HTMLTextAreaElement>('#gpg_signature')!.value.trim();
|
||||
if (!validateSignature(sig)) {
|
||||
e.preventDefault();
|
||||
alert('Paste the GPG signed output.');
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector('#btn-copy-nonce')?.addEventListener('click', () => {
|
||||
copyToClipboard(document.querySelector<HTMLInputElement>('#token-field')!.value);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import {makeNonce, buildSignCommand} from './gpg-nonce.ts';
|
||||
|
||||
export function initGpgKeySettings() {
|
||||
const addTokenField = document.querySelector<HTMLInputElement>('#add-key-token-field');
|
||||
if (addTokenField) {
|
||||
const nonce = makeNonce();
|
||||
addTokenField.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#add-key-hidden-nonce')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#add-key-sign-command')!.value = buildSignCommand(nonce);
|
||||
document.querySelector('#add-key-btn-copy-cmd')?.addEventListener('click', () => {
|
||||
navigator.clipboard.writeText(
|
||||
document.querySelector<HTMLInputElement>('#add-key-sign-command')!.value,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const verifyTokenField = document.querySelector<HTMLInputElement>('#verify-key-token-field');
|
||||
if (verifyTokenField) {
|
||||
const nonce = makeNonce();
|
||||
const keyID = document.querySelector('#verify-key-form')?.getAttribute('data-key-id') ?? undefined;
|
||||
verifyTokenField.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#verify-key-hidden-nonce')!.value = nonce;
|
||||
document.querySelector<HTMLInputElement>('#verify-key-sign-command')!.value = buildSignCommand(nonce, keyID);
|
||||
document.querySelector('#verify-key-btn-copy-cmd')?.addEventListener('click', () => {
|
||||
navigator.clipboard.writeText(
|
||||
document.querySelector<HTMLInputElement>('#verify-key-sign-command')!.value,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import '../fomantic/build/fomantic.js';
|
||||
import '../css/index.css';
|
||||
|
||||
import {initDashboardRepoList} from './features/dashboard.ts';
|
||||
import {initMailApp} from './features/mail/index.ts';
|
||||
import {initGlobalCopyToClipboardListener} from './modules/clipboard.ts';
|
||||
import {initCopyContent} from './features/copycontent.ts';
|
||||
import {initRepoGraphGit} from './features/repo-graph.ts';
|
||||
@@ -66,6 +67,9 @@ import {initActionsPermissionsForm} from './features/common-actions-permissions.
|
||||
import {initRefIssueContextPopup} from './features/ref-issue.ts';
|
||||
import {initGlobalShortcut} from './modules/shortcut.ts';
|
||||
import {initDevtest} from './modules/devtest.ts';
|
||||
import {initGpgSignup} from './features/user-auth-gpg-signup.ts';
|
||||
import {initGpgSignin} from './features/user-auth-gpg-signin.ts';
|
||||
import {initGpgKeySettings} from './features/user-settings-gpg-key.ts';
|
||||
|
||||
const initStartTime = performance.now();
|
||||
const initPerformanceTracer = callInitFunctions([
|
||||
@@ -83,6 +87,9 @@ const initPerformanceTracer = callInitFunctions([
|
||||
initGlobalComboMarkdownEditor,
|
||||
initGlobalInput,
|
||||
initGlobalShortcut,
|
||||
initGpgSignup,
|
||||
initGpgSignin,
|
||||
initGpgKeySettings,
|
||||
|
||||
initCommonOrganization,
|
||||
initCommonIssueListQuickGoto,
|
||||
@@ -111,6 +118,7 @@ const initPerformanceTracer = callInitFunctions([
|
||||
initAdminSelfCheck,
|
||||
|
||||
initDashboardRepoList,
|
||||
initMailApp,
|
||||
|
||||
initNotificationCount,
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import octiconCheckCircleFill from '../../public/assets/img/svg/octicon-check-ci
|
||||
import octiconChevronDown from '../../public/assets/img/svg/octicon-chevron-down.svg';
|
||||
import octiconChevronLeft from '../../public/assets/img/svg/octicon-chevron-left.svg';
|
||||
import octiconChevronRight from '../../public/assets/img/svg/octicon-chevron-right.svg';
|
||||
import octiconChevronUp from '../../public/assets/img/svg/octicon-chevron-up.svg';
|
||||
import octiconCircle from '../../public/assets/img/svg/octicon-circle.svg';
|
||||
import octiconClock from '../../public/assets/img/svg/octicon-clock.svg';
|
||||
import octiconCode from '../../public/assets/img/svg/octicon-code.svg';
|
||||
@@ -59,12 +60,18 @@ import octiconLink from '../../public/assets/img/svg/octicon-link.svg';
|
||||
import octiconListOrdered from '../../public/assets/img/svg/octicon-list-ordered.svg';
|
||||
import octiconListUnordered from '../../public/assets/img/svg/octicon-list-unordered.svg';
|
||||
import octiconLock from '../../public/assets/img/svg/octicon-lock.svg';
|
||||
import octiconMail from '../../public/assets/img/svg/octicon-mail.svg';
|
||||
import octiconMeter from '../../public/assets/img/svg/octicon-meter.svg';
|
||||
import octiconMilestone from '../../public/assets/img/svg/octicon-milestone.svg';
|
||||
import octiconMirror from '../../public/assets/img/svg/octicon-mirror.svg';
|
||||
import octiconOrganization from '../../public/assets/img/svg/octicon-organization.svg';
|
||||
import octiconPaperclip from '../../public/assets/img/svg/octicon-paperclip.svg';
|
||||
import octiconPaperAirplane from '../../public/assets/img/svg/octicon-paper-airplane.svg';
|
||||
import octiconPin from '../../public/assets/img/svg/octicon-pin.svg';
|
||||
import octiconPinSlash from '../../public/assets/img/svg/octicon-pin-slash.svg';
|
||||
import octiconPlay from '../../public/assets/img/svg/octicon-play.svg';
|
||||
import octiconPlus from '../../public/assets/img/svg/octicon-plus.svg';
|
||||
import octiconSmiley from '../../public/assets/img/svg/octicon-smiley.svg';
|
||||
import octiconProject from '../../public/assets/img/svg/octicon-project.svg';
|
||||
import octiconQuote from '../../public/assets/img/svg/octicon-quote.svg';
|
||||
import octiconRepo from '../../public/assets/img/svg/octicon-repo.svg';
|
||||
@@ -107,6 +114,7 @@ const svgs = {
|
||||
'octicon-chevron-down': octiconChevronDown,
|
||||
'octicon-chevron-left': octiconChevronLeft,
|
||||
'octicon-chevron-right': octiconChevronRight,
|
||||
'octicon-chevron-up': octiconChevronUp,
|
||||
'octicon-circle': octiconCircle,
|
||||
'octicon-clock': octiconClock,
|
||||
'octicon-code': octiconCode,
|
||||
@@ -148,13 +156,19 @@ const svgs = {
|
||||
'octicon-list-ordered': octiconListOrdered,
|
||||
'octicon-list-unordered': octiconListUnordered,
|
||||
'octicon-lock': octiconLock,
|
||||
'octicon-mail': octiconMail,
|
||||
'octicon-meter': octiconMeter,
|
||||
'octicon-milestone': octiconMilestone,
|
||||
'octicon-mirror': octiconMirror,
|
||||
'octicon-organization': octiconOrganization,
|
||||
'octicon-paperclip': octiconPaperclip,
|
||||
'octicon-paper-airplane': octiconPaperAirplane,
|
||||
'octicon-pin': octiconPin,
|
||||
'octicon-pin-slash': octiconPinSlash,
|
||||
'octicon-play': octiconPlay,
|
||||
'octicon-plus': octiconPlus,
|
||||
'octicon-project': octiconProject,
|
||||
'octicon-smiley': octiconSmiley,
|
||||
'octicon-quote': octiconQuote,
|
||||
'octicon-repo': octiconRepo,
|
||||
'octicon-repo-forked': octiconRepoForked,
|
||||
|
||||