Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Jun 27, 2024
2 parents edbfb9a + b5aa632 commit 24b5040
Show file tree
Hide file tree
Showing 65 changed files with 789 additions and 390 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ sponsor](https://docs.asciinema.org/donations/#corporate-sponsorship).
asciinema is sponsored by:

- [Brightbox](https://www.brightbox.com/)
- [DataDog](https://datadoghq.com/)

## Consulting

Expand Down
2 changes: 1 addition & 1 deletion assets/css/_recording_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ div.asciicast-card {
width: 20px;
height: 20px;

img {
img, svg {
width: 100%;
height: 100%;
border-radius: 2px;
Expand Down
23 changes: 21 additions & 2 deletions assets/css/_recording_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,24 @@
}
}

.sorting {
margin-top: 2rem;
.heading {
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin: 2rem 0 1rem 0;

h2 {
flex-grow: 1;
margin-top: 0;
}
}

.toggles {
display: flex;
gap: 1rem;
}

.filtering, .sorting {
span {
margin-right: 0.5rem;
font-size: 0.875rem;
Expand All @@ -22,6 +37,10 @@
a {
border-color: #d3d9df;
}

.btn-group .active {
font-weight: 600;
}
}

.pagination {
Expand Down
8 changes: 4 additions & 4 deletions assets/css/iframe.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
@import "./fonts/source_sans_pro.css";
@import "./fonts/fira-code-nerd-font.css";
@import "./fonts/jetbrains-mono-nerd-font.css";
@import "~asciinema-player/dist/bundle/asciinema-player.css";
@import "./fonts/powerline-symbols.css";

body.iframe {
color: #333;
background-color: transparent;
padding: 0;
margin: 0;
font-family: sans-serif;

.powered {
margin: 8px 0 0 0;
text-align: right;
font-size: 12px;
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;

a {
color: inherit;
font-weight: 600;
color: #06989a;
text-decoration: none;

&:hover {
Expand Down
8 changes: 4 additions & 4 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"asciinema-player": "3.7.2-rc.3",
"asciinema-player": "3.8.0",
"babel-loader": "^8.3.0",
"bootstrap": "^4.5.0",
"copy-webpack-plugin": "^11.0.0",
Expand Down
35 changes: 26 additions & 9 deletions assets/static/js/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
container.style.float = 'none';
container.style.overflow = 'hidden';
container.style.padding = 0;
container.style.margin = '20px 0';
container.style.margin = '1.5em 0';
container.style.colorScheme = 'light dark';

insertAfter(script, container);

Expand All @@ -77,20 +78,36 @@
iframe.style.width = "100%";
iframe.style.float = "none";
iframe.style.visibility = "hidden";
iframe.onload = function() { this.style.visibility = 'visible' };
iframe.title = "Terminal session recording"

function syncTextStyle() {
const style = window.getComputedStyle(container);
const color = style.getPropertyValue("color");
const fontFamily = style.getPropertyValue("font-family");
const fontSize = style.getPropertyValue("font-size");
iframe.contentWindow.postMessage({ type: 'textStyle', payload: { color, fontFamily, fontSize } }, apiHost);
}

iframe.onload = function() {
syncTextStyle();
setTimeout(syncTextStyle, 1000);
this.style.visibility = 'visible'

if (window.matchMedia) {
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', syncTextStyle);
}
};

container.appendChild(iframe);

function receiveSize(e) {
const name = e.data[0];
const data = e.data[1];
window.addEventListener("message", (e) => {
if (e.origin !== apiHost || e.source !== iframe.contentWindow) return;

if (e.origin === apiHost && e.source === iframe.contentWindow && name === 'resize') {
iframe.style.height = '' + data.height + 'px';
if (e.data.type === 'bodySize') {
iframe.style.height = '' + e.data.payload.height + 'px';
}
}
}, false);

window.addEventListener("message", receiveSize, false);
script.dataset.initialized = '1';
}

Expand Down
6 changes: 4 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,19 @@ config :sentry,
tags: %{env: config_env()},
in_app_module_allow_list: [Asciinema]

config :asciinema, :file_store, Asciinema.FileStore.Local
config :asciinema, Asciinema.FileStore, adapter: Asciinema.FileStore.Local
config :asciinema, Asciinema.FileStore.Local, path: "uploads/"

config :asciinema, Asciinema.FileCache, path: "cache/"

config :asciinema, :png_generator, Asciinema.PngGenerator.Rsvg
config :asciinema, Asciinema.PngGenerator, adapter: Asciinema.PngGenerator.Rsvg

config :asciinema, Asciinema.PngGenerator.Rsvg,
pool_size: 2,
font_family: "monospace"

config :asciinema, AsciinemaWeb.DefaultAvatar, adapter: AsciinemaWeb.DefaultAvatar.Identicon

config :asciinema, Oban,
repo: Asciinema.Repo,
queues: [default: 10, emails: 10, upgrades: 1],
Expand Down
15 changes: 13 additions & 2 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ if config_env() in [:prod, :dev] do
path: "uploads/",
proxy: !!env.("S3_PROXY_ENABLED")

config :asciinema, :file_store, Asciinema.FileStore.Cached
config :asciinema, Asciinema.FileStore, adapter: Asciinema.FileStore.Cached

config :asciinema, Asciinema.FileStore.Cached,
remote_store: Asciinema.FileStore.S3,
Expand Down Expand Up @@ -209,7 +209,18 @@ if config_env() in [:prod, :dev] do
end

if env.("SIGN_UP_DISABLED") in ["1", "true"] do
config :asciinema, :sign_up_enabled?, false
config :asciinema, Asciinema.Accounts, sign_up_enabled?: false
end

case env.("DEFAULT_AVATAR") do
"identicon" ->
config :asciinema, AsciinemaWeb.DefaultAvatar, adapter: AsciinemaWeb.DefaultAvatar.Identicon

"gravatar" ->
config :asciinema, AsciinemaWeb.DefaultAvatar, adapter: AsciinemaWeb.DefaultAvatar.Gravatar

nil ->
:ok
end

if dsn = env.("SENTRY_DSN") do
Expand Down
2 changes: 0 additions & 2 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ config :asciinema, Asciinema.FileStore.Local, path: "uploads/test/"

config :asciinema, Asciinema.FileCache, path: "/tmp/asciinema/"

config :asciinema, :snapshot_updater, Asciinema.Recordings.SnapshotUpdater.Noop

config :asciinema, Oban, testing: :manual

config :asciinema, Asciinema.Telemetry, enabled: false
130 changes: 130 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 24b5040

Please sign in to comment.