<commit_before>/*
 * This file is part of GPaste.
 *
 * Copyright (c) 2010-2021, <NAME> <<EMAIL>>
 *
 * Based on js/misc/util.js from gnome-shell
 */

const Main = imports.ui.main;

const Gio = imports.gi.Gio;

/** */
function bypass() {
    let checker = Main.shellDBusService._senderChecker;
    if (!checker._gpasteEnabled) {
        checker._gpasteEnabled = true;
        checker._watchList.push(Gio.DBus.watch_name(Gio.BusType.SESSION,
                                                    'org.gnome.GPaste',
                                                    Gio.BusNameWatcherFlags.NONE,
                                                    (conn_, name_, owner) => checker._allowlistMap.set(name, owner),
                                                    () => checker._allowlistMap.delete(name)));
    }
}<commit_msg>add comments as to why the checkerBypass exists<commit_after>/*
 * This file is part of GPaste.
 *
 * Copyright (c) 2010-2021, <NAME> <<EMAIL>>
 *
 * Based on js/misc/util.js from gnome-shell
 */

const Main = imports.ui.main;

const Gio = imports.gi.Gio;

// Sadly, there is no other way of making global keybindings work on wayland until we get a portal for this.
// I really wish we could avoid this, and the fact that we do this defeats the whole purpose of the added security from
// gnome-shell which is... really sad.

/** */
function bypass() {
    if (!Main.shellDBusService) {
        // FIXME: if we get loaded too early, the dbus service isn't ready so we cannot hook ourselves in.
        return;
    }
    let checker = Main.shellDBusService._senderChecker;
    if (!checker._gpasteEnabled) {
        checker._gpasteEnabled = true;
        checker._watchList.push(Gio.DBus.watch_name(Gio.BusType.SESSION,
                                                    'org.gnome.GPaste',
                                                    Gio.BusNameWatcherFlags.NONE,
                                                    (conn_, name_, owner) => checker._allowlistMap.set(name, owner),
                                                    () => checker._allowlistMap.delete(name)));
    }
}
{'fraction_non_alphanumeric': 0.10424528301886793, 'fraction_numerical': 0.007547169811320755, 'mean_word_length': 1.664572864321608, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '647251', 'n_tokens_mistral': 589, 'n_tokens_neox': 563, 'n_words': 159}