Skip to content

Commit

Permalink
Merge branch 'mv3' into mv3-ltl
Browse files Browse the repository at this point in the history
  • Loading branch information
KentoNishi committed Dec 23, 2024
2 parents 97f80c6 + df97569 commit c2ed19a
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 31 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'

- name: Install modules
run: yarn

- name: Build
run: yarn build
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/main.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
name: Latest Release Build

on:
release:
types:
- published

jobs:
build:
env:
ADDON_ID: "{14a15c41-13f4-498e-986c-7f00435c4d00}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: c-hive/gha-yarn-cache@v1
- uses: actions/setup-node@v3
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 16
node-version: '22'
cache: 'yarn'

- name: Install modules
run: yarn

- name: Build Chrome
run: |
VERSION=$(echo -n "${{ github.ref }}" | sed 's/[refs\/tagv]//g' | sed 's/-.*//') yarn build:chrome
# Extract version number from the tag
VERSION=$(echo -n "${{ github.ref }}" | sed 's/[refs\/tagv]//g' | sed 's/-.*//')
yarn build:chrome
yarn package
- name: Upload Chrome package to release
uses: svenstaro/upload-release-action@v2
with:
Expand All @@ -30,10 +38,14 @@ jobs:
asset_name: HyperChat-Chrome.zip
tag: ${{ github.ref }}
overwrite: true

- name: Build Firefox
run: |
VERSION=$(echo -n "${{ github.ref }}" | sed 's/[refs\/tagv]//g' | sed 's/-.*//') yarn build:firefox
# Extract version number from the tag
VERSION=$(echo -n "${{ github.ref }}" | sed 's/[refs\/tagv]//g' | sed 's/-.*//')
yarn build:firefox
yarn package
- name: Upload Firefox package to release
uses: svenstaro/upload-release-action@v2
with:
Expand Down
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
node = "22"
12 changes: 11 additions & 1 deletion src/components/ChatSummary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@
let dismissed = false;
let shorten = false;
let autoHideTimeout: NodeJS.Timeout | null = null;
const classes = 'rounded inline-flex flex-col overflow-visible ' +
'bg-secondary-900 p-2 w-full text-white z-10 shadow';
const onShorten = () => { shorten = !shorten; };
const onShorten = () => {
shorten = !shorten;
if (autoHideTimeout) {
clearTimeout(autoHideTimeout);
autoHideTimeout = null;
}
};
$: if (summary) {
dismissed = false;
shorten = false;
if (summary.showtime) {
autoHideTimeout = setTimeout(() => { shorten = true; }, summary.showtime);
}
}
const dispatch = createEventDispatcher();
Expand Down
9 changes: 1 addition & 8 deletions src/scripts/chat-injector.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HcButton from '../components/HyperchatButton.svelte';
import { getFrameInfoAsync, isValidFrameInfo, frameIsReplay, checkInjected } from '../ts/chat-utils';
import { isLiveTL, isAndroid } from '../ts/chat-constants';
import { isLiveTL } from '../ts/chat-constants';
import { hcEnabled, autoLiveChat } from '../ts/storage';
import {
initInterceptor,
Expand Down Expand Up @@ -150,13 +150,6 @@ const chatLoaded = async (): Promise<void> => {
}
ytcTicker.remove();

// Hide input panel on android
if (isAndroid) {
const inputPanel = document.querySelector('#input-panel');
if (!inputPanel) return;
(inputPanel as HTMLElement).style.display = 'none';
}

if (await autoLiveChat.get()) {
const live = document.querySelector<HTMLElement>('tp-yt-paper-listbox#menu > :nth-child(2)');
if (!live) {
Expand Down
13 changes: 1 addition & 12 deletions src/ts/chat-constants.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
export const isLiveTL = false;
export const isAndroid = false;
// DO NOT EDIT THE ABOVE LINE. It is updated by webpack.

export const enum Browser {
FIREFOX,
CHROME,
SAFARI,
ANDROID
SAFARI
}

export const getBrowser = (): Browser => {
if (navigator.userAgent.includes('Firefox')) {
return Browser.FIREFOX;
}
let w: any;
try {
w = window;
} catch {
w = self;
}
if (isAndroid || w.chrome == null) {
return Browser.ANDROID;
}
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
return Browser.SAFARI;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ts/chat-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const parseChatSummary = (renderer: Ytc.AddChatItem, isEphemeral: boolean, banne
message: splitRuns[2],
},
id: baseRenderer.liveChatSummaryId,
showtime: isEphemeral ? (bannerTimeoutMs / 1000) : 0,
showtime: isEphemeral ? bannerTimeoutMs : 0,
};
return item;
}
Expand Down

0 comments on commit c2ed19a

Please sign in to comment.