Skip to content

Commit 9e74c0c

Browse files
committed
chore(viewer): local2pod script
1 parent 0c44085 commit 9e74c0c

File tree

17 files changed

+1976
-12
lines changed

17 files changed

+1976
-12
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<title>Solid Resources Catalog</title>
77
<script type="module" src='https://cdn.jsdelivr.net/npm/mashlib@latest/dist/mashlib.min.js'></script>
88
<!-- <script type="module" src='./node_modules/mashlib/dist/mashlib.min.js'></script> -->
9-
<link rel="stylesheet" type="text/css" href="./pages/viewer.css">
10-
<link rel="stylesheet" type="text/css" href="./pages/forms.css">
9+
<link rel="stylesheet" type="text/css" href="./viewer/viewer.css">
10+
<link rel="stylesheet" type="text/css" href="./viewer/forms.css">
1111
<link rel="icon" href="https://solidproject.org/assets/img/solid-emblem.svg" type="image/svg+xml">
1212
<meta name="thumbnail" content="https://solidproject.org/assets/img/solid-emblem.svg">
1313
</head>
@@ -63,7 +63,7 @@ <h1 style="font-size:1.4em !important">Solid Resources Catalog</h1>
6363
var sh;
6464
</script>
6565
<script type="module">
66-
import {viewer,showSubtypes} from './scripts/viewer.js';
66+
import {viewer,showSubtypes} from './viewer/viewer.js';
6767
document.addEventListener('DOMContentLoaded', async () => {
6868
sh = showSubtypes;
6969
await viewer();

local2pod.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { SolidNodeClient } from "solid-node-client";
2+
const client = new SolidNodeClient;
3+
4+
async function local2pod(){
5+
try {
6+
await client.login();
7+
}
8+
catch(e){ console.log(e); }
9+
for(let file of files){
10+
const from = `file:///home/jeff/solid/catalog/${file}`;
11+
const to = `https://solidproject.solidcommunity.net/catalog/${file}`;
12+
try {
13+
const getResponse = await client.fetch(from);
14+
const content = await getResponse.text();
15+
const contentType = getResponse.headers.get('Content-type');
16+
const putResponse = await client.fetch( to, {
17+
method:"PUT",
18+
body:content,
19+
headers:{"content-type":contentType}
20+
});
21+
console.log(putResponse.status,to)
22+
}
23+
catch(e){ console.log(e); }
24+
}
25+
}
26+
27+
const files = [
28+
'index.html',
29+
'catalog-data.ttl',
30+
'catalog-skos.ttl',
31+
'catalog-shacl.ttl',
32+
'assets/logo.svg',
33+
'viewer/form.js',
34+
'viewer/forms.css',
35+
'viewer/makeTOC.js',
36+
'viewer/page-content.js',
37+
'viewer/pages.js',
38+
'viewer/showRecord.js',
39+
'viewer/utils.js',
40+
'viewer/viewer.css',
41+
'viewer/viewer.html',
42+
'viewer/viewer.js',
43+
];
44+
45+
local2pod();
46+

migrations/webid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Store, DataFactory } from 'n3'
99

1010
const __filename = fileURLToPath(import.meta.url);
1111
const __dirname = dirname(__filename);
12-
const filePath = join(__dirname, '../catalog-data.ttl');
12+
const filePath = join(__dirname, '../catlog-data.ttl');
1313
const ex = createVocabulary('http://example.org#', 'webid')
1414

1515
function changeSubject(quad, subject) {

0 commit comments

Comments
 (0)