Fix European trip return heuristic for weekend location tracking

Adjust European short trip heuristic from >3 days to >1 day to correctly
detect when user has returned home from European trips. This fixes the
April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg"
instead of "Bristol" when the user was free (no events scheduled) after
the foss-north trip ended on April 27.

The previous logic required more than 3 days to pass before assuming
return home from European countries, but for short European trips by
rail/ferry, users typically return within 1-2 days.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2025-07-16 06:38:37 +02:00
parent 663dc479c2
commit ea4980a5d7
6407 changed files with 1072847 additions and 18 deletions

15
node_modules/randombytes/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,15 @@
sudo: false
language: node_js
matrix:
include:
- node_js: '7'
env: TEST_SUITE=test
- node_js: '6'
env: TEST_SUITE=test
- node_js: '5'
env: TEST_SUITE=test
- node_js: '4'
env: TEST_SUITE=test
- node_js: '4'
env: TEST_SUITE=phantom
script: "npm run-script $TEST_SUITE"

1
node_modules/randombytes/.zuul.yml generated vendored Normal file
View file

@ -0,0 +1 @@
ui: tape

21
node_modules/randombytes/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 crypto-browserify
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

14
node_modules/randombytes/README.md generated vendored Normal file
View file

@ -0,0 +1,14 @@
randombytes
===
[![Version](http://img.shields.io/npm/v/randombytes.svg)](https://www.npmjs.org/package/randombytes) [![Build Status](https://travis-ci.org/crypto-browserify/randombytes.svg?branch=master)](https://travis-ci.org/crypto-browserify/randombytes)
randombytes from node that works in the browser. In node you just get crypto.randomBytes, but in the browser it uses .crypto/msCrypto.getRandomValues
```js
var randomBytes = require('randombytes');
randomBytes(16);//get 16 random bytes
randomBytes(16, function (err, resp) {
// resp is 16 random bytes
});
```

50
node_modules/randombytes/browser.js generated vendored Normal file
View file

@ -0,0 +1,50 @@
'use strict'
// limit of Crypto.getRandomValues()
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
var MAX_BYTES = 65536
// Node supports requesting up to this number of bytes
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
var MAX_UINT32 = 4294967295
function oldBrowser () {
throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
}
var Buffer = require('safe-buffer').Buffer
var crypto = global.crypto || global.msCrypto
if (crypto && crypto.getRandomValues) {
module.exports = randomBytes
} else {
module.exports = oldBrowser
}
function randomBytes (size, cb) {
// phantomjs needs to throw
if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
var bytes = Buffer.allocUnsafe(size)
if (size > 0) { // getRandomValues fails on IE if size == 0
if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
for (var generated = 0; generated < size; generated += MAX_BYTES) {
// buffer.slice automatically checks if the end is past the end of
// the buffer so we don't have to here
crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
}
} else {
crypto.getRandomValues(bytes)
}
}
if (typeof cb === 'function') {
return process.nextTick(function () {
cb(null, bytes)
})
}
return bytes
}

1
node_modules/randombytes/index.js generated vendored Normal file
View file

@ -0,0 +1 @@
module.exports = require('crypto').randomBytes

36
node_modules/randombytes/package.json generated vendored Normal file
View file

@ -0,0 +1,36 @@
{
"name": "randombytes",
"version": "2.1.0",
"description": "random bytes from browserify stand alone",
"main": "index.js",
"scripts": {
"test": "standard && node test.js | tspec",
"phantom": "zuul --phantom -- test.js",
"local": "zuul --local --no-coverage -- test.js"
},
"repository": {
"type": "git",
"url": "git@github.com:crypto-browserify/randombytes.git"
},
"keywords": [
"crypto",
"random"
],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/crypto-browserify/randombytes/issues"
},
"homepage": "https://github.com/crypto-browserify/randombytes",
"browser": "browser.js",
"devDependencies": {
"phantomjs": "^1.9.9",
"standard": "^10.0.2",
"tap-spec": "^2.1.2",
"tape": "^4.6.3",
"zuul": "^3.7.2"
},
"dependencies": {
"safe-buffer": "^5.1.0"
}
}

81
node_modules/randombytes/test.js generated vendored Normal file
View file

@ -0,0 +1,81 @@
var test = require('tape')
var randomBytes = require('./')
var MAX_BYTES = 65536
var MAX_UINT32 = 4294967295
test('sync', function (t) {
t.plan(9)
t.equals(randomBytes(0).length, 0, 'len: ' + 0)
t.equals(randomBytes(3).length, 3, 'len: ' + 3)
t.equals(randomBytes(30).length, 30, 'len: ' + 30)
t.equals(randomBytes(300).length, 300, 'len: ' + 300)
t.equals(randomBytes(17 + MAX_BYTES).length, 17 + MAX_BYTES, 'len: ' + 17 + MAX_BYTES)
t.equals(randomBytes(MAX_BYTES * 100).length, MAX_BYTES * 100, 'len: ' + MAX_BYTES * 100)
t.throws(function () {
randomBytes(MAX_UINT32 + 1)
})
t.throws(function () {
t.equals(randomBytes(-1))
})
t.throws(function () {
t.equals(randomBytes('hello'))
})
})
test('async', function (t) {
t.plan(9)
randomBytes(0, function (err, resp) {
if (err) throw err
t.equals(resp.length, 0, 'len: ' + 0)
})
randomBytes(3, function (err, resp) {
if (err) throw err
t.equals(resp.length, 3, 'len: ' + 3)
})
randomBytes(30, function (err, resp) {
if (err) throw err
t.equals(resp.length, 30, 'len: ' + 30)
})
randomBytes(300, function (err, resp) {
if (err) throw err
t.equals(resp.length, 300, 'len: ' + 300)
})
randomBytes(17 + MAX_BYTES, function (err, resp) {
if (err) throw err
t.equals(resp.length, 17 + MAX_BYTES, 'len: ' + 17 + MAX_BYTES)
})
randomBytes(MAX_BYTES * 100, function (err, resp) {
if (err) throw err
t.equals(resp.length, MAX_BYTES * 100, 'len: ' + MAX_BYTES * 100)
})
t.throws(function () {
randomBytes(MAX_UINT32 + 1, function () {
t.ok(false, 'should not get here')
})
})
t.throws(function () {
randomBytes(-1, function () {
t.ok(false, 'should not get here')
})
})
t.throws(function () {
randomBytes('hello', function () {
t.ok(false, 'should not get here')
})
})
})