A lot of changes
+ PowerLine prompt now shows degraded systemctl state (When Apllicable) + Get-PlexInfo notifies if PLEX creds are needed and are missing + XDG env are setup if missing on linux + vi/vim command will launch editor, but prefer vi/vim/nvim if exists + new chezmoi package: auto loading completion + new flatpak package: List and Kill commands added + new zfs package: zls command added
This commit is contained in:
parent
cdabbc7858
commit
4bf2ff19f4
15 changed files with 188 additions and 42 deletions
|
@ -1,10 +1,19 @@
|
|||
param([switch]$FetchFromServer,[string]$PlexHost='localhost',[switch]$PassThruOnly)
|
||||
param([switch]$FetchFromServer,[string]$PlexHost,[PSCredential]$Credential,[switch]$PassThruOnly)
|
||||
|
||||
$local:content = $(try{(Get-Content /run/plex.stream.counter/sessions -Raw -ErrorAction Stop)}catch{})
|
||||
|
||||
if( $FetchFromServer ) {
|
||||
$local:creds = New-Object System.Management.Automation.PsCredential($env:PLEX_USERNAME,$(ConvertTo-SecureString -AsPlainText $env:PLEX_PASSWORD -Force))
|
||||
$local:webResp = Invoke-WebRequest -Headers @{ "Content-Length" = "0"; "X-Plex-Client-Identifier" = "my-app" } -Credential $creds -Method Post -Uri "https://my.plexapp.com/users/sign_in.xml"
|
||||
if( ! $PlexHost ) { $PlexHost = $env:PLEX_HOST }
|
||||
if( ! $PlexHost ) { $PlexHost = 'localhost' }
|
||||
|
||||
if( -not Credential ) { $Credential = $PlexPresetCredential }
|
||||
if( -not Credential ) {
|
||||
if( -not $env:PLEX_USERNAME -or -not $env:PLEX_PASSWORD ) {
|
||||
throw "`$env:PLEX_USERNAME AND `$env:PLEX_PASSWORD must be defined in order to read directly from server"
|
||||
}
|
||||
$Credential = New-Object System.Management.Automation.PsCredential($env:PLEX_USERNAME,$(ConvertTo-SecureString -AsPlainText $env:PLEX_PASSWORD -Force))
|
||||
}
|
||||
$local:webResp = Invoke-WebRequest -Headers @{ "Content-Length" = "0"; "X-Plex-Client-Identifier" = "my-app" } -Credential $Credential -Method Post -Uri "https://my.plexapp.com/users/sign_in.xml"
|
||||
$local:plexHeaders = @{ "X-Plex-Token" = ([xml]$webResp.Content).user.authenticationToken }
|
||||
$webResp = Invoke-WebRequest -Headers $plexHeaders "http://${PlexHost}:32400"
|
||||
$local:plexVersion = ([xml]$webResp.Content).MediaContainer.version
|
||||
|
|
9
base.linux/profile.d/env.ps1
Normal file
9
base.linux/profile.d/env.ps1
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Setting some defaults based on
|
||||
# FreeDesktop.org's XDG Base Directory Specification document:
|
||||
# https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
|
||||
if( -not (Test-Path env:XDG_DATA_HOME) ) {
|
||||
$env:XDG_DATA_HOME="$HOME/.local/share"
|
||||
}
|
||||
if( -not (Test-Path env:XDG_CONFIG_HOME) ) {
|
||||
$env:XDG_CONFIG_HOME="$HOME/.config"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue