[gnome] Update gnome extensions
This commit is contained in:
@ -10,6 +10,7 @@ import GLib from 'gi://GLib';
|
||||
|
||||
import Config from '../config.js';
|
||||
import {setup, setupGettext} from '../utils/setup.js';
|
||||
import {MissingOpensslError} from '../utils/exceptions.js';
|
||||
|
||||
|
||||
// Promise Wrappers
|
||||
@ -62,10 +63,22 @@ const extensionFolder = GLib.path_get_dirname(serviceFolder);
|
||||
setup(extensionFolder);
|
||||
setupGettext();
|
||||
|
||||
|
||||
if (Config.IS_USER) {
|
||||
// Infer libdir by assuming gnome-shell shares a common prefix with gjs;
|
||||
// assume the parent directory if it's not there
|
||||
let libdir = GIRepository.Repository.get_search_path().find(path => {
|
||||
let gir_paths;
|
||||
|
||||
if (GIRepository.Repository.hasOwnProperty('get_search_path')) {
|
||||
// GNOME <= 48 / GIRepository 2.0
|
||||
gir_paths = GIRepository.Repository.get_search_path();
|
||||
} else {
|
||||
// GNOME 49+ / GIRepository 3.0
|
||||
const repo = GIRepository.Repository.dup_default();
|
||||
gir_paths = repo.get_search_path();
|
||||
}
|
||||
|
||||
let libdir = gir_paths.find(path => {
|
||||
return path.endsWith('/gjs/girepository-1.0');
|
||||
}).replace('/gjs/girepository-1.0', '');
|
||||
|
||||
@ -110,7 +123,7 @@ globalThis.HAVE_GNOME = GLib.getenv('GSCONNECT_MODE')?.toLowerCase() !== 'cli' &
|
||||
* @param {Error|string} message - A string or Error to log
|
||||
* @param {string} [prefix] - An optional prefix for the warning
|
||||
*/
|
||||
const _debugCallerMatch = new RegExp(/([^@]*)@([^:]*):([^:]*)/);
|
||||
const _debugCallerMatch = new RegExp(/^([^@]+)@(.*):(\d+):(\d+)$/);
|
||||
// eslint-disable-next-line func-style
|
||||
const _debugFunc = function (error, prefix = null) {
|
||||
let caller, message;
|
||||
@ -127,7 +140,9 @@ const _debugFunc = function (error, prefix = null) {
|
||||
message = `${prefix}: ${message}`;
|
||||
|
||||
const [, func, file, line] = _debugCallerMatch.exec(caller);
|
||||
const script = file.replace(Config.PACKAGE_DATADIR, '');
|
||||
let script = file.replace(Config.PACKAGE_DATADIR, '');
|
||||
if (script.startsWith('file:///'))
|
||||
script = script.slice(8);
|
||||
|
||||
GLib.log_structured('GSConnect', GLib.LogLevelFlags.LEVEL_MESSAGE, {
|
||||
'MESSAGE': `[${script}:${func}:${line}]: ${message}`,
|
||||
@ -338,10 +353,11 @@ GLib.Variant.prototype.full_unpack = _full_unpack;
|
||||
* @param {string} keyPath - Absolute path to a private key in PEM format
|
||||
* @param {string} commonName - A unique common name for the certificate
|
||||
* @returns {Gio.TlsCertificate} A TLS certificate
|
||||
* @throws MissingOpensslError on missing openssl binary
|
||||
*/
|
||||
Gio.TlsCertificate.new_for_paths = function (certPath, keyPath, commonName = null) {
|
||||
if (GLib.find_program_in_path(Config.OPENSSL_PATH) === null) {
|
||||
const error = new Error();
|
||||
const error = new MissingOpensslError();
|
||||
error.name = _('OpenSSL not found');
|
||||
error.url = `${Config.PACKAGE_URL}/wiki/Error#openssl-not-found`;
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user