From e493cda473a9aeacc75170897d06710de44496c5 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:04:50 +0200 Subject: [PATCH 01/15] logging for report new matches --- discord/report_new_matches.ps1 | 3 ++- logs/REAMD.MD | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 logs/REAMD.MD diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 91a2253..aa73f3d 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,4 +1,5 @@ -Start-Transcript -Path '/var/log/dtch/report_new_matches.log' -Append +$logprefix = get-date -Format ddMMyyy_HHmmss +Start-Transcript -Path "../logs/report_new_matches_$logprefix.log" -Append if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location diff --git a/logs/REAMD.MD b/logs/REAMD.MD new file mode 100644 index 0000000..940fe81 --- /dev/null +++ b/logs/REAMD.MD @@ -0,0 +1 @@ +Location for logs \ No newline at end of file From 13e73a8fe92caa77273e2d798591dfb47d304e65 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:09:41 +0200 Subject: [PATCH 02/15] workflow --- .github/workflows/dtchsyn.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dtchsyn.yml b/.github/workflows/dtchsyn.yml index 7ef0e1e..f7c6548 100644 --- a/.github/workflows/dtchsyn.yml +++ b/.github/workflows/dtchsyn.yml @@ -33,6 +33,5 @@ jobs: ./ => ${{ env.DESTINATION }} ignore: | *.git - */**/*git* config.php data/**/*.json \ No newline at end of file From 554861f00f8ea0e40fbf4d5edd3639f961ad97dd Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:13:41 +0200 Subject: [PATCH 03/15] dryrun for debugging --- .github/workflows/dtchsyn.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dtchsyn.yml b/.github/workflows/dtchsyn.yml index f7c6548..d3daa0e 100644 --- a/.github/workflows/dtchsyn.yml +++ b/.github/workflows/dtchsyn.yml @@ -25,6 +25,7 @@ jobs: - name: SFTP upload uses: Dylan700/sftp-upload-action@latest with: + dry-run: true server: ${{secrets.SYNADDR}} username: ${{secrets.SYNUSR}} password: ${{secrets.SYNPASS}} @@ -32,6 +33,6 @@ jobs: uploads: | ./ => ${{ env.DESTINATION }} ignore: | - *.git + .git config.php data/**/*.json \ No newline at end of file From d4ca82923e46310bc56766a78f389e04e66fb682 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:15:13 +0200 Subject: [PATCH 04/15] dry-run: true --- .github/workflows/dtchsyn.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dtchsyn.yml b/.github/workflows/dtchsyn.yml index d3daa0e..7a3443a 100644 --- a/.github/workflows/dtchsyn.yml +++ b/.github/workflows/dtchsyn.yml @@ -25,7 +25,7 @@ jobs: - name: SFTP upload uses: Dylan700/sftp-upload-action@latest with: - dry-run: true + dry-run: false server: ${{secrets.SYNADDR}} username: ${{secrets.SYNUSR}} password: ${{secrets.SYNPASS}} From d9c78f148874b11683fa3f3a36f5eb736db998a9 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:17:19 +0200 Subject: [PATCH 05/15] debug: true --- .github/workflows/dtchsyn.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dtchsyn.yml b/.github/workflows/dtchsyn.yml index 7a3443a..cb9baee 100644 --- a/.github/workflows/dtchsyn.yml +++ b/.github/workflows/dtchsyn.yml @@ -25,6 +25,7 @@ jobs: - name: SFTP upload uses: Dylan700/sftp-upload-action@latest with: + debug: true dry-run: false server: ${{secrets.SYNADDR}} username: ${{secrets.SYNUSR}} From 50543f97d1d89cfda75a349950573999bf7d4fb1 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:20:05 +0200 Subject: [PATCH 06/15] andere provider --- .../workflows/{dtchsyn.yml => dtchsyn.bck} | 0 .github/workflows/dtchsyn_v2.yml | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+) rename .github/workflows/{dtchsyn.yml => dtchsyn.bck} (100%) create mode 100644 .github/workflows/dtchsyn_v2.yml diff --git a/.github/workflows/dtchsyn.yml b/.github/workflows/dtchsyn.bck similarity index 100% rename from .github/workflows/dtchsyn.yml rename to .github/workflows/dtchsyn.bck diff --git a/.github/workflows/dtchsyn_v2.yml b/.github/workflows/dtchsyn_v2.yml new file mode 100644 index 0000000..49d096d --- /dev/null +++ b/.github/workflows/dtchsyn_v2.yml @@ -0,0 +1,38 @@ +on: + push: + branches: + - dev + - main + +name: Publish Website +jobs: + web-deploy: + name: Deploy based on branch + runs-on: ubuntu-latest + steps: + - name: Set destination path based on branch + id: set-destination + run: | + if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then + echo "DESTINATION=/Lantaeu/dtch/" >> $GITHUB_ENV + else + echo "DESTINATION=/Lantaeu/dtch_dev/" >> $GITHUB_ENV + fi + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Show upload destination + run: | + echo "Uploading to: $DESTINATION" + + - name: Upload via SFTP + uses: pressidium/lftp-mirror-action@v1 + with: + host: ${{ secrets.SYNADDR }} + port: 22 + user: ${{ secrets.SYNUSR }} + pass: ${{ secrets.SYNPASS }} + localDir: ./ + remoteDir: ${{ env.DESTINATION }} + args: "--exclude-glob *.git --exclude-glob config.php --exclude-glob data/**/*.json" From 50d8a89cb81488b0e86750231d4b4b38fbdc12fb Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:25:55 +0200 Subject: [PATCH 07/15] fix --- .github/workflows/{dtchsyn.bck => dtchsyn.yaml} | 4 ++-- .github/workflows/{dtchsyn_v2.yml => dtchsyn_v2.bck} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{dtchsyn.bck => dtchsyn.yaml} (86%) rename .github/workflows/{dtchsyn_v2.yml => dtchsyn_v2.bck} (100%) diff --git a/.github/workflows/dtchsyn.bck b/.github/workflows/dtchsyn.yaml similarity index 86% rename from .github/workflows/dtchsyn.bck rename to .github/workflows/dtchsyn.yaml index cb9baee..a3a654f 100644 --- a/.github/workflows/dtchsyn.bck +++ b/.github/workflows/dtchsyn.yaml @@ -14,9 +14,9 @@ jobs: id: set-destination run: | if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - echo "DESTINATION=/Lantaeu/dtch/" >> $GITHUB_ENV + echo "DESTINATION=/LantaeuSSD/dtch/" >> $GITHUB_ENV else - echo "DESTINATION=/Lantaeu/dtch_dev/" >> $GITHUB_ENV + echo "DESTINATION=/LantaeuSSD/dtch_dev/" >> $GITHUB_ENV fi - name: Checkout diff --git a/.github/workflows/dtchsyn_v2.yml b/.github/workflows/dtchsyn_v2.bck similarity index 100% rename from .github/workflows/dtchsyn_v2.yml rename to .github/workflows/dtchsyn_v2.bck From b6a4b3f4e2bac05a709a821266040135fed991e1 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:28:18 +0200 Subject: [PATCH 08/15] fixes --- .github/workflows/dtchsyn.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dtchsyn.yaml b/.github/workflows/dtchsyn.yaml index a3a654f..356fe61 100644 --- a/.github/workflows/dtchsyn.yaml +++ b/.github/workflows/dtchsyn.yaml @@ -25,7 +25,6 @@ jobs: - name: SFTP upload uses: Dylan700/sftp-upload-action@latest with: - debug: true dry-run: false server: ${{secrets.SYNADDR}} username: ${{secrets.SYNUSR}} From 4a24446fbb46c2ff6335a5c401c0f22e729d5d16 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 09:28:53 +0200 Subject: [PATCH 09/15] remove --- .github/workflows/dtchsyn_v2.bck | 38 -------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .github/workflows/dtchsyn_v2.bck diff --git a/.github/workflows/dtchsyn_v2.bck b/.github/workflows/dtchsyn_v2.bck deleted file mode 100644 index 49d096d..0000000 --- a/.github/workflows/dtchsyn_v2.bck +++ /dev/null @@ -1,38 +0,0 @@ -on: - push: - branches: - - dev - - main - -name: Publish Website -jobs: - web-deploy: - name: Deploy based on branch - runs-on: ubuntu-latest - steps: - - name: Set destination path based on branch - id: set-destination - run: | - if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - echo "DESTINATION=/Lantaeu/dtch/" >> $GITHUB_ENV - else - echo "DESTINATION=/Lantaeu/dtch_dev/" >> $GITHUB_ENV - fi - - - name: Checkout code - uses: actions/checkout@v4 - - - name: Show upload destination - run: | - echo "Uploading to: $DESTINATION" - - - name: Upload via SFTP - uses: pressidium/lftp-mirror-action@v1 - with: - host: ${{ secrets.SYNADDR }} - port: 22 - user: ${{ secrets.SYNUSR }} - pass: ${{ secrets.SYNPASS }} - localDir: ./ - remoteDir: ${{ env.DESTINATION }} - args: "--exclude-glob *.git --exclude-glob config.php --exclude-glob data/**/*.json" From 8ba50dc2180d032898fa471a9175c47895d00503 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:14:15 +0200 Subject: [PATCH 10/15] up --- discord/report_new_matches.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index aa73f3d..992a934 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,4 +1,5 @@ $logprefix = get-date -Format ddMMyyy_HHmmss +#up Start-Transcript -Path "../logs/report_new_matches_$logprefix.log" -Append if ($PSScriptRoot.length -eq 0) { From dcbe548b38b5d43b173e32e7e0181b273e26a315 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:23:06 +0200 Subject: [PATCH 11/15] s --- discord/report_new_matches.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 992a934..bebe835 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,6 +1,4 @@ -$logprefix = get-date -Format ddMMyyy_HHmmss -#up -Start-Transcript -Path "../logs/report_new_matches_$logprefix.log" -Append + if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location @@ -8,6 +6,11 @@ if ($PSScriptRoot.length -eq 0) { else { $scriptroot = $PSScriptRoot } + +$logprefix = get-date -Format ddMMyyy_HHmmss +#up +Start-Transcript -Path "$scriptroot/../logs/report_new_matches_$logprefix.log" -Append + . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" From 9445bbbc05ac9c4ac25ecf04616ccaf1bbcbcf7c Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:23:19 +0200 Subject: [PATCH 12/15] s --- discord/report_new_matches.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index bebe835..483146d 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,6 +1,4 @@ - - -if ($PSScriptRoot.length -eq 0) { +if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location } else { @@ -8,7 +6,6 @@ else { } $logprefix = get-date -Format ddMMyyy_HHmmss -#up Start-Transcript -Path "$scriptroot/../logs/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 From 4de3775ed75832d9dece9c60af97c3c3d768755a Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:37:40 +0200 Subject: [PATCH 13/15] new --- discord/report_new_matches.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 483146d..eaca2c0 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,15 +1,21 @@ -if ($PSScriptRoot.length -eq 0) { +$logprefix = Get-Date -Format "ddMMyyyy_HHmmss" +if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location } else { $scriptroot = $PSScriptRoot } +$RelativeLogdir = Join-Path -Path $scriptroot -ChildPath "..\logs" +$logDir = (Resolve-Path -Path $RelativeLogdir).Path -$logprefix = get-date -Format ddMMyyy_HHmmss -Start-Transcript -Path "$scriptroot/../logs/report_new_matches_$logprefix.log" -Append - +Start-Transcript -Path "$logDir/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" +write-output "Scriptroot: $scriptroot" +write-output "Scriptname: $($MyInvocation.MyCommand)" +write-output "Script: $($MyInvocation.MyCommand.Path)" +write-output "PSScriptroot: $PSScriptRoot" +write-output "Logdir: $logDir" $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw @@ -66,11 +72,14 @@ $map_map = @{ } try { + get-content "$scriptroot/../data/player_matches.json" #debug purposes $player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100 } catch { Write-Output 'Unable to read file exitin' } +write-output $player_matches +Write-Output $new_win_matches $new_win_matches = $player_matches[-1].new_win_matches From 70e7e32c577a329693c5a5a311375e02c7597df3 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:45:53 +0200 Subject: [PATCH 14/15] iets minder mag wel --- discord/report_new_matches.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index eaca2c0..83462d3 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -72,13 +72,12 @@ $map_map = @{ } try { - get-content "$scriptroot/../data/player_matches.json" #debug purposes $player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100 } catch { Write-Output 'Unable to read file exitin' } -write-output $player_matches +Write-Output $player_matches Write-Output $new_win_matches $new_win_matches = $player_matches[-1].new_win_matches From 7e15639bb3011c38a53c6c9c47491ffbb4278d7d Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 10 Apr 2025 12:53:36 +0200 Subject: [PATCH 15/15] fix for custom met bots --- discord/report_new_matches.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 83462d3..e70b450 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -95,14 +95,14 @@ foreach ($winid in $new_win_matches) { $2D_replay_url = $2D_replay_url + "?follow=$($winners[0])" $match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers - if($winmatches[0].gameMode -eq 'tdm' ){ + if ($winmatches[0].gameMode -eq 'tdm' ) { continue } #skip tdm matches if ($winmatches[0].matchType -eq 'custom') { - $players_to_report = $match_stats.included.attributes.stats + $players_to_report = $match_stats.included.attributes.stats | where-object { $_.playerId -notlike "ai.*" } } else { - $players_to_report = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 }) + $players_to_report = $match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 } } if ($new_win_matches.count -le 10) {