v2.0重构

This commit is contained in:
Searchstars
2024-07-10 19:44:33 +08:00
parent bd924bb307
commit deda3492c3
115 changed files with 10072 additions and 12776 deletions
-2
View File
@@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
+3 -1
View File
@@ -1,5 +1,7 @@
/.nyc_output
/coverage
/node_modules
/sign
/dist
/build
/.VSCodeCounter
.husky/
+22
View File
@@ -0,0 +1,22 @@
module.exports = {
printWidth: 100, // 指定代码长度,超出换行
tabWidth: 2, // tab 键的宽度
useTabs: false, // 使用空格替代tab
semi: false, // 结尾加上分号
singleQuote: false, // 使用单引号
quoteProps: "consistent", // 要求对象字面量属性是否使用引号包裹,(‘as-needed’: 没有特殊要求,禁止使用,'consistent': 保持一致 , preserve: 不限制,想用就用)
trailingComma: "none", // 不添加对象和数组最后一个元素的逗号
bracketSpacing: false, // 对象中对空格和空行进行处理
jsxBracketSameLine: false, // 在多行JSX元素的最后一行追加 >
requirePragma: false, // 是否严格按照文件顶部的特殊注释格式化代码
insertPragma: false, // 是否在格式化的文件顶部插入Pragma标记,以表明该文件被prettier格式化过了
proseWrap: "preserve", // 按照文件原样折行
htmlWhitespaceSensitivity: "ignore", // html文件的空格敏感度,控制空格是否影响布局
endOfLine: "auto", // 结尾是 \n \r \n\r auto
overrides: [
{
files: "*.ux",
options: {parser: "vue"}
}
]
}
+44
View File
@@ -0,0 +1,44 @@
module.exports = {
extends: [
"stylelint-config-standard",
"stylelint-config-recess-order"
// "stylelint-selector-bem-pattern"
],
ignoreFiles: ["node_modules", "test", "dist", "**/*.js"],
rules: {
"no-descending-specificity": null,
"color-hex-case": "lower",
"color-hex-length": "short",
"at-rule-no-unknown": null,
"block-no-empty": null,
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ["blur"]
}
],
"property-no-unknown": [
true,
{
ignoreProperties: [
"placeholder-color",
"gradient-start",
"gradient-center",
"gradient-end",
"caret-color",
"selected-color",
"block-color"
]
}
],
"max-line-length": null,
// "indentation": 2,
// "no-empty-source": null,
"selector-type-no-unknown": [
true,
{
ignoreTypes: ["selected-color", "block-color"]
}
]
}
}
-674
View File
@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
+2 -73
View File
@@ -6,80 +6,9 @@
## 搭建开发环境
克隆此仓库,然后在`Aiot IDE`中打开它,按照IDE的提示配置环境后就可以开始开发了
克隆此仓库,然后在`Aiot IDE`中打开它
对于Aiot IDE的安装,推荐参阅:[https://www.projcora.club/OpenWearWiki/vela-developer-guide.html#preparing](https://www.projcora.club/OpenWearWiki/vela-developer-guide.html#preparing)
懒得看文档的直接从 https://kpan.mioffice.cn/webfolder/ext/iYJr4hwMLio (提取码RS85)下载对应你系统版本的Aiot-IDE就好了
***当然请一定要使用Ubuntu LTS系统,使用Windows和MacOS只会让你修问题修到头皮发麻,个人建议可以在Windows里开一个Hyper-V或VMware安装Ubuntu进行环境搭建***
## Hap链接接口
### 打开 澎湃哔哩
只是用来打开程序罢了
hap://app/com.searchstars.hyperbilibili/main
### 打开 澎湃哔哩 视频详情页
带用户到视频详情页,然后用户可以查看视频的封面、标题、AI视频总结、评论区等内容,并且可以进行添加视频到收藏夹等操作
hap://app/com.searchstars.hyperbilibili/videodetail?<params传参列表>
传参列表:
img_src 视频封面URL
vid_title 视频标题文本
bv 视频BV号
cid 视频CID
up_mid 视频UP主mid
id 视频avid
haplink 是否来自HAP链接(这个一定要设置true,除非澎湃哔哩在后台保活)
本接口传参较多,但都是从B站的 获取视频详细信息 的接口获取的,应用程序开发者可以写一个函数,专门通过视频bv号获取这些信息,然后传过来。至于B站的接口从哪找,拉到这个README的最底下就知道了
### 打开 澎湃哔哩 AI视频总结页
带用户到AI视频总结页,然后用户即可查看视频的AI视频总结。本接口相比视频详情页接口传参较少,但是留给用户的选择也较少,用户不能查看视频的标题和封面,也不能进行过多的操作,就只能看总结,因此不推荐使用
hap://app/com.searchstars.hyperbilibili/videoaisummary?<params传参列表>
传参列表:
bv 视频BV号
cid 视频CID
up_mid 视频UP主mid
haplink 是否来自HAP链接(这个一定要设置true,除非澎湃哔哩在后台保活)
同上,本接口的所有除BV号外的参数都可以通过B站的 获取视频详细信息 的接口获取,拉到README最底下就能知道在哪找B站的API了
#### 使用HAP链接请务必保证传参正确,否则 澎湃哔哩 将无法正常工作。传参格式请参考HTTP URL FORMS格式,例如 `hap://app/.../...?key=value&you=myfriend&test=ok`
#### 为什么要提供这么多的参数?不能只提供一个BV号,获取更多信息的工作交给 澎湃哔哩 程序本身来进行吗?我的回答是NO,这些HAP接口也是 澎湃哔哩 程序内部所使用的接口,由于嵌入式设备的性能有限,我们需要减少使用fetch的数量,并且只传有用信息,如果再进行视频信息获取,对于澎湃哔哩而言是无用的多余操作,对于经过细致优化的调用HAP接口的第三方应用而言,也或许会是多余操作,我们不想进行额外的优化,也不清楚第三方开发者会如何开发和设计自己的程序,因此就干脆直接这么提供接口了
## 项目结构说明
根据Vela快应用项目的开发指南,本应用的结构将确定为单ux文件设计,即所有功能都写进单个ux文件中,包括template、js、css,一个ux文件代表一个功能模块,ux文件可被本项目中的其它ux文件使用,并且部分ux页面支持hap链接,以供第三方应用程序进行调用
单ux文件会难以维护?其实我个人认为还好,特别是对于这种 ***"还是API调用大佬"*** 的应用来说,一个Fetch,小参数一传,就都搞定了
项目Pages UX文件用途介绍:
main:程序入口
login:登录页面
home:主页面
myfolders:收藏夹列表
foldercontent:收藏夹内容
history:历史记录
networkerror:网络错误提示
replydetail:评论详情
settings:设置
textshow:你可以理解为messagebox
videoaisummary:视频AI总结 (开放HAP链接接口)
videodetail:视频详情页 (开放HAP链接接口)
videopush:视频首页推送页
videoreplies:视频回复页
## 旧版模拟器运行注意事项
### 如果您在使用最新版本的Aiot-IDE,并将其附带的所有插件都已更新到最新版本(如果你能忍受最新版插件与IDE带来的各种Bug的话),且使用的模拟器镜像是最新版本,则可以忽略这些内容
模拟器和真机环境环境归根结底还是有所不同,部分功能的效果在模拟器和真机上的区别也不是可以忽略的,甚至可以直接影响到程序逻辑
因此,我们设置了一个叫`emu_mode`的变量,当它为true时,部分检测功能(如网络类型判定)会被禁用,只有这样,应用才能正常在模拟器下运行,否则将会产生误判导致出现异常。
所以,在使用模拟器开发的过程中,请到`src/app.ux`中的`script`标签下的`emu_mode`变量设置为true,***但是请千万不要忘记,打要装到真机上的rpk包时,请务必把它设置回false!***
`npm i -D typescript ts-loader`
## 开发文档
+21
View File
@@ -0,0 +1,21 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
[
"bug", // 此项特别针对bug号,用于向测试反馈bug列表的bug修改情况
"feat", // 新功能(feature
"fix", // 修补bug
"docs", // 文档(documentation
"style", // 格式(不影响代码运行的变动)
"refactor", // 重构(即不是新增功能,也不是修改bug的代码变动)
"test", // 增加测试
"chore", // 构建过程或辅助工具的变动
"revert", // feat(pencil): add graphiteWidth option (撤销之前的commit)
"merge" // 合并分支, 例如: merge(前端页面): feature-xxxx修改线程地址
]
]
}
}
+41
View File
@@ -0,0 +1,41 @@
# 转换视频为序列帧
# 需要安装opencv
import cv2
import os
def video_to_frames(video_path, output_folder, prefix):
# 创建输出文件夹
if not os.path.exists(output_folder):
os.makedirs(output_folder)
# 打开视频文件
cap = cv2.VideoCapture(video_path)
if not cap.isOpened():
print(f"无法打开视频文件: {video_path}")
return
frame_count = 0
while True:
# 读取一帧
ret, frame = cap.read()
if not ret:
break
# 构建输出文件名
frame_count += 1
output_file = os.path.join(output_folder, f"{prefix}-{frame_count}.png")
# 保存帧为PNG图像
cv2.imwrite(output_file, frame)
# 释放视频文件
cap.release()
print(f"视频帧已成功保存到: {output_folder}")
# 使用示例
video_path = 'splashv0.mp4' # 视频文件路径
output_folder = './' # 输出文件夹
prefix = 'splash' # 自定义命名前缀
video_to_frames(video_path, output_folder, prefix)
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
npx husky install
npx husky add .husky/pre-commit 'npx lint-staged'
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
+9175 -9285
View File
File diff suppressed because it is too large Load Diff
+35 -3
View File
@@ -12,12 +12,44 @@
"watch": "aiot watch --open-nuttx",
"lint": "eslint --format codeframe --fix --ext .ux,.js src/"
},
"lint-staged": {
"*.{ux,js}": [
"prettier --write",
"eslint --format codeframe --fix",
"git add"
],
"*.{less,css}": [
"prettier --write",
"stylelint --fix --custom-syntax postcss-less",
"git add"
]
},
"devDependencies": {
"@aiot-toolkit/velasim": "^0.1.23",
"aiot-toolkit": "^1.0.18",
"@aiot-toolkit/jsc": "^1.0.3",
"@aiot-toolkit/velasim": "^0.1.26-beta.3",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"aiot-toolkit": "1.1.0",
"babel-eslint": "^10.0.1",
"eslint": "^6.8.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-import-resolver-node": "^0.3.7",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-ux": "^0.0.4",
"husky": "^8.0.1",
"less": "^3.12.2",
"less-loader": "^6.2.0",
"lint-staged": "^8.2.1",
"postcss-html": "^1.3.0",
"postcss-less": "^6.0.0",
"prettier": "^2.7.1",
"stylelint": "^14.5.3",
"stylelint-config-recess-order": "^3.0.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-order": "^5.0.0",
"ts-loader": "^9.5.1",
"typescript": "^5.5.3",
"ux-types": "^0.1.1"
}
}
+16
View File
@@ -0,0 +1,16 @@
module.exports = {
webpack: {
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: "ts-loader",
},
],
},
],
},
},
};
+136
View File
@@ -0,0 +1,136 @@
interface GlobalAnimations {
[key: string]: Array<Anim>;
}
declare var global: {
animations: GlobalAnimations | undefined;
};
abstract class Anim {
abstract start(): void;
abstract stop(): void;
}
class SequenceAnim extends Anim {
pageId: string;
currentFramePathRef: { value: string };
frameCount: number;
framePathPattern: string;
baseDuration: number;
loop: boolean;
currentFrame: number;
intervalId: NodeJS.Timeout | null;
constructor(pageId: string, currentFramePathRef: { value: string }, frameCount: number, framePathPattern: string, baseDuration: number, loop = false) {
super();
this.pageId = pageId;
this.currentFramePathRef = currentFramePathRef;
this.frameCount = frameCount;
this.framePathPattern = framePathPattern;
this.baseDuration = baseDuration;
this.loop = loop;
this.currentFrame = 1;
this.intervalId = null;
if (!global.animations) {
global.animations = {};
}
if (!global.animations[pageId]) {
global.animations[pageId] = [];
}
global.animations[pageId].push(this);
}
start(): void {
const frameDuration = this.baseDuration / this.frameCount;
const updateFrame = () => {
this.currentFramePathRef.value = this.framePathPattern.replace('*', this.currentFrame.toString());
this.currentFrame++;
if (this.currentFrame > this.frameCount) {
if (this.loop) {
this.currentFrame = 1;
} else {
clearInterval(this.intervalId!);
}
}
};
this.intervalId = setInterval(updateFrame, frameDuration);
}
stop(): void {
clearInterval(this.intervalId!);
}
}
class DomAnim extends Anim {
pageId: string;
marginLeftRef: { value: string };
marginTopRef: { value: string };
targetMarginLeft: number;
targetMarginTop: number;
duration: number;
startTime: number | null;
intervalId: NodeJS.Timeout | null;
constructor(pageId: string, marginLeftRef: { value: string }, marginTopRef: { value: string }, targetMarginLeft: number, targetMarginTop: number, duration: number) {
super();
this.pageId = pageId;
this.marginLeftRef = marginLeftRef;
this.marginTopRef = marginTopRef;
this.targetMarginLeft = targetMarginLeft;
this.targetMarginTop = targetMarginTop;
this.duration = duration;
this.startTime = null;
this.intervalId = null;
if (!global.animations) {
global.animations = {};
}
if (!global.animations[pageId]) {
global.animations[pageId] = [];
}
global.animations[pageId].push(this);
}
start(): void {
this.startTime = Date.now();
const startMarginLeft = parseFloat(this.marginLeftRef.value);
const startMarginTop = parseFloat(this.marginTopRef.value);
const step = () => {
const currentTime = Date.now();
const elapsed = currentTime - this.startTime!;
if (elapsed >= this.duration) {
this.marginLeftRef.value = this.targetMarginLeft.toString();
this.marginTopRef.value = this.targetMarginTop.toString();
clearInterval(this.intervalId!);
} else {
const progress = elapsed / this.duration;
const newMarginLeft = startMarginLeft + (this.targetMarginLeft - startMarginLeft) * progress;
const newMarginTop = startMarginTop + (this.targetMarginTop - startMarginTop) * progress;
this.marginLeftRef.value = newMarginLeft.toString();
this.marginTopRef.value = newMarginTop.toString();
}
};
this.intervalId = setInterval(step, 16); // 60 FPS
}
stop(): void {
clearInterval(this.intervalId!);
}
}
function clearPageAnims(pageId: string): void {
if (global.animations && global.animations[pageId]) {
global.animations[pageId].forEach(anim => anim.stop());
delete global.animations[pageId];
}
}
export { SequenceAnim, DomAnim, clearPageAnims };
+6 -7
View File
@@ -1,15 +1,14 @@
<script>
import * as bilirequest_imported from './bilirequest'
import * as animengine from "./animengine"
import { BilibiliClient } from "./bilibiliclient"
export default {
emu_mode: false, //发布真机版本时关闭
folders_info: "", // 用户收藏夹信息 这应在home初始化流程中被设置
bilirequest: bilirequest_imported,
animengine: animengine,
biliclient: new BilibiliClient(),
onCreate() {
console.log('app created')
console.log("app created")
},
onDestroy() {
console.log('app destroyed')
console.log("app destroyed")
}
}
</script>
+184
View File
@@ -0,0 +1,184 @@
import { fetch, storage } from './tsimports';
interface AccountData {
sessData: string;
biliJct: string;
dedeUserID: string;
sid: string;
}
class BilibiliClient {
private qrCodeKey: string | null = null;
private sessData: string | null = null;
private biliJct: string | null = null;
private dedeUserID: string | null = null;
private sid: string | null = null;
// 获取请求头
private getHeaders(): { [key: string]: string } {
return {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,image/png,image/svg+xml,*/*;q=0.8',
'Accept-Encoding': '',
'Accept-Language': 'zh-CN,zh;q=0.8',
'Cookie': this.getCookieString(),
'Referer': 'https://www.bilibili.com',
'Origin': 'https://www.bilibili.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0'
};
}
// 构建Cookie字符串
private getCookieString(): string {
return `SESSDATA=${this.sessData}; bili_jct=${this.biliJct}; DedeUserID=${this.dedeUserID}; sid=${this.sid}`;
}
// 发送GET请求的函数
private async getRequest(url: string): Promise<any> {
try {
const response = await fetch.fetch({
url: url,
responseType: 'json',
header: this.getHeaders()
});
console.log(response.data);
return response.data;
} catch (error) {
console.error(`请求失败,错误码 = ${error.code}`);
throw error;
}
}
// 获取二维码信息
async login_qr(): Promise<{ url: string, qrcode_key: string }> {
console.log("请求登录二维码");
const url = 'https://passport.bilibili.com/x/passport-login/web/qrcode/generate';
const response = await this.getRequest(url);
if (response && response.data) {
this.qrCodeKey = response.data.data.qrcode_key;
return {
url: response.data.data.url,
qrcode_key: response.data.data.qrcode_key
};
} else {
throw new Error('获取二维码失败');
}
}
// 登录函数,使用本地存储的账号数据或通过二维码登录
async login(send_req: boolean, interval: NodeJS.Timeout | null = null): Promise<{ success: boolean, message: string }> {
const accountData = await this.getStoredAccountData();
if (accountData) {
this.sessData = accountData.sessData;
this.biliJct = accountData.biliJct;
this.dedeUserID = accountData.dedeUserID;
this.sid = accountData.sid;
console.log('使用存储的账号数据登录成功');
return {
success: true,
message: "登录成功"
};
} else if (send_req) {
const url = `https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=${this.qrCodeKey}`;
const response = await this.getRequest(url);
if (response && response.data && response.data.data.code === 0) {
if (interval) {
clearInterval(interval);
}
let setCookieHeaders = response.headers['Set-Cookie'] || [];
if (typeof setCookieHeaders === 'string') {
setCookieHeaders = setCookieHeaders.split(', ');
}
setCookieHeaders.forEach(cookie => {
if (cookie.includes('SESSDATA')) {
this.sessData = this.parseCookie(cookie, 'SESSDATA');
} else if (cookie.includes('bili_jct')) {
this.biliJct = this.parseCookie(cookie, 'bili_jct');
} else if (cookie.includes('DedeUserID') && !cookie.includes('DedeUserID__ckMd5')) {
this.dedeUserID = this.parseCookie(cookie, 'DedeUserID');
} else if (cookie.includes('sid')) {
this.sid = this.parseCookie(cookie, 'sid');
}
});
await this.storeAccountData();
console.log('使用二维码登录并存储账号数据成功');
return {
success: true,
message: "登录成功"
};
} else {
return {
success: false,
message: "等待用户操作..."
};
}
}
}
// 获取首页视频推荐
async getMainPageRecommendVideos(fresh_type: number, pagesize: number): Promise<any> {
const url = `https://api.bilibili.com/x/web-interface/index/top/rcmd?fresh_type=${fresh_type}&ps=${pagesize}&version=1`;
const response = await this.getRequest(url);
return response.data.data.item
}
// 辅助函数,用于解析cookie字符串
private parseCookie(cookie: string, name: string): string | null {
const match = cookie.match(new RegExp(`${name}=([^;]+)`));
return match ? match[1] : null;
}
// 获取本地存储的账号数据
private async getStoredAccountData(): Promise<AccountData | null> {
return new Promise((resolve) => {
storage.get({
key: 'bilibili_account',
success: function (data: string) {
if (data && data !== "") {
resolve(JSON.parse(data) as AccountData);
} else {
resolve(null);
}
},
fail: function (data: any, code: number) {
console.log(`获取存储的账号数据失败,错误码 = ${code}`);
resolve(null);
}
});
});
}
// 保存账号数据到本地存储
private async storeAccountData(): Promise<void> {
return new Promise((resolve, reject) => {
if (this.sessData && this.biliJct && this.dedeUserID && this.sid) {
const accountData: AccountData = {
sessData: this.sessData,
biliJct: this.biliJct,
dedeUserID: this.dedeUserID,
sid: this.sid
};
storage.set({
key: 'bilibili_account',
value: JSON.stringify(accountData),
success: function () {
console.log('账号数据存储成功');
resolve();
},
fail: function (data: any, code: number) {
console.log(`存储账号数据失败,错误码 = ${code}`);
reject();
}
});
}
});
}
}
export { BilibiliClient };
-241
View File
@@ -1,241 +0,0 @@
import fetch from '@system.fetch'
import file from '@system.file'
import router from '@system.router'
import storage from '@system.storage'
import { ParseSetCookie } from './tools'
import { md5 } from './tinymd5'
let Inited = false
let DedeUserID = null
let DedeUserID__ckMd5 = null
let SESSDATA = null
let bili_jct = null
let buvid3 = null
let sid = null
let wbi_img_key = null
let wbi_sub_key = null
const BILI_BASE_HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0",
"TE": "trailers",
"Referer": "https://www.bilibili.com",
"Origin": "https://www.bilibili.com",
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Accept": "*/*"
}
// From https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/misc/sign/wbi.md#JavaScript
const mixinKeyEncTab = [
46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49,
33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40,
61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11,
36, 20, 34, 44, 52
]
// 对 imgKey 和 subKey 进行字符顺序打乱编码
const getMixinKey = (orig) => mixinKeyEncTab.map(n => orig[n]).join('').slice(0, 32)
function encWbi(params, img_key, sub_key) {
const mixin_key = getMixinKey(img_key + sub_key),
curr_time = Math.round(Date.now() / 1000),
chr_filter = /[!'()*]/g
Object.assign(params, { wts: curr_time }) // 添加 wts 字段
// 按照 key 重排参数
const query = Object
.keys(params)
.sort()
.map(key => {
// 过滤 value 中的 "!'()*" 字符
const value = params[key].toString().replace(chr_filter, '')
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
})
.join('&')
const wbi_sign = md5(query + mixin_key) // 计算 w_rid
return query + '&w_rid=' + wbi_sign
}
export function InitBiliWbi(wbi_img){
var img_key_parts = wbi_img.img_url.toString().split('/')
var img_key = img_key_parts[img_key_parts.length - 1].split('.')[0]
var sub_key_parts = wbi_img.sub_url.toString().split('/')
var sub_key = sub_key_parts[sub_key_parts.length - 1].split('.')[0]
console.log("img_key=" + img_key + " sub_key=" + sub_key)
wbi_img_key = img_key
wbi_sub_key = sub_key
}
export async function InitBiliBUVID3() {
await new Promise((resolve, reject) => {
storage.get({
key: "BUVID3",
default: "",
success: async (data) => {
if (data != "") {
buvid3 = data;
resolve();
} else {
try {
console.log("buvid3: Send GET Request To https://api.bilibili.com/x/frontend/finger/spi")
var ret_buvids = await SendBiliGET("https://api.bilibili.com/x/frontend/finger/spi");
console.log("buvid3: reading")
if (ret_buvids !== void 0 && ret_buvids !== undefined && ret_buvids !== "") {
buvid3 = ret_buvids.data.b_3
}
storage.set({
key: "BUVID3",
value: buvid3.toString(),
success: (data) => {
console.log("Inited buvid3=" + buvid3);
resolve(); // 成功回调后解决Promise
},
fail: () => reject(), // 如果set失败,拒绝Promise
});
} catch (error) {
reject(error); // 如果在尝试过程中抛出错误,拒绝Promise
}
}
},
fail: () => reject(), // 如果get失败,拒绝Promise
});
});
}
// JumpToHomePage: bool
// 用于设置是否在初始化完BiliRequest后跳转到Home页
export async function InitBiliRequest(JumpToHomePage){
try{
console.log("开始初始化BiliRequest")
file.readText({
uri: "internal://files/hbili_DedeUserID.txt",
success: function(DUIDReadRet){
console.log(DUIDReadRet)
DedeUserID = DUIDReadRet.text
file.readText({
uri: "internal://files/hbili_DedeUserID__ckMd5.txt",
success: function(DUIDMD5ReadRet){
console.log(DUIDMD5ReadRet)
DedeUserID__ckMd5 = DUIDMD5ReadRet.text
file.readText({
uri: "internal://files/hbili_SESSDATA.txt",
success: function(SESSDATAReadRet){
console.log(SESSDATAReadRet)
SESSDATA = SESSDATAReadRet.text
file.readText({
uri: "internal://files/hbili_bili_jct.txt",
success: function(BiliJCTReadRet){
console.log(BiliJCTReadRet)
bili_jct = BiliJCTReadRet.text
file.readText({
uri: "internal://files/hbili_sid.txt",
success: function(sidReadRet){
console.log(sidReadRet)
sid = sidReadRet.text
console.log("bilirequest初始化完毕: \nDedeUserID=" + DedeUserID + "\nDedeUserID__ckMd5=" + DedeUserID__ckMd5 + "\nSESSDATA=" + SESSDATA + "\nbili_jct=" + bili_jct + "\nsid=" + sid)
Inited = true
if(JumpToHomePage){
router.push({
uri: "pages/home"
})
}
},
fail: function(data, code) {
console.log(`brequest.init.sid > handling fail, code = ${code}`)
router.push({
uri: "pages/login"
})
}
})
},
fail: function(data, code) {
console.log(`brequest.init.hbilibilijct > handling fail, code = ${code}`)
}
})
},
fail: function(data, code) {
console.log(`brequest.init.sessdata_read > handling fail, code = ${code}`)
}
})
},
fail: function(data, code) {
console.log(`brequest.init.dedeuseridmd5_read > handling fail, code = ${code}`)
}
})
},
fail: function(data, code) {
console.log(`brequest.init.dedeuserid_read > handling fail, code = ${code}`)
}
})
}
catch(err){
console.log("BiliRequest初始化失败,错误信息:" + err)
}
}
export async function GetBUVID3(){
return buvid3
}
export async function SendBiliGET(url, type){
var headers = BILI_BASE_HEADERS;
headers["Cookie"] = "DedeUserID=" + DedeUserID + "; DedeUserID__ckMd5=" + DedeUserID__ckMd5 + "; SESSDATA=" + SESSDATA + "; bili_jct=" + bili_jct + "; buvid3=" + buvid3;
var ret = await fetch.fetch({
url: url,
responseType: type,
header: headers
});
return ret.data.data
}
export async function SendBiliGETReturnAll(url, type){
var headers = BILI_BASE_HEADERS;
headers["Cookie"] = "DedeUserID=" + DedeUserID + "; DedeUserID__ckMd5=" + DedeUserID__ckMd5 + "; SESSDATA=" + SESSDATA + "; bili_jct=" + bili_jct + "; buvid3=" + buvid3;
var ret = await fetch.fetch({
url: url,
responseType: type,
header: headers
});
return ret.data
}
export async function SendWbiGET(url, type, paramsobj){
var headers = BILI_BASE_HEADERS;
headers["Cookie"] = "DedeUserID=" + DedeUserID + "; DedeUserID__ckMd5=" + DedeUserID__ckMd5 + "; SESSDATA=" + SESSDATA + "; bili_jct=" + bili_jct + "; buvid3=" + buvid3;
url = url + "?" + encWbi(paramsobj, wbi_img_key, wbi_sub_key)
console.log("WbiGet URL: " + url)
var ret = await fetch.fetch({
url: url,
responseType: type,
header: headers
});
return ret.data.data
}
export async function SendBiliPOST(url, body, type, content_type){
var headers = BILI_BASE_HEADERS;
headers["Cookie"] = "DedeUserID=" + DedeUserID + "; DedeUserID__ckMd5=" + DedeUserID__ckMd5 + "; SESSDATA=" + SESSDATA + "; bili_jct=" + bili_jct + "; buvid3=" + buvid3;
headers["Content-Type"] = content_type
var ret = await fetch.fetch({
url: url,
responseType: type,
header: headers,
method: "POST",
data: body
});
return ret.data.data
}
export function GetCSRF(){
console.log("Current CSRF: " + bili_jct)
return bili_jct
}
export async function GetVideoInfoByID(id){
var ret = await SendBiliGET("https://api.bilibili.com/x/web-interface/view?aid=" + id,"json")
return ret.data
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

+1 -2
View File
@@ -1,2 +1 @@
{
}
{"a":{"b":""}}
+9 -49
View File
@@ -1,10 +1,9 @@
{
"package": "com.searchstars.hyperbilibili",
"name": "澎湃哔哩",
"versionName": "1.1.0",
"versionCode": 1,
"versionName": "2.0.0",
"versionCode": 2,
"minPlatformVersion": 1000,
"minAPILevel": 2,
"icon": "/common/logo.png",
"deviceTypeList": [
"watch"
@@ -16,59 +15,20 @@
],
"config": {
"logLevel": "log",
"designWidth": 480
"designWidth": 466
},
"router": {
"entry": "pages/main",
"entry": "pages/splash",
"pages": {
"pages/main": {
"component": "main"
"pages/splash":{
"component": "splash"
},
"pages/login": {
"pages/login":{
"component": "login"
},
"pages/home": {
"component": "home"
},
"pages/settings": {
"component": "settings"
},
"pages/videopush": {
"component": "videopush"
},
"pages/videoaisummary": {
"component": "videoaisummary"
},
"pages/videodetail": {
"component": "videodetail"
},
"pages/networkerror":{
"component": "networkerror"
},
"pages/videoreplies":{
"component": "videoreplies"
},
"pages/replydetail": {
"component": "replydetail"
},
"pages/textshow": {
"component": "textshow"
},
"pages/myfolders": {
"component": "myfolders"
},
"pages/foldercontent": {
"component": "foldercontent"
},
"pages/history": {
"component": "history"
},
"pages/about": {
"component": "about"
"pages/main": {
"component": "main"
}
}
},
"display": {
"backgroundColor": "#000000"
}
}
-26
View File
@@ -1,26 +0,0 @@
import fetch from '@system.fetch'
import prompt from '@system.prompt'
import app from '@system.app'
export function CheckUpdates(){
fetch.fetch({
url: "https://gitee.com/search__stars/hb_ota_info/raw/master/current_ver",
responseType: "text",
success: (response) => {
console.log(response)
if(response != "" && response != void 0 && response != null){
if(response.data != app.getInfo().versionName){
prompt.showToast({
message: "检查到版本更新:" + response.data + ",建议下载最新rpk并安装更新以获得更佳体验",
duration: 5000
})
}
}
else{
prompt.showToast({
message: "更新检查失败"
})
}
}
})
}
-92
View File
@@ -1,92 +0,0 @@
<template>
<div class="about-page">
<image class="app_logo" src="/common/logo.png"></image>
<text class="appname">{{app_name}}</text>
<text class="app_ver">{{app_ver}}</text>
<text class="app_author">{{app_author}}</text>
<text class="free_tips">{{free_tips_text}}</text>
<text class="free_warn">{{free_warn_text}}</text>
<text class="github_url">{{github_url}}</text>
</div>
</template>
<script>
import app from '@system.app'
export default{
private: {
app_name: app.getInfo().name,
app_ver: "v" + app.getInfo().versionName,
app_author: "Made by @Searchstars with love",
free_tips_text: "本应用永久免费且开源,遵循GPL-v3协议",
free_warn_text: "若发现倒卖此应用或不遵循开源协议者,欢迎任何人泛滥他们的个人隐私信息",
github_url: "https://github.com/searchstars/hyperbilibili"
}
}
</script>
<style>
.about-page{
justify-content: center;
position: absolute;
}
.app_logo{
position: absolute;
width: 100px;
height: 100px;
margin-top: 90px;
border-radius: 50%;
}
.appname{
color: white;
position: absolute;
width: 75%;
font-size: 26px;
margin-top: 230px;
text-align: center;
}
.app_ver{
color: white;
position: absolute;
width: 75%;
height: 50%;
font-size: 18px;
margin-top: 160px;
text-align: center;
}
.app_author{
color: white;
position: absolute;
width: 75%;
height: 50%;
font-size: 18px;
margin-top: 190px;
text-align: center;
}
.free_tips{
color: white;
position: absolute;
width: 75%;
height: 50%;
font-size: 18px;
margin-top: 220px;
text-align: center;
}
.free_warn{
color: white;
position: absolute;
width: 75%;
height: 50%;
font-size: 18px;
margin-top: 260px;
text-align: center;
}
.github_url{
color: white;
position: absolute;
width: 75%;
height: 50%;
font-size: 18px;
margin-top: 310px;
text-align: center;
}
</style>
-190
View File
@@ -1,190 +0,0 @@
<template>
<div class="foldercontent-page">
<div class="content" style="margin-top: 60px" @click="OpenFolderContent(0)">
<image class="content_image" src="{{favlist.data.medias[0].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[0].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[0].upper.name}}</text>
</div>
<div class="content" style="margin-top: 200px" @click="OpenFolderContent(1)">
<image class="content_image" src="{{favlist.data.medias[1].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[1].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[1].upper.name}}</text>
</div>
<div class="content" style="margin-top: 340px" @click="OpenFolderContent(2)">
<image class="content_image" src="{{favlist.data.medias[2].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[2].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[2].upper.name}}</text>
</div>
<div class="content" style="margin-top: 480px" @click="OpenFolderContent(3)">
<image class="content_image" src="{{favlist.data.medias[3].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[3].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[3].upper.name}}</text>
</div>
<div class="content" style="margin-top: 620px" @click="OpenFolderContent(4)">
<image class="content_image" src="{{favlist.data.medias[4].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[4].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[4].upper.name}}</text>
</div>
<div class="content" style="margin-top: 760px" @click="OpenFolderContent(5)">
<image class="content_image" src="{{favlist.data.medias[5].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[5].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[5].upper.name}}</text>
</div>
<div class="content" style="margin-top: 900px" @click="OpenFolderContent(6)">
<image class="content_image" src="{{favlist.data.medias[6].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[6].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[6].upper.name}}</text>
</div>
<div class="content" style="margin-top: 1040px" @click="OpenFolderContent(7)">
<image class="content_image" src="{{favlist.data.medias[7].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[7].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[7].upper.name}}</text>
</div>
<div class="content" style="margin-top: 1180px" @click="OpenFolderContent(8)">
<image class="content_image" src="{{favlist.data.medias[8].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[8].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[8].upper.name}}</text>
</div>
<div class="content" style="margin-top: 1320px" @click="OpenFolderContent(9)">
<image class="content_image" src="{{favlist.data.medias[9].cover}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{favlist.data.medias[9].title}}</text>
<text class="content_up_name">UP: {{favlist.data.medias[9].upper.name}}</text>
</div>
<div class="pagecontrol">
<input type="button" value="上一页" style="font-size: 22px; width: 90px; height: 40px" @click="BackPage()"></input>
<text style="width: 30px;"> </text>
<text style="color: white; font-size: 24px">{{pn}}/{{maxpn}}</text>
<text style="width: 30px;"> </text>
<input type="button" value="下一页" style="font-size: 22px; width: 90px; height: 40px" @click="NextPage()"></input>
</div>
<text style="height: 50px; margin-top: 1620px"></text>
</div>
</template>
<script>
import prompt from '@system.prompt'
import router from '@system.router'
export default{
public:{
media_id: 0
},
private: {
favlist: null,
pn: 1,
maxpn: 1,
ifInterval: null,
async UpdateFavList(){
this.favlist = await this.$app.$def.bilirequest.SendBiliGET("https://api.bilibili.com/x/v3/fav/resource/list?" + "media_id=" + this.media_id + "&ps=10&pn=" + this.pn,"json")
},
BackPage(){
if(this.pn < 2){
prompt.showToast({
message: "已经到头啦!"
})
}
else{
this.pn = this.pn - 1
this.UpdateFavList()
}
},
NextPage(){
if(this.pn >= this.maxpn){
prompt.showToast({
message: "已经到底啦!"
})
}
else{
this.pn = this.pn + 1
this.UpdateFavList()
}
},
async OpenFolderContent(id){
if(this.favlist.data.medias[id].type == 2){
var vid_info = await this.$app.$def.bilirequest.GetVideoInfoByID(this.favlist.data.medias[id].id)
router.push({
uri: "pages/videodetail",
params: {
img_src: vid_info.pic,
vid_title: vid_info.title,
bv: vid_info.bvid,
cid: vid_info.cid,
up_mid: vid_info.owner.mid,
id: vid_info.aid
}
})
}
else{
prompt.showToast({
message: "目标稿件不是视频稿件,目前暂不支持除视频外的稿件"
})
}
}
},
onInit(){
this.UpdateFavList()
this.ifInterval = setInterval(() => {
if(this.favlist != null && this.favlist != undefined){
if(this.favlist.data.info.media_count < 1){
prompt.showToast({
message: "该收藏夹为空!!!",
duration: 10000
})
}
else if(this.favlist.data.info.media_count < 10){
prompt.showToast({
message: "收藏夹内容较少,如果在一条正常的收藏下发现接下来的所有收藏全部没加载出来,就是没东西啦!",
duration: 10000
})
}
this.maxpn = Math.ceil(this.favlist.data.info.media_count / 10)
clearInterval(this.ifInterval)
}
},1000)
}
}
</script>
<style>
.foldercontent-page{
justify-content: center;
position: absolute;
}
.content{
background-color: rgba(255, 255, 255, 0.178);
border-radius: 25px;
width: 80%;
height: 130px;
position: absolute;
display: flex;
align-items: center;
}
.content_image{
margin-left: 25px;
width: 100.6px;
height: 80.6px;
border-radius: 10px;
min-width: 100.6px;
min-height: 80.6px;
}
.content_title{
width: 90%;
height: 70%;
font-size: 16px;
color: white;
margin-left: 15px;
}
.content_up_name{
color: white;
font-size: 14px;
position: absolute;
top: 102px;
margin-left: 146px;
}
.pagecontrol{
position: absolute;
margin-top: 1440px;
flex-direction: row;
align-items: center;
height: 100px;
}
</style>
-190
View File
@@ -1,190 +0,0 @@
<template>
<div class="historycontent-page">
<div class="content" style="margin-top: 60px" @click="OpenHistoryContent(0)">
<image class="content_image" src="{{hislist.data[0].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[0].title}}</text>
<text class="content_up_name">UP: {{hislist.data[0].owner.name}}</text>
</div>
<div class="content" style="margin-top: 200px" @click="OpenHistoryContent(1)">
<image class="content_image" src="{{hislist.data[1].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[1].title}}</text>
<text class="content_up_name">UP: {{hislist.data[1].owner.name}}</text>
</div>
<div class="content" style="margin-top: 340px" @click="OpenHistoryContent(2)">
<image class="content_image" src="{{hislist.data[2].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[2].title}}</text>
<text class="content_up_name">UP: {{hislist.data[2].owner.name}}</text>
</div>
<div class="content" style="margin-top: 480px" @click="OpenHistoryContent(3)">
<image class="content_image" src="{{hislist.data[3].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[3].title}}</text>
<text class="content_up_name">UP: {{hislist.data[3].owner.name}}</text>
</div>
<div class="content" style="margin-top: 620px" @click="OpenHistoryContent(4)">
<image class="content_image" src="{{hislist.data[4].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[4].title}}</text>
<text class="content_up_name">UP: {{hislist.data[4].owner.name}}</text>
</div>
<div class="content" style="margin-top: 760px" @click="OpenHistoryContent(5)">
<image class="content_image" src="{{hislist.data[5].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[5].title}}</text>
<text class="content_up_name">UP: {{hislist.data[5].owner.name}}</text>
</div>
<div class="content" style="margin-top: 900px" @click="OpenHistoryContent(6)">
<image class="content_image" src="{{hislist.data[6].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[6].title}}</text>
<text class="content_up_name">UP: {{hislist.data[6].owner.name}}</text>
</div>
<div class="content" style="margin-top: 1040px" @click="OpenHistoryContent(7)">
<image class="content_image" src="{{hislist.data[7].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[7].title}}</text>
<text class="content_up_name">UP: {{hislist.data[7].owner.name}}</text>
</div>
<div class="content" style="margin-top: 1180px" @click="OpenHistoryContent(8)">
<image class="content_image" src="{{hislist.data[8].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[8].title}}</text>
<text class="content_up_name">UP: {{hislist.data[8].owner.name}}</text>
</div>
<div class="content" style="margin-top: 1320px" @click="OpenHistoryContent(9)">
<image class="content_image" src="{{hislist.data[9].pic}}@100w_80h" alt="/common/icons8-loading-96.png"></image>
<text class="content_title">{{hislist.data[9].title}}</text>
<text class="content_up_name">UP: {{hislist.data[9].owner.name}}</text>
</div>
<div class="pagecontrol">
<input type="button" value="上一页" style="font-size: 22px; width: 90px; height: 40px" @click="BackPage()"></input>
<text style="width: 30px;"> </text>
<text style="color: white; font-size: 24px">{{pn}}/{{maxpn}}</text>
<text style="width: 30px;"> </text>
<input type="button" value="下一页" style="font-size: 22px; width: 90px; height: 40px" @click="NextPage()"></input>
</div>
<text style="height: 50px; margin-top: 1620px"></text>
</div>
</template>
<script>
import prompt from '@system.prompt'
import router from '@system.router'
export default{
public:{
},
private: {
hislist: null,
pn: 1,
maxpn: 1,
ifInterval: null,
async UpdateFavList(){
this.hislist = await this.$app.$def.bilirequest.SendBiliGET("https://api.bilibili.com/x/v2/history?" + "&ps=10&pn=" + this.pn,"json")
},
BackPage(){
if(this.pn < 2){
prompt.showToast({
message: "已经到头啦!"
})
}
else{
this.pn = this.pn - 1
this.UpdateFavList()
}
},
NextPage(){
if(this.pn >= this.maxpn){
prompt.showToast({
message: "已经到底啦!"
})
}
else{
this.pn = this.pn + 1
this.UpdateFavList()
}
},
async OpenHistoryContent(id){
if(this.hislist.data[id].type == 3){
var vid_info = await this.$app.$def.bilirequest.GetVideoInfoByID(this.hislist.data[id].aid)
router.push({
uri: "pages/videodetail",
params: {
img_src: vid_info.pic,
vid_title: vid_info.title,
bv: vid_info.bvid,
cid: vid_info.cid,
up_mid: vid_info.owner.mid,
id: vid_info.aid
}
})
}
else{
prompt.showToast({
message: "目标稿件不是视频稿件,目前暂不支持除视频外的稿件"
})
}
}
},
onInit(){
this.UpdateFavList()
this.ifInterval = setInterval(() => {
if(this.hislist != null && this.hislist != undefined){
if(this.hislist.data.length < 1){
prompt.showToast({
message: "历史记录为空!!!",
duration: 10000
})
}
else if(this.hislist.data.length < 10){
prompt.showToast({
message: "历史记录内容较少,如果在一条正常的记录下发现接下来的所有记录全部没加载出来,就是没东西啦!",
duration: 10000
})
}
this.maxpn = Math.ceil(this.hislist.data.length / 10)
clearInterval(this.ifInterval)
}
},1000)
}
}
</script>
<style>
.historycontent-page{
justify-content: center;
position: absolute;
}
.content{
background-color: rgba(255, 255, 255, 0.178);
border-radius: 25px;
width: 80%;
height: 130px;
position: absolute;
display: flex;
align-items: center;
}
.content_image{
margin-left: 25px;
width: 100.6px;
height: 80.6px;
border-radius: 10px;
min-width: 100.6px;
min-height: 80.6px;
}
.content_title{
width: 90%;
height: 70%;
font-size: 16px;
color: white;
margin-left: 15px;
}
.content_up_name{
color: white;
font-size: 14px;
position: absolute;
top: 102px;
margin-left: 146px;
}
.pagecontrol{
position: absolute;
margin-top: 1440px;
flex-direction: row;
align-items: center;
height: 100px;
}
</style>
-253
View File
@@ -1,253 +0,0 @@
<template>
<div class="home-page">
<image class="profile_image" src={{profile_image_src}} alt="/common/icons8-loading-96.png"></image>
<text class="normal_welcome_text">欢迎回来,{{user_name}}</text>
<text class="loading_status_text" show={{show_loading_status}}>{{loading_status}}</text>
<div class="features_div" show="{{show_features}}">
<div class="feature" @click="OpenVideoPushPage()">
<div class="feature_icon_div">
<image class="feature_icon" src="/common/icons8-pushes-96.png"></image>
</div>
<text class="feature_text">首页视频推荐</text>
<text class="feature_arrow">></text>
</div>
<div class="feature" style="margin-top: 80px" @click="OpenMyHistoryPage()">
<div class="feature_icon_div">
<image class="feature_icon" src="/common/icons8-history-96.png"></image>
</div>
<text class="feature_text">观看历史</text>
<text class="feature_arrow">></text>
</div>
<div class="feature" style="margin-top: 160px" @click="OpenMyFoldersPage()">
<div class="feature_icon_div">
<image class="feature_icon" src="/common/icons8-star-96.png"></image>
</div>
<text class="feature_text">我的收藏</text>
<text class="feature_arrow">></text>
</div>
<div class="feature" style="margin-top: 240px" @click="ShowWIP()">
<div class="feature_icon_div">
<image class="feature_icon" src="/common/icons8-chat-message-96.png"></image>
</div>
<text class="feature_text">我的私信</text>
<text class="feature_arrow">></text>
</div>
<div class="feature" style="margin-top: 320px" @click="OpenSettingsPage()">
<div class="feature_icon_div">
<image class="feature_icon" src="/common/icons8-settings-96.png"></image>
</div>
<text class="feature_text">设置</text>
<text class="feature_arrow">></text>
</div>
<div class="feature" style="margin-top: 400px" @click="OpenAboutPage()">
<div class="feature_icon_div">
<image class="feature_icon" src="/common/icons8-info-96.png"></image>
</div>
<text class="feature_text">关于</text>
<text class="feature_arrow">></text>
</div>
</div>
</div>
</template>
<script>
import prompt from '@system.prompt'
import router from '@system.router'
import { CheckUpdates } from '../../ota'
export default {
private: {
profile_image_src: "",
login_info: null,
user_name: "Loading...",
var_poll_check_interval: null,
network_ok: false,
login_wait_num: 0,
login_timeouted: false,
show_features: false,
show_loading_status: true,
loading_status: "获取账号信息...",
made_by_searchstars_with_love: "本软件永久免费,倒卖者户口本只有单页",
async MainInit(){
router.clear() //清内存
this.profile_image_src = "/common/icons8-loading-96.png"
var login_ret = await this.$app.$def.bilirequest.SendBiliGET("https://api.bilibili.com/x/web-interface/nav","json")
this.login_info = login_ret
CheckUpdates()
},
OpenSettingsPage(){
router.push({
uri: "pages/settings"
})
},
OpenVideoPushPage(){
router.push({
uri: "pages/videopush"
})
},
isValidUserName(obj){
if (obj === null || obj === undefined){
return false;
}
const str = String(obj);
if(str.includes("Loading") || str.includes("undefined")){
return false;
}
return true;
},
ShowWIP(){
prompt.showToast({
message: "该功能还未开发完毕,请更新版本后再来看看吧!"
})
},
OpenMyFoldersPage(){
router.push({
uri: "pages/myfolders"
})
},
OpenMyHistoryPage(){
router.push({
uri: "pages/history"
})
},
OpenAboutPage(){
router.push({
uri: "pages/about"
})
}
},
onInit(){
this.MainInit()
this.var_poll_check_interval = setInterval(async() => {
if(this.login_info === null || this.login_info === undefined){
console.log("trying to login")
}
else{
if(this.isValidUserName(this.login_info.data.uname)){
this.network_ok = true;
console.log("logined")
clearInterval(this.var_poll_check_interval)
console.log(this.login_info.code)
this.profile_image_src = this.login_info.data.face + "@120w_120h" //向后端请求低分辨率图片以加快加载速度
this.loading_status = "获取头像..."
console.log(this.profile_image_src)
this.user_name = this.login_info.data.uname
this.loading_status = "获取收藏夹信息..."
this.$app.$def.folders_info = await this.$app.$def.bilirequest.SendBiliGET("https://api.bilibili.com/x/v3/fav/folder/created/list-all?up_mid=" + this.login_info.data.mid,"json");
console.log(this.$app.$def.folders_info)
if((this.login_info.data.wbi_img.img_url != void 0 && this.login_info.data.wbi_img.img_url != undefined) && this.login_info.data.wbi_img.img_url != ""){
this.loading_status = "获取wbi签名密钥..."
this.$app.$def.bilirequest.InitBiliWbi(this.login_info.data.wbi_img)
this.loading_status = "获取BUVID3,若太久未响应请重启程序..."
await this.$app.$def.bilirequest.InitBiliBUVID3()
this.show_features = true
this.show_loading_status = false
}
}
else{
if(this.login_wait_num > 8 && (!this.login_timeouted)){
this.network_ok = true
prompt.showToast({
message: "登录已失效,请重新登录,否则各项功能将无法正常使用",
duration: 6000
})
setTimeout(() => {
router.push({
uri: "pages/login"
})
},2000)
clearInterval(this.var_poll_check_interval)
}
console.log("wait")
this.login_wait_num ++
}
}
}, 1000)
},
onReady(){
setTimeout(() => {
if(this.login_info.data.isLogin == false && this.network_ok == false){
this.login_timeouted = true
prompt.showToast({
message: "您的网络连接质量较差或网络连接已中断,请检查网络后再试",
duration: 6000
})
}
},6000) // 给予6秒的等待时间,在一切加载完后再进行登录结果检测
// 但由于模拟器的垃圾效率 在模拟器里这个提示可能会在账户登录成功的情况下仍然出现
// 判断账户是否登录成功的最好方法就是看你自己的头像有没有出来
}
}
</script>
<style>
.profile_image{
/* Vela快应用的图片似乎没法变圆 迫于无奈只能使用正方形 */
/* 2024.3.6 Update: 这个问题只会在模拟器里出现 并且已经在最新版本里修复 */
border-radius: 50%;
width: 120px;
height: 120px;
position: relative;
left: 240px;
margin-left: -60px;
margin-top: 50px;
}
.normal_welcome_text{
color: white;
font-size: 22px;
text-align: center;
width: 100%;
position: absolute;
top: 200px;
}
.loading_status_text{
color: white;
font-size: 16px;
text-align: center;
width: 100%;
position: absolute;
top: 240px;
}
.features_div{
/*background-color: gray;*/
width: 60%;
height: 120%;
position: relative;
margin-left: 35px;
top: 250px
}
.feature{
background-color: rgba(255, 255, 255, 0.178);
width: 100%;
height: 70px;
border-radius: 50px;
position: absolute;
display: flex;
}
.feature_icon_div{
width: 50px;
height: 50px;
background-color: pink;
border-radius: 100px;
margin-left: 20px;
margin-top: 10px;
justify-content: center;
align-items: center;
}
.feature_icon{
width: 35px;
height: 35px;
}
.feature_text{
color: white;
font-size: 20px;
margin-left: 20px;
}
.feature_arrow{
color: white;
font-size: 20px;
margin-left: 10px;
}
</style>
+97 -196
View File
@@ -1,204 +1,105 @@
<template>
<div class="login-page" style="justify-content: center">
<text
style="
position: absolute;
text-align: center;
margin-top: 50%;
font-size: 24px;
color: white;
height: 20%;
width: 80%;
"
>
使用哔哩哔哩APP扫描以登录
</text>
<qrcode
id="login_qr"
style="
position: absolute;
justify-content: center;
align-items: center;
margin-top: 130%;
width: 60%;
height: 60%;
"
value="{{qr_value}}"
show="{{qr_show}}"
></qrcode>
<text
style="
position: absolute;
margin-top: 100%;
text-align: center;
width: 100%;
height: 100%;
font-size: 16px;
color: white;
"
show="{{qr_loading_show}}"
>
Loading...
</text>
</div>
<div>
<text style="position: absolute; color: rgba(0, 0, 0, 0)">{{ anims.pagediv_mgt.value }}</text>
<div class="page" style="margin-top: {{ anims.pagediv_mgt.value }}px">
<text style="font-weight: bold; margin-top: 35px">扫码登录</text>
<div class="qr_code">
<qrcode value="{{qr_value}}" show="{{show_qr}}" style="width: 90%; height: 90%"></qrcode>
<image style="position: absolute" show="{{show_loading}}" src="{{anims.loading_img_src.value}}"></image>
</div>
<text style="margin-top: 20px; font-size: 26px; font-weight: bold">请前往官方客户端</text>
<text style="font-size: 20px">进行扫码登录</text>
</div>
</div>
</template>
<script>
/*
下面的代码很好的诠释了这句话:
“此程序依赖bug运行,如非大难临头请勿修改”
*/
import prompt from "@system.prompt"
import router from "@system.router"
export default {
private: {
qr_value: "",
show_qr: false,
show_loading: true,
qrpoll_interval: null,
anims: {
loading_img: null,
loading_img_src: {value: "/common/seqanims/loading/icons8-loading-1.png"},
pagediv: null,
pagediv_mgt: {value: "800"}
}
},
async PollQR() {
var result = await this.$app.$def.biliclient.login(true, this.qrpoll_interval)
if (result.success) {
console.log("登录成功")
prompt.showToast({
message: "登录成功"
})
router.replace({
uri: "pages/main"
})
} else {
if (result.message.includes("登录失败")) {
prompt.showToast({
message: result.message,
duration: 5000
})
}
}
},
async GetQR() {
var get_result = await this.$app.$def.biliclient.login_qr()
this.qr_value = get_result.url
console.log(get_result)
this.show_qr = true
this.show_loading = false
this.qrpoll_interval = setInterval(async() => {
await this.PollQR()
}, 1500);
},
onShow() {
this.anims.pagediv = new this.$app.$def.animengine.DomAnim(
"loginPage",
{value: "0"},
this.anims.pagediv_mgt,
0,
0,
250
)
this.anims.pagediv.start()
this.anims.loading_img = new this.$app.$def.animengine.SequenceAnim(
"loginPage",
this.anims.loading_img_src,
28,
"/common/seqanims/loading/icons8-loading-*.png",
1000,
true
)
this.anims.loading_img.start()
import router from "@system.router";
import fetch from '@system.fetch'
import prompt from '@system.prompt'
import file from '@system.file'
import { ParseSetCookie } from '../../tools'
// 定义一个异步函数,返回一个Promise对象
async function SetQRCode(){
// 使用try...catch语句处理可能的异常
try {
// 使用await关键字等待fetch请求的结果
let res = await fetch.fetch({
url: "https://passport.bilibili.com/x/passport-login/web/qrcode/generate",
responseType: "json",
})
// 返回二维码的url
return [res.data.data.data.url,res.data.data.data.qrcode_key]
} catch (error) {
// 使用error.message和error.code获取错误信息
prompt.showToast({
message: '在请求登录二维码时发生错误!错误信息:' + error.message + "错误代码:" + error.code + "\n请重新启动此应用程序,然后再试",
duration: 5000
})
this.GetQR()
}
}
export default {
public:{
qr_value: void 0,
qr_show: false,
qr_loading_show: true,
qr_key: "N/A",
get_qr_num: 0,
set_qr_num: 0,
// 定义一个异步方法,用于获取和更新qr_value的值
async getQRInfos(){
this.get_qr_num++
// 如果qr_value为空,就调用SetQRCode函数
if (!this.qr_value){
this.set_qr_num++
var GetInfoRet = await SetQRCode()
this.qr_value = GetInfoRet[0]
this.qr_key = GetInfoRet[1]
}
console.log(`第${this.get_qr_num}次获取登录二维码,第${this.set_qr_num}次设置登录二维码`)
// 返回qr_value的值
return [this.qr_value, this.qr_key]
},
async writeLoginRetCookies(headers){
console.log("开始写入headers")
console.log(headers)
try{
for (var i=0;i<headers.length;i++){
console.log(headers[i])
if(headers[i]["DedeUserID"] != void 0 && headers[i]["DedeUserID"] != undefined && headers[i]["DedeUserID"] != ""){
console.log(`发现DedeUserID=${headers[i]["DedeUserID"]},写入!`)
await file.writeText({
uri: "internal://files/hbili_DedeUserID.txt",
text: headers[i]["DedeUserID"]
})
}
if(headers[i]["DedeUserID__ckMd5"] != void 0 && headers[i]["DedeUserID__ckMd5"] != undefined && headers[i]["DedeUserID__ckMd5"] != ""){
console.log(`发现DedeUserID__ckMd5=${headers[i]["DedeUserID__ckMd5"]},写入!`)
await file.writeText({
uri: "internal://files/hbili_DedeUserID__ckMd5.txt",
text: headers[i]["DedeUserID__ckMd5"]
})
}
if(headers[i]["SESSDATA"] != void 0 && headers[i]["SESSDATA"] != undefined && headers[i]["SESSDATA"] != ""){
console.log(`发现SESSDATA=${headers[i]["SESSDATA"]},写入!`)
await file.writeText({
uri: "internal://files/hbili_SESSDATA.txt",
text: headers[i]["SESSDATA"]
})
}
if(headers[i]["bili_jct"] != void 0 && headers[i]["bili_jct"] != undefined && headers[i]["bili_jct"] != ""){
console.log(`发现bili_jct=${headers[i]["bili_jct"]},写入!`)
await file.writeText({
uri: "internal://files/hbili_bili_jct.txt",
text: headers[i]["bili_jct"]
})
}
if(headers[i]["sid"] != void 0 && headers[i]["sid"] != undefined && headers[i]["sid"] != ""){
console.log(`发现sid=${headers[i]["sid"]},写入!`)
await file.writeText({
uri: "internal://files/hbili_sid.txt",
text: headers[i]["sid"]
})
}
}
}
catch(err){
console.log("Cookies写入失败,错误信息:" + err)
}
console.log("Cookies写入完成")
return;
},
PollInterval: null,
GetQRInterval: null,
async DoPollCheck(){
console.log("qr_key=" + this.qr_key)
try {
// 使用await关键字等待fetch请求的结果
fetch.fetch({
url: "https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=" + this.qr_key,
responseType: "json",
}).then(async (res) => {
if(res.data.data.data.code === 0){
console.log("登录成功")
let headers = ParseSetCookie(res.data.headers["Set-Cookie"])
console.log(headers)
clearInterval(this.PollInterval)
clearInterval(this.GetQRInterval)
await this.writeLoginRetCookies(headers)
this.$app.$def.bilirequest.InitBiliRequest(true)
}
})
} catch (error) {
// 使用error.message和error.code获取错误信息
prompt.showToast({
message: '在进行二维码登录短轮询时发生错误!错误信息:' + error.message + "错误代码:" + error.code + "\n请重新启动此应用程序,然后再试",
duration: 5000
})
}
},
async AsyncOnInitDo(){
this.getQRInfos().then((v) => {
this.qr_value = v[0]
this.qr_key = v[1]
this.qr_show = true
this.qr_loading_show = false
})
this.GetQRInterval = setInterval(() => {
this.qr_show = false
this.qr_loading_show = true
this.getQRInfos().then((v) => {
this.qr_value = v[0]
this.qr_key = v[1]
this.qr_show = true
this.qr_loading_show = false
})
}, 15000);
this.PollInterval = setInterval(() => {
this.DoPollCheck()
},1500)
}
},
onInit(){
router.clear() //清内存
this.AsyncOnInitDo()
}
};
</script>
<style>
.page {
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
position: absolute;
width: 100%;
}
.qr_code {
margin-top: 30px;
width: 50%;
height: 50%;
align-items: center;
justify-content: center;
border-radius: 5%;
background-color: white;
}
</style>

Some files were not shown because too many files have changed in this diff Show More