diff --git a/_backend/GeoLite2-City.mmdb b/_backend/GeoLite2-City.mmdb deleted file mode 100644 index e52c3873c8..0000000000 Binary files a/_backend/GeoLite2-City.mmdb and /dev/null differ diff --git a/_backend/composer.json b/_backend/composer.json index 4ffe11f35b..60f9539419 100644 --- a/_backend/composer.json +++ b/_backend/composer.json @@ -16,7 +16,6 @@ "require": { "stripe/stripe-php": "21.3.1", "erusev/parsedown-extra": "^0.9", - "geoip2/geoip2": "^3.0", "ext-intl": ">=7", "ext-json": ">=7", "sentry/sentry": "^4.7" diff --git a/_backend/composer.lock b/_backend/composer.lock index 8899ae2200..999f3025c0 100644 --- a/_backend/composer.lock +++ b/_backend/composer.lock @@ -4,80 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d365825137d8ec920a698e51b9c6db46", + "content-hash": "6e9287c940503728165e3d63e46dec5c", "packages": [ - { - "name": "composer/ca-bundle", - "version": "1.5.14", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "0c8abba0634f637bd78c4e451981da368d403463" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/0c8abba0634f637bd78c4e451981da368d403463", - "reference": "0c8abba0634f637bd78c4e451981da368d403463", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^8 || ^9", - "psr/log": "^1.0 || ^2.0 || ^3.0", - "symfony/process": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.5.14" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - } - ], - "time": "2026-08-21T14:57:29+00:00" - }, { "name": "erusev/parsedown", "version": "1.8.0", @@ -195,64 +123,6 @@ ], "time": "2026-02-16T13:06:37+00:00" }, - { - "name": "geoip2/geoip2", - "version": "v3.4.0", - "source": { - "type": "git", - "url": "https://github.com/maxmind/GeoIP2-php.git", - "reference": "257a350e5e0cae57ac95417f32bb0aba285b2c0d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/257a350e5e0cae57ac95417f32bb0aba285b2c0d", - "reference": "257a350e5e0cae57ac95417f32bb0aba285b2c0d", - "shasum": "" - }, - "require": { - "ext-json": "*", - "maxmind-db/reader": "^1.13.0", - "maxmind/web-service-common": "~0.11", - "php": ">=8.1" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "3.*", - "phpstan/phpstan": "*", - "phpunit/phpunit": "^10.0", - "squizlabs/php_codesniffer": "4.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "GeoIp2\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory J. Oschwald", - "email": "goschwald@maxmind.com", - "homepage": "https://www.maxmind.com/en/home" - } - ], - "description": "MaxMind GeoIP PHP API", - "homepage": "https://github.com/maxmind/GeoIP2-php", - "keywords": [ - "IP", - "geoip", - "geoip2", - "geolocation", - "maxmind" - ], - "support": { - "issues": "https://github.com/maxmind/GeoIP2-php/issues", - "source": "https://github.com/maxmind/GeoIP2-php/tree/v3.4.0" - }, - "time": "2026-07-16T22:11:20+00:00" - }, { "name": "guzzlehttp/psr7", "version": "3.1.0", @@ -432,121 +302,6 @@ }, "time": "2025-03-19T14:43:43+00:00" }, - { - "name": "maxmind-db/reader", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "2194f58d0f024ce923e685cdf92af3daf9951908" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/2194f58d0f024ce923e685cdf92af3daf9951908", - "reference": "2194f58d0f024ce923e685cdf92af3daf9951908", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "conflict": { - "ext-maxminddb": "<1.11.1 || >=2.0.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "3.*", - "phpstan/phpstan": "*", - "phpunit/phpunit": ">=8.0.0,<10.0.0", - "squizlabs/php_codesniffer": "4.*" - }, - "suggest": { - "ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", - "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", - "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups", - "maxmind-db/reader-ext": "C extension for significantly faster IP lookups (install via PIE: pie install maxmind-db/reader-ext)" - }, - "type": "library", - "autoload": { - "psr-4": { - "MaxMind\\Db\\": "src/MaxMind/Db" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory J. Oschwald", - "email": "goschwald@maxmind.com", - "homepage": "https://www.maxmind.com/" - } - ], - "description": "MaxMind DB Reader API", - "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php", - "keywords": [ - "database", - "geoip", - "geoip2", - "geolocation", - "maxmind" - ], - "support": { - "issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues", - "source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.13.1" - }, - "time": "2025-11-21T22:24:26+00:00" - }, - { - "name": "maxmind/web-service-common", - "version": "v0.11.1", - "source": { - "type": "git", - "url": "https://github.com/maxmind/web-service-common-php.git", - "reference": "c309236b5a5555b96cf560089ec3cead12d845d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/c309236b5a5555b96cf560089ec3cead12d845d2", - "reference": "c309236b5a5555b96cf560089ec3cead12d845d2", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0.3", - "ext-curl": "*", - "ext-json": "*", - "php": ">=8.1" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "3.*", - "phpstan/phpstan": "*", - "phpunit/phpunit": "^10.0", - "squizlabs/php_codesniffer": "4.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "MaxMind\\Exception\\": "src/Exception", - "MaxMind\\WebService\\": "src/WebService" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory Oschwald", - "email": "goschwald@maxmind.com" - } - ], - "description": "Internal MaxMind Web Service API", - "homepage": "https://github.com/maxmind/web-service-common-php", - "support": { - "issues": "https://github.com/maxmind/web-service-common-php/issues", - "source": "https://github.com/maxmind/web-service-common-php/tree/v0.11.1" - }, - "time": "2026-01-13T17:56:03+00:00" - }, { "name": "psr/http-factory", "version": "1.1.0", @@ -1379,16 +1134,16 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "ext-intl": ">=7", "ext-json": ">=7" }, - "platform-dev": {}, + "platform-dev": [], "platform-overrides": { "php": "8.1" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/_backend/config.example.php b/_backend/config.example.php index 5913adf74a..39db544948 100644 --- a/_backend/config.example.php +++ b/_backend/config.example.php @@ -17,12 +17,6 @@ 'release_arm_magnet' => '90b3382caff769f4c7779ef90a5ab30eedda73d4', 'release_arm_sha256' => '85116d48c406ae7cd60c936050a099d4b8610321273f6f0a694796db4d4e86ba', - 'previous_title' => 'Circe', - 'previous_version' => '8.0.2', - 'previous_filename' => 'elementaryos-8.0-stable-amd64.20250902rc.iso', - 'previous_size' => '3.3 GB', - 'previous_magnet' => '36d2dec9234ae7196062b60eca32b08f01c77143', - // Stripe API version + Keys 'stripe_version' => '2026-03-25.dahlia', 'stripe_sk' => 'sk_test_hoigesrjgoisrhgilgjrsfjs', @@ -31,8 +25,6 @@ // Classic token that requires 'read:org', 'read:user', 'public_repo' scopes for `/api/sponsors_goals` endpoint 'gh_sponsors_token' => 'ghp_1234567890abcdefghij', - 'previous_stripe_sk' => 'sk_test_hoigesrjgoisrhgilgjrsfjs', - 'slack_token' => 'asdf-1234567890-7418529630-a7854123692-8412487519', 'sentry_dsn' => false, diff --git a/_backend/download.php b/_backend/download.php new file mode 100644 index 0000000000..d755a4a426 --- /dev/null +++ b/_backend/download.php @@ -0,0 +1,9 @@ +city($hostname); - - $continent = $record->continent->code; - $country = $record->country->isoCode; - $longitude = $record->location->longitude; - } catch (\Exception $e) { - if ($debug) { - echo $e->getMessage(); - } else { - error_log($e->getMessage()); - } - - $continent = false; - $country = false; - $longitude = false; - } - - if ($debug) { - echo 'Continent: "'.$continent.'"'."\n"; - echo 'Country: "' .$country .'"'."\n"; - echo 'Longitude: "'.$longitude.'"'."\n"; - } - - // North America - if ($continent == 'NA') { - // These lists are based on who is on what side of the USA. - $northEast = array('BZ', 'CR', 'SV', 'GT', 'HN', 'MX', 'NI', 'PA'); - /** @var string $northWest */ - $northWest = array('AG', 'BS', 'BB', 'BM', 'VG', 'KY', 'CU', 'DM', 'DO', 'GL', 'GD', 'GP', 'HT', 'JM', 'MQ', 'MS', 'CW', 'AW', 'SX', 'BQ', 'PR', 'BL', 'KN', 'AI', 'LC', 'MF', 'PM', 'VC', 'TT', 'TC', 'VI'); - if (in_array($country, $northEast) || - $longitude < -100 - ) { - return 'sfo1'; - } elseif (in_array($country, $northWest) || - $longitude >= -100 - ) { - return 'nyc3'; - } else { - return array('nyc3', 'sfo1'); - } - - // Europe - } elseif ($continent == 'EU') { - // These lists are based on who is connected to which international exchange directly. - // They are by no means exclusive. - $isles = array('GB', 'IM', 'IE', 'FO', 'IS', 'GG', 'JE', 'GI'); - $vikings = array('NL', 'SX', 'DK', 'NO', 'SE', 'FI', 'SJ'); - // Great Britain - if (in_array($country, $isles)) { - return 'ams3'; - // Vikings - } elseif (in_array($country, $vikings)) { - return 'ams3'; - // Everywhere else - } else { - return array('ams3', 'fra1'); - } - - // South America - } elseif ($continent == 'SA') { - return array('nyc3', 'sfo1'); - - // Africa - } elseif ($continent == 'AF') { - return array('fra1', 'ams3'); - } elseif ( - // Asia - $continent == 'AS' || - // Oceania - $continent == 'OC' || - // Antarctica - $continent == 'AN' - ) { - return 'sgp1'; - - // Other - } else { - return array('nyc3', 'ams3'); - } -} - -//// getIPHash -// Hashes the given IP to return either a 0 or a 1 consistently for the same IP. -// Used when balancing between two regions returned by getDownloadRegion. -function getIPHash($hostname, $debug = false) -{ - $hash = array_sum(str_split($hostname)); - if ($debug) { - echo 'Hash: "'.$hash.'"'."\n"; - } - $hash = $hash % 10; - if ($debug) { - echo 'Remainder: "'.$hash.'"'."\n"; - } - if ($hash > 5) { - return 0; - } else { - return 1; - } -} - -function getCurrentLocation($hostname, $debug = false) -{ - - try { - if ($debug) { - echo $hostname."\n"; - } - if (!class_exists('GeoIp2\Database\Reader')) { - throw new \Exception('Class GeoIp2\Database\Reader not found'); - } - $reader = new Reader(__DIR__.'/GeoLite2-City.mmdb'); - $record = $reader->city($hostname); - - $city = $record->city->name; // 'Minneapolis' - $state = $record->mostSpecificSubdivision->name ; // 'Minnesota' - $stateCode = $record->mostSpecificSubdivision->isoCode; // 'MN' - $country = $record->country->name; // 'United States' - $countryCode = $record->country->isoCode; // 'US' - $postcode = $record->postal->code; // '55455' - $continent = $record->continent->code; - } catch (\Exception $e) { - if ($debug) { - echo $e->getMessage(); - } else { - error_log($e->getMessage()); - } - - $city = false; - $state = false; - $stateCode = false; - $country = false; - $countryCode = false; - $postcode = false; - $continent = false; - } - - return array( - 'city' => $city, - 'state' => $state, - 'stateCode' => $stateCode, - 'country' => $country, - 'countryCode' => $countryCode, - 'postcode' => $postcode, - 'continent' => $continent, - ); -} diff --git a/_backend/geolocate.guess_ip.php b/_backend/geolocate.guess_ip.php deleted file mode 100644 index 20a9a12873..0000000000 --- a/_backend/geolocate.guess_ip.php +++ /dev/null @@ -1,21 +0,0 @@ - $config['release_version'] ), - 'previous' => array( - 'title' => $config['previous_title'], - 'version' => $config['previous_version'] - ), - 'keys' => array( 'stripe' => $config['stripe_pk'] - ), - - 'user' => array( - 'ip' => $ip, - 'region' => $region, - 'timecode' => $timecode ) ); diff --git a/api/download.php b/api/download.php deleted file mode 100644 index d37965d15e..0000000000 --- a/api/download.php +++ /dev/null @@ -1,130 +0,0 @@ - $config['stripe_sk'], - "stripe_version" => $config['stripe_version'] -]); - -/** - * go_home - * Sets header to redirect home - * - * @return {Void} - */ -function go_home() -{ - global $sitewide; - - header("Location: " . $sitewide['root']); - die(); -} - -// everything else falls into a great pyrimid of php ifs -if (isset($_GET['charge'])) { - $charge_id = $_GET['charge']; - - if (substr($charge_id, 0, 3) !== 'ch_') { - return go_home(); - } - - // Try to fetch the charge id under the current Stripe account - try { - $charge = $stripe->charges->retrieve($charge_id); - } catch (\Stripe\Exception\ApiConnectionException $e) { - $status = $e->getHttpStatus(); - if (isset($status) && $status !== 404) { - return go_home(); - } - } - - // Try to fetch the charge id under the _previous_ Stripe account - // IF the metadata we need isn't set yet - if (!isset($charge['metadata']['products'])) { - try { - $charge = $stripe->charges->retrieve( - $charge_id, - [], - ['api_key' => $config['previous_stripe_sk']] - ); - } catch (Exception $e) { - return go_home(); - } - } -} else { - $intent_id = $_GET['intent']; - - try { - $charge = $stripe->paymentIntents->retrieve($intent_id); - } catch (Exception $e) { - return go_home(); - } -} - -$products = array(); -if (isset($charge['metadata']['products'])) { - try { - $products = json_decode($charge['metadata']['products']); - } catch (Exception $e) { - return go_home(); - } -} - -$isoVersion = false; -foreach ($products as $product) { - if (substr($product, 0, 3) === 'ISO') { - // Set $isoVersion to the ISO Version number like '0.4.1' from the purchased product string 'ISO_0.4.1' - $isoVersion = substr($product, 4); - // Set $isoMajor as the first number from $isoVersion - list($isoMajor) = explode('.', $isoVersion); - // If that worked - if ($isoMajor != null) { - // Set $currentMajor as the first number from the current release version - list($currentMajor) = explode('.', $config['release_version']); - // Set $previousMajor as the first number from the previous release version - list($previousMajor) = explode('.', $config['previous_version']); - - // If the purchased major matches the current major - if ($isoMajor == $currentMajor) { - // Override $isoVersion to match the current release, - // so long as it's only a minor upgrade. - $isoVersion = $config['release_version']; - // $isoVersion is either: - // 1. an outdated product that was purchased - // 2. a minor upgrade version to a product that was purchased - os_payment_setcookie($isoVersion, $charge['amount']); - go_home(); - - // If the purchased major matches the previous major - } elseif ($isoMajor == $previousMajor) { - // Override $isoVersion to match the previous release, - // so long as it's only a minor upgrade. - $isoVersion = $config['previous_version']; - // $isoVersion is either: - // 1. an outdated product that was purchased - // 2. a minor upgrade version to a product that was purchased - os_payment_setcookie($isoVersion, $charge['amount']); - header('Location: ' . $sitewide['root'] . 'previous'); - exit; - - // Was too old or not determinable - } else { - go_home(); - } - } - } -} diff --git a/api/geolocate.php b/api/geolocate.php deleted file mode 100644 index d5a098d2f8..0000000000 --- a/api/geolocate.php +++ /dev/null @@ -1,55 +0,0 @@ - $ip, - 'shipping' => array( - 'address' => $estimatedAddress, - ), - ); - - if (!empty($estimatedAddress['countryCode']) && - !empty($estimatedAddress['stateCode']) && - !empty($estimatedAddress['city']) && - !empty($estimatedAddress['postcode']) - ) { - $address = new \Store\Address\Address(); - $address->set_line1(''); - $address->set_country($estimatedAddress['countryCode']); - $address->set_state($estimatedAddress['stateCode']); - $address->set_city($estimatedAddress['city']); - $address->set_postal($estimatedAddress['postcode']); - $items = array( - array ( - 'quantity' => 1, - 'variant_id' => $_GET['item'], - ), - ); - $result['shipping']['estimates'] = Store\Api\get_shipping($address, $items); - } - - echo json_encode($result, JSON_PRETTY_PRINT); -} else { - $result = array ('error' => 'No parameters were supplied, but some were expected.'); - echo json_encode($result, JSON_PRETTY_PRINT); -} diff --git a/index.php b/index.php index 66c15c7b89..aa92627bc6 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@
Download the install media for your computer's processor from a localized server or by magnet link
+Download the install media for your computer's processor by direct download or by magnet link
For help and more info, see the installation guide
You are attempting to download an outdated release of elementary OS that you have purchased. For the latest updates and extended support please go to elementary.io
-For help and more info, read the installation guide. If you purchased elementary OS, check your email for a receipt that includes your link to download elementary OS again for free.
- Read Installation Guide -