Skip to content

Commit e2d56d3

Browse files
committed
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into chapters
2 parents 7895b9d + b6c1ee1 commit e2d56d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2958
-657
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ jobs:
5151
- name: Zip Artifacts
5252
run: cd ./dist ; zip -r ../builds/ChromeExtensionBeta.zip *
5353

54+
55+
# Create Safari artifacts
56+
- name: Create Safari artifacts
57+
run: npm run build:safari
58+
- uses: actions/upload-artifact@v2
59+
with:
60+
name: SafariExtension
61+
path: dist
62+
- name: Zip Artifacts
63+
run: cd ./dist ; zip -r ../builds/SafariExtension.zip *
64+
# Create Edge artifacts
65+
- name: Clear dist for Edge
66+
run: rm -rf ./dist
67+
- name: Create Edge artifacts
68+
run: npm run build:edge
69+
- uses: actions/upload-artifact@v2
70+
with:
71+
name: EdgeExtension
72+
path: dist
73+
- name: Zip Artifacts
74+
run: cd ./dist ; zip -r ../builds/EdgeExtension.zip *
75+
5476
# Upload each release asset
5577
- name: Upload ChromeExtension to release
5678
uses: Shopify/upload-to-release@master
@@ -73,6 +95,20 @@ jobs:
7395
name: FirefoxExtension.zip
7496
path: ./builds/FirefoxExtension.zip
7597
repo-token: ${{ secrets.GITHUB_TOKEN }}
98+
- name: Upload SafariExtension to release
99+
uses: Shopify/upload-to-release@master
100+
with:
101+
args: builds/SafariExtension.zip
102+
name: SafariExtension.zip
103+
path: ./builds/SafariExtension.zip
104+
repo-token: ${{ secrets.GITHUB_TOKEN }}
105+
- name: Upload EdgeExtension to release
106+
uses: Shopify/upload-to-release@master
107+
with:
108+
args: builds/EdgeExtension.zip
109+
name: EdgeExtension.zip
110+
path: ./builds/EdgeExtension.zip
111+
repo-token: ${{ secrets.GITHUB_TOKEN }}
76112

77113
# Firefox Beta
78114
- name: Create Firefox Beta artifacts
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: update invidious
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 1 * *' # check every month
6+
7+
jobs:
8+
check-list:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Download instance list
14+
run: |
15+
wget https://api.invidious.io/instances.json -O data.json
16+
- name: "Run CI"
17+
run: npm run ci:invidious
18+
19+
- name: Create pull request to update list
20+
uses: peter-evans/create-pull-request@v3
21+
with:
22+
commit-message: Update Invidious List
23+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
24+
branch: ci/update_invidious_list
25+
title: Update Invidious List
26+
body: Automated Invidious list update

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ web-ext-artifacts
66
.vscode/
77
dist/
88
tmp/
9-
.DS_Store
9+
.DS_Store
10+
ci/data.json

ci/invidiousCI.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
This file is only ran by GitHub Actions in order to populate the Invidious instances list
3+
4+
This file should not be shipped with the extension
5+
*/
6+
7+
import { writeFile, existsSync } from 'fs';
8+
import { join } from 'path';
9+
10+
// import file from https://api.invidious.io/instances.json
11+
if (!existsSync('./data.json')) {
12+
process.exit(1);
13+
}
14+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
15+
// @ts-ignore
16+
import * as data from "./data.json";
17+
18+
type instanceMap = {
19+
name: string,
20+
url: string,
21+
dailyRatios: {ratio: string, label: string }[],
22+
thirtyDayUptime: string
23+
}[]
24+
25+
// only https servers
26+
const mapped: instanceMap = data
27+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
28+
.filter((i: any) => i[1]?.type === 'https')
29+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
30+
.map((instance: any) => {
31+
return {
32+
name: instance[0],
33+
url: instance[1].uri,
34+
dailyRatios: instance[1].monitor.dailyRatios,
35+
thirtyDayUptime: instance[1]?.monitor['30dRatio'].ratio,
36+
}
37+
})
38+
39+
// reliability and sanity checks
40+
const reliableCheck = mapped
41+
.filter((instance) => {
42+
// 30d uptime >= 90%
43+
const thirtyDayUptime = Number(instance.thirtyDayUptime) >= 90
44+
// available for at least 80/90 days
45+
const dailyRatioCheck = instance.dailyRatios.filter(status => status.label !== "black")
46+
return (thirtyDayUptime && dailyRatioCheck.length >= 80)
47+
})
48+
// url includes name
49+
.filter(instance => instance.url.includes(instance.name))
50+
51+
// finally map to array
52+
const result: string[] = reliableCheck.map(instance => instance.name)
53+
writeFile(join(__dirname, "./invidiouslist.json"), JSON.stringify(result), (err) => {
54+
if (err) return console.log(err);
55+
})

ci/invidiouslist.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["yewtu.be","invidious.snopyta.org","vid.puffyan.us","invidious.kavin.rocks","invidio.xamh.de","invidious-us.kavin.rocks","inv.riverside.rocks","vid.mint.lgbt","youtube.076.ne.jp","invidious.namazso.eu"]

config.json.example

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"serverAddress": "https://sponsor.ajay.app",
33
"testingServerAddress": "https://sponsor.ajay.app/test",
44
"serverAddressComment": "This specifies the default SponsorBlock server to connect to",
5-
"categoryList": ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "filler", "music_offtopic", "chapter"],
5+
"categoryList": ["sponsor", "selfpromo", "exclusive_access", "interaction", "poi_highlight", "intro", "outro", "preview", "filler", "music_offtopic", "chapter"],
66
"categorySupport": {
7-
"sponsor": ["skip", "mute"],
8-
"selfpromo": ["skip", "mute"],
7+
"sponsor": ["skip", "mute", "full"],
8+
"selfpromo": ["skip", "mute", "full"],
9+
"exclusive_access": ["full"],
910
"interaction": ["skip", "mute"],
1011
"intro": ["skip", "mute"],
1112
"outro": ["skip", "mute"],
@@ -18,6 +19,7 @@
1819
"wikiLinks": {
1920
"sponsor": "https://wiki.sponsor.ajay.app/w/Sponsor",
2021
"selfpromo": "https://wiki.sponsor.ajay.app/w/Unpaid/Self_Promotion",
22+
"exclusive_access": "https://wiki.sponsor.ajay.app/w/Exclusive_Access",
2123
"interaction": "https://wiki.sponsor.ajay.app/w/Interaction_Reminder_(Subscribe)",
2224
"intro": "https://wiki.sponsor.ajay.app/w/Intermission/Intro_Animation",
2325
"outro": "https://wiki.sponsor.ajay.app/w/Endcards/Credits",

manifest/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "__MSG_fullName__",
33
"short_name": "SponsorBlock",
4-
"version": "3.6.2",
4+
"version": "4.0.3",
55
"default_locale": "en",
66
"description": "__MSG_Description__",
77
"homepage_url": "https://sponsor.ajay.app",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"background": {
3+
"persistent": false
4+
}
5+
}

0 commit comments

Comments
 (0)