diff --git a/assets/css/_recording_show.scss b/assets/css/_recording_show.scss index 366c57e48..6b300bf8a 100644 --- a/assets/css/_recording_show.scss +++ b/assets/css/_recording_show.scss @@ -25,8 +25,12 @@ } .actions { - .btn { + .btn-group > div { margin-left: 1rem; + + &:first-child { + margin-left: 0; + } } } } diff --git a/lib/asciinema_web/controllers/doc_controller.ex b/lib/asciinema_web/controllers/doc_controller.ex deleted file mode 100644 index b34a2cc5a..000000000 --- a/lib/asciinema_web/controllers/doc_controller.ex +++ /dev/null @@ -1,28 +0,0 @@ -defmodule AsciinemaWeb.DocController do - use AsciinemaWeb, :controller - alias AsciinemaWeb.{DocView, ErrorView} - - plug :clear_main_class - - @topics ["how-it-works", "getting-started", "installation", "usage", "config", "embedding"] - - def index(conn, _params) do - redirect(conn, to: Routes.doc_path(conn, :show, :"getting-started")) - end - - def show(conn, %{"topic" => topic}) when topic in @topics do - topic = String.to_atom(topic) - - conn - |> assign(:topic, topic) - |> assign(:page_title, DocView.title_for(topic)) - |> put_layout(:docs) - |> render("#{topic}.html") - end - - def show(conn, _params) do - conn - |> put_status(404) - |> render(ErrorView, "404.html") - end -end diff --git a/lib/asciinema_web/router.ex b/lib/asciinema_web/router.ex index 7cd1fd962..85fbbe4f8 100644 --- a/lib/asciinema_web/router.ex +++ b/lib/asciinema_web/router.ex @@ -78,9 +78,6 @@ defmodule AsciinemaWeb.Router do resources "/s", LiveStreamController, only: [:show, :edit, :update] - get "/docs", DocController, :index - get "/docs/:topic", DocController, :show - resources "/login", LoginController, only: [:new, :create], singleton: true get "/login/sent", LoginController, :sent, as: :login diff --git a/lib/asciinema_web/templates/doc/config.html.md b/lib/asciinema_web/templates/doc/config.html.md deleted file mode 100644 index 8d3ffae87..000000000 --- a/lib/asciinema_web/templates/doc/config.html.md +++ /dev/null @@ -1,60 +0,0 @@ -# Configuration file - -You can configure asciinema by creating config file at -`$HOME/.config/asciinema/config`. - -Configuration is split into sections (`[api]`, `[record]`, `[play]`). Here's a -list of all available options for each section: - -```ini -[api] - -; API server URL, default: https://asciinema.org -; If you run your own instance of asciinema-server then set its address here -; It can also be overriden by setting ASCIINEMA_API_URL environment variable -url = https://asciinema.example.com - -[record] - -; Command to record, default: $SHELL -command = /bin/bash -l - -; Enable stdin (keyboard) recording, default: no -stdin = yes - -; List of environment variables to capture, default: SHELL,TERM -env = SHELL,TERM,USER - -; Limit recorded terminal inactivity to max n seconds, default: off -idle_time_limit = 2 - -; Answer "yes" to all interactive prompts, default: no -yes = true - -; Be quiet, suppress all notices/warnings, default: no -quiet = true - -[play] - -; Playback speed (can be fractional), default: 1 -speed = 2 - -; Limit replayed terminal inactivity to max n seconds, default: off -idle_time_limit = 1 -``` - -A very minimal config file could look like that: - -```ini -[record] -idle_time_limit = 2 -``` - -Config directory location can be changed by setting `$ASCIINEMA_CONFIG_HOME` -environment variable. - -If `$XDG_CONFIG_HOME` is set on Linux then asciinema uses -`$XDG_CONFIG_HOME/asciinema` instead of `$HOME/.config/asciinema`. - -> asciinema versions prior to 1.1 used `$HOME/.asciinema`. If you have it -> there you should `mv $HOME/.asciinema $HOME/.config/asciinema`. diff --git a/lib/asciinema_web/templates/doc/embedding.html.md b/lib/asciinema_web/templates/doc/embedding.html.md deleted file mode 100644 index 272c3e74f..000000000 --- a/lib/asciinema_web/templates/doc/embedding.html.md +++ /dev/null @@ -1,175 +0,0 @@ -# Sharing & embedding - -You can share any recording by copying its URL and sending it to a friend or -posting it on a social network. asciinema.org supports oEmbed/Open Graph/Twitter -Card protocols, displaying a nice thumbnail where possible. - -You can also easily embed an asciicast on any HTML page. If you want to put a -recording in a blog post, a project's documentation or in a conference talk's -slides, you can do it by copy-pasting one of the embed scripts. - -## Sharing a link - -You can get the share link for a specific asciicast by clicking on "Share" link -on asciicast page. - -Any of the options listed in "Customizing the playback" section below can be -appended to the asciicast URL as the query params, e.g.: - - https://asciinema.org/a/14?t=25&speed=2&theme=solarized-dark - -Visiting this link will start the playback at 25s and play at double speed, -using Solarized Dark terminal theme. - -## Embedding image link - -Embedding as an image link is useful in places where scripts are not allowed, -e.g. in a project's README file. - -You can get the embed snippets for a specific asciicast by clicking on "Share" -link on asciicast page. - -This is how they look for asciicast 14: - -HTML: - - - -Markdown: - - [![asciicast](https://asciinema.org/a/14.png)](https://asciinema.org/a/14) - -You can pass extra options (listed in "Customizing the playback" below) to the -linked URL as query params. For example, to start the playback automatically -when opening linked asciicast page append `?autoplay=1` to the asciicast URL in -`href` attribute: - - - -## Embedding the player - -If you're embedding on your own page or on a site which permits script tags, you -can use the full player widget. - -You can get the widget script for a specific asciicast by clicking on "Embed" -link on asciicast page. - -It looks like this: - - - -The player shows up right at the place where the script is pasted. Let's look -at the following markup: - -
This is some text.
- -This is some other text.
- -The player is displayed between the two paragraphs, as a `div` element with -"asciicast" class. - -The embed script supports all customization options (see the section below). An -option can be specified by adding it as a -data-option-name="value"
attribute to the script
-tag.
-
-For example, to make the embedded player autostart playback when loaded and use
-big font, use the following script:
-
-
-
-## Customizing the playback
-
-The player supports several options that control the behavior and look of it.
-Append them to the URL (`?speed=2&theme=tango`) or set them as data attributes
-on embed script (`data-speed="2" data-theme="tango"`).
-
-### **startAt** / **t**
-
-The `startAt` (or `t`) option specifies the time at which the playback should
-start. The default is `startAt=0` (play from the beginning).
-
-Accepted formats: `ss`, `mm:ss`, `hh:mm:ss`.
-
-NOTE: when `startAt` is specified then `autoplay=1` is implied. To prevent the
-player from starting automatically when `startAt` option is set you have to
-explicitly set `autoplay=0`.
-
-### **autoplay**
-
-The `autoplay` option controls whether the playback should automatically start
-when the player loads. Accepted values:
-
-* 0 / false - do not start playback automatically (default)
-* 1 / true - start playback automatically
-
-### **preload**
-
-The `preload` option controls whether the player should immediately start
-fetching the recording.
-
-* 0 / false - do not preload the recording, wait for user action
-* 1 / true - preload the recording
-
-Defaults to 1 for asciinema.org URLs, to 0 for embed script.
-
-### **loop**
-
-The `loop` option allows for looping the playback. This option is usually
-combined with `autoplay` option. Accepted values:
-
-* 0 / false - disable looping (default)
-* 1 / true - enable looping
-
-### **speed**
-
-The `speed` option alters the playback speed. The default speed is 1 which
-means it plays at the unaltered, original speed.
-
-### **idleTimeLimit** / **i**
-
-The `idleTimeLimit` (or `i`) option allows reducing terminal inactivity periods
-to a given number of seconds.
-
-For example, when set to 2 any inactivity longer than 2 seconds will be
-"compressed" to 2 seconds.
-
-When not specified it defaults to (first non-blank):
-
-- the "Idle time limit" value set on asciicast's settings page,
-- `idle_time_limit` value from asciicast header (saved when passing `-i - To start recording run the following command: -
- -asciinema rec
-
-
- This spawns a new shell instance and records all terminal output.
- When you're ready to finish simply exit the shell either by typing exit
or
- hitting Ctrl-D.
-
- See usage instructions to learn about all commands and options. -
- -- If you want to manage your recordings on asciinema.org (set title/description, - delete etc) you need to authenticate. Run the following command and open - displayed URL in your web browser: -
- -asciinema auth
-
-- If you skip this step now, you can run the above command later and all - previously recorded asciicasts will automatically get assigned to your - profile. -
diff --git a/lib/asciinema_web/templates/doc/how-it-works.html.md b/lib/asciinema_web/templates/doc/how-it-works.html.md deleted file mode 100644 index 74432cb68..000000000 --- a/lib/asciinema_web/templates/doc/how-it-works.html.md +++ /dev/null @@ -1,74 +0,0 @@ -# How it works - -asciinema project is built of several complementary pieces: - -* command-line based terminal session recorder, `asciinema`, -* website with an API at asciinema.org, -* javascript player - -When you run `asciinema rec` in your terminal the recording starts, capturing -all output that is being printed to your terminal while you're issuing the -shell commands. When the recording finishes (by hitting Ctrl-D or -typing `exit`) then the captured output is uploaded to asciinema.org website -and prepared for playback on the web. - -Here's a brief overview of how these parts work. - -## Recording - -You probably know `ssh`, `screen` or `script` command. Actually, asciinema -was inspired by `script` (and `scriptreplay`) commands. What you may not know -is they all use the same UNIX system capability: [a -pseudo-terminal](http://en.wikipedia.org/wiki/Pseudo_terminal). - -> A pseudo terminal is a pair of pseudo-devices, one of which, the slave, -> emulates a real text terminal device, the other of which, the master, -> provides the means by which a terminal emulator process controls the slave. - -Here's how terminal emulator interfaces with a user and a shell: - -> The role of the terminal emulator process is to interact with the user; to -> feed text input to the master pseudo-device for use by the shell (which is -> connected to the slave pseudo-device) and to read text output from the -> master pseudo-device and show it to the user. - -In other words, pseudo-terminals give programs the ability to act as a -middlemen between the user, the display and the shell. It allows for -transparent capture of user input (keyboard) and terminal output (display). -`screen` command utilizes it for capturing special keyboard shortcuts -like Ctrl-A and altering the output in order to display window -numbers/names and other messages. - -asciinema recorder does its job by utilizing pseudo-terminal for capturing all -the output that goes to a terminal and saving it in memory (together with timing -information). The captured output includes all the text and invisible -escape/control sequences in a raw, unaltered form. When the recording session -finishes it uploads the output (in -[asciicast format](https://github.com/asciinema/asciinema/blob/main/doc/asciicast-v2.md)) -to asciinema.org. That's all about "recording" part. - -For the implementation details check out [recorder source -code](https://github.com/asciinema/asciinema). - -## Playback - -As the recording is a raw stream of text and control -sequences it can't be just played by incrementally printing text in proper -intervals. It requires interpretation of [ANSI escape code -sequences](http://en.wikipedia.org/wiki/ANSI_escape_code) in order to -correctly display color changes, cursor movement and printing text at proper -places on the screen. - -The player comes with its own terminal emulator based on -[Paul Williams' parser for ANSI-compatible video terminals](https://vt100.net/emu/dec_ansi_parser). -It covers only the display part of the emulation as this is what the player is -about (input is handled by your terminal+shell at the time of recording anyway) -and its handling of escape sequences is fully compatible with most modern -terminal emulators like xterm, Gnome Terminal, iTerm, mosh etc. - -The end result is a smooth animation with all text attributes (bold, -underline, inverse, ...) and 256 colors perfectly rendered. - -For the implementation details check out [asciinema.org website source -code](https://github.com/asciinema/asciinema-server) and [player source -code](https://github.com/asciinema/asciinema-player). diff --git a/lib/asciinema_web/templates/doc/installation.html.md b/lib/asciinema_web/templates/doc/installation.html.md deleted file mode 100644 index 795f7f35c..000000000 --- a/lib/asciinema_web/templates/doc/installation.html.md +++ /dev/null @@ -1,158 +0,0 @@ -# Installation - -There are several ways to get asciinema recorder: - -- [Installing via Pip](#installing-via-pip) -- [Installing on Linux](#installing-on-linux) -- [Installing on macOS](#installing-on-macos) -- [Installing on FreeBSD](#installing-on-freebsd) -- [Installing on OpenBSD](#installing-on-openbsd) -- [Running in a container](#running-in-a-container) -- [Running from source](#running-from-source) - -If you use other operating system and you can build a native package for it then -don't hesitate, do it and let us know. We have [Github -issue](https://github.com/asciinema/asciinema/issues/116) where we track new -releases and packaging progress. - -## Installing via Pip -{: #installing-via-pip} - -asciinema is available on [PyPI](https://pypi.python.org/pypi/asciinema) and can -be installed with pip (Python 3 required): - - sudo pip3 install asciinema - -This is the universal installation method for all operating systems, which -always provides the latest version. - -## Installing on Linux -{: #installing-on-linux} - -### Arch Linux - - pacman -S asciinema - -### Debian - - sudo apt-get install asciinema - -### Fedora - -For Fedora < 22: - - sudo yum install asciinema - -For Fedora >= 22: - - sudo dnf install asciinema - -### Gentoo Linux - - emerge -av asciinema - -### NixOS / Nix - - nix-env -i asciinema - -### openSUSE - - zypper in asciinema - -### Ubuntu - - sudo apt-add-repository ppa:zanchey/asciinema - sudo apt-get update - sudo apt-get install asciinema - -## Installing on macOS -{: #installing-on-macos} - -### Homebrew - - brew install asciinema - -### MacPorts - - sudo port selfupdate && sudo port install asciinema - -### Nix - - nix-env -i asciinema - -## Installing on FreeBSD -{: #installing-on-freebsd} - -### Ports - - cd /usr/ports/textproc/py-asciinema && make install - -### Packages - - pkg install py39-asciinema - -## Installing on OpenBSD -{: #installing-on-openbsd} - - pkg_add asciinema - -## Running in a container -{: #running-in-a-container} - -asciinema Docker image is based on [Ubuntu -22.04](https://releases.ubuntu.com/22.04/) and has the latest version of -asciinema recorder pre-installed. - -```sh -docker pull ghcr.io/asciinema/asciinema -``` - -When running it don't forget to allocate a pseudo-TTY (`-t`), keep STDIN open -(`-i`) and mount config directory volume (`-v`): - -```sh -docker run --rm -it -v "${HOME}/.config/asciinema:/root/.config/asciinema" ghcr.io/asciinema/asciinema rec -``` - -Container's entrypoint is set to `/usr/local/bin/asciinema` so you can run the -container with any arguments you would normally pass to `asciinema` binary (see -Usage section for commands and options). - -There's not much software installed in this image though. In most cases you may -want to install extra programs before recording. One option is to derive new -image from this one (start your custom Dockerfile with `FROM -ghcr.io/asciinema/asciinema`). Another option is to start the container with -`/bin/bash` as the entrypoint, install extra packages and manually start -`asciinema rec`: - -```console -docker run --rm -it -v "${HOME}/.config/asciinema:/root/.config/asciinema" --entrypoint=/bin/bash ghcr.io/asciinema/asciinema rec -root@6689517d99a1:~# apt-get install foobar -root@6689517d99a1:~# asciinema rec -``` - -It is also possible to run the docker container as a non-root user, which has -security benefits. You can specify a user and group id at runtime to give the -application permission similar to the calling user on your host. - -```sh -docker run --rm -it \ - --env=ASCIINEMA_CONFIG_HOME="/run/user/$(id -u)/.config/asciinema" \ - --user="$(id -u):$(id -g)" \ - --volume="${HOME}/.config/asciinema:/run/user/$(id -u)/.config/asciinema:rw" \ - --volume="${PWD}:/data:rw" \ - --workdir='/data' \ - ghcr.io/asciinema/asciinema rec -``` - -## Running from source -{: #running-from-source} - -If none of the above works for you (or you want to help with development) just -clone the repo and run latest version of asciinema straight from the main -branch: - - git clone https://github.com/asciinema/asciinema.git - cd asciinema - git checkout main - python3 -m asciinema --version diff --git a/lib/asciinema_web/templates/doc/quick_install.html.eex b/lib/asciinema_web/templates/doc/quick_install.html.eex deleted file mode 100644 index fd85fd083..000000000 --- a/lib/asciinema_web/templates/doc/quick_install.html.eex +++ /dev/null @@ -1,9 +0,0 @@ -- Install asciinema with: -
- -brew install asciinema
-
-- See other installation options. -
diff --git a/lib/asciinema_web/templates/doc/topic_link.html.eex b/lib/asciinema_web/templates/doc/topic_link.html.eex deleted file mode 100644 index 379ce89fe..000000000 --- a/lib/asciinema_web/templates/doc/topic_link.html.eex +++ /dev/null @@ -1 +0,0 @@ -