Add circle-ci API call
This commit is contained in:
parent
b19b0d4e39
commit
0568fe9282
1 changed files with 30 additions and 20 deletions
|
@ -1,18 +1,18 @@
|
||||||
import {join} from "path";
|
import { join } from "path";
|
||||||
import {app, BrowserWindow as bw, ipcMain, ShareMenu, shell} from "electron";
|
import { app, BrowserWindow as bw, ipcMain, ShareMenu, shell } from "electron";
|
||||||
import * as windowStateKeeper from "electron-window-state";
|
import * as windowStateKeeper from "electron-window-state";
|
||||||
import * as express from "express";
|
import * as express from "express";
|
||||||
import * as getPort from "get-port";
|
import * as getPort from "get-port";
|
||||||
import {search} from "youtube-search-without-api-key";
|
import { search } from "youtube-search-without-api-key";
|
||||||
import {existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync} from "fs";
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "fs";
|
||||||
import {Stream} from "stream";
|
import { Stream } from "stream";
|
||||||
import {networkInterfaces} from "os";
|
import { networkInterfaces } from "os";
|
||||||
import * as mm from 'music-metadata';
|
import * as mm from 'music-metadata';
|
||||||
import fetch from 'electron-fetch'
|
import fetch from 'electron-fetch'
|
||||||
import {wsapi} from "./wsapi";
|
import { wsapi } from "./wsapi";
|
||||||
import {jsonc} from "jsonc";
|
import { jsonc } from "jsonc";
|
||||||
import {AppImageUpdater, NsisUpdater} from "electron-updater";
|
import { AppImageUpdater, NsisUpdater } from "electron-updater";
|
||||||
import {utils} from './utils';
|
import { utils } from './utils';
|
||||||
|
|
||||||
|
|
||||||
export class BrowserWindow {
|
export class BrowserWindow {
|
||||||
|
@ -93,7 +93,7 @@ export class BrowserWindow {
|
||||||
show: false,
|
show: false,
|
||||||
backgroundColor: "#1E1E1E",
|
backgroundColor: "#1E1E1E",
|
||||||
titleBarStyle: 'hidden',
|
titleBarStyle: 'hidden',
|
||||||
trafficLightPosition: {x: 15, y: 20},
|
trafficLightPosition: { x: 15, y: 20 },
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
sandbox: true,
|
sandbox: true,
|
||||||
|
@ -111,7 +111,7 @@ export class BrowserWindow {
|
||||||
* Creates the browser window
|
* Creates the browser window
|
||||||
*/
|
*/
|
||||||
async createWindow(): Promise<Electron.BrowserWindow> {
|
async createWindow(): Promise<Electron.BrowserWindow> {
|
||||||
this.clientPort = await getPort({port: 9000});
|
this.clientPort = await getPort({ port: 9000 });
|
||||||
BrowserWindow.verifyFiles();
|
BrowserWindow.verifyFiles();
|
||||||
|
|
||||||
// Load the previous state with fallback to defaults
|
// Load the previous state with fallback to defaults
|
||||||
|
@ -278,7 +278,7 @@ export class BrowserWindow {
|
||||||
remote.use(express.static(join(utils.getPath('srcPath'), "./web-remote/")))
|
remote.use(express.static(join(utils.getPath('srcPath'), "./web-remote/")))
|
||||||
remote.set("views", join(utils.getPath('srcPath'), "./web-remote/views"));
|
remote.set("views", join(utils.getPath('srcPath'), "./web-remote/views"));
|
||||||
remote.set("view engine", "ejs");
|
remote.set("view engine", "ejs");
|
||||||
getPort({port: 6942}).then((port) => {
|
getPort({ port: 6942 }).then((port) => {
|
||||||
this.remotePort = port;
|
this.remotePort = port;
|
||||||
// Start Remote Discovery
|
// Start Remote Discovery
|
||||||
this.broadcastRemote()
|
this.broadcastRemote()
|
||||||
|
@ -331,7 +331,7 @@ export class BrowserWindow {
|
||||||
if (itspod != null)
|
if (itspod != null)
|
||||||
details.requestHeaders["Cookie"] = `itspod=${itspod}`;
|
details.requestHeaders["Cookie"] = `itspod=${itspod}`;
|
||||||
}
|
}
|
||||||
callback({requestHeaders: details.requestHeaders});
|
callback({ requestHeaders: details.requestHeaders });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ export class BrowserWindow {
|
||||||
})
|
})
|
||||||
//Fullscreen
|
//Fullscreen
|
||||||
ipcMain.on('detachDT', (_event, _) => {
|
ipcMain.on('detachDT', (_event, _) => {
|
||||||
BrowserWindow.win.webContents.openDevTools({mode: 'detach'});
|
BrowserWindow.win.webContents.openDevTools({ mode: 'detach' });
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -559,11 +559,21 @@ export class BrowserWindow {
|
||||||
console.log('sc', SoundCheckTag)
|
console.log('sc', SoundCheckTag)
|
||||||
BrowserWindow.win.webContents.send('SoundCheckTag', SoundCheckTag)
|
BrowserWindow.win.webContents.send('SoundCheckTag', SoundCheckTag)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('check-for-update', async (_event) => {
|
ipcMain.on('check-for-update', async (_event) => {
|
||||||
|
const branch = utils.getStoreValue('general.update_branch')
|
||||||
|
let latestbranch = await fetch(`https://circleci.com/api/v1.1/project/gh/ciderapp/Cider/latest/artifacts?branch=${branch}&filter=successful`)
|
||||||
|
if (latestbranch.status != 200) {
|
||||||
|
console.log(`Error fetching latest artifact from the **${branch}** branch`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let latestbranchjson = await latestbranch.json()
|
||||||
|
console.log('Artifact - ', latestbranchjson[0].url)
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
provider: 'generic',
|
provider: 'generic',
|
||||||
url: 'https://43-429851205-gh.circle-artifacts.com/0/%7E/Cider/dist/artifacts' //Base URL
|
url: 'https://43-429851205-gh.circle-artifacts.com/0/%7E/Cider/dist/artifacts' //Base URL
|
||||||
|
@ -650,10 +660,10 @@ export class BrowserWindow {
|
||||||
// Set window Handler
|
// Set window Handler
|
||||||
BrowserWindow.win.webContents.setWindowOpenHandler((x: any) => {
|
BrowserWindow.win.webContents.setWindowOpenHandler((x: any) => {
|
||||||
if (x.url.includes("apple") || x.url.includes("localhost")) {
|
if (x.url.includes("apple") || x.url.includes("localhost")) {
|
||||||
return {action: "allow"};
|
return { action: "allow" };
|
||||||
}
|
}
|
||||||
shell.openExternal(x.url).catch(console.error);
|
shell.openExternal(x.url).catch(console.error);
|
||||||
return {action: "deny"};
|
return { action: "deny" };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,7 +712,7 @@ export class BrowserWindow {
|
||||||
"CtlN": "Cider",
|
"CtlN": "Cider",
|
||||||
"iV": "196623"
|
"iV": "196623"
|
||||||
};
|
};
|
||||||
let server2 = mdns.createAdvertisement(x, `${await getPort({port: 3839})}`, {
|
let server2 = mdns.createAdvertisement(x, `${await getPort({ port: 3839 })}`, {
|
||||||
name: encoded,
|
name: encoded,
|
||||||
txt: txt_record
|
txt: txt_record
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue