Skip to content
This repository was archived by the owner on Dec 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ This is the repository for phuzzylink in KWG .

## Deploying

Before starting the server, first install the dependencies and run the npx build tool.
Before starting the server, first install the dependencies and run the npx build tool. The CSS files are generated with `transpile.sh`. You _may_ need to install less with

`npm install less -g`

```
npm install
cd plugins
npm install
cd ..
npx emk
npx emk -f -w
sh transpile.sh
```

### Production and Development
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"name": "Blake Regalia",
"email": "blake.regalia@gmail.com"
},
"contributors": ["Bryce Mecum <mecum@nceas.ucsb.edu>", "Thomas Thelen <thelen@nceas.ucsb.edu>", "Austin Truchan <truchan@msu.edu>", "Rui Zhu <ruizhu@ucsb.edu>"],
"contributors": [
"Bryce Mecum <mecum@nceas.ucsb.edu>",
"Thomas Thelen <thelen@nceas.ucsb.edu>",
"Austin Truchan <truchan@msu.edu>",
"Rui Zhu <ruizhu@ucsb.edu>"
],
"files": [
"dist"
],
Expand All @@ -23,7 +28,7 @@
"devDependencies": {
"@graphy/core.data.factory": "^3.2.2",
"browserify": "^16.2.3",
"less": "^3.9.0",
"less": "^3.13.1",
"pug": "^2.0.3",
"pug-cli": "^1.0.0-alpha6"
},
Expand Down Expand Up @@ -53,8 +58,8 @@
"stream-to-array": "^2.3.0",
"uglify": "^0.1.5",
"uglifyify": "^4.0.5",
"webtorrent": "^1.5.8",
"wellknown": "^0.5.0",
"worker": "^0.3.12",
"webtorrent": "^1.5.8"
"worker": "^0.3.12"
}
}
16 changes: 9 additions & 7 deletions src/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ const D_URL_ENDPOINT = new url.URL(P_ENDPOINT);
// sparql
k_app.use('/sparql', proxy({
target: D_URL_ENDPOINT.origin,
// Disable checking that the request is sent over HTTPS (NGINX will take care of this)
secure: false,
pathRewrite: {
'^/sparql': D_URL_ENDPOINT.pathname,
},
Expand Down Expand Up @@ -282,7 +284,7 @@ const negotiate_feature = (d_req, d_res, f_next) => {
};
// If the subject is coming from the lite repository-switch endpoints
let endpoint = P_ENDPOINT
if (group.includes("kwgl")) {
if (s_group.includes("kwgl")) {
endpoint = P_LITE_ENDPOINT;
}
// application/rdf+xml
Expand Down Expand Up @@ -444,7 +446,7 @@ k_app.use([

// fetch specific pack
k_app.get([
'/asset/pack/:pack',
'/static/pack/:pack',
], (d_req, d_res) => {
// extract pack
let s_pack = d_req.params.pack;
Expand All @@ -455,7 +457,7 @@ k_app.get([

// fetch specific pack
k_app.get([
'/asset/context/:context',
'/static/context/:context',
], (d_req, d_res) => {
// extract context
let s_context = d_req.params.context;
Expand All @@ -472,7 +474,7 @@ k_app.get([

// fetch specific config
k_app.get([
/^\/asset\/config\/(.+)$/,
/^\/static\/config\/(.+)$/,
], (d_req, d_res) => {
// extract source
let s_source = resolve_endpoint(d_req.params[0], d_res);
Expand Down Expand Up @@ -738,7 +740,7 @@ k_app.get([

// describe plugin
k_app.get([
'/asset/plugin/:plugin',
'/static/plugin/:plugin',
], (d_req, d_res) => {
// fetch plugin name
let s_plugin = d_req.params.plugin;
Expand Down Expand Up @@ -771,7 +773,7 @@ k_app.get([
let p_asset = h_package.main.replace(/^(\/*|(\.+\/)*)*/, '');

// redirect
d_res.redirect(303, `/asset/plugin/${s_plugin}/${p_asset}`);
d_res.redirect(303, `/static/plugin/${s_plugin}/${p_asset}`);
});
},
});
Expand Down Expand Up @@ -819,7 +821,7 @@ class streamStringWrapper extends stream.Transform {

// describe plugin
k_app.get([
/^\/asset\/plugin\/([\w0-9_-]+)\/([^/].*)/,
/^\/static\/plugin\/([\w0-9_-]+)\/([^/].*)/,
], (d_req, d_res) => {
// fetch plugin name
let s_plugin = d_req.params[0];
Expand Down
12 changes: 6 additions & 6 deletions src/webapp/_scripts/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const phuzzy = require('../../main/phuzzy.js');
const querystring = require('querystring');

const R_BROWSE_SOURCE = /^\/browse\/(.+)$/;
const P_DEFAULT_PREFIXES = `${window.location.origin}/asset/context/default`;
const P_DEFAULT_PLUGIN_PACK = `${window.location.origin}/asset/pack/iospress`;
const P_DEFAULT_PREFIXES = `${window.location.origin}/static/context/default`;
const P_DEFAULT_PLUGIN_PACK = `${window.location.origin}/static/pack/iospress`;
const R_PREFIXED_NAME = /^([^:]+:.*|:.+)$/;
const R_IRI = /^<(.+)>$/;
const R_UNENCLOSED_IRI = /^\w+:\/\//;
Expand Down Expand Up @@ -215,7 +215,7 @@ function download_sources(fk_download) {
function fetch_endpoint_config(p_endpoint, fk_download) {
// wait for download
request.get({
url: '/asset/config/'+p_endpoint,
url: '/static/config/'+p_endpoint,
}, (e_req, d_res, s_body) => {
// request error
if(e_req) {
Expand Down Expand Up @@ -599,7 +599,7 @@ document.addEventListener('DOMContentLoaded', () => {
// load package
(fk_task_package) => {
request.get({
url: `/asset/plugin/${s_name}`,
url: `/static/plugin/${s_name}`,
headers: {
accept: 'application/json',
},
Expand Down Expand Up @@ -641,7 +641,7 @@ document.addEventListener('DOMContentLoaded', () => {
id: 'stylesheet_'+s_name,
rel: 'stylesheet',
type: 'text/css',
href: `/asset/plugin/${s_name}/${p_css}`,
href: `/static/plugin/${s_name}/${p_css}`,
}));
});
}
Expand All @@ -652,7 +652,7 @@ document.addEventListener('DOMContentLoaded', () => {
], () => {
// download script
request.get({
url: `/asset/plugin/${s_name}/`,
url: `/static/plugin/${s_name}/`,
headers: {
accept: 'text/javascript',
},
Expand Down
5 changes: 5 additions & 0 deletions transpile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lessc src/webapp/_styles/explore.less build/webapp/_styles/explore.css
lessc src/webapp/_styles/flexbox.less build/webapp/_styles/flexbox.css
lessc src/webapp/_styles/index.less build/webapp/_styles/index.css
lessc src/webapp/_styles/query.less build/webapp/_styles/query.css
lessc src/webapp/_styles/seed.less build/webapp/_styles/seed.css