Skip to content

Commit

Permalink
Merge branch 'main' of github.com:watzon/0x45
Browse files Browse the repository at this point in the history
  • Loading branch information
watzon committed Nov 18, 2024
2 parents 18a5b33 + ef2bfed commit 386cbbe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 244 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ WORKDIR /usr/app

COPY --from=build /build/src/app /usr/app

# Copy ca-certificates for TLS (specifically STARTTLS for SMTP)
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

COPY ./views /usr/app/views

COPY ./public /usr/app/public
Expand Down
201 changes: 0 additions & 201 deletions views/docs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<ul>
<li><a href="#getting-started">Getting Started</a></li>
<li><a href="#file-upload-endpoints">File Upload Endpoints</a></li>
<li><a href="#cli-usage">CLI Usage</a></li>
{{#if apiKeysEnabled}}
<li><a href="#authentication">Authentication & API Keys</a></li>
<li><a href="#url-shortener">URL Shortener</a></li>
Expand All @@ -31,206 +30,6 @@
<p>The parameter names remain the same regardless of the content type used. The examples in this documentation use form data for simplicity, as it doesn't require explicitly setting content type headers.</p>
</section>

<section id="cli-usage">
<h2>CLI Usage</h2>

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

<strong>Installation</strong>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>go install github.com/watzon/0x45-cli/cmd/0x45@latest</code>
<button class="action-btn" data-clipboard data-clipboard-content="go install github.com/watzon/0x45-cli/cmd/0x45@latest"><span>Copy</span></button>
</div>
</div>

<p>Alternatively, you can build from source:</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<pre><code>git clone https://github.com/watzon/0x45-cli.git
cd 0x45-cli
go build -o $GOPATH/bin/0x45 ./cmd/0x45</code></pre>
<button class="action-btn" data-clipboard data-clipboard-content="git clone https://github.com/watzon/0x45-cli.git\ncd 0x45-cli\ngo build -o $GOPATH/bin/0x45 ./cmd/0x45"><span>Copy</span></button>
</div>
</div>

<strong>Initial Setup</strong>
<p>Before using the CLI, configure your API key and optionally the API URL:</p>
<div class="command-group">
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 config set api_key YOUR_API_KEY</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 config set api_key YOUR_API_KEY"><span>Copy</span></button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 config set api_url https://your-instance.com</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 config set api_url https://your-instance.com"><span>Copy</span></button>
</div>
</div>
</div>

<strong>Getting an API Key</strong>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 key request --name "Your Name" --email "[email protected]"</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 key request --name \"Your Name\" --email \"[email protected]\""><span>Copy</span></button>
</div>
</div>

<strong>File Operations</strong>
<p>1. Upload a file</p>
<div class="command-group">
<div class="labeled-code-block">
<span class="command-label curl-label">CURL</span>
<div class="code-block">
<code>curl -F "file=@path/to/file.txt" {{baseUrl}}/p</code>
<button class="action-btn" data-clipboard data-clipboard-content="curl -F &quot;file=@path/to/file.txt&quot; {{baseUrl}}/p"><span>Copy</span></button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 upload path/to/file.txt</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 upload path/to/file.txt"><span>Copy</span></button>
</div>
</div>
</div>

<p>2. Upload a private file with expiration</p>
<div class="command-group">
<div class="labeled-code-block">
<span class="command-label curl-label">CURL</span>
<div class="code-block">
<code>curl -F "file=@path/to/file.txt" -F "private=true" -F "expires_in=24h" "{{baseUrl}}/p"</code>
<button class="action-btn" data-clipboard data-clipboard-content="curl -F &quot;file=@path/to/file.txt&quot; -F &quot;private=true&quot; -F &quot;expires_in=24h&quot; &quot;{{baseUrl}}/p&quot;"><span>Copy</span></button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 upload --private --expires 24h path/to/file.txt</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 upload --private --expires 24h path/to/file.txt"><span>Copy</span></button>
</div>
</div>
</div>

<p>3. Upload from stdin</p>
<div class="command-group">
<div class="labeled-code-block">
<span class="command-label curl-label">CURL</span>
<div class="code-block">
<code>echo "Hello, World!" | curl --data-binary @- {{baseUrl}}/p</code>
<button class="action-btn" data-clipboard data-clipboard-content="echo &quot;Hello, World!&quot; | curl --data-binary @- {{baseUrl}}/p"><span>Copy</span></button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>echo "Hello, World!" | 0x45 upload -</code>
<button class="action-btn" data-clipboard data-clipboard-content="echo &quot;Hello, World!&quot; | 0x45 upload -"><span>Copy</span></button>
</div>
</div>
</div>

<strong>URL Operations</strong>
<p>1. Shorten a URL</p>
<div class="command-group">
<div class="labeled-code-block">
<span class="command-label curl-label">CURL</span>
<div class="code-block">
<code>curl -X POST -d "url=https://example.com" {{baseUrl}}/u</code>
<button class="action-btn" data-clipboard data-clipboard-content="curl -X POST -d &quot;url=https://example.com&quot; {{baseUrl}}/u"><span>Copy</span></button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 shorten https://example.com</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 shorten https://example.com"><span>Copy</span></button>
</div>
</div>
</div>

<p>2. Shorten a private URL with expiration</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 shorten --private --expires 7d https://example.com</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 shorten --private --expires 7d https://example.com"><span>Copy</span></button>
</div>
</div>

<strong>Content Management</strong>
<p>1. List your uploads</p>
<div class="command-group">
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 list pastes</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 list pastes"><span>Copy</span></button>
</div>
</div>
</div>

<p>2. List your shortened URLs</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 list urls</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 list urls"><span>Copy</span></button>
</div>
</div>

<p>3. List with pagination</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 list pastes --page 2 --limit 10</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 list pastes --page 2 --limit 10"><span>Copy</span></button>
</div>
</div>

<p>4. Delete content</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 delete CONTENT_ID</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 delete CONTENT_ID"><span>Copy</span></button>
</div>
</div>

<strong>Configuration Management</strong>
<p>1. Get a config value</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 config get KEY</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 config get KEY"><span>Copy</span></button>
</div>
</div>

<p>2. Set a config value</p>
<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<code>0x45 config set KEY VALUE</code>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 config set KEY VALUE"><span>Copy</span></button>
</div>
</div>
</section>

{{#if apiKeysEnabled}}
<section id="authentication">
<h2>Authentication & API Keys</h2>
Expand Down
43 changes: 0 additions & 43 deletions views/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
</p>
</section>

<section>
<div class="info-box">
<h3>📦 CLI Tool Available!</h3>
<p>Install our CLI tool for easier interaction:</p>
<div class="code-block">
<code>go install github.com/watzon/0x45-cli/cmd/0x45@latest</code>
<button class="action-btn" data-clipboard data-clipboard-content="go install github.com/watzon/0x45-cli/cmd/0x45@latest">
<span>Copy</span>
</button>
</div>
</div>
</section>

<section>
<h2>Usage</h2>

Expand All @@ -36,16 +23,6 @@
</button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<pre><code>0x45 upload file.txt</code></pre>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 upload file.txt">
<span>Copy</span>
</button>
</div>
</div>
</div>

<div class="command-group">
Expand All @@ -58,16 +35,6 @@
</button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<pre><code>cat file.txt | 0x45 upload -</code></pre>
<button class="action-btn" data-clipboard data-clipboard-content="cat file.txt | 0x45 upload -">
<span>Copy</span>
</button>
</div>
</div>
</div>

<div class="command-group">
Expand All @@ -80,16 +47,6 @@
</button>
</div>
</div>

<div class="labeled-code-block">
<span class="command-label cli-label">0X45 CLI</span>
<div class="code-block">
<pre><code>0x45 shorten https://example.com</code></pre>
<button class="action-btn" data-clipboard data-clipboard-content="0x45 shorten https://example.com">
<span>Copy</span>
</button>
</div>
</div>
</div>

<p>
Expand Down

0 comments on commit 386cbbe

Please sign in to comment.