initial commit
8
.env.example
Normal file
|
@ -0,0 +1,8 @@
|
|||
NODE_ENV=production #if set to development, morgan middleware will log every request
|
||||
PORT=3000 # if unset, default back to 3000
|
||||
|
||||
#optional properties. default shown. comment out by removing # to enable them.
|
||||
|
||||
#user agent and accept header that quora will see
|
||||
#AXIOS_USER_AGENT='axios/0.26.1'
|
||||
#AXIOS_ACCEPT='application/json, text/plain, */*'
|
12
.eslintrc.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": ["airbnb-base", "prettier"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": { "spaced-comment": 0, "import/extensions": 0 }
|
||||
}
|
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
.vscode/*
|
||||
node_modules/*
|
||||
.env
|
||||
dev-data/*
|
661
LICENSE
Normal file
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
189
README.md
Normal file
|
@ -0,0 +1,189 @@
|
|||
# **Quetre**
|
||||
|
||||
Quetre is an alternative front-end to Quora.
|
||||
It enables you to see answers without ads, trackers, and other such bloat.
|
||||
|
||||
---
|
||||
|
||||
## **Key Features**
|
||||
|
||||
- Privacy focused
|
||||
|
||||
All requests except for images are proxied which makes it impossible for Quora to collate meaningful data points about you.
|
||||
|
||||
- No ads or tracking
|
||||
|
||||
Absolutely no ads, no tracking, no browser fingerprinting, and no telemetry of any kind.
|
||||
|
||||
- Fully responsive layout
|
||||
|
||||
Utilises modern CSS features like CSS Grid and Flexbox to make the website fully responsive for all screen sizes.
|
||||
|
||||
- Lightweight and fast
|
||||
|
||||
As the website contains no bloat, pages load in a jiffy and request sizes are tiny.
|
||||
|
||||
- Dark and light themes
|
||||
|
||||
Whether you're a nightowl or bright screen lover, you'll enjoy curated color scheme for your taste.
|
||||
|
||||
- Unofficial API support
|
||||
|
||||
just add `/api/v1/` after the domain name in the URL and get a JSON repsonse.
|
||||
|
||||
---
|
||||
|
||||
## **Screenshots**
|
||||
|
||||
| | |
|
||||
| :------------------------------: | :-------------------------------: |
|
||||
|  |  |
|
||||
|
||||
---
|
||||
|
||||
## **Comparision**
|
||||
|
||||
### Speed
|
||||
|
||||
URL for comparision: https://www.quora.com/How-does-the-Z-boson-decay
|
||||
| | Quora | Quetre |
|
||||
| :------------- | :---- | :------ |
|
||||
| No. of requests | 83* | 15 |
|
||||
| Load time | 6.76s | 4.61s |
|
||||
| Finish time | 2.44min* | 4.62s |
|
||||
| Data consumed | 3.49MB | 404.47KB |
|
||||
|
||||
\*the requests were ongoing even after 6 minutes
|
||||
|
||||
---
|
||||
|
||||
### Usability
|
||||
|
||||
- Quora: You can't even see an answer(except for some hacks) if you're not signed in. They put a big banner in front of answers to sign you up/in forcefully.
|
||||
|
||||
- Quetre: There is no accounts system. Just read whatever you want to read. Zero fuss.
|
||||
|
||||
---
|
||||
|
||||
### Privacy
|
||||
|
||||
#### Quora(when browsing anonymously)
|
||||
|
||||
From [their privacy policy](https://www.quora.com/about/privacy)
|
||||
|
||||
- Technologies used
|
||||
- cookies
|
||||
- log files
|
||||
- clear GIFs/pixel tags
|
||||
- JavaScript
|
||||
- web beacons
|
||||
- local storage objects
|
||||
- Analytics Tools
|
||||
- other tracking technologies
|
||||
- Data collected
|
||||
- searches
|
||||
- page views
|
||||
- date and time of your visit
|
||||
- browser type
|
||||
- type of computer or mobile device
|
||||
- browser language
|
||||
- IP address
|
||||
- mobile carrier
|
||||
- unique device identifier
|
||||
- location
|
||||
- requested and referring URLs
|
||||
- other information about your use of the Quora Platform
|
||||
|
||||
#### Quetre
|
||||
|
||||
- Data actively collected by Quetre
|
||||
|
||||
None.
|
||||
|
||||
- Data passively collected by Quetre
|
||||
|
||||
Whenever you hit some error page, an error object is logged to the console on the server. That error object contains the resource url you were trying to access, and the usual stack trace. That's it.
|
||||
|
||||
- Data stored locally in your browser
|
||||
|
||||
A key called 'theme' is stored in local storage provided by your browser to store your theme preference should you override the default theme. To prevent this behaviour, either disable JavaScript or local storage for Quetre.
|
||||
|
||||
- Data collected by other services
|
||||
|
||||
Since Quetre is deployed on heroku, heroku might log your IP to prevent abuse. Also, as Quetre connects to '\*.quoracdn.net' and 'cdn.jsdelivr.net' for images and mathjax library respectively, both of these service might log some data. So, follow due precaution. Using a VPN might be a good idea. Or even better, consider hosting your own instance.
|
||||
|
||||
---
|
||||
|
||||
## FAQs
|
||||
|
||||
- There are some unreachable routes.
|
||||
|
||||
I'm working to implement them soon. Keep an eye on [To-Do list](#to-do).
|
||||
|
||||
- Why is website connecting to '\*.quoracdn.net' and 'cdn.jsdelivr.net'?
|
||||
|
||||
For the moment, images aren't proxied but directly fetched from quora. Hence the connection to quoracdn. As for the connection to jsdelivr, it is for an open source library – [Mathjax](https://www.mathjax.org/) – which is used to display math eqations nicely. If I get enough time, I'll include it locally.
|
||||
|
||||
- Why are some math equations showing up weirdly?
|
||||
|
||||
If you're browsing with JavaScript disabled, then the Mathjax library isn't able to load and format tex equations. I'd recommend to enable JavaScript for it since there's no other way to show them in the browser. Even Quora uses Mathjax.
|
||||
|
||||
- Why can I only view a couple of answers?
|
||||
|
||||
Quora doesn't show all answers at once. It only loads more answers as the user scrolls down. Furthermore, it uses many unique IDs to send ajax requests to fetch those answers. So, all in all, getting more answers isn't impossible but quite difficult requiring some serious amount of time on their website in order to figure out how it all happens. I'm short on time for now.
|
||||
|
||||
- I have some ideas/want to help.
|
||||
|
||||
You're most welcome to do that. Just [contact me](#contact) or fork [the repo](https://github.com/zyachel/quetre/fork) and make a pull request. You can even help by correcting some typos or translating this README to other languages.
|
||||
|
||||
- Why the name Quetre?
|
||||
|
||||
Quora is [supposedly](https://www.quora.com/Why-is-Quora-called-Quora-4) a portmanteau of 'Questions or answers'. In the same vein, Quetre is a portmanteau of 'Questions and answers', but [in Latin](https://lingva.ml/en/la/questions%20and%20answers%0A).
|
||||
|
||||
---
|
||||
|
||||
## To-Do
|
||||
|
||||
- [ ] add missing routes like topics, profile, and search
|
||||
- [ ] use redis
|
||||
- [ ] serve images and other assets from Quetre
|
||||
- [ ] implement a better installation method
|
||||
- [ ] implement other trivial routes like a specific answer, spaces, etc.
|
||||
- [ ] implement a way to get more answers(not a big priority as of now)
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install [Node.js](https://nodejs.org/en/) and [Git](https://git-scm.com/). Instructions are on their websites.
|
||||
|
||||
2. Clone and set up the repository.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/zyachel/quetre.git
|
||||
cd quetre
|
||||
cp .env.example .env # you can make any changes here
|
||||
# change `pnpm` to `npm run` here as well as in package.json if you use `npm`
|
||||
pnpm install
|
||||
pnpm start
|
||||
```
|
||||
|
||||
Quetre will start running at http://localhost:3000.
|
||||
|
||||
---
|
||||
|
||||
## Misc
|
||||
|
||||
Check out these [projects](https://github.com/mendel5/alternative-front-ends) similar to Quetre.
|
||||
|
||||
---
|
||||
|
||||
## Contact
|
||||
|
||||
Send a message on [\[matrix\]](https://matrix.to/#/@ninal:matrix.org) or go old school with [email](mailto:aricla@protonmail.com) in case you wish to contact me.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
Licensed under [GNU AGPLv3](/LICENSE).
|
60
app.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import express from 'express';
|
||||
import morgan from 'morgan';
|
||||
import helmet from 'helmet';
|
||||
import compression from 'compression';
|
||||
import { fileURLToPath } from 'url';
|
||||
import viewRouter from './routes/viewRoutes.js';
|
||||
import apiRouter from './routes/apiRoutes.js';
|
||||
import globalErrorHandler from './controllers/errorController.js';
|
||||
import AppError from './utils/AppError.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// CREATING AND CONFIGURING APP
|
||||
////////////////////////////////////////////////////////
|
||||
const app = express();
|
||||
|
||||
app.set('view engine', 'pug');
|
||||
const pathToViews = fileURLToPath(new URL('./views/pug', import.meta.url));
|
||||
app.set('views', pathToViews);
|
||||
const pathToPublicDirectory = fileURLToPath(
|
||||
new URL('./public', import.meta.url)
|
||||
);
|
||||
app.use(express.static(pathToPublicDirectory));
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// MIDDLEWARES
|
||||
////////////////////////////////////////////////////////
|
||||
app.use(compression()); // compressing responses
|
||||
app.use(
|
||||
helmet({
|
||||
contentSecurityPolicy: {
|
||||
directives: {
|
||||
'img-src': ["'self'", '*.quoracdn.net'],
|
||||
'script-src': ["'self'", 'cdn.jsdelivr.net'],
|
||||
},
|
||||
},
|
||||
crossOriginEmbedderPolicy: false,
|
||||
})
|
||||
); // using sane headers on response
|
||||
if (process.env.NODE_ENV === 'development') app.use(morgan('dev')); // for logging during development
|
||||
|
||||
app.use('/', viewRouter);
|
||||
app.use('/api/v1/', apiRouter);
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// HANDLING ERRORS
|
||||
////////////////////////////////////////////////////////
|
||||
// for all other routes, throwing error
|
||||
app.all('*', (req, res, next) => {
|
||||
next(new AppError(`this route(${req.originalUrl}) doesn't exist`, 404));
|
||||
});
|
||||
|
||||
app.use(globalErrorHandler);
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default app;
|
35
controllers/apiController.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import catchAsyncErrors from '../utils/catchAsyncErrors.js';
|
||||
import getAnswers from '../fetchers/getAnswers.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export const about = (req, res, next) => {
|
||||
res
|
||||
.status(200)
|
||||
.json({
|
||||
status: 'success',
|
||||
message:
|
||||
"make a request. available endpoints are: '/some-slug', '/unanswered/some-slug'",
|
||||
});
|
||||
};
|
||||
|
||||
export const unansweredQuestion = catchAsyncErrors(async (req, res, next) => {
|
||||
const data = await getAnswers(`/unanswered/${req.params.slug}`);
|
||||
res.status(200).json({ status: 'success', data });
|
||||
});
|
||||
|
||||
export const answeredQuestion = catchAsyncErrors(async (req, res, next) => {
|
||||
const data = await getAnswers(req.params.slug);
|
||||
res.status(200).json({ status: 'success', data });
|
||||
});
|
||||
|
||||
export const unimplemented = (req, res, next) => {
|
||||
res.status(503).json({
|
||||
status: 'fail',
|
||||
message: "This route isn't yet implemented. Check back sometime later!",
|
||||
});
|
||||
};
|
63
controllers/errorController.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* eslint-disable no-param-reassign */
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import log from '../utils/log.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
////////////////////////////////////////////////////////
|
||||
/**
|
||||
* @description function to send error responses to the client
|
||||
* @param {{}} err error object
|
||||
* @param {{}} req request object provided by express
|
||||
* @param {{}} res response object provided by express
|
||||
* @param {boolean} devMode if set to true, will send full stack trace to the client
|
||||
*/
|
||||
const sendErrorResponse = (err, req, res, devMode = false) => {
|
||||
// 1. FOR API
|
||||
if (req.originalUrl.startsWith('/api/'))
|
||||
res.status(err.statusCode).json({
|
||||
status: err.status,
|
||||
message: err.message,
|
||||
// only if devMode is true, will this stack trace get sent. using es6 spreading and short circuiting
|
||||
...(devMode && { stack: err.stack }),
|
||||
});
|
||||
// 2. FOR WEBPAGES
|
||||
else
|
||||
res.status(err.statusCode).render('error', {
|
||||
title: 'Error',
|
||||
statusCode: err.statusCode,
|
||||
message: err.message,
|
||||
...(devMode && { stack: err.stack }),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @description function to handle all errors occuring in the app
|
||||
* @param {{}} err object containing full error
|
||||
* @param {{}} req request object in express
|
||||
* @param {{}} res response object in express
|
||||
* @param {function} next function to call next middleware in express
|
||||
*/
|
||||
|
||||
const globalErrorHandler = (err, req, res, next) => {
|
||||
// since not all errors will be an instance of AppError class(as not errors will be manually thrown by us), we have to set sensible defaults before dealing with those errors
|
||||
err.statusCode = err.statusCode || 500;
|
||||
err.status = err.status || 'error';
|
||||
log(err, 'error');
|
||||
|
||||
if (process.env.NODE_ENV === 'development')
|
||||
sendErrorResponse(err, req, res, true);
|
||||
else {
|
||||
// if error is not operational, sending a generic error message and not revealing full details in production mode
|
||||
if (err.name !== 'OperationalError') err.message = 'something went wrong!';
|
||||
sendErrorResponse(err, req, res);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default globalErrorHandler;
|
48
controllers/viewController.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import catchAsyncErrors from '../utils/catchAsyncErrors.js';
|
||||
import getAnswers from '../fetchers/getAnswers.js';
|
||||
import { nonSlugRoutes } from '../utils/constants.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export const about = (req, res, next) => {
|
||||
res.render('about', { title: 'About' });
|
||||
};
|
||||
export const privacy = (req, res, next) => {
|
||||
res.render('privacy', { title: 'Privacy' });
|
||||
};
|
||||
|
||||
export const unansweredQuestion = catchAsyncErrors(async (req, res, next) => {
|
||||
const answers = await getAnswers(`/unanswered/${req.params.slug}`);
|
||||
res.status(200).render('answers', {
|
||||
title: answers.question.text.spans.map(span => span.text).join(''),
|
||||
data: answers,
|
||||
math: answers.hasMath,
|
||||
});
|
||||
});
|
||||
|
||||
export const answeredQuestion = catchAsyncErrors(async (req, res, next) => {
|
||||
const { slug } = req.params;
|
||||
// added this so that a request by browser to get favicon doesn't end up being interpreted as a slug
|
||||
if (nonSlugRoutes.includes(slug)) return next();
|
||||
|
||||
const answers = await getAnswers(slug);
|
||||
|
||||
res.status(200).render('answers', {
|
||||
title: answers.question.text.spans.map(span => span.text).join(''),
|
||||
data: answers,
|
||||
math: answers.hasMath,
|
||||
});
|
||||
});
|
||||
|
||||
export const unimplemented = (req, res, next) => {
|
||||
res.status(503).render('error', {
|
||||
title: 'Not yet implemented',
|
||||
statusCode: 503,
|
||||
message: "This route isn't yet implemented. Check back sometime later!",
|
||||
});
|
||||
};
|
51
fetchers/fetcher.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* eslint-disable no-useless-catch */
|
||||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import * as cheerio from 'cheerio';
|
||||
import axiosInstance from '../utils/axiosInstance.js';
|
||||
import AppError from '../utils/AppError.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FUNCTION
|
||||
////////////////////////////////////////////////////////
|
||||
/**
|
||||
*
|
||||
* @param {string} resourceStr a string after the baseURL
|
||||
* @returns JSON containing the result
|
||||
* @description makes a call to quora.com(with the resourceStr appended) and returns parsed JSON containing the data about the resource requested.
|
||||
* @example await fetcher('What-is-free-and-open-software'); // will return object containing answers
|
||||
* await fetcher('topic/Space-Physics'); // will return 'space physics' topic object
|
||||
* await fetcher('profile/Charlie-Cheever'); // will return object containing information about charlie cheever
|
||||
*/
|
||||
const fetcher = async resourceStr => {
|
||||
try {
|
||||
// as url might contain unescaped chars. so, encodeing it right away
|
||||
const res = await axiosInstance.get(encodeURIComponent(resourceStr));
|
||||
|
||||
const $ = cheerio.load(res.data);
|
||||
let rawData;
|
||||
$('body')
|
||||
.children('script')
|
||||
.each((i, el) => {
|
||||
if ($(el).html() === 'window.installSettings();')
|
||||
rawData = $(el)
|
||||
.next()
|
||||
.html()
|
||||
?.match(/"\{.*\}"/m)?.[0];
|
||||
});
|
||||
if (!rawData) throw new Error("couldn't retrieve data");
|
||||
|
||||
const data = JSON.parse(rawData);
|
||||
|
||||
return data;
|
||||
} catch (err) {
|
||||
if (err.response.status === 404) throw new AppError('Not found', 404);
|
||||
else throw err;
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default fetcher;
|
84
fetchers/getAnswers.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
// import log from '../utils/log.js';
|
||||
import fetcher from './fetcher.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FUNCTION
|
||||
////////////////////////////////////////////////////////
|
||||
const getAnswers = async slug => {
|
||||
// getting data and destructuring it in case it exists
|
||||
const res = await fetcher(slug);
|
||||
if (!Object.entries(res).length) throw new Error('no data received!');
|
||||
|
||||
const {
|
||||
data: { question: rawData },
|
||||
} = JSON.parse(res);
|
||||
|
||||
// array containing all the answers with metadata
|
||||
const ansArr = rawData.pagedListDataConnection.edges
|
||||
.filter(ansObj => ansObj.node.answer !== undefined)
|
||||
.map(ansObj => ({
|
||||
text: JSON.parse(ansObj.node.answer.content).sections,
|
||||
isViewable: !!ansObj.node.answer.viewerHasAccess,
|
||||
creationTime: ansObj.node.answer.creationTime,
|
||||
updatedTime: ansObj.node.answer.updatedTime,
|
||||
numComments: ansObj.node.answer.numDisplayComments,
|
||||
numUpvotes: ansObj.node.answer.numUpvotes,
|
||||
numViews: ansObj.node.answer.numViews,
|
||||
numShares: ansObj.node.answer.numSharers,
|
||||
numAnswerRequests: ansObj.node.answer.numRequesters,
|
||||
aid: ansObj.node.answer.aid,
|
||||
isBusinessAnswer: ansObj.node.answer.businessAnswer,
|
||||
author: {
|
||||
uid: ansObj.node.answer.author.uid,
|
||||
isAnon: ansObj.node.answer.author.isAnon,
|
||||
avatar: ansObj.node.answer.author.profileImageUrl,
|
||||
isVerified: ansObj.node.answer.author.isVerified,
|
||||
profile: ansObj.node.answer.author.profileUrl,
|
||||
name: `${ansObj.node.answer.author.names[0].givenName} ${ansObj.node.answer.author.names[0].familyName}`,
|
||||
credential: ansObj.node.answer.authorCredential?.translatedString,
|
||||
// additionalCredentials: ansObj.node.answer?.credibilityFacts.map(),
|
||||
},
|
||||
OriginalQuestion: {
|
||||
text: JSON.parse(ansObj.node.answer.question.title).sections[0],
|
||||
url: ansObj.node.answer.question.url,
|
||||
qid: ansObj.node.answer.question.qid,
|
||||
isDeleted: ansObj.node.answer.question.isDeleted,
|
||||
},
|
||||
}));
|
||||
|
||||
// main data object to be returned
|
||||
const data = {
|
||||
question: {
|
||||
text: JSON.parse(rawData.title).sections[0],
|
||||
url: rawData.url,
|
||||
qid: rawData.qid,
|
||||
idDeleted: rawData.isDeleted,
|
||||
isViewable: rawData.isVisibleToViewer,
|
||||
askerUid: rawData.asker.uid,
|
||||
},
|
||||
numAnswers: rawData.answerCount,
|
||||
answers: ansArr,
|
||||
topics: rawData.topics.map(topicObj => ({
|
||||
tid: topicObj.tid,
|
||||
name: topicObj.name,
|
||||
url: topicObj.url,
|
||||
})),
|
||||
relatedQuestions: rawData.bottomRelatedQuestionsInfo.relatedQuestions.map(
|
||||
questionObj => ({
|
||||
qid: questionObj.qid,
|
||||
url: questionObj.url,
|
||||
text: JSON.parse(questionObj.title).sections[0],
|
||||
})
|
||||
),
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default getAnswers;
|
61
package.json
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"name": "quetre",
|
||||
"version": "1.0.0",
|
||||
"description": "a libre front-end for Quora",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"sass:watch": "sass views/sass/main.scss:public/css/styles.css --watch",
|
||||
"sass:build": "sass views/sass/main.scss:public/css/styles.css --style=compressed",
|
||||
"server:dev": "NODE_ENV=development nodemon server.js",
|
||||
"server:prod": "nodemon server.js",
|
||||
"dev": "(pnpm sass:watch) & (pnpm server:dev)",
|
||||
"prod": "(pnpm sass:build) & (pnpm server:prod)",
|
||||
"start": "(npm run sass:build) & (node server.js)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zyachel/quetre.git"
|
||||
},
|
||||
"keywords": [
|
||||
"front-end"
|
||||
],
|
||||
"author": "zyachel",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zyachel/quetre/issues"
|
||||
},
|
||||
"homepage": "https://github.com/zyachel/quetre#readme",
|
||||
"dependencies": {
|
||||
"axios": "^0.26.1",
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"compression": "^1.7.4",
|
||||
"dotenv": "^16.0.0",
|
||||
"express": "^4.17.3",
|
||||
"helmet": "^5.0.2",
|
||||
"morgan": "^1.10.0",
|
||||
"pug": "^3.0.2",
|
||||
"sass": "^1.50.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/create-config": "^0.1.2",
|
||||
"@types/express": "^4.17.13",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"nodemon": "^2.0.15",
|
||||
"prettier": "^2.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"prettier": "^2.3.0"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"ignore": [
|
||||
"dev-data/*",
|
||||
"public/*"
|
||||
]
|
||||
}
|
||||
}
|
2631
pnpm-lock.yaml
generated
Normal file
BIN
public/android-chrome-192x192.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
public/android-chrome-512x512.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
public/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
9
public/browserconfig.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square150x150logo src="/mstile-150x150.png"/>
|
||||
<TileColor>#0f0e15</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
1031
public/css/styles.css
Normal file
1
public/css/styles.css.map
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sourceRoot":"","sources":["../../views/sass/_mixins.scss","../../views/sass/_base.scss","../../views/sass/_components.scss","../../views/sass/_layouts.scss","../../views/sass/_pages.scss"],"names":[],"mappings":";AAUA;EACE;IACE;IACA;;EAEF;IACE;IACA;;;ACTJ;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAMF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAAA;AAAA;EAGE;EACA;EACA;;;AAMF;EDhBI;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAQA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;;ACeF;EDfE;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;;ACsBA;EAFF;IDpBE;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;;;;AC6BJ;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EAEA;;;AD2BA;ECxBF;IAEI;IACA;;;;AAOJ;EACE;EACA;;;AAIF;EACE;IACE;IACA;;;AAKJ;EACE;IACE;IACA;;;EAGF;IACE;IACA;IACA;IACA;;EAEA;IACE;;;EAIJ;IACE;;;AAOJ;EACE;EACA;;;AAGF;EACE;IACE;;;EAGF;IACE;IACA;;;AAOJ;EACE;;;AAEF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AC7IA;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;AAEA;EACE;;;AAMJ;EACE;EAEA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EAEA;EACA;;AAGA;EACE;;AAGF;EACE;;;AAOF;EACE;;AAGF;EACE;;;AAQN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AFsBF;EEzBA;IAMI;IACA;;;;AAQN;EACE;EACA;;;AAMF;EACE;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;;AFTF;EEMA;IAMI;IACA;;;AAIJ;EACE;EACA;EACA;EACA;;AAKF;EACE;EACA;EAEA;EACA;;AF/BF;EE0BA;IAQI;IACA;;;AAIJ;EACE;EACA;;AAEF;EACE;;AF5CF;EEFF;IAkDI;;;AFhDF;EEFF;IAqDI;;;;AAOJ;EACE;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;EACA;;AFvEF;EEmEA;IAQI;;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;;AAEF;EACE;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AFtHF;EE0DF;IAgEI;;;AF1HF;EE0DF;IAmEI;;;;AAOJ;EACE;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EAEA;EACA;EAGA;EACA;;AAGA;EACE;EACA;;AAIJ;EACE;EACA;;AAGF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;;AAIF;EACE;;AAIF;EACE;EACA;EAUA;;AAPA;EAEE;;AASJ;EAEE;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAOF;EACE;;AAEF;EACE;;AAEF;EFzTA;EACA,OE0TI;EFnTF;EAIA;;AATF;EACE,OEwTE;;AAKJ;EAEE;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;;AAMF;EACE;EAEA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EAEA;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EAEA;EACA;;;AAOJ;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAKF;EAEE;;;AAOJ;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;;;ACtcJ;EACE;;AAEA;EACE;EACA;EAEA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AH6EF;EGlFA;IAQI;;;AH0EJ;EGlFA;IAWI;;;AAIJ;EACE;EACA;EACA;EACA;;AH+DF;EGnEA;IAOI;;;AAIJ;EACE;;AAGF;EAEE;;AHkDF;EGpDA;IAKI;;;AAIJ;EACE;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EHrBF;EACA,OGsBuB;EHfrB;;AALF;EACE,OGmByC;;AH8B3C;EGlCA;IAOI;;;AAIJ;EACE;EACA;;AHqBF;EGvBA;IAKI;IACA;;;AAIJ;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AHEF;EGNA;IAOI;;;AHDJ;EGNA;IAUI;IACA;;;AAIJ;EACE;;;AAOJ;EACE;EACA;EACA;EACA;EAEA;;AAEA;EACE;EACA;;AH3BF;EGyBA;IAKI;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;AHvCF;EGkCA;IAQI;;;AH1CJ;EGkCA;IAYI;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;AAWF;EACE;;AAGF;EH3HA;EACA,OG2HuB;EHpHrB;EGqHA;;AH1HF;EACE,OGwHyC;;AAI3C;EACE;EACA;EACA;EACA;;AH/EF;EGiBF;IAkEI;IACA;;;;AClLJ;EACE;EACA;EACA;;AAEA;EACE;;AJwFF;EIzFA;IAII;;;AJqFJ;EIzFA;IAOI;;;AAIJ;EJyBA;EACA,OIxBI;EJ+BF;EAIA;;AATF;EACE,OI1BE;;AAKJ;EACE;;AJqEF;EItEA;IAII;;;AAIJ;EACE;;AJ6DF;EI9DA;IAII;;;AJ0DJ;EI9DA;IAOI;;;AAIJ;EACE;EACA;EACA;EACA;;AJ+CF;EInDA;IAOI;;;AJ4CJ;EInDA;IAWI;;;AJwCJ;EInDA;IAcI;;;AAOJ;EACE;EACA;EACA;;AJ2BF;EI9BA;IAMI;;;AJwBJ;EI9FF;IA0EI;;EAEA;IACE;;;AJiBJ;EI9FF;IAiFI;;;;AAOJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;AJDF;EIDA;IAKI;;;AJJJ;EIDA;IAQI;;;AAIJ;EACE;;AJZF;EIWA;IAII;;;AJfJ;EIWA;IAOI;;;AAIJ;EACE;EACA;EACA;EACA;;AJ1BF;EIsBA;IAOI;;;AAIJ;EACE;EACA;;AJnCF;EIiCA;IAKI;;;AJtCJ;EINF;IAiDI;IACA;;;AJ5CF;EINF;IAqDI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EAEA;;AJlEF;EI6DA;IAQI;;;AAIJ;EAEE;EAEA;EACA;;AJ9EF;EIyEA;IAQI;;;AAIJ;EJ1IA;EACA,OI0IuB;EJnIrB;;AALF;EACE,OIuI2C;;AAG7C;EAEE;EACA;;AAIF;EACE;;;AAQJ;EAEE;EAEA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EAEA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;AJzIF;EIwIA;IAII;;;AAIJ;EJrMA;EACA,OIqMuB;EJ9LrB;;AALF;EACE,OIkM2C;;AAG7C;EACE;EACA;;AAEA;EACE;EACA;EACA;;AJ3JJ;EIoJA;IAWI;;EAEA;IACE;;;AJlKN;EIyGF;IA+DI;IACA;;;AJzKF;EIyGF;IAoEI;IACA;;;AJ9KF;EIyGF;IAwEI","file":"styles.css"}
|
BIN
public/favicon-32x32.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
public/favicon.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
public/fonts/Quicksand.woff2
Normal file
BIN
public/fonts/WorkSans.woff2
Normal file
41
public/js/index.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// CONSTANTS
|
||||
////////////////////////////////////////////////////////
|
||||
const rootEl = document.documentElement;
|
||||
const btnTheme = document.querySelector('.theme-changer');
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// HELPER FUNCTIONS
|
||||
////////////////////////////////////////////////////////
|
||||
// gets theme prefered by browser
|
||||
const browserPrefersDarkTheme = window.matchMedia(
|
||||
'prefers-color-scheme: dark'
|
||||
).matches;
|
||||
// gets theme prefered by user(stored in local storage)
|
||||
const userPrefersTheme = localStorage?.getItem('theme');
|
||||
// sets theme to local storage
|
||||
const setTheme = theme => rootEl.setAttribute('theme', theme);
|
||||
const localStorageAccessible = !!typeof Storage;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EVENT LISTENER
|
||||
////////////////////////////////////////////////////////
|
||||
btnTheme.addEventListener('click', () => {
|
||||
const curTheme = rootEl.getAttribute('theme') || 'light';
|
||||
const themeToSet = curTheme === 'light' ? 'dark' : 'light';
|
||||
setTheme(themeToSet);
|
||||
|
||||
// only setting the value in localStoage if it's actually accessible
|
||||
if (localStorageAccessible) localStorage.setItem('theme', themeToSet);
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// INIT FUNCTION
|
||||
////////////////////////////////////////////////////////
|
||||
(() => {
|
||||
// setting this attr on root to not render some css styles
|
||||
rootEl.setAttribute('js-enabled', '');
|
||||
// applying theme preferences in case they exist
|
||||
if (browserPrefersDarkTheme) setTheme('dark');
|
||||
else if (userPrefersTheme) setTheme(userPrefersTheme);
|
||||
})();
|
BIN
public/misc/img/preview.png
Normal file
After Width: | Height: | Size: 168 KiB |
BIN
public/misc/img/preview2.png
Normal file
After Width: | Height: | Size: 97 KiB |
120
public/misc/sprite.svg
Normal file
|
@ -0,0 +1,120 @@
|
|||
<svg width="0" height="0" class="hidden">
|
||||
<!--main logo-->
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 189.91 130.7" id="icon-logo">
|
||||
<g transform="translate(-6.7989 -97.001)">
|
||||
<text transform="matrix(13.904 0 0 13.904 -630.55 -1382.3)" fill="#000000" font-family="sans-serif" font-size="10.583px" font-weight="bold" style="font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal;line-height:1.25;shape-inside:url(#rect12);white-space:pre" xml:space="preserve"><tspan x="45.310547" y="114.24655"><tspan font-family="sans-serif" font-size="10.583px" font-weight="bold" style="font-variant-caps:normal;font-variant-east-asian:normal;font-variant-ligatures:normal;font-variant-numeric:normal">Qr</tspan></tspan></text>
|
||||
</g>
|
||||
</symbol>
|
||||
|
||||
<!--theme switcher icons-->
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-sun">
|
||||
<path d="M256 159.1c-53.02 0-95.1 42.98-95.1 95.1S202.1 351.1 256 351.1s95.1-42.98 95.1-95.1S309 159.1 256 159.1zM509.3 347L446.1 255.1l63.15-91.01c6.332-9.125 1.104-21.74-9.826-23.72l-109-19.7l-19.7-109c-1.975-10.93-14.59-16.16-23.72-9.824L256 65.89L164.1 2.736c-9.125-6.332-21.74-1.107-23.72 9.824L121.6 121.6L12.56 141.3C1.633 143.2-3.596 155.9 2.736 164.1L65.89 256l-63.15 91.01c-6.332 9.125-1.105 21.74 9.824 23.72l109 19.7l19.7 109c1.975 10.93 14.59 16.16 23.72 9.824L256 446.1l91.01 63.15c9.127 6.334 21.75 1.107 23.72-9.822l19.7-109l109-19.7C510.4 368.8 515.6 356.1 509.3 347zM256 383.1c-70.69 0-127.1-57.31-127.1-127.1c0-70.69 57.31-127.1 127.1-127.1s127.1 57.3 127.1 127.1C383.1 326.7 326.7 383.1 256 383.1z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-moon">
|
||||
<path d="M32 256c0-123.8 100.3-224 223.8-224c11.36 0 29.7 1.668 40.9 3.746c9.616 1.777 11.75 14.63 3.279 19.44C245 86.5 211.2 144.6 211.2 207.8c0 109.7 99.71 193 208.3 172.3c9.561-1.805 16.28 9.324 10.11 16.95C387.9 448.6 324.8 480 255.8 480C132.1 480 32 379.6 32 256z"></path>
|
||||
</symbol>
|
||||
|
||||
<!--miscellaneous logos-->
|
||||
<!-- on about page -->
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" id="icon-down">
|
||||
<path d="M169.4 278.6C175.6 284.9 183.8 288 192 288s16.38-3.125 22.62-9.375l160-160c12.5-12.5 12.5-32.75 0-45.25s-32.75-12.5-45.25 0L192 210.8L54.63 73.38c-12.5-12.5-32.75-12.5-45.25 0s-12.5 32.75 0 45.25L169.4 278.6zM329.4 265.4L192 402.8L54.63 265.4c-12.5-12.5-32.75-12.5-45.25 0s-12.5 32.75 0 45.25l160 160C175.6 476.9 183.8 480 192 480s16.38-3.125 22.62-9.375l160-160c12.5-12.5 12.5-32.75 0-45.25S341.9 252.9 329.4 265.4z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" id="icon-spy">
|
||||
<path d="M377.7 338.8l37.15-92.87C419 235.4 411.3 224 399.1 224h-57.48C348.5 209.2 352 193 352 176c0-4.117-.8359-8.057-1.217-12.08C390.7 155.1 416 142.3 416 128c0-16.08-31.75-30.28-80.31-38.99C323.8 45.15 304.9 0 277.4 0c-10.38 0-19.62 4.5-27.38 10.5c-15.25 11.88-36.75 11.88-52 0C190.3 4.5 181.1 0 170.7 0C143.2 0 124.4 45.16 112.5 88.98C63.83 97.68 32 111.9 32 128c0 14.34 25.31 27.13 65.22 35.92C96.84 167.9 96 171.9 96 176C96 193 99.47 209.2 105.5 224H48.02C36.7 224 28.96 235.4 33.16 245.9l37.15 92.87C27.87 370.4 0 420.4 0 477.3C0 496.5 15.52 512 34.66 512H413.3C432.5 512 448 496.5 448 477.3C448 420.4 420.1 370.4 377.7 338.8zM176 479.1L128 288l64 32l16 32L176 479.1zM271.1 479.1L240 352l16-32l64-32L271.1 479.1zM320 186C320 207 302.8 224 281.6 224h-12.33c-16.46 0-30.29-10.39-35.63-24.99C232.1 194.9 228.4 192 224 192S215.9 194.9 214.4 199C209 213.6 195.2 224 178.8 224h-12.33C145.2 224 128 207 128 186V169.5C156.3 173.6 188.1 176 224 176s67.74-2.383 96-6.473V186z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-fingerprint">
|
||||
<path d="M256.1 246c-13.25 0-23.1 10.75-23.1 23.1c1.125 72.25-8.124 141.9-27.75 211.5C201.7 491.3 206.6 512 227.5 512c10.5 0 20.12-6.875 23.12-17.5c13.5-47.87 30.1-125.4 29.5-224.5C280.1 256.8 269.4 246 256.1 246zM255.2 164.3C193.1 164.1 151.2 211.3 152.1 265.4c.75 47.87-3.75 95.87-13.37 142.5c-2.75 12.1 5.624 25.62 18.62 28.37c12.1 2.625 25.62-5.625 28.37-18.62c10.37-50.12 15.12-101.6 14.37-152.1C199.7 238.6 219.1 212.1 254.5 212.3c31.37 .5 57.24 25.37 57.62 55.5c.8749 47.1-2.75 96.25-10.62 143.5c-2.125 12.1 6.749 25.37 19.87 27.62c19.87 3.25 26.75-15.12 27.5-19.87c8.249-49.1 12.12-101.1 11.25-151.1C359.2 211.1 312.2 165.1 255.2 164.3zM144.6 144.5C134.2 136.1 119.2 137.6 110.7 147.9C85.25 179.4 71.38 219.3 72 259.9c.6249 37.62-2.375 75.37-8.999 112.1c-2.375 12.1 6.249 25.5 19.25 27.87c20.12 3.5 27.12-14.87 27.1-19.37c7.124-39.87 10.5-80.62 9.749-121.4C119.6 229.3 129.2 201.3 147.1 178.3C156.4 167.9 154.9 152.9 144.6 144.5zM253.1 82.14C238.6 81.77 223.1 83.52 208.2 87.14c-12.87 2.1-20.87 15.1-17.87 28.87c3.125 12.87 15.1 20.75 28.1 17.75C230.4 131.3 241.7 130 253.4 130.1c75.37 1.125 137.6 61.5 138.9 134.6c.5 37.87-1.375 75.1-5.624 113.6c-1.5 13.12 7.999 24.1 21.12 26.5c16.75 1.1 25.5-11.87 26.5-21.12c4.625-39.75 6.624-79.75 5.999-119.7C438.6 165.3 355.1 83.64 253.1 82.14zM506.1 203.6c-2.875-12.1-15.51-21.25-28.63-18.38c-12.1 2.875-21.12 15.75-18.25 28.62c4.75 21.5 4.875 37.5 4.75 61.62c-.1249 13.25 10.5 24.12 23.75 24.25c13.12 0 24.12-10.62 24.25-23.87C512.1 253.8 512.3 231.8 506.1 203.6zM465.1 112.9c-48.75-69.37-128.4-111.7-213.3-112.9c-69.74-.875-134.2 24.84-182.2 72.96c-46.37 46.37-71.34 108-70.34 173.6l-.125 21.5C-.3651 281.4 10.01 292.4 23.26 292.8C23.51 292.9 23.76 292.9 24.01 292.9c12.1 0 23.62-10.37 23.1-23.37l.125-23.62C47.38 193.4 67.25 144 104.4 106.9c38.87-38.75 91.37-59.62 147.7-58.87c69.37 .1 134.7 35.62 174.6 92.37c7.624 10.87 22.5 13.5 33.37 5.875C470.1 138.6 473.6 123.8 465.1 112.9z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" id="icon-bolt">
|
||||
<path d="M240.5 224H352C365.3 224 377.3 232.3 381.1 244.7C386.6 257.2 383.1 271.3 373.1 280.1L117.1 504.1C105.8 513.9 89.27 514.7 77.19 505.9C65.1 497.1 60.7 481.1 66.59 467.4L143.5 288H31.1C18.67 288 6.733 279.7 2.044 267.3C-2.645 254.8 .8944 240.7 10.93 231.9L266.9 7.918C278.2-1.92 294.7-2.669 306.8 6.114C318.9 14.9 323.3 30.87 317.4 44.61L240.5 224z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" id="icon-code">
|
||||
<path d="M414.8 40.79L286.8 488.8C281.9 505.8 264.2 515.6 247.2 510.8C230.2 505.9 220.4 488.2 225.2 471.2L353.2 23.21C358.1 6.216 375.8-3.624 392.8 1.232C409.8 6.087 419.6 23.8 414.8 40.79H414.8zM518.6 121.4L630.6 233.4C643.1 245.9 643.1 266.1 630.6 278.6L518.6 390.6C506.1 403.1 485.9 403.1 473.4 390.6C460.9 378.1 460.9 357.9 473.4 345.4L562.7 256L473.4 166.6C460.9 154.1 460.9 133.9 473.4 121.4C485.9 108.9 506.1 108.9 518.6 121.4V121.4zM166.6 166.6L77.25 256L166.6 345.4C179.1 357.9 179.1 378.1 166.6 390.6C154.1 403.1 133.9 403.1 121.4 390.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4L121.4 121.4C133.9 108.9 154.1 108.9 166.6 121.4C179.1 133.9 179.1 154.1 166.6 166.6V166.6z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-responsive">
|
||||
<path d="M4,6V16H9V12A2,2 0 0,1 11,10H16A2,2 0 0,1 18,12V16H20V6H4M0,20V18H4A2,2 0 0,1 2,16V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V16A2,2 0 0,1 20,18H24V20H18V20C18,21.11 17.1,22 16,22H11A2,2 0 0,1 9,20H9L0,20M11.5,20A0.5,0.5 0 0,0 11,20.5A0.5,0.5 0 0,0 11.5,21A0.5,0.5 0 0,0 12,20.5A0.5,0.5 0 0,0 11.5,20M15.5,20A0.5,0.5 0 0,0 15,20.5A0.5,0.5 0 0,0 15.5,21A0.5,0.5 0 0,0 16,20.5A0.5,0.5 0 0,0 15.5,20M13,20V21H14V20H13M11,12V19H16V12H11Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-palette">
|
||||
<path d="M512 255.1C512 256.9 511.1 257.8 511.1 258.7C511.6 295.2 478.4 319.1 441.9 319.1H344C317.5 319.1 296 341.5 296 368C296 371.4 296.4 374.7 297 377.9C299.2 388.1 303.5 397.1 307.9 407.8C313.9 421.6 320 435.3 320 449.8C320 481.7 298.4 510.5 266.6 511.8C263.1 511.9 259.5 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256V255.1zM96 255.1C78.33 255.1 64 270.3 64 287.1C64 305.7 78.33 319.1 96 319.1C113.7 319.1 128 305.7 128 287.1C128 270.3 113.7 255.1 96 255.1zM128 191.1C145.7 191.1 160 177.7 160 159.1C160 142.3 145.7 127.1 128 127.1C110.3 127.1 96 142.3 96 159.1C96 177.7 110.3 191.1 128 191.1zM256 63.1C238.3 63.1 224 78.33 224 95.1C224 113.7 238.3 127.1 256 127.1C273.7 127.1 288 113.7 288 95.1C288 78.33 273.7 63.1 256 63.1zM384 191.1C401.7 191.1 416 177.7 416 159.1C416 142.3 401.7 127.1 384 127.1C366.3 127.1 352 142.3 352 159.1C352 177.7 366.3 191.1 384 191.1z"/>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" id="icon-open">
|
||||
<path d="M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"></path>
|
||||
</symbol>
|
||||
|
||||
<!-- answers page -->
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-verified">
|
||||
<path d="M23,12L20.56,9.22L20.9,5.54L17.29,4.72L15.4,1.54L12,3L8.6,1.54L6.71,4.72L3.1,5.53L3.44,9.21L1,12L3.44,14.78L3.1,18.47L6.71,19.29L8.6,22.47L12,21L15.4,22.46L17.29,19.28L20.9,18.46L20.56,14.78L23,12M10,17L6,13L7.41,11.59L10,14.17L16.59,7.58L18,9L10,17Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-danger">
|
||||
<path d="M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-eye">
|
||||
<path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-arrow-up">
|
||||
<path d="M15,20H9V12H4.16L12,4.16L19.84,12H15V20Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-comments">
|
||||
<path d="M12,23A1,1 0 0,1 11,22V19H7A2,2 0 0,1 5,17V7C5,5.89 5.9,5 7,5H21A2,2 0 0,1 23,7V17A2,2 0 0,1 21,19H16.9L13.2,22.71C13,22.9 12.75,23 12.5,23V23H12M13,17V20.08L16.08,17H21V7H7V17H13M3,15H1V3A2,2 0 0,1 3,1H19V3H3V15Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-share">
|
||||
<path d="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M14 16V13C10.39 13 7.81 14.43 6 17C6.72 13.33 8.94 9.73 14 9V6L19 11L14 16Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-clock">
|
||||
<path d="M12 2C6.5 2 2 6.5 2 12C2 17.5 6.5 22 12 22C17.5 22 22 17.5 22 12S17.5 2 12 2M16.3 15.2L11 12.3V7H12.5V11.4L17 13.9L16.3 15.2Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-clock-edit">
|
||||
<path d="M21 13.1C20.9 13.1 20.7 13.2 20.6 13.3L19.6 14.3L21.7 16.4L22.7 15.4C22.9 15.2 22.9 14.8 22.7 14.6L21.4 13.3C21.3 13.2 21.2 13.1 21 13.1M19.1 14.9L13 20.9V23H15.1L21.2 16.9L19.1 14.9M11 21.9C5.9 21.4 2 17.1 2 12C2 6.5 6.5 2 12 2C17.3 2 21.6 6.1 22 11.3C21.7 11.2 21.4 11.1 21 11.1C20.2 11.1 19.6 11.5 19.2 11.9L16.5 14.6L12.5 12.2V7H11V13L15.4 15.7L11 20.1V21.9Z"></path>
|
||||
</symbol>
|
||||
|
||||
<!-- not yet used -->
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-cancel">
|
||||
<path d="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM64 256c0-41.4 13.3-79.68 35.68-111.1l267.4 267.4C335.7 434.7 297.4 448 256 448C150.1 448 64 361.9 64 256zM412.3 367.1L144.9 99.68C176.3 77.3 214.6 64 256 64c105.9 0 192 86.13 192 192C448 297.4 434.7 335.7 412.3 367.1z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" id="icon-code-document">
|
||||
<path d="M162.1 257.8c-7.812-7.812-20.47-7.812-28.28 0l-48 48c-7.812 7.812-7.812 20.5 0 28.31l48 48C137.8 386.1 142.9 388 148 388s10.23-1.938 14.14-5.844c7.812-7.812 7.812-20.5 0-28.31L128.3 320l33.86-33.84C169.1 278.3 169.1 265.7 162.1 257.8zM365.3 93.38l-74.63-74.64C278.6 6.742 262.3 0 245.4 0H64C28.65 0 0 28.65 0 64l.0065 384c0 35.34 28.65 64 64 64H320c35.2 0 64-28.8 64-64V138.6C384 121.7 377.3 105.4 365.3 93.38zM336 448c0 8.836-7.164 16-16 16H64.02c-8.838 0-16-7.164-16-16L48 64.13c0-8.836 7.164-16 16-16h160L224 128c0 17.67 14.33 32 32 32h79.1V448zM221.9 257.8c-7.812 7.812-7.812 20.5 0 28.31L255.7 320l-33.86 33.84c-7.812 7.812-7.812 20.5 0 28.31C225.8 386.1 230.9 388 236 388s10.23-1.938 14.14-5.844l48-48c7.812-7.812 7.812-20.5 0-28.31l-48-48C242.3 250 229.7 250 221.9 257.8z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" id="icon-computer-home">
|
||||
<path d="M218.3 8.486C230.6-2.829 249.4-2.829 261.7 8.486L469.7 200.5C476.4 206.7 480 215.2 480 224H336C316.9 224 299.7 232.4 288 245.7V208C288 199.2 280.8 192 272 192H208C199.2 192 192 199.2 192 208V272C192 280.8 199.2 288 208 288H271.1V416H112C85.49 416 64 394.5 64 368V256H32C18.83 256 6.996 247.9 2.198 235.7C-2.6 223.4 .6145 209.4 10.3 200.5L218.3 8.486zM336 256H560C577.7 256 592 270.3 592 288V448H624C632.8 448 640 455.2 640 464C640 490.5 618.5 512 592 512H303.1C277.5 512 255.1 490.5 255.1 464C255.1 455.2 263.2 448 271.1 448H303.1V288C303.1 270.3 318.3 256 336 256zM352 304V448H544V304H352z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" id="icon-link-slash">
|
||||
<path d="M485.1 354.9l113.5-113.5c55.21-55.21 55.21-144.7 0-199.9C570.1 13.8 534.8 0 498.6 0s-72.36 13.8-99.96 41.41l-43.36 43.36c15.11 8.012 29.47 17.58 41.91 30.02c3.146 3.146 5.898 6.518 8.742 9.838l37.96-37.96C458.5 72.05 477.1 64 498.6 64s40.1 8.047 54.71 22.66c14.61 14.61 22.66 34.04 22.66 54.71s-8.049 40.1-22.66 54.71l-119 119l-30.09-23.59c21.49-51.28 12.12-112.4-29.63-154.1C346.1 109.8 310.8 96 274.6 96c-29.6 0-58.93 9.752-83.83 28.23L38.81 5.109C34.41 1.672 29.19 0 24.03 0c-7.125 0-14.19 3.156-18.91 9.187c-8.188 10.44-6.375 25.53 4.062 33.7l591.1 463.1c10.5 8.203 25.56 6.328 33.69-4.078c8.188-10.44 6.375-25.53-4.062-33.7L485.1 354.9zM350.8 249.6L244.3 166.2C253.8 162.2 264 160 274.6 160c20.67 0 40.1 8.049 54.71 22.66c14.62 14.61 22.66 34.04 22.66 54.71C352 241.5 351.4 245.6 350.8 249.6zM234 387.4l-37.96 37.96C181.5 439.1 162 448 141.4 448c-20.67 0-40.1-8.047-54.71-22.66c-14.61-14.61-22.66-34.04-22.66-54.71s8.049-40.1 22.66-54.71l84.83-84.83L120.7 191.3L41.41 270.7c-55.21 55.21-55.21 144.7 0 199.9C69.01 498.2 105.2 512 141.4 512c36.18 0 72.36-13.8 99.96-41.41l43.36-43.36c-15.11-8.012-29.47-17.58-41.91-30.02C239.6 394.1 236.9 390.7 234 387.4zM265.4 374.6C293 402.2 329.2 416 365.4 416c11.98 0 23.84-2.082 35.51-5.111L224.6 272.7C223.9 309.5 237.3 346.5 265.4 374.6z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" id="icon-eye-slash">
|
||||
<path d="M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-feather">
|
||||
<path d="M483.4 244.2L351.9 287.1h97.74c-9.874 10.62 3.75-3.125-46.24 46.87l-147.6 49.12h98.24c-74.99 73.12-194.6 70.62-246.8 54.1l-66.14 65.99c-9.374 9.374-24.6 9.374-33.98 0s-9.374-24.6 0-33.98l259.5-259.2c6.249-6.25 6.249-16.37 0-22.62c-6.249-6.249-16.37-6.249-22.62 0l-178.4 178.2C58.78 306.1 68.61 216.7 129.1 156.3l85.74-85.68c90.62-90.62 189.8-88.27 252.3-25.78C517.8 95.34 528.9 169.7 483.4 244.2z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-fast-forward">
|
||||
<path d="M52.51 440.6l171.5-142.9V214.3L52.51 71.41C31.88 54.28 0 68.66 0 96.03v319.9C0 443.3 31.88 457.7 52.51 440.6zM308.5 440.6l192-159.1c15.25-12.87 15.25-36.37 0-49.24l-192-159.1c-20.63-17.12-52.51-2.749-52.51 24.62v319.9C256 443.3 287.9 457.7 308.5 440.6z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-graph-rising">
|
||||
<path d="M472 432h-48a24 24 0 01-24-24V104a24 24 0 0124-24h48a24 24 0 0124 24v304a24 24 0 01-24 24zM344 432h-48a24 24 0 01-24-24V184a24 24 0 0124-24h48a24 24 0 0124 24v224a24 24 0 01-24 24zM216 432h-48a24 24 0 01-24-24V248a24 24 0 0124-24h48a24 24 0 0124 24v160a24 24 0 01-24 24zM88 432H40a24 24 0 01-24-24v-96a24 24 0 0124-24h48a24 24 0 0124 24v96a24 24 0 01-24 24z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" id="icon-rating">
|
||||
<path d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="icon-rewind">
|
||||
<path d="M459.5 71.41l-171.5 142.9v83.45l171.5 142.9C480.1 457.7 512 443.3 512 415.1V96.03C512 68.66 480.1 54.28 459.5 71.41zM203.5 71.41L11.44 231.4c-15.25 12.87-15.25 36.37 0 49.24l192 159.1c20.63 17.12 52.51 2.749 52.51-24.62v-319.9C255.1 68.66 224.1 54.28 203.5 71.41z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-like-dislike">
|
||||
<path d="M22.5,10H15.75C15.13,10 14.6,10.38 14.37,10.91L12.11,16.2C12.04,16.37 12,16.56 12,16.75V18A1,1 0 0,0 13,19H18.18L17.5,22.18V22.42C17.5,22.73 17.63,23 17.83,23.22L18.62,24L23.56,19.06C23.83,18.79 24,18.41 24,18V11.5A1.5,1.5 0 0,0 22.5,10M12,6A1,1 0 0,0 11,5H5.82L6.5,1.82V1.59C6.5,1.28 6.37,1 6.17,0.79L5.38,0L0.44,4.94C0.17,5.21 0,5.59 0,6V12.5A1.5,1.5 0 0,0 1.5,14H8.25C8.87,14 9.4,13.62 9.63,13.09L11.89,7.8C11.96,7.63 12,7.44 12,7.25V6Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" id="icon-person-slash">
|
||||
<path d="M95.1 477.3c0 19.14 15.52 34.67 34.66 34.67h378.7c5.625 0 10.73-1.65 15.42-4.029L264.9 304.3C171.3 306.7 95.1 383.1 95.1 477.3zM630.8 469.1l-277.1-217.9c54.69-14.56 95.18-63.95 95.18-123.2C447.1 57.31 390.7 0 319.1 0C250.2 0 193.7 55.93 192.3 125.4l-153.4-120.3C34.41 1.672 29.19 0 24.03 0C16.91 0 9.845 3.156 5.127 9.187c-8.187 10.44-6.375 25.53 4.062 33.7L601.2 506.9c10.5 8.203 25.56 6.328 33.69-4.078C643.1 492.4 641.2 477.3 630.8 469.1z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-image-slash">
|
||||
<path d="M21 17.2L6.8 3H19C20.1 3 21 3.9 21 5V17.2M20.7 22L19.7 21H5C3.9 21 3 20.1 3 19V4.3L2 3.3L3.3 2L22 20.7L20.7 22M16.8 18L12.9 14.1L11 16.5L8.5 13.5L5 18H16.8Z"></path>
|
||||
</symbol>
|
||||
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-legal">
|
||||
<path d="M12,3C10.73,3 9.6,3.8 9.18,5H3V7H4.95L2,14C1.53,16 3,17 5.5,17C8,17 9.56,16 9,14L6.05,7H9.17C9.5,7.85 10.15,8.5 11,8.83V20H2V22H22V20H13V8.82C13.85,8.5 14.5,7.85 14.82,7H17.95L15,14C14.53,16 16,17 18.5,17C21,17 22.56,16 22,14L19.05,7H21V5H14.83C14.4,3.8 13.27,3 12,3M12,5A1,1 0 0,1 13,6A1,1 0 0,1 12,7A1,1 0 0,1 11,6A1,1 0 0,1 12,5M5.5,10.25L7,14H4L5.5,10.25M18.5,10.25L20,14H17L18.5,10.25Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-code-block">
|
||||
<path d="M5,3H7V5H5V10A2,2 0 0,1 3,12A2,2 0 0,1 5,14V19H7V21H5C3.93,20.73 3,20.1 3,19V15A2,2 0 0,0 1,13H0V11H1A2,2 0 0,0 3,9V5A2,2 0 0,1 5,3M19,3A2,2 0 0,1 21,5V9A2,2 0 0,0 23,11H24V13H23A2,2 0 0,0 21,15V19A2,2 0 0,1 19,21H17V19H19V14A2,2 0 0,1 21,12A2,2 0 0,1 19,10V5H17V3H19M12,15A1,1 0 0,1 13,16A1,1 0 0,1 12,17A1,1 0 0,1 11,16A1,1 0 0,1 12,15M8,15A1,1 0 0,1 9,16A1,1 0 0,1 8,17A1,1 0 0,1 7,16A1,1 0 0,1 8,15M16,15A1,1 0 0,1 17,16A1,1 0 0,1 16,17A1,1 0 0,1 15,16A1,1 0 0,1 16,15Z"></path>
|
||||
</symbol>
|
||||
<symbol aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="icon-ads-slash">
|
||||
<path d="M12.2 9L10.2 7H13C14.1 7 15 7.9 15 9V11.8L13 9.8V9H12.2M23 9V7H19C17.9 7 17 7.9 17 9V11C17 12.1 17.9 13 19 13H21V15H18.2L20.2 17H21C22.1 17 23 16.1 23 15V13C23 11.9 22.1 11 21 11H19V9H23M22.1 21.5L20.8 22.8L14.4 16.4C14.1 16.7 13.6 17 13 17H9V10.9L7 8.9V17H5V13H3V17H1V9C1 7.9 1.9 7 3 7H5.1L1.1 3L2.4 1.7L22.1 21.5M5 9H3V11H5V9M13 14.9L11 12.9V15H13V14.9Z"></path>
|
||||
</symbol>
|
||||
</svg>
|
After Width: | Height: | Size: 22 KiB |
BIN
public/mstile-150x150.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
2
public/robots.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
user-agent: *
|
||||
disallow: /misc/
|
63
public/safari-pinned-tab.svg
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="1158.000000pt" height="1158.000000pt" viewBox="0 0 1158.000000 1158.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.14, written by Peter Selinger 2001-2017
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,1158.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M3278 10395 c-1 -1 -41 -5 -88 -9 -105 -8 -150 -13 -265 -31 -93 -15
|
||||
-102 -17 -195 -36 -30 -6 -62 -13 -70 -14 -8 -2 -15 -4 -15 -5 0 -1 -11 -4
|
||||
-25 -6 -14 -3 -43 -10 -65 -16 -22 -6 -42 -12 -45 -13 -182 -44 -577 -215
|
||||
-747 -322 -29 -18 -54 -33 -57 -33 -16 0 -336 -225 -404 -284 -15 -13 -49 -43
|
||||
-77 -66 -360 -305 -695 -762 -900 -1230 -144 -329 -255 -736 -290 -1070 -4
|
||||
-36 -9 -74 -11 -84 -11 -62 -19 -243 -19 -466 0 -255 8 -405 30 -555 3 -22 8
|
||||
-58 10 -80 3 -22 7 -51 10 -65 8 -39 13 -64 19 -101 3 -19 12 -65 21 -104 9
|
||||
-38 18 -77 20 -85 6 -31 27 -109 56 -205 314 -1044 1057 -1880 2006 -2258 215
|
||||
-85 484 -165 625 -183 27 -4 50 -10 53 -14 3 -5 -474 -186 -540 -204 -5 -2
|
||||
-17 -6 -25 -9 -16 -7 -41 -15 -200 -71 -58 -20 -114 -41 -125 -46 -11 -5 -58
|
||||
-23 -105 -39 -47 -16 -112 -40 -145 -52 -191 -70 -290 -224 -281 -439 9 -212
|
||||
164 -399 375 -454 55 -14 178 -12 256 4 30 6 58 12 62 12 27 3 161 56 296 117
|
||||
97 44 187 78 230 86 83 17 357 14 447 -4 30 -7 68 -14 85 -17 110 -19 376
|
||||
-140 705 -318 354 -193 742 -344 1005 -391 68 -12 147 -25 195 -31 30 -3 66
|
||||
-8 80 -9 200 -26 795 -26 839 -1 4 2 30 7 60 10 179 21 526 122 762 222 415
|
||||
175 709 394 817 609 92 183 56 380 -95 529 -98 97 -206 139 -338 132 -123 -7
|
||||
-218 -58 -425 -230 -297 -246 -558 -363 -880 -395 -72 -7 -328 -6 -380 2 -14
|
||||
3 -52 8 -85 12 -156 19 -424 104 -680 218 -101 44 -242 111 -475 224 -389 189
|
||||
-482 223 -725 263 -33 5 -64 10 -69 10 -20 0 5 12 100 46 54 20 142 52 194 71
|
||||
52 19 118 42 145 52 28 10 113 41 190 69 77 28 197 65 266 81 437 103 854 302
|
||||
1217 579 87 66 112 87 211 177 423 383 725 837 954 1435 55 141 139 433 153
|
||||
528 3 20 9 51 14 67 5 17 11 48 14 70 42 301 43 314 52 485 11 211 6 562 -10
|
||||
660 -3 14 -7 52 -10 85 -4 33 -8 71 -10 85 -10 64 -20 126 -22 140 -12 108
|
||||
-80 373 -146 575 -117 358 -354 804 -575 1085 -379 482 -880 856 -1443 1078
|
||||
-167 65 -434 142 -580 167 -19 3 -42 8 -50 10 -8 2 -37 6 -65 10 -27 3 -57 8
|
||||
-65 10 -8 2 -46 6 -83 10 -37 3 -78 9 -90 12 -24 5 -573 14 -579 8z m442 -979
|
||||
c47 -4 96 -9 110 -11 14 -2 45 -7 70 -10 37 -6 139 -26 200 -40 308 -73 679
|
||||
-268 950 -501 205 -176 407 -433 555 -706 122 -227 247 -585 285 -820 5 -35
|
||||
12 -72 14 -83 2 -12 7 -48 11 -80 4 -33 9 -69 11 -80 23 -123 22 -592 -1 -765
|
||||
-2 -19 -7 -57 -10 -85 -5 -42 -22 -136 -41 -233 -55 -275 -178 -598 -320 -842
|
||||
-144 -246 -371 -513 -568 -665 -21 -17 -48 -38 -60 -49 -51 -45 -238 -161
|
||||
-354 -219 -214 -107 -461 -187 -662 -213 -30 -3 -66 -8 -80 -10 -183 -28 -571
|
||||
-21 -745 12 -11 2 -33 7 -50 9 -204 36 -458 124 -655 228 -73 38 -256 155
|
||||
-282 180 -7 6 -29 24 -48 38 -97 73 -262 238 -364 364 -275 340 -461 744 -550
|
||||
1191 -23 116 -30 159 -41 244 -21 155 -28 611 -12 760 4 41 10 98 13 125 3 28
|
||||
7 56 9 63 3 7 7 34 11 60 3 26 10 67 16 92 5 25 12 56 14 70 20 108 96 349
|
||||
156 490 41 97 133 281 168 335 11 17 23 37 26 45 15 32 140 209 203 285 157
|
||||
192 366 372 576 500 82 50 316 165 335 165 6 0 18 4 28 10 18 11 185 66 224
|
||||
74 12 3 41 10 63 15 22 6 54 12 70 15 17 3 41 8 55 11 13 2 42 7 65 10 22 3
|
||||
51 8 65 10 14 2 66 7 115 11 50 3 91 7 92 8 5 4 259 -2 333 -8z"/>
|
||||
<path d="M10918 8616 c-1 -2 -52 -6 -113 -10 -119 -6 -143 -10 -250 -32 -38
|
||||
-8 -79 -17 -91 -19 -11 -3 -54 -16 -95 -29 -284 -91 -542 -249 -768 -469 -145
|
||||
-142 -255 -290 -354 -476 l-53 -99 0 286 c0 198 -5 304 -14 342 -31 134 -143
|
||||
274 -262 330 -293 137 -629 -20 -698 -325 -13 -56 -17 -4527 -4 -4611 4 -26
|
||||
17 -73 30 -105 79 -194 235 -290 463 -285 129 3 221 37 312 113 76 64 149 193
|
||||
166 291 3 21 7 649 8 1397 1 748 5 1378 9 1400 3 22 8 54 11 70 3 17 7 48 11
|
||||
70 41 269 188 585 381 825 247 305 627 499 937 477 100 -7 102 -8 272 -58 202
|
||||
-59 249 -68 349 -66 77 2 100 7 156 33 170 80 262 252 255 475 -2 75 -7 96
|
||||
-35 153 -65 132 -256 261 -445 302 -12 3 -50 7 -86 10 -36 3 -70 7 -77 9 -6 2
|
||||
-13 2 -15 1z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
18
public/site.webmanifest
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "Quetre",
|
||||
"short_name": "Quetre",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#0f0e15",
|
||||
"background_color": "#0f0e15"
|
||||
}
|
18
routes/apiRoutes.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
about,
|
||||
unimplemented,
|
||||
unansweredQuestion,
|
||||
answeredQuestion,
|
||||
} from '../controllers/apiController.js';
|
||||
|
||||
const apiRouter = express.Router();
|
||||
|
||||
apiRouter.get('/', about);
|
||||
apiRouter.get('/search', unimplemented);
|
||||
apiRouter.get('/profile/:name', unimplemented);
|
||||
apiRouter.get('/topic/:name', unimplemented);
|
||||
apiRouter.get('/unanswered/:slug', unansweredQuestion);
|
||||
apiRouter.get('/:slug', answeredQuestion);
|
||||
|
||||
export default apiRouter;
|
20
routes/viewRoutes.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
import express from 'express';
|
||||
import {
|
||||
about,
|
||||
answeredQuestion,
|
||||
privacy,
|
||||
unansweredQuestion,
|
||||
unimplemented,
|
||||
} from '../controllers/viewController.js';
|
||||
|
||||
const viewRouter = express.Router();
|
||||
|
||||
viewRouter.get('/', about);
|
||||
viewRouter.get('/privacy', privacy);
|
||||
viewRouter.get('/search', unimplemented);
|
||||
viewRouter.get('/profile/:name', unimplemented);
|
||||
viewRouter.get('/topic/:name', unimplemented);
|
||||
viewRouter.get('/unanswered/:slug', unansweredQuestion);
|
||||
viewRouter.get('/:slug', answeredQuestion);
|
||||
|
||||
export default viewRouter;
|
30
server.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import dotenv from 'dotenv/config'; // importing .env vars
|
||||
import app from './app.js';
|
||||
import log from './utils/log.js';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// HANDLING NODEJS ERRORS
|
||||
////////////////////////////////////////////////////////
|
||||
process.on('uncaughtException', err => {
|
||||
log(err, 'error');
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
log(err, 'error');
|
||||
server.close(() => process.exit(1));
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// STARTING SERVER
|
||||
////////////////////////////////////////////////////////
|
||||
const port = 3000 || process.env.PORT;
|
||||
const server = app.listen(port, () =>
|
||||
log(
|
||||
`server running in ${process.env.NODE_ENV} mode at port ${port}`,
|
||||
'success'
|
||||
)
|
||||
);
|
26
utils/AppError.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// CLASS DECLARATION
|
||||
////////////////////////////////////////////////////////
|
||||
/**
|
||||
*
|
||||
* @param {string} message error message to display
|
||||
* @param {number} statusCode status code to send(defaults to 500)
|
||||
* @description custom error class to handle operational errors elegantly
|
||||
*/
|
||||
const AppError = class extends Error {
|
||||
constructor(message, statusCode = 500) {
|
||||
super(message);
|
||||
this.statusCode = statusCode;
|
||||
this.status = `${statusCode}`.startsWith('4') ? 'fail' : 'error';
|
||||
// adding custom name to distinguish operational errors(errors that we know will occur and will handle them accordingly) from non-operational errors.
|
||||
this.name = 'OperationalError';
|
||||
// since this method is only available in v8(which is what nodejs uses), using it conditionally.
|
||||
// this.constructor just points back to AppError
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default AppError;
|
28
utils/axiosInstance.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
import axios from 'axios';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FUNCTION
|
||||
////////////////////////////////////////////////////////
|
||||
/**
|
||||
* @description an axios instance having base url already set
|
||||
*/
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: 'https://www.quora.com',
|
||||
// conditionally adding headers to the request config using ES6 spreading and short-circuiting
|
||||
headers: {
|
||||
...(process.env.AXIOS_USER_AGENT && {
|
||||
'User-Agent': process.env.AXIOS_USER_AGENT,
|
||||
}),
|
||||
...(process.env.ACCEPT && {
|
||||
Accept: process.env.ACCEPT,
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default axiosInstance;
|
18
utils/catchAsyncErrors.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
///////////////////////////////////////////////////////////////
|
||||
// FUNCTION
|
||||
///////////////////////////////////////////////////////////////
|
||||
/**
|
||||
*
|
||||
* @param {function} asyncFunction an async function whose errors need to be caught
|
||||
* @returns a function which executes all the code inside the passed asyncFunction, and passes down the errors to the express middleware, if any.
|
||||
*
|
||||
* @description an alternative to try catch blocks to handle errors in async functions
|
||||
*/
|
||||
const catchAsyncErrors = asyncFunction => (req, res, next) => {
|
||||
asyncFunction(req, res, next).catch(err => next(err));
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
///////////////////////////////////////////////////////////////
|
||||
export default catchAsyncErrors;
|
13
utils/constants.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
// some routes are accidentally thought of as slug for answered question. filtering those here.
|
||||
export const nonSlugRoutes = [
|
||||
'favicon.ico',
|
||||
'apple-touch-icon.png',
|
||||
'favicon-32x32.png',
|
||||
'favicon-16x16.png',
|
||||
'safari-pinned-tab.svg',
|
||||
'site.webmanifest',
|
||||
];
|
42
utils/log.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// FUNCTION
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string | {}} toLog stuff to log
|
||||
* @param {'success'| 'error'} type optional type param to color the log accordingly
|
||||
* @description logs color coded stuff to the stdout so that it's easily distinguishable
|
||||
*/
|
||||
function log(toLog, type = null) {
|
||||
// setting defaults
|
||||
const data = {
|
||||
message: toLog?.message || toLog,
|
||||
stack: toLog?.stack || '',
|
||||
colorCode: 33,
|
||||
emoji: '🟡',
|
||||
};
|
||||
|
||||
// changing some values according to the type provided
|
||||
switch (type) {
|
||||
case 'success':
|
||||
data.colorCode = 32;
|
||||
data.emoji = '🟢';
|
||||
break;
|
||||
|
||||
case 'error':
|
||||
data.colorCode = 31;
|
||||
data.emoji = '🔴';
|
||||
break;
|
||||
}
|
||||
|
||||
// actually logging to the console
|
||||
console.log(
|
||||
`\u001b[${data.colorCode}m ${data.emoji} ${data.message}\n${data.stack} \u001b[39m`
|
||||
);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// EXPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
export default log;
|
94
views/pug/_answer.pug
Normal file
|
@ -0,0 +1,94 @@
|
|||
//- putting spans in semantically correct tags(to the extent possible)
|
||||
mixin spansChecker(spans)
|
||||
each span in spans
|
||||
- if(span.modifiers.math)
|
||||
//- setting that var in the base.pug value to true here.
|
||||
- someAnswerContainsMath = true;
|
||||
span.answer__span-math= `\\(${span.text}\\)`
|
||||
- else if (span.modifiers.code)
|
||||
code.answer__span-code= span.text
|
||||
- else if (span.modifiers.embed)
|
||||
a.answer__span-link.answers__link(href=span.modifiers.embed.url)= span.modifiers.embed.title || 'link'
|
||||
- else if (span.modifiers.link)
|
||||
//- removing quora.com from the link in case it is a quora.com link.
|
||||
a.answer__span-link.answers__link(href=span.modifiers.link.url.split('https://www.quora.com')[1] || span.modifiers.link.url)=span.text
|
||||
- else if (span.modifiers.bold)
|
||||
strong.answer__span-bold= span.text
|
||||
- else if (span.modifiers.italic)
|
||||
em.answer__span-bold= span.text
|
||||
- else
|
||||
span.answer__span-plain= span.text
|
||||
|
||||
//- mixin to format date and stuff
|
||||
mixin addDate(date)
|
||||
- const dateObj = new Date(date / 1000);
|
||||
time.answer__metadata-data(datetime= dateObj.toISOString(), title=dateObj.toUTCString())= Intl.DateTimeFormat('en-US', {year: '2-digit', month: 'short', day: 'numeric' }).format(dateObj)
|
||||
|
||||
article.answer
|
||||
//- stuff about author
|
||||
figure.answer__author
|
||||
figcaption.answer__author-name
|
||||
if answerObj.author.isAnon
|
||||
span Anonymous
|
||||
else
|
||||
a.answers__link(href=answerObj.author.profile)= answerObj.author.name
|
||||
if answerObj.author.isVerified
|
||||
svg.answer__icon
|
||||
title verified
|
||||
use(href='/misc/sprite.svg#icon-verified')
|
||||
img.answer__author-image(src=answerObj.author.avatar, alt=`${answerObj.author.name}'s profile photo`)
|
||||
p.answer__author-credentials(aria-label=`${answerObj.author.name}'s credentials`)= answerObj.author.credential || ''
|
||||
|
||||
h3.answer__question.heading.heading__tertiary
|
||||
span Originally answered to
|
||||
a.answer__link.answers__link(href=answerObj.OriginalQuestion.url)
|
||||
+spansChecker(answerObj.OriginalQuestion.text.spans)
|
||||
|
||||
//- main answer goes here
|
||||
.answer__text
|
||||
//- putting paragraphs in semantically correct tags(to the extent possible)
|
||||
each para in answerObj.text
|
||||
-if(para.type==='image')
|
||||
img.answer__para.answer__image(src=para.spans[0].modifiers.master_url, alt='User embedded image')
|
||||
- else if (para.type==='code')
|
||||
pre.answer__para.answer__code: code
|
||||
+spansChecker(para.spans)
|
||||
- else if(para.quoted)
|
||||
blockquote.answer__para.answer__quote
|
||||
+spansChecker(para.spans)
|
||||
- else
|
||||
p(class=`answer__para answer__${para.type}`)
|
||||
+spansChecker(para.spans)
|
||||
//- for quora plus answers. since quora only shows half answer, we gotta warn viewer.
|
||||
unless answerObj.isViewable
|
||||
p.answer__unviewable
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-danger')
|
||||
| This is a Quora plus answer and hence full answer is not viewable.
|
||||
|
||||
//- metadata about answer(likes, shares, etc)
|
||||
.answer__metadata
|
||||
p.answer__metadata-item
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-clock')
|
||||
+addDate(answerObj.creationTime)
|
||||
span.answer__metadata-text Answered
|
||||
if answerObj.updatedTime
|
||||
p.answer__metadata-item
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-clock-edit')
|
||||
+addDate(answerObj.updatedTime)
|
||||
span.answer__metadata-text Edited
|
||||
p.answer__metadata-item
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-eye')
|
||||
span.answer__metadata-data= answerObj.numViews
|
||||
span.answer__metadata-text Views
|
||||
p.answer__metadata-item
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-arrow-up')
|
||||
span.answer__metadata-data= answerObj.numUpvotes
|
||||
span.answer__metadata-text Upvotes
|
||||
p.answer__metadata-item
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-comments')
|
||||
span.answer__metadata-data= answerObj.numComments
|
||||
span.answer__metadata-text Comments
|
||||
p.answer__metadata-item
|
||||
svg.answer__icon: use(href='/misc/sprite.svg#icon-share')
|
||||
span.answer__metadata-data= answerObj.numShares
|
||||
span.answer__metadata-text Shares
|
15
views/pug/_footer.pug
Normal file
|
@ -0,0 +1,15 @@
|
|||
footer.footer(class=`${title ==='About' ? 'footer__about' : ''}`)
|
||||
block footer
|
||||
//- more stuff will be prepended here on about page
|
||||
nav.footer__nav-box(aria-label='Primary navigation')
|
||||
ul.footer__nav
|
||||
- if (title !=='About')
|
||||
li.footer__nav-item: a.footer__nav-link.footer__link(href="/") About
|
||||
|
||||
li.footer__nav-item: a.footer__nav-link.footer__link(href="https://github.com/zyachel/quetre") Source Code
|
||||
li.footer__nav-item: a.footer__nav-link.footer__link(href="/privacy") Privacy
|
||||
li.footer__nav-item: a.footer__nav-link.footer__link(href="#") Back to top
|
||||
|
||||
p.footer__license Licensed under
|
||||
a.footer__link(href="https://www.gnu.org/licenses/agpl-3.0.html") GNU AGPLv3
|
||||
| .
|
13
views/pug/_header.pug
Normal file
|
@ -0,0 +1,13 @@
|
|||
header.header(class=`${title === 'About' ? 'header__about': ''}`)
|
||||
.header__bar
|
||||
a.header__link.header__logo(href='/') Quetre
|
||||
|
||||
//- for nav on about page
|
||||
block header__nav
|
||||
|
||||
button.button.theme-changer.header__theme(aria-label='Change Theme')
|
||||
svg.icon.icon__theme.theme-changer__icon.theme-changer__icon--sun: use(href='/misc/sprite.svg#icon-sun')
|
||||
svg.icon.icon__theme.theme-changer__icon.theme-changer__icon--moon: use(href='/misc/sprite.svg#icon-moon')
|
||||
|
||||
//- for info line on about page
|
||||
block header__info
|
98
views/pug/about.pug
Normal file
|
@ -0,0 +1,98 @@
|
|||
extends base
|
||||
|
||||
block header__nav
|
||||
nav.header__nav-box(aria-label='Table of Contents'): ul.header__nav
|
||||
li.header__nav-item
|
||||
a.header__link.header__nav-link(href="#features") Features
|
||||
li.header__nav-item
|
||||
a.header__link.header__nav-link(href="#faqs") FAQs
|
||||
li.header__nav-item
|
||||
a.header__link.header__nav-link(href="#contact") Contact
|
||||
li.header__nav-item
|
||||
a.header__link.header__nav-link(href="https://github.com/zyachel/quetre") Source
|
||||
|
||||
|
||||
block header__info
|
||||
.header__info
|
||||
h1.heading.heading__primary.header__hero A libre front-end for Quora
|
||||
a.header__link.header__down(href='#features', aria-label='go to features section'): svg.icon.icon__down: use(href='/misc/sprite.svg#icon-down')
|
||||
|
||||
block content
|
||||
main#main.main.about
|
||||
section.about__features.features#features
|
||||
h2.heading.heading__secondary.about__heading-secondary.features__heading Key features
|
||||
.features__list
|
||||
.features__feature
|
||||
svg.features__feature-icon: use(href='/misc/sprite.svg#icon-spy')
|
||||
h3.heading.heading__tertiary.features__feature-heading Privacy focused
|
||||
p.features__feature-text All requests except for images are proxied which makes it impossible for Quora to collate meaningful data points about you.
|
||||
.features__feature
|
||||
svg.features__feature-icon: use(href='/misc/sprite.svg#icon-fingerprint')
|
||||
h3.heading.heading__tertiary.features__feature-heading No ads or tracking
|
||||
p.features__feature-text Absolutely no ads, no tracking, no browser fingerprinting, and no telemetry of any kind.
|
||||
.features__feature
|
||||
svg.features__feature-icon: use(href='/misc/sprite.svg#icon-responsive')
|
||||
h3.heading.heading__tertiary.features__feature-heading Fully responsive layout
|
||||
p.features__feature-text Utilises modern CSS features like CSS Grid and Flexbox to make the website fully responsive for all screen sizes.
|
||||
.features__feature
|
||||
svg.features__feature-icon: use(href='/misc/sprite.svg#icon-bolt')
|
||||
h3.heading.heading__tertiary.features__feature-heading Lightweight and fast
|
||||
p.features__feature-text As the website contains no bloat, pages load in a jiffy and request sizes are tiny.
|
||||
.features__feature
|
||||
svg.features__feature-icon: use(href='/misc/sprite.svg#icon-palette')
|
||||
h3.heading.heading__tertiary.features__feature-heading Dark and light themes
|
||||
p.features__feature-text Whether you're a nightowl or bright screen lover, you'll enjoy curated color scheme for your taste.
|
||||
.features__feature
|
||||
svg.features__feature-icon: use(href='/misc/sprite.svg#icon-code')
|
||||
h3.heading.heading__tertiary.features__feature-heading Unofficial API support
|
||||
p.features__feature-text just add
|
||||
code /api/v1/
|
||||
| after the domain name in the URL and get a JSON repsonse.
|
||||
|
||||
section.about__faqs.faqs#faqs
|
||||
h2.heading.heading__secondary.about__heading-secondary.faqs__heading FAQs
|
||||
.faqs__list
|
||||
details.faqs__faq
|
||||
summary.faqs__question There are some unreachable routes.
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer I'm working to implement them soon.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Why is website connecting to '*.quoracdn.net' and 'cdn.jsdelivr.net'?
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer For the moment, images aren't proxied but directly fetched from quora. Hence the connection to quoracdn. As for the connection to jsdelivr, it is for an open source library –
|
||||
a.about__link(href='https://www.mathjax.org/') Mathjax
|
||||
| – which is used to display math eqations nicely. If I get enough time, I'll include it locally.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Why are some math equations showing up weirdly?
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer If you're browsing with JavaScript disabled, then the Mathjax library isn't able to load and format tex equations. I'd recommend to enable JavaScript for it since there's no other way to show them in the browser. Even Quora uses Mathjax.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Why can I only view a couple of answers?
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer Quora doesn't show all answers at once. It only loads more answers as the user scrolls down. Furthermore, it uses many unique IDs to send ajax requests to fetch those answers. So, all in all, getting more answers isn't impossible but quite difficult requiring some serious amount of time on their website in order to figure out how it all happens. I'm short on time for now.
|
||||
details.faqs__faq
|
||||
summary.faqs__question I have some ideas/want to help.
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer You're most welcome to do that. Just
|
||||
a.about__link(href='#contact') contact me
|
||||
| or fork
|
||||
a.about__link(href='https://github.com/zyachel/quetre') the repo
|
||||
| and make a pull request.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Why the name Quetre?
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer Quora is
|
||||
a.about__link(href='/Why-is-Quora-called-Quora-4') supposedly
|
||||
| a portmanteau of 'Questions or answers'. In the same vein, Quetre is a portmanteau of 'Questions and answers', but
|
||||
a.about__link(href="https://lingva.ml/en/la/questions%20and%20answers%0A") in Latin
|
||||
|.
|
||||
|
||||
section.about__contact#contact
|
||||
h2.heading.heading__secondary.about__heading-secondary.about__contact-heading Contact
|
||||
address.about__contact-text Reach me via
|
||||
a.about__link(href='https://matrix.to/#/@ninal:matrix.org') Matrix
|
||||
| or
|
||||
a.about__link(href="mailto:aricla@protonmail.com") Email
|
||||
| in case you got any suggestions or feedback, or if you just want to drop a hi :)
|
||||
block prepend footer
|
||||
p.footer__logo Quetre
|
39
views/pug/answers.pug
Normal file
|
@ -0,0 +1,39 @@
|
|||
extends base
|
||||
|
||||
mixin checkMath(spans)
|
||||
each span in spans
|
||||
-if(span.modifiers?.math)
|
||||
span= `\\(${span.text}\\)`
|
||||
-else
|
||||
span= span.text
|
||||
|
||||
block content
|
||||
main#main.main.answers
|
||||
|
||||
.answers__question-box
|
||||
h1.heading.heading__primary.answers__question
|
||||
+checkMath(data.question.text.spans)
|
||||
.answers__metadata
|
||||
p.answers__answers-total= `${ data.numAnswers ? 'Total answers: ' + data.numAnswers : 'Unanswered'}`
|
||||
p.answers__answers-shown Viewable answers: #{data.answers.length}
|
||||
a.answers__question-link.answers__link(href='https://quora.com' + data.question.url) View on Quora
|
||||
|
||||
.answers-box.answers__answers-box
|
||||
h2.heading.heading__secondary.answers__answers-box-heading Answers
|
||||
.answers-box__list
|
||||
each answerObj in data.answers
|
||||
include _answer
|
||||
|
||||
aside.topics.answers__topics
|
||||
h2.heading.heading__secondary.answers__topic-heading Tagged Topics
|
||||
ul.topics__list
|
||||
each topic in data.topics
|
||||
li.topics__item: a.topics__link.answers__link(href=topic.url)= topic.name
|
||||
|
||||
|
||||
aside.related.answers__related
|
||||
h2.heading.heading__secondary.answers__related-heading Related Questions
|
||||
ul.related__questions
|
||||
each question in data.relatedQuestions
|
||||
li.related__question-item: a.related__question-link.answers__link(href=question.url)
|
||||
+checkMath(question.text.spans)
|
49
views/pug/base.pug
Normal file
|
@ -0,0 +1,49 @@
|
|||
doctype html
|
||||
html(lang='en')
|
||||
// see the full source code on github in case you're interested.
|
||||
head
|
||||
meta(charset='UTF-8')
|
||||
meta(http-equiv='X-UA-Compatible', content='IE=edge')
|
||||
meta(name='viewport', content='width=device-width, initial-scale=1.0')
|
||||
//- appending title to name in case it exists, else showing name as the title of the page
|
||||
title= title ? `${title} | Quetre`: 'Quetre'
|
||||
meta(name="description", content="A libre front-end for Quora. See any answer without being tracked, without being required to log in, and without being bombarded by pesky ads.")
|
||||
//- preloading css and fonts for performance gains
|
||||
link(rel='preload', href='/fonts/WorkSans.woff2', as='font', type='font/woff2', crossorigin)
|
||||
link(rel='preload', href='/fonts/Quicksand.woff2', as='font', type='font/woff2', crossorigin)
|
||||
link(rel='preload stylesheet', href='/css/styles.css', as='style', crossorigin)
|
||||
//- favicons
|
||||
link(rel="shortcut icon", href="/favicon.ico", type="image/x-icon")
|
||||
link(rel="icon", href="/favicon.ico", type="image/x-icon")
|
||||
link(rel="icon", type="image/png", sizes="32x32", href="/favicon-32x32.png")
|
||||
link(rel="apple-touch-icon", sizes="180x180", href="/apple-touch-icon.png")
|
||||
link(rel="mask-icon", href="/safari-pinned-tab.svg", color="#0f0e15")
|
||||
link(rel="manifest", href="/site.webmanifest")
|
||||
meta(name="msapplication-TileColor", content="#0f0e15")
|
||||
meta(name="theme-color", content="#0f0e15")
|
||||
|
||||
|
||||
|
||||
|
||||
//- own script
|
||||
script(src='/js/index.js', defer)
|
||||
|
||||
//- initially setting this var to false. will update in case an answer contains some math expression
|
||||
- let someAnswerContainsMath = false;
|
||||
|
||||
body.body
|
||||
-if (title !=='About')
|
||||
a.skip-link(href="#main") Skip to main content
|
||||
//- stuff that's visible on page goes here
|
||||
include _header
|
||||
block content
|
||||
p placeholder text
|
||||
include _footer
|
||||
|
||||
//- including mathjax script only when some answer has math expressions(using the var from above)
|
||||
if someAnswerContainsMath
|
||||
script#MathJax-script(
|
||||
type='text/javascript',
|
||||
src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js',
|
||||
async
|
||||
)
|
15
views/pug/error.pug
Normal file
|
@ -0,0 +1,15 @@
|
|||
extends base
|
||||
|
||||
block content
|
||||
main#main.main.error
|
||||
p.error__code= statusCode
|
||||
p.error__message= message
|
||||
|
||||
//- will only apply in dev mode
|
||||
if stack
|
||||
.error__stack-box: pre.error__stack
|
||||
code.error__text= stack
|
||||
|
||||
p.error__return Go back to the
|
||||
a.error__link(href="/") Home Page
|
||||
|.
|
29
views/pug/privacy.pug
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends base
|
||||
|
||||
block content
|
||||
main#main.main.privacy
|
||||
h1.heading.heading__primary.privacy__heading-primary Privacy Policy
|
||||
|
||||
section.privacy__short
|
||||
h2.heading.heading__secondary.privacy__heading-secondary The short version
|
||||
p.privacy__short-text Quetre doesn't collect any personally identifiable data.
|
||||
|
||||
section.faqs.privacy__long
|
||||
h2.heading.heading__secondary.privacy__heading-secondary The long version
|
||||
.faqs__list
|
||||
details.faqs__faq
|
||||
summary.faqs__question Data actively collected by Quetre
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer None.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Data passively collected by Quetre
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer Whenever you hit some error page, an error object is logged to the console on the server. That error object contains the resource url you were trying to access, and the usual stack trace. That's it.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Data stored locally in your browser
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer A key called 'theme' is stored in local storage provided by your browser to store your theme preference should you override the default theme. To prevent this behaviour, either disable JavaScript or local storage for Quetre.
|
||||
details.faqs__faq
|
||||
summary.faqs__question Data collected by other services
|
||||
svg.faqs__icon: use(href='/misc/sprite.svg#icon-open')
|
||||
p.faqs__answer Since Quetre is deployed on heroku, heroku might log your IP to prevent abuse. Also, as Quetre connects to '*.quoracdn.net' and 'cdn.jsdelivr.net' for images and mathjax library respectively, both of these service might log some data. So, follow due precaution. Using a VPN might be a good idea. Or even better, consider hosting your own instance.
|
155
views/sass/_abstracts.scss
Normal file
|
@ -0,0 +1,155 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'sass:map';
|
||||
@use 'sass:color';
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// COLORS
|
||||
////////////////////////////////////////////////////////
|
||||
$clr-primary: #e3f6f5;
|
||||
$clr-secondary: #272343;
|
||||
$clr-highlight: #ff5277;
|
||||
|
||||
$misc-vars: (
|
||||
ff-primary: (
|
||||
'Worksans',
|
||||
sans-serif,
|
||||
),
|
||||
ff-alt-alpha: (
|
||||
'QuickSand',
|
||||
sans-serif,
|
||||
),
|
||||
fs-160: 1.6rem,
|
||||
fs-180: 1.8rem,
|
||||
fs-200: 2rem,
|
||||
fs-220: 2.2rem,
|
||||
fs-250: 2.5rem,
|
||||
fs-270: 2.7rem,
|
||||
fs-300: 3rem,
|
||||
fs-350: 3.5rem,
|
||||
fs-400: 4rem,
|
||||
fs-500: 5rem,
|
||||
fs-600: 6rem,
|
||||
fs-1000: 10rem,
|
||||
fs-1500: 15rem,
|
||||
space-050: 0.5rem,
|
||||
space-100: 1rem,
|
||||
space-200: 2rem,
|
||||
space-300: 3rem,
|
||||
space-400: 4rem,
|
||||
space-500: 5rem,
|
||||
space-800: 8rem,
|
||||
space-1000: 10rem,
|
||||
);
|
||||
|
||||
$themed-vars: (
|
||||
// base
|
||||
clr-base-bg:
|
||||
(
|
||||
light: color.scale($clr-primary, $lightness: 90%),
|
||||
dark: color.scale($clr-secondary, $lightness: -65%, $saturation: -40%),
|
||||
),
|
||||
clr-base-heading: (
|
||||
light: color.scale($clr-secondary, $lightness: -5%),
|
||||
dark: color.scale($clr-primary, $lightness: 50%, $saturation: -100%),
|
||||
),
|
||||
clr-base-heading-alt-alpha: (
|
||||
light: color.scale($clr-secondary, $lightness: 5%),
|
||||
dark: color.scale($clr-primary, $lightness: 10%),
|
||||
),
|
||||
clr-base-text: (
|
||||
light: color.scale($clr-secondary, $lightness: -60%),
|
||||
dark: color.scale($clr-primary, $whiteness: 90%, $blackness: 10%),
|
||||
),
|
||||
clr-base-text-alt-alpha: (
|
||||
light: color.scale($clr-secondary, $whiteness: 20%),
|
||||
dark: color.scale($clr-secondary, $whiteness: 100%),
|
||||
),
|
||||
clr-code-bg: (
|
||||
light: color.scale($clr-primary, $lightness: 70%, $saturation: -70%),
|
||||
dark: color.scale($clr-secondary, $lightness: -50%, $saturation: -50%),
|
||||
),
|
||||
clr-code-text: (
|
||||
light: color.scale($clr-secondary, $lightness: 5%, $saturation: -100%),
|
||||
dark: color.scale($clr-primary, $whiteness: 100%, $blackness: 30%),
|
||||
),
|
||||
clr-base-icon: (
|
||||
light: color.scale($clr-primary, $lightness: -55%),
|
||||
dark: color.scale($clr-primary, $lightness: -40%, $saturation: 90%),
|
||||
),
|
||||
clr-base-icon-alt-alpha: (
|
||||
light: color.scale($clr-secondary, $lightness: 80%, $saturation: -100%),
|
||||
dark: color.scale($clr-secondary, $lightness: -50%, $saturation: -50%),
|
||||
),
|
||||
clr-base-link: (
|
||||
light: color.scale($clr-secondary, $lightness: 20%, $saturation: 20%),
|
||||
dark: color.scale($clr-primary, $lightness: -15%, $saturation: -35%),
|
||||
),
|
||||
clr-base-link-alt-alpha: (
|
||||
light: color.scale($clr-secondary, $lightness: 40%, $saturation: 20%),
|
||||
dark: color.scale($clr-primary, $lightness: -35%, $saturation: -35%),
|
||||
),
|
||||
// header, footer
|
||||
grad-hf:
|
||||
(
|
||||
light: (
|
||||
$clr-primary 70%,
|
||||
color.scale($clr-primary, $lightness: 95%),
|
||||
),
|
||||
dark: (
|
||||
color.scale($clr-secondary, $lightness: -60%, $saturation: 7%),
|
||||
color.scale($clr-secondary, $lightness: -60%, $saturation: 5%),
|
||||
color.scale($clr-secondary, $lightness: -60%, $saturation: 2%),
|
||||
color.scale($clr-secondary, $lightness: -60%, $saturation: -0%),
|
||||
color.scale($clr-secondary, $lightness: -62%, $saturation: -5%),
|
||||
color.scale($clr-secondary, $lightness: -65%, $saturation: -40%),
|
||||
),
|
||||
),
|
||||
clr-hf-bg: (
|
||||
light: $clr-primary,
|
||||
dark: color.scale($clr-secondary, $lightness: -30%, $saturation: -30%),
|
||||
),
|
||||
clr-hf-logo: (
|
||||
light: color.scale($clr-secondary, $lightness: 20%),
|
||||
dark: color.scale($clr-primary, $lightness: -40%, $saturation: 20%),
|
||||
),
|
||||
clr-hf-heading: (
|
||||
light: color.scale($clr-secondary, $lightness: 10%),
|
||||
dark: color.scale($clr-primary, $lightness: -5%),
|
||||
),
|
||||
clr-hf-text: (
|
||||
light: color.scale($clr-secondary, $lightness: -50%),
|
||||
dark: color.scale($clr-primary, $lightness: 0%),
|
||||
),
|
||||
clr-hf-link: (
|
||||
light: color.scale($clr-secondary, $lightness: 30%, $saturation: 30%),
|
||||
dark: color.scale($clr-primary, $lightness: -10%),
|
||||
),
|
||||
clr-hf-link-alt-alpha: (
|
||||
light: color.scale($clr-secondary, $lightness: 40%, $saturation: 60%),
|
||||
dark: color.scale($clr-primary, $lightness: -30%),
|
||||
),
|
||||
// misc
|
||||
clr-selection-bg:
|
||||
(
|
||||
light: color.scale($clr-secondary, $lightness: 15%),
|
||||
dark: color.scale($clr-primary, $lightness: -85%),
|
||||
),
|
||||
clr-selection-text: (
|
||||
light: color.scale($clr-primary, $lightness: 50%),
|
||||
dark: color.scale($clr-primary, $lightness: 90%),
|
||||
),
|
||||
clr-scrollbar-thumb: (
|
||||
light: color.scale($clr-secondary, $lightness: 15%),
|
||||
dark: color.scale($clr-primary, $lightness: -40%),
|
||||
),
|
||||
clr-scrollbar-thumb-alt-alpha: (
|
||||
light: color.scale($clr-secondary, $lightness: 30%),
|
||||
dark: color.scale($clr-primary, $lightness: -60%),
|
||||
),
|
||||
clr-focus: (
|
||||
light: color.scale($clr-highlight, $lightness: 0%, $saturation: 0%),
|
||||
dark: color.scale($clr-highlight),
|
||||
)
|
||||
);
|
165
views/sass/_base.scss
Normal file
|
@ -0,0 +1,165 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'mixins' as *;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FONTS
|
||||
////////////////////////////////////////////////////////
|
||||
@font-face {
|
||||
font-family: 'WorkSans';
|
||||
src: url('/fonts/WorkSans.woff2');
|
||||
font-display: swap;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Quicksand';
|
||||
src: url('/fonts/Quicksand.woff2');
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// RESET
|
||||
////////////////////////////////////////////////////////
|
||||
html {
|
||||
font-size: 62.5%;
|
||||
scroll-behavior: smooth;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
body {
|
||||
box-sizing: border-box;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// BASE STYLING
|
||||
////////////////////////////////////////////////////////
|
||||
:root {
|
||||
// normal vars
|
||||
@include get-misc-vars;
|
||||
// themed vars(default:light)
|
||||
@include get-themed-vars;
|
||||
|
||||
// dark themed vars when root has an attribute of theme set to 'dark'
|
||||
&[theme='dark'] {
|
||||
@include get-themed-vars(dark);
|
||||
}
|
||||
|
||||
// styles to be applied when js is disabled
|
||||
&:not([js-enabled]) {
|
||||
// if the user prefers dark theme
|
||||
@media (prefers-color-scheme: dark) {
|
||||
// using dark theme instead of default one
|
||||
@include get-themed-vars(dark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.body {
|
||||
font-size: var(--fs-160);
|
||||
font-family: var(--ff-primary);
|
||||
background-color: var(--clr-base-bg);
|
||||
color: var(--clr-base-text);
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
min-height: 100vh;
|
||||
|
||||
transition: color 500ms ease, background-color 500ms ease;
|
||||
}
|
||||
|
||||
.main {
|
||||
@include respond-to(bp-1900, true) {
|
||||
width: 110em;
|
||||
margin-inline: auto;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// SELECTION & SCROLLBAR
|
||||
////////////////////////////////////////////////////////
|
||||
::selection {
|
||||
background: var(--clr-selection-bg);
|
||||
color: var(--clr-selection-text);
|
||||
}
|
||||
|
||||
// for gecko-based browsers
|
||||
@supports (scrollbar-width: auto) {
|
||||
* {
|
||||
scrollbar-width: auto;
|
||||
scrollbar-color: var(--clr-scrollbar-thumb) transparent;
|
||||
}
|
||||
}
|
||||
|
||||
// for webkit(and its fork blink) based browsers
|
||||
@supports not (scrollbar-width: auto) {
|
||||
::-webkit-scrollbar {
|
||||
height: 0.8em;
|
||||
width: 0.8em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: var(--clr-scrollbar-thumb);
|
||||
border: 2px solid transparent;
|
||||
background-clip: padding-box;
|
||||
border-radius: 100vw;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--clr-scrollbar-thumb-alt-alpha);
|
||||
}
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// KEYBOARD NAVIGATION
|
||||
////////////////////////////////////////////////////////
|
||||
:focus {
|
||||
outline: 3px solid var(--clr-focus);
|
||||
outline-offset: 0.2em;
|
||||
}
|
||||
|
||||
@supports selector(:focus-visible) {
|
||||
:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 3px solid var(--clr-focus);
|
||||
outline-offset: 0.2em;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FOR MATHJAX
|
||||
////////////////////////////////////////////////////////
|
||||
mjx-container.MathJax {
|
||||
pointer-events: none;
|
||||
}
|
||||
/*
|
||||
.CtxtMenu_ContextMenu,
|
||||
.CtxtMenu_Info {
|
||||
background-color: var(--clr-base-bg) !important;
|
||||
font-family: inherit !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
.CtxtMenu_InfoTitle,
|
||||
.CtxtMenu_InfoSignature,
|
||||
.CtxtMenu_MenuClose .CtxtMenu_InfoClose,
|
||||
.CtxtMenu_InfoContent {
|
||||
font-family: inherit !important;
|
||||
background: inherit !important;
|
||||
color: inherit !important;
|
||||
}
|
||||
*/
|
466
views/sass/_components.scss
Normal file
|
@ -0,0 +1,466 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'mixins' as *;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// SKIP TO MAIN CONTENT LINK
|
||||
////////////////////////////////////////////////////////
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
// background: var(--clr-base-bg);
|
||||
color: var(--clr-base-heading);
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
padding: 0 var(--space-100);
|
||||
border-radius: 0 0 5px 5px;
|
||||
font-size: var(--fs-180);
|
||||
transform: translate(-50%, -150%);
|
||||
|
||||
transition: transform 200ms ease;
|
||||
|
||||
&:is(:focus, :focus-visible) {
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////
|
||||
// THEME CHANGER
|
||||
////////////////////////////////////////////////////////
|
||||
.theme-changer {
|
||||
border: none;
|
||||
// outline: none;
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
&__icon {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
transition: all 0.5s ease;
|
||||
transform-origin: center;
|
||||
|
||||
// initial config
|
||||
&--sun {
|
||||
transform: scale(0) rotateZ(-180deg);
|
||||
}
|
||||
|
||||
&--moon {
|
||||
transform: scale(1) rotateZ(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// changing config when root has the attr of theme
|
||||
:root[theme='dark'] {
|
||||
.theme-changer__icon {
|
||||
&--sun {
|
||||
transform: scale(1) rotateZ(0);
|
||||
}
|
||||
|
||||
&--moon {
|
||||
transform: scale(0) rotateZ(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// ICONS
|
||||
////////////////////////////////////////////////////////
|
||||
.icon {
|
||||
max-height: var(--fs-500);
|
||||
max-width: var(--fs-500);
|
||||
fill: var(--clr-base-icon);
|
||||
|
||||
&__down {
|
||||
height: var(--fs-350);
|
||||
width: var(--fs-350);
|
||||
opacity: 0.3;
|
||||
|
||||
@include respond-to(bp-450) {
|
||||
height: var(--fs-250);
|
||||
width: var(--fs-250);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// HEADINGS
|
||||
////////////////////////////////////////////////////////
|
||||
.heading {
|
||||
color: var(--clr-base-heading);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FEATURES
|
||||
////////////////////////////////////////////////////////
|
||||
.features {
|
||||
display: grid;
|
||||
gap: var(--space-800);
|
||||
|
||||
&__heading {
|
||||
justify-self: center;
|
||||
}
|
||||
|
||||
&__list {
|
||||
display: grid;
|
||||
gap: var(--space-800);
|
||||
grid-template-columns: repeat(auto-fit, minmax(40rem, 1fr));
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
gap: var(--space-500);
|
||||
grid-template-columns: auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__feature {
|
||||
display: grid;
|
||||
gap: var(--space-100);
|
||||
grid-template-rows: repeat(3, min-content);
|
||||
font-size: var(--fs-160);
|
||||
// justify-items: center;
|
||||
// text-align: center;
|
||||
}
|
||||
|
||||
&__feature-icon {
|
||||
fill: var(--clr-base-icon);
|
||||
grid-row: 1 / 2;
|
||||
|
||||
height: 3em;
|
||||
width: 3em;
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
height: 2em;
|
||||
width: 2em;
|
||||
}
|
||||
}
|
||||
|
||||
&__feature-heading {
|
||||
grid-row: 2 / 3;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
&__feature-text {
|
||||
grid-row: 3 / 4;
|
||||
}
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
gap: var(--space-500);
|
||||
}
|
||||
@include respond-to(bp-750) {
|
||||
gap: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FAQs
|
||||
////////////////////////////////////////////////////////
|
||||
.faqs {
|
||||
display: grid;
|
||||
gap: var(--space-800);
|
||||
justify-items: center;
|
||||
|
||||
&__heading {
|
||||
justify-self: center;
|
||||
}
|
||||
|
||||
&__list {
|
||||
justify-self: strech;
|
||||
display: grid;
|
||||
gap: var(--space-500);
|
||||
width: 100%;
|
||||
// text-align: center;
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
gap: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
&__faq {
|
||||
border: 1px solid var(--clr-base-icon-alt-alpha);
|
||||
padding: var(--space-100);
|
||||
}
|
||||
|
||||
&__question {
|
||||
padding: var(--space-100);
|
||||
display: flex;
|
||||
gap: var(--space-100);
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
color: var(--clr-base-heading-alt-alpha);
|
||||
font-weight: 500;
|
||||
font-size: var(--fs-180);
|
||||
list-style-type: none;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
&__icon {
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
fill: var(--clr-base-icon);
|
||||
transition: all 200ms;
|
||||
}
|
||||
|
||||
&__faq[open] {
|
||||
border: 1px solid var(--clr-base-icon);
|
||||
}
|
||||
|
||||
&__faq[open] &__question &__icon {
|
||||
transform: rotateX(180deg);
|
||||
}
|
||||
|
||||
&__answer {
|
||||
padding: var(--space-100);
|
||||
}
|
||||
|
||||
&__faq[open] &__answer {
|
||||
animation: slide 200ms ease;
|
||||
}
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
gap: var(--space-500);
|
||||
}
|
||||
@include respond-to(bp-750) {
|
||||
gap: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// ANSWERS
|
||||
////////////////////////////////////////////////////////
|
||||
.answers-box {
|
||||
display: grid;
|
||||
gap: var(--space-200);
|
||||
|
||||
&__list {
|
||||
display: grid;
|
||||
gap: var(--space-800);
|
||||
}
|
||||
}
|
||||
|
||||
.answer {
|
||||
display: grid;
|
||||
gap: var(--space-200);
|
||||
|
||||
// author area
|
||||
&__author {
|
||||
display: grid;
|
||||
gap: 0 var(--space-100);
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-rows: repeat(2, min-content);
|
||||
font-size: var(--fs-160);
|
||||
}
|
||||
|
||||
&__author-name {
|
||||
grid-column: 2 / -1;
|
||||
align-self: end;
|
||||
|
||||
color: var(--clr-base-heading-alt-alpha);
|
||||
font-weight: 500;
|
||||
|
||||
// for verified icon
|
||||
display: flex;
|
||||
gap: var(--space-050);
|
||||
|
||||
// for name linking to profile
|
||||
a {
|
||||
font-size: 1.05em;
|
||||
color: currentColor;
|
||||
}
|
||||
}
|
||||
|
||||
&__author-credentials {
|
||||
grid-column: 2 / -1;
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
&__author-image {
|
||||
grid-row: 1 / -1;
|
||||
grid-column: 1 / span 1;
|
||||
|
||||
max-height: var(--fs-600);
|
||||
max-width: var(--fs-600);
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
object-fit: cover;
|
||||
|
||||
clip-path: circle(50% at 50% 50%);
|
||||
}
|
||||
|
||||
// question area
|
||||
&__question {
|
||||
font-size: 1.05em;
|
||||
}
|
||||
|
||||
// main answer formatting
|
||||
&__text {
|
||||
border-block: 1px solid var(--clr-base-icon-alt-alpha);
|
||||
padding: var(--space-100);
|
||||
|
||||
// lobotomised owl selector. equivalent to '> *:not(:first-of-type)' but has no/lowest specificity, and hence better for cascading. who says css isn't a programming language :p
|
||||
> * + * {
|
||||
// every direct child except first will have padding-top
|
||||
padding-top: 0.3em;
|
||||
}
|
||||
|
||||
// some math eqations will overflow.
|
||||
// in mathjax v3, they can't be broken as of now. this is the best solution i could come up with.
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
// paragraphs
|
||||
&__para {
|
||||
// line-height: 1.3;
|
||||
overflow-wrap: anywhere; //breaks long words without hyphens
|
||||
}
|
||||
|
||||
&__image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
&__quote {
|
||||
padding-left: 1em;
|
||||
border-left: 3px solid var(--clr-base-icon-alt-alpha);
|
||||
color: var(--clr-base-text-alt-alpha);
|
||||
}
|
||||
|
||||
&__unordered-list {
|
||||
display: list-item;
|
||||
margin-left: 1em;
|
||||
list-style: inside;
|
||||
}
|
||||
|
||||
&__ordered-list {
|
||||
display: list-item;
|
||||
list-style: decimal inside;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
&__code {
|
||||
white-space: pre-wrap;
|
||||
background: var(--clr-code-bg);
|
||||
color: var(--clr-code-text);
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
// spans
|
||||
&__span-math {
|
||||
}
|
||||
|
||||
&__span-code {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
&__span-bold {
|
||||
font-weight: 500;
|
||||
}
|
||||
&__span-link {
|
||||
@include format-link(
|
||||
var(--clr-base-link),
|
||||
var(--clr-base-link-alt-alpha),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
&__unviewable {
|
||||
// for aligning both text and svg
|
||||
display: grid;
|
||||
align-content: center;
|
||||
justify-content: start;
|
||||
grid-auto-flow: column;
|
||||
gap: var(--space-100);
|
||||
align-items: center;
|
||||
|
||||
margin-top: var(--space-200);
|
||||
color: var(--clr-base-heading-alt-alpha);
|
||||
font-weight: 500;
|
||||
// border: 1px solid var(--clr-base-icon-alt-alpha);
|
||||
// padding: var(--space-100);
|
||||
}
|
||||
|
||||
// metadata(likes, shares, etc)
|
||||
&__metadata {
|
||||
justify-self: start;
|
||||
|
||||
display: flex;
|
||||
gap: var(--space-200);
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__metadata-item {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, auto);
|
||||
gap: 0 var(--space-050);
|
||||
}
|
||||
|
||||
&__icon {
|
||||
grid-column: 1 / span 1;
|
||||
justify-self: end;
|
||||
align-self: center;
|
||||
|
||||
height: 1.3em;
|
||||
width: 1.3em;
|
||||
fill: var(--clr-base-icon);
|
||||
}
|
||||
|
||||
&__metadata-data {
|
||||
grid-column: -2 / -1;
|
||||
justify-self: start;
|
||||
}
|
||||
|
||||
&__metadata-text {
|
||||
grid-row: 2 / span 1;
|
||||
grid-column: 1 / -1;
|
||||
justify-self: center;
|
||||
|
||||
font-size: 0.9em;
|
||||
color: var(--clr-base-text-alt-alpha);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// TOPICS
|
||||
////////////////////////////////////////////////////////
|
||||
.topics {
|
||||
display: grid;
|
||||
gap: var(--space-200);
|
||||
|
||||
&__list {
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: var(--space-100);
|
||||
// display: flex;
|
||||
// flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__item {
|
||||
// flex: 0 1 auto
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// RELATED
|
||||
////////////////////////////////////////////////////////
|
||||
.related {
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: var(--space-200);
|
||||
|
||||
&__questions {
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: var(--space-100);
|
||||
}
|
||||
|
||||
&__question-item {
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
181
views/sass/_layouts.scss
Normal file
|
@ -0,0 +1,181 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'mixins' as *;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// HEADER
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
.header {
|
||||
background: var(--clr-hf-bg);
|
||||
|
||||
&__about {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(var(--grad-hf));
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr;
|
||||
}
|
||||
|
||||
&__bar {
|
||||
padding: var(--space-300) var(--space-500);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: var(--space-300);
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
padding: var(--space-300);
|
||||
}
|
||||
@include respond-to(bp-450) {
|
||||
padding: var(--space-200) var(--space-300);
|
||||
}
|
||||
}
|
||||
|
||||
&__logo {
|
||||
font-size: var(--fs-300);
|
||||
font-family: var(--ff-alt-alpha);
|
||||
color: var(--clr-hf-logo);
|
||||
font-weight: 700;
|
||||
|
||||
@include respond-to(bp-450) {
|
||||
font-size: var(--fs-250);
|
||||
}
|
||||
}
|
||||
|
||||
&__link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&__nav-box {
|
||||
// margin-left: auto; // for pushing nav to the right
|
||||
align-self: center;
|
||||
@include respond-to(bp-650) {
|
||||
// margin-left: auto;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__nav {
|
||||
display: flex;
|
||||
gap: var(--space-300);
|
||||
}
|
||||
|
||||
&__nav-item {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
&__nav-link {
|
||||
font-size: var(--fs-200);
|
||||
font-weight: 500;
|
||||
// color: var(--clr-link);
|
||||
@include format-link(var(--clr-hf-link), var(--clr-hf-link-alt-alpha));
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-180);
|
||||
}
|
||||
}
|
||||
|
||||
&__theme {
|
||||
height: var(--fs-300);
|
||||
width: var(--fs-300);
|
||||
|
||||
@include respond-to(bp-450) {
|
||||
height: var(--fs-250);
|
||||
width: var(--fs-250);
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
grid-template-rows: 1fr min-content 0.2fr; // .2fr is bottom padding
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__hero {
|
||||
font-size: var(--fs-600);
|
||||
font-family: var(--ff-alt-alpha);
|
||||
color: var(--clr-hf-heading);
|
||||
font-weight: 700;
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
font-size: var(--fs-500);
|
||||
}
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-400);
|
||||
padding: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
&__down {
|
||||
align-self: end;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// FOOTER
|
||||
////////////////////////////////////////////////////////
|
||||
.footer {
|
||||
padding: var(--space-400);
|
||||
display: grid;
|
||||
gap: var(--space-300);
|
||||
align-items: center;
|
||||
|
||||
background: var(--clr-hf-bg);
|
||||
|
||||
&__about {
|
||||
padding-top: var(--space-800);
|
||||
background: linear-gradient(to top, var(--grad-hf));
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
padding-top: var(--space-500);
|
||||
}
|
||||
}
|
||||
|
||||
&__logo {
|
||||
justify-self: center;
|
||||
font-size: var(--fs-600);
|
||||
color: var(--clr-hf-logo);
|
||||
font-family: var(--ff-alt-alpha);
|
||||
font-weight: 700;
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
font-size: var(--fs-500);
|
||||
}
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-400);
|
||||
}
|
||||
}
|
||||
|
||||
&__nav {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
gap: var(--space-200);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
&__nav-item {
|
||||
font-size: var(--fs-180);
|
||||
}
|
||||
|
||||
&__link {
|
||||
@include format-link(var(--clr-hf-link), var(--clr-hf-link-alt-alpha));
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&__license {
|
||||
justify-self: center;
|
||||
font-size: var(--fs-180);
|
||||
color: var(--clr-hf-text);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@include respond-to(bp-450) {
|
||||
padding: var(--space-300);
|
||||
gap: var(--space-200);
|
||||
}
|
||||
}
|
106
views/sass/_mixins.scss
Normal file
|
@ -0,0 +1,106 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'sass:map';
|
||||
@use 'sass:meta';
|
||||
@use 'abstracts' as *;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// ANIMATIONS
|
||||
////////////////////////////////////////////////////////
|
||||
@keyframes slide {
|
||||
0% {
|
||||
transform: translateY(-1rem);
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// MIXINS
|
||||
////////////////////////////////////////////////////////
|
||||
/////// CONVERTS SASS VARS TO CSS CUSTOM PROPERTIES
|
||||
@mixin get-misc-vars {
|
||||
// here $var is name of the key and $val is value
|
||||
@each $var, $val in $misc-vars {
|
||||
--#{$var}: #{$val};
|
||||
}
|
||||
}
|
||||
|
||||
/////// CONVERTS SASS (THEMED)VARS TO CSS CUSTOM PROPERTIES
|
||||
@mixin get-themed-vars($theme: 'light') {
|
||||
// here also, $var is name of the key and $val is value of that key, which in itself is a map. we get value from the map by passing in $theme.
|
||||
@each $var, $val in $themed-vars {
|
||||
--#{$var}: #{map.get($val, $theme)};
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// LINKS
|
||||
////////////////////////////////////////////////////////
|
||||
@mixin format-link(
|
||||
$clr-base,
|
||||
$clr-hover,
|
||||
$underline: false,
|
||||
$transition: true
|
||||
) {
|
||||
text-decoration: none;
|
||||
color: $clr-base;
|
||||
|
||||
&:hover {
|
||||
color: $clr-hover;
|
||||
}
|
||||
|
||||
@if $transition {
|
||||
transition: color 400ms ease;
|
||||
}
|
||||
|
||||
@if $underline {
|
||||
border-bottom: 1px solid currentColor;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// BREAKPOINT MANAGER
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
// map to hold breakpoints
|
||||
$breakpoints: (
|
||||
bp-1900: 118.75em,
|
||||
bp-1200: 75em,
|
||||
bp-1024: 64em,
|
||||
bp-900: 56.25em,
|
||||
bp-750: 46.875em,
|
||||
bp-650: 40.625em,
|
||||
bp-550: 34.375em,
|
||||
bp-450: 28.125em,
|
||||
);
|
||||
|
||||
// main mixin
|
||||
@mixin respond-to($given-breakpoint, $min: false) {
|
||||
$breakpoint: null;
|
||||
|
||||
@if (map.has-key($breakpoints, $given-breakpoint)) {
|
||||
$breakpoint: map.get($breakpoints, $given-breakpoint);
|
||||
|
||||
// when only nos are passed
|
||||
} @else if (meta.type-of($given-breakpoint) == 'number') {
|
||||
$breakpoint: $given-breakpoint;
|
||||
|
||||
// throwing an error
|
||||
} @else {
|
||||
@error 'given breakpoint(#{$given-breakpoint}) is neither present in breakpoint map, nor is it a sensible number!';
|
||||
}
|
||||
|
||||
$expr: 'max-width: #{$breakpoint}';
|
||||
|
||||
@if ($min) {
|
||||
$expr: 'min-width: #{$breakpoint}';
|
||||
}
|
||||
@media screen and ($expr) {
|
||||
@content;
|
||||
}
|
||||
}
|
282
views/sass/_pages.scss
Normal file
|
@ -0,0 +1,282 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'mixins' as *;
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// ABOUT
|
||||
////////////////////////////////////////////////////////
|
||||
.about {
|
||||
display: grid;
|
||||
gap: var(--space-500);
|
||||
padding: var(--space-500) var(--space-800);
|
||||
|
||||
&__heading-secondary {
|
||||
font-size: var(--fs-400);
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-350);
|
||||
}
|
||||
@include respond-to(bp-550) {
|
||||
font-size: var(--fs-300);
|
||||
}
|
||||
}
|
||||
|
||||
&__link {
|
||||
@include format-link(
|
||||
var(--clr-base-link),
|
||||
var(--clr-base-link-alt-alpha),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
&__features {
|
||||
padding-block: var(--space-800);
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__faqs {
|
||||
padding: var(--space-800);
|
||||
|
||||
@include respond-to(bp-1024) {
|
||||
padding-inline: 0;
|
||||
}
|
||||
@include respond-to(bp-900) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__contact {
|
||||
display: grid;
|
||||
gap: var(--space-500);
|
||||
padding: var(--space-800);
|
||||
justify-items: center;
|
||||
|
||||
@include respond-to(bp-1024) {
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
padding: 0;
|
||||
}
|
||||
@include respond-to(bp-750) {
|
||||
gap: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
&__contact-heading {
|
||||
}
|
||||
|
||||
&__contact-text {
|
||||
font-style: normal;
|
||||
font-size: var(--fs-200);
|
||||
text-align: center;
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-180);
|
||||
}
|
||||
}
|
||||
@include respond-to(bp-900) {
|
||||
padding: var(--space-500);
|
||||
|
||||
& > * {
|
||||
padding-block: var(--space-300);
|
||||
}
|
||||
}
|
||||
@include respond-to(bp-550) {
|
||||
padding: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// PRIVACY
|
||||
////////////////////////////////////////////////////////
|
||||
.privacy {
|
||||
display: grid;
|
||||
gap: var(--space-800);
|
||||
padding: var(--space-800);
|
||||
|
||||
&__heading-primary {
|
||||
justify-self: center;
|
||||
font-size: var(--fs-500);
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-400);
|
||||
}
|
||||
@include respond-to(bp-550) {
|
||||
font-size: var(--fs-350);
|
||||
}
|
||||
}
|
||||
|
||||
&__heading-secondary {
|
||||
font-size: var(--fs-400);
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-300);
|
||||
}
|
||||
@include respond-to(bp-550) {
|
||||
font-size: var(--fs-250);
|
||||
}
|
||||
}
|
||||
|
||||
&__short {
|
||||
justify-self: center;
|
||||
display: grid;
|
||||
gap: var(--space-200);
|
||||
justify-items: center;
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
gap: var(--space-100);
|
||||
}
|
||||
}
|
||||
|
||||
&__short-text {
|
||||
text-align: center;
|
||||
font-size: var(--fs-200);
|
||||
|
||||
@include respond-to(bp-750) {
|
||||
font-size: var(--fs-180);
|
||||
}
|
||||
}
|
||||
|
||||
@include respond-to(bp-900) {
|
||||
gap: var(--space-500);
|
||||
padding: var(--space-500);
|
||||
}
|
||||
@include respond-to(bp-550) {
|
||||
padding: var(--space-200);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// ERROR
|
||||
////////////////////////////////////////////////////////
|
||||
.error {
|
||||
padding: var(--space-500);
|
||||
display: grid;
|
||||
place-content: center;
|
||||
gap: var(--space-300);
|
||||
place-items: center;
|
||||
|
||||
&__code {
|
||||
font-size: var(--fs-1500);
|
||||
font-family: var(--ff-alt-alpha);
|
||||
font-weight: 700;
|
||||
// letter-spacing: 0.1em;
|
||||
line-height: 1;
|
||||
|
||||
@include respond-to(bp-550) {
|
||||
font-size: var(--fs-1000);
|
||||
}
|
||||
}
|
||||
|
||||
&__message,
|
||||
&__return {
|
||||
font-size: var(--fs-200);
|
||||
// font-family: var(--ff-alt-alpha);
|
||||
color: var(--clr-base-text);
|
||||
text-align: center;
|
||||
|
||||
@include respond-to(bp-550) {
|
||||
font-size: var(--fs-180);
|
||||
}
|
||||
}
|
||||
|
||||
&__link {
|
||||
@include format-link(var(--clr-base-link), var(--clr-base-link-alt-alpha));
|
||||
}
|
||||
|
||||
&__stack-box {
|
||||
// display: none;
|
||||
overflow: auto;
|
||||
max-width: 90%;
|
||||
// background: red;
|
||||
}
|
||||
|
||||
&__stack {
|
||||
padding: var(--space-300);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// ANSWERED
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
.answers {
|
||||
// justify-self: center;
|
||||
padding: var(--space-800);
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1.2fr;
|
||||
grid-template-rows: min-content min-content 1fr;
|
||||
grid-auto-flow: dense;
|
||||
align-items: start;
|
||||
gap: var(--space-800);
|
||||
|
||||
&__question-box {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 1 / span 1;
|
||||
|
||||
display: grid;
|
||||
gap: var(--space-200);
|
||||
}
|
||||
|
||||
&__answers-box {
|
||||
grid-row: 2 / -1;
|
||||
}
|
||||
|
||||
&__topics {
|
||||
grid-row: 2 / span 1;
|
||||
}
|
||||
|
||||
&__related {
|
||||
grid-row: 3 / -1;
|
||||
}
|
||||
|
||||
&__question {
|
||||
font-size: var(--fs-300);
|
||||
|
||||
@include respond-to(bp-550) {
|
||||
font-size: var(--fs-270);
|
||||
}
|
||||
}
|
||||
|
||||
&__link {
|
||||
@include format-link(var(--clr-base-link), var(--clr-base-link-alt-alpha));
|
||||
}
|
||||
|
||||
&__metadata {
|
||||
display: flex;
|
||||
color: var(--clr-base-text-alt-alpha);
|
||||
|
||||
:not(:last-child)::after {
|
||||
margin-inline: var(--space-100);
|
||||
content: '\00b7';
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
@include respond-to(bp-550) {
|
||||
display: block;
|
||||
|
||||
:not(:last-child)::after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@include respond-to(bp-1200) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// gap: var(--space-800);
|
||||
}
|
||||
@include respond-to(bp-900) {
|
||||
padding: var(--space-500);
|
||||
gap: var(--space-500);
|
||||
}
|
||||
@include respond-to(bp-550) {
|
||||
padding-inline: var(--space-200);
|
||||
}
|
||||
}
|
7
views/sass/main.scss
Normal file
|
@ -0,0 +1,7 @@
|
|||
////////////////////////////////////////////////////////
|
||||
// IMPORTS
|
||||
////////////////////////////////////////////////////////
|
||||
@use 'base';
|
||||
@use 'components';
|
||||
@use 'layouts';
|
||||
@use 'pages';
|