Skip to content

Commit eee7bdb

Browse files
committed
Fix twitch render in production
1 parent 1ebddcf commit eee7bdb

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This is a tool built in React and Electron to help you clip VODs of tournaments automatically! It's a work in progress, so please be patient and expect some bugs ><. If you run into any issues or have any suggestions, please make an issue [here](https://github.com/willie-yao/tournament-vod-clipper/issues) so I can fix it ASAP!
44

55
## Main Features
6-
- Automatically clips Twitch or YouTube VODs of matches from a start.gg bracket
6+
- Automatically clips Twitch VODs of matches from a start.gg bracket
77
- Clips and downloads matches in parallel
88
- Upload VODs to YouTube automatically
99

@@ -34,9 +34,8 @@ This tool clips VODs automatically by retrieving timestamps of when matches are
3434
- Once you have your token, paste it into the `Start.GG API Key` field in the tool
3535
- Next, you need to enter the Start.GG event slug. You can find this in the URL of the event page. For example, the slug for the following event is `microspacing-69`:
3636
- tournament/microspacing-69/event/singles-de
37-
- Then, enter the VOD url for the stream in the `VOD Link` field. This can be a Twitch or YouTube link. For example:
38-
- Twitch: https://www.twitch.tv/videos/123456789
39-
- YouTube: https://www.youtube.com/watch?v=123456789
37+
- Then, enter the VOD url for the stream in the `VOD Link` field. This can only be a Twitch link at the moment. For example:
38+
- https://www.twitch.tv/videos/123456789
4039
- To retrieve only the streamed sets, enter the station number assigned to the stream setup in the `Stream Station Number` field
4140
- Finally, click the `Retrieve Sets` button. This will take you to a new page.
4241

@@ -47,7 +46,7 @@ This tool clips VODs automatically by retrieving timestamps of when matches are
4746

4847
### Uploading VODs to YouTube
4948
- Once the VODs are downloaded, you can navigate to the upload page by clicking the `Upload` button.
50-
- You will need to enter your YouTube email, recovery email (if applicable), and password.
49+
- You will need to login to your YouTube account. Click the `Login` button and follow the instructions.
5150
- Next, select the tournament you want to upload VODs from using the `VOD Folder` box.
5251
- Finally, click the `Upload` button. You should see the VODs being processed on your YouTube account!
5352

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@
208208
"webpack-merge": "^5.8.0"
209209
},
210210
"build": {
211-
"productName": "ElectronReact",
212-
"appId": "org.erb.ElectronReact",
211+
"productName": "Tournament VOD Clipper",
212+
"appId": "org.erb.TournamentVODClipper",
213213
"asar": false,
214214
"asarUnpack": "**\\*.{node,dll}",
215215
"files": [

src/main/main.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* `./src/main.js` using webpack. This gives us some performance wins.
1010
*/
1111
import path from 'path';
12-
import { app, BrowserWindow, shell, ipcMain, safeStorage } from 'electron';
12+
import { app, BrowserWindow, shell, ipcMain, safeStorage, session } from 'electron';
1313
import { autoUpdater } from 'electron-updater';
1414
import log from 'electron-log';
1515
import MenuBuilder from './menu';
@@ -326,5 +326,26 @@ app
326326
// dock icon is clicked and there are no other windows open.
327327
if (mainWindow === null) createWindow();
328328
});
329+
// works for dumb iFrames
330+
session.defaultSession.webRequest.onHeadersReceived({
331+
urls: [
332+
'https://www.twitch.tv/*',
333+
'https://player.twitch.tv/*',
334+
'https://embed.twitch.tv/*'
335+
]
336+
}, (details, cb) => {
337+
var responseHeaders = details.responseHeaders;
338+
339+
console.log('headers', details.url, responseHeaders);
340+
341+
if (responseHeaders) {
342+
delete responseHeaders['Content-Security-Policy'];
343+
}
344+
345+
cb({
346+
cancel: false,
347+
responseHeaders
348+
});
349+
});
329350
})
330351
.catch(console.log);

0 commit comments

Comments
 (0)