rename to infinipaste
Signed-off-by: Xe Iaso <xe@tailscale.com>
This commit is contained in:
parent
14c5989f6c
commit
2d60fbc5cb
|
@ -1,6 +1,7 @@
|
|||
# paste
|
||||
# infinipaste
|
||||
|
||||
A self-hostable pastebin for your tailnet.
|
||||
A self-hostable pastebin for your tailnet. It can store an infinite\*
|
||||
number of pastes.
|
||||
|
||||
## Development
|
||||
|
||||
|
@ -11,7 +12,7 @@ A self-hostable pastebin for your tailnet.
|
|||
## Building
|
||||
|
||||
```
|
||||
nix build .#bin
|
||||
nix build .#web
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -14,12 +14,12 @@ import (
|
|||
|
||||
var (
|
||||
fname = flag.String("n", "", "filename to use for pastes from standard input")
|
||||
target = flag.String("target", "http://paste", "paste server URL")
|
||||
target = flag.String("target", "http://paste", "infinipaste server URL")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s [filename]\n\nTakes a file or standard in and posts it to your tailnet's paste service. Returns a URL on standard out for sharing.\n\nFlags:\n", filepath.Base(os.Args[0]))
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s [filename]\n\nTakes a file or standard in and posts it to your tailnet's infinipaste service. Returns a URL on standard out for sharing.\n\nFlags:\n", filepath.Base(os.Args[0]))
|
||||
flag.PrintDefaults()
|
||||
os.Exit(2)
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
<body id="top">
|
||||
<main>
|
||||
<nav>
|
||||
<a href="/">Paste</a>{{if .UserInfo}} - <a href="/paste/list">List</a> - <a href="/help">Help</a>{{end}}
|
||||
<a href="/">Infinipaste</a>{{if .UserInfo}} - <a href="/paste/list">List</a> - <a href="/help">Help</a>{{end}}
|
||||
{{if .UserInfo}}<div class="right">{{.UserInfo.DisplayName}} <img style="width:32px;height:32px" src="{{.UserInfo.ProfilePicURL}}" /></div>{{end}}
|
||||
</nav>
|
||||
|
||||
|
|
|
@ -13,17 +13,17 @@
|
|||
|
||||
<h2 id="cli">Command-line tool</h2>
|
||||
|
||||
<p>You can pipe commands or paste files to the pastebin using the command <code>tailpaste</code>. You can install it by installing the <a href="https://go.dev">Go</a> compiler toolkit and then running this command:</p>
|
||||
<p>You can pipe commands or paste files to the pastebin using the command <code>infinipaste</code>. You can install it by installing the <a href="https://go.dev">Go</a> compiler toolkit and then running this command:</p>
|
||||
|
||||
<pre><code>go get github.com/tailscale/paste/cmd/tailpaste@main</code></pre>
|
||||
<pre><code>go get github.com/tailscale/paste/cmd/infinipaste@main</code></pre>
|
||||
|
||||
<p>Once it is installed, invoke it with the command <code>tailpaste</code>:</p>
|
||||
<p>Once it is installed, invoke it with the command <code>infinipaste</code>:</p>
|
||||
|
||||
<pre><code>tailpaste ./foo.txt</code></pre>
|
||||
<pre><code>infinipaste ./foo.txt</code></pre>
|
||||
|
||||
<p>and the program will print a URL that you can share with your team. You can also pipe the output from any command to it:</p>
|
||||
|
||||
<pre><code>go test &2<1 | tailpaste -n go-test.txt</code></pre>
|
||||
<pre><code>go test &2<1 | infinipaste -n go-test.txt</code></pre>
|
||||
|
||||
<h2 id="api">API</h2>
|
||||
|
||||
|
@ -52,13 +52,13 @@
|
|||
|
||||
<h3 id="emacs">Emacs package</h3>
|
||||
|
||||
<p>The default distribution of tailpaste ships with a package for <a href="https://www.gnu.org/software/emacs/">GNU Emacs</a>. This package will let you submit pastes from your editor. It requires the <a href="https://github.com/tkf/emacs-request"><code>request</code></a> package and exposes two interactive functions:</p>
|
||||
<p>The default distribution of infinipaste ships with a package for <a href="https://www.gnu.org/software/emacs/">GNU Emacs</a>. This package will let you submit pastes from your editor. It requires the <a href="https://github.com/tkf/emacs-request"><code>request</code></a> package and exposes two interactive functions:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>M-x tailpaste-submit-region</code> - submits the currently highlighted region to tailpaste</li>
|
||||
<li><code>M-x tailpaste-submit-buffer</code> - submits the contents of the current buffer to tailpaste</li>
|
||||
<li><code>M-x infinipaste-submit-region</code> - submits the currently highlighted region to infinipaste</li>
|
||||
<li><code>M-x infinipaste-submit-buffer</code> - submits the contents of the current buffer to infinipaste</li>
|
||||
</ul>
|
||||
|
||||
<p>You can download this package <a href="https://github.com/tailscale/paste/blob/main/contrib/tailpaste.el">from the tailpaste repository</a>. You can install it by using <code>M-x package-install-file</code> or by opening it in Emacs and running <code>M-x package-install-from-buffer</code>. Please be sure that <code>request</code> is installed.</p>
|
||||
<p>You can download this package <a href="https://github.com/tailscale-dev/infinipaste/blob/main/contrib/infinipaste.el">from the infinipaste repository</a>. You can install it by using <code>M-x package-install-file</code> or by opening it in Emacs and running <code>M-x package-install-from-buffer</code>. Please be sure that <code>request</code> is installed.</p>
|
||||
|
||||
{{template "footer" .}}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
<div class="right"><img style="width:32px;height:32px" src="{{.PasterProfilePicURL}}" /></div>
|
||||
|
||||
There are no pastes in the list. Try <a href="/">creating some</a>
|
||||
<p>There are no pastes in the list. Try <a href="/">creating some</a>!</p>
|
||||
|
||||
{{template "footer" .}}
|
||||
|
|
81
contrib/infinipaste.el
Normal file
81
contrib/infinipaste.el
Normal file
|
@ -0,0 +1,81 @@
|
|||
;;; infinipaste.el --- infinipaste client for Emacs -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C)
|
||||
;; 2023 Tailscale, Inc.
|
||||
;; Author: Xe Iaso <xe@tailscale.com>
|
||||
;; Maintainer: Xe Iaso <xe@tailscale.com>
|
||||
;; Created: 2023-01-13
|
||||
;; Version: 0.1
|
||||
;; Keywords: tailscale, pastebin, sharing
|
||||
;; Homepage: https://github.com/tailscale-dev/infinipaste
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This uses request-el to make requests to your tailnet's infinipaste server. You
|
||||
;; can install request-el with M-x package-install.
|
||||
;;
|
||||
;; This package requires that you have a infinipaste server set up. This package
|
||||
;; reaches out to a infinipaste server over either plain HTTP, or HTTPS should you
|
||||
;; configure the variable `infinipaste-server'.
|
||||
;;
|
||||
;; Usage:
|
||||
;;
|
||||
;; To submit the contents of the current buffer to infinipaste:
|
||||
;; M-x infinipaste-submit-buffer
|
||||
;; To submit the contents of the currently highlighted region to infinipaste:
|
||||
;; M-x infinipaste-submit-region
|
||||
;;
|
||||
;; Customization:
|
||||
;;
|
||||
;; To customize the infinipaste server this package reaches out to:
|
||||
;; M-x customize-group infinipaste
|
||||
;;
|
||||
;; You can customize the infinipaste server URL by changing the value of `infinipaste-server':
|
||||
;; (setq infinipaste-server "https://paste.shark-harmonic.ts.net")
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'request)
|
||||
|
||||
(defgroup infinipaste nil
|
||||
"Infinipaste server configuration."
|
||||
:prefix "infinipaste-"
|
||||
:group 'infinipaste)
|
||||
|
||||
(defcustom infinipaste-server "http://paste"
|
||||
"The server that is running infinipaste or a service with a compatible API to infinipaste. This should NOT end with a trailing slash."
|
||||
:group 'infinipaste
|
||||
:type 'string)
|
||||
|
||||
(defun infinipaste--send-paste (fname content)
|
||||
"Internal function that actually fires off the paste with name FNAME and content CONTENT to the infinipaste server."
|
||||
(request (format "%s/api/post" infinipaste-server)
|
||||
:type "POST"
|
||||
:data `(("filename" . ,fname)
|
||||
("content" . ,content))
|
||||
:headers '(("Accept" . "text/plain"))
|
||||
:timeout 60
|
||||
:success (cl-function
|
||||
(lambda (&key response &allow-other-keys)
|
||||
(message "%s" (request-response-data response))))))
|
||||
|
||||
(defun infinipaste-submit-buffer ()
|
||||
"Submits the entire current buffer to infinipaste."
|
||||
(interactive)
|
||||
(let ((fname (format "%s.%s"
|
||||
(file-name-base (buffer-file-name))
|
||||
(file-name-extension (buffer-file-name))))
|
||||
(content (buffer-string)))
|
||||
(infinipaste--send-paste fname content)))
|
||||
|
||||
(defun infinipaste-submit-region ()
|
||||
"Submits the highlighted region to infinipaste."
|
||||
(interactive)
|
||||
(let ((fname (format "%s.%s"
|
||||
(file-name-base (buffer-file-name))
|
||||
(file-name-extension (buffer-file-name))))
|
||||
(content (buffer-substring-no-properties (region-beginning) (region-end))))
|
||||
(infinipaste--send-paste fname content)))
|
||||
|
||||
(provide 'infinipaste)
|
||||
;;; infinipaste.el ends here
|
|
@ -1,81 +0,0 @@
|
|||
;;; tailpaste.el --- tailpaste client for Emacs -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C)
|
||||
;; 2023 Tailscale, Inc.
|
||||
;; Author: Xe Iaso <xe@tailscale.com>
|
||||
;; Maintainer: Xe Iaso <xe@tailscale.com>
|
||||
;; Created: 2023-01-13
|
||||
;; Version: 0.1
|
||||
;; Keywords: tailscale, pastebin, sharing
|
||||
;; Homepage: https://github.com/tailscale/paste
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; This uses request-el to make requests to your tailnet's tailpaste server. You
|
||||
;; can install request-el with M-x package-install.
|
||||
;;
|
||||
;; This package requires that you have a tailpaste server set up. This package
|
||||
;; reaches out to a tailpaste server over either plain HTTP, or HTTPS should you
|
||||
;; configure the variable `tailpaste-server'.
|
||||
;;
|
||||
;; Usage:
|
||||
;;
|
||||
;; To submit the contents of the current buffer to tailpaste:
|
||||
;; M-x tailpaste-submit-buffer
|
||||
;; To submit the contents of the currently highlighted region to tailpaste:
|
||||
;; M-x tailpaste-submit-region
|
||||
;;
|
||||
;; Customization:
|
||||
;;
|
||||
;; To customize the tailpaste server this package reaches out to:
|
||||
;; M-x customize-group tailpaste
|
||||
;;
|
||||
;; You can customize the tailpaste server URL by changing the value of `tailpaste-server':
|
||||
;; (setq tailpaste-server "https://paste.shark-harmonic.ts.net")
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'request)
|
||||
|
||||
(defgroup tailpaste nil
|
||||
"Tailpaste server configuration."
|
||||
:prefix "tailpaste-"
|
||||
:group 'tailpaste)
|
||||
|
||||
(defcustom tailpaste-server "http://paste"
|
||||
"The server that is running tailpaste or a service with a compatible API to tailpaste. This should NOT end with a trailing slash."
|
||||
:group 'tailpaste
|
||||
:type 'string)
|
||||
|
||||
(defun tailpaste--send-paste (fname content)
|
||||
"Internal function that actually fires off the paste with name FNAME and content CONTENT to the tailpaste server."
|
||||
(request (format "%s/api/post" tailpaste-server)
|
||||
:type "POST"
|
||||
:data `(("filename" . ,fname)
|
||||
("content" . ,content))
|
||||
:headers '(("Accept" . "text/plain"))
|
||||
:timeout 60
|
||||
:success (cl-function
|
||||
(lambda (&key response &allow-other-keys)
|
||||
(message "%s" (request-response-data response))))))
|
||||
|
||||
(defun tailpaste-submit-buffer ()
|
||||
"Submits the entire current buffer to tailpaste."
|
||||
(interactive)
|
||||
(let ((fname (format "%s.%s"
|
||||
(file-name-base (buffer-file-name))
|
||||
(file-name-extension (buffer-file-name))))
|
||||
(content (buffer-string)))
|
||||
(tailpaste--send-paste fname content)))
|
||||
|
||||
(defun tailpaste-submit-region ()
|
||||
"Submits the highlighted region to tailpaste."
|
||||
(interactive)
|
||||
(let ((fname (format "%s.%s"
|
||||
(file-name-base (buffer-file-name))
|
||||
(file-name-extension (buffer-file-name))))
|
||||
(content (buffer-substring-no-properties (region-beginning) (region-end))))
|
||||
(tailpaste--send-paste fname content)))
|
||||
|
||||
(provide 'tailpaste)
|
||||
;;; tailpaste.el ends here
|
Loading…
Reference in a new issue