Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
1006df5
Bump vite-plugin-web-extension
ChrRubin Jul 12, 2022
f848734
Move background script to messaging.ts
ChrRubin Jul 12, 2022
00150ab
Add service worker
ChrRubin Jul 12, 2022
4431897
WIP messaging
ChrRubin Jul 12, 2022
435363a
No more code errors (Doesn't mean it works yet)
ChrRubin Jul 12, 2022
e588c55
Unconstant url params
ChrRubin Jul 12, 2022
4efd6ee
IT WORKS?!
ChrRubin Jul 12, 2022
0661847
Cleanup interceptor and injector
ChrRubin Jul 12, 2022
ff95649
Cleanup messaging.ts
ChrRubin Jul 12, 2022
9acc1c2
Merge branch 'master' into mv3
KentoNishi Sep 24, 2022
2686e03
get frame info *before* injection
KentoNishi Oct 1, 2022
efa83d4
downgrade ts because estree doesn't support it yet
KentoNishi Oct 3, 2022
4c3e018
fix error spam in cheatTimestamps
KentoNishi Oct 9, 2022
510a7b5
w-screen
KentoNishi Oct 12, 2022
fe8352d
max-w-none
KentoNishi Oct 14, 2022
8e2bb1c
bump webext stores
KentoNishi Oct 14, 2022
c98ee13
add linux note
KentoNishi Nov 1, 2022
cc72487
Bump loader-utils from 1.4.0 to 1.4.2
dependabot[bot] Nov 16, 2022
e406769
Bump decode-uri-component from 0.2.0 to 0.2.2
dependabot[bot] Dec 7, 2022
b55c402
Bump qs from 6.5.2 to 6.5.3
dependabot[bot] Dec 8, 2022
6087b92
Bump jszip from 3.7.1 to 3.10.1
dependabot[bot] Feb 2, 2023
ecfe477
use background.scripts in ff manifest
r2dev2 Feb 18, 2023
36e134e
add yarn dev:chrome, dev:firefox, modify yarn start
r2dev2 Feb 18, 2023
62218de
proxy extension to content script thru bg for ff 🧪
r2dev2 Mar 12, 2023
aa99119
yarn:build defaults to chrome now ⚙
r2dev2 Mar 12, 2023
a7eccb8
update readme with build commands 👷
r2dev2 Mar 13, 2023
899dc73
Merge pull request #115 from LiveTL/ff-mv3
r2dev2 Mar 21, 2023
3cc8b55
⬆ uwupgrade svelte-webext-stores to @livetl/...
r2dev2 Apr 9, 2023
081ad8c
🧙‍ ff mv3 needs specified addon id
r2dev2 Apr 9, 2023
4e59d0e
📔 track byte usage of chrome.storage.local
r2dev2 Apr 9, 2023
a918e98
🤫 stfu eslint
r2dev2 Apr 9, 2023
047f72c
Merge pull request #116 from LiveTL/track-usage
KentoNishi May 18, 2023
e40c9ac
Merge branch 'master' into mv3
KentoNishi May 21, 2023
71099e1
chat-metagetter for mv3
KentoNishi May 25, 2023
ed9da27
Merge branch 'master' into mv3
KentoNishi May 25, 2023
1e163cd
Merge branch 'master' into mv3
KentoNishi May 26, 2023
891b0f4
color update
KentoNishi May 26, 2023
1f68672
ytdark store
KentoNishi May 26, 2023
98e66f2
title bump
KentoNishi May 29, 2023
b3dbd00
merge from master
KentoNishi Jun 10, 2023
6025c2c
Merge branch 'master' into mv3
KentoNishi Jun 10, 2023
e72f7d9
Merge pull request #113 from LiveTL/dependabot/npm_and_yarn/jszip-3.10.1
KentoNishi Jun 15, 2023
a998fdd
Merge pull request #106 from LiveTL/dependabot/npm_and_yarn/loader-ut…
KentoNishi Jun 15, 2023
d0d17b0
Merge pull request #107 from LiveTL/dependabot/npm_and_yarn/decode-ur…
KentoNishi Jun 15, 2023
38c05c5
Bump vite from 2.9.14 to 2.9.16
dependabot[bot] Jun 15, 2023
28a5b0d
Merge pull request #118 from LiveTL/dependabot/npm_and_yarn/vite-2.9.16
KentoNishi Jun 15, 2023
e00406a
Merge pull request #108 from LiveTL/dependabot/npm_and_yarn/qs-6.5.3
KentoNishi Jun 15, 2023
1d1d8e9
Bump json5 from 1.0.1 to 1.0.2
dependabot[bot] Jun 15, 2023
243393f
Bump express from 4.17.1 to 4.17.3
dependabot[bot] Jun 15, 2023
25d2cff
Bump minimatch from 3.0.4 to 3.0.8
dependabot[bot] Jun 15, 2023
66591d4
Merge pull request #111 from LiveTL/dependabot/npm_and_yarn/json5-1.0.2
KentoNishi Jun 15, 2023
eadb636
Merge pull request #119 from LiveTL/dependabot/npm_and_yarn/minimatch…
KentoNishi Jun 15, 2023
8205ed9
Merge pull request #109 from LiveTL/dependabot/npm_and_yarn/express-4…
KentoNishi Jun 15, 2023
5a8118c
can show a 404 page in hyperchat.html
r2dev2 Jun 15, 2023
7178b1d
can mount hyperchat in 404 as a content script
r2dev2 Jul 6, 2023
3914eac
Revert "can show a 404 page in hyperchat.html"
r2dev2 Jul 6, 2023
7e80a00
use same chrome.runtime forwarding for chrome and ff
r2dev2 Jul 6, 2023
3e396f2
Bump semver from 5.7.1 to 5.7.2
dependabot[bot] Jul 11, 2023
c4e55a5
Bump word-wrap from 1.2.3 to 1.2.4
dependabot[bot] Jul 19, 2023
dd27c71
fixed scrollbar
KentoNishi Jul 21, 2023
ca22c34
inject blanker css
KentoNishi Jul 21, 2023
d6be0f3
no visual artifacts!
KentoNishi Jul 21, 2023
ebc89dc
add hyperchat=1 to 404 page query
r2dev2 Jul 22, 2023
c65ec58
Merge pull request #120 from LiveTL/mount-404
KentoNishi Jul 22, 2023
5b94a74
Merge pull request #122 from LiveTL/dependabot/npm_and_yarn/semver-5.7.2
KentoNishi Jul 23, 2023
747a290
Merge pull request #123 from LiveTL/dependabot/npm_and_yarn/word-wrap…
KentoNishi Jul 23, 2023
f8a241d
Merge branch 'master' into mv3
KentoNishi Jul 26, 2023
7d24479
Merge pull request #124 from LiveTL/master
KentoNishi Jul 28, 2023
73d41d4
upgrade vite to v3 + copy js/css to scripts/stylesheets
r2dev2 Aug 13, 2023
6053375
copy hooks
KentoNishi Aug 13, 2023
7d0d9a9
Revert "copy hooks"
r2dev2 Aug 19, 2023
9a189d5
Revert "upgrade vite to v3 + copy js/css to scripts/stylesheets"
r2dev2 Aug 19, 2023
beb6712
use terser for minifier to prevent random esbuild regex hangs
r2dev2 Aug 19, 2023
53a4d8a
mount using /embed/hyperchat_embed
KentoNishi Aug 29, 2023
acaefe9
onMount ig
KentoNishi Aug 29, 2023
7e3cd6c
ping service worker every 15 seconds
r2dev2 Sep 17, 2023
f590646
Merge pull request #125 from LiveTL/service-worker-ping
KentoNishi Sep 21, 2023
3821844
can also return undefined
KentoNishi Sep 21, 2023
dce6a96
add ping type
KentoNishi Sep 21, 2023
c6a0f6e
feat: reconnecting chat port
r2dev2 Oct 1, 2023
4dcfed2
Merge pull request #127 from LiveTL/reconnect-chat-port
KentoNishi Oct 6, 2023
a771527
Merge branch 'master' into mv3
KentoNishi Feb 26, 2024
7818bf5
remove -100
KentoNishi Mar 16, 2024
e5535fc
Merge branch 'master' into mv3
KentoNishi Mar 16, 2024
735b442
Fix broken link
thatsprettygood Mar 27, 2024
ae3e054
Fix broken link
thatsprettygood Mar 27, 2024
32ccb59
Merge pull request #137 from thatsprettygood/patch-1
r2dev2 May 7, 2024
b3d7b00
Merge branch 'master' into mv3
KentoNishi May 15, 2024
e6dcdf7
Merge branch 'master' into mv3
KentoNishi May 25, 2024
a43c83e
copy stylesheets hack
KentoNishi May 25, 2024
2ef8215
forward args for reconnecting port
KentoNishi May 25, 2024
14e28f3
on publish trigger
KentoNishi May 25, 2024
6124be6
add hc/ltl duplicate checking to 404 mounter
r2dev2 May 25, 2024
18e1a11
specify addon id in ci
r2dev2 May 26, 2024
45da26f
Merge branch 'master' into mv3
KentoNishi Jun 16, 2024
9406cc5
updated prod build readme
KentoNishi Jun 29, 2024
57be4a2
v3.0.1
KentoNishi Jul 7, 2024
5ffbcd0
strict_min_version
KentoNishi Jul 7, 2024
168305d
Merge branch 'master' into mv3
KentoNishi Jul 9, 2024
8bdadf0
allow undefined viewer name
KentoNishi Jul 9, 2024
e4e5ea5
Merge branch 'master' into mv3
KentoNishi Jul 11, 2024
c40f8cb
allow parsedJson?
KentoNishi Jul 11, 2024
3e75c33
Merge branch 'master' into mv3
KentoNishi Sep 12, 2024
1629fdc
Merge branch 'master' into mv3
KentoNishi Oct 3, 2024
c550fd0
Merge branch 'master' into mv3
KentoNishi Oct 3, 2024
97129fe
Merge branch 'master' into mv3
KentoNishi Oct 10, 2024
f54f20f
Merge branch 'master' into mv3
KentoNishi Dec 16, 2024
c2b1ca3
Merge branch 'master' into mv3
KentoNishi Dec 16, 2024
9f2563a
Merge branch 'master' into mv3
KentoNishi Dec 16, 2024
df97569
Merge branch 'master' into mv3
KentoNishi Dec 23, 2024
ebf3a67
Merge branch 'master' into mv3
KentoNishi Dec 23, 2024
d338628
Merge branch 'master' into mv3
KentoNishi Jan 1, 2025
3cc60ba
Bump postcss from 8.4.14 to 8.4.31 (#128)
dependabot[bot] Jan 1, 2025
aba3511
Merge branch 'master' into mv3
KentoNishi Jan 3, 2025
27c3a6e
Merge branch 'master' into mv3
KentoNishi Jan 12, 2025
de39751
Clean up some of the build logic (#162)
arkon Jan 12, 2025
9e4570b
Bump body-parser from 1.19.0 to 1.20.3 (#159)
dependabot[bot] Jan 12, 2025
25173ec
More build cleanup (#165)
arkon Jan 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -14,10 +18,11 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'

- name: Install modules
run: yarn
- run: |
npm install

# TODO: there's way too many errors right now
# npm run format:check

- name: Build
run: yarn build
npm run build
22 changes: 12 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Latest Release Build

on:
release:
types:
- released
- published

jobs:
build:
Expand All @@ -15,21 +16,22 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'

- name: Install modules
run: yarn
- run: |
npm install

# TODO: there's way too many errors right now
# npm run format:check

- name: Build extensions
run: |
VERSION=$(echo -n ${{ github.ref }} | sed 's/[refs\/tagv]//g') yarn build
yarn package
# Extract version number from the tag
VERSION=$(echo -n "${{ github.ref }}" | sed 's/[refs\/tagv]//g' | sed 's/-.*//')
npm run build

- name: Upload Chrome package to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/HyperChat-Chrome.zip
file: build/HyperChat-chrome.zip
asset_name: HyperChat-Chrome.zip
tag: ${{ github.ref }}
overwrite: true
Expand All @@ -38,7 +40,7 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/HyperChat-Firefox.zip
file: build/HyperChat-firefox.zip
asset_name: HyperChat-Firefox.zip
tag: ${{ github.ref }}
overwrite: true
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
.DS_Store
node_modules
build
dist
package-lock.json
.eslintcache

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Editor directories and files
.idea
Expand All @@ -22,10 +19,3 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?

# Vue Browser Extension Output
*.pem
*.pub
*.zip
artifacts
.eslintcache
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,28 @@ Open the repository and npm install:
```bash
cd hyperchat
git checkout master # switch to master for MV2 first!
yarn # install dependencies
npm install # install dependencies
```

Build or serve the extension:

```bash
yarn start # watch mode
yarn build # production mode
VERSION=x.x.x yarn build
npm run dev:chrome # devserver for Chrome extension
npm run dev:firefox # devserver for Firefox extension

npm run start:chrome # devserver + open extension in Chrome
npm run start:firefox # devserver + open extension in Firefox

VERSION=x.x.x npm run build # production mode (Chrome & Firefox)
VERSION=x.x.x npm run build:chrome # production mode (Chrome)
VERSION=x.x.x npm run build:firefox # production mode (Firefox)
```

## Building for Production

Our build script is an automated GitHub action. To simulate the build, please follow the steps outlined in the [Latest Release Build](.github/workflows/build.yml) workflow file.

Clarifications:
- `${{ github.ref }}` should evaluate to `vX.X.X`, where `X.X.X` is the version number.

The built ZIP files can be found in the `build` directory.
12 changes: 0 additions & 12 deletions README_PRODUCTION.md

This file was deleted.

66 changes: 30 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,50 @@
{
"name": "HyperChat",
"version": "69.42.0",
"version": "3.0.4",
"private": true,
"scripts": {
"build": "vite build",
"package": "node utils/package.js",
"start": "cross-env MINIFY=false vite build --watch",
"start:none": "cross-env MINIFY=false BROWSER=none vite build --watch",
"start:firefox": "cross-env MINIFY=false BROWSER=firefox vite build --watch",
"format:check": "eslint ."
"build": "npm run build:chrome && npm run build:firefox",
"build:chrome": "cross-env BROWSER=chrome vite build",
"build:firefox": "cross-env BROWSER=firefox vite build",
"dev:chrome": "cross-env MINIFY=false BROWSER=chrome vite build --watch",
"dev:firefox": "cross-env MINIFY=false BROWSER=firefox vite build --watch",
"start:chrome": "cross-env HC_AUTOLAUNCH=menace npm run dev:chrome",
"start:firefox": "cross-env HC_AUTOLAUNCH=menace npm run dev:firefox",
"format": "eslint src --fix",
"format:check": "eslint src"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.0.3",
"dependencies": {
"@livetl/svelte-webext-stores": "^0.0.14",
"@mdi/js": "^6.5.95",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.34",
"iframe-translator": "^0.3.7",
"is-dark-color": "^1.2.0",
"sha-1": "^1.0.0",
"smelte": "^1.1.8",
"svelte": "^3.49.0",
"tailwindcss": "^2.2.7"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.0.3",
"@sveltejs/vite-plugin-svelte": "1.0.0-next.34",
"@tsconfig/svelte": "^2.0.1",
"@types/chrome": "^0.0.149",
"@types/download": "8.0.1",
"@typescript-eslint/eslint-plugin": "4",
"@typescript-eslint/parser": "^4.28.5",
"@types/chrome": "^0.0.193",
"autoprefixer": "^10.3.1",
"body-parser": "1.19.0",
"body-parser": "1.20.3",
"cross-env": "^7.0.3",
"cssnano": "^5.0.7",
"download": "8.0.0",
"eslint": "7",
"eslint-config-standard-with-typescript": "^20.0.0",
"eslint-plugin-import": "2",
"eslint-plugin-node": "11",
"eslint-plugin-promise": "4",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-svelte3": "^3.2.0",
"express": "4.17.1",
"iframe-translator": "^0.3.7",
"is-dark-color": "^1.2.0",
"postcss": "^8.3.6",
"postcss": "^8.4.31",
"postcss-extend": "^1.0.5",
"postcss-import": "^14.0.2",
"postcss-input-range": "^4.0.0",
"postcss-preset-env": "^6.7.0",
"postcss-url": "^10.1.3",
"rollup-plugin-copy": "^3.4.0",
"safe-compare": "1.1.4",
"sha-1": "^1.0.0",
"smelte": "^1.1.8",
"svelte": "^3.49.0",
"svelte-check": "^2.8.0",
"svelte-preprocess": "^4.7.4",
"svelte-waypoint": "^0.1.4",
"tailwindcss": "^2.2.7",
"typescript": "^4.7.4",
"vite": "2.7.10",
"vite-plugin-web-extension": "^1.0.7"
"terser": "^5.19.2",
"typescript": "4.3.5",
"vite": "2.9.16",
"vite-plugin-web-extension": "^1.4.0",
"vite-plugin-zip-pack": "1.0.7"
}
}
73 changes: 50 additions & 23 deletions src/components/Hyperchat.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import '../stylesheets/scrollbar.css';
import { onDestroy, afterUpdate, tick } from 'svelte';
import { onDestroy, onMount, afterUpdate, tick } from 'svelte';
import { fade } from 'svelte/transition';
import dark from 'smelte/src/dark';
import WelcomeMessage from './WelcomeMessage.svelte';
Expand All @@ -14,14 +14,20 @@
import SuperchatViewDialog from './SuperchatViewDialog.svelte';
import StickyBar from './StickyBar.svelte';
import {
paramsTabId,
paramsFrameId,
paramsIsReplay,
// paramsTabId,
// paramsFrameId,
// paramsIsReplay,
Theme,
YoutubeEmojiRenderMode,
chatUserActionsItems
chatUserActionsItems,
} from '../ts/chat-constants';
import { isAllEmoji, isChatMessage, isPrivileged, responseIsAction } from '../ts/chat-utils';
import {
isAllEmoji,
isChatMessage,
isPrivileged,
responseIsAction,
useReconnect
} from '../ts/chat-utils';
import Button from 'smelte/src/components/Button';
import {
theme,
Expand All @@ -46,11 +52,15 @@
enableHighlightedMentions,
ytDark
} from '../ts/storage';
import { version } from '../manifest.json';

const welcome = { welcome: true, message: { messageId: 'welcome' } };
type Welcome = typeof welcome;

const params = new URLSearchParams(window.location.search);
const paramsTabId = params.get('tabid');
const paramsFrameId = params.get('frameid');
const paramsIsReplay = params.get('isReplay');

const CHAT_HISTORY_SIZE = 150;
const TRUNCATE_SIZE = 20;
let messageActions: (Chat.MessageAction | Welcome)[] = [];
Expand Down Expand Up @@ -86,7 +96,7 @@
$: hasBanner = pinned || redirect || (summary && $showChatSummary);
let div: HTMLElement;
let isAtBottom = true;
let truncateInterval: number;
let truncateInterval: number | undefined;
const isReplay = paramsIsReplay;
const smelteDark = dark();

Expand Down Expand Up @@ -287,15 +297,18 @@
break;
case 'registerClientResponse':
break;
case 'ping':
break;
default:
console.error('Unknown payload type', { port, response });
break;
}
};

// Doesn't work well with onMount, so onLoad will have to do
const onLoad = () => {
$lastOpenedVersion = version;
// Update: use onMount because hc now mounts in content script
const onLoad = (): (() => void) | undefined => {
$lastOpenedVersion = __VERSION__;
document.body.classList.add('overflow-hidden');

if (paramsTabId == null || paramsFrameId == null || paramsTabId.length < 1 || paramsFrameId.length < 1) {
Expand All @@ -308,21 +321,35 @@
frameId: parseInt(paramsFrameId)
};

$port = chrome.runtime.connect();
let hasRun = false;
$port = useReconnect(() => {
const port = chrome.runtime.connect({
name: JSON.stringify(frameInfo)
}) as Chat.Port;

$port?.onMessage.addListener(onPortMessage);
port.onMessage.addListener(onPortMessage);

$port?.postMessage({
type: 'registerClient',
frameInfo,
getInitialData: true
});
$port?.postMessage({
type: 'getTheme',
frameInfo
port.postMessage({
type: 'registerClient',
getInitialData: true
});

if (!hasRun) {
port.postMessage({
type: 'getTheme'
});
}

hasRun = true;

return port;
});

return () => $port?.destroy && $port?.destroy();
};

onMount(onLoad);

const onRefresh = () => {
if (isAtBottom) {
scrollToBottom();
Expand All @@ -348,7 +375,7 @@
$showProfileIcons, $showUsernames, $showTimestamps, $showUserBadges
);

const containerClass = 'h-screen w-screen text-black dark:text-white bg-white bg-ytbg-light dark:bg-ytbg-dark flex flex-col justify-between';
const containerClass = 'hyperchat-root h-screen w-screen text-black dark:text-white bg-white bg-ytbg-light dark:bg-ytbg-dark flex flex-col justify-between max-w-none';

const isSuperchat = (action: Chat.MessageAction) => (action.message.superChat || action.message.superSticker);
const isMembership = (action: Chat.MessageAction) => (action.message.membership || action.message.membershipGiftPurchase);
Expand Down Expand Up @@ -395,13 +422,13 @@
<svelte:window on:resize={() => {
scrollToBottom();
topBarResized();
}} on:load={onLoad} />
}} />

<div class={containerClass} style="font-size: 13px">
{#if $enableStickySuperchatBar}
<StickyBar />
{/if}
<div class="w-full min-h-0 flex justify-end flex-col relative">
<div class="w-screen min-h-0 flex justify-end flex-col relative">
<div bind:this={div} on:scroll={checkAtBottom} class="content overflow-y-scroll">
<div style="height: {topBarSize}px;" />
{#each messageActions as action (action.message.messageId)}
Expand Down
Loading