Skip to content

XiaoXiaoSN/magic-box

Repository files navigation

Magic Box

~ Quick In Quick Out ~

GitHub Workflow Status (with event) License


Usage 🏁

Magic Box parses user input into two parts: input and options.

For example, when Magic Box receives the following user input: The input will be https://youtu.be/dQw4w9WgXcQ and the option key is shorten with the value document.

https://youtu.be/dQw4w9WgXcQ
::shorten=document

Based on matching methods, we can roughly classify Boxes into two types:

  1. match by the input string
  2. match by options
Base64Box
match rule description output
valid string base64 encode
can be decode to valid string base64 decode
CronExpressionBox
match rule description output
valid cron expression convert to human language
options description example
l, lang, locate select while human language ::locale=tw
tz, timezone, tzOffset shift to the base timezone ::tz=8
GenerateQRCodeBox
match rule description output
contains option qr or qrcode generate QR Code
options description example
qr, qrcode -- ::QRCode
JWTBox
match rule description output
valid JWT string decode JWT header and body
MathExpressionBox
match rule description output
valid math express calculate the math result
NowBox
match rule description output
input matches now show current time in 3 difference formats: RFC 3339, RFC 3339 (UTC+8), and Timestamp (s)
PrettyJSON
match rule description output
valid JSON formatted JSON
ShortenURLBox
match rule description output
contains option surl or shorten generate a shorten URL
options description example
surl, shorten desired short URL result, if not set, a random string will be used ::surl=foo
TimeFormat
match rule description output
valid RFC 3339 time string timestamp in second and millisecond
TimestampBox
match rule description output
valid timestamp. to avoid match all of number string, it only receive 1600 AD to 2500 AD the time of timestamp in RFC 3339 format
URLDecode
match rule description output
URL-encoded string decoded URL-encoded string

Development ⛑️

It is recommended to use Node.js version 20.x

yarn install
yarn start

Prepare deploy

Initial Deployment Preparation

npm install -g firebase-tools

firebase login
firebase init
firebase deploy

License 📃

Magic Box is licensed under MIT and Apache 2.0 dual-licensed.

You may obtain a copy of the License at LICENSE-MIT and LICENSE-APACHE