Skip to content

Commit

Permalink
Automated error tracking!
Browse files Browse the repository at this point in the history
  • Loading branch information
ironman5366 committed Apr 25, 2019
1 parent ea04dce commit ffc20f9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ <h1>Upcoming</h1>
let yourAudio = document.getElementById('stream'),
ctrl = document.getElementById('audioControl');
function do_playpause(){
let visitor = require('electron').remote.getCurrentWindow().visitor;

visitor.event("Music", method).send();

// Update the Button
var pause = ctrl.innerHTML === pause_button;
ctrl.innerHTML = pause ? play_button : pause_button;
Expand Down
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
const { app, BrowserWindow, globalShortcut } = require('electron');
const fs = require('fs');
var ua = require('universal-analytics');
const tracking_id = "UA-67885845-4";
var visitor = ua(tracking_id);
const { init } = require('@sentry/electron');
init({
dsn: 'https://[email protected]/1446827',
enableNative: false,
});

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win;
const krlx_url = "http://live.krlx.org/data.php";

function createWindow () {

Expand All @@ -13,7 +20,7 @@ function createWindow () {

// and load the index.html of the app.
win.loadFile('index.html');

win.visitor = visitor;
// Register media shortcuts
globalShortcut.register("MediaPlayPause",
function(){
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "krlxdesktop",
"version": "1.0.1",
"version": "1.0.2",
"description": "A desktop player for KRLX",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -40,13 +40,14 @@
]
},
"dependencies": {
"@sentry/electron": "^0.17.1",
"bootstrap": "^4.3.1",
"bootswatch": "^4.3.1",
"jquery": "^3.4.0",
"js-base64": "^2.5.1",
"moment": "^2.24.0",
"popper": "^1.0.1",
"popper.js": "^1.15.0",
"universal-analytics": "^0.4.20",
"yarn": "^1.15.2"
},
"postinstall": "electron-builder install-app-deps"
Expand Down
10 changes: 9 additions & 1 deletion page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ const Base64 = require('./node_modules/js-base64').Base64;
const fs = require('fs');
const moment = require('./assets/moment.min.js');
const spotify_api = require('./spotify_api.json');
const { init } = require('@sentry/electron');
let visitor = remote.getCurrentWindow().visitor;

visitor.screenview("Home Screen", "KRLX Desktop", remote.app.getVersion()).send();

init({
dsn: 'https://[email protected]/1446827',
enableNative: false,
});
// The RegEx to resolve student images from the directory
const DIR_REG = new RegExp('(<div class="email"><span class="icon">' +
'\\n{0,1}<\\/span>(\\w+)&nbsp;)|<span class="icon"><\\/span><a href="mailto:(\\w+)@carleton.edu">');
Expand Down Expand Up @@ -321,7 +330,6 @@ function check_updates(){
success: function(data){
console.log("Got update data");
console.log(data);
console.log(shell);
let curr_version = remote.app.getVersion();
let remote_version = data.updates.version;
let update_url = data.updates.update;
Expand Down
5 changes: 5 additions & 0 deletions schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,22 @@ <h1>Schedule</h1>
&copy <script>document.write(new Date().getFullYear())</script>
</div>
<script>
let visitor = require('electron').remote.getCurrentWindow().visitor;
let app_version = require('electron').remote.app.getVersion();
visitor.screenview("Schedule", "KRLX Desktop", app_version).send();
let play_button = '<img class="img-fluid" src="assets/play.svg" width="50" height="50">';
let pause_button = '<img class="img-fluid" src="assets/pause.svg" width="50" height="50">'
let yourAudio = document.getElementById('stream'),
ctrl = document.getElementById('audioControl');
function do_playpause(){

// Update the Button
var pause = ctrl.innerHTML === pause_button;
ctrl.innerHTML = pause ? play_button : pause_button;

// Update the Audio
var method = pause ? 'pause': 'play';
visitor.event("Music", method).send();
yourAudio[method]();

// Prevent Default Action
Expand Down

0 comments on commit ffc20f9

Please sign in to comment.