Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to CSS V7 #3

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions copy-pods-to-css.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node --no-warnings
#!/usr/bin/env node
// #!/usr/bin/env node --no-warnings
// ©2023 Ruben Verborgh – MIT License
// 2024-11 Alain Bourgeois updated to CSS V7

import assert from 'node:assert';
import { resolve } from 'node:path';
Expand Down Expand Up @@ -123,7 +125,7 @@ async function updateAccount(account, internalPath) {
checks.read = true;

// Update the password section
const passwordSections = Object.values(accountConfig['**password**']);
const passwordSections = Object.values(accountConfig['payload']['**password**']);
assert.equal(passwordSections.length, 1);
assert(account.hashedPassword.startsWith(passwordHashStart));
assert(passwordSections[0].password.startsWith(passwordHashStart));
Expand All @@ -132,7 +134,7 @@ async function updateAccount(account, internalPath) {

// Update the WebID section
if (account.webId) {
const webIdSections = Object.values(accountConfig['**webIdLink**']);
const webIdSections = Object.values(accountConfig['payload']['**webIdLink**']);
assert.equal(webIdSections.length, 1);
assert(webIdSections[0].webId.startsWith('http'));
assert(account.webId.startsWith('http'));
Expand Down Expand Up @@ -196,7 +198,7 @@ async function testPod({ username }, cssUrl) {
async function getAccountControls(cssUrl) {
try {
const body = await cssApiGet(new URL('.account/', cssUrl));
assert.equal(body.version, '0.5', 'Unsupported CSS account API');
// assert.equal(body.version, '0.5', 'Unsupported CSS account API');
return body.controls;
}
catch (cause) {
Expand Down Expand Up @@ -225,7 +227,7 @@ async function cssApiFetch(url, options = {}, authorization = '') {
headers: {
...options.headers,
accept: 'application/json',
authorization: `CSS-Account-Cookie ${authorization}`,
authorization: `CSS-Account-Token ${authorization}`,
},
});
const json = await response.json();
Expand Down