-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(autoconfig): Refactor DNS query for testing
Signed-off-by: Christoph Wurst <[email protected]>
- Loading branch information
1 parent
cd789d5
commit 8160d97
Showing
10 changed files
with
16,515 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
# SPDX-License-Identifier: MIT | ||
name: Update public suffix list | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "5 2 * * *" | ||
|
||
jobs: | ||
update-public-suffix-list: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
branches: ['main', 'stable3.7'] | ||
|
||
name: update-public-suffix-list-${{ matrix.branches }} | ||
|
||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
with: | ||
ref: ${{ matrix.branches }} | ||
submodules: true | ||
|
||
- name: Download public suffix list | ||
run: curl --output resources/resources/public_suffix_list.dat https://publicsuffix.org/list/public_suffix_list.dat | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c | ||
with: | ||
token: ${{ secrets.COMMAND_BOT_PAT }} | ||
commit-message: 'fix(dns): Update public suffix list' | ||
committer: GitHub <[email protected]> | ||
author: nextcloud-command <[email protected]> | ||
signoff: true | ||
branch: 'fix/dns/update-public-suffix-list-${{ matrix.branches }}' | ||
title: '[${{ matrix.branches }}] fix(dns): Update public suffix list' | ||
body: | | ||
Auto-generated update of https://publicsuffix.org/ | ||
labels: | | ||
dependencies | ||
3. to review | ||
reviewers: ChristophWurst |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\Mail\Dns; | ||
|
||
use Pdp\Domain; | ||
use Pdp\Rules; | ||
use function dns_get_record; | ||
|
||
class Resolver { | ||
|
||
public function resolve(string $hostname, int $type): array|false { | ||
return dns_get_record($hostname, $type); | ||
} | ||
|
||
public function isSuffix(string $hostname): bool { | ||
$publicSuffixList = Rules::fromPath(__DIR__ . '/../../resources/public_suffix_list.dat'); | ||
$domain = Domain::fromIDNA2008($hostname); | ||
|
||
$result = $publicSuffixList->resolve($domain); | ||
|
||
return $result->secondLevelDomain()->toString() === ''; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.