demo s3 edit

This commit is contained in:
Quentin 2022-12-04 17:11:31 +01:00
parent 900961be9b
commit 6296997169
Signed by: quentin
GPG key ID: E9602264D639FF68
5 changed files with 51 additions and 1 deletions

50
demo/edit/index.html Normal file
View file

@ -0,0 +1,50 @@
<!doctype html>
<html>
<head>
<title>Small web IDE</title>
<meta charset="utf-8"/>
</head>
<body>
<h1>Small web IDE</h1>
<script src="https://unpkg.com/aws4-tiny@1.0.0/dist/aws4.js"></script>
<script>
let aki = localStorage.getItem('accessKeyId');
if (aki === null) {
aki = window.prompt("What is your Garage Access Key ID?");
localStorage.setItem('accessKeyId', aki);
}
let sak = localStorage.getItem('secretAccessKey');
if (sak === null) {
sak = window.prompt("What is you Garage Secret Access Key?");
localStorage.setItem("secretAccessKey", sak);
}
const credentials = {
accessKeyId: aki,
secretAccessKey: sak,
};
const opts = {
region: 'garage',
service: 's3',
host: 'garage.deuxfleurs.fr',
path: '/quentin.dufour.io/?list-type=2',
headers: {
'x-amz-content-sha256': 'UNSIGNED-PAYLOAD',
},
};
const req = aws4.sign(opts, credentials);
console.log(req)
async function ListObjectsV2() {
const res = await fetch('https://garage.deuxfleurs.fr/quentin.dufour.io/?list-type=2', req);
const body = await res.text()
console.log("body raw", body)
const objList = new window.DOMParser().parseFromString(body, "text/xml")
console.log("parsed body", objList)
}
ListObjectsV2()
</script>
</body>
</html>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/feed.xsl" type="text/xsl"?>
<?xml-stylesheet href="./feed.xsl" type="text/xsl"?>
<!-- https://support.google.com/podcast-publishers/answer/9889544?hl=fr -->
<rss version="2.0"