├── l10n ├── .gitkeep ├── nn_NO.json ├── nn_NO.js ├── sq.json ├── sq.js ├── id.json ├── id.js ├── es_MX.json ├── es_MX.js ├── da.json ├── da.js ├── lt_LT.json └── lt_LT.js ├── 3rdparty ├── .gitkeep ├── rir_data │ └── .gitkeep └── maxmind_geolite2 │ └── .gitkeep ├── .prettierignore ├── .github ├── lint │ └── markdown-lint.yml └── workflows │ ├── check-maxmind.yml │ ├── load-maxmind.yml │ ├── lint.yml │ ├── build-release.yml │ └── phpunit.yml ├── img ├── 1.PNG ├── blocking.svg └── blocking-dark.svg ├── tests ├── Unit │ ├── LocalizationServices │ │ ├── test-rir-data-invalid3.txt │ │ ├── test-rir-data-invalid1.txt │ │ ├── test-rir-data-invalid2.txt │ │ ├── test-rir-data.txt │ │ ├── DummyTest.php │ │ └── MaxMindGeoLite2Test.php │ └── Db │ │ └── RIRServiceMapperTest.php ├── bootstrap.php ├── UnitMissingServiceTests │ ├── MaxMindGeoLite2Valid2Test.php │ ├── MaxMindGeoLite2Valid1Test.php │ ├── MaxMindGeoLite2MissingTest.php │ └── MaxMindGeoLite2TestBase.php └── Integration │ ├── RIRServiceMapperDBTest.php │ └── GeoBlockerIntegrationTest.php ├── .prettierrc ├── .gitpod ├── custom-entrypoint.sh ├── Dockerfile └── docker-compose.yml ├── package.json ├── phpunit.xml ├── .gitignore ├── phpunit.integration.xml ├── phpunit.special1.xml ├── phpunit.special2.xml ├── phpunit.special3.xml ├── lib ├── LocalizationServices │ ├── RIRStatus.php │ ├── IDatabaseDate.php │ ├── IDatabaseFileLocation.php │ ├── Dummy.php │ ├── GeoIPLookupCmdWrapper.php │ ├── RIRDataChecks.php │ ├── ILocalizationService.php │ ├── IDatabaseUpdate.php │ ├── GeoIPLookup.php │ ├── LocalizationServiceFactory.php │ └── MaxMindGeoLite2.php ├── AppInfo │ └── Application.php ├── Db │ ├── RIRServiceDBEntity.php │ └── RIRServiceMapper.php ├── Command │ └── LocalizationService │ │ ├── ResetCountries.php │ │ ├── SelectService.php │ │ ├── ListServices.php │ │ ├── ResetDB.php │ │ └── UpdateDB.php ├── Migration │ ├── Version000501Date20210709171637.php │ └── Version000300Date20200413202844.php ├── Settings │ ├── AdminSection.php │ └── Admin.php ├── Hooks │ └── UserHooks.php ├── Controller │ └── ServiceController.php ├── GeoBlocker │ └── GeoBlocker.php └── Config │ └── GeoBlockerConfig.php ├── .tx └── config ├── phpunit.all.xml ├── .gitpod.yml ├── .php_cs.dist ├── composer.json ├── css └── admin.css ├── bin └── tools │ └── file_from_env.php ├── runtest.sh ├── GeoIP.template.conf ├── helper_scripts ├── create_countries.sh └── cl_start.txt ├── appinfo ├── routes.php └── info.xml ├── Makefile └── templates └── admin.php /l10n/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /3rdparty/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | templates/* -------------------------------------------------------------------------------- /3rdparty/rir_data/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /3rdparty/maxmind_geolite2/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/lint/markdown-lint.yml: -------------------------------------------------------------------------------- 1 | default: true 2 | MD013: 3 | code_blocks: false 4 | -------------------------------------------------------------------------------- /img/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HomeITAdmin/nextcloud_geoblocker/HEAD/img/1.PNG -------------------------------------------------------------------------------- /tests/Unit/LocalizationServices/test-rir-data-invalid3.txt: -------------------------------------------------------------------------------- 1 | asdfasdf dsgffsdgsg fsag sfg asg asdfasdf 2 | This is a nonsense file 3 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "phpVersion": "7.4", 3 | "printWidth": 80, 4 | "tabWidth": 4, 5 | "useTabs": true, 6 | "endOfLine": "lf", 7 | "braceStyle": "1tbs" 8 | } 9 | -------------------------------------------------------------------------------- /.gitpod/custom-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | chown www-data:www-data /var/www/html/custom_apps/ 4 | 5 | sudo -u#33 php occ app:enable geoblocker 6 | 7 | /entrypoint.sh "$@" -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "geoblocker", 3 | "description": "GeoBlocker dependencies", 4 | "version": "0.0.0", 5 | "devDependencies": { 6 | "prettier": "*", 7 | "@prettier/plugin-php": "*" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests/Unit 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .buildpath 2 | .project 3 | .settings/ 4 | vendor/ 5 | composer.lock 6 | .phpunit.result.cache 7 | 3rdparty/maxmind_geolite2/geoip2.phar 8 | 3rdparty/rir_data/*.txt 9 | node_modules 10 | package-lock.json 11 | build/ 12 | .php_cs.cache 13 | -------------------------------------------------------------------------------- /phpunit.integration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests/Integration 5 | 6 | 7 | -------------------------------------------------------------------------------- /phpunit.special1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests/UnitMissingServiceTests/MaxMindGeoLite2Valid1Test.php 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /phpunit.special2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests/UnitMissingServiceTests/MaxMindGeoLite2MissingTest.php 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /phpunit.special3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests/UnitMissingServiceTests/MaxMindGeoLite2Valid2Test.php 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | loadApp('geoblocker'); 13 | -------------------------------------------------------------------------------- /lib/LocalizationServices/RIRStatus.php: -------------------------------------------------------------------------------- 1 | /geoblocker.po 7 | source_file = translationfiles/templates/geoblocker.pot 8 | source_lang = en 9 | type = PO 10 | 11 | -------------------------------------------------------------------------------- /phpunit.all.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests/Unit 5 | 6 | 7 | ./tests/Integration 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - name: Nextcloud Server 3 | before: | 4 | sudo chown -R gitpod:www-data . 5 | sudo chmod -R g+w . 6 | init: | 7 | cd .gitpod 8 | docker-compose up --no-start 9 | command: | 10 | cd .gitpod 11 | docker-compose up 12 | 13 | ports: 14 | - port: 8080 15 | visibility: private 16 | onOpen: open-browser -------------------------------------------------------------------------------- /.php_cs.dist: -------------------------------------------------------------------------------- 1 | getFinder() 12 | // ->ignoreVCSIgnored(true) 13 | ->notPath('build') 14 | ->notPath('l10n') 15 | ->notPath('src') 16 | ->notPath('vendor') 17 | ->in(__DIR__); 18 | return $config; 19 | -------------------------------------------------------------------------------- /lib/LocalizationServices/IDatabaseDate.php: -------------------------------------------------------------------------------- 1 | =9.0 <10.0", 7 | "nextcloud/coding-standard": ">=0.3.0" 8 | }, 9 | "scripts": { 10 | "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", 11 | "cs:check": "php-cs-fixer fix --dry-run --diff", 12 | "cs:fix": "php-cs-fixer fix --diff" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /css/admin.css: -------------------------------------------------------------------------------- 1 | #geoblocker #choose-countries { 2 | height: initial; 3 | background: initial; 4 | padding-right: 12px !important; 5 | } 6 | 7 | #geoblocker .subsection { 8 | margin-left: 12px; 9 | } 10 | 11 | #geoblocker .path-input { 12 | width: 440px; 13 | } 14 | 15 | #geoblocker a:link, a:visited { 16 | color: blue; 17 | text-decoration: underline; 18 | } 19 | 20 | #geoblocker a:hover, a:active { 21 | color: lightblue; 22 | text-decoration: none; 23 | } -------------------------------------------------------------------------------- /tests/Unit/LocalizationServices/test-rir-data-invalid2.txt: -------------------------------------------------------------------------------- 1 | 2|bla|20201003|6899|00000000|20201003|00000 2 | bla|*|asn|*|2|summary 3 | bla|*|ipv4|*|2|summary 4 | bla|*|ipv6|*|2|summary 5 | bla|ZA|asn|1228|1|19910301|allocated 6 | bla|ZA|asn|1229|1|19910301|allocated 7 | bla|GH|ipv4|41.75.48.0|4096|20101111|allocated 8 | bla|KE|ipv4|41.76.184.0|2048|20100701|allocated 9 | bla|CI|ipv6|2001:42d8::|32|20171229|allocated 10 | bla|AO|ipv6|2001:43f8:720::|48|20121025|assigned 11 | -------------------------------------------------------------------------------- /.gitpod/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nextcloud 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y sudo geoip-bin wget 5 | 6 | COPY custom-entrypoint.sh /custom-entrypoint.sh 7 | RUN chmod +x /custom-entrypoint.sh 8 | 9 | ENTRYPOINT ["/custom-entrypoint.sh"] 10 | 11 | # Needs to be set again, even though it is already in base image 12 | # reference: https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact 13 | CMD ["apache2-foreground"] -------------------------------------------------------------------------------- /.gitpod/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | app: 5 | build: . 6 | ports: 7 | - 8080:80 8 | restart: no 9 | volumes: 10 | - ${GITPOD_REPO_ROOT}:/var/www/html/custom_apps/geoblocker 11 | environment: 12 | - SQLITE_DATABASE=nc 13 | - NEXTCLOUD_ADMIN_USER=admin 14 | - NEXTCLOUD_ADMIN_PASSWORD=test123 15 | - NEXTCLOUD_TRUSTED_DOMAINS=*.gitpod.io 16 | - OVERWRITEPROTOCOL=https 17 | - TRUSTED_PROXIES=192.168.0.0/16 -------------------------------------------------------------------------------- /lib/LocalizationServices/IDatabaseFileLocation.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright Benjamin Brahmer 2020 11 | */ 12 | 13 | if ($argc < 2) { 14 | echo "This script expects two parameters:\n"; 15 | echo "./file_from_env.php ENV_VAR PATH_TO_FILE\n"; 16 | exit(1); 17 | } 18 | 19 | # Read environment variable 20 | $content = getenv($argv[1]); 21 | 22 | if (!$content){ 23 | echo "Variable was empty\n"; 24 | exit(1); 25 | } 26 | 27 | file_put_contents($argv[2], $content); 28 | 29 | echo "Done...\n"; -------------------------------------------------------------------------------- /lib/AppInfo/Application.php: -------------------------------------------------------------------------------- 1 | getAppContainer()->get(UserHooks::class)->register(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/LocalizationServices/Dummy.php: -------------------------------------------------------------------------------- 1 | l = $l; 16 | } 17 | 18 | public function getStatus(): bool { 19 | return true; 20 | } 21 | 22 | public function getStatusString(): string { 23 | return '"Dummy": ' . $this->l->t('OK. This service always returns "%s" for "Country not found".', GeoBlocker::kCountryNotFoundCode); 24 | } 25 | 26 | public function getCountryCodeFromIP($ip_address): string { 27 | return GeoBlocker::kCountryNotFoundCode; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /runtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "" 4 | echo "<<<<<<<<<<<<<<< Unit Tests + Code Coverage >>>>>>>>>>>>>>>" 5 | echo "" 6 | vendor/phpunit/phpunit/phpunit -c phpunit.xml --testdox --coverage-html build/coverage_report_unit --coverage-filter lib/ 7 | 8 | echo "" 9 | echo "" 10 | echo "<<<<<<<<<<<<<<< Special Unit Tests >>>>>>>>>>>>>>>" 11 | echo "" 12 | vendor/phpunit/phpunit/phpunit -c phpunit.special1.xml --testdox 13 | echo "" 14 | vendor/phpunit/phpunit/phpunit -c phpunit.special2.xml --testdox 15 | echo "" 16 | vendor/phpunit/phpunit/phpunit -c phpunit.special3.xml --testdox 17 | 18 | echo "" 19 | echo "" 20 | echo "<<<<<<<<<<<<<<< Integration Tests >>>>>>>>>>>>>>>" 21 | echo "" 22 | vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml --testdox --coverage-html build/coverage_report_integration --coverage-filter lib/ 23 | -------------------------------------------------------------------------------- /.github/workflows/check-maxmind.yml: -------------------------------------------------------------------------------- 1 | name: Check Maxmind DB to Cache 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | load: 8 | runs-on: ubuntu-latest 9 | continue-on-error: false 10 | name: "Load Maxmind Database into cache" 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v4 14 | 15 | - name: Cache db 16 | id: cache-maxmind 17 | uses: actions/cache@v4 18 | with: 19 | path: /home/runner/work/_temp/GeoIP/GeoLite2-Country.mmdb 20 | key: ${{ runner.os }}-maxmind-db 21 | 22 | - name: Test Maxmind No Cache Hit 23 | if: steps.cache-maxmind.outputs.cache-hit != 'true' 24 | run: echo 'No Cache Hit' 25 | 26 | - name: Test Maxmind Cache Hit 27 | if: steps.cache-maxmind.outputs.cache-hit == 'true' 28 | run: echo 'Cache Hit' 29 | -------------------------------------------------------------------------------- /lib/Db/RIRServiceDBEntity.php: -------------------------------------------------------------------------------- 1 | $this->id,'beginIpRange' => $this->beginIpRange, 17 | 'lengthIpRange' => $this->lengthIpRange,'isIpV6' => $this->isIpV6, 18 | 'countryCode' => $this->countryCode,'version' => $this->version]; 19 | } 20 | 21 | public function __construct() { 22 | $this->addType('beginIpRange', 'integer'); 23 | $this->addType('lengthIpRange', 'integer'); 24 | $this->addType('isIpV6', 'boolean'); 25 | $this->addType('version', 'integer'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/Unit/LocalizationServices/test-rir-data.txt: -------------------------------------------------------------------------------- 1 | 2|afrinic|20201003|6899|00000000|20201003|00000 2 | afrinic|*|asn|*|2|summary 3 | afrinic|*|ipv4|*|6|summary 4 | afrinic|*|ipv6|*|6|summary 5 | afrinic|ZA|asn|1228|1|19910301|allocated 6 | afrinic|ZA|asn|1229|1|19910301|allocated 7 | afrinic|GH|ipv4|41.75.48.0|4096|20101111|allocated 8 | afrinic|KE|ipv4|41.76.184.0|2048|20100701|allocated 9 | afrinic||ipv4|23.132.161.0|3840||reserved| 10 | afrinic||ipv4|24.132.161.0|3840||available| 11 | afrinic||ipv4|25.132.161.0|3840|20100701|allocated 12 | afrinic||ipv4|26.132.161.0|3840|20100701|assigned 13 | afrinic|CI|ipv6|2001:42d8::|32|20171229|allocated 14 | afrinic|AO|ipv6|2001:43f8:720::|48|20121025|assigned 15 | afrinic||ipv6|2602:fcfc:1000::|36||reserved| 16 | afrinic||ipv6|2603:fcfc:1000::|36||available| 17 | afrinic||ipv6|2604:fcfc:1000::|36|20121025|allocated 18 | afrinic||ipv6|2605:fcfc:1000::|36|20121025|assigned 19 | -------------------------------------------------------------------------------- /lib/LocalizationServices/GeoIPLookupCmdWrapper.php: -------------------------------------------------------------------------------- 1 | = 8; 30 | } 31 | 32 | public function checkAll(): bool { 33 | return $this->checkAllowURLFOpen() && $this->checkGMP() && 34 | $this->checkInternetConnection(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/Command/LocalizationService/ResetCountries.php: -------------------------------------------------------------------------------- 1 | config = $config; 21 | } 22 | 23 | protected function configure(): void { 24 | $this->setName('geoblocker:country-selection:reset')->setDescription( 25 | 'Resets the country selection, so that no country is blocked.'); 26 | } 27 | 28 | protected function execute(InputInterface $input, OutputInterface $output): int { 29 | $this->config->setUseWhiteListing(false); 30 | $this->config->setChoosenCountriesByString(''); 31 | return 0; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.github/workflows/load-maxmind.yml: -------------------------------------------------------------------------------- 1 | name: Load Maxmind DB to Cache 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '1 5 * * 1' 7 | 8 | jobs: 9 | load: 10 | runs-on: ubuntu-latest 11 | continue-on-error: false 12 | name: "Load Maxmind Database into cache" 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | 17 | - name: Cache db 18 | uses: actions/cache@v4 19 | with: 20 | path: /home/runner/work/_temp/GeoIP/GeoLite2-Country.mmdb 21 | key: ${{ runner.os }}-maxmind-db 22 | 23 | - name: Prep Maxmind 24 | run: sudo apt-get update 25 | && sudo apt-get install geoipupdate 26 | && sudo mv GeoIP.template.conf /etc/GeoIP.conf 27 | && sudo sed -i "s/<>/${{ secrets.MM_ID }}/g" /etc/GeoIP.conf 28 | && sudo sed -i "s/<>/${{ secrets.MM_KEY }}/g" /etc/GeoIP.conf 29 | && sudo geoipupdate 30 | && mkdir -p /home/runner/work/_temp/GeoIP/ 31 | && cp /var/lib/GeoIP/GeoLite2-Country.mmdb /home/runner/work/_temp/GeoIP/GeoLite2-Country.mmdb 32 | -------------------------------------------------------------------------------- /tests/UnitMissingServiceTests/MaxMindGeoLite2Valid2Test.php: -------------------------------------------------------------------------------- 1 | assertTrue(file_exists($this->phar_file_1)); 14 | $this->assertFalse(file_exists($this->phar_file_2)); 15 | 16 | copy($this->phar_file_1, $this->phar_file_2); 17 | 18 | $this->assertTrue(file_exists($this->phar_file_1)); 19 | $this->assertTrue(file_exists($this->phar_file_2)); 20 | try { 21 | $this->geo_ip_lookup = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 22 | $this->assertTrue($this->geo_ip_lookup->getStatus()); 23 | } catch (Exception $e) { 24 | $this->assertFalse(true); 25 | throw $e; 26 | } finally { 27 | $this->assertTrue(unlink($this->phar_file_2)); 28 | } 29 | $this->assertTrue(file_exists($this->phar_file_1)); 30 | $this->assertFalse(file_exists($this->phar_file_2)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/UnitMissingServiceTests/MaxMindGeoLite2Valid1Test.php: -------------------------------------------------------------------------------- 1 | assertTrue(file_exists($this->phar_file_1)); 14 | $this->assertFalse(file_exists($this->phar_file_2)); 15 | 16 | rename($this->phar_file_1, $this->phar_file_2); 17 | 18 | $this->assertFalse(file_exists($this->phar_file_1)); 19 | $this->assertTrue(file_exists($this->phar_file_2)); 20 | try { 21 | $this->geo_ip_lookup = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 22 | $this->assertTrue($this->geo_ip_lookup->getStatus()); 23 | } catch (Exception $e) { 24 | $this->assertFalse(true); 25 | throw $e; 26 | } finally { 27 | rename($this->phar_file_2, $this->phar_file_1); 28 | } 29 | $this->assertTrue(file_exists($this->phar_file_1)); 30 | $this->assertFalse(file_exists($this->phar_file_2)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /l10n/nn_NO.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "OK" : "OK", 3 | "Loading" : "Loading", 4 | "Albania" : "Albania", 5 | "Armenia" : "Armenia", 6 | "Angola" : "Angola", 7 | "Argentina" : "Argentina", 8 | "Austria" : "Austerrike", 9 | "Australia" : "Australia", 10 | "Belgium" : "Belgia", 11 | "Bulgaria" : "Bulgaria", 12 | "Bahamas" : "Bahamas", 13 | "Chile" : "Chile", 14 | "Germany" : "Tyskland", 15 | "Denmark" : "Danmark", 16 | "Estonia" : "Estland", 17 | "Egypt" : "Egypt", 18 | "Finland" : "Finland", 19 | "France" : "Frankrike", 20 | "Georgia" : "Georgia", 21 | "Greece" : "Hellas", 22 | "Indonesia" : "Indonesia", 23 | "Ireland" : "Irland", 24 | "Israel" : "Israel", 25 | "India" : "India", 26 | "Iceland" : "Island", 27 | "Jordan" : "Jordan", 28 | "Japan" : "Japan", 29 | "Kenya" : "Kenya", 30 | "Kuwait" : "Kuwait", 31 | "Lebanon" : "Libanon", 32 | "Lithuania" : "Litauen", 33 | "Latvia" : "Latvia", 34 | "Libya" : "Libya", 35 | "Mexico" : "Mexico", 36 | "Nigeria" : "Nigeria", 37 | "Netherlands" : "Nederland", 38 | "Norway" : "Noreg" 39 | },"pluralForm" :"nplurals=2; plural=(n != 1);" 40 | } -------------------------------------------------------------------------------- /l10n/nn_NO.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "geoblocker", 3 | { 4 | "OK" : "OK", 5 | "Loading" : "Loading", 6 | "Albania" : "Albania", 7 | "Armenia" : "Armenia", 8 | "Angola" : "Angola", 9 | "Argentina" : "Argentina", 10 | "Austria" : "Austerrike", 11 | "Australia" : "Australia", 12 | "Belgium" : "Belgia", 13 | "Bulgaria" : "Bulgaria", 14 | "Bahamas" : "Bahamas", 15 | "Chile" : "Chile", 16 | "Germany" : "Tyskland", 17 | "Denmark" : "Danmark", 18 | "Estonia" : "Estland", 19 | "Egypt" : "Egypt", 20 | "Finland" : "Finland", 21 | "France" : "Frankrike", 22 | "Georgia" : "Georgia", 23 | "Greece" : "Hellas", 24 | "Indonesia" : "Indonesia", 25 | "Ireland" : "Irland", 26 | "Israel" : "Israel", 27 | "India" : "India", 28 | "Iceland" : "Island", 29 | "Jordan" : "Jordan", 30 | "Japan" : "Japan", 31 | "Kenya" : "Kenya", 32 | "Kuwait" : "Kuwait", 33 | "Lebanon" : "Libanon", 34 | "Lithuania" : "Litauen", 35 | "Latvia" : "Latvia", 36 | "Libya" : "Libya", 37 | "Mexico" : "Mexico", 38 | "Nigeria" : "Nigeria", 39 | "Netherlands" : "Nederland", 40 | "Norway" : "Noreg" 41 | }, 42 | "nplurals=2; plural=(n != 1);"); 43 | -------------------------------------------------------------------------------- /lib/Migration/Version000501Date20210709171637.php: -------------------------------------------------------------------------------- 1 | ensureColumnIsNullable($schema, 'geoblocker_ls_rir', 'is_ip_v6'); 25 | 26 | return $result ? $schema : null; 27 | } 28 | 29 | protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool { 30 | $table = $schema->getTable($tableName); 31 | $column = $table->getColumn($columnName); 32 | 33 | if ($column->getNotnull()) { 34 | $column->setNotnull(false); 35 | return true; 36 | } 37 | 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/UnitMissingServiceTests/MaxMindGeoLite2MissingTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(file_exists($this->phar_file_1)); 14 | $this->assertFalse(file_exists($this->phar_file_2)); 15 | 16 | rename($this->phar_file_1, $this->phar_file_1 . 'bak'); 17 | 18 | $this->assertFalse(file_exists($this->phar_file_1)); 19 | $this->assertFalse(file_exists($this->phar_file_2)); 20 | 21 | try { 22 | $this->geo_ip_lookup = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 23 | $this->assertFalse($this->geo_ip_lookup->getStatus()); 24 | } catch (Exception $e) { 25 | $this->assertFalse(true); 26 | throw $e; 27 | } finally { 28 | rename($this->phar_file_1 . 'bak', $this->phar_file_1); 29 | } 30 | 31 | $this->assertTrue(file_exists($this->phar_file_1)); 32 | $this->assertFalse(file_exists($this->phar_file_2)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /GeoIP.template.conf: -------------------------------------------------------------------------------- 1 | # Please see https://dev.maxmind.com/geoip/geoipupdate/ for instructions 2 | # on setting up geoipupdate, including information on how to download a 3 | # pre-filled GeoIP.conf file. 4 | 5 | # Enter your account ID and license key below. These are available from 6 | # https://www.maxmind.com/en/my_license_key. If you are only using free 7 | # GeoLite databases, do not uncomment these lines. 8 | # AccountID 0 9 | # LicenseKey 000000000000 10 | 11 | # Enter the edition IDs of the databases you would like to update. 12 | # Multiple edition IDs are separated by spaces. 13 | # 14 | # Include one or more of the following edition IDs: 15 | # * GeoLite2-ASN - GeoLite 2 ASN 16 | # * GeoLite2-City - GeoLite 2 City 17 | # * GeoLite2-Country - GeoLite2 Country 18 | # * GeoLite-Legacy-IPv6-City - GeoLite Legacy IPv6 City 19 | # * GeoLite-Legacy-IPv6-Country - GeoLite Legacy IPv6 Country 20 | # * 506 - GeoLite Legacy Country 21 | # * 517 - GeoLite Legacy ASN 22 | # * 533 - GeoLite Legacy City 23 | #EditionIDs GeoLite2-Country GeoLite2-City 24 | 25 | # `AccountID` is from your MaxMind account. 26 | AccountID <> 27 | 28 | # `LicenseKey` is from your MaxMind account 29 | LicenseKey <> 30 | 31 | # `EditionIDs` is from your MaxMind account. 32 | EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country 33 | -------------------------------------------------------------------------------- /tests/UnitMissingServiceTests/MaxMindGeoLite2TestBase.php: -------------------------------------------------------------------------------- 1 | l = $this->getMockBuilder('OCP\IL10N')->getMock(); 23 | $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); 24 | $this->l->method('t')->will( 25 | $this->returnCallback([$this,'callbackLTJustRouteThrough'])); 26 | $tmp_config = $this->getMockBuilder('OCP\IConfig')->getMock(); 27 | $this->config = $this->getMockBuilder( 28 | 'OCA\GeoBlocker\Config\GeoBlockerConfig')->setConstructorArgs( 29 | [$tmp_config])->getMock(); 30 | } 31 | 32 | public function callbackLTJustRouteThrough(string $in): string { 33 | return $in; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/Command/LocalizationService/SelectService.php: -------------------------------------------------------------------------------- 1 | ls_factory = $ls_factory; 22 | } 23 | 24 | protected function configure(): void { 25 | $this->setName('geoblocker:localization-service:select-service')->setDescription( 26 | 'Select the location service, that is used to determine the country code.')->addArgument( 27 | 'service_id', InputArgument::REQUIRED, 28 | 'The ID of the localization service to be used.'); 29 | } 30 | 31 | protected function execute(InputInterface $input, OutputInterface $output): int { 32 | $service_id = intval($input->getArgument('service_id')); 33 | 34 | $this->ls_factory->setCurrentLocationServiceID($service_id); 35 | 36 | return 0; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/Command/LocalizationService/ListServices.php: -------------------------------------------------------------------------------- 1 | ls_factory = $ls_factory; 21 | } 22 | 23 | protected function configure(): void { 24 | $this->setName('geoblocker:localization-service:list-services')->setDescription( 25 | 'List the IDs of the localization services.'); 26 | } 27 | 28 | protected function execute(InputInterface $input, OutputInterface $output): int { 29 | $info_string = "\n"; 30 | $i = 0; 31 | foreach ($this->ls_factory->getLocationServiceOverview() as $key => $value) { 32 | $info_string .= strval($i). ": "; 33 | $info_string .= $key; 34 | if ($value) { 35 | $info_string .= " [Active]"; 36 | } 37 | $info_string .= "\n"; 38 | ++$i; 39 | } 40 | $info_string .= ""; 41 | $output->writeln($info_string); 42 | return 0; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/LocalizationServices/ILocalizationService.php: -------------------------------------------------------------------------------- 1 | l = $l; 17 | $this->url=$url; 18 | } 19 | /** 20 | * returns the ID of the section. 21 | * It is supposed to be a lower case string 22 | * 23 | * @returns string 24 | */ 25 | public function getID() { 26 | return 'geoblocker'; // or a generic id if feasible 27 | } 28 | 29 | /** 30 | * returns the translated name as it should be displayed, e.g. 31 | * 'LDAP / AD 32 | * integration'. Use the L10N service to translate it. 33 | * 34 | * @return string 35 | */ 36 | public function getName() { 37 | return $this->l->t('GeoBlocker'); 38 | } 39 | 40 | /** 41 | * 42 | * @return int whether the form should be rather on the top or bottom of 43 | * the settings navigation. The sections are arranged in ascending order of 44 | * the priority values. It is required to return a value between 0 and 99. 45 | */ 46 | public function getPriority() { 47 | return 50; 48 | } 49 | 50 | public function getIcon() { 51 | return $this->url->imagePath('geoblocker', 'blocking-dark.svg'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tests/Unit/LocalizationServices/DummyTest.php: -------------------------------------------------------------------------------- 1 | l = $this->getMockBuilder('OCP\IL10N')->getMock(); 18 | $this->l->method('t')->will( 19 | $this->returnCallback( 20 | [$this,'callbackLTJustRouteThrough'])); 21 | $this->dummy = new Dummy($this->l); 22 | } 23 | 24 | public function testIsStatusOk() { 25 | $this->assertTrue($this->dummy->getStatus()); 26 | } 27 | 28 | public function testIsStatusStringOk() { 29 | $this->assertStringStartsWith('"Dummy": OK. This service always returns', $this->dummy->getStatusString()); 30 | } 31 | 32 | /** 33 | * 34 | * @dataProvider ipProvider 35 | */ 36 | public function testIsCountryCodeOk(string $ip_address) { 37 | $this->assertEquals('AA', $this->dummy->getCountryCodeFromIP($ip_address)); 38 | } 39 | 40 | public function callbackLTJustRouteThrough(string $in): string { 41 | return $in; 42 | } 43 | 44 | public function ipProvider(): array { 45 | return [ ['2a02:2e0:3fe:1001:302::'], 46 | ['24.165.23.67'], 47 | ['asdfes'], 48 | ['2342552'], 49 | ['24.165.523.67'],]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /helper_scripts/create_countries.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #cat cl_start.txt | awk 'NF > 0' | awk -F '\t' 'BEGIN{print "\n\n"}' > "../templates/countries.php" 3 | #cat cl_start.txt | awk 'NF > 0' | awk -F '\t' 'BEGIN{print "\n\n"}' > "../templates/countries.php" 4 | cat cl_start.txt | awk 'NF > 0' | awk -F '\t' 'BEGIN{print "\n\n"}' > "../templates/countries.php" 5 | -------------------------------------------------------------------------------- /appinfo/routes.php: -------------------------------------------------------------------------------- 1 | [ 5 | ['name' => 'service#status','url' => '/service/status/{id}', 6 | 'verb' => 'GET'], 7 | ['name' => 'service#hasDatabaseDate', 8 | 'url' => '/service/hasDatabaseDate/{id}','verb' => 'GET'], 9 | ['name' => 'service#getDatabaseDate', 10 | 'url' => '/service/getDatabaseDate/{id}','verb' => 'GET'], 11 | ['name' => 'service#hasConfigurationOption', 12 | 'url' => '/service/hasConfigurationOption/{id}','verb' => 'GET'], 13 | ['name' => 'service#hasDatabaseFileLocation', 14 | 'url' => '/service/hasDatabaseFileLocation/{id}','verb' => 'GET'], 15 | ['name' => 'service#getDatabaseFileLocation', 16 | 'url' => '/service/getDatabaseFileLocation/{id}','verb' => 'GET'], 17 | ['name' => 'service#getUniqueServiceString', 18 | 'url' => '/service/getUniqueServiceString/{id}','verb' => 'GET'], 19 | ['name' => 'service#hasDatabaseUpdate', 20 | 'url' => '/service/hasDatabaseUpdate/{id}','verb' => 'GET'], 21 | ['name' => 'service#updateDatabase', 22 | 'url' => '/service/updateDatabase/{id}','verb' => 'GET'], 23 | ['name' => 'service#getDatabaseUpdateStatus', 24 | 'url' => '/service/getDatabaseUpdateStatus/{id}','verb' => 'GET'], 25 | ['name' => 'service#getDatabaseUpdateStatusString', 26 | 'url' => '/service/getDatabaseUpdateStatusString/{id}', 27 | 'verb' => 'GET'], 28 | ['name' => 'service#getAllServiceData', 29 | 'url' => '/service/getAllServiceData/{id}', 30 | 'verb' => 'GET']]]; 31 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Lint 3 | 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: [ master ] 8 | pull_request: 9 | branches: [ master ] 10 | 11 | jobs: 12 | Markdown: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - name: Markdown Linting Action 19 | uses: avto-dev/markdown-lint@v1.5.0 20 | #uses: docker://avtodev/markdown-lint:v1.3.1 21 | with: 22 | config: .github/lint/markdown-lint.yml 23 | args: '*.md' 24 | 25 | php: 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | matrix: 30 | php-versions: ['8.0', '8.1', '8.2'] 31 | 32 | name: php${{ matrix.php-versions }} lint 33 | steps: 34 | - uses: actions/checkout@v3 35 | - name: Set up php${{ matrix.php-versions }} 36 | uses: shivammathur/setup-php@v2 37 | with: 38 | php-version: ${{ matrix.php-versions }} 39 | coverage: none 40 | - name: Lint 41 | run: composer run lint 42 | 43 | # php-cs-fixer: 44 | # name: php-cs check 45 | # runs-on: ubuntu-latest 46 | # steps: 47 | # - name: Checkout 48 | # uses: actions/checkout@master 49 | # - name: Set up php 50 | # uses: shivammathur/setup-php@master 51 | # with: 52 | # php-version: 7.4 53 | # coverage: none 54 | # - name: Install dependencies 55 | # run: composer i 56 | # - name: Run coding standards check 57 | # run: composer run cs:check 58 | 59 | #- name: GitHub Action for PHPUnit 60 | # uses: owenvoke/phpunit-action@v1.0.0 61 | # with: 62 | # command: phpunit.all.xml 63 | -------------------------------------------------------------------------------- /lib/LocalizationServices/IDatabaseUpdate.php: -------------------------------------------------------------------------------- 1 | userSession = $userSession; 26 | $this->logger = $logger; 27 | $this->request = $request; 28 | $this->config = new GeoBlockerConfig($config); 29 | $this->l = $l; 30 | $this->db = $db; 31 | } 32 | 33 | public function register() { 34 | $callback_pre_login = function (string $user) { 35 | $this->checkGeoIpBlocking($user); 36 | }; 37 | $this->userSession->listen('\OC\User', 'preLogin', $callback_pre_login); 38 | } 39 | 40 | private function checkGeoIpBlocking($user) { 41 | if ($this->config->getDoFakeAddress() && $this->config->getFakeAddressUser() == $user) { 42 | $ip_address = $this->config->getFakeAddress(); 43 | $this->config->setDoFakeAddress(false); 44 | } else { 45 | $ip_address = $this->request->getRemoteAddress(); 46 | } 47 | 48 | $location_service_factory = new LocalizationServiceFactory( 49 | $this->config, $this->l, $this->db, $this->logger); 50 | $location_service = $location_service_factory->getLocationService(); 51 | $geoblocker = new GeoBlocker($user, $this->logger, $this->config, 52 | $this->l, $location_service); 53 | $geoblocker->blockIpAddress($ip_address); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/Unit/Db/RIRServiceMapperTest.php: -------------------------------------------------------------------------------- 1 | db = $this->getMockBuilder('OCP\IDBConnection')->getMock(); 18 | $this->rir_service_mapper = new RIRServiceMapper($this->db); 19 | } 20 | 21 | public function testIsIpv6String2Int64Correct() { 22 | $ip = "::"; 23 | $this->assertEquals(-9223372036854775808, RIRServiceMapper::ipv6String2Int64($ip)); 24 | 25 | $ip = "0:0:0:0::"; 26 | $this->assertEquals(-9223372036854775808, RIRServiceMapper::ipv6String2Int64($ip)); 27 | 28 | $ip = "ffff:ffff:ffff:ffff::"; 29 | $this->assertEquals(9223372036854775807, RIRServiceMapper::ipv6String2Int64($ip)); 30 | 31 | $ip = "7fff:ffff:ffff:ffff::"; 32 | $this->assertEquals(-1, RIRServiceMapper::ipv6String2Int64($ip)); 33 | 34 | $ip = "8000:0:0:0::"; 35 | $this->assertEquals(0, RIRServiceMapper::ipv6String2Int64($ip)); 36 | } 37 | 38 | public function testIsIpv6String2Int64Correct2() { 39 | $ip = "1::"; 40 | $ip2 = "0:0:0:1::"; 41 | 42 | $this->assertNotEquals(RIRServiceMapper::ipv6String2Int64($ip2), RIRServiceMapper::ipv6String2Int64($ip)); 43 | 44 | $ip = "ABCD:1234:4312:DBCA::"; 45 | $ip2 = "ABCD:1234:4312:DBCA:FFFF:EEEE:1111:5555"; 46 | 47 | $this->assertEquals(RIRServiceMapper::ipv6String2Int64($ip2), RIRServiceMapper::ipv6String2Int64($ip)); 48 | 49 | $ip = "0:0:0:1::"; 50 | $ip2 = "0:0:0:0001::"; 51 | 52 | $this->assertEquals(RIRServiceMapper::ipv6String2Int64($ip2), RIRServiceMapper::ipv6String2Int64($ip)); 53 | } 54 | 55 | public function callbackLTJustRouteThrough(string $in): string { 56 | return $in; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Migration/Version000300Date20200413202844.php: -------------------------------------------------------------------------------- 1 | hasTable('geoblocker_ls_rir')) { 43 | $table = $schema->createTable('geoblocker_ls_rir'); 44 | $table->addColumn('id', 'integer', 45 | ['autoincrement' => true,'notnull' => true]); 46 | $table->addColumn('begin_ip_range', 'bigint', ['notnull' => true]); 47 | $table->addColumn('length_ip_range', 'bigint', ['notnull' => true]); 48 | $table->addColumn('is_ip_v6', 'boolean', ['notnull' => false]); 49 | $table->addColumn('country_code', 'string', 50 | ['notnull' => true,'length' => 2]); 51 | $table->addColumn('version', 'integer', ['notnull' => true]); 52 | 53 | $table->setPrimaryKey(['id']); 54 | } 55 | return $schema; 56 | } 57 | 58 | /** 59 | * 60 | * @param IOutput $output 61 | * @param Closure $schemaClosure 62 | * The `\Closure` returns a `ISchemaWrapper` 63 | * @param array $options 64 | */ 65 | public function postSchemaChange(IOutput $output, Closure $schemaClosure, 66 | array $options) { 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /img/blocking.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 51 | 57 | 63 | 71 | 72 | -------------------------------------------------------------------------------- /img/blocking-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 29 | 31 | 51 | 57 | 63 | 71 | 72 | -------------------------------------------------------------------------------- /lib/Settings/Admin.php: -------------------------------------------------------------------------------- 1 | config = $config; 31 | $this->logger = $logger; 32 | $this->request = $request; 33 | $this->user_session = $user_session; 34 | $this->l = $l; 35 | $this->db = $db; 36 | } 37 | public function getForm() { 38 | $response = new TemplateResponse('geoblocker', 'admin'); 39 | $localizationServiceFactory = new LocalizationServiceFactory( 40 | $this->config, $this->l, $this->db, $this->logger); 41 | $response->setParams( 42 | ['logWithIpAddress' => $this->config->getLogWithIpAddress(), 43 | 'logWithCountryCode' => $this->config->getLogWithCountryCode(), 44 | 'logWithUserName' => $this->config->getLogWithUserName(), 45 | 'countryList' => $this->config->getChoosenCountriesByString(), 46 | 'chosenBlackWhiteList' => $this->config->getUseWhiteListing(), 47 | 'ipAddress' => $this->request->getRemoteAddress(), 48 | 'doFakeAddress' => $this->config->getDoFakeAddress(), 49 | 'userID' => $this->user_session->getUser()->getUID(), 50 | 'fakeAddress' => $this->config->getFakeAddress(), 51 | 'chosenService' => $this->config->getChosenService(), 52 | 'delayIpAddress' => $this->config->getDelayIpAddress(), 53 | 'blockIpAddress' => $this->config->getBlockIpAddress() || $this->config->getBlockIpAddressBefore(), 54 | 'localizationServiceFactory' => $localizationServiceFactory 55 | ]); 56 | return $response; 57 | } 58 | public function getSection() { 59 | return 'geoblocker'; 60 | } 61 | public function getPriority() { 62 | return 10; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/Integration/RIRServiceMapperDBTest.php: -------------------------------------------------------------------------------- 1 | container = $app->getContainer(); 27 | $this->db = $this->container->get('ServerContainer')->getDatabaseConnection(); 28 | $this->rir_mapper = new RIRServiceMapper($this->db); 29 | } 30 | 31 | public function testDbEntryCycle() { 32 | $this->rir_mapper->eraseAllDatabaseEntries(RIRServiceMapperDBTest::kUsedTestVersion); 33 | $this->assertEquals($this->rir_mapper->getNumberOfEntries(RIRServiceMapperDBTest::kUsedTestVersion), 0); 34 | 35 | $db_entry = new RIRServiceDBEntity(); 36 | $db_entry->setBeginIpRange( 37 | RIRServiceMapper::ipv4String2Int64('24.165.23.0')); 38 | $db_entry->setCountryCode('US'); 39 | $db_entry->setLengthIpRange(256); 40 | $db_entry->setIsIpV6(false); 41 | $db_entry->setVersion(RIRServiceMapperDBTest::kUsedTestVersion); 42 | $this->rir_mapper->insert($db_entry); 43 | 44 | $db_entry = new RIRServiceDBEntity(); 45 | $db_entry->setBeginIpRange( 46 | RIRServiceMapper::ipv6String2Int64('2a02:2e0::')); 47 | $db_entry->setCountryCode('DE'); 48 | $db_entry->setLengthIpRange(pow(2, 64 - intval(29))); 49 | $db_entry->setIsIpV6(true); 50 | $db_entry->setVersion(RIRServiceMapperDBTest::kUsedTestVersion); 51 | $this->rir_mapper->insert($db_entry); 52 | 53 | $this->assertEquals($this->rir_mapper->getNumberOfEntries(RIRServiceMapperDBTest::kUsedTestVersion), 2); 54 | $this->assertEquals($this->rir_mapper->getCountryCodeFromIpv4(RIRServiceMapper::ipv4String2Int64('24.165.23.67'), RIRServiceMapperDBTest::kUsedTestVersion), 'US'); 55 | $this->assertEquals($this->rir_mapper->getCountryCodeFromIpv6(RIRServiceMapper::ipv6String2Int64('2a02:2e0:3fe:1001:302::'), RIRServiceMapperDBTest::kUsedTestVersion), 'DE'); 56 | 57 | $this->rir_mapper->eraseAllDatabaseEntries(RIRServiceMapperDBTest::kUsedTestVersion); 58 | $this->assertEquals($this->rir_mapper->getNumberOfEntries(RIRServiceMapperDBTest::kUsedTestVersion), 0); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /.github/workflows/build-release.yml: -------------------------------------------------------------------------------- 1 | name: Build and publish app release 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | env: 8 | APP_NAME: geoblocker 9 | 10 | jobs: 11 | build_and_publish: 12 | environment: release 13 | runs-on: ubuntu-latest 14 | name: "Release: build, sign and upload the app" 15 | strategy: 16 | matrix: 17 | php-versions: ['8.3'] 18 | nextcloud: ['stable30'] 19 | database: ['sqlite'] 20 | steps: 21 | - name: Checkout 22 | uses: actions/checkout@v3 23 | 24 | - name: Setup PHP 25 | uses: shivammathur/setup-php@v2 26 | with: 27 | php-version: ${{ matrix.php-versions }} 28 | extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip 29 | coverage: none 30 | 31 | - name: Set up server non MySQL 32 | uses: SMillerDev/nextcloud-actions/setup-nextcloud@main 33 | with: 34 | cron: false 35 | version: ${{ matrix.nextcloud }} 36 | database-type: ${{ matrix.database }} 37 | 38 | - name: Prime app build 39 | run: make 40 | 41 | - name: Configure server with app 42 | uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main 43 | with: 44 | app: ${{ env.APP_NAME }} 45 | check-code: false 46 | 47 | - name: Create signed release archive 48 | run: | 49 | cd ../server/apps/${{ env.APP_NAME }} && make appstore2 50 | env: 51 | app_private_key: ${{ secrets.APP_PRIVATE_KEY }} 52 | app_public_crt: ${{ secrets.APP_PUBLIC_CRT }} 53 | 54 | - name: Upload app tarball to release 55 | uses: svenstaro/upload-release-action@master 56 | id: attach_to_release 57 | with: 58 | repo_token: ${{ secrets.GITHUB_TOKEN }} 59 | file: ../server/apps/${{ env.APP_NAME }}/build/artifacts/appstore/${{ env.APP_NAME }}.tar.gz 60 | asset_name: ${{ env.APP_NAME }}.tar.gz 61 | tag: ${{ github.ref }} 62 | overwrite: true 63 | 64 | - name: Upload app to Nextcloud appstore 65 | uses: R0Wi/nextcloud-appstore-push-action@master 66 | with: 67 | app_name: ${{ env.APP_NAME }} 68 | appstore_token: ${{ secrets.APPSTORE_TOKEN }} 69 | download_url: ${{ steps.attach_to_release.outputs.browser_download_url }} 70 | app_private_key: ${{ secrets.APP_PRIVATE_KEY }} 71 | nightly: ${{ github.event.release.prerelease }} 72 | 73 | - name: Delete crt and key from local storage 74 | run: rm -f ~/.nextcloud/certificates/* 75 | -------------------------------------------------------------------------------- /appinfo/info.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | geoblocker 5 | GeoBlocker 6 | Blocks user depending on the estimated country of their IP address. 7 | 21 | 0.5.18 22 | agpl 23 | HomeITAdmin 24 | GeoBlocker 25 | security 26 | https://github.com/HomeITAdmin/nextcloud_geoblocker/ 27 | https://github.com/HomeITAdmin/nextcloud_geoblocker/issues 28 | https://github.com/HomeITAdmin/nextcloud_geoblocker.git 29 | https://raw.githubusercontent.com/HomeITAdmin/nextcloud_geoblocker/master/img/1.PNG 30 | 31 | 32 | 33 | 34 | 35 | 36 | OCA\GeoBlocker\Command\LocalizationService\ResetDB 37 | OCA\GeoBlocker\Command\LocalizationService\UpdateDB 38 | OCA\GeoBlocker\Command\LocalizationService\ListServices 39 | OCA\GeoBlocker\Command\LocalizationService\SelectService 40 | OCA\GeoBlocker\Command\LocalizationService\ResetCountries 41 | 42 | 43 | 44 | OCA\GeoBlocker\Settings\Admin 45 | OCA\GeoBlocker\Settings\AdminSection 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /lib/Db/RIRServiceMapper.php: -------------------------------------------------------------------------------- 1 | db->getQueryBuilder(); 29 | try { 30 | $qb->delete($this->getTableName()); 31 | if ($version >= 0) { 32 | $qb->where($qb->expr()->eq('version', $qb->createNamedParameter(strval($version)))); 33 | } 34 | $qb->execute(); 35 | return true; 36 | } catch (Exception $e) { 37 | return false; 38 | } 39 | } 40 | 41 | public function getCountryCodeFromIpv4(int $ip, int $version): string { 42 | return $this->getCountryCodeIpImpl($ip, '0', $version); 43 | } 44 | 45 | public function getCountryCodeFromIpv6(int $ip, int $version): string { 46 | return $this->getCountryCodeIpImpl($ip, '1', $version); 47 | } 48 | 49 | public function getCountryCodeIpImpl(int $ip, string $is_ip_v6, int $version): string { 50 | $qb = $this->db->getQueryBuilder(); 51 | 52 | $expr1 = $qb->expr()->lte('begin_ip_range', 53 | $qb->createNamedParameter($ip)); 54 | $expr2 = $qb->expr()->eq('is_ip_v6', 55 | $qb->createNamedParameter($is_ip_v6)); 56 | $expr3 = $qb->expr()->eq('version', 57 | $qb->createNamedParameter($version)); 58 | 59 | $qb->select('*')->from($this->getTableName())->where( 60 | $qb->expr()->andX($expr1, $expr2, $expr3)); 61 | 62 | 63 | $qb->setMaxResults(1); 64 | $qb->orderBy('begin_ip_range', 'DESC'); 65 | 66 | try { 67 | $db_entry = $this->findEntity($qb); 68 | if ($ip < 69 | $db_entry->getBeginIpRange() + $db_entry->getLengthIpRange()) { 70 | return $db_entry->getCountryCode(); 71 | } 72 | return GeoBlocker::kCountryNotFoundCode; 73 | } catch (DoesNotExistException $e) { 74 | return GeoBlocker::kCountryNotFoundCode; 75 | } 76 | } 77 | 78 | public function getNumberOfEntries(int $version = -1): int { 79 | $qb = $this->db->getQueryBuilder(); 80 | $qb->selectAlias($qb->func()->count('*'),'count')->from($this->getTableName()); 81 | if ($version >= 0) { 82 | $qb->where($qb->expr()->eq('version', $qb->createNamedParameter(strval($version)))); 83 | } 84 | $res = $this->findOneQuery($qb); 85 | return intval($res['count']); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/Command/LocalizationService/ResetDB.php: -------------------------------------------------------------------------------- 1 | ls_factory = $ls_factory; 28 | $this->logger = $logger; 29 | } 30 | 31 | protected function configure(): void { 32 | $this->setName('geoblocker:localization-service:reset-db')->setDescription( 33 | 'Reset the database for the given localization service.')->addArgument( 34 | 'service_id', InputArgument::OPTIONAL, 35 | 'The ID of the localization service, whose database will be reset. If not given the current service will be used.'); 36 | } 37 | 38 | protected function execute(InputInterface $input, OutputInterface $output): int { 39 | $this->output = $output; 40 | if ($input->getArgument('service_id') == null) { 41 | $service_id = $this->ls_factory->getCurrentLocationServiceID(); 42 | } else { 43 | $service_id = intval($input->getArgument('service_id')); 44 | } 45 | 46 | if (! $this->ls_factory->hasDatabaseUpdateByID($service_id)) { 47 | $this->logError('The database of this service cannot be reset.'); 48 | } else { 49 | $this->logInfo('Starting reset of the database.'); 50 | $loc_service = $this->ls_factory->getLocationServiceByID($service_id); 51 | if ($loc_service->resetDatabase()) { 52 | if ($loc_service->getDatabaseUpdateStatus() == 53 | LocationServiceUpdateStatus::kUpdatePossible && 54 | ! $loc_service->getStatus()) { 55 | $this->logInfo('Reset was successful.'); 56 | } else { 57 | $this->logError('There was a problem when reseting the database. Service is not in correct status.'); 58 | } 59 | } else { 60 | $this->logError('There was a problem when reseting the database. Reset function returned false.'); 61 | } 62 | } 63 | 64 | return 0; 65 | } 66 | 67 | private function logInfo(string $info) { 68 | $this->output->writeln('' . $info . ''); 69 | $this->logger->info($info, ['app' => 'geoblocker']); 70 | } 71 | 72 | private function logError(string $error) { 73 | $this->output->writeln('ERROR: ' . $error . ''); 74 | $this->logger->error($error, ['app' => 'geoblocker']); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/Command/LocalizationService/UpdateDB.php: -------------------------------------------------------------------------------- 1 | ls_factory = $ls_factory; 28 | $this->logger = $logger; 29 | } 30 | 31 | protected function configure(): void { 32 | $this->setName('geoblocker:localization-service:update-db')->setDescription( 33 | 'Update the database for the given localization service.')->addArgument( 34 | 'service_id', InputArgument::OPTIONAL, 35 | 'The ID of the localization service, whose database will be updated. If not given the current service will be used.'); 36 | } 37 | 38 | protected function execute(InputInterface $input, OutputInterface $output): int { 39 | $this->output = $output; 40 | if ($input->getArgument('service_id') == null) { 41 | $service_id = $this->ls_factory->getCurrentLocationServiceID(); 42 | } else { 43 | $service_id = intval($input->getArgument('service_id')); 44 | } 45 | 46 | if (! $this->ls_factory->hasDatabaseUpdateByID($service_id)) { 47 | $this->logError('The database of this service cannot be updated.'); 48 | } else { 49 | $this->logInfo('Starting update of the database. This may take very long.'); 50 | $loc_service = $this->ls_factory->getLocationServiceByID($service_id); 51 | if ($loc_service->updateDatabase()) { 52 | if ($loc_service->getDatabaseUpdateStatus() == 53 | LocationServiceUpdateStatus::kUpdatePossible && 54 | $loc_service->getStatus()) { 55 | $this->logInfo('Update was successful.'); 56 | } else { 57 | $this->logError('There was a problem when updating the database. Service is not in the correct status afterwards.'); 58 | } 59 | } else { 60 | $this->logError('There was a problem when updating the database. Update function returned false. Update Status: ' . $loc_service->getDatabaseUpdateStatusString()); 61 | } 62 | } 63 | 64 | return 0; 65 | } 66 | 67 | private function logInfo(string $info) { 68 | $this->output->writeln('' . $info . ''); 69 | $this->logger->info($info, ['app' => 'geoblocker']); 70 | } 71 | 72 | private function logError(string $error) { 73 | $this->output->writeln('ERROR: ' . $error . ''); 74 | $this->logger->error($error, ['app' => 'geoblocker']); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/LocalizationServices/GeoIPLookup.php: -------------------------------------------------------------------------------- 1 | cmd_wrapper = $cmd_wrapper; 17 | $this->l = $l; 18 | } 19 | 20 | public function getStatus(): bool { 21 | $output = []; 22 | $return_val = 0; 23 | $return_val2 = 0; 24 | $location_raw1 = $this->cmd_wrapper->geoiplookup('127.0.0.1', $output, 25 | $return_val); 26 | $location_raw2 = $this->cmd_wrapper->geoiplookup6('fe80::', $output, 27 | $return_val2); 28 | if ($return_val == 0 && $return_val2 == 0) { 29 | if (strpos($location_raw1, 'IP Address not found') !== false && 30 | strpos($location_raw2, 'IP Address not found') !== false) { 31 | return true; 32 | } else { 33 | return false; 34 | } 35 | } else { 36 | return false; 37 | } 38 | } 39 | 40 | public function getStatusString(): string { 41 | $service_string = '"Geoiplookup": '; 42 | if ($this->getStatus() === true) { 43 | return $service_string . $this->l->t('OK.'); 44 | } else { 45 | return $service_string . 46 | $this->l->t( 47 | 'ERROR: Service seem to be not installed on the host of the Nextcloud server or not reachable for the web server or is wrongly configured (is the database for IPv4 and IPv6 available?!). Maybe the use of the php function exec() is disabled in the php.ini.'); 48 | } 49 | } 50 | 51 | public function getCountryCodeFromIP($ip_address): string { 52 | $output = []; 53 | $return_val = 0; 54 | $location = ""; 55 | 56 | if (! $this->getStatus()) { 57 | return 'UNAVAILABLE'; 58 | } 59 | 60 | if (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { 61 | $location_raw = $this->cmd_wrapper->geoiplookup($ip_address, $output, 62 | $return_val); 63 | } elseif (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { 64 | $location_raw = $this->cmd_wrapper->geoiplookup6($ip_address, 65 | $output, $return_val); 66 | } else { 67 | return 'INVALID_IP'; 68 | } 69 | 70 | if ($return_val != 0) { 71 | $location = 'UNAVAILABLE'; 72 | } elseif (strpos($location_raw, 'IP Address not found') !== false) { 73 | $location = GeoBlocker::kCountryNotFoundCode; 74 | } else { 75 | $matches = []; 76 | foreach ($output as $line) { 77 | $match = []; 78 | $count_matches = preg_match('/^GeoIP Country .*Edition: (..),.*/', 79 | $line, $match); 80 | if ($count_matches > 0) { 81 | $matches[] = $match[1]; 82 | } 83 | } 84 | if (count($matches) != 1) { 85 | $location = 'UNAVAILABLE'; 86 | } else { 87 | $location = $matches[0]; 88 | } 89 | } 90 | return $location; 91 | } 92 | 93 | public function getDatabaseDate(): string { 94 | $output = []; 95 | $return_val = 0; 96 | $date_string = $this->l->t("Date of the database cannot be determined!"); 97 | 98 | $this->cmd_wrapper->getFullDateString($output, $return_val); 99 | 100 | if ($return_val == 0) { 101 | $matches = []; 102 | foreach ($output as $line) { 103 | $match = []; 104 | $count_matches = preg_match( 105 | '/^GeoIP Country .*Edition.*(\d{8}).*/', $line, 106 | $match); 107 | if ($count_matches > 0) { 108 | $matches[] = $match[1]; 109 | } 110 | } 111 | if (count($matches) > 0) { 112 | $split = str_split(min($matches), 2); 113 | $date_string = $split[0] . $split[1] . '-' . $split[2] . '-' . 114 | $split[3]; 115 | } 116 | } 117 | return $date_string; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /l10n/sq.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "OK" : "OK", 3 | "Loading" : "Duke ngarkuar", 4 | "Andorra" : "Andorra", 5 | "United Arab Emirates" : "Emiratet e Bashkuara Arabe", 6 | "Afghanistan" : "Afganistani", 7 | "Antigua and Barbuda" : "Antigua and Barbuda", 8 | "Anguilla" : "Anguilla", 9 | "Albania" : "Shqipëria", 10 | "Armenia" : "Armenia", 11 | "Angola" : "Angola", 12 | "Antarctica" : "Antarktiku", 13 | "Argentina" : "Argjentina", 14 | "American Samoa" : "Samoa Amerikane", 15 | "Austria" : "Austria", 16 | "Australia" : "Australia", 17 | "Aruba" : "Aruba", 18 | "Åland Islands" : "Ishujt Oland", 19 | "Azerbaijan" : "Azerbajxhani", 20 | "Bosnia and Herzegovina" : "Bosnja and Hercegovina", 21 | "Barbados" : "Barbados", 22 | "Bangladesh" : "Bangladesh", 23 | "Belgium" : "Belgjika", 24 | "Burkina Faso" : "Burkina Faso", 25 | "Bulgaria" : "Bullgaria", 26 | "Bahrain" : "Bahrein", 27 | "Burundi" : "Burundi", 28 | "Benin" : "Benin", 29 | "Bermuda" : "Bermuda", 30 | "Brazil" : "Brazil", 31 | "Bahamas" : "Bahamas", 32 | "Bhutan" : "Butani", 33 | "Botswana" : "Botsvana", 34 | "Belarus" : "Bjellorusi", 35 | "Belize" : "Belize", 36 | "Canada" : "Kanada", 37 | "Congo" : "Kongo", 38 | "Switzerland" : "Zvicër", 39 | "Côte d'Ivoire" : "Bregu i Fildishtë", 40 | "Chile" : "Kili", 41 | "Cameroon" : "Kamerun", 42 | "China" : "Kina", 43 | "Colombia" : "Kolumbi", 44 | "Cuba" : "Kubë", 45 | "Cabo Verde" : "Kepi i Gjelbër", 46 | "Cyprus" : "Qipro", 47 | "Germany" : "Gjermani", 48 | "Denmark" : "Danimarkë", 49 | "Algeria" : "Algjeria", 50 | "Ecuador" : "Ekuadori", 51 | "Estonia" : "Estonia", 52 | "Egypt" : "Egjipt", 53 | "Eritrea" : "Eritrea", 54 | "Spain" : "Spanja", 55 | "Ethiopia" : "Etiopia", 56 | "Finland" : "Finlanda", 57 | "Fiji" : "Fixhi", 58 | "France" : "Franca", 59 | "Gabon" : "Gabon", 60 | "United Kingdom of Great Britain and Northern Ireland" : "Mbretëria e Bashkuar e Britanisë së Madhe dhe Irlandës Veriore", 61 | "Georgia" : "Gjeorgji", 62 | "Ghana" : "Gana", 63 | "Gibraltar" : "Gjibraltar", 64 | "Gambia" : "Gambia", 65 | "Guinea" : "Guinea", 66 | "Greece" : "Greqi", 67 | "Guatemala" : "Guatemala", 68 | "Honduras" : "Honduras", 69 | "Croatia" : "Kroaci", 70 | "Haiti" : "Haiti", 71 | "Hungary" : "Hungari", 72 | "Indonesia" : "Indonezia", 73 | "Ireland" : "Irlanda", 74 | "Israel" : "Izraeli", 75 | "India" : "India", 76 | "Iraq" : "Irak", 77 | "Iceland" : "Islanda", 78 | "Italy" : "Itali", 79 | "Jamaica" : "Xhamaika", 80 | "Jordan" : "Jordani", 81 | "Japan" : "Japoni", 82 | "Kenya" : "Kenia", 83 | "Cambodia" : "Kamboxhia", 84 | "Kiribati" : "Kiribati", 85 | "Kuwait" : "Kuvajti", 86 | "Kazakhstan" : "Kazakistani", 87 | "Lebanon" : "Lebanon", 88 | "Sri Lanka" : "Sri Lanka", 89 | "Liberia" : "Liberia", 90 | "Lithuania" : "Lituania", 91 | "Luxembourg" : "Luksemburgu", 92 | "Libya" : "Libia", 93 | "Morocco" : "Maroku", 94 | "Montenegro" : "Mali i Zi", 95 | "Mali" : "Mali", 96 | "Mongolia" : "Mongolia", 97 | "Malta" : "Malta", 98 | "Mexico" : "Meksikë", 99 | "Niger" : "Niger", 100 | "Nigeria" : "Nigeria", 101 | "Nicaragua" : "Nikaragua", 102 | "Netherlands" : "Hollandë", 103 | "Norway" : "Norvegji", 104 | "Nepal" : "Nepal", 105 | "New Zealand" : "Zelanda e Re", 106 | "Oman" : "Oman", 107 | "Panama" : "Panama", 108 | "Peru" : "Peru", 109 | "Pakistan" : "Pakistan", 110 | "Poland" : "Poloni", 111 | "Puerto Rico" : "Puerto Riko", 112 | "Portugal" : "Portugali", 113 | "Paraguay" : "Paraguaj", 114 | "Qatar" : "Qatar", 115 | "Romania" : "Rumania", 116 | "Serbia" : "Serbi", 117 | "Russian Federation" : "Federata Ruse", 118 | "Saudi Arabia" : "Arabia Saudite", 119 | "Sudan" : "Sudan", 120 | "Sweden" : "Suedi", 121 | "Singapore" : "Singapori", 122 | "Slovenia" : "Sllovenia", 123 | "Slovakia" : "Sllovakia", 124 | "Sierra Leone" : "Sierra Leone", 125 | "San Marino" : "San Marino", 126 | "Senegal" : "Senegali", 127 | "Somalia" : "Somalia", 128 | "Syrian Arab Republic" : "Republika Arabe e Sirisë", 129 | "Chad" : "Çad", 130 | "Togo" : "Togo", 131 | "Thailand" : "Tajlanda", 132 | "Tajikistan" : "Taxhikistan", 133 | "Turkmenistan" : "Turkmenistan", 134 | "Tunisia" : "Tunizia", 135 | "Tonga" : "Tonga", 136 | "Turkey" : "Turqi", 137 | "Ukraine" : "Ukrainë", 138 | "Uganda" : "Uganda", 139 | "United States of America" : "Shtetet e Bashkuara të Amerikës", 140 | "Uruguay" : "Uruguaj", 141 | "Zambia" : "Zambia" 142 | },"pluralForm" :"nplurals=2; plural=(n != 1);" 143 | } -------------------------------------------------------------------------------- /l10n/sq.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "geoblocker", 3 | { 4 | "OK" : "OK", 5 | "Loading" : "Duke ngarkuar", 6 | "Andorra" : "Andorra", 7 | "United Arab Emirates" : "Emiratet e Bashkuara Arabe", 8 | "Afghanistan" : "Afganistani", 9 | "Antigua and Barbuda" : "Antigua and Barbuda", 10 | "Anguilla" : "Anguilla", 11 | "Albania" : "Shqipëria", 12 | "Armenia" : "Armenia", 13 | "Angola" : "Angola", 14 | "Antarctica" : "Antarktiku", 15 | "Argentina" : "Argjentina", 16 | "American Samoa" : "Samoa Amerikane", 17 | "Austria" : "Austria", 18 | "Australia" : "Australia", 19 | "Aruba" : "Aruba", 20 | "Åland Islands" : "Ishujt Oland", 21 | "Azerbaijan" : "Azerbajxhani", 22 | "Bosnia and Herzegovina" : "Bosnja and Hercegovina", 23 | "Barbados" : "Barbados", 24 | "Bangladesh" : "Bangladesh", 25 | "Belgium" : "Belgjika", 26 | "Burkina Faso" : "Burkina Faso", 27 | "Bulgaria" : "Bullgaria", 28 | "Bahrain" : "Bahrein", 29 | "Burundi" : "Burundi", 30 | "Benin" : "Benin", 31 | "Bermuda" : "Bermuda", 32 | "Brazil" : "Brazil", 33 | "Bahamas" : "Bahamas", 34 | "Bhutan" : "Butani", 35 | "Botswana" : "Botsvana", 36 | "Belarus" : "Bjellorusi", 37 | "Belize" : "Belize", 38 | "Canada" : "Kanada", 39 | "Congo" : "Kongo", 40 | "Switzerland" : "Zvicër", 41 | "Côte d'Ivoire" : "Bregu i Fildishtë", 42 | "Chile" : "Kili", 43 | "Cameroon" : "Kamerun", 44 | "China" : "Kina", 45 | "Colombia" : "Kolumbi", 46 | "Cuba" : "Kubë", 47 | "Cabo Verde" : "Kepi i Gjelbër", 48 | "Cyprus" : "Qipro", 49 | "Germany" : "Gjermani", 50 | "Denmark" : "Danimarkë", 51 | "Algeria" : "Algjeria", 52 | "Ecuador" : "Ekuadori", 53 | "Estonia" : "Estonia", 54 | "Egypt" : "Egjipt", 55 | "Eritrea" : "Eritrea", 56 | "Spain" : "Spanja", 57 | "Ethiopia" : "Etiopia", 58 | "Finland" : "Finlanda", 59 | "Fiji" : "Fixhi", 60 | "France" : "Franca", 61 | "Gabon" : "Gabon", 62 | "United Kingdom of Great Britain and Northern Ireland" : "Mbretëria e Bashkuar e Britanisë së Madhe dhe Irlandës Veriore", 63 | "Georgia" : "Gjeorgji", 64 | "Ghana" : "Gana", 65 | "Gibraltar" : "Gjibraltar", 66 | "Gambia" : "Gambia", 67 | "Guinea" : "Guinea", 68 | "Greece" : "Greqi", 69 | "Guatemala" : "Guatemala", 70 | "Honduras" : "Honduras", 71 | "Croatia" : "Kroaci", 72 | "Haiti" : "Haiti", 73 | "Hungary" : "Hungari", 74 | "Indonesia" : "Indonezia", 75 | "Ireland" : "Irlanda", 76 | "Israel" : "Izraeli", 77 | "India" : "India", 78 | "Iraq" : "Irak", 79 | "Iceland" : "Islanda", 80 | "Italy" : "Itali", 81 | "Jamaica" : "Xhamaika", 82 | "Jordan" : "Jordani", 83 | "Japan" : "Japoni", 84 | "Kenya" : "Kenia", 85 | "Cambodia" : "Kamboxhia", 86 | "Kiribati" : "Kiribati", 87 | "Kuwait" : "Kuvajti", 88 | "Kazakhstan" : "Kazakistani", 89 | "Lebanon" : "Lebanon", 90 | "Sri Lanka" : "Sri Lanka", 91 | "Liberia" : "Liberia", 92 | "Lithuania" : "Lituania", 93 | "Luxembourg" : "Luksemburgu", 94 | "Libya" : "Libia", 95 | "Morocco" : "Maroku", 96 | "Montenegro" : "Mali i Zi", 97 | "Mali" : "Mali", 98 | "Mongolia" : "Mongolia", 99 | "Malta" : "Malta", 100 | "Mexico" : "Meksikë", 101 | "Niger" : "Niger", 102 | "Nigeria" : "Nigeria", 103 | "Nicaragua" : "Nikaragua", 104 | "Netherlands" : "Hollandë", 105 | "Norway" : "Norvegji", 106 | "Nepal" : "Nepal", 107 | "New Zealand" : "Zelanda e Re", 108 | "Oman" : "Oman", 109 | "Panama" : "Panama", 110 | "Peru" : "Peru", 111 | "Pakistan" : "Pakistan", 112 | "Poland" : "Poloni", 113 | "Puerto Rico" : "Puerto Riko", 114 | "Portugal" : "Portugali", 115 | "Paraguay" : "Paraguaj", 116 | "Qatar" : "Qatar", 117 | "Romania" : "Rumania", 118 | "Serbia" : "Serbi", 119 | "Russian Federation" : "Federata Ruse", 120 | "Saudi Arabia" : "Arabia Saudite", 121 | "Sudan" : "Sudan", 122 | "Sweden" : "Suedi", 123 | "Singapore" : "Singapori", 124 | "Slovenia" : "Sllovenia", 125 | "Slovakia" : "Sllovakia", 126 | "Sierra Leone" : "Sierra Leone", 127 | "San Marino" : "San Marino", 128 | "Senegal" : "Senegali", 129 | "Somalia" : "Somalia", 130 | "Syrian Arab Republic" : "Republika Arabe e Sirisë", 131 | "Chad" : "Çad", 132 | "Togo" : "Togo", 133 | "Thailand" : "Tajlanda", 134 | "Tajikistan" : "Taxhikistan", 135 | "Turkmenistan" : "Turkmenistan", 136 | "Tunisia" : "Tunizia", 137 | "Tonga" : "Tonga", 138 | "Turkey" : "Turqi", 139 | "Ukraine" : "Ukrainë", 140 | "Uganda" : "Uganda", 141 | "United States of America" : "Shtetet e Bashkuara të Amerikës", 142 | "Uruguay" : "Uruguaj", 143 | "Zambia" : "Zambia" 144 | }, 145 | "nplurals=2; plural=(n != 1);"); 146 | -------------------------------------------------------------------------------- /lib/LocalizationServices/LocalizationServiceFactory.php: -------------------------------------------------------------------------------- 1 | l = $l; 30 | $this->config = $config; 31 | $this->logger = $logger; 32 | $this->db = $db; 33 | } 34 | 35 | public function getCurrentLocationServiceID(): int { 36 | return intval($this->config->getChosenService()); 37 | } 38 | 39 | public function setCurrentLocationServiceID(int $id) { 40 | if ($id >= 0 and $id < $this->count_ids) { 41 | return $this->config->setChosenService(strval($id)); 42 | } else { 43 | throw new OutOfRangeException('Invalid location service ID.'); 44 | } 45 | } 46 | 47 | public function getLocationService() { 48 | return $this->getLocationServiceByID( 49 | $this->getCurrentLocationServiceID()); 50 | } 51 | 52 | public function getLocationServiceByID(int $id) { 53 | switch ($id) { 54 | case '0': 55 | $location_service = new GeoIPLookup(new GeoIPLookupCmdWrapper(), 56 | $this->l); 57 | break; 58 | case '1': 59 | $location_service = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 60 | break; 61 | case '2': 62 | $location_service = new RIRData(new RIRDataChecks(), new RIRServiceMapper($this->db), $this->config, 63 | $this->l, $this->logger); 64 | break; 65 | case '3': 66 | $location_service = new Dummy($this->l); 67 | break; 68 | // Add new location Service here and increase $count_ids 69 | default: 70 | $location_service = new Dummy($this->l); 71 | } 72 | return $location_service; 73 | } 74 | 75 | public function getLocationServiceOverview(): array { 76 | $current_service = $this->config->getChosenService(); 77 | $overview = []; 78 | for ($i = 0; $i < $this->count_ids; $i ++) { 79 | $location_service = $this->getLocationServiceByID($i); 80 | $service_string = (new \ReflectionClass($location_service))->getShortName(); 81 | if ($location_service instanceof IDatabaseDate || 82 | $location_service instanceof IDatabaseFileLocation) { 83 | $service_string .= ' (' . $this->l->t('local') . ')'; 84 | } 85 | if ($i == 3) { 86 | $service_string .= ' (' . $this->l->t('default') . ')'; 87 | } 88 | $overview[$service_string] = ($current_service == $i); 89 | } 90 | 91 | return $overview; 92 | } 93 | 94 | public function hasDatabaseDate(): bool { 95 | $id = $this->getCurrentLocationServiceID(); 96 | return $this->hasDatabaseDateByID($id); 97 | } 98 | 99 | public function hasDatabaseDateByID(int $id): bool { 100 | $location_service = $this->getLocationServiceByID($id); 101 | return $location_service instanceof IDatabaseDate; 102 | } 103 | 104 | public function hasDatabaseFileLocation(): bool { 105 | $id = $this->getCurrentLocationServiceID(); 106 | return $this->hasDatabaseFileLocationByID($id); 107 | } 108 | 109 | public function hasDatabaseFileLocationByID(int $id): bool { 110 | $location_service = $this->getLocationServiceByID($id); 111 | return $location_service instanceof IDatabaseFileLocation; 112 | } 113 | 114 | public function hasDatabaseUpdate(): bool { 115 | $id = $this->getCurrentLocationServiceID(); 116 | return $this->hasDatabaseUpdateByID($id); 117 | } 118 | 119 | public function hasDatabaseUpdateByID(int $id): bool { 120 | $location_service = $this->getLocationServiceByID($id); 121 | return $location_service instanceof IDatabaseUpdate; 122 | } 123 | 124 | public function updateDatabase(): bool { 125 | $id = $this->getCurrentLocationServiceID(); 126 | return $this->updateDatabaseByID($id); 127 | } 128 | 129 | public function updateDatabaseByID(int $id): bool { 130 | if ($this->hasDatabaseUpdateByID($id)) { 131 | $location_service = $this->getLocationServiceByID($id); 132 | return $location_service->updateDatabase(); 133 | } 134 | return true; 135 | } 136 | 137 | public function resetDatabase(): bool { 138 | $id = $this->getCurrentLocationServiceID(); 139 | return $this->resetDatabaseByID($id); 140 | } 141 | 142 | public function resetDatabaseByID(int $id): bool { 143 | if ($this->hasDatabaseUpdateByID($id)) { 144 | $location_service = $this->getLocationServiceByID($id); 145 | return $location_service->resetDatabase(); 146 | } 147 | return true; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /helper_scripts/cl_start.txt: -------------------------------------------------------------------------------- 1 | AA COUNTRY NOT FOUND 2 | AD Andorra 3 | AE United Arab Emirates 4 | AF Afghanistan 5 | AG Antigua and Barbuda 6 | AI Anguilla 7 | AL Albania 8 | AM Armenia 9 | AO Angola 10 | AQ Antarctica 11 | AR Argentina 12 | AS American Samoa 13 | AT Austria 14 | AU Australia 15 | AW Aruba 16 | AX Åland Islands 17 | AZ Azerbaijan 18 | BA Bosnia and Herzegovina 19 | BB Barbados 20 | BD Bangladesh 21 | BE Belgium 22 | BF Burkina Faso 23 | BG Bulgaria 24 | BH Bahrain 25 | BI Burundi 26 | BJ Benin 27 | BL Saint Barthélemy 28 | BM Bermuda 29 | BN Brunei Darussalam 30 | BO Bolivia (Plurinational State of) 31 | BQ Bonaire, Sint Eustatius and Saba 32 | BR Brazil 33 | BS Bahamas 34 | BT Bhutan 35 | BV Bouvet Island 36 | BW Botswana 37 | BY Belarus 38 | BZ Belize 39 | CA Canada 40 | CC Cocos (Keeling) Islands 41 | CD Congo, Democratic Republic of the 42 | CF Central African Republic 43 | CG Congo 44 | CH Switzerland 45 | CI Côte d'Ivoire 46 | CK Cook Islands 47 | CL Chile 48 | CM Cameroon 49 | CN China 50 | CO Colombia 51 | CR Costa Rica 52 | CU Cuba 53 | CV Cabo Verde 54 | CW Curaçao 55 | CX Christmas Island 56 | CY Cyprus 57 | CZ Czechia 58 | DE Germany 59 | DJ Djibouti 60 | DK Denmark 61 | DM Dominica 62 | DO Dominican Republic 63 | DZ Algeria 64 | EC Ecuador 65 | EE Estonia 66 | EG Egypt 67 | EH Western Sahara 68 | ER Eritrea 69 | ES Spain 70 | ET Ethiopia 71 | FI Finland 72 | FJ Fiji 73 | FK Falkland Islands (Malvinas) 74 | FM Micronesia (Federated States of) 75 | FO Faroe Islands 76 | FR France 77 | GA Gabon 78 | GB United Kingdom of Great Britain and Northern Ireland 79 | GD Grenada 80 | GE Georgia 81 | GF French Guiana 82 | GG Guernsey 83 | GH Ghana 84 | GI Gibraltar 85 | GL Greenland 86 | GM Gambia 87 | GN Guinea 88 | GP Guadeloupe 89 | GQ Equatorial Guinea 90 | GR Greece 91 | GS South Georgia and the South Sandwich Islands 92 | GT Guatemala 93 | GU Guam 94 | GW Guinea-Bissau 95 | GY Guyana 96 | HK Hong Kong 97 | HM Heard Island and McDonald Islands 98 | HN Honduras 99 | HR Croatia 100 | HT Haiti 101 | HU Hungary 102 | ID Indonesia 103 | IE Ireland 104 | IL Israel 105 | IM Isle of Man 106 | IN India 107 | IO British Indian Ocean Territory 108 | IQ Iraq 109 | IR Iran (Islamic Republic of) 110 | IS Iceland 111 | IT Italy 112 | JE Jersey 113 | JM Jamaica 114 | JO Jordan 115 | JP Japan 116 | KE Kenya 117 | KG Kyrgyzstan 118 | KH Cambodia 119 | 120 | KI Kiribati 121 | KM Comoros 122 | KN Saint Kitts and Nevis 123 | KP Korea (Democratic People's Republic of) 124 | KR Korea, Republic of 125 | KW Kuwait 126 | KY Cayman Islands 127 | KZ Kazakhstan 128 | LA Lao People's Democratic Republic 129 | LB Lebanon 130 | LC Saint Lucia 131 | LI Liechtenstein 132 | LK Sri Lanka 133 | LR Liberia 134 | LS Lesotho 135 | LT Lithuania 136 | LU Luxembourg 137 | LV Latvia 138 | LY Libya 139 | MA Morocco 140 | MC Monaco 141 | MD Moldova, Republic of 142 | ME Montenegro 143 | MF Saint Martin (French part) 144 | MG Madagascar 145 | MH Marshall Islands 146 | MK North Macedonia 147 | ML Mali 148 | MM Myanmar 149 | MN Mongolia 150 | MO Macao 151 | MP Northern Mariana Islands 152 | MQ Martinique 153 | MR Mauritania 154 | MS Montserrat 155 | MT Malta 156 | MU Mauritius 157 | MV Maldives 158 | MW Malawi 159 | MX Mexico 160 | MY Malaysia 161 | MZ Mozambique 162 | NA Namibia 163 | NC New Caledonia 164 | NE Niger 165 | NF Norfolk Island 166 | NG Nigeria 167 | NI Nicaragua 168 | NL Netherlands 169 | NO Norway 170 | NP Nepal 171 | NR Nauru 172 | NU Niue 173 | NZ New Zealand 174 | OM Oman 175 | PA Panama 176 | PE Peru 177 | PF French Polynesia 178 | PG Papua New Guinea 179 | PH Philippines 180 | PK Pakistan 181 | PL Poland 182 | PM Saint Pierre and Miquelon 183 | PN Pitcairn 184 | PR Puerto Rico 185 | PS Palestine, State of 186 | PT Portugal 187 | PW Palau 188 | PY Paraguay 189 | QA Qatar 190 | RE Réunion 191 | RO Romania 192 | RS Serbia 193 | RU Russian Federation 194 | RW Rwanda 195 | SA Saudi Arabia 196 | SB Solomon Islands 197 | SC Seychelles 198 | SD Sudan 199 | SE Sweden 200 | SG Singapore 201 | SH Saint Helena, Ascension and Tristan da Cunha 202 | SI Slovenia 203 | SJ Svalbard and Jan Mayen 204 | SK Slovakia 205 | SL Sierra Leone 206 | SM San Marino 207 | SN Senegal 208 | SO Somalia 209 | SR Suriname 210 | SS South Sudan 211 | ST Sao Tome and Principe 212 | SV El Salvador 213 | SX Sint Maarten (Dutch part) 214 | SY Syrian Arab Republic 215 | SZ Eswatini 216 | TC Turks and Caicos Islands 217 | TD Chad 218 | TF French Southern Territories 219 | TG Togo 220 | TH Thailand 221 | TJ Tajikistan 222 | TK Tokelau 223 | TL Timor-Leste 224 | TM Turkmenistan 225 | TN Tunisia 226 | TO Tonga 227 | TR Turkey 228 | TT Trinidad and Tobago 229 | TV Tuvalu 230 | TW Taiwan, Province of China 231 | TZ Tanzania, United Republic of 232 | UA Ukraine 233 | UG Uganda 234 | UM United States Minor Outlying Islands 235 | US United States of America 236 | UY Uruguay 237 | UZ Uzbekistan 238 | VA Holy See 239 | VC Saint Vincent and the Grenadines 240 | VE Venezuela (Bolivarian Republic of) 241 | VG Virgin Islands (British) 242 | VI Virgin Islands (U.S.) 243 | VN Viet Nam 244 | VU Vanuatu 245 | WF Wallis and Futuna 246 | WS Samoa 247 | YE Yemen 248 | YT Mayotte 249 | ZA South Africa 250 | ZM Zambia 251 | ZW Zimbabwe 252 | -------------------------------------------------------------------------------- /.github/workflows/phpunit.yml: -------------------------------------------------------------------------------- 1 | name: PHPUnit Tests 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | env: 11 | POSTGRES_PASSWORD: nc_test_db 12 | MYSQL_USER: nc_test 13 | MYSQL_PASSWORD: nc_test_db 14 | MYSQL_DATABASE: nc_test 15 | MYSQL_PORT: 3800 16 | 17 | jobs: 18 | php: 19 | runs-on: ubuntu-latest 20 | continue-on-error: ${{ matrix.experimental }} 21 | name: "PHP: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-version }} - DB ${{ matrix.database }}" 22 | services: 23 | postgres: 24 | image: postgres 25 | env: 26 | POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} 27 | options: >- 28 | --health-cmd pg_isready 29 | --health-interval 10s 30 | --health-timeout 5s 31 | --health-retries 5 32 | ports: 33 | - 5432:5432 # Maps tcp port 5432 on service container to the host 34 | strategy: 35 | matrix: 36 | php-version: ['8.2', '8.3', '8.4'] 37 | nextcloud: [ 'stable30', 'stable31', 'stable32'] 38 | database: ['sqlite', 'pgsql', 'mysql'] 39 | experimental: [false] 40 | exclude: 41 | - php-version: '8.4' 42 | nextcloud: 'stable30' 43 | steps: 44 | - name: Checkout 45 | uses: actions/checkout@v4 46 | 47 | - name: Setup PHP 48 | uses: shivammathur/setup-php@v2 49 | with: 50 | php-version: ${{ matrix.php-version }} 51 | extensions: pdo_sqlite,pdo_mysql,pdo_pgsql,gd,zip 52 | coverage: pcov 53 | 54 | - name: Setup mysql 55 | if: matrix.database == 'mysql' 56 | uses: getong/mariadb-action@v1.1 57 | with: 58 | mariadb version: '10.11' 59 | host port: ${{ env.MYSQL_PORT }} 60 | mysql database: ${{ env.MYSQL_DATABASE }} 61 | mysql root password: ${{ env.MYSQL_PASSWORD }} 62 | mysql user: ${{ env.MYSQL_USER }} 63 | mysql password: ${{ env.MYSQL_PASSWORD }} 64 | 65 | - name: Set up server MySQL 66 | if: matrix.database == 'mysql' 67 | uses: SMillerDev/nextcloud-actions/setup-nextcloud@main 68 | with: 69 | version: ${{ matrix.nextcloud }} 70 | cron: true 71 | database-type: ${{ matrix.database }} 72 | database-host: 127.0.0.1 73 | database-port: ${{ env.MYSQL_PORT }} 74 | database-name: ${{ env.MYSQL_DATABASE }} 75 | database-user: root 76 | database-password: ${{ env.MYSQL_PASSWORD }} 77 | 78 | - name: Set up server non MySQL 79 | if: matrix.database != 'mysql' 80 | uses: SMillerDev/nextcloud-actions/setup-nextcloud@main 81 | with: 82 | version: ${{ matrix.nextcloud }} 83 | cron: true 84 | database-type: ${{ matrix.database }} 85 | database-host: localhost 86 | database-port: 5432 87 | database-name: postgres 88 | database-user: postgres 89 | database-password: ${{ env.POSTGRES_PASSWORD }} 90 | 91 | - name: Prime app build 92 | run: make 93 | 94 | - name: Configure server with app 95 | uses: SMillerDev/nextcloud-actions/setup-nextcloud-app@main 96 | with: 97 | app: 'geoblocker' 98 | check-code: false 99 | force: ${{ matrix.experimental }} 100 | 101 | - name: Cache Maxmind DB 102 | id: cache-maxmind 103 | uses: actions/cache@v4 104 | with: 105 | path: /home/runner/work/_temp/GeoIP/GeoLite2-Country.mmdb 106 | key: ${{ runner.os }}-maxmind-db 107 | 108 | - name: Prep Maxmind No Cache Hit 109 | if: steps.cache-maxmind.outputs.cache-hit != 'true' 110 | run: sudo apt-get update 111 | && sudo apt-get install geoipupdate 112 | && sudo mv GeoIP.template.conf /etc/GeoIP.conf 113 | && sudo sed -i "s/<>/${{ secrets.MM_ID }}/g" /etc/GeoIP.conf 114 | && sudo sed -i "s/<>/${{ secrets.MM_KEY }}/g" /etc/GeoIP.conf 115 | && sudo geoipupdate 116 | && mkdir -p /home/runner/work/_temp/GeoIP/ 117 | && cp /var/lib/GeoIP/GeoLite2-Country.mmdb /home/runner/work/_temp/GeoIP/GeoLite2-Country.mmdb 118 | 119 | - name: Prep Maxmind Cache Hit 120 | if: steps.cache-maxmind.outputs.cache-hit == 'true' 121 | run: sudo mkdir -p /var/lib/GeoIP/ 122 | && sudo cp /home/runner/work/_temp/GeoIP/GeoLite2-Country.mmdb /var/lib/GeoIP/GeoLite2-Country.mmdb 123 | 124 | - name: Prep GeoIPLookup 125 | run: sudo apt-get update 126 | && sudo apt-get install geoip-bin geoip-database 127 | 128 | - name: Prep PHPUnit tests 129 | working-directory: ../server/apps/geoblocker 130 | run: make prepare-test 131 | 132 | - name: Unit and Integration Tests 133 | working-directory: ../server/apps/geoblocker 134 | run: sudo make test 135 | # 136 | # - name: Upload codecoverage 137 | # working-directory: ../server/apps/geoblocker 138 | # run: bash <(curl -s https://codecov.io/bash) -f build/php-unit.clover -N ${{ github.sha }} 139 | 140 | - name: Clean up 141 | run: sudo rm -f /etc/GeoIP.conf 142 | -------------------------------------------------------------------------------- /lib/Controller/ServiceController.php: -------------------------------------------------------------------------------- 1 | config = new GeoBlockerConfig($config); 32 | $this->l = $l; 33 | $this->db = $db; 34 | $this->logger = $logger; 35 | $this->location_service_factory = new LocalizationServiceFactory( 36 | $this->config, $this->l, $this->db, $this->logger); 37 | } 38 | 39 | public function status(int $id) { 40 | $location_service = $this->location_service_factory->getLocationServiceByID( 41 | $id); 42 | return new DataResponse($location_service->getStatusString()); 43 | } 44 | 45 | public function hasDatabaseDate(int $id) { 46 | return new DataResponse( 47 | $this->location_service_factory->hasDatabaseDateByID($id)); 48 | } 49 | 50 | public function getDatabaseDate(int $id) { 51 | $location_service = $this->location_service_factory->getLocationServiceByID( 52 | $id); 53 | if ($this->location_service_factory->hasDatabaseDateByID($id)) { 54 | return new DataResponse($location_service->getDatabaseDate()); 55 | } else { 56 | return new DataResponse($this->l->t("No database date available.")); 57 | } 58 | } 59 | 60 | public function hasConfigurationOptionImpl(int $id) { 61 | return $this->location_service_factory->hasDatabaseFileLocationByID($id) || 62 | $this->location_service_factory->hasDatabaseUpdateByID($id); 63 | } 64 | 65 | public function hasConfigurationOption(int $id) { 66 | return new DataResponse($this->hasConfigurationOptionImpl($id)); 67 | } 68 | 69 | public function hasDatabaseFileLocation(int $id) { 70 | return new DataResponse( 71 | $this->location_service_factory->hasDatabaseFileLocationByID($id)); 72 | } 73 | 74 | public function getDatabaseFileLocation(int $id) { 75 | $location_service = $this->location_service_factory->getLocationServiceByID( 76 | $id); 77 | if ($this->location_service_factory->hasDatabaseFileLocationByID($id)) { 78 | return new DataResponse( 79 | $location_service->getDatabaseFileLocation()); 80 | } else { 81 | return new DataResponse( 82 | $this->l->t("Database file location not available!")); 83 | } 84 | } 85 | 86 | public function getUniqueServiceString(int $id) { 87 | $location_service = $this->location_service_factory->getLocationServiceByID( 88 | $id); 89 | return new DataResponse( 90 | (new \ReflectionClass($location_service))->getShortName()); 91 | } 92 | 93 | public function hasDatabaseUpdate(int $id) { 94 | return new DataResponse( 95 | $this->location_service_factory->hasDatabaseUpdateByID($id)); 96 | ; 97 | } 98 | 99 | public function updateDatabase(int $id) { 100 | return new DataResponse( 101 | $this->location_service_factory->updateDatabaseByID($id)); 102 | ; 103 | } 104 | 105 | public function getDatabaseUpdateStatus(int $id) { 106 | $location_service = $this->location_service_factory->getLocationServiceByID( 107 | $id); 108 | if ($this->location_service_factory->hasDatabaseUpdateByID($id)) { 109 | return new DataResponse( 110 | $location_service->getDatabaseUpdateStatus()); 111 | } else { 112 | return new DataResponse($this->l->t("Update Status not available!")); 113 | } 114 | } 115 | 116 | public function getDatabaseUpdateStatusString(int $id) { 117 | $location_service = $this->location_service_factory->getLocationServiceByID( 118 | $id); 119 | if ($this->location_service_factory->hasDatabaseUpdateByID($id)) { 120 | return new DataResponse( 121 | $location_service->getDatabaseUpdateStatusString()); 122 | } else { 123 | return new DataResponse($this->l->t("Update Status not available!")); 124 | } 125 | } 126 | 127 | public function getAllServiceData(int $id) { 128 | $location_service = $this->location_service_factory->getLocationServiceByID($id); 129 | $ret = []; 130 | $ret['status'] = $location_service->getStatusString(); 131 | $ret['hasDatabaseDate'] = $this->location_service_factory->hasDatabaseDateByID($id); 132 | if ($ret['hasDatabaseDate']) { 133 | $ret['getDatabaseDate'] = $location_service->getDatabaseDate(); 134 | } 135 | $ret['hasConfigurationOption'] = $this->hasConfigurationOptionImpl($id); 136 | if ($ret['hasConfigurationOption']) { 137 | $ret['hasDatabaseFileLocation'] = $this->location_service_factory->hasDatabaseFileLocationByID($id); 138 | if ($ret['hasDatabaseFileLocation']) { 139 | $ret['getDatabaseFileLocation'] = $location_service->getDatabaseFileLocation(); 140 | } 141 | $ret['hasDatabaseUpdate'] = $this->location_service_factory->hasDatabaseUpdateByID($id); 142 | if ($ret['hasDatabaseUpdate']) { 143 | $ret['getDatabaseUpdateStatus'] = $location_service->getDatabaseUpdateStatus(); 144 | $ret['getDatabaseUpdateStatusString'] = $location_service->getDatabaseUpdateStatusString(); 145 | } 146 | } 147 | return new JSONResponse($ret); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lib/GeoBlocker/GeoBlocker.php: -------------------------------------------------------------------------------- 1 | user = $user; 34 | $this->logger = $logger; 35 | $this->config = $config; 36 | $this->l = $l; 37 | $this->location_service = $location_service; 38 | } 39 | 40 | private function createInvalidIPLogString(string $log_user, 41 | string $log_address): string { 42 | return sprintf( 43 | 'The user "%s" attempt to login with an invalid IP address "%s".', 44 | $log_user, $log_address); 45 | } 46 | 47 | private function logEvent(string $log_string): void { 48 | $this->logger->warning($log_string, ['app' => 'geoblocker']); 49 | } 50 | 51 | private function logError(string $log_string): void { 52 | $this->logger->error($log_string, ['app' => 'geoblocker']); 53 | } 54 | 55 | public function blockIpAddress(String $ip_address): void { 56 | $block_ip_address = false; 57 | if ($this->isIPAddressValid($ip_address)) { 58 | if (! $this->isIPAddressLocal($ip_address)) { 59 | $location = $this->location_service->getCountryCodeFromIP( 60 | $ip_address); 61 | 62 | $log_user = $this->config->getLogWithUserName() ? $this->user : $this::kNotShownString; 63 | $log_location = $this->config->getLogWithCountryCode() ? $location : $this::kNotShownString; 64 | $log_address = $this->config->getLogWithIpAddress() ? $ip_address : $this::kNotShownString; 65 | 66 | if ($location !== 'INVALID_IP' && $location !== 'UNAVAILABLE') { 67 | if ($this->config->isCountryCodeInListOfChoosenCountries( 68 | $location) xor $this->config->getUseWhiteListing()) { 69 | $log_string = sprintf( 70 | 'The user "%s" attempt to login with IP address "%s" from blocked country "%s".', 71 | $log_user, $log_address, $log_location); 72 | $any_reaction = false; 73 | if ($this->config->getDelayIpAddress()) { 74 | usleep(30 * 1000000); 75 | $log_string .= ' Login is delayed.'; 76 | $any_reaction = true; 77 | } 78 | $should_be_blocked = $this->config->getBlockIpAddress(); 79 | if ($should_be_blocked|| $this->config->getBlockIpAddressBefore()) { 80 | //Make sure this one is also set, too. Want to get rid of "getBlockIpAddressBefore" soon. 81 | if (!$should_be_blocked) { 82 | $this->config->setBlockIpAddress(true); 83 | } 84 | 85 | $block_ip_address = true; 86 | $log_string .= ' Login is blocked.'; 87 | $any_reaction = true; 88 | } 89 | if (! $any_reaction) { 90 | $log_string .= ' No reaction is activated.'; 91 | } 92 | $this->logEvent($log_string); 93 | } 94 | } elseif ($location === 'UNAVAILABLE') { 95 | $log_string = sprintf( 96 | 'The login of user "%s" with IP address "%s" could not be checked due to problems with location service.', 97 | $log_user, $log_address); 98 | $this->logEvent($log_string); 99 | } elseif ($location === 'INVALID_IP') { 100 | $log_string = $this->createInvalidIPLogString($log_user, 101 | $log_address); 102 | $this->logEvent($log_string); 103 | } else { 104 | $this->logger->error( 105 | "This shouldn't have happen. This line should never be reached.", 106 | ['app' => 'geoblocker']); 107 | } 108 | } 109 | } else { 110 | $log_user = $this->config->getLogWithUserName() ? $this->user : 'NOT_SHOWN_IN_LOG'; 111 | $log_address = $this->config->getLogWithIpAddress() ? $ip_address : 'NOT_SHOWN_IN_LOG'; 112 | 113 | $log_string = $this->createInvalidIPLogString($log_user, 114 | $log_address); 115 | $this->logEvent($log_string); 116 | } 117 | if ($block_ip_address) { 118 | throw new LoginException($this->l->t('Your attempt to login from country "%s" is blocked by the Nextcloud GeoBlocker App. ' 119 | . 'If this is a problem for you, please contact your administrator.', [$location])); 120 | } 121 | } 122 | 123 | public static function isIPAddressValid(String $ip_address): bool { 124 | if (filter_var($ip_address, FILTER_VALIDATE_IP)) { 125 | return true; 126 | } else { 127 | return false; 128 | } 129 | } 130 | 131 | /** 132 | * Returns if the IP address is an local IP address. 133 | * This implicitly also confirms, that it is a valid IP address, if it is local. 134 | * If it is not local it could also be a not valid IP address. 135 | * 136 | * @param string $IPAdress 137 | * The IP Adress to check. 138 | * @return bool 139 | */ 140 | public static function isIPAddressLocal(String $ip_address): bool { 141 | if (GeoBlocker::isIPAddressValid($ip_address)) { 142 | if (filter_var($ip_address, FILTER_VALIDATE_IP, 143 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { 144 | return false; 145 | } else { 146 | return true; 147 | } 148 | } else { 149 | return false; 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /lib/LocalizationServices/MaxMindGeoLite2.php: -------------------------------------------------------------------------------- 1 | l = $l; 41 | $this->config = $config; 42 | $this->logger = $logger; 43 | $this->unique_service_string = (new \ReflectionClass($this))->getShortName(); 44 | $this->database_file_location = $this->config->getDatabaseFileLocation( 45 | $this->unique_service_string); 46 | if ($this->database_file_location == '') { 47 | $this->database_file_location = '/var/lib/GeoIP/GeoLite2-Country.mmdb'; 48 | } 49 | } 50 | 51 | public function getStatus(): bool { 52 | return $this->getCountryCodeFromIP($this::kStatusTestIP) == $this::kStatusTestResult; 53 | } 54 | 55 | public function getStatusString(): string { 56 | $service_string = '"MaxMind GeoLite2": '; 57 | try { 58 | if ($this->getCountryCodeFromIPImpl($this::kStatusTestIP) == $this::kStatusTestResult) { 59 | return $service_string . $this->l->t('OK.'); 60 | } else { 61 | return $service_string . 62 | $this->l->t('ERROR: There is an unknown problem with the service.'); 63 | } 64 | } catch (AddressNotFoundException $e) { 65 | return $service_string . 66 | $this->l->t('ERROR: Country cannot be found.'); 67 | } catch (DatabaseFileNotFoundException | InvalidDatabaseException $e) { 68 | return $service_string . 69 | $this->l->t( 70 | 'ERROR: Database is not valid, does not have the correct access rights or is not placed at %s.', 71 | $this->database_file_location); 72 | } catch (InvalidArgumentException $e) { 73 | return $service_string . 74 | $this->l->t('ERROR: Invalid Argument.'); 75 | } catch (DatabaseReaderNotFoundException $e) { 76 | return $service_string . 77 | $this->l->t('ERROR: "geoip2.phar" does not seem to be placed correctly or does not have the correct access rights.'); 78 | } 79 | } 80 | 81 | private function logError(string $log_string): void { 82 | $this->logger->error('Geoblocker: MaxMindGeoLite2: ' . $log_string, ['app' => 'geoblocker']); 83 | } 84 | 85 | private function getCountryCodeFromIPImpl($ip_address): string { 86 | if (!@include_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '3rdparty' 87 | . DIRECTORY_SEPARATOR . 'maxmind_geolite2' . DIRECTORY_SEPARATOR . 'geoip2.phar') { 88 | @include_once \pathinfo($this->database_file_location)['dirname'] . DIRECTORY_SEPARATOR . 'geoip2.phar'; 89 | } 90 | if (!class_exists('GeoIp2\Database\Reader')) { 91 | throw new DatabaseReaderNotFoundException('"GeoIp2\Database\Reader" does not exists.'); 92 | } 93 | if (!\file_exists($this->database_file_location)) { 94 | throw new DatabaseFileNotFoundException('No file at ' . $this->database_file_location . '.'); 95 | } 96 | $reader = new Reader($this->database_file_location); 97 | $record = $reader->country($ip_address); 98 | return $record->country->isoCode; 99 | } 100 | 101 | public function getCountryCodeFromIP($ip_address): string { 102 | try { 103 | return $this->getCountryCodeFromIPImpl($ip_address); 104 | } catch (AddressNotFoundException $e) { 105 | $this->logError('Address No Found: ' . $e->getMessage()); 106 | return GeoBlocker::kCountryNotFoundCode; 107 | } catch (InvalidDatabaseException $e) { 108 | $this->logError('Invalid Database Exception: ' . $e->getMessage()); 109 | return 'UNAVAILABLE'; 110 | } catch (DatabaseFileNotFoundException $e) { 111 | $this->logError('Database File Not Found Exception: ' . $e->getMessage()); 112 | return 'UNAVAILABLE'; 113 | } catch (InvalidArgumentException $e) { 114 | $this->logError('Invalid Argument Exception: ' . $e->getMessage()); 115 | return 'UNAVAILABLE'; 116 | } catch (DatabaseReaderNotFoundException $e) { 117 | $this->logError('Database Reader is not available: '. $e->getMessage()); 118 | return 'UNAVAILABLE'; 119 | } 120 | } 121 | 122 | public function getDatabaseDate(): string { 123 | $db_file_date = false; 124 | if (file_exists($this->database_file_location)) { 125 | $db_file_date = filemtime($this->database_file_location); 126 | } 127 | if ($db_file_date == null || $db_file_date === false) { 128 | return $this->l->t('Date of the database cannot be determined!'); 129 | } else { 130 | return date('Y-m-d', $db_file_date); 131 | } 132 | } 133 | 134 | public function getDatabaseFileLocation(): string { 135 | return $this->database_file_location; 136 | } 137 | 138 | public function setDatabaseFileLocation(string $database_file_location) { 139 | $this->database_file_location = $database_file_location; 140 | $this->config->setDatabaseFileLocation($database_file_location, 141 | $this->unique_service_string); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /lib/Config/GeoBlockerConfig.php: -------------------------------------------------------------------------------- 1 | config = $config; 18 | } 19 | 20 | public function getLogWithIpAddress(): bool { 21 | $log_with_ip_address = $this->config->getAppValue('geoblocker', 22 | 'logWithIpAddress', '0'); 23 | return $log_with_ip_address === '1'; 24 | } 25 | 26 | public function setLogWithIpAddress(bool $log_with_ip_address) { 27 | $value = $log_with_ip_address === true ? '1' : '0'; 28 | $this->config->setAppValue('geoblocker', 'logWithIpAddress', $value); 29 | } 30 | 31 | public function getLogWithCountryCode(): bool { 32 | $log_with_country_code = $this->config->getAppValue('geoblocker', 33 | 'logWithCountryCode', '0'); 34 | return $log_with_country_code === '1'; 35 | } 36 | 37 | public function setLogWithCountryCode(bool $log_with_country_code) { 38 | $value = $log_with_country_code === true ? '1' : '0'; 39 | $this->config->setAppValue('geoblocker', 'logWithCountryCode', $value); 40 | } 41 | 42 | public function getLogWithUserName(): bool { 43 | $log_with_user_name = $this->config->getAppValue('geoblocker', 44 | 'logWithUserName', '0'); 45 | return $log_with_user_name === '1'; 46 | } 47 | 48 | public function setLogWithUserName(bool $log_with_user_name) { 49 | $value = $log_with_user_name === true ? '1' : '0'; 50 | $this->config->setAppValue('geoblocker', 'logWithUserName', $value); 51 | } 52 | 53 | public function getDelayIpAddress(): bool { 54 | $delay_ip_address = $this->config->getAppValue('geoblocker', 55 | 'delayIpAddress', '0'); 56 | return $delay_ip_address === '1'; 57 | } 58 | 59 | public function setDelayIpAddress(bool $delay_ip_address) { 60 | $value = $delay_ip_address === true ? '1' : '0'; 61 | $this->config->setAppValue('geoblocker', 'delayIpAddress', $value); 62 | } 63 | 64 | public function getBlockIpAddress(): bool { 65 | $block_ip_address = $this->config->getAppValue('geoblocker', 66 | 'blockIpAddress', '0'); 67 | return $block_ip_address === '1'; 68 | } 69 | 70 | public function setBlockIpAddress(bool $block_ip_address) { 71 | $value = $block_ip_address === true ? '1' : '0'; 72 | $this->config->setAppValue('geoblocker', 'blockIpAddress', $value); 73 | } 74 | 75 | public function getBlockIpAddressBefore(): bool { 76 | $block_ip_address = $this->config->getAppValue('geoblocker', 77 | 'blockIpAddressBefore', '0'); 78 | return $block_ip_address === '1'; 79 | } 80 | 81 | public function setBlockIpAddressBefore(bool $block_ip_address) { 82 | $value = $block_ip_address === true ? '1' : '0'; 83 | $this->config->setAppValue('geoblocker', 'blockIpAddressBefore', $value); 84 | } 85 | 86 | public function getUseWhiteListing(): bool { 87 | $log_with_user_name = $this->config->getAppValue('geoblocker', 88 | 'choosenWhiteBlackList', '0'); 89 | return $log_with_user_name === '1'; 90 | } 91 | 92 | public function setUseWhiteListing(bool $use_white_listing) { 93 | $value = $use_white_listing === true ? '1' : '0'; 94 | $this->config->setAppValue('geoblocker', 'choosenWhiteBlackList', $value); 95 | } 96 | 97 | public function getChosenService(): string { 98 | $chosen_service = $this->config->getAppValue('geoblocker', 99 | 'chosenService', '3'); 100 | return $chosen_service; 101 | } 102 | 103 | public function setChosenService(string $chosen_service) { 104 | $this->config->setAppValue('geoblocker', 'chosenService', 105 | $chosen_service); 106 | } 107 | 108 | public function getChoosenCountriesByString(): string { 109 | $countries = $this->config->getAppValue('geoblocker', 'choosenCountries', 110 | ''); 111 | return $countries; 112 | } 113 | 114 | public function setChoosenCountriesByString(string $countries) { 115 | $this->config->setAppValue('geoblocker', 'choosenCountries', 116 | $countries); 117 | } 118 | 119 | public function isCountryCodeInListOfChoosenCountries(string $cc): bool { 120 | $countries = $this->config->getAppValue('geoblocker', 'choosenCountries', 121 | ''); 122 | $cc_short = substr($cc, 0, 2); 123 | if (strpos($countries, $cc_short) !== false) { 124 | return true; 125 | } else { 126 | return false; 127 | } 128 | } 129 | 130 | public function getDoFakeAddress(): bool { 131 | $do_fake_address = $this->config->getAppValue('geoblocker', 132 | 'doFakeAddress', '0'); 133 | return $do_fake_address === '1'; 134 | } 135 | 136 | public function setDoFakeAddress(bool $do_fake_address) { 137 | $value = $do_fake_address === true ? '1' : '0'; 138 | $this->config->setAppValue('geoblocker', 'doFakeAddress', $value); 139 | } 140 | 141 | public function getFakeAddress(): string { 142 | $default_fake_address = '127.0.0.1'; 143 | $fake_address = $this->config->getAppValue('geoblocker', 'fakeAddress', 144 | $default_fake_address); 145 | if (! GeoBlocker::isIPAddressValid($fake_address)) { 146 | $fake_address = $default_fake_address; 147 | $this->config->setAppValue('geoblocker', 'fakeAddress', 148 | $default_fake_address); 149 | } 150 | return $fake_address; 151 | } 152 | 153 | public function getFakeAddressUser(): string { 154 | $user = $this->config->getAppValue('geoblocker', 'fakeAddressUser', ''); 155 | return $user; 156 | } 157 | 158 | public function setFakeAddressUser(string $user) { 159 | $this->config->setAppValue('geoblocker', 'fakeAddressUser', $user); 160 | } 161 | 162 | public function getDatabaseFileLocation(string $unique_service_string): string { 163 | $database_file_location = $this->config->getAppValue('geoblocker', 164 | $unique_service_string . '_DatabaseFileLocation', ''); 165 | return $database_file_location; 166 | } 167 | 168 | public function setDatabaseFileLocation(string $database_file_location, 169 | string $unique_service_string) { 170 | $this->config->setAppValue('geoblocker', 171 | $unique_service_string . '_DatabaseFileLocation', 172 | $database_file_location); 173 | } 174 | 175 | public function getServiceSpecificConfigValue(string $name, 176 | string $default_value): string { 177 | return $this->config->getAppValue('geoblocker', $name, $default_value); 178 | } 179 | 180 | public function setServiceSpecificConfigValue(string $name, string $value) { 181 | $this->config->setAppValue('geoblocker', $name, $value); 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /tests/Integration/GeoBlockerIntegrationTest.php: -------------------------------------------------------------------------------- 1 | user = 'admin'; 30 | $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); 31 | $tmp_config = $this->getMockBuilder('OCP\IConfig')->getMock(); 32 | $this->config = $this->getMockBuilder( 33 | 'OCA\GeoBlocker\Config\GeoBlockerConfig')->setConstructorArgs( 34 | [$tmp_config])->getMock(); 35 | $this->l = $this->getMockBuilder('OCP\IL10N')->getMock(); 36 | } 37 | 38 | private function doCheckTest(String $ip_address, String $country_code, 39 | InvokedCountMatcher $invokerLocationService, 40 | String $log_string_template, String $log_method, 41 | InvokedCountMatcher $invokerLogging, bool $blocking_active = true, 42 | bool $expect_blocking = false, bool $isCountryInList = false, 43 | bool $useWhiteListing = false, bool $logWithUserName = true, 44 | bool $logWithCountryCode = true, bool $logWithIPAdress = true) { 45 | $log_string = sprintf($log_string_template, $this->user, $ip_address, 46 | $country_code); 47 | // $this->location_service->expects ( $invokerLocationService )->method ( 48 | // 'getCountryCodeFromIP' )->with ( $this->equalTo ( $ip_address ) )->willReturn ( 49 | // $country_code ); 50 | $this->config->method('getLogWithUserName')->will( 51 | $this->returnValue($logWithUserName)); 52 | $this->config->method('getLogWithCountryCode')->will( 53 | $this->returnValue($logWithCountryCode)); 54 | $this->config->method('getLogWithIpAddress')->will( 55 | $this->returnValue($logWithIPAdress)); 56 | $this->config->method('isCountryCodeInListOfChoosenCountries')->with( 57 | $this->equalTo($country_code))->will( 58 | $this->returnValue($isCountryInList)); 59 | $this->config->method('getUseWhiteListing')->with()->will( 60 | $this->returnValue($useWhiteListing)); 61 | $this->config->method('getDelayIpAddress')->with()->will( 62 | $this->returnValue(false)); 63 | $this->config->method('getBlockIpAddress')->with()->will( 64 | $this->returnValue($blocking_active)); 65 | $this->l->method('t')->will( 66 | $this->returnCallback([$this,'defaultTranslate'])); 67 | $this->logger->expects($invokerLogging)->method($log_method)->with( 68 | $this->equalTo($log_string), 69 | $this->equalTo(['app' => 'geoblocker'])); 70 | if ($expect_blocking) { 71 | $this->expectException(LoginException::class); 72 | $this->expectExceptionMessageMatches('/^Your attempt to login from country ".." is blocked by the Nextcloud GeoBlocker App. ' 73 | . 'If this is a problem for you, please contact your administrator.$/'); 74 | } 75 | $this->geoblocker->blockIpAddress($ip_address); 76 | } 77 | 78 | public function defaultTranslate() { 79 | $args = func_get_args(); 80 | $sprintf_args = array_merge([$args[0]], $args[1]); 81 | return call_user_func_array('sprintf', $sprintf_args); 82 | } 83 | 84 | /** 85 | * 86 | * @dataProvider ipCountryListProvider 87 | */ 88 | public function testLoginNotBlockedFromGeoiplookup(string $ip_address, 89 | string $country_code) { 90 | $this->mySetUp(); 91 | $this->location_service = new GeoIPLookup(new GeoIPLookupCmdWrapper(), 92 | $this->l); 93 | 94 | $this->geoblocker = new GeoBlocker($this->user, $this->logger, 95 | $this->config, $this->l, $this->location_service); 96 | 97 | $log_string_template = ''; 98 | $log_method = 'warning'; 99 | $this->doCheckTest($ip_address, $country_code, $this->once(), 100 | $log_string_template, $log_method, $this->never()); 101 | } 102 | 103 | /** 104 | * 105 | * @dataProvider ipCountryListProvider 106 | */ 107 | public function testLoginBlockedFromGeoiplookup(string $ip_address, 108 | string $country_code) { 109 | $this->mySetUp(); 110 | $this->location_service = new GeoIPLookup(new GeoIPLookupCmdWrapper(), 111 | $this->l); 112 | 113 | $this->geoblocker = new GeoBlocker($this->user, $this->logger, 114 | $this->config, $this->l, $this->location_service); 115 | 116 | $log_string_template = 'The user "%s" attempt to login with IP address "%s" from blocked country "%s". Login is blocked.'; 117 | $log_method = 'warning'; 118 | $isCountryInList = true; 119 | $this->doCheckTest($ip_address, $country_code, $this->once(), 120 | $log_string_template, $log_method, $this->once(), true, true, 121 | $isCountryInList); 122 | } 123 | 124 | /** 125 | * 126 | * @dataProvider ipCountryListProvider 127 | */ 128 | public function testLoginNotBlockedFromMaxmindGeoLite2(string $ip_address, 129 | string $country_code) { 130 | $this->mySetUp(); 131 | $this->location_service = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 132 | 133 | $this->geoblocker = new GeoBlocker($this->user, $this->logger, 134 | $this->config, $this->l, $this->location_service); 135 | 136 | $log_string_template = ''; 137 | $log_method = 'warning'; 138 | $this->doCheckTest($ip_address, $country_code, $this->once(), 139 | $log_string_template, $log_method, $this->never()); 140 | } 141 | 142 | /** 143 | * 144 | * @dataProvider ipCountryListProvider 145 | */ 146 | public function testLoginBlockedFromMaxmindGeoLite2(string $ip_address, 147 | string $country_code) { 148 | $this->mySetUp(); 149 | $this->location_service = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 150 | 151 | $this->geoblocker = new GeoBlocker($this->user, $this->logger, 152 | $this->config, $this->l, $this->location_service); 153 | 154 | $log_string_template = 'The user "%s" attempt to login with IP address "%s" from blocked country "%s". Login is blocked.'; 155 | $log_method = 'warning'; 156 | $isCountryInList = true; 157 | $this->doCheckTest($ip_address, $country_code, $this->once(), 158 | $log_string_template, $log_method, $this->once(), true, true, 159 | $isCountryInList); 160 | } 161 | 162 | public function ipCountryListProvider(): array { 163 | return ["ip_v6" => ['2a02:2e0:3fe:1001:302::','DE'], 164 | "ip_v4" => ['24.165.23.67','US']]; 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # This file is licensed under the Affero General Public License version 3 or 2 | # later. See the COPYING file. 3 | 4 | # Dependencies: 5 | # * make 6 | # * which 7 | # * curl: used if phpunit and composer are not installed to fetch them from the web 8 | # * tar: for building the archive 9 | # * npm: for building and testing everything JS 10 | # * ... 11 | # ... 12 | 13 | app_name=$(notdir $(CURDIR)) 14 | build_dir=$(CURDIR)/build 15 | build_tools_directory=$(build_dir)/tools 16 | source_build_directory=$(build_dir)/artifacts/source 17 | source_package_name=$(source_build_directory)/$(app_name) 18 | appstore_build_directory:=$(CURDIR)/build/appstore/$(app_name) 19 | appstore_sign_dir=$(appstore_build_directory)/sign 20 | appstore_artifact_directory:=$(CURDIR)/build/artifacts/appstore 21 | appstore_package_name:=$(appstore_artifact_directory)/$(app_name) 22 | # cert_dir=$(build_dir)/cert 23 | cert_dir=$(HOME)/.nextcloud/certificates 24 | npm=$(shell which npm 2> /dev/null) 25 | composer=$(shell which composer 2> /dev/null) 26 | version=0.5.18 27 | 28 | all: build 29 | 30 | # Fetches the PHP and JS dependencies and compiles the JS. If no composer.json 31 | # is present, the composer step is skipped, if no package.json or js/package.json 32 | # is present, the npm step is skipped 33 | .PHONY: build 34 | build: 35 | ifneq (,$(wildcard $(CURDIR)/composer.json)) 36 | make composer 37 | endif 38 | ifneq (,$(wildcard $(CURDIR)/package.json)) 39 | make npm 40 | endif 41 | ifneq (,$(wildcard $(CURDIR)/js/package.json)) 42 | make npm 43 | endif 44 | 45 | # Installs and updates the composer dependencies. If composer is not installed 46 | # a copy is fetched from the web 47 | .PHONY: composer 48 | composer: 49 | ifeq (, $(composer)) 50 | @echo "No composer command available, downloading a copy from the web" 51 | mkdir -p $(build_tools_directory) 52 | curl -sS https://getcomposer.org/installer | php 53 | mv composer.phar $(build_tools_directory) 54 | php $(build_tools_directory)/composer.phar install --prefer-dist 55 | php $(build_tools_directory)/composer.phar update --prefer-dist 56 | else 57 | composer install --prefer-dist 58 | composer update --prefer-dist 59 | endif 60 | 61 | # Installs npm dependencies 62 | .PHONY: npm 63 | npm: 64 | ifneq (, $(npm)) 65 | $(npm) install 66 | else 67 | @echo "npm command not available, please install nodejs first" 68 | @exit 1 69 | endif 70 | 71 | # Removes the appstore build 72 | .PHONY: clean 73 | clean: 74 | rm -rf $(build_tools_directory) 75 | rm -rf $(source_build_directory) 76 | rm -rf $(build_dir)/$(app_name)-*.tar.gz 77 | 78 | # Same as clean but also removes dependencies installed by composer, bower and 79 | # npm 80 | .PHONY: distclean 81 | distclean: clean 82 | rm -rf vendor 83 | rm -rf node_modules 84 | rm -rf js/vendor 85 | rm -rf js/node_modules 86 | 87 | # Builds the source and appstore package 88 | .PHONY: dist 89 | dist: 90 | make source 91 | make appstore 92 | 93 | # Builds the source package 94 | .PHONY: source 95 | source: 96 | rm -rf $(source_build_directory) 97 | mkdir -p $(source_build_directory) 98 | tar cvzf $(source_package_name).tar.gz ../$(app_name) \ 99 | --exclude-vcs \ 100 | --exclude="../$(app_name)/build" \ 101 | --exclude="../$(app_name)/js/node_modules" \ 102 | --exclude="../$(app_name)/node_modules" \ 103 | --exclude="../$(app_name)/*.log" \ 104 | --exclude="../$(app_name)/js/*.log" \ 105 | 106 | .PHONY: release 107 | release: appstore create-tag 108 | 109 | .PHONY: create-tag 110 | create-tag: 111 | git tag -s -a v$(version) -m "Tagging the $(version) release." 112 | git push origin v$(version) 113 | 114 | # Builds the source package for the app store, ignores php and js tests 115 | .PHONY: appstore 116 | appstore: 117 | tar cvz \ 118 | --exclude-vcs \ 119 | --exclude="../$(app_name)/build" \ 120 | --exclude="../$(app_name)/tests" \ 121 | --exclude="../$(app_name)/Makefile" \ 122 | --exclude="../$(app_name)/README.md" \ 123 | --exclude="../$(app_name)/phpunit*.xml" \ 124 | --exclude="../$(app_name)/composer.*" \ 125 | --exclude="../$(app_name)/package*.json" \ 126 | --exclude="../$(app_name)/.*" \ 127 | --exclude="../$(app_name)/runtest.sh" \ 128 | --exclude="../$(app_name)/helper_scripts" \ 129 | --exclude="../$(app_name)/3rdparty/*/*" \ 130 | --exclude="../$(app_name)/3rdparty/.*" \ 131 | --exclude="../$(app_name)/l10n/.*" \ 132 | --exclude="../$(app_name)/vendor" \ 133 | --exclude="../$(app_name)/node_modules" \ 134 | -f $(build_dir)/$(app_name)-$(version).tar.gz ../$(app_name) 135 | @if [ -f $(cert_dir)/$(app_name).key ]; then \ 136 | echo "Signing package…"; \ 137 | openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(version).tar.gz | openssl base64; \ 138 | fi 139 | 140 | # Builds the source package for the app store for the github action 141 | .PHONY: appstore2 142 | appstore2: 143 | rm -rf $(appstore_build_directory) $(appstore_sign_dir) $(appstore_artifact_directory) 144 | mkdir -p $(appstore_sign_dir)/$(app_name) 145 | cp -r \ 146 | "3rdparty" \ 147 | "appinfo" \ 148 | "css" \ 149 | "img" \ 150 | "js" \ 151 | "l10n" \ 152 | "lib" \ 153 | "templates" \ 154 | "COPYING" \ 155 | $(appstore_sign_dir)/$(app_name) 156 | 157 | rm -f $(appstore_sign_dir)/$(app_name)/3rdparty/maxmind_geolite2/* 158 | rm -f $(appstore_sign_dir)/$(app_name)/3rdparty/rir_data/* 159 | rm -f $(appstore_sign_dir)/$(app_name)/3rdparty/maxmind_geolite2/.gitkeep 160 | rm -f $(appstore_sign_dir)/$(app_name)/3rdparty/rir_data/.gitkeep 161 | rm -f $(appstore_sign_dir)/$(app_name)/3rdparty/.gitkeep 162 | 163 | mkdir -p $(cert_dir) 164 | php ./bin/tools/file_from_env.php "app_private_key" "$(cert_dir)/$(app_name).key" 165 | php ./bin/tools/file_from_env.php "app_public_crt" "$(cert_dir)/$(app_name).crt" 166 | 167 | #@if [ -f $(cert_dir)/$(app_name).key ]; then \ 168 | # echo "Signing app files…"; \ 169 | # php ../../occ integrity:sign-app \ 170 | # --privateKey=$(cert_dir)/$(app_name).key\ 171 | # --certificate=$(cert_dir)/$(app_name).crt\ 172 | # --path=$(appstore_sign_dir)/$(app_name); \ 173 | # echo "Signing app files ... done"; \ 174 | #fi 175 | 176 | mkdir -p $(appstore_artifact_directory) 177 | tar -czf $(appstore_package_name).tar.gz -C $(appstore_sign_dir) $(app_name) 178 | 179 | .PHONY: unit-test 180 | unit-test: 181 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.xml 182 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.special1.xml 183 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.special2.xml 184 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.special3.xml 185 | 186 | .PHONY: integration-test 187 | integration-test: 188 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.integration.xml 189 | 190 | .PHONY: test 191 | test: unit-test integration-test 192 | 193 | .PHONY: unit-test-cov 194 | unit-test-cov: 195 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.xml --coverage-html $(CURDIR)/build/coverage_report_unit --coverage-filter $(CURDIR)/lib/ 196 | 197 | .PHONY: integration-test-cov 198 | integration-test-cov: 199 | $(CURDIR)/vendor/phpunit/phpunit/phpunit -c $(CURDIR)/phpunit.integration.xml --coverage-html build/coverage_report_integration --coverage-filter lib/ 200 | 201 | .PHONY: test-cov 202 | test-cov: unit-test-cov integration-test-cov 203 | 204 | .PHONY: prepare-test 205 | prepare-test: 206 | make composer 207 | rm -Rf $(CURDIR)/../../3rdparty/nikic/php-parser/ 208 | cp -R $(CURDIR)/vendor/nikic/php-parser/ $(CURDIR)/../../3rdparty/nikic/ 209 | wget https://github.com/maxmind/GeoIP2-php/releases/latest/download/geoip2.phar -O $(CURDIR)/3rdparty/maxmind_geolite2/geoip2.phar 210 | chown www-data:1000 $(CURDIR)/3rdparty/maxmind_geolite2/geoip2.phar 211 | -------------------------------------------------------------------------------- /l10n/id.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "OK" : "OK", 3 | "Loading" : "Memuat", 4 | "Andorra" : "Andorra", 5 | "United Arab Emirates" : "Uni Emirat Arab", 6 | "Afghanistan" : "Afganistan", 7 | "Antigua and Barbuda" : "Antigua dan Barbuda", 8 | "Anguilla" : "Anguilla", 9 | "Albania" : "Albania", 10 | "Armenia" : "Armenia", 11 | "Angola" : "Angola", 12 | "Antarctica" : "Antartika", 13 | "Argentina" : "Argentina", 14 | "American Samoa" : "Samoa Amerika", 15 | "Austria" : "Austria", 16 | "Australia" : "Australia", 17 | "Aruba" : "Aruba", 18 | "Åland Islands" : "Pulau Åland", 19 | "Azerbaijan" : "Azerbaijan", 20 | "Bosnia and Herzegovina" : "Bosnia dan Herzegovina", 21 | "Barbados" : "Barbados", 22 | "Bangladesh" : "Bangladesh", 23 | "Belgium" : "Belgium", 24 | "Burkina Faso" : "Burkina Faso", 25 | "Bulgaria" : "Bulgaria", 26 | "Bahrain" : "Bahrain", 27 | "Burundi" : "Burundi", 28 | "Benin" : "Benin", 29 | "Saint Barthélemy" : "Saint Barthelemy", 30 | "Bermuda" : "Bermuda", 31 | "Bonaire, Sint Eustatius and Saba" : "Bonaire, Sint Eustatius dan Saba", 32 | "Brazil" : "Brazil", 33 | "Bahamas" : "Bahamas", 34 | "Bhutan" : "Bhutan", 35 | "Bouvet Island" : "Bouvet Island", 36 | "Botswana" : "Botswana", 37 | "Belarus" : "Belarus", 38 | "Belize" : "Belize", 39 | "Canada" : "Kanada", 40 | "Cocos (Keeling) Islands" : "Pulau Cocos (Keeling)", 41 | "Central African Republic" : "Republik Afrika Tengah", 42 | "Congo" : "Congo", 43 | "Switzerland" : "Swiss", 44 | "Cook Islands" : "Pulau Cook", 45 | "Chile" : "Chile", 46 | "Cameroon" : "Cameroon", 47 | "China" : "Cina", 48 | "Colombia" : "Colombia", 49 | "Costa Rica" : "Costa Rica", 50 | "Cuba" : "Cuba", 51 | "Cabo Verde" : "Cabo Verde", 52 | "Curaçao" : "Curaçao", 53 | "Christmas Island" : "Pulau Natal", 54 | "Cyprus" : "Cyprus", 55 | "Germany" : "Jerman", 56 | "Djibouti" : "Djibouti", 57 | "Denmark" : "Denmark", 58 | "Dominican Republic" : "Republik Dominika", 59 | "Algeria" : "Algeria", 60 | "Ecuador" : "Ekuador", 61 | "Estonia" : "Estonia", 62 | "Egypt" : "Mesir", 63 | "Eritrea" : "Eritrea", 64 | "Spain" : "Spanyol", 65 | "Ethiopia" : "Ethiopia", 66 | "Finland" : "Finlandia", 67 | "Fiji" : "Fiji", 68 | "Faroe Islands" : "Pulau Faroe", 69 | "France" : "Prancis", 70 | "Gabon" : "Gabon", 71 | "Grenada" : "Grenada", 72 | "Georgia" : "Georgia", 73 | "French Guiana" : "Guyana Prancis", 74 | "Guernsey" : "Guernsey", 75 | "Ghana" : "Ghana", 76 | "Gibraltar" : "Gibraltar", 77 | "Greenland" : "Greenland", 78 | "Gambia" : "Gambia", 79 | "Guinea" : "Guinea", 80 | "Guadeloupe" : "Guadeloupe", 81 | "Equatorial Guinea" : "Guinea Khatulistiwa", 82 | "Greece" : "Yunani", 83 | "South Georgia and the South Sandwich Islands" : "Georgia Selatan dan Kepulauan Sandwich Selatan", 84 | "Guatemala" : "Guatemala", 85 | "Guam" : "Guam", 86 | "Guinea-Bissau" : "Guinea-Bissau", 87 | "Guyana" : "Guyana", 88 | "Hong Kong" : "Hong Kong", 89 | "Heard Island and McDonald Islands" : "Pulau Heard dan Kepulauan McDonald", 90 | "Honduras" : "Honduras", 91 | "Croatia" : "Kroatia", 92 | "Haiti" : "Haiti", 93 | "Hungary" : "Hungaria", 94 | "Indonesia" : "Indonesia", 95 | "Ireland" : "Irlandia", 96 | "Israel" : "Israel", 97 | "Isle of Man" : "Isle of Man", 98 | "India" : "India", 99 | "British Indian Ocean Territory" : "Wilayah Samudra Hindia Inggris", 100 | "Iraq" : "Irak", 101 | "Iceland" : "Islandia", 102 | "Italy" : "Italia", 103 | "Jamaica" : "Jamaika", 104 | "Jordan" : "Jordan", 105 | "Japan" : "Jepang", 106 | "Kenya" : "Kenya", 107 | "Kyrgyzstan" : "Kirgizstan", 108 | "Cambodia" : "Kambodia", 109 | "Kiribati" : "Kiribati", 110 | "Saint Kitts and Nevis" : "Saint Kitts dan Nevis", 111 | "Kuwait" : "Kuwait", 112 | "Cayman Islands" : "Kepulauan Cayman", 113 | "Kazakhstan" : "Kazakhstan", 114 | "Lebanon" : "Lebanon", 115 | "Saint Lucia" : "Saint Lucia", 116 | "Liechtenstein" : "Liechtenstein", 117 | "Sri Lanka" : "Sri Lanka", 118 | "Liberia" : "Liberia", 119 | "Lesotho" : "Lesotho", 120 | "Lithuania" : "Lithuania", 121 | "Luxembourg" : "Luksemburg", 122 | "Latvia" : "Latvia", 123 | "Libya" : "Libya", 124 | "Morocco" : "Maroko", 125 | "Monaco" : "Monako", 126 | "Montenegro" : "Montenegro", 127 | "Madagascar" : "Madagascar", 128 | "Marshall Islands" : "Kepulauan Marshall", 129 | "Mali" : "Mali", 130 | "Myanmar" : "Myanmar", 131 | "Mongolia" : "Mongolia", 132 | "Macao" : "Macao", 133 | "Northern Mariana Islands" : "Kepulauan Mariana Utara", 134 | "Mauritania" : "Mauritania", 135 | "Montserrat" : "Montserrat", 136 | "Malta" : "Malta", 137 | "Mauritius" : "Mauritius", 138 | "Maldives" : "Maldives", 139 | "Malawi" : "Malawi", 140 | "Mexico" : "Meksiko", 141 | "Malaysia" : "Malaysia", 142 | "Mozambique" : "Mozambik", 143 | "Namibia" : "Namibia", 144 | "New Caledonia" : "Kaledonia Baru", 145 | "Niger" : "Niger", 146 | "Norfolk Island" : "Kepulauan Norfolk", 147 | "Nigeria" : "Nigeria", 148 | "Nicaragua" : "Nikaragua", 149 | "Netherlands" : "Belanda", 150 | "Norway" : "Norwegia", 151 | "Nepal" : "Nepal", 152 | "Nauru" : "Nauru", 153 | "Niue" : "Niue", 154 | "New Zealand" : "Selandia Baru", 155 | "Oman" : "Oman", 156 | "Panama" : "Panama", 157 | "Peru" : "Peru", 158 | "French Polynesia" : "Polinesia Prancis", 159 | "Papua New Guinea" : "Papua Nugini", 160 | "Philippines" : "Filipina", 161 | "Pakistan" : "Pakistan", 162 | "Poland" : "Polandia", 163 | "Saint Pierre and Miquelon" : "Saint Pierre dan Miquelon", 164 | "Pitcairn" : "Pitcairn", 165 | "Puerto Rico" : "Puerto Rico", 166 | "Portugal" : "Portugis", 167 | "Palau" : "Palau", 168 | "Paraguay" : "Paraguay", 169 | "Qatar" : "Qatar", 170 | "Réunion" : "Réunion", 171 | "Romania" : "Romania", 172 | "Serbia" : "Serbia", 173 | "Rwanda" : "Rwanda", 174 | "Saudi Arabia" : "Arab Saudi", 175 | "Solomon Islands" : "Kepulauan Solomon", 176 | "Seychelles" : "Seychelles", 177 | "Sudan" : "Sudan", 178 | "Sweden" : "Swedia", 179 | "Singapore" : "Singapora", 180 | "Saint Helena, Ascension and Tristan da Cunha" : "Saint Helena, Ascension dan Tristan da Cunha", 181 | "Slovenia" : "Slovenia", 182 | "Svalbard and Jan Mayen" : "Svalbard dan Jan Mayen", 183 | "Slovakia" : "Slovakia", 184 | "Sierra Leone" : "Sierra Leone", 185 | "San Marino" : "San Marino", 186 | "Senegal" : "Senegal", 187 | "Somalia" : "Somalia", 188 | "Suriname" : "Suriname", 189 | "South Sudan" : "Sudan Selatan", 190 | "Sao Tome and Principe" : "Sao Tome dan Principe", 191 | "El Salvador" : "El Salvador", 192 | "Turks and Caicos Islands" : "Kepulauan Turks dan Caicos", 193 | "Chad" : "Chad", 194 | "Togo" : "Togo", 195 | "Thailand" : "Thailand", 196 | "Tajikistan" : "Tajikistan", 197 | "Tokelau" : "Tokelau", 198 | "Timor-Leste" : "Timor Leste", 199 | "Turkmenistan" : "Turkmenistan", 200 | "Tunisia" : "Tunisia", 201 | "Tonga" : "Tonga", 202 | "Turkey" : "Turki", 203 | "Trinidad and Tobago" : "Trinidad dan Tobago", 204 | "Tuvalu" : "Tuvalu", 205 | "Ukraine" : "Ukraina", 206 | "Uganda" : "Uganda", 207 | "United States Minor Outlying Islands" : "Pulau Kecil Terluar Amerika Serikat", 208 | "Uruguay" : "Uruguay", 209 | "Uzbekistan" : "Uzbekistan", 210 | "Holy See" : "Holy See", 211 | "Saint Vincent and the Grenadines" : "Saint Vincent dan Grenadine", 212 | "Virgin Islands (British)" : "Kepulauan Virgin (Inggris)", 213 | "Virgin Islands (U.S.)" : "Kepulauan Virgin (AS)", 214 | "Vanuatu" : "Vanuatu", 215 | "Wallis and Futuna" : "Wallis dan Futuna", 216 | "Samoa" : "Samoa", 217 | "Yemen" : "Yemen", 218 | "Mayotte" : "Mayotte", 219 | "South Africa" : "Afrika Selatan", 220 | "Zambia" : "Zambia", 221 | "Zimbabwe" : "Zimbabwe" 222 | },"pluralForm" :"nplurals=1; plural=0;" 223 | } -------------------------------------------------------------------------------- /l10n/id.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "geoblocker", 3 | { 4 | "OK" : "OK", 5 | "Loading" : "Memuat", 6 | "Andorra" : "Andorra", 7 | "United Arab Emirates" : "Uni Emirat Arab", 8 | "Afghanistan" : "Afganistan", 9 | "Antigua and Barbuda" : "Antigua dan Barbuda", 10 | "Anguilla" : "Anguilla", 11 | "Albania" : "Albania", 12 | "Armenia" : "Armenia", 13 | "Angola" : "Angola", 14 | "Antarctica" : "Antartika", 15 | "Argentina" : "Argentina", 16 | "American Samoa" : "Samoa Amerika", 17 | "Austria" : "Austria", 18 | "Australia" : "Australia", 19 | "Aruba" : "Aruba", 20 | "Åland Islands" : "Pulau Åland", 21 | "Azerbaijan" : "Azerbaijan", 22 | "Bosnia and Herzegovina" : "Bosnia dan Herzegovina", 23 | "Barbados" : "Barbados", 24 | "Bangladesh" : "Bangladesh", 25 | "Belgium" : "Belgium", 26 | "Burkina Faso" : "Burkina Faso", 27 | "Bulgaria" : "Bulgaria", 28 | "Bahrain" : "Bahrain", 29 | "Burundi" : "Burundi", 30 | "Benin" : "Benin", 31 | "Saint Barthélemy" : "Saint Barthelemy", 32 | "Bermuda" : "Bermuda", 33 | "Bonaire, Sint Eustatius and Saba" : "Bonaire, Sint Eustatius dan Saba", 34 | "Brazil" : "Brazil", 35 | "Bahamas" : "Bahamas", 36 | "Bhutan" : "Bhutan", 37 | "Bouvet Island" : "Bouvet Island", 38 | "Botswana" : "Botswana", 39 | "Belarus" : "Belarus", 40 | "Belize" : "Belize", 41 | "Canada" : "Kanada", 42 | "Cocos (Keeling) Islands" : "Pulau Cocos (Keeling)", 43 | "Central African Republic" : "Republik Afrika Tengah", 44 | "Congo" : "Congo", 45 | "Switzerland" : "Swiss", 46 | "Cook Islands" : "Pulau Cook", 47 | "Chile" : "Chile", 48 | "Cameroon" : "Cameroon", 49 | "China" : "Cina", 50 | "Colombia" : "Colombia", 51 | "Costa Rica" : "Costa Rica", 52 | "Cuba" : "Cuba", 53 | "Cabo Verde" : "Cabo Verde", 54 | "Curaçao" : "Curaçao", 55 | "Christmas Island" : "Pulau Natal", 56 | "Cyprus" : "Cyprus", 57 | "Germany" : "Jerman", 58 | "Djibouti" : "Djibouti", 59 | "Denmark" : "Denmark", 60 | "Dominican Republic" : "Republik Dominika", 61 | "Algeria" : "Algeria", 62 | "Ecuador" : "Ekuador", 63 | "Estonia" : "Estonia", 64 | "Egypt" : "Mesir", 65 | "Eritrea" : "Eritrea", 66 | "Spain" : "Spanyol", 67 | "Ethiopia" : "Ethiopia", 68 | "Finland" : "Finlandia", 69 | "Fiji" : "Fiji", 70 | "Faroe Islands" : "Pulau Faroe", 71 | "France" : "Prancis", 72 | "Gabon" : "Gabon", 73 | "Grenada" : "Grenada", 74 | "Georgia" : "Georgia", 75 | "French Guiana" : "Guyana Prancis", 76 | "Guernsey" : "Guernsey", 77 | "Ghana" : "Ghana", 78 | "Gibraltar" : "Gibraltar", 79 | "Greenland" : "Greenland", 80 | "Gambia" : "Gambia", 81 | "Guinea" : "Guinea", 82 | "Guadeloupe" : "Guadeloupe", 83 | "Equatorial Guinea" : "Guinea Khatulistiwa", 84 | "Greece" : "Yunani", 85 | "South Georgia and the South Sandwich Islands" : "Georgia Selatan dan Kepulauan Sandwich Selatan", 86 | "Guatemala" : "Guatemala", 87 | "Guam" : "Guam", 88 | "Guinea-Bissau" : "Guinea-Bissau", 89 | "Guyana" : "Guyana", 90 | "Hong Kong" : "Hong Kong", 91 | "Heard Island and McDonald Islands" : "Pulau Heard dan Kepulauan McDonald", 92 | "Honduras" : "Honduras", 93 | "Croatia" : "Kroatia", 94 | "Haiti" : "Haiti", 95 | "Hungary" : "Hungaria", 96 | "Indonesia" : "Indonesia", 97 | "Ireland" : "Irlandia", 98 | "Israel" : "Israel", 99 | "Isle of Man" : "Isle of Man", 100 | "India" : "India", 101 | "British Indian Ocean Territory" : "Wilayah Samudra Hindia Inggris", 102 | "Iraq" : "Irak", 103 | "Iceland" : "Islandia", 104 | "Italy" : "Italia", 105 | "Jamaica" : "Jamaika", 106 | "Jordan" : "Jordan", 107 | "Japan" : "Jepang", 108 | "Kenya" : "Kenya", 109 | "Kyrgyzstan" : "Kirgizstan", 110 | "Cambodia" : "Kambodia", 111 | "Kiribati" : "Kiribati", 112 | "Saint Kitts and Nevis" : "Saint Kitts dan Nevis", 113 | "Kuwait" : "Kuwait", 114 | "Cayman Islands" : "Kepulauan Cayman", 115 | "Kazakhstan" : "Kazakhstan", 116 | "Lebanon" : "Lebanon", 117 | "Saint Lucia" : "Saint Lucia", 118 | "Liechtenstein" : "Liechtenstein", 119 | "Sri Lanka" : "Sri Lanka", 120 | "Liberia" : "Liberia", 121 | "Lesotho" : "Lesotho", 122 | "Lithuania" : "Lithuania", 123 | "Luxembourg" : "Luksemburg", 124 | "Latvia" : "Latvia", 125 | "Libya" : "Libya", 126 | "Morocco" : "Maroko", 127 | "Monaco" : "Monako", 128 | "Montenegro" : "Montenegro", 129 | "Madagascar" : "Madagascar", 130 | "Marshall Islands" : "Kepulauan Marshall", 131 | "Mali" : "Mali", 132 | "Myanmar" : "Myanmar", 133 | "Mongolia" : "Mongolia", 134 | "Macao" : "Macao", 135 | "Northern Mariana Islands" : "Kepulauan Mariana Utara", 136 | "Mauritania" : "Mauritania", 137 | "Montserrat" : "Montserrat", 138 | "Malta" : "Malta", 139 | "Mauritius" : "Mauritius", 140 | "Maldives" : "Maldives", 141 | "Malawi" : "Malawi", 142 | "Mexico" : "Meksiko", 143 | "Malaysia" : "Malaysia", 144 | "Mozambique" : "Mozambik", 145 | "Namibia" : "Namibia", 146 | "New Caledonia" : "Kaledonia Baru", 147 | "Niger" : "Niger", 148 | "Norfolk Island" : "Kepulauan Norfolk", 149 | "Nigeria" : "Nigeria", 150 | "Nicaragua" : "Nikaragua", 151 | "Netherlands" : "Belanda", 152 | "Norway" : "Norwegia", 153 | "Nepal" : "Nepal", 154 | "Nauru" : "Nauru", 155 | "Niue" : "Niue", 156 | "New Zealand" : "Selandia Baru", 157 | "Oman" : "Oman", 158 | "Panama" : "Panama", 159 | "Peru" : "Peru", 160 | "French Polynesia" : "Polinesia Prancis", 161 | "Papua New Guinea" : "Papua Nugini", 162 | "Philippines" : "Filipina", 163 | "Pakistan" : "Pakistan", 164 | "Poland" : "Polandia", 165 | "Saint Pierre and Miquelon" : "Saint Pierre dan Miquelon", 166 | "Pitcairn" : "Pitcairn", 167 | "Puerto Rico" : "Puerto Rico", 168 | "Portugal" : "Portugis", 169 | "Palau" : "Palau", 170 | "Paraguay" : "Paraguay", 171 | "Qatar" : "Qatar", 172 | "Réunion" : "Réunion", 173 | "Romania" : "Romania", 174 | "Serbia" : "Serbia", 175 | "Rwanda" : "Rwanda", 176 | "Saudi Arabia" : "Arab Saudi", 177 | "Solomon Islands" : "Kepulauan Solomon", 178 | "Seychelles" : "Seychelles", 179 | "Sudan" : "Sudan", 180 | "Sweden" : "Swedia", 181 | "Singapore" : "Singapora", 182 | "Saint Helena, Ascension and Tristan da Cunha" : "Saint Helena, Ascension dan Tristan da Cunha", 183 | "Slovenia" : "Slovenia", 184 | "Svalbard and Jan Mayen" : "Svalbard dan Jan Mayen", 185 | "Slovakia" : "Slovakia", 186 | "Sierra Leone" : "Sierra Leone", 187 | "San Marino" : "San Marino", 188 | "Senegal" : "Senegal", 189 | "Somalia" : "Somalia", 190 | "Suriname" : "Suriname", 191 | "South Sudan" : "Sudan Selatan", 192 | "Sao Tome and Principe" : "Sao Tome dan Principe", 193 | "El Salvador" : "El Salvador", 194 | "Turks and Caicos Islands" : "Kepulauan Turks dan Caicos", 195 | "Chad" : "Chad", 196 | "Togo" : "Togo", 197 | "Thailand" : "Thailand", 198 | "Tajikistan" : "Tajikistan", 199 | "Tokelau" : "Tokelau", 200 | "Timor-Leste" : "Timor Leste", 201 | "Turkmenistan" : "Turkmenistan", 202 | "Tunisia" : "Tunisia", 203 | "Tonga" : "Tonga", 204 | "Turkey" : "Turki", 205 | "Trinidad and Tobago" : "Trinidad dan Tobago", 206 | "Tuvalu" : "Tuvalu", 207 | "Ukraine" : "Ukraina", 208 | "Uganda" : "Uganda", 209 | "United States Minor Outlying Islands" : "Pulau Kecil Terluar Amerika Serikat", 210 | "Uruguay" : "Uruguay", 211 | "Uzbekistan" : "Uzbekistan", 212 | "Holy See" : "Holy See", 213 | "Saint Vincent and the Grenadines" : "Saint Vincent dan Grenadine", 214 | "Virgin Islands (British)" : "Kepulauan Virgin (Inggris)", 215 | "Virgin Islands (U.S.)" : "Kepulauan Virgin (AS)", 216 | "Vanuatu" : "Vanuatu", 217 | "Wallis and Futuna" : "Wallis dan Futuna", 218 | "Samoa" : "Samoa", 219 | "Yemen" : "Yemen", 220 | "Mayotte" : "Mayotte", 221 | "South Africa" : "Afrika Selatan", 222 | "Zambia" : "Zambia", 223 | "Zimbabwe" : "Zimbabwe" 224 | }, 225 | "nplurals=1; plural=0;"); 226 | -------------------------------------------------------------------------------- /l10n/es_MX.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "OK" : "OK", 3 | "Loading" : "Cargando", 4 | "Andorra" : "Andorra", 5 | "United Arab Emirates" : "Emiratos Árabes Unidos", 6 | "Afghanistan" : "Afghanistán", 7 | "Antigua and Barbuda" : "Antigua y Barbuda", 8 | "Anguilla" : "Anguila", 9 | "Albania" : "Albania", 10 | "Armenia" : "Armenia", 11 | "Angola" : "Angola", 12 | "Antarctica" : "Antártida", 13 | "Argentina" : "Argentina", 14 | "American Samoa" : "Samoa Americana", 15 | "Austria" : "Austria", 16 | "Australia" : "Australia", 17 | "Aruba" : "Aruba", 18 | "Åland Islands" : "Islas Åland", 19 | "Azerbaijan" : "Azerbaiyán", 20 | "Bosnia and Herzegovina" : "Bosnia y Herzegovina", 21 | "Barbados" : "Barbados", 22 | "Bangladesh" : "Bangladesh", 23 | "Belgium" : "Bélgica", 24 | "Burkina Faso" : "Burkina Faso", 25 | "Bulgaria" : "Bulgaria", 26 | "Bahrain" : "Baréin", 27 | "Burundi" : "Burundi", 28 | "Benin" : "Benín", 29 | "Saint Barthélemy" : "San Bartolomé", 30 | "Bermuda" : "Bermudas", 31 | "Bonaire, Sint Eustatius and Saba" : "Bonaire, San Eustaquio y Saba", 32 | "Brazil" : "Brasil", 33 | "Bahamas" : "Bahamas", 34 | "Bhutan" : "Bután", 35 | "Bouvet Island" : "Isla Bouvet", 36 | "Botswana" : "Botsuana", 37 | "Belarus" : "Bielorrusia", 38 | "Belize" : "Belice", 39 | "Canada" : "Canadá", 40 | "Cocos (Keeling) Islands" : "Islas Cocos (Keeling)", 41 | "Central African Republic" : "República Centroafricana", 42 | "Congo" : "Congo", 43 | "Switzerland" : "Suiza", 44 | "Cook Islands" : "Islas Cook", 45 | "Chile" : "Chile", 46 | "Cameroon" : "Camerún", 47 | "China" : "China", 48 | "Colombia" : "Colombia", 49 | "Costa Rica" : "Costa Rica", 50 | "Cuba" : "Cuba", 51 | "Cabo Verde" : "Cabo Verde", 52 | "Curaçao" : "Curazao", 53 | "Christmas Island" : "Islas Navidad", 54 | "Cyprus" : "Chipre", 55 | "Germany" : "Alemania", 56 | "Djibouti" : "Djibouti", 57 | "Denmark" : "Dinamarca", 58 | "Dominican Republic" : "República Dominicana", 59 | "Algeria" : "Algeria", 60 | "Ecuador" : "Ecuador", 61 | "Estonia" : "Estonia", 62 | "Egypt" : "Egipto", 63 | "Eritrea" : "Eritrea", 64 | "Spain" : "España", 65 | "Ethiopia" : "Etiopía", 66 | "Finland" : "Finlandia", 67 | "Fiji" : "Fiji", 68 | "Faroe Islands" : "Islas Faroe", 69 | "France" : "Francia", 70 | "Gabon" : "Gabón", 71 | "Grenada" : "Granada", 72 | "Georgia" : "Georgia", 73 | "French Guiana" : "Guyana Francesa", 74 | "Guernsey" : "Guernesey", 75 | "Ghana" : "Ghana", 76 | "Gibraltar" : "Gibraltar", 77 | "Greenland" : "Groenlandia", 78 | "Gambia" : "Gambia", 79 | "Guinea" : "Guinea", 80 | "Guadeloupe" : "Guadalupe", 81 | "Equatorial Guinea" : "Guinea Ecuatorial", 82 | "Greece" : "Grecia", 83 | "South Georgia and the South Sandwich Islands" : "Islas Georgia del Sur y Sandwich del Sur", 84 | "Guatemala" : "Guatemala", 85 | "Guam" : "Guam", 86 | "Guinea-Bissau" : "Guinea-Bissau", 87 | "Guyana" : "Guyana", 88 | "Hong Kong" : "Hong Kong", 89 | "Heard Island and McDonald Islands" : "Isla Heard e Islas McDonald", 90 | "Honduras" : "Honduras", 91 | "Croatia" : "Croacia", 92 | "Haiti" : "Haití", 93 | "Hungary" : "Hungría", 94 | "Indonesia" : "Indonesia", 95 | "Ireland" : "Irlanda", 96 | "Israel" : "Israel", 97 | "Isle of Man" : "Isla de Man", 98 | "India" : "India", 99 | "British Indian Ocean Territory" : "Territorio Británico del Océano Índico", 100 | "Iraq" : "Iraq", 101 | "Iceland" : "Islandia", 102 | "Italy" : "Italia", 103 | "Jamaica" : "Jamaica", 104 | "Jordan" : "Jordania", 105 | "Japan" : "Japón", 106 | "Kenya" : "Kenia", 107 | "Kyrgyzstan" : "Kirguistán", 108 | "Cambodia" : "Camboya", 109 | "Kiribati" : "Kiribati", 110 | "Saint Kitts and Nevis" : "San Cristóbal y Nieves", 111 | "Kuwait" : "Kuwait", 112 | "Cayman Islands" : "Islas Caimán", 113 | "Kazakhstan" : "Kazajistán", 114 | "Lebanon" : "Líbano", 115 | "Saint Lucia" : "Santa Lucía", 116 | "Liechtenstein" : "Liechtenstein", 117 | "Sri Lanka" : "Sri Lanka", 118 | "Liberia" : "Liberia", 119 | "Lesotho" : "Lesoto", 120 | "Lithuania" : "Lituania", 121 | "Luxembourg" : "Luxemburgo", 122 | "Latvia" : "Letonia", 123 | "Libya" : "Libia", 124 | "Morocco" : "Marruecos", 125 | "Monaco" : "Mónaco", 126 | "Montenegro" : "Montenegro", 127 | "Madagascar" : "Madagascar", 128 | "Marshall Islands" : "Islas Marshall", 129 | "Mali" : "Malí", 130 | "Myanmar" : "Birmania", 131 | "Mongolia" : "Mongolia", 132 | "Macao" : "Macao", 133 | "Northern Mariana Islands" : "Islas Marianas del Norte", 134 | "Mauritania" : "Mauritania", 135 | "Montserrat" : "Montserrat", 136 | "Malta" : "Malta", 137 | "Mauritius" : "Mauricio", 138 | "Maldives" : "Maldivas", 139 | "Malawi" : "Malawi", 140 | "Mexico" : "México", 141 | "Malaysia" : "Malasia", 142 | "Mozambique" : "Mozambique", 143 | "Namibia" : "Namibia", 144 | "New Caledonia" : "Nueva Caledonia", 145 | "Niger" : "Níger", 146 | "Norfolk Island" : "Isla Norfolk", 147 | "Nigeria" : "Nigeria", 148 | "Nicaragua" : "Nicaragua", 149 | "Netherlands" : "Países Bajos", 150 | "Norway" : "Noruega", 151 | "Nepal" : "Nepal", 152 | "Nauru" : "Nauru", 153 | "Niue" : "Niue", 154 | "New Zealand" : "Nueva Zelanda", 155 | "Oman" : "Omán", 156 | "Panama" : "Panamá", 157 | "Peru" : "Perú", 158 | "French Polynesia" : "Polinesia Francesa", 159 | "Papua New Guinea" : "Papúa Nueva Guinea", 160 | "Philippines" : "Filipinas", 161 | "Pakistan" : "Pakistán", 162 | "Poland" : "Polonia", 163 | "Saint Pierre and Miquelon" : "San Pedro y Miquelón", 164 | "Pitcairn" : "Pitcairn", 165 | "Puerto Rico" : "Puerto Rico", 166 | "Portugal" : "Portugal", 167 | "Palau" : "Palau", 168 | "Paraguay" : "Paraguay", 169 | "Qatar" : "Catar", 170 | "Réunion" : "Reunión", 171 | "Romania" : "Rumanía", 172 | "Serbia" : "Serbia", 173 | "Rwanda" : "Ruanda", 174 | "Saudi Arabia" : "Arabia Saudita", 175 | "Solomon Islands" : "Islas Salomón", 176 | "Seychelles" : "Seychelles", 177 | "Sudan" : "Sudán", 178 | "Sweden" : "Suecia", 179 | "Singapore" : "Singapur", 180 | "Saint Helena, Ascension and Tristan da Cunha" : "Santa Elena, Ascensión y Tristán de Acuña", 181 | "Slovenia" : "Eslovenia", 182 | "Svalbard and Jan Mayen" : "Svalbard y Jan Mayen", 183 | "Slovakia" : "Eslovaquia", 184 | "Sierra Leone" : "Sierra Leona", 185 | "San Marino" : "San Marino", 186 | "Senegal" : "Senegal", 187 | "Somalia" : "Somalia", 188 | "Suriname" : "Surinam", 189 | "South Sudan" : "Sudán del Sur", 190 | "Sao Tome and Principe" : "Santo Tomé y Príncipe", 191 | "El Salvador" : "El Salvador", 192 | "Turks and Caicos Islands" : "Islas Turcas y Caicos", 193 | "Chad" : "Chad", 194 | "Togo" : "Togo", 195 | "Thailand" : "Tailandia", 196 | "Tajikistan" : "Tayikistán", 197 | "Tokelau" : "Tokelau", 198 | "Timor-Leste" : "Timor Oriental", 199 | "Turkmenistan" : "Turkmenistán", 200 | "Tunisia" : "Túnez", 201 | "Tonga" : "Tonga", 202 | "Turkey" : "Turquía", 203 | "Trinidad and Tobago" : "Trinidad y Tobago", 204 | "Tuvalu" : "Tuvalu", 205 | "Ukraine" : "Ucrania", 206 | "Uganda" : "Uganda", 207 | "United States Minor Outlying Islands" : "Islas menores alejadas de los Estados Unidos", 208 | "Uruguay" : "Uruguay", 209 | "Uzbekistan" : "Uzbekistán", 210 | "Holy See" : "Santa Sede", 211 | "Saint Vincent and the Grenadines" : "San Vicente y las Granadinas", 212 | "Virgin Islands (British)" : "Islas Vírgenes Británicas", 213 | "Virgin Islands (U.S.)" : "Islas Vírgenes (estadounidenses)", 214 | "Vanuatu" : "Vanuatu", 215 | "Wallis and Futuna" : "Wallis and Futuna", 216 | "Samoa" : "Samoa", 217 | "Yemen" : "Yemen", 218 | "Mayotte" : "Mayotte", 219 | "South Africa" : "Sudáfrica", 220 | "Zambia" : "Zambia", 221 | "Zimbabwe" : "Zimbabue" 222 | },"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" 223 | } -------------------------------------------------------------------------------- /l10n/es_MX.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "geoblocker", 3 | { 4 | "OK" : "OK", 5 | "Loading" : "Cargando", 6 | "Andorra" : "Andorra", 7 | "United Arab Emirates" : "Emiratos Árabes Unidos", 8 | "Afghanistan" : "Afghanistán", 9 | "Antigua and Barbuda" : "Antigua y Barbuda", 10 | "Anguilla" : "Anguila", 11 | "Albania" : "Albania", 12 | "Armenia" : "Armenia", 13 | "Angola" : "Angola", 14 | "Antarctica" : "Antártida", 15 | "Argentina" : "Argentina", 16 | "American Samoa" : "Samoa Americana", 17 | "Austria" : "Austria", 18 | "Australia" : "Australia", 19 | "Aruba" : "Aruba", 20 | "Åland Islands" : "Islas Åland", 21 | "Azerbaijan" : "Azerbaiyán", 22 | "Bosnia and Herzegovina" : "Bosnia y Herzegovina", 23 | "Barbados" : "Barbados", 24 | "Bangladesh" : "Bangladesh", 25 | "Belgium" : "Bélgica", 26 | "Burkina Faso" : "Burkina Faso", 27 | "Bulgaria" : "Bulgaria", 28 | "Bahrain" : "Baréin", 29 | "Burundi" : "Burundi", 30 | "Benin" : "Benín", 31 | "Saint Barthélemy" : "San Bartolomé", 32 | "Bermuda" : "Bermudas", 33 | "Bonaire, Sint Eustatius and Saba" : "Bonaire, San Eustaquio y Saba", 34 | "Brazil" : "Brasil", 35 | "Bahamas" : "Bahamas", 36 | "Bhutan" : "Bután", 37 | "Bouvet Island" : "Isla Bouvet", 38 | "Botswana" : "Botsuana", 39 | "Belarus" : "Bielorrusia", 40 | "Belize" : "Belice", 41 | "Canada" : "Canadá", 42 | "Cocos (Keeling) Islands" : "Islas Cocos (Keeling)", 43 | "Central African Republic" : "República Centroafricana", 44 | "Congo" : "Congo", 45 | "Switzerland" : "Suiza", 46 | "Cook Islands" : "Islas Cook", 47 | "Chile" : "Chile", 48 | "Cameroon" : "Camerún", 49 | "China" : "China", 50 | "Colombia" : "Colombia", 51 | "Costa Rica" : "Costa Rica", 52 | "Cuba" : "Cuba", 53 | "Cabo Verde" : "Cabo Verde", 54 | "Curaçao" : "Curazao", 55 | "Christmas Island" : "Islas Navidad", 56 | "Cyprus" : "Chipre", 57 | "Germany" : "Alemania", 58 | "Djibouti" : "Djibouti", 59 | "Denmark" : "Dinamarca", 60 | "Dominican Republic" : "República Dominicana", 61 | "Algeria" : "Algeria", 62 | "Ecuador" : "Ecuador", 63 | "Estonia" : "Estonia", 64 | "Egypt" : "Egipto", 65 | "Eritrea" : "Eritrea", 66 | "Spain" : "España", 67 | "Ethiopia" : "Etiopía", 68 | "Finland" : "Finlandia", 69 | "Fiji" : "Fiji", 70 | "Faroe Islands" : "Islas Faroe", 71 | "France" : "Francia", 72 | "Gabon" : "Gabón", 73 | "Grenada" : "Granada", 74 | "Georgia" : "Georgia", 75 | "French Guiana" : "Guyana Francesa", 76 | "Guernsey" : "Guernesey", 77 | "Ghana" : "Ghana", 78 | "Gibraltar" : "Gibraltar", 79 | "Greenland" : "Groenlandia", 80 | "Gambia" : "Gambia", 81 | "Guinea" : "Guinea", 82 | "Guadeloupe" : "Guadalupe", 83 | "Equatorial Guinea" : "Guinea Ecuatorial", 84 | "Greece" : "Grecia", 85 | "South Georgia and the South Sandwich Islands" : "Islas Georgia del Sur y Sandwich del Sur", 86 | "Guatemala" : "Guatemala", 87 | "Guam" : "Guam", 88 | "Guinea-Bissau" : "Guinea-Bissau", 89 | "Guyana" : "Guyana", 90 | "Hong Kong" : "Hong Kong", 91 | "Heard Island and McDonald Islands" : "Isla Heard e Islas McDonald", 92 | "Honduras" : "Honduras", 93 | "Croatia" : "Croacia", 94 | "Haiti" : "Haití", 95 | "Hungary" : "Hungría", 96 | "Indonesia" : "Indonesia", 97 | "Ireland" : "Irlanda", 98 | "Israel" : "Israel", 99 | "Isle of Man" : "Isla de Man", 100 | "India" : "India", 101 | "British Indian Ocean Territory" : "Territorio Británico del Océano Índico", 102 | "Iraq" : "Iraq", 103 | "Iceland" : "Islandia", 104 | "Italy" : "Italia", 105 | "Jamaica" : "Jamaica", 106 | "Jordan" : "Jordania", 107 | "Japan" : "Japón", 108 | "Kenya" : "Kenia", 109 | "Kyrgyzstan" : "Kirguistán", 110 | "Cambodia" : "Camboya", 111 | "Kiribati" : "Kiribati", 112 | "Saint Kitts and Nevis" : "San Cristóbal y Nieves", 113 | "Kuwait" : "Kuwait", 114 | "Cayman Islands" : "Islas Caimán", 115 | "Kazakhstan" : "Kazajistán", 116 | "Lebanon" : "Líbano", 117 | "Saint Lucia" : "Santa Lucía", 118 | "Liechtenstein" : "Liechtenstein", 119 | "Sri Lanka" : "Sri Lanka", 120 | "Liberia" : "Liberia", 121 | "Lesotho" : "Lesoto", 122 | "Lithuania" : "Lituania", 123 | "Luxembourg" : "Luxemburgo", 124 | "Latvia" : "Letonia", 125 | "Libya" : "Libia", 126 | "Morocco" : "Marruecos", 127 | "Monaco" : "Mónaco", 128 | "Montenegro" : "Montenegro", 129 | "Madagascar" : "Madagascar", 130 | "Marshall Islands" : "Islas Marshall", 131 | "Mali" : "Malí", 132 | "Myanmar" : "Birmania", 133 | "Mongolia" : "Mongolia", 134 | "Macao" : "Macao", 135 | "Northern Mariana Islands" : "Islas Marianas del Norte", 136 | "Mauritania" : "Mauritania", 137 | "Montserrat" : "Montserrat", 138 | "Malta" : "Malta", 139 | "Mauritius" : "Mauricio", 140 | "Maldives" : "Maldivas", 141 | "Malawi" : "Malawi", 142 | "Mexico" : "México", 143 | "Malaysia" : "Malasia", 144 | "Mozambique" : "Mozambique", 145 | "Namibia" : "Namibia", 146 | "New Caledonia" : "Nueva Caledonia", 147 | "Niger" : "Níger", 148 | "Norfolk Island" : "Isla Norfolk", 149 | "Nigeria" : "Nigeria", 150 | "Nicaragua" : "Nicaragua", 151 | "Netherlands" : "Países Bajos", 152 | "Norway" : "Noruega", 153 | "Nepal" : "Nepal", 154 | "Nauru" : "Nauru", 155 | "Niue" : "Niue", 156 | "New Zealand" : "Nueva Zelanda", 157 | "Oman" : "Omán", 158 | "Panama" : "Panamá", 159 | "Peru" : "Perú", 160 | "French Polynesia" : "Polinesia Francesa", 161 | "Papua New Guinea" : "Papúa Nueva Guinea", 162 | "Philippines" : "Filipinas", 163 | "Pakistan" : "Pakistán", 164 | "Poland" : "Polonia", 165 | "Saint Pierre and Miquelon" : "San Pedro y Miquelón", 166 | "Pitcairn" : "Pitcairn", 167 | "Puerto Rico" : "Puerto Rico", 168 | "Portugal" : "Portugal", 169 | "Palau" : "Palau", 170 | "Paraguay" : "Paraguay", 171 | "Qatar" : "Catar", 172 | "Réunion" : "Reunión", 173 | "Romania" : "Rumanía", 174 | "Serbia" : "Serbia", 175 | "Rwanda" : "Ruanda", 176 | "Saudi Arabia" : "Arabia Saudita", 177 | "Solomon Islands" : "Islas Salomón", 178 | "Seychelles" : "Seychelles", 179 | "Sudan" : "Sudán", 180 | "Sweden" : "Suecia", 181 | "Singapore" : "Singapur", 182 | "Saint Helena, Ascension and Tristan da Cunha" : "Santa Elena, Ascensión y Tristán de Acuña", 183 | "Slovenia" : "Eslovenia", 184 | "Svalbard and Jan Mayen" : "Svalbard y Jan Mayen", 185 | "Slovakia" : "Eslovaquia", 186 | "Sierra Leone" : "Sierra Leona", 187 | "San Marino" : "San Marino", 188 | "Senegal" : "Senegal", 189 | "Somalia" : "Somalia", 190 | "Suriname" : "Surinam", 191 | "South Sudan" : "Sudán del Sur", 192 | "Sao Tome and Principe" : "Santo Tomé y Príncipe", 193 | "El Salvador" : "El Salvador", 194 | "Turks and Caicos Islands" : "Islas Turcas y Caicos", 195 | "Chad" : "Chad", 196 | "Togo" : "Togo", 197 | "Thailand" : "Tailandia", 198 | "Tajikistan" : "Tayikistán", 199 | "Tokelau" : "Tokelau", 200 | "Timor-Leste" : "Timor Oriental", 201 | "Turkmenistan" : "Turkmenistán", 202 | "Tunisia" : "Túnez", 203 | "Tonga" : "Tonga", 204 | "Turkey" : "Turquía", 205 | "Trinidad and Tobago" : "Trinidad y Tobago", 206 | "Tuvalu" : "Tuvalu", 207 | "Ukraine" : "Ucrania", 208 | "Uganda" : "Uganda", 209 | "United States Minor Outlying Islands" : "Islas menores alejadas de los Estados Unidos", 210 | "Uruguay" : "Uruguay", 211 | "Uzbekistan" : "Uzbekistán", 212 | "Holy See" : "Santa Sede", 213 | "Saint Vincent and the Grenadines" : "San Vicente y las Granadinas", 214 | "Virgin Islands (British)" : "Islas Vírgenes Británicas", 215 | "Virgin Islands (U.S.)" : "Islas Vírgenes (estadounidenses)", 216 | "Vanuatu" : "Vanuatu", 217 | "Wallis and Futuna" : "Wallis and Futuna", 218 | "Samoa" : "Samoa", 219 | "Yemen" : "Yemen", 220 | "Mayotte" : "Mayotte", 221 | "South Africa" : "Sudáfrica", 222 | "Zambia" : "Zambia", 223 | "Zimbabwe" : "Zimbabue" 224 | }, 225 | "nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); 226 | -------------------------------------------------------------------------------- /l10n/da.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "OK." : "OK.", 3 | "local" : "lokal", 4 | "default" : "standard", 5 | "OK" : "OK", 6 | "Loading" : "Indlæser", 7 | "Service" : "Tjeneste", 8 | "Select countries from list" : "Vælg lande fra liste", 9 | "with IP Address" : "med IP adresse", 10 | "Andorra" : "Andorra", 11 | "United Arab Emirates" : "De Forenede Arabiske Emirater", 12 | "Afghanistan" : "Afghanistan", 13 | "Antigua and Barbuda" : "Antigua og Barbuda", 14 | "Anguilla" : "Anguilla", 15 | "Albania" : "Albanien", 16 | "Armenia" : "Armenien", 17 | "Angola" : "Angola", 18 | "Antarctica" : "Antarktis", 19 | "Argentina" : "Argentina", 20 | "American Samoa" : "Amerikansk Samoa", 21 | "Austria" : "Østrig", 22 | "Australia" : "Australien", 23 | "Aruba" : "Aruba", 24 | "Åland Islands" : "Ålandsøerne", 25 | "Azerbaijan" : "Aserbajdsjan", 26 | "Bosnia and Herzegovina" : "Bosnien-Hercegovina", 27 | "Barbados" : "Barbados", 28 | "Bangladesh" : "Bangladesh", 29 | "Belgium" : "Belgien", 30 | "Burkina Faso" : "Burkina Faso", 31 | "Bulgaria" : "Bulgarien", 32 | "Bahrain" : "Bahrain", 33 | "Burundi" : "Burundi", 34 | "Benin" : "Benin", 35 | "Saint Barthélemy" : "Saint Barthélemy", 36 | "Bermuda" : "Bermuda", 37 | "Bonaire, Sint Eustatius and Saba" : "Bonaire, Sint Eustatius og Saba", 38 | "Brazil" : "Brasilien", 39 | "Bahamas" : "Bahamas", 40 | "Bhutan" : "Bhutanworld. kgm", 41 | "Bouvet Island" : "Bouvet Island", 42 | "Botswana" : "Botswana", 43 | "Belarus" : "Hviderusland", 44 | "Belize" : "Belize", 45 | "Canada" : "Canada", 46 | "Cocos (Keeling) Islands" : "Cocos (Keeling) Islands", 47 | "Central African Republic" : "Den Centralafrikanske Republik", 48 | "Congo" : "Congo", 49 | "Switzerland" : "Schweiz", 50 | "Cook Islands" : "Cook Islands", 51 | "Chile" : "Chile", 52 | "Cameroon" : "Cameroun", 53 | "China" : "Kina", 54 | "Colombia" : "Colombia", 55 | "Costa Rica" : "Costa Rica", 56 | "Cuba" : "Cuba", 57 | "Cabo Verde" : "Cabo Verde", 58 | "Curaçao" : "Curaçao", 59 | "Christmas Island" : "Juleøen", 60 | "Cyprus" : "Cypern", 61 | "Germany" : "Tyskland", 62 | "Djibouti" : "Djibouti", 63 | "Denmark" : "Danmark", 64 | "Dominican Republic" : "Den Dominikanske Republik", 65 | "Algeria" : "Algeriet", 66 | "Ecuador" : "Ecuador", 67 | "Estonia" : "Estland", 68 | "Egypt" : "Egypten", 69 | "Eritrea" : "Eritrea", 70 | "Spain" : "Spanien", 71 | "Ethiopia" : "Etiopien", 72 | "Finland" : "Finland", 73 | "Fiji" : "Fiji", 74 | "Faroe Islands" : "Færøerne", 75 | "France" : "Frankrig", 76 | "Gabon" : "Gabon", 77 | "Grenada" : "Grenada", 78 | "Georgia" : "Georgien", 79 | "French Guiana" : "Fransk Guyana", 80 | "Guernsey" : "Guernsey", 81 | "Ghana" : "Ghana", 82 | "Gibraltar" : "Gibraltar", 83 | "Greenland" : "Grønland", 84 | "Gambia" : "Gambia", 85 | "Guinea" : "Guinea", 86 | "Guadeloupe" : "Guadeloupe", 87 | "Equatorial Guinea" : "Ækvatorialguinea", 88 | "Greece" : "Grækenland", 89 | "South Georgia and the South Sandwich Islands" : "Sydgeorgien og de sydlige Sandwichøer", 90 | "Guatemala" : "Guatemala", 91 | "Guam" : "Guam", 92 | "Guinea-Bissau" : "Guinea-Bissau", 93 | "Guyana" : "Guyana", 94 | "Hong Kong" : "Hong Kong", 95 | "Heard Island and McDonald Islands" : "Hørt Island og McDonald Islands", 96 | "Honduras" : "Honduras", 97 | "Croatia" : "Kroatien", 98 | "Haiti" : "Haiti", 99 | "Hungary" : "Ungarn", 100 | "Indonesia" : "Indonesien", 101 | "Ireland" : "Irland", 102 | "Israel" : "Israel", 103 | "Isle of Man" : "Isle of Man", 104 | "India" : "Indien", 105 | "British Indian Ocean Territory" : "Britisk område i Det Indiske Ocean", 106 | "Iraq" : "Irak", 107 | "Iceland" : "Island", 108 | "Italy" : "Italien", 109 | "Jamaica" : "Jamaica", 110 | "Jordan" : "Jordan", 111 | "Japan" : "Japan", 112 | "Kenya" : "Kenya", 113 | "Kyrgyzstan" : "Kirgisistan", 114 | "Cambodia" : "Cambodja", 115 | "Kiribati" : "Kiribati", 116 | "Comoros" : "Comoros", 117 | "Saint Kitts and Nevis" : "Saint Christopher og Nevis", 118 | "Kuwait" : "Kuwait", 119 | "Cayman Islands" : "Caymanøerne", 120 | "Kazakhstan" : "Kasakhstan", 121 | "Lebanon" : "Libanon", 122 | "Saint Lucia" : "Saint Lucia", 123 | "Liechtenstein" : "Liechtenstein", 124 | "Sri Lanka" : "Sri Lanka", 125 | "Liberia" : "Liberia", 126 | "Lesotho" : "Lesotho", 127 | "Lithuania" : "Litauen", 128 | "Luxembourg" : "Luxembourg", 129 | "Latvia" : "Letland", 130 | "Libya" : "Libyen", 131 | "Morocco" : "Marokko", 132 | "Monaco" : "Monaco", 133 | "Montenegro" : "Montenegro", 134 | "Madagascar" : "Madagaskar", 135 | "Marshall Islands" : "Marshalløerne", 136 | "Mali" : "Mali", 137 | "Myanmar" : "Myanmar", 138 | "Mongolia" : "Mongoliet", 139 | "Macao" : "Macao", 140 | "Northern Mariana Islands" : "Northern Mariana Islands", 141 | "Mauritania" : "Mauretanien", 142 | "Montserrat" : "Montserrat", 143 | "Malta" : "Malta", 144 | "Mauritius" : "Mauritius", 145 | "Maldives" : "Maldiverne", 146 | "Malawi" : "Malawi", 147 | "Mexico" : "Mexico", 148 | "Malaysia" : "Malaysia", 149 | "Mozambique" : "Mozambique", 150 | "Namibia" : "Namibia", 151 | "New Caledonia" : "Ny kaledonien", 152 | "Niger" : "Niger", 153 | "Norfolk Island" : "Norfolk Island", 154 | "Nigeria" : "Nigeria", 155 | "Nicaragua" : "Nicaragua", 156 | "Netherlands" : "Holland", 157 | "Norway" : "Norge", 158 | "Nepal" : "Nepal", 159 | "Nauru" : "Nauru", 160 | "Niue" : "Niue", 161 | "New Zealand" : "New Zealand", 162 | "Oman" : "Oman", 163 | "Panama" : "Panama", 164 | "Peru" : "Peru", 165 | "French Polynesia" : "Fransk Polynesien", 166 | "Papua New Guinea" : "Papua Ny Guinea", 167 | "Philippines" : "Filippinerne", 168 | "Pakistan" : "Pakistan", 169 | "Poland" : "Polen", 170 | "Saint Pierre and Miquelon" : "Saint Pierre og Miquelon", 171 | "Pitcairn" : "Pitcairn", 172 | "Puerto Rico" : "Puerto Rico", 173 | "Portugal" : "Portugal", 174 | "Palau" : "Palau ", 175 | "Paraguay" : "Paraguay", 176 | "Qatar" : "Qatar", 177 | "Réunion" : "Réunion", 178 | "Romania" : "Rumænien", 179 | "Serbia" : "Serbien", 180 | "Rwanda" : "Rwanda", 181 | "Saudi Arabia" : "Saudi-Arabien", 182 | "Solomon Islands" : "Salomonøerne", 183 | "Seychelles" : "Seychellerne", 184 | "Sudan" : "Sudan", 185 | "Sweden" : "Sverige", 186 | "Singapore" : "Singapore", 187 | "Saint Helena, Ascension and Tristan da Cunha" : "Saint Helena, Ascension og Tristan da Cunha", 188 | "Slovenia" : "Slovenien", 189 | "Svalbard and Jan Mayen" : "Svalbard og Jan Mayen", 190 | "Slovakia" : "Slovakiet", 191 | "Sierra Leone" : "Sierra Leone", 192 | "San Marino" : "San Marino", 193 | "Senegal" : "Senegal", 194 | "Somalia" : "Somalia", 195 | "Suriname" : "Surinam", 196 | "South Sudan" : "Sydsudan", 197 | "Sao Tome and Principe" : "São Tomé og Príncipe", 198 | "El Salvador" : "El Salvador", 199 | "Turks and Caicos Islands" : "Turks- og Caicosøerne", 200 | "Chad" : "Chad", 201 | "Togo" : "Togo", 202 | "Thailand" : "Thailand", 203 | "Tajikistan" : "Tadsjikistan", 204 | "Tokelau" : "Tokelau", 205 | "Timor-Leste" : "Timor-Leste", 206 | "Turkmenistan" : "Turkmenistan", 207 | "Tunisia" : "Tunesien", 208 | "Tonga" : "Tonga", 209 | "Turkey" : "Tyrkiet", 210 | "Trinidad and Tobago" : "Trinidad og Tobago", 211 | "Tuvalu" : "Tuvalu", 212 | "Ukraine" : "Ukraine", 213 | "Uganda" : "Uganda", 214 | "United States Minor Outlying Islands" : "United States Minor Outliing Islands", 215 | "Uruguay" : "Uruguay", 216 | "Uzbekistan" : "Usbekistan", 217 | "Holy See" : "Pavestolen", 218 | "Saint Vincent and the Grenadines" : "Saint Vincent og Grenadinerne", 219 | "Virgin Islands (British)" : "Jomfruøerne (britisk)", 220 | "Virgin Islands (U.S.)" : "Jomfruøerne (USA)", 221 | "Vanuatu" : "Vanuatu", 222 | "Wallis and Futuna" : "Wallis og Futuna", 223 | "Samoa" : "Samoa", 224 | "Yemen" : "Yemen", 225 | "Mayotte" : "Mayotte", 226 | "South Africa" : "Sydafrika", 227 | "Zambia" : "Zambia", 228 | "Zimbabwe" : "Zimbabwe" 229 | },"pluralForm" :"nplurals=2; plural=(n != 1);" 230 | } -------------------------------------------------------------------------------- /templates/admin.php: -------------------------------------------------------------------------------- 1 | t('Loading').'...'; 9 | ?> 10 |
11 |

t('GeoBlocker')); ?> 12 |

13 |
14 |

t('This is a front end to geo localization services, that allows blocking (beta), delaying (beta) and logging of login attempts from specified countries. ')); ?> 15 |

16 |

t('Login attempts from local network IP addresses are never blocked, delayed or logged.')); ?> 17 |

18 |

t('In the current implementation the login page is normally shown to everybody independent of the country. Also login attempts with a non existing user are failing as usual independent of the country.')); ?> 19 |

20 |

t('Wrong Nextcloud configuration (especially in container) can lead to all accesses seem to come from a local network IP address.')); ?> 21 |

22 |

t('If you are accessing from external network, this should be an external IP address:')); p(' '); p($_['ipAddress']); p(' '); 23 | if (GeoBlocker::isIPAddressLocal($_['ipAddress'])) { 24 | p($l->t('is local.')); 25 | } else { 26 | p($l->t('is external.')); 27 | } 28 | ?> 29 |

30 | 31 |

t('Determination of the country from IP address is only as good as the chosen service.')); ?> 32 |

33 |

t('For help how to setup the localization services, have a look into the Readme in the')); ?> 34 | t('repository')); ?>. 35 |

36 |
37 | 38 |

t('Service')); ?> 39 |

40 |
41 |

42 | t('Choose the service you want to use to determine the country from the IP Address:')); ?> 43 |
44 |

45 |

61 | 62 |

63 | t('Status of the chosen service: ')); ?> 64 |

65 |
66 |

67 |

68 | 73 |
74 | 93 | 94 |
95 |

t('Country Selection')); ?> 96 |

97 |
98 |

99 | t('Choose the selection mode'))?>: 100 |

101 |

102 | 112 |

113 | 114 |

115 | t('Select countries from list'))?>: 116 |
117 |

118 |

119 | 120 |

121 |

122 | t('The following countries were selected in the list above: '));?> 123 |

124 |

125 | 126 |

127 |
128 | 129 | 130 |

t('Reaction')); ?> 131 |

132 |
133 |

134 | t('If a login attempt is detected from the chosen countries, the attempt is logged with the following information')); 135 | p(' '); 136 | p($l->t('( be aware of data protection issues depending on your logging strategy)'));?>: 137 |

138 | 139 |

140 | > 143 | 145 |

146 |

147 | > 150 |
152 |

153 |

154 | > 157 | 160 |

161 | 162 |
163 |

164 | t('In addition, the login attempt can also be delayed and blocked.'))?> 165 | t('(beta version)'))?>: 166 |

167 |

168 | > 171 | 176 |

177 |

178 | > 181 | 184 |

185 |
186 | 187 |

t('Test')); ?> 188 |

189 |
190 |

191 | t('Possibilities to test if the Geoblocker is working as expected:'))?> 192 |

193 |

194 | > 197 | 200 | 202 |

203 |
204 | 207 |
208 |
209 | 210 |
-------------------------------------------------------------------------------- /l10n/da.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "geoblocker", 3 | { 4 | "OK." : "OK.", 5 | "local" : "lokal", 6 | "default" : "standard", 7 | "OK" : "OK", 8 | "Loading" : "Indlæser", 9 | "Service" : "Tjeneste", 10 | "Select countries from list" : "Vælg lande fra liste", 11 | "with IP Address" : "med IP adresse", 12 | "Andorra" : "Andorra", 13 | "United Arab Emirates" : "De Forenede Arabiske Emirater", 14 | "Afghanistan" : "Afghanistan", 15 | "Antigua and Barbuda" : "Antigua og Barbuda", 16 | "Anguilla" : "Anguilla", 17 | "Albania" : "Albanien", 18 | "Armenia" : "Armenien", 19 | "Angola" : "Angola", 20 | "Antarctica" : "Antarktis", 21 | "Argentina" : "Argentina", 22 | "American Samoa" : "Amerikansk Samoa", 23 | "Austria" : "Østrig", 24 | "Australia" : "Australien", 25 | "Aruba" : "Aruba", 26 | "Åland Islands" : "Ålandsøerne", 27 | "Azerbaijan" : "Aserbajdsjan", 28 | "Bosnia and Herzegovina" : "Bosnien-Hercegovina", 29 | "Barbados" : "Barbados", 30 | "Bangladesh" : "Bangladesh", 31 | "Belgium" : "Belgien", 32 | "Burkina Faso" : "Burkina Faso", 33 | "Bulgaria" : "Bulgarien", 34 | "Bahrain" : "Bahrain", 35 | "Burundi" : "Burundi", 36 | "Benin" : "Benin", 37 | "Saint Barthélemy" : "Saint Barthélemy", 38 | "Bermuda" : "Bermuda", 39 | "Bonaire, Sint Eustatius and Saba" : "Bonaire, Sint Eustatius og Saba", 40 | "Brazil" : "Brasilien", 41 | "Bahamas" : "Bahamas", 42 | "Bhutan" : "Bhutanworld. kgm", 43 | "Bouvet Island" : "Bouvet Island", 44 | "Botswana" : "Botswana", 45 | "Belarus" : "Hviderusland", 46 | "Belize" : "Belize", 47 | "Canada" : "Canada", 48 | "Cocos (Keeling) Islands" : "Cocos (Keeling) Islands", 49 | "Central African Republic" : "Den Centralafrikanske Republik", 50 | "Congo" : "Congo", 51 | "Switzerland" : "Schweiz", 52 | "Cook Islands" : "Cook Islands", 53 | "Chile" : "Chile", 54 | "Cameroon" : "Cameroun", 55 | "China" : "Kina", 56 | "Colombia" : "Colombia", 57 | "Costa Rica" : "Costa Rica", 58 | "Cuba" : "Cuba", 59 | "Cabo Verde" : "Cabo Verde", 60 | "Curaçao" : "Curaçao", 61 | "Christmas Island" : "Juleøen", 62 | "Cyprus" : "Cypern", 63 | "Germany" : "Tyskland", 64 | "Djibouti" : "Djibouti", 65 | "Denmark" : "Danmark", 66 | "Dominican Republic" : "Den Dominikanske Republik", 67 | "Algeria" : "Algeriet", 68 | "Ecuador" : "Ecuador", 69 | "Estonia" : "Estland", 70 | "Egypt" : "Egypten", 71 | "Eritrea" : "Eritrea", 72 | "Spain" : "Spanien", 73 | "Ethiopia" : "Etiopien", 74 | "Finland" : "Finland", 75 | "Fiji" : "Fiji", 76 | "Faroe Islands" : "Færøerne", 77 | "France" : "Frankrig", 78 | "Gabon" : "Gabon", 79 | "Grenada" : "Grenada", 80 | "Georgia" : "Georgien", 81 | "French Guiana" : "Fransk Guyana", 82 | "Guernsey" : "Guernsey", 83 | "Ghana" : "Ghana", 84 | "Gibraltar" : "Gibraltar", 85 | "Greenland" : "Grønland", 86 | "Gambia" : "Gambia", 87 | "Guinea" : "Guinea", 88 | "Guadeloupe" : "Guadeloupe", 89 | "Equatorial Guinea" : "Ækvatorialguinea", 90 | "Greece" : "Grækenland", 91 | "South Georgia and the South Sandwich Islands" : "Sydgeorgien og de sydlige Sandwichøer", 92 | "Guatemala" : "Guatemala", 93 | "Guam" : "Guam", 94 | "Guinea-Bissau" : "Guinea-Bissau", 95 | "Guyana" : "Guyana", 96 | "Hong Kong" : "Hong Kong", 97 | "Heard Island and McDonald Islands" : "Hørt Island og McDonald Islands", 98 | "Honduras" : "Honduras", 99 | "Croatia" : "Kroatien", 100 | "Haiti" : "Haiti", 101 | "Hungary" : "Ungarn", 102 | "Indonesia" : "Indonesien", 103 | "Ireland" : "Irland", 104 | "Israel" : "Israel", 105 | "Isle of Man" : "Isle of Man", 106 | "India" : "Indien", 107 | "British Indian Ocean Territory" : "Britisk område i Det Indiske Ocean", 108 | "Iraq" : "Irak", 109 | "Iceland" : "Island", 110 | "Italy" : "Italien", 111 | "Jamaica" : "Jamaica", 112 | "Jordan" : "Jordan", 113 | "Japan" : "Japan", 114 | "Kenya" : "Kenya", 115 | "Kyrgyzstan" : "Kirgisistan", 116 | "Cambodia" : "Cambodja", 117 | "Kiribati" : "Kiribati", 118 | "Comoros" : "Comoros", 119 | "Saint Kitts and Nevis" : "Saint Christopher og Nevis", 120 | "Kuwait" : "Kuwait", 121 | "Cayman Islands" : "Caymanøerne", 122 | "Kazakhstan" : "Kasakhstan", 123 | "Lebanon" : "Libanon", 124 | "Saint Lucia" : "Saint Lucia", 125 | "Liechtenstein" : "Liechtenstein", 126 | "Sri Lanka" : "Sri Lanka", 127 | "Liberia" : "Liberia", 128 | "Lesotho" : "Lesotho", 129 | "Lithuania" : "Litauen", 130 | "Luxembourg" : "Luxembourg", 131 | "Latvia" : "Letland", 132 | "Libya" : "Libyen", 133 | "Morocco" : "Marokko", 134 | "Monaco" : "Monaco", 135 | "Montenegro" : "Montenegro", 136 | "Madagascar" : "Madagaskar", 137 | "Marshall Islands" : "Marshalløerne", 138 | "Mali" : "Mali", 139 | "Myanmar" : "Myanmar", 140 | "Mongolia" : "Mongoliet", 141 | "Macao" : "Macao", 142 | "Northern Mariana Islands" : "Northern Mariana Islands", 143 | "Mauritania" : "Mauretanien", 144 | "Montserrat" : "Montserrat", 145 | "Malta" : "Malta", 146 | "Mauritius" : "Mauritius", 147 | "Maldives" : "Maldiverne", 148 | "Malawi" : "Malawi", 149 | "Mexico" : "Mexico", 150 | "Malaysia" : "Malaysia", 151 | "Mozambique" : "Mozambique", 152 | "Namibia" : "Namibia", 153 | "New Caledonia" : "Ny kaledonien", 154 | "Niger" : "Niger", 155 | "Norfolk Island" : "Norfolk Island", 156 | "Nigeria" : "Nigeria", 157 | "Nicaragua" : "Nicaragua", 158 | "Netherlands" : "Holland", 159 | "Norway" : "Norge", 160 | "Nepal" : "Nepal", 161 | "Nauru" : "Nauru", 162 | "Niue" : "Niue", 163 | "New Zealand" : "New Zealand", 164 | "Oman" : "Oman", 165 | "Panama" : "Panama", 166 | "Peru" : "Peru", 167 | "French Polynesia" : "Fransk Polynesien", 168 | "Papua New Guinea" : "Papua Ny Guinea", 169 | "Philippines" : "Filippinerne", 170 | "Pakistan" : "Pakistan", 171 | "Poland" : "Polen", 172 | "Saint Pierre and Miquelon" : "Saint Pierre og Miquelon", 173 | "Pitcairn" : "Pitcairn", 174 | "Puerto Rico" : "Puerto Rico", 175 | "Portugal" : "Portugal", 176 | "Palau" : "Palau ", 177 | "Paraguay" : "Paraguay", 178 | "Qatar" : "Qatar", 179 | "Réunion" : "Réunion", 180 | "Romania" : "Rumænien", 181 | "Serbia" : "Serbien", 182 | "Rwanda" : "Rwanda", 183 | "Saudi Arabia" : "Saudi-Arabien", 184 | "Solomon Islands" : "Salomonøerne", 185 | "Seychelles" : "Seychellerne", 186 | "Sudan" : "Sudan", 187 | "Sweden" : "Sverige", 188 | "Singapore" : "Singapore", 189 | "Saint Helena, Ascension and Tristan da Cunha" : "Saint Helena, Ascension og Tristan da Cunha", 190 | "Slovenia" : "Slovenien", 191 | "Svalbard and Jan Mayen" : "Svalbard og Jan Mayen", 192 | "Slovakia" : "Slovakiet", 193 | "Sierra Leone" : "Sierra Leone", 194 | "San Marino" : "San Marino", 195 | "Senegal" : "Senegal", 196 | "Somalia" : "Somalia", 197 | "Suriname" : "Surinam", 198 | "South Sudan" : "Sydsudan", 199 | "Sao Tome and Principe" : "São Tomé og Príncipe", 200 | "El Salvador" : "El Salvador", 201 | "Turks and Caicos Islands" : "Turks- og Caicosøerne", 202 | "Chad" : "Chad", 203 | "Togo" : "Togo", 204 | "Thailand" : "Thailand", 205 | "Tajikistan" : "Tadsjikistan", 206 | "Tokelau" : "Tokelau", 207 | "Timor-Leste" : "Timor-Leste", 208 | "Turkmenistan" : "Turkmenistan", 209 | "Tunisia" : "Tunesien", 210 | "Tonga" : "Tonga", 211 | "Turkey" : "Tyrkiet", 212 | "Trinidad and Tobago" : "Trinidad og Tobago", 213 | "Tuvalu" : "Tuvalu", 214 | "Ukraine" : "Ukraine", 215 | "Uganda" : "Uganda", 216 | "United States Minor Outlying Islands" : "United States Minor Outliing Islands", 217 | "Uruguay" : "Uruguay", 218 | "Uzbekistan" : "Usbekistan", 219 | "Holy See" : "Pavestolen", 220 | "Saint Vincent and the Grenadines" : "Saint Vincent og Grenadinerne", 221 | "Virgin Islands (British)" : "Jomfruøerne (britisk)", 222 | "Virgin Islands (U.S.)" : "Jomfruøerne (USA)", 223 | "Vanuatu" : "Vanuatu", 224 | "Wallis and Futuna" : "Wallis og Futuna", 225 | "Samoa" : "Samoa", 226 | "Yemen" : "Yemen", 227 | "Mayotte" : "Mayotte", 228 | "South Africa" : "Sydafrika", 229 | "Zambia" : "Zambia", 230 | "Zimbabwe" : "Zimbabwe" 231 | }, 232 | "nplurals=2; plural=(n != 1);"); 233 | -------------------------------------------------------------------------------- /l10n/lt_LT.json: -------------------------------------------------------------------------------- 1 | { "translations": { 2 | "Update not possible. " : "Atnaujinimas neįmanomas.", 3 | "Update possible. " : "Atnaujinimas įmanomas.", 4 | "Update running. " : "Vykdomas atnaujinimas.", 5 | "Update undefined. " : "Atnaujinimas neapibrėžtas.", 6 | "Status of the service cannot be determined." : "Nepavyksta nustatyti tarnybos būsenos.", 7 | "No database date available." : "Neprieinama jokia duomenų bazės data.", 8 | "Database file location not available!" : "Neprieinama duomenų bazės failo vieta!", 9 | "Update Status not available!" : "Atnaujinimo būsena neprieinama!", 10 | "OK." : "Gerai.", 11 | "Date of the database cannot be determined!" : "Nepavyksta nustatyti duomenų bazės datos!", 12 | "local" : "vietinė", 13 | "default" : "numatytoji", 14 | "ERROR:" : "KLAIDA:", 15 | "OK" : "Gerai", 16 | "Something is missing." : "Kažko trūksta.", 17 | "No database available!" : "Neprieinama jokia duomenų bazė!", 18 | "Loading" : "Įkeliama", 19 | "Status of the chosen service: " : "Pasirinktos tarnybos būsena: ", 20 | "Date of the database: " : "Duomenų bazės data: ", 21 | "Country Selection" : "Šalių pasirinkimas", 22 | "Choose the selection mode" : "Pasirinkite pasirinkimo veikseną", 23 | "Reaction" : "Reakcija", 24 | "(beta version)" : "(beta versija)", 25 | "COUNTRY NOT FOUND" : "ŠALIS NERASTA", 26 | "Andorra" : "Andora", 27 | "United Arab Emirates" : "Jungtiniai Arabų Emyratai", 28 | "Afghanistan" : "Afganistanas", 29 | "Antigua and Barbuda" : "Antigva ir Barbuda", 30 | "Anguilla" : "Angilija", 31 | "Albania" : "Albanija", 32 | "Armenia" : "Armėnija", 33 | "Angola" : "Angola", 34 | "Argentina" : "Argentina", 35 | "Austria" : "Austrija", 36 | "Australia" : "Australija", 37 | "Azerbaijan" : "Azerbaidžanas", 38 | "Bosnia and Herzegovina" : "Bosnija ir Hercegovina", 39 | "Barbados" : "Barbadosas", 40 | "Bangladesh" : "Bangladešas", 41 | "Belgium" : "Belgija", 42 | "Burkina Faso" : "Burkina Fasas", 43 | "Bulgaria" : "Bulgarija", 44 | "Bahrain" : "Bahreinas", 45 | "Burundi" : "Burundis", 46 | "Benin" : "Beninas", 47 | "Bermuda" : "Bermudai", 48 | "Brunei Darussalam" : "Brunėjaus Darusalamas", 49 | "Bolivia (Plurinational State of)" : "Bolivija (Daugiatautė Valstybė)", 50 | "Brazil" : "Brazilija", 51 | "Bahamas" : "Bahamos", 52 | "Bhutan" : "Butanas", 53 | "Botswana" : "Botsvana", 54 | "Belarus" : "Baltarusija", 55 | "Belize" : "Belizas", 56 | "Canada" : "Kanada", 57 | "Central African Republic" : "Centrinės Afrikos Respublika", 58 | "Congo" : "Kongas", 59 | "Switzerland" : "Šveicarija", 60 | "Chile" : "Čilė", 61 | "Cameroon" : "Kamerūnas", 62 | "China" : "Kinija", 63 | "Colombia" : "Kolumbija", 64 | "Costa Rica" : "Kosta Rika", 65 | "Cuba" : "Kuba", 66 | "Christmas Island" : "Kalėdų sala", 67 | "Cyprus" : "Kipras", 68 | "Czechia" : "Čekija", 69 | "Germany" : "Vokietija", 70 | "Djibouti" : "Džibutis", 71 | "Denmark" : "Danija", 72 | "Dominica" : "Dominika", 73 | "Dominican Republic" : "Dominikos Respublika", 74 | "Algeria" : "Alžyras", 75 | "Ecuador" : "Ekvadoras", 76 | "Estonia" : "Estija", 77 | "Egypt" : "Egiptas", 78 | "Eritrea" : "Eritrėja", 79 | "Spain" : "Ispanija", 80 | "Ethiopia" : "Etiopija", 81 | "Finland" : "Suomija", 82 | "Fiji" : "Fidžis", 83 | "Falkland Islands (Malvinas)" : "Folklando (Malvinų) salos", 84 | "Micronesia (Federated States of)" : "Mikronezija (Federacinės Valstijos)", 85 | "Faroe Islands" : "Farerų salos", 86 | "France" : "Prancūzija", 87 | "Gabon" : "Gabonas", 88 | "Grenada" : "Grenada", 89 | "Georgia" : "Gruzija", 90 | "Ghana" : "Gana", 91 | "Gibraltar" : "Gibraltaras", 92 | "Greenland" : "Grenlandija", 93 | "Gambia" : "Gambija", 94 | "Guinea" : "Gvinėja", 95 | "Equatorial Guinea" : "Pusiaujo Gvinėja", 96 | "Greece" : "Graikija", 97 | "Guatemala" : "Gvatemala", 98 | "Guinea-Bissau" : "Bisau Gvinėja", 99 | "Guyana" : "Gajana", 100 | "Hong Kong" : "Honkongas", 101 | "Honduras" : "Hondūras", 102 | "Croatia" : "Kroatija", 103 | "Haiti" : "Haitis", 104 | "Hungary" : "Vengrija", 105 | "Indonesia" : "Indonezija", 106 | "Ireland" : "Airija", 107 | "Israel" : "Izraelis", 108 | "India" : "Indija", 109 | "Iraq" : "Irakas", 110 | "Iran (Islamic Republic of)" : "Iranas (Islamo Respublika)", 111 | "Iceland" : "Islandija", 112 | "Italy" : "Italija", 113 | "Jamaica" : "Jamaika", 114 | "Jordan" : "Jordanija", 115 | "Japan" : "Japonija", 116 | "Kenya" : "Kenija", 117 | "Kyrgyzstan" : "Kirgizija", 118 | "Cambodia" : "Kambodža", 119 | "Kiribati" : "Kiribatis", 120 | "Saint Kitts and Nevis" : "Sent Kitsas ir Nevis", 121 | "Korea (Democratic People's Republic of)" : "Korėja (Liaudies Demokratinė Respublika)", 122 | "Kuwait" : "Kuveitas", 123 | "Kazakhstan" : "Kazachstanas", 124 | "Lebanon" : "Libanas", 125 | "Liechtenstein" : "Lichtenšteinas", 126 | "Sri Lanka" : "Šri Lanka", 127 | "Liberia" : "Liberija", 128 | "Lesotho" : "Lesotas", 129 | "Lithuania" : "Lietuva", 130 | "Luxembourg" : "Liuksemburgas", 131 | "Latvia" : "Latvija", 132 | "Libya" : "Libija", 133 | "Morocco" : "Marokas", 134 | "Monaco" : "Monakas", 135 | "Montenegro" : "Juodkalnija", 136 | "Madagascar" : "Madagaskaras", 137 | "Marshall Islands" : "Maršalo salos", 138 | "Mali" : "Malis", 139 | "Myanmar" : "Mianmaras", 140 | "Mongolia" : "Mongolija", 141 | "Mauritania" : "Mauritanija", 142 | "Malta" : "Malta", 143 | "Mauritius" : "Mauricijus", 144 | "Maldives" : "Maldyvai", 145 | "Malawi" : "Malavis", 146 | "Mexico" : "Meksika", 147 | "Malaysia" : "Malaizija", 148 | "Mozambique" : "Mozambikas", 149 | "Namibia" : "Namibija", 150 | "New Caledonia" : "Naujoji Kaledonija", 151 | "Niger" : "Nigeris", 152 | "Nigeria" : "Nigerija", 153 | "Nicaragua" : "Nikaragva", 154 | "Netherlands" : "Nyderlandai", 155 | "Norway" : "Norvegija", 156 | "Nepal" : "Nepalas", 157 | "Nauru" : "Nauru", 158 | "New Zealand" : "Naujoji Zelandija", 159 | "Oman" : "Omanas", 160 | "Panama" : "Panama", 161 | "Peru" : "Peru", 162 | "Papua New Guinea" : "Papua Naujoji Gvinėja", 163 | "Philippines" : "Filipinai", 164 | "Pakistan" : "Pakistanas", 165 | "Poland" : "Lenkija", 166 | "Pitcairn" : "Pitkerno salos", 167 | "Puerto Rico" : "Puerto Rikas", 168 | "Portugal" : "Portugalija", 169 | "Paraguay" : "Paragvajus", 170 | "Qatar" : "Kataras", 171 | "Romania" : "Rumunija", 172 | "Serbia" : "Serbija", 173 | "Russian Federation" : "Rusijos Federacija", 174 | "Rwanda" : "Ruanda", 175 | "Saudi Arabia" : "Saudo Arabija", 176 | "Solomon Islands" : "Saliamono salos", 177 | "Seychelles" : "Seišelių salos", 178 | "Sudan" : "Sudanas", 179 | "Sweden" : "Švedija", 180 | "Singapore" : "Singapūras", 181 | "Slovenia" : "Slovėnija", 182 | "Slovakia" : "Slovakija", 183 | "Sierra Leone" : "Siera Leonė", 184 | "Senegal" : "Senegalas", 185 | "Somalia" : "Somalis", 186 | "Suriname" : "Surinamas", 187 | "South Sudan" : "Pietų Sudanas", 188 | "El Salvador" : "Salvadoras", 189 | "Syrian Arab Republic" : "Sirijos Arabų Respublika", 190 | "Turks and Caicos Islands" : "Terkso ir Kaikoso salos", 191 | "Chad" : "Čadas", 192 | "Togo" : "Togas", 193 | "Thailand" : "Tailandas", 194 | "Tajikistan" : "Tadžikistanas", 195 | "Timor-Leste" : "Rytų Timoras", 196 | "Turkmenistan" : "Turkmėnistanas", 197 | "Tunisia" : "Tunisas", 198 | "Tonga" : "Tongų", 199 | "Turkey" : "Turkija", 200 | "Trinidad and Tobago" : "Trinidadas ir Tobagas", 201 | "Tanzania, United Republic of" : "Tanzanijos Jungtinė Respublika", 202 | "Ukraine" : "Ukraina", 203 | "Uganda" : "Uganda", 204 | "United States Minor Outlying Islands" : "Jungtinių Valstijų nuošalios mažosios salos", 205 | "United States of America" : "Jungtinės Amerikos Valstijos", 206 | "Uruguay" : "Urugvajus", 207 | "Uzbekistan" : "Uzbekistanas", 208 | "Viet Nam" : "Vietnamas", 209 | "Vanuatu" : "Vanuatu", 210 | "Yemen" : "Jemenas", 211 | "South Africa" : "Pietų Afrika", 212 | "Zambia" : "Zambija", 213 | "Zimbabwe" : "Zimbabvė" 214 | },"pluralForm" :"nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);" 215 | } -------------------------------------------------------------------------------- /l10n/lt_LT.js: -------------------------------------------------------------------------------- 1 | OC.L10N.register( 2 | "geoblocker", 3 | { 4 | "Update not possible. " : "Atnaujinimas neįmanomas.", 5 | "Update possible. " : "Atnaujinimas įmanomas.", 6 | "Update running. " : "Vykdomas atnaujinimas.", 7 | "Update undefined. " : "Atnaujinimas neapibrėžtas.", 8 | "Status of the service cannot be determined." : "Nepavyksta nustatyti tarnybos būsenos.", 9 | "No database date available." : "Neprieinama jokia duomenų bazės data.", 10 | "Database file location not available!" : "Neprieinama duomenų bazės failo vieta!", 11 | "Update Status not available!" : "Atnaujinimo būsena neprieinama!", 12 | "OK." : "Gerai.", 13 | "Date of the database cannot be determined!" : "Nepavyksta nustatyti duomenų bazės datos!", 14 | "local" : "vietinė", 15 | "default" : "numatytoji", 16 | "ERROR:" : "KLAIDA:", 17 | "OK" : "Gerai", 18 | "Something is missing." : "Kažko trūksta.", 19 | "No database available!" : "Neprieinama jokia duomenų bazė!", 20 | "Loading" : "Įkeliama", 21 | "Status of the chosen service: " : "Pasirinktos tarnybos būsena: ", 22 | "Date of the database: " : "Duomenų bazės data: ", 23 | "Country Selection" : "Šalių pasirinkimas", 24 | "Choose the selection mode" : "Pasirinkite pasirinkimo veikseną", 25 | "Reaction" : "Reakcija", 26 | "(beta version)" : "(beta versija)", 27 | "COUNTRY NOT FOUND" : "ŠALIS NERASTA", 28 | "Andorra" : "Andora", 29 | "United Arab Emirates" : "Jungtiniai Arabų Emyratai", 30 | "Afghanistan" : "Afganistanas", 31 | "Antigua and Barbuda" : "Antigva ir Barbuda", 32 | "Anguilla" : "Angilija", 33 | "Albania" : "Albanija", 34 | "Armenia" : "Armėnija", 35 | "Angola" : "Angola", 36 | "Argentina" : "Argentina", 37 | "Austria" : "Austrija", 38 | "Australia" : "Australija", 39 | "Azerbaijan" : "Azerbaidžanas", 40 | "Bosnia and Herzegovina" : "Bosnija ir Hercegovina", 41 | "Barbados" : "Barbadosas", 42 | "Bangladesh" : "Bangladešas", 43 | "Belgium" : "Belgija", 44 | "Burkina Faso" : "Burkina Fasas", 45 | "Bulgaria" : "Bulgarija", 46 | "Bahrain" : "Bahreinas", 47 | "Burundi" : "Burundis", 48 | "Benin" : "Beninas", 49 | "Bermuda" : "Bermudai", 50 | "Brunei Darussalam" : "Brunėjaus Darusalamas", 51 | "Bolivia (Plurinational State of)" : "Bolivija (Daugiatautė Valstybė)", 52 | "Brazil" : "Brazilija", 53 | "Bahamas" : "Bahamos", 54 | "Bhutan" : "Butanas", 55 | "Botswana" : "Botsvana", 56 | "Belarus" : "Baltarusija", 57 | "Belize" : "Belizas", 58 | "Canada" : "Kanada", 59 | "Central African Republic" : "Centrinės Afrikos Respublika", 60 | "Congo" : "Kongas", 61 | "Switzerland" : "Šveicarija", 62 | "Chile" : "Čilė", 63 | "Cameroon" : "Kamerūnas", 64 | "China" : "Kinija", 65 | "Colombia" : "Kolumbija", 66 | "Costa Rica" : "Kosta Rika", 67 | "Cuba" : "Kuba", 68 | "Christmas Island" : "Kalėdų sala", 69 | "Cyprus" : "Kipras", 70 | "Czechia" : "Čekija", 71 | "Germany" : "Vokietija", 72 | "Djibouti" : "Džibutis", 73 | "Denmark" : "Danija", 74 | "Dominica" : "Dominika", 75 | "Dominican Republic" : "Dominikos Respublika", 76 | "Algeria" : "Alžyras", 77 | "Ecuador" : "Ekvadoras", 78 | "Estonia" : "Estija", 79 | "Egypt" : "Egiptas", 80 | "Eritrea" : "Eritrėja", 81 | "Spain" : "Ispanija", 82 | "Ethiopia" : "Etiopija", 83 | "Finland" : "Suomija", 84 | "Fiji" : "Fidžis", 85 | "Falkland Islands (Malvinas)" : "Folklando (Malvinų) salos", 86 | "Micronesia (Federated States of)" : "Mikronezija (Federacinės Valstijos)", 87 | "Faroe Islands" : "Farerų salos", 88 | "France" : "Prancūzija", 89 | "Gabon" : "Gabonas", 90 | "Grenada" : "Grenada", 91 | "Georgia" : "Gruzija", 92 | "Ghana" : "Gana", 93 | "Gibraltar" : "Gibraltaras", 94 | "Greenland" : "Grenlandija", 95 | "Gambia" : "Gambija", 96 | "Guinea" : "Gvinėja", 97 | "Equatorial Guinea" : "Pusiaujo Gvinėja", 98 | "Greece" : "Graikija", 99 | "Guatemala" : "Gvatemala", 100 | "Guinea-Bissau" : "Bisau Gvinėja", 101 | "Guyana" : "Gajana", 102 | "Hong Kong" : "Honkongas", 103 | "Honduras" : "Hondūras", 104 | "Croatia" : "Kroatija", 105 | "Haiti" : "Haitis", 106 | "Hungary" : "Vengrija", 107 | "Indonesia" : "Indonezija", 108 | "Ireland" : "Airija", 109 | "Israel" : "Izraelis", 110 | "India" : "Indija", 111 | "Iraq" : "Irakas", 112 | "Iran (Islamic Republic of)" : "Iranas (Islamo Respublika)", 113 | "Iceland" : "Islandija", 114 | "Italy" : "Italija", 115 | "Jamaica" : "Jamaika", 116 | "Jordan" : "Jordanija", 117 | "Japan" : "Japonija", 118 | "Kenya" : "Kenija", 119 | "Kyrgyzstan" : "Kirgizija", 120 | "Cambodia" : "Kambodža", 121 | "Kiribati" : "Kiribatis", 122 | "Saint Kitts and Nevis" : "Sent Kitsas ir Nevis", 123 | "Korea (Democratic People's Republic of)" : "Korėja (Liaudies Demokratinė Respublika)", 124 | "Kuwait" : "Kuveitas", 125 | "Kazakhstan" : "Kazachstanas", 126 | "Lebanon" : "Libanas", 127 | "Liechtenstein" : "Lichtenšteinas", 128 | "Sri Lanka" : "Šri Lanka", 129 | "Liberia" : "Liberija", 130 | "Lesotho" : "Lesotas", 131 | "Lithuania" : "Lietuva", 132 | "Luxembourg" : "Liuksemburgas", 133 | "Latvia" : "Latvija", 134 | "Libya" : "Libija", 135 | "Morocco" : "Marokas", 136 | "Monaco" : "Monakas", 137 | "Montenegro" : "Juodkalnija", 138 | "Madagascar" : "Madagaskaras", 139 | "Marshall Islands" : "Maršalo salos", 140 | "Mali" : "Malis", 141 | "Myanmar" : "Mianmaras", 142 | "Mongolia" : "Mongolija", 143 | "Mauritania" : "Mauritanija", 144 | "Malta" : "Malta", 145 | "Mauritius" : "Mauricijus", 146 | "Maldives" : "Maldyvai", 147 | "Malawi" : "Malavis", 148 | "Mexico" : "Meksika", 149 | "Malaysia" : "Malaizija", 150 | "Mozambique" : "Mozambikas", 151 | "Namibia" : "Namibija", 152 | "New Caledonia" : "Naujoji Kaledonija", 153 | "Niger" : "Nigeris", 154 | "Nigeria" : "Nigerija", 155 | "Nicaragua" : "Nikaragva", 156 | "Netherlands" : "Nyderlandai", 157 | "Norway" : "Norvegija", 158 | "Nepal" : "Nepalas", 159 | "Nauru" : "Nauru", 160 | "New Zealand" : "Naujoji Zelandija", 161 | "Oman" : "Omanas", 162 | "Panama" : "Panama", 163 | "Peru" : "Peru", 164 | "Papua New Guinea" : "Papua Naujoji Gvinėja", 165 | "Philippines" : "Filipinai", 166 | "Pakistan" : "Pakistanas", 167 | "Poland" : "Lenkija", 168 | "Pitcairn" : "Pitkerno salos", 169 | "Puerto Rico" : "Puerto Rikas", 170 | "Portugal" : "Portugalija", 171 | "Paraguay" : "Paragvajus", 172 | "Qatar" : "Kataras", 173 | "Romania" : "Rumunija", 174 | "Serbia" : "Serbija", 175 | "Russian Federation" : "Rusijos Federacija", 176 | "Rwanda" : "Ruanda", 177 | "Saudi Arabia" : "Saudo Arabija", 178 | "Solomon Islands" : "Saliamono salos", 179 | "Seychelles" : "Seišelių salos", 180 | "Sudan" : "Sudanas", 181 | "Sweden" : "Švedija", 182 | "Singapore" : "Singapūras", 183 | "Slovenia" : "Slovėnija", 184 | "Slovakia" : "Slovakija", 185 | "Sierra Leone" : "Siera Leonė", 186 | "Senegal" : "Senegalas", 187 | "Somalia" : "Somalis", 188 | "Suriname" : "Surinamas", 189 | "South Sudan" : "Pietų Sudanas", 190 | "El Salvador" : "Salvadoras", 191 | "Syrian Arab Republic" : "Sirijos Arabų Respublika", 192 | "Turks and Caicos Islands" : "Terkso ir Kaikoso salos", 193 | "Chad" : "Čadas", 194 | "Togo" : "Togas", 195 | "Thailand" : "Tailandas", 196 | "Tajikistan" : "Tadžikistanas", 197 | "Timor-Leste" : "Rytų Timoras", 198 | "Turkmenistan" : "Turkmėnistanas", 199 | "Tunisia" : "Tunisas", 200 | "Tonga" : "Tongų", 201 | "Turkey" : "Turkija", 202 | "Trinidad and Tobago" : "Trinidadas ir Tobagas", 203 | "Tanzania, United Republic of" : "Tanzanijos Jungtinė Respublika", 204 | "Ukraine" : "Ukraina", 205 | "Uganda" : "Uganda", 206 | "United States Minor Outlying Islands" : "Jungtinių Valstijų nuošalios mažosios salos", 207 | "United States of America" : "Jungtinės Amerikos Valstijos", 208 | "Uruguay" : "Urugvajus", 209 | "Uzbekistan" : "Uzbekistanas", 210 | "Viet Nam" : "Vietnamas", 211 | "Vanuatu" : "Vanuatu", 212 | "Yemen" : "Jemenas", 213 | "South Africa" : "Pietų Afrika", 214 | "Zambia" : "Zambija", 215 | "Zimbabwe" : "Zimbabvė" 216 | }, 217 | "nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);"); 218 | -------------------------------------------------------------------------------- /tests/Unit/LocalizationServices/MaxMindGeoLite2Test.php: -------------------------------------------------------------------------------- 1 | l = $this->getMockBuilder('OCP\IL10N')->getMock(); 21 | $this->l->method('t')->will( 22 | $this->returnCallback([$this,'callbackLTJustRouteThrough'])); 23 | $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); 24 | $tmp_config = $this->getMockBuilder('OCP\IConfig')->getMock(); 25 | $this->config = $this->getMockBuilder( 26 | 'OCA\GeoBlocker\Config\GeoBlockerConfig')->setConstructorArgs( 27 | [$tmp_config])->getMock(); 28 | $this->geo_ip_lookup = new MaxMindGeoLite2($this->config, $this->l, $this->logger); 29 | } 30 | 31 | public function testIsValidStatusOk() { 32 | $this->assertTrue($this->geo_ip_lookup->getStatus()); 33 | } 34 | 35 | // public function testIsInvalidStatusOk() { 36 | // $phar_file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 37 | // '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 38 | // '3rdparty' . DIRECTORY_SEPARATOR . 'maxmind_geolite2' . 39 | // DIRECTORY_SEPARATOR . '' . 'geoip2.phar'; 40 | // $this->assertTrue(file_exists($phar_file)); 41 | // rename($phar_file, $phar_file . 'bak'); 42 | // try { 43 | // $this->geo_ip_lookup = new MaxMindGeoLite2($this->config, $this->l); 44 | // $this->assertFalse($this->geo_ip_lookup->getStatus()); 45 | // } finally { 46 | // rename($phar_file . 'bak', $phar_file); 47 | // } 48 | // } 49 | public function testIsValidStatusStringOk() { 50 | // $this->cmd_wrapper->method ( 'geoiplookup' )->will ( 51 | // $this->returnCallback ( 52 | // array ($this,'callbackGeoIpLookupValid' 53 | // ) ) ); 54 | // $this->cmd_wrapper->method ( 'geoiplookup6' )->will ( 55 | // $this->returnCallback ( 56 | // array ($this,'callbackGeoIpLookup6Valid' 57 | // ) ) ); 58 | $result = '"MaxMind GeoLite2": OK.'; 59 | $this->assertEquals($result, $this->geo_ip_lookup->getStatusString()); 60 | } 61 | 62 | // public function testIsInvalidStatusStringOk() { 63 | // $this->cmd_wrapper->method ( 'geoiplookup' )->will ( 64 | // $this->returnCallback ( 65 | // array ($this,'callbackGeoIpLookupInvalid' 66 | // ) ) ); 67 | // $this->cmd_wrapper->method ( 'geoiplookup6' )->will ( 68 | // $this->returnCallback ( 69 | // array ($this,'callbackGeoIpLookup6Invalid' 70 | // ) ) ); 71 | // $result = 'ERROR: "geoiplookup" seem to be not installed on the host of the Nextcloud server or not reachable for the web server or is wrongly configured (is the database for IPv4 and IPv6 available?!). Maybe the use of the php function exec() is disabled in the php.ini.'; 72 | // $this->assertEquals ( $result, $this->geo_ip_lookup->getStatusString () ); 73 | // } 74 | public function testIsCountryCodeFromValidIpOk() { 75 | $ip_address = '2a02:2e0:3fe:1001:302::'; 76 | $country_code = 'DE'; 77 | $this->assertEquals($country_code, 78 | $this->geo_ip_lookup->getCountryCodeFromIP($ip_address)); 79 | 80 | $country_code = 'US'; 81 | $ip_address = '24.165.23.67'; 82 | $this->assertEquals($country_code, 83 | $this->geo_ip_lookup->getCountryCodeFromIP($ip_address)); 84 | } 85 | 86 | public function testIsCountryCodeFromNotFoundIpOk() { 87 | $ip_address = 'fe80::'; 88 | $country_code = GeoBlocker::kCountryNotFoundCode; 89 | $this->assertEquals($country_code, 90 | $this->geo_ip_lookup->getCountryCodeFromIP($ip_address)); 91 | 92 | $ip_address = '127.0.0.1'; 93 | $country_code = GeoBlocker::kCountryNotFoundCode; 94 | $this->assertEquals($country_code, 95 | $this->geo_ip_lookup->getCountryCodeFromIP($ip_address)); 96 | } 97 | 98 | // public function testIsCountryCodeFromInvalidIp1Ok() { 99 | // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup' )->with ( 100 | // '127.0.0.1' )->will ( 101 | // $this->returnCallback ( 102 | // array ($this,'callbackGeoIpLookupValid' 103 | // ) ) ); 104 | // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup6' )->with ( 105 | // 'fe80::' )->will ( 106 | // $this->returnCallback ( 107 | // array ($this,'callbackGeoIpLookup6Valid' 108 | // ) ) ); 109 | // $ip_address = '291.133.564.12'; 110 | // $this->assertEquals ( 'INVALID_IP', 111 | // $this->geo_ip_lookup->getCountryCodeFromIP ( $ip_address ) ); 112 | // } 113 | // public function testIsCountryCodeFromInvalidIp2Ok() { 114 | // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup' )->with ( 115 | // '127.0.0.1' )->will ( 116 | // $this->returnCallback ( 117 | // array ($this,'callbackGeoIpLookupValid' 118 | // ) ) ); 119 | // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup6' )->with ( 120 | // 'fe80::' )->will ( 121 | // $this->returnCallback ( 122 | // array ($this,'callbackGeoIpLookup6Valid' 123 | // ) ) ); 124 | // $ip_address = 'aöerb03s'; 125 | // $this->assertEquals ( 'INVALID_IP', 126 | // $this->geo_ip_lookup->getCountryCodeFromIP ( $ip_address ) ); 127 | // } 128 | // public function testIsCountryCodeFromInvalidIp3Ok() { 129 | // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup' )->with ( 130 | // '127.0.0.1' )->will ( 131 | // $this->returnCallback ( 132 | // array ($this,'callbackGeoIpLookupValid' 133 | // ) ) ); 134 | // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup6' )->with ( 135 | // 'fe80::' )->will ( 136 | // $this->returnCallback ( 137 | // array ($this,'callbackGeoIpLookup6Valid' 138 | // ) ) ); 139 | // $ip_address = '2a023:2e0:3fe:1001:302::'; 140 | // $this->assertEquals ( 'INVALID_IP', 141 | // $this->geo_ip_lookup->getCountryCodeFromIP ( $ip_address ) ); 142 | // } 143 | // // public function testIsCountryCodeFromValidIpButInvalidServiceOk() { 144 | // // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup' )->with ( 145 | // // '127.0.0.1' )->will ( 146 | // // $this->returnCallback ( 147 | // // array ($this,'callbackGeoIpLookupInvalid' 148 | // // ) ) ); 149 | // // $this->cmd_wrapper->expects ( $this->once () )->method ( 'geoiplookup6' )->with ( 150 | // // 'fe80::' )->will ( 151 | // // $this->returnCallback ( 152 | // // array ($this,'callbackGeoIpLookup6Invalid' 153 | // // ) ) ); 154 | // // $ip_address = '2a02:2e0:3fe:1001:302::'; 155 | // // $this->assertEquals ( 'UNAVAILABLE', 156 | // // $this->geo_ip_lookup->getCountryCodeFromIP ( $ip_address ) ); 157 | // // } 158 | // public function callbackGeoIpLookupInvalid(string $ip_address, 159 | // array &$output, int &$return_var): String { 160 | // $output = array (); 161 | // $return_var = - 1; 162 | // return 'Command not found'; 163 | // } 164 | // public function callbackGeoIpLookup6Invalid(string $ip_address, 165 | // array &$output, int &$return_var): String { 166 | // $output = array (); 167 | // $return_var = - 1; 168 | // return 'Command not found'; 169 | // } 170 | // public function callbackGeoIpLookupValid(string $ip_address, array &$output, 171 | // int &$return_var): String { 172 | // $output = array ('GeoIP Country Edition: IP Address not found' 173 | // ); 174 | // $return_var = 0; 175 | // return 'GeoIP Country Edition: IP Address not found'; 176 | // } 177 | // public function callbackGeoIpLookup6Valid(string $ip_address, array &$output, 178 | // int &$return_var): String { 179 | // $output = array ('GeoIP Country V6 Edition: IP Address not found' 180 | // ); 181 | // $return_var = 0; 182 | // return 'GeoIP Country V6 Edition: IP Address not found'; 183 | // } 184 | // public function callbackGeoIpLookupValidIP(string $ip_address, 185 | // array &$output, int &$return_var): String { 186 | // if ($ip_address === '127.0.0.1') { 187 | // $output = array ('GeoIP Country Edition: IP Address not found' 188 | // ); 189 | // $return_var = 0; 190 | // return 'GeoIP Country Edition: IP Address not found'; 191 | // } else { 192 | // $output = array ('GeoIP Country Edition: DE, Germany' 193 | // ); 194 | // $return_var = 0; 195 | // return 'GeoIP Country Edition: DE, Germany'; 196 | // } 197 | // } 198 | // public function callbackGeoIpLookup6ValidIP(string $ip_address, 199 | // array &$output, int &$return_var): String { 200 | // if ($ip_address === 'fe80::') { 201 | // $output = array ('GeoIP Country V6 Edition: IP Address not found' 202 | // ); 203 | // $return_var = 0; 204 | // return 'GeoIP Country V6 Edition: IP Address not found'; 205 | // } else { 206 | // $output = array ('GeoIP Country V6 Edition: DE, Germany' 207 | // ); 208 | // $return_var = 0; 209 | // return 'GeoIP Country V6 Edition: DE, Germany'; 210 | // } 211 | // } 212 | public function callbackLTJustRouteThrough(string $in): string { 213 | return $in; 214 | } 215 | } 216 | --------------------------------------------------------------------------------