-
Notifications
You must be signed in to change notification settings - Fork 2
/
sample.ps1
58 lines (43 loc) · 1.97 KB
/
sample.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#Requires -PSEdition Core
#-Requires -Modules TUN.CredentialManager
param(
[switch] $Init,
[switch] $Dump,
[switch] $Test,
[switch] $Session
)
if ($Init) {
Import-Module .\PoshToDon -Force
$scope = "read", "write"
$instance = "home.social"
# $email = Get-Secret -Vault PoshToDon -Name "$instance|email"
# $password = Get-Secret -Vault PoshToDon -Name "$instance|password"
$clientKey = Get-Secret -Vault PoshToDon -Name "$instance|key" | ConvertFrom-SecureString -AsPlainText
$clientSecret = Get-Secret -Vault PoshToDon -Name "$instance|secret"
New-MastodonSession -ClientId:$clientKey -ClientSecret:$clientSecret -Instance:$instance
Connect-MastodonApplication -Scope:$scope # -Email:$email -Password:$password
}
if ($Dump) {
Get-MastodonInstance
Get-MastodonNotification
Get-MastodonCustomEmojis
#Get-MastodonNotifications -Session:$session1 -Limit 300 -MaxId 87886 -ExcludeTypes favourite, mention | Format-Table
355424 | Get-MastodonNotification
}
if ($Session) {
$scope = "read", "write"
$instance2 = "norden.social"
$clientKey2 = Get-Secret -Vault PoshToDon -Name "$instance2|key" | ConvertFrom-SecureString -AsPlainText
$clientSecret2 = Get-Secret -Vault PoshToDon -Name "$instance2|secret"
# $email = Get-Secret -Vault PoshToDon -Name "$instance2|email"
# $password2 = Get-Secret -Vault PoshToDon -Name "$instance2|password"
$session2 = New-MastodonSession -ClientId:$clientKey2 -ClientSecret:$clientSecret2 -Instance:$instance2 -PassThru
Connect-MastodonApplication -Session:$session2 -Scope:$scope # -Email:$email -Password:$password2
Get-MastodonNotification -Session:$session2 -Limit 300 -MaxId 87886 -ExcludeTypes favourite, mention | Format-Table
$session2 | Get-MastodonInstance | ForEach-Object name
}
if ($Test) {
$MyInvocation | ConvertTo-Json -Depth 1
# Write-Host $fname
# $null = New-Item -Path function: -Name "local:$fname" -Value { Write-Host "lol2" } -Force
}