Cross-Platform PowerShell framework that allows you to host REST APIs, Web Sites, and TCP/SMTP Servers
Badgerati on develop
fix for choco packer (compare)
Badgerati on gh-pages
v2.8.0 docs (compare)
Badgerati on v2.8.0
Badgerati on master
add workflows for auto-assignin… Merge pull request #1027 from B… helps if you add the action ver… and 71 more (compare)
Hi @Badgerati,
i have a problem with UserFile-Authentication. I used the following code:
Start-PodeServer {
Add-PodeEndpoint -Address localhost -Port 80 -Protocol Http
Enable-PodeSessionMiddleware -Duration (10*60) -Extend
New-PodeAuthScheme -Form | Add-PodeAuthUserFile -Name 'Login' -Groups @("Admin","Developer")
Use-PodewebTemplates -Title 'Login Example'
Set-PodeWebLoginPage -Authentication Login
}
and the following users.json in the root of the Script ( SHA256-Hash of Passw0rd):
[
{
"Name": "hans",
"Username": "hans",
"Email": "hans.wurst@demo.com",
"Password": "AB38EADAEB746599F2C1EE90F8267F31F467347462764A24D71AC1843EE77FE3",
"Groups": [
"Admin",
"Developer"
],
"Metadata": {
"Created": "2022-01-05"
}
}
]
But I always get Access denied. I also tried HMAC SHA256, but to no avail. Can you give me hint what is going south here?
Hey @hvoges,
How are you generating the SHA256 of "Passw0rd"? When I do it I get: qzjq2ut0ZZnywe6Q+CZ/MfRnNHRidkok1xrBhD7nf+M=
, using:
$password = 'Passw0rd'
$crypto = [System.Security.Cryptography.SHA256]::Create()
[System.Convert]::ToBase64String($crypto.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($password)))
Hey @Badgerati
Not really a Pode.Web issue but thought you might have a answer.
I've create a simple Web page using Pode.Web and it is working as expected. With FireFox, I then save the Web page as 'index.html' using the option 'Web Page Complete'.
When the index.html file is opened with a Firefox, it appears to not be finding the css files and just renders the raw html content only.
Any thoughts on how to get it to render in the same manner as when running the service.ps1?
Hey @cadayton_gitlab, I'm not too sure to be honest! Looking at Firefox's docs it should be saving the html, along will all the css/js at the same path. I followed https://support.mozilla.org/en-US/kb/how-save-web-page and saved the ./basic.ps1
in examples, and then opened the index.htm
saved. For me it loaded everything, but it looked a little weird.
It seems as though it only saves normal images, js and css; so js/css maps and fonts are a no-show it looks like 🤔.
I found opening the 'index.html' file with the browse sort of worked but missing a couple of icons too. But if I browse to the 'index.html' location, I get just the raw html output.
I'm just trying to create a static webpage and hosting it on IPFS. Using either Brave or a browser with IPFS Companion installed, the following IPNS link should work as an example of what I'm up to.
https://ipfs.io/ipns/k51qzi5uqu5dlc0pztfwwd8g4hj8up0j2vnam1fxr7866psrl15zzygp5rol8d/
I had the same with the icons, the "complete" doesn't save everything - like fonts, maps, etc.
I managed to get it "working" just now by saving the single HTML page. Then:
/pode.web/
references to pode.web/
pode.web
folderTemplates/Public
path. Copy all folders (images, libs, etc.) within the Templates/Public
folder into the pode.web
folder aboveThat should let everything render when browsed to. I've just been opening the html file by double-clicking it, but if you get a plain style again, check the Developer Console in the browser for errors :)
I finally figured out the issue that I was encountering which boiled down to how the path is specified for 'href' to the .css and .js files. If I'm hosting from Keybase in a given directory path, the directory path needs to proceed, the 'index_files' directory. I.E. "<dir path>/index_files/..".
For an example see: https://jabless.keybase.pub/UnitedWeeStand
The same was true when hosting from IPFS and the html is Windows based. But if the html was being hosted from Linux using IPFS, I had to remove "dir_path" reference.
For an example see: https://ipfs.io/ipns/k51qzi5uqu5dhgvz0udvoqbsh51e0wvfmpr4teyoqodcfq7zxj9tjywwdhn5ee/