From 2d60fbc5cb13e3539ef3bebcc79b72d6a16321bb Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 16 Jan 2023 16:06:46 +0000 Subject: [PATCH] rename to infinipaste Signed-off-by: Xe Iaso --- README.md | 7 ++- cmd/{tailpaste => infinipaste}/main.go | 4 +- cmd/web/tmpl/base.tmpl | 2 +- cmd/web/tmpl/help.tmpl | 18 +++--- cmd/web/tmpl/nopastes.tmpl | 2 +- contrib/infinipaste.el | 81 ++++++++++++++++++++++++++ contrib/tailpaste.el | 81 -------------------------- go.mod | 2 +- 8 files changed, 99 insertions(+), 98 deletions(-) rename cmd/{tailpaste => infinipaste}/main.go (87%) create mode 100644 contrib/infinipaste.el delete mode 100644 contrib/tailpaste.el diff --git a/README.md b/README.md index 3e9dacf..30e43bd 100644 --- a/README.md +++ b/README.md @@ -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 ``` ``` diff --git a/cmd/tailpaste/main.go b/cmd/infinipaste/main.go similarity index 87% rename from cmd/tailpaste/main.go rename to cmd/infinipaste/main.go index 192421a..c9d3763 100644 --- a/cmd/tailpaste/main.go +++ b/cmd/infinipaste/main.go @@ -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) } diff --git a/cmd/web/tmpl/base.tmpl b/cmd/web/tmpl/base.tmpl index 7246b9b..e7253ff 100644 --- a/cmd/web/tmpl/base.tmpl +++ b/cmd/web/tmpl/base.tmpl @@ -9,7 +9,7 @@
diff --git a/cmd/web/tmpl/help.tmpl b/cmd/web/tmpl/help.tmpl index 0fc3321..78df14f 100644 --- a/cmd/web/tmpl/help.tmpl +++ b/cmd/web/tmpl/help.tmpl @@ -13,17 +13,17 @@

Command-line tool

-

You can pipe commands or paste files to the pastebin using the command tailpaste. You can install it by installing the Go compiler toolkit and then running this command:

+

You can pipe commands or paste files to the pastebin using the command infinipaste. You can install it by installing the Go compiler toolkit and then running this command:

-
go get github.com/tailscale/paste/cmd/tailpaste@main
+
go get github.com/tailscale/paste/cmd/infinipaste@main
-

Once it is installed, invoke it with the command tailpaste:

+

Once it is installed, invoke it with the command infinipaste:

-
tailpaste ./foo.txt
+
infinipaste ./foo.txt

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:

-
go test &2<1 | tailpaste -n go-test.txt
+
go test &2<1 | infinipaste -n go-test.txt

API

@@ -52,13 +52,13 @@

Emacs package

-

The default distribution of tailpaste ships with a package for GNU Emacs. This package will let you submit pastes from your editor. It requires the request package and exposes two interactive functions:

+

The default distribution of infinipaste ships with a package for GNU Emacs. This package will let you submit pastes from your editor. It requires the request package and exposes two interactive functions:

    -
  • M-x tailpaste-submit-region - submits the currently highlighted region to tailpaste
  • -
  • M-x tailpaste-submit-buffer - submits the contents of the current buffer to tailpaste
  • +
  • M-x infinipaste-submit-region - submits the currently highlighted region to infinipaste
  • +
  • M-x infinipaste-submit-buffer - submits the contents of the current buffer to infinipaste
-

You can download this package from the tailpaste repository. You can install it by using M-x package-install-file or by opening it in Emacs and running M-x package-install-from-buffer. Please be sure that request is installed.

+

You can download this package from the infinipaste repository. You can install it by using M-x package-install-file or by opening it in Emacs and running M-x package-install-from-buffer. Please be sure that request is installed.

{{template "footer" .}} diff --git a/cmd/web/tmpl/nopastes.tmpl b/cmd/web/tmpl/nopastes.tmpl index 9f39e72..fe0f946 100644 --- a/cmd/web/tmpl/nopastes.tmpl +++ b/cmd/web/tmpl/nopastes.tmpl @@ -2,6 +2,6 @@
-There are no pastes in the list. Try creating some +

There are no pastes in the list. Try creating some!

{{template "footer" .}} diff --git a/contrib/infinipaste.el b/contrib/infinipaste.el new file mode 100644 index 0000000..6ec7e90 --- /dev/null +++ b/contrib/infinipaste.el @@ -0,0 +1,81 @@ +;;; infinipaste.el --- infinipaste client for Emacs -*- lexical-binding: t; -*- + +;; Copyright (C) +;; 2023 Tailscale, Inc. +;; Author: Xe Iaso +;; Maintainer: Xe Iaso +;; 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 diff --git a/contrib/tailpaste.el b/contrib/tailpaste.el deleted file mode 100644 index 4430665..0000000 --- a/contrib/tailpaste.el +++ /dev/null @@ -1,81 +0,0 @@ -;;; tailpaste.el --- tailpaste client for Emacs -*- lexical-binding: t; -*- - -;; Copyright (C) -;; 2023 Tailscale, Inc. -;; Author: Xe Iaso -;; Maintainer: Xe Iaso -;; 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 diff --git a/go.mod b/go.mod index 941eb0a..cabe63a 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/tailscale/paste +module github.com/tailscale-dev/infinipaste go 1.19