This commit is contained in:
Cypro Freelance 2024-09-06 23:30:18 +05:30
parent a48a97092d
commit 86c994be45
2 changed files with 68 additions and 138 deletions

View file

@ -32,47 +32,44 @@ export default function Banner({
isBannerVisible && (
<div
className={cn(
"relative isolate flex flex-col sm:flex-row items-start sm:items-center gap-y-4 sm:gap-y-0 sm:gap-x-6 overflow-hidden bg-gray-50 px-4 sm:px-6 py-3 sm:py-2 border-b",
"relative isolate flex items-center gap-x-6 overflow-hidden bg-gray-50 px-6 py-2 sm:px-3.5 sm:before:flex-1 border-b",
className
)}
>
<div
aria-hidden="true"
className="absolute left-[calc(50%-20rem)] sm:left-[max(-7rem,calc(50%-52rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
className="absolute left-[max(-7rem,calc(50%-52rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
>
<div
style={{
clipPath:
"polygon(74.8% 41.9%, 97.2% 73.2%, 100% 34.9%, 92.5% 0.4%, 87.5% 0%, 75% 28.6%, 58.5% 54.6%, 50.1% 56.8%, 46.9% 44%, 48.3% 17.4%, 24.7% 53.9%, 0% 27.9%, 11.9% 74.2%, 24.9% 54.1%, 68.6% 100%, 74.8% 41.9%)",
}}
className="aspect-[577/310] w-[20rem] sm:w-[36.0625rem] bg-gradient-to-r from-primary to-yellow-200 opacity-30"
className="aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-primary to-yellow-200 opacity-30"
/>
</div>
<div
aria-hidden="true"
className="absolute left-[calc(50%+16rem)] sm:left-[max(45rem,calc(50%+8rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
className="absolute left-[max(45rem,calc(50%+8rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
>
<div
style={{
clipPath:
"polygon(74.8% 41.9%, 97.2% 73.2%, 100% 34.9%, 92.5% 0.4%, 87.5% 0%, 75% 28.6%, 58.5% 54.6%, 50.1% 56.8%, 46.9% 44%, 48.3% 17.4%, 24.7% 53.9%, 0% 27.9%, 11.9% 74.2%, 24.9% 54.1%, 68.6% 100%, 74.8% 41.9%)",
}}
className="aspect-[577/310] w-[20rem] sm:w-[36.0625rem] bg-gradient-to-r from-primary to-[#9089fc] opacity-30"
className="aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-primary to-[#9089fc] opacity-30"
/>
</div>
<div className="flex flex-col sm:flex-row sm:items-center flex-wrap gap-x-4 gap-y-2 w-full">
<div className="flex items-center flex-wrap gap-x-4 gap-y-2">
{icon && <span className="flex-none sm:block hidden">{icon}</span>}
<div className="flex items-start sm:items-center flex-col sm:flex-row gap-y-2 sm:gap-y-0 w-full">
<p className="text-sm sm:leading-6 leading-tight text-gray-900">
<p className="text-sm leading-6 text-gray-900">
{title && (
<>
<strong className="font-semibold sm:leading-tight leading-normal block sm:inline">
{title}
</strong>
<strong className="font-semibold">{title}</strong>
<svg
viewBox="0 0 2 2"
aria-hidden="true"
className="mx-2 hidden sm:inline h-0.5 w-0.5 fill-current"
className="mx-2 inline h-0.5 w-0.5 fill-current"
>
<circle r={1} cx={1} cy={1} />
</svg>
@ -83,18 +80,17 @@ export default function Banner({
{link && (
<a
href={link}
className="mt-2 sm:mt-0 flex-none rounded-full bg-gray-900 px-3.5 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900 w-auto"
className="flex-none rounded-full bg-gray-900 px-3.5 py-1 text-sm font-semibold text-white shadow-sm hover:bg-gray-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900"
>
{buttonText} <span aria-hidden="true">&rarr;</span>
</a>
)}
</div>
</div>
{closeButton && (
<div className="mt-2 sm:mt-0 flex self-start sm:self-auto sm:flex-1 justify-end">
<div className="flex flex-1 justify-end">
<button
type="button"
className="-m-2 sm:-m-3 p-2 sm:p-3 focus-visible:outline-offset-[-4px]"
className="-m-3 p-3 focus-visible:outline-offset-[-4px]"
onClick={handleClose}
>
<span className="sr-only">Dismiss</span>

View file

@ -1,117 +1,51 @@
### Redirects
# Redirects
Setting up HTTP redirects is simple with SVR.JS. You can add a 301 or 302 code (with _scode_ property set to 301 or 302) entry to the _nonStandardCodes_ property in _config.json_. The entry should specify the source URL for the redirect in the _url_ or regular expression string for the redirect in _regex_ property (for example `"/\\/blog($|[#?\\/].*)/"`), and the destination URL in the _location_ property (for regular expressions, you can use for example "_$1_" for contents of first capturing group). Destination location can be relative to current site (for example _/blogs_) or a full URL (for example _https://blog.example.com_).
Setting up HTTP redirects is simple with SVR.JS. You can add a 301 or 302 code (with `scode` property set to 301 or 302) entry to the `nonStandardCodes` property in `config.json`. The entry should specify the source URL for the redirect in the `url` or regular expression string for the redirect in `regex` property (for example `"/\\/blog($|[#?\\/].*)/"`), and the destination URL in the `location` property (for regular expressions, you can use for example `"$1"` for contents of the first capturing group). Destination location can be relative to the current site (for example `/blogs`) or a full URL (for example `https://blog.example.com`).
Please be cautious when setting up redirects to avoid redirect loops, as they can cause unintended behavior and potentially impact the performance of your server.
From SVR.JS 3.8.0 onwards, you can specify a hostname for which this redirect applies in _host_ property. If you want to move your website to new address, you can add redirect to new website and specify _host_ property to be host name of the old website (for example _oldsite.example_), _location_ property to be a location of new website with "_$1_" appended (for example "_https://newsite.example$1_") and _regex_ property to be `"/(.*)/"` (regular expression, which matches everything to capturing group).
Starting from SVR.JS 3.8.0, you can specify a hostname for which this redirect applies using the `host` property. If you want to move your website to a new address, you can add a redirect to the new website and specify the `host` property to be the hostname of the old website (for example `oldsite.example`), the `location` property to be the location of the new website with `"$1"` appended (for example `"https://newsite.example$1"`), and the `regex` property to be `"/(.*)/"` (a regular expression, which matches everything to the capturing group).
### URL rewriting
## URL rewriting
You can set up URL rewriting by adding entries to _rewriteMap_ property in _config.json_ file. See ["_config.json_ properties" section](#config-json-properties) for URL rewrite rules syntax.
You can set up URL rewriting by adding entries to the `rewriteMap` property in the `config.json` file. See the ["config.json properties" section](#config-json-properties) for URL rewrite rules syntax.
### Log viewing
## Log viewing
To make log viewing easier, SVR.JS 3.x and later included it's log viewer utility under _logviewer.js_. SVR.JS log viewer is interactive.
SVR.JS 3.x and later includes a log viewer utility under `logviewer.js`. The SVR.JS log viewer is interactive.
You can also manually view logs, and highlight them using SVR.JS log highlighter utility under _loghighlight.js_ (SVR.JS 3.0.0 or newer). Usage: `&lt;some process&gt; | node loghighlight.js [-h] [--help] [-?] [/h] [/?]`.
You can also manually view logs and highlight them using the SVR.JS log highlighter utility under `loghighlight.js` (SVR.JS 3.0.0 or newer).
**Usage:**
```bash
<some process> | node loghighlight.js [-h] [--help] [-?] [/h] [/?]
```
SVR.JS stores it's logs in _log_ directory. Server logs look like this:
<pre>
[2023-07-04T18:50:54.610Z] SERVER MESSAGE [Request Id: c0ffd0]: Somebody
connected to port 80... [2023-07-04T18:50:54.611Z]{" "}
<span style="color: #5050ff">
SERVER REQUEST MESSAGE [Request Id: c0ffd0]: Client ::ffff:127.0.0.1:33670
wants content in localhost/leak.svr
</span>
[2023-07-04T18:50:54.611Z]{" "}
<span style="color: #5050ff">
SERVER REQUEST MESSAGE [Request Id: c0ffd0]: Client uses Mozilla/5.0 (X11;
Ubuntu; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: There was an error while
processing the request!
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: Stack:
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: RangeError
[ERR_INVALID_OPT_VALUE]: The value "4294967296" is invalid for option "size"
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at Function.allocUnsafe
(buffer.js:290:3)
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at
/home/ubuntu/svr.js.3.3.3/temp/serverSideScript.js:70:18
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at
/home/ubuntu/svr.js.3.3.3/temp/modloader/primitiveanalytics.tar.gz/index.js:28:23
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at modExecute
(/home/ubuntu/svr.js.3.3.3/svr.js:2981:9)
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at Server.reqhandler
(/home/ubuntu/svr.js.3.3.3/svr.js:3741:11)
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at Server.emit
(events.js:198:13)
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at parserOnIncoming
(_http_server.js:691:12)
</span>
[2023-07-04T18:50:54.625Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at
HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)
</span>
[2023-07-04T18:50:54.626Z]{" "}
<span style="color: #ff5050">
SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: Server responded with
500 code.
</span>
[2023-07-04T18:50:54.630Z] SERVER MESSAGE [Request Id: c0ffd0]: Client
disconnected. [2023-07-04T18:50:54.699Z] SERVER MESSAGE [Request Id: 1be453]:
Somebody connected to port 80... [2023-07-04T18:50:54.699Z]{" "}
<span style="color: #5050ff">
SERVER REQUEST MESSAGE [Request Id: 1be453]: Client ::ffff:127.0.0.1:33670
wants content in localhost/favicon.ico
</span>
[2023-07-04T18:50:54.700Z]{" "}
<span style="color: #5050ff">
SERVER REQUEST MESSAGE [Request Id: 1be453]: Client uses Mozilla/5.0 (X11;
Ubuntu; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0
</span>
[2023-07-04T18:50:54.709Z] SERVER MESSAGE [Request Id: 1be453]: Client
disconnected. [2023-07-04T18:50:54.710Z]{" "}
<span style="color: #00ff00">
SERVER RESPONSE MESSAGE [Request Id: 1be453]: Server responded with 200
code.
</span>
[2023-07-04T18:50:54.712Z]{" "}
<span style="color: #00ff00">
SERVER RESPONSE MESSAGE [Request Id: 1be453]: Client successfully recieved
content.
</span>
</pre>
```
[2023-07-04T18:50:54.610Z] SERVER MESSAGE [Request Id: c0ffd0]: Somebody connected to port 80...
[2023-07-04T18:50:54.611Z] SERVER REQUEST MESSAGE [Request Id: c0ffd0]: Client ::ffff:127.0.0.1:33670 wants content in localhost/leak.svr
[2023-07-04T18:50:54.611Z] SERVER REQUEST MESSAGE [Request Id: c0ffd0]: Client uses Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: There was an error while processing the request!
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: RangeError [ERR_INVALID_OPT_VALUE]: The value "4294967296" is invalid for option "size"
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at Function.allocUnsafe (buffer.js:290:3)
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at /home/ubuntu/svr.js.3.3.3/temp/serverSideScript.js:70:18
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at /home/ubuntu/svr.js.3.3.3/temp/modloader/primitiveanalytics.tar.gz/index.js:28:23
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at modExecute (/home/ubuntu/svr.js.3.3.3/svr.js:2981:9)
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at Server.reqhandler (/home/ubuntu/svr.js.3.3.3/svr.js:3741:11)
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at Server.emit (events.js:198:13)
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at parserOnIncoming (_http_server.js:691:12)
[2023-07-04T18:50:54.625Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: at HTTPParser.parserOnHeadersComplete (_http_common.js:111:17)
[2023-07-04T18:50:54.626Z] SERVER RESPONSE ERROR MESSAGE [Request Id: c0ffd0]: Server responded with 500 code.
[2023-07-04T18:50:54.630Z] SERVER MESSAGE [Request Id: c0ffd0]: Client disconnected.
[2023-07-04T18:50:54.699Z] SERVER MESSAGE [Request Id: 1be453]: Somebody connected to port 80...
[2023-07-04T18:50:54.699Z] SERVER REQUEST MESSAGE [Request Id: 1be453]: Client ::ffff:127.0.0.1:33670 wants content in localhost/favicon.ico
[2023-07-04T18:50:54.700Z] SERVER REQUEST MESSAGE [Request Id: 1be453]: Client uses Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0
[2023-07-04T18:50:54.709Z] SERVER MESSAGE [Request Id: 1be453]: Client disconnected.
[2023-07-04T18:50:54.710Z] SERVER RESPONSE MESSAGE [Request Id: 1be453]: Server responded with 200 code.
[2023-07-04T18:50:54.712Z] SERVER RESPONSE MESSAGE [Request Id: 1be453]: Client successfully received content.
```
First on the line is timestamp. Second is message type, optionally with request ID. Last is message contents.
First in the log entry is the timestamp. Second is the message type, optionally with the request ID. Finally, it includes the actual message content.