this post was submitted on 19 Jul 2024
8 points (90.0% liked)

LibreWolf

3133 readers
1 users here now

Welcome to the official community for LibreWolf.

LibreWolf is designed to increase protection against tracking and fingerprinting techniques, while also including a few security improvements. LibreWolf also aims to remove all the telemetry, data collection and annoyances, as well as disabling anti-freedom features like DRM. If you have any question please visit our FAQ first: https://librewolf.net/docs/faq/

To learn more or to download the browser visit the website: https://librewolf.net/

If you want to contribute head over to our Codeberg: https://codeberg.org/librewolf

founded 3 years ago
MODERATORS
 

I recently migrated to Librewolf from Firefox due to Mozilla's recent blunder of covertly adding adware to their browser.

I like the ResistFingerprinting feature for added privacy, but enabling it seems to set my browser time to GMT instead of ET, with most times on webpages (which refer to browser time) ahead by several hours as a result.

Can I define my desired timezone in the browser settings so I don't have to pick one or the other between a correct browser time and better privacy? TIA :D!

top 5 comments
sorted by: hot top controversial new old
[–] dvb@lemmy.ml 6 points 3 months ago (1 children)

I have a similar requirement and use a self-written script in Tampermonkey, in which I falsify the wrong time (GMT) to the correct time just for websites I have previously defined. Specifically, I overwrite the newDate function on these.

This means that Librewolf always displays the wrong time (GMT) by default, except for websites I want to have the correct time (which just are a few) without the need to disable RFP.

[–] DetachablePianist@lemmy.world 3 points 3 months ago (1 children)

Any chance you could share your script? I've tried a few browser extensions to solve this but they never seem to work on the sites where I actually need them. Your approach sounds way better!

[–] dvb@lemmy.ml 6 points 3 months ago (2 children)

Yes, of course. You will have to adapt it to your time zone, as the German time zone is currently hardcoded. If I had known back then that I would be sharing this at some point, I would have tried harder. 😅

// ==UserScript==
// @name         Spoof Timezone
// @namespace    http://tampermonkey.net/
// @version      0.1
// @license      GPL-3.0
// @description  Overwrites the Date object to use the German time zone
// @author       dvb
// @match        *://*.foo.com/*
// @match        *://*.bar.com/*
// @match        *://*.foobar.com/*
// @match        https://webbrowsertools.com/timezone/
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    const originalDate = Date;

    function isSummerTime(now) {
        const month = now.getMonth() + 1; // January is 0, so +1
        const day = now.getDate();
        const hour = now.getHours();

        if (month > 3 && month < 10) { // Summer time is from April to September
            return true;
        } else if (month === 3 && day >= 29 && hour >= 2) { // Last Sunday in March at 2 o'clock
            return true;
        } else if (month === 10 && day <= 25 && hour < 3) { // Last Sunday in October at 3 o'clock
            return true;
        }

        return false;
    }

    function getGermanDate(...args) {
        const now = new originalDate(...args);
        const germanTimeZoneOffset = isSummerTime(now) ? -120 : -60; // German time zone is UTC+1 (+2 during summer time)
        if (args.length === 0) {
            return new originalDate(now.getTime() + (now.getTimezoneOffset() - germanTimeZoneOffset) * 60000);
        } else {
            return now;
        }
    }

    // Overwrite the newDate function
    const newDate = function(...args) {
        return getGermanDate(...args);
    };

    // Copy the prototypes and static methods
    Object.setPrototypeOf(newDate, originalDate);
    Object.setPrototypeOf(newDate.prototype, originalDate.prototype);
    for (const prop of Object.getOwnPropertyNames(originalDate)) {
        if (typeof originalDate[prop] === 'function') {
            newDate[prop] = originalDate[prop].bind(originalDate);
        } else {
            Object.defineProperty(newDate, prop, Object.getOwnPropertyDescriptor(originalDate, prop));
        }
    }

    // Overwrite Date objects
    Date = newDate;
    window.Date = newDate;
})();
[–] DetachablePianist@lemmy.world 4 points 3 months ago* (last edited 3 months ago)

Thanks! I successfully modified your script to adjust for my local timezone. Definitely seems to work on your example webbrowsertools site, though I still can't seem to make AWS happy. no idea where they're pulling their timezone data from, but it always shows me UTC no matter what (and yes, I followed your @match examples adjusting for amazon - the script triggers, just doesn't fix the time displayed for instance monitoring the way I want).

anyway, thanks for sharing your script. I love it! I'll keep playing around to see if I can figure what AWS actually uses to determine "local timezone".

[–] starlord@lemm.ee 2 points 2 months ago

This is super rad