<commit_before>/* eslint-env browser */
'use strict';

// ! Renderer Process Side Script
// This script will be invoked by `./after.js` with `require` through `contents.executeJavaScript`.

const path = require('path');

const electron = require('electron');
const {remote, webFrame} = electron;

const loaderConfig = remote.require(path.join(__dirname, 'loaderconfig.js')).acquire();


console.info('::: loaded', __filename);


// set window.discordLoader
window.discordLoader = {
    loaderConfig,
};


// assume custom protocol as secure
// note: custom protocols are registered in `./before.js`
[
    'l-data',
].forEach(scheme => {
    webFrame.registerURLSchemeAsSecure(scheme);
    //webFrame.registerURLSchemeAsBypassingCSP(scheme);
});


// inject user stylesheet
function injectUserFiles() {
    function injectStylesheet(file) {
        const head = document.getElementsByTagName('head')[0];
        let link = document.createElement('link');
        link.rel = 'stylesheet';
        link.href = file;<commit_msg>Unwrap renderer process side loaderConfig from ipc getter / setter<commit_after>/* eslint-env browser */
'use strict';

// ! Renderer Process Side Script
// This script will be invoked by `./after.js` with `require` through `contents.executeJavaScript`.

const path = require('path');

const electron = require('electron');
const {remote, webFrame} = electron;

// To unwrap ipc getter / setter, calls `Object.assign` and create new object.
const loaderConfig = Object.assign({}, remote.require(path.join(__dirname, 'loaderconfig.js')).acquire());


console.info('::: loaded', __filename);


// set window.discordLoader
window.discordLoader = {
    loaderConfig,
};


// assume custom protocol as secure
// note: custom protocols are registered in `./before.js`
[
    'l-data',
].forEach(scheme => {
    webFrame.registerURLSchemeAsSecure(scheme);
    //webFrame.registerURLSchemeAsBypassingCSP(scheme);
});


// inject user stylesheet
function injectUserFiles() {
    function injectStylesheet(file) {
        const head = document.getElementsByTagName('head')[0];
        let link = document.createElement('link');
        link.rel = 'stylesheet';
        link.href = file;
{'fraction_non_alphanumeric': 0.1377899045020464, 'fraction_numerical': 0.0009095043201455207, 'mean_word_length': 4.057471264367816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '6182211', 'n_tokens_mistral': 637, 'n_tokens_neox': 631, 'n_words': 167}