Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1158

Help: Rainmeter Skins • Re: Weird behaivour with WebParser HTTP Authentication

$
0
0
I don't have VLC installed either, but same way as Yincognito, this error leads me thinking there is something wrong with the username.
Hmm... it works for me for a plain non authentication local webpage (e.g. (Invoke-WebRequest -URI "http://localhost:8080/Index.js").Content), so this might require the usage of some other parameters of Invoke-WebRequest e.g. -Authentication and possibly -Body in order to be successful in the attempt (see example 2 below too):
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4
Both of you were correct, the problem in both Rainmeter and Powershell were the fact that the username is missing.
In Powershell's case, I tried to use both -Body to input a $NULL username and then -Credentials which also didn't allow me to continue without a valid username
In Rainmeter's case, I wasn't able to find what is exactly used, looking at the MeasureWebParser.h file though I see the class HINTERNET, which is my only hint, searching it on Google got me to this page about HINTERNET Handlers, then on the side there is the page explaining this problem, Handling Authentication, which specifically says both User name and password have to be valid.

The problem is, you can't set a username in VLC, the URL can not be in any other form than http://:<Password>@localhost:<Port>/, which sucks. In essence this is a Windows design choice exasperated by a VLC design choice.
Not sure why you'd need the slower loadstring() hacks to compile additional chunks of code, since besides using Lua functions directly / inline, you could !CommandMeasure any kind of global code separated by ; to do the same thing. Not to mention you can add any number of custom options to a Script measure and refer them in Lua using the SELF object. Or, you can use 'template' structures if by any chance you want to have those 'factory' measures that mass create the contents in your .inc files at load / refresh time.
From my testing like 4 years ago, Rainmeter requires a ScriptFile to be loaded in order for any !CommandMeasure to work, the file could be empty, it just has to open a file to ever initialize the environment.
I wanted other skin authors to just copy paste the MAIN .ini and be done, nothing else, if they wanna implement what I'm writing into their own suites.
My idea is just to... brace yourself... do !CommandMeasure "MyScriptMeasure" "local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';function enc(data);return ((data:gsub('.', function(x) ;local r,b='',x:byte();for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end;return r;end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x);if (#x < 6) then return '' end;local c=0;for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end;return b:sub(c+1,c+1);end)..({ '', '==', '=' })[#data%3+1]);end;function Initialize();local VLCPassword = SKIN:GetVariable("Password", "");SKIN:Bang("!SetOption", "VLCRoot", "Header", "Authorization: Basic "..enc(":"..tostring(VLCPassword)))" in order for the user, who ever modifies this, to not have to copy/use the .lua file.
For the better of humanity, I ditched this idea, if a user wants to modify this skin, just do it like a normal person, duplicate the folder and rename it lol

Statistics: Posted by Jeff — Yesterday, 8:37 pm



Viewing all articles
Browse latest Browse all 1158

Trending Articles