<commit_before>import menu from "./menu.js";
import autoUpdater from "./auto-updater";
import { app, BrowserWindow, session, Menu, Tray } from "electron";
import path from "path";
import url from "url";
import pkg from "../package.json";
import { format as urlFormat } from "url";
/* eslint-disable no-console */

// app.dock && app.dock.hide();

const imagePath = path.resolve(
  require.resolve("streamplace-ui"),
  "..",
  "images"
);

// Activate the auto-updater unless we're running directly from Electron
if (path.basename(process.argv[0]) !== "Electron") {
  autoUpdater(app);
}

process.on("uncaughtException", err => {
  console.error(err);
  process.exit(1);
});

process.on("unhandledRejection", err => {
  console.error("unhandled rejection");
  console.error(err);
  process.exit(1);
});

let tray = null;
let win;
app.on("ready", () => {
  let iconImage =
    process.platform === "darwin" ? "iconTemplate.png" : "favicon.png";
  tray = new Tray(path.resolve(imagePath, iconImage));
  const contextMenu = Menu.buildFromTemplate([
    { label: `Streamplace v${pkg.version}`, enabled: false },
    { label: "Close Streamplace", role: "quit" }
  ]);
  tray.setToolTip("Streamplace");
  tray.setContextMenu(contextMenu);

  // Login window!
  let url = urlFormat({
    protocol: "file",
    slashes: true,
    pathname: require("path").join(__dirname, "entrypoint.html")
  });

  win = new BrowserWindow({
    width: 350,
    height: 450,
    title: "Streamplace",
    titleBarStyle: "hidden-inset",
    show: true
  });

  win.loadURL("http://localhost:3939");
});

// // 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 spUrl = process.env.SP_URL || "stream.place";

// function createWindow() {
//   Menu.setApplicationMenu(menu);

//   // Create the browser window.
//   win = new BrowserWindow({
//     width: 1920,
//     height: 1080,
//     title: "Streamplace",
//     titleBarStyle: "hidden-inset",
//     show: false
//   });

//   win.once("ready-to-show", () => {
//     win.show();
//   });

//   // Little old-school async method here to set all our cookies before loading the page
//   const cookies = [
//     {
//       url: `${spUrl}`,
//       name: "streamplace",
//       value: "w00t",
//       hostOnly: false,
//       expirationDate: 32503680000000 // i've been to the year 3000
//     },
//     {
//       url: `${spUrl}`,
//       name: "appMode",
//       value: "true",
//       hostOnly: false,
//       expirationDate: 32503680000000 // i've been to the year 3000
//     }
//   ];

//   const done = () => {
//     win.loadURL(spUrl);
//   };

//   const setCookie = () => {
//     if (cookies.length === 0) {
//       return done();
//     }
//     const cookie = cookies.pop();
//     win.webContents.session.cookies.set(cookie, error => {
//       if (error) {
//         console.error(error);
//         throw error;
//       }
//       setCookie();
//     });
//   };

//   // For now we're just gonna operate with no cache on load
//   win.webContents.session.clearCache(err => {
//     if (err) {
//       throw err;
//     }
//     setCookie();
//   });

//   // Open the DevTools.
//   // win.webContents.openDevTools()

//   // Emitted when the window is closed.
//   win.on("closed", () => {
//     // Dereference the window object, usually you would store windows
//     // in an array if your app supports multi windows, this is the time
//     // when you should delete the corresponding element.
//     win = null;
//   });
// }

// // This method will be called when Electron has finished
// // initialization and is ready to create browser windows.
// // Some APIs can only be used after this event occurs.
// app.on("ready", createWindow);

// // Quit when all windows are closed.
// app.on("window-all-closed", () => {
//   // On macOS it is common for applications and their menu bar
//   // to stay active until the user quits explicitly with Cmd + Q
//   if (process.platform !== "darwin") {
//     app.quit();
//   }
// });

// app.on("activate", () => {
//   // On macOS it's common to re-create a window in the app when the
//   // dock icon is clicked and there are no other windows open.
//   if (win === null) {
//     createWindow();
//   }
// });<commit_msg>revert these last two commits after merge plz<commit_after>import menu from "./menu.js";
import autoUpdater from "./auto-updater";
import { app, BrowserWindow, session, Menu, Tray } from "electron";
import path from "path";
import url from "url";
import pkg from "../package.json";
import { format as urlFormat } from "url";
/* eslint-disable no-console */

app.dock && app.dock.hide();

const imagePath = path.resolve(
  require.resolve("streamplace-ui"),
  "..",
  "images"
);

// Activate the auto-updater unless we're running directly from Electron
if (path.basename(process.argv[0]) !== "Electron") {
  autoUpdater(app);
}

process.on("uncaughtException", err => {
  console.error(err);
  process.exit(1);
});

process.on("unhandledRejection", err => {
  console.error("unhandled rejection");
  console.error(err);
  process.exit(1);
});

let tray = null;
let win;
app.on("ready", () => {
  let iconImage =
    process.platform === "darwin" ? "iconTemplate.png" : "favicon.png";
  tray = new Tray(path.resolve(imagePath, iconImage));
  const contextMenu = Menu.buildFromTemplate([
    { label: `Streamplace v${pkg.version}`, enabled: false },
    { label: "Close Streamplace", role: "quit" }
  ]);
  tray.setToolTip("Streamplace");
  tray.setContextMenu(contextMenu);

  // Login window!
  let url = urlFormat({
    protocol: "file",
    slashes: true,
    pathname: require("path").join(__dirname, "entrypoint.html")
  });

  /////// uncomment from here to have app window show up again /////////

  // win = new BrowserWindow({
  //   width: 350,
  //   height: 450,
  //   title: "Streamplace",
  //   titleBarStyle: "hidden-inset",
  //   show: true
  // });

  // win.loadURL("http://localhost:3939");
});
{'fraction_non_alphanumeric': 0.17764241027329603, 'fraction_numerical': 0.012018439249259136, 'mean_word_length': 2.6684782608695654, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '750503', 'n_tokens_mistral': 2008, 'n_tokens_neox': 1920, 'n_words': 535}