aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yml33
-rw-r--r--index.js38
-rw-r--r--package.json14
3 files changed, 21 insertions, 64 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
deleted file mode 100644
index b61160f..0000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-# This is a basic workflow to help you get started with Actions
-
-name: CI
-
-# Controls when the workflow will run
-on: push
-jobs:
- release:
- runs-on: ${{ matrix.os }}
-
- strategy:
- matrix:
- os: [macos-latest, ubuntu-latest, windows-latest]
-
- steps:
- - name: Check out Git repository
- uses: actions/checkout@v1
-
- - name: Install Node.js, NPM and Yarn
- uses: actions/setup-node@v1
- with:
- node-version: 16
-
- - name: Build/release Electron app
- uses: samuelmeuli/action-electron-builder@v1
- with:
- # GitHub token, automatically provided to the action
- # (No need to define this secret in the repo settings)
- github_token: ${{ secrets.github_token }}
-
- # If the commit is tagged with a version (e.g. "v1.0.0"),
- # release the app after building
- release: ${{ startsWith(github.ref, 'refs/tags/v') }}
diff --git a/index.js b/index.js
index dbfbc7f..dd65abe 100644
--- a/index.js
+++ b/index.js
@@ -1,45 +1,33 @@
const { app, BrowserWindow, session } = require('electron')
+const userAgent = "Mozilla/5.0 (Linux; Tizen 2.3) AppleWebKit/538.1 (KHTML, like Gecko)Version/2.3 TV Safari/538.1";
+const URL = "https://youtube.com/tv"
+
function createWindow() {
const win = new BrowserWindow({
- width: 800,
- height: 600,
fullscreen: true,
autoHideMenuBar: true
})
- win.loadURL('https://youtube.com/tv');
+ win.loadURL(URL);
+ console.log("Loading " + URL)
}
function fetchCookie(){
+ console.log("Fetching cookies...")
session.defaultSession.cookies.get({
- url: 'https://youtube.com/tv'
- });
-}
-
-function cookieDump(cookies) {
- var buffer = '['
- for (let cookie of cookies) {
- console.log(cookie)
- buffer += JSON.stringify(cookie)
- buffer += ","
- }
- buffer = buffer.slice(0, -1) + "]"
- fs.writeFile('cookies.json', buffer, function (err) {
- if (err) return console.log(err);
- console.log('Wrote cookies to file');
+ url: URL
});
}
-
app.whenReady().then(() => {
console.log("Started YouTube TV Client 2.0");
createWindow();
-
fetchCookie();
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
- details.requestHeaders['User-Agent'] = 'Mozilla/5.0 (Linux; Tizen 2.3) AppleWebKit/538.1 (KHTML, like Gecko)Version/2.3 TV Safari/538.1';
+ details.requestHeaders['User-Agent'] = userAgent;
callback({ cancel: false, requestHeaders: details.requestHeaders });
});
+ console.log("User Agent has been set to \"" + userAgent + "\"")
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
@@ -50,12 +38,4 @@ app.whenReady().then(() => {
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit();
- fetchCookie()
- .then((cookies) => {
- cookieDump(cookies);
- console.log("Wrote Cookies");
- }).catch((error) => {
- console.log(error);
- });
-
}); \ No newline at end of file
diff --git a/package.json b/package.json
index a99cc43..cb6ba1a 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"license": "GPL-3.0",
"scripts": {
"start": "electron .",
- "build": "electron-builder --linux --win=portable --mac=zip"
+ "build": "electron-builder -lwm"
},
"devDependencies": {
"electron": "^13.1.9",
@@ -15,6 +15,16 @@
"build": {
"appId": "me.alee14.ytvclient",
"productName": "YouTube TV Client",
- "copyright": "© Copyright 2017-2021, ${author}"
+ "copyright": "© Copyright 2017-2021, Andrew Lee",
+ "linux": {
+ "target": "default",
+ "category": "Video"
+ },
+ "win": {
+ "target": "portable"
+ },
+ "mac": {
+ "target": "zip"
+ }
}
}