diff --git a/public/css/app.css b/public/css/app.css index 940dc11..70eff48 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -81,13 +81,6 @@ code { border-radius: 3px; } -pre code { - display: block; - padding: 1em; - margin: 0; - overflow-x: auto; -} - blockquote { border-left: 4px solid #30363d; margin: 1em 0; @@ -361,16 +354,12 @@ section { .code-block { position: relative; background: #161b22; - border-radius: 6px; + border-radius: 3px; + border: 1px solid #30363d; margin: 0.5em 0; padding: 0.5em; } -.code-block pre { - margin: 0; - padding-right: 2.5em; /* Reduced padding for smaller button */ -} - .code-block .action-btn { position: absolute; right: 8px; @@ -523,4 +512,63 @@ section { background: rgba(255, 255, 255, 0.1); padding: 0.2rem 0.4rem; border-radius: 3px; +} + +/* Info Box */ +.info-box { + margin: 20px 0; + padding: 15px; + background: #161b22; + border: 1px solid #30363d; + border-radius: 6px; +} + +.info-box h3 { + margin-top: 0; +} + +/* Command Labels and Code Blocks */ +.command-label { + display: block; + font-size: 10px; + font-weight: bold; + letter-spacing: 0.5px; + padding: 5px 0 0 1.5em; + background: #161b22; + border: 1px solid #30363d; + border-bottom: none; + border-radius: 3px 3px 0 0; +} + +.curl-label { + color: #2ea043; +} + +.cli-label { + color: #1f6feb; +} + +.labeled-code-block { + margin-bottom: 15px; +} + +.code-block { + border-radius: 3px; + border: 1px solid #30363d; +} + +.labeled-code-block .code-block { + margin-top: 0; + border-top: none; + border-top-left-radius: 0; + border-top-right-radius: 0; + padding-top: 2px; +} + +.labeled-code-block .code-block pre { + margin: 0; +} + +.command-group { + margin-bottom: 20px; } \ No newline at end of file diff --git a/views/docs.hbs b/views/docs.hbs index 3ae99fa..74249d3 100644 --- a/views/docs.hbs +++ b/views/docs.hbs @@ -8,6 +8,7 @@

Table of Contents

+
+

CLI Usage

+ +

The 0x45 CLI tool provides a convenient way to interact with the service from your terminal.

+ + Installation +
+ 0X45 CLI +
+ go install github.com/watzon/0x45-cli/cmd/0x45@latest + +
+
+ +

Alternatively, you can build from source:

+
+ 0X45 CLI +
+
git clone https://github.com/watzon/0x45-cli.git
+cd 0x45-cli
+go build -o $GOPATH/bin/0x45 ./cmd/0x45
+ +
+
+ + Initial Setup +

Before using the CLI, configure your API key and optionally the API URL:

+
+
+ 0X45 CLI +
+ 0x45 config set api_key YOUR_API_KEY + +
+
+ +
+ 0X45 CLI +
+ 0x45 config set api_url https://your-instance.com + +
+
+
+ + Getting an API Key +
+ 0X45 CLI +
+ 0x45 key request --name "Your Name" --email "your@email.com" + +
+
+ + File Operations +

1. Upload a file

+
+
+ CURL +
+ curl -F "file=@path/to/file.txt" {{baseUrl}} + +
+
+ +
+ 0X45 CLI +
+ 0x45 upload path/to/file.txt + +
+
+
+ +

2. Upload a private file with expiration

+
+
+ CURL +
+ curl -F "file=@path/to/file.txt" "{{baseUrl}}?private=true&expires=24h" + +
+
+ +
+ 0X45 CLI +
+ 0x45 upload --private --expires 24h path/to/file.txt + +
+
+
+ +

3. Upload from stdin

+
+
+ CURL +
+ echo "Hello, World!" | curl --data-binary @- {{baseUrl}} + +
+
+ +
+ 0X45 CLI +
+ echo "Hello, World!" | 0x45 upload - + +
+
+
+ + URL Operations +

1. Shorten a URL

+
+
+ CURL +
+ curl -X POST -d "url=https://example.com" {{baseUrl}}/api/urls + +
+
+ +
+ 0X45 CLI +
+ 0x45 shorten https://example.com + +
+
+
+ +

2. Shorten a private URL with expiration

+
+ 0X45 CLI +
+ 0x45 shorten --private --expires 7d https://example.com + +
+
+ + Content Management +

1. List your uploads

+
+
+ 0X45 CLI +
+ 0x45 list pastes + +
+
+
+ +

2. List your shortened URLs

+
+ 0X45 CLI +
+ 0x45 list urls + +
+
+ +

3. List with pagination

+
+ 0X45 CLI +
+ 0x45 list pastes --page 2 --limit 10 + +
+
+ +

4. Delete content

+
+ 0X45 CLI +
+ 0x45 delete CONTENT_ID + +
+
+ + Configuration Management +

1. Get a config value

+
+ 0X45 CLI +
+ 0x45 config get KEY + +
+
+ +

2. Set a config value

+
+ 0X45 CLI +
+ 0x45 config set KEY VALUE + +
+
+
+

File Upload Endpoints

1. Multipart Upload -
- POST {{baseUrl}} - +
+ CURL +
+ POST {{baseUrl}} + +
Form field:
@@ -64,9 +268,12 @@
2. Raw Upload -
- POST {{baseUrl}} - +
+ CURL +
+ POST {{baseUrl}} + +
Body:
@@ -100,9 +307,12 @@
3. JSON Upload -
- POST {{baseUrl}} - +
+ CURL +
+ POST {{baseUrl}} + +
Content-Type:
@@ -151,9 +361,12 @@
  • View File -
    - GET {{baseUrl}}/:id - +
    + CURL +
    + GET {{baseUrl}}/:id + +
    Response:
    @@ -162,9 +375,12 @@
  • Raw View -
    - GET {{baseUrl}}/raw/:id[.:ext] - +
    + CURL +
    + GET {{baseUrl}}/raw/:id[.:ext] + +
    Response:
    @@ -173,9 +389,12 @@
  • Download -
    - GET {{baseUrl}}/download/:id[.:ext] - +
    + CURL +
    + GET {{baseUrl}}/download/:id[.:ext] + +
    Response:
    @@ -184,9 +403,12 @@
  • Delete with Key -
    - DELETE {{baseUrl}}/delete/:id/:key - +
    + CURL +
    + DELETE {{baseUrl}}/delete/:id/:key + +
    Response:
    @@ -208,9 +430,12 @@

    URL Shortener (Requires API Key)

    1. Shorten URL -
    - POST {{baseUrl}}/url - +
    + CURL +
    + POST {{baseUrl}}/url + +
    Content-Type:
    @@ -253,9 +478,12 @@

    URL Management (Requires API Key)

    1. List URLs -
    - GET {{baseUrl}}/urls - +
    + CURL +
    + GET {{baseUrl}}/urls + +
    Query params:
    @@ -294,9 +522,12 @@
    2. URL Stats -
    - GET {{baseUrl}}/url/:id/stats - +
    + CURL +
    + GET {{baseUrl}}/url/:id/stats + +
    Response:
    @@ -320,9 +551,12 @@
    3. Update URL Expiration -
    - PUT {{baseUrl}}/url/:id/expire - +
    + CURL +
    + PUT {{baseUrl}}/url/:id/expire + +
    Content-Type:
    @@ -359,9 +593,12 @@
    4. Delete URL -
    - DELETE {{baseUrl}}/url/:id - +
    + CURL +
    + DELETE {{baseUrl}}/url/:id + +
    Response:
    @@ -393,16 +630,19 @@ API keys are required for URL shortening and extended features. To request an API key:

    -
    -
    curl -X POST {{baseUrl}}/api-key \
    +    
    + CURL +
    +
    curl -X POST {{baseUrl}}/api-key \
         -H "Content-Type: application/json" \
         -d '{
         "email": "your@email.com",
         "name": "Your Name"
     }'
    - + +

    Response:

    @@ -425,11 +665,14 @@ Once verified, your API key can be used by including it in the Authorization header:

    -
    -
    Authorization: Bearer your-api-key
    - +
    + CURL +
    +
    Authorization: Bearer your-api-key
    + +
diff --git a/views/index.hbs b/views/index.hbs index 575f373..75c98a2 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -10,35 +10,94 @@

+
+
+

📦 CLI Tool Available!

+

Install our CLI tool for easier interaction:

+
+ go install github.com/watzon/0x45-cli/cmd/0x45@latest + +
+
+
+

Usage

-
-
curl -F 'file=@file.txt' {{baseUrl}}
- + +
+
+ CURL +
+
curl -F 'file=@file.txt' {{baseUrl}}
+ +
+
+ +
+ 0X45 CLI +
+
0x45 upload file.txt
+ +
+
-
-
curl -X POST --data-binary @file.txt {{baseUrl}}
- +
+
+ CURL +
+
curl -X POST --data-binary @file.txt {{baseUrl}}
+ +
+
+ +
+ 0X45 CLI +
+
cat file.txt | 0x45 upload -
+ +
+
-
-
curl -d '{"url":"https://example.com"}' {{baseUrl}}/url
- +
+
+ CURL +
+
curl -d '{"url":"https://example.com"}' {{baseUrl}}/url
+ +
+
+ +
+ 0X45 CLI +
+
0x45 shorten https://example.com
+ +
+
-

+

For more examples and API docs, visit: {{baseUrl}}/docs

-

+

View detailed statistics at: {{baseUrl}}/stats