mirror of
https://github.com/dockur/windows.git
synced 2026-07-27 21:42:36 +07:00
Compare commits
6 Commits
e9f78810f5
...
e4d79e1a17
| Author | SHA1 | Date | |
|---|---|---|---|
| e4d79e1a17 | |||
| 915f9d87aa | |||
| 3f890dda8b | |||
| 0f1cedfc2c | |||
| 18a7b3d6f3 | |||
| 22e48a6bea |
@@ -295,9 +295,7 @@ jobs:
|
||||
Function GetPlatform(shell)
|
||||
Dim architecture
|
||||
|
||||
architecture = UCase(
|
||||
shell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
|
||||
)
|
||||
architecture = UCase(shell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%"))
|
||||
|
||||
Select Case architecture
|
||||
Case "AMD64"
|
||||
@@ -334,10 +332,7 @@ jobs:
|
||||
Set shell = CreateObject("WScript.Shell")
|
||||
Set locator = CreateObject("WbemScripting.SWbemLocator")
|
||||
Set service = locator.ConnectServer(".", "root\cimv2")
|
||||
Set systems = service.ExecQuery(
|
||||
"SELECT Caption, Version, BuildNumber " & _
|
||||
"FROM Win32_OperatingSystem"
|
||||
)
|
||||
Set systems = service.ExecQuery("SELECT Caption, Version, BuildNumber FROM Win32_OperatingSystem")
|
||||
|
||||
caption = ""
|
||||
version = ""
|
||||
@@ -350,11 +345,7 @@ jobs:
|
||||
Exit For
|
||||
Next
|
||||
|
||||
edition = ReadRegistry(
|
||||
shell,
|
||||
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID"
|
||||
)
|
||||
|
||||
edition = ReadRegistry(shell, "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID")
|
||||
platform = GetPlatform(shell)
|
||||
|
||||
temporary = "\\host.lan\Data\windows.tmp"
|
||||
@@ -363,10 +354,7 @@ jobs:
|
||||
Do
|
||||
On Error Resume Next
|
||||
|
||||
share = ReadTextFile(
|
||||
filesystem,
|
||||
"\\host.lan\Data\readme.txt"
|
||||
)
|
||||
share = ReadTextFile(filesystem, "\\host.lan\Data\readme.txt")
|
||||
|
||||
If Err.Number = 0 Then
|
||||
json = _
|
||||
@@ -380,12 +368,7 @@ jobs:
|
||||
"""share"":""" & EscapeJson(share) & """" & _
|
||||
"}"
|
||||
|
||||
Set file = filesystem.OpenTextFile(
|
||||
temporary,
|
||||
ForWriting,
|
||||
True
|
||||
)
|
||||
|
||||
Set file = filesystem.OpenTextFile(temporary, ForWriting, True)
|
||||
file.Write json
|
||||
file.Close
|
||||
|
||||
|
||||
+107
-5
@@ -2,6 +2,8 @@ name: Links
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
concurrency:
|
||||
group: links
|
||||
@@ -22,29 +24,63 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
-
|
||||
name: Validate Links
|
||||
name: Validate all download mirrors
|
||||
id: validate
|
||||
run: |
|
||||
errors=0
|
||||
count=0
|
||||
skipped=0
|
||||
tested=0
|
||||
host=""
|
||||
failed_links=""
|
||||
failed_links_html=""
|
||||
declare -A seen
|
||||
|
||||
ignored_domains=(
|
||||
files.dog
|
||||
bobpony.com
|
||||
)
|
||||
|
||||
wget https://github.com/lwthiker/curl-impersonate/releases/download/v0.6.1/curl-impersonate-v0.6.1.x86_64-linux-gnu.tar.gz
|
||||
tar -xzf curl-impersonate-v0.6.1.x86_64-linux-gnu.tar.gz
|
||||
sudo cp curl-impersonate-ff /usr/local/bin/
|
||||
|
||||
check() {
|
||||
local url="$1" http
|
||||
|
||||
http=$(curl-impersonate-ff -sSL -o /dev/null -w "%{http_code}" --max-time 10 -I -- "$url" 2>&1) || http="000"
|
||||
[[ "$http" == 2* ]] && return 0
|
||||
|
||||
http=$(curl-impersonate-ff -sSL -o /dev/null -w "%{http_code}" --max-time 10 -r "0-0" -- "$url" 2>&1) || http="000"
|
||||
[[ "$http" == 2* ]]
|
||||
}
|
||||
|
||||
isIgnoredDomain() {
|
||||
local url="$1"
|
||||
local domain ignored
|
||||
|
||||
domain="${url#*://}"
|
||||
domain="${domain%%/*}"
|
||||
domain="${domain%%:*}"
|
||||
domain="${domain,,}"
|
||||
|
||||
for ignored in "${ignored_domains[@]}"; do
|
||||
if [[ "$domain" == "$ignored" || "$domain" == *."$ignored" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" =~ ^[[:space:]]*local[[:space:]]+host=\"(https://[^\"]+)\" ]]; then
|
||||
host="${BASH_REMATCH[1]%/}"
|
||||
continue
|
||||
fi
|
||||
|
||||
[[ "$line" =~ ^[[:space:]]*url=\"(.+)\" ]] || continue
|
||||
val="${BASH_REMATCH[1]#/}"
|
||||
|
||||
if [[ "$val" == https://* ]]; then
|
||||
url="$val"
|
||||
elif [[ -n "$host" ]]; then
|
||||
@@ -52,16 +88,82 @@ jobs:
|
||||
else
|
||||
continue
|
||||
fi
|
||||
|
||||
[[ -v seen[$url] ]] && continue
|
||||
seen[$url]=1
|
||||
count=$((count + 1))
|
||||
|
||||
if isIgnoredDomain "$url"; then
|
||||
echo "SKIP: $url (ignored domain)"
|
||||
skipped=$((skipped + 1))
|
||||
continue
|
||||
fi
|
||||
|
||||
tested=$((tested + 1))
|
||||
|
||||
if check "$url"; then
|
||||
echo " OK: $url"
|
||||
else
|
||||
echo "FAIL: $url"
|
||||
errors=$((errors + 1))
|
||||
failed_links+="$url"$'\n'
|
||||
failed_links_html+="<li><a href=\"$url\">$url</a></li>"$'\n'
|
||||
fi
|
||||
done < "src/define.sh"
|
||||
|
||||
echo ""
|
||||
printf '%d/%d links valid\n' "$(( count - errors ))" "$count"
|
||||
(( errors == 0 ))
|
||||
printf '%d/%d tested links valid\n' "$((tested - errors))" "$tested"
|
||||
|
||||
if (( skipped > 0 )); then
|
||||
printf '%d link(s) skipped for ignored domains\n' "$skipped"
|
||||
fi
|
||||
|
||||
if (( errors > 0 )); then
|
||||
printf '%d blocking failure(s)\n' "$errors"
|
||||
|
||||
{
|
||||
echo "failed=true"
|
||||
echo "links<<EOF"
|
||||
printf '%s' "$failed_links"
|
||||
echo "EOF"
|
||||
echo "html_links<<EOF"
|
||||
printf '%s' "$failed_links_html"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "failed=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
-
|
||||
name: Send mail
|
||||
if: steps.validate.outputs.failed == 'true'
|
||||
uses: action-pack/send-mail@v1
|
||||
with:
|
||||
to: ${{secrets.MAILTO}}
|
||||
from: Github Actions <${{secrets.MAILTO}}>
|
||||
connection_url: ${{secrets.MAIL_CONNECTION}}
|
||||
subject: Mirror verification failed!
|
||||
body: |
|
||||
Mirror verification failed!
|
||||
|
||||
The following links failed:
|
||||
|
||||
${{ steps.validate.outputs.links }}
|
||||
|
||||
See https://github.com/${{ github.repository }}/actions for more information.
|
||||
html_body: |
|
||||
<p>Mirror verification failed!</p>
|
||||
|
||||
<p>The following links failed:</p>
|
||||
|
||||
<ul>
|
||||
${{ steps.validate.outputs.html_links }}
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
See
|
||||
<a href="https://github.com/${{ github.repository }}/actions">GitHub Actions</a>
|
||||
for more information.
|
||||
</p>
|
||||
-
|
||||
name: Fail workflow
|
||||
if: always() && steps.validate.outputs.failed == 'true'
|
||||
run: exit 1
|
||||
|
||||
@@ -23,7 +23,6 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
desktop:
|
||||
if: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -102,7 +101,6 @@ jobs:
|
||||
platform: ${{ matrix.platform }}
|
||||
|
||||
tiny:
|
||||
if: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -141,7 +139,6 @@ jobs:
|
||||
platform: ${{ matrix.platform }}
|
||||
|
||||
server:
|
||||
if: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
||||
Reference in New Issue
Block a user