Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,5 @@ typings/

tmp/
.DS_Store
.metadata
.metadata
.idea
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/checkBuiltinInput.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/codemirror.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/libraries/jen3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/nordicspa.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/sparql.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/libraries/sparql2spin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/n3-editor-js.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ This system requires [NodeJS](https://nodejs.org/en/).

Clone the repository and run `npm install` in the main folder to install the NodeJs packages.

Update the `./config.js` file with your hostname, port number and locations of Eye and Cwm executables.
If you simply want to try the editor locally, you can keep the localhost http config (as long as the port number isn't in use).
Add a config file under `./config/main.js` similar to the ones already there (.e.g, `./config/local.js`)

Update the `./editor/index.html` file with the URL of the NodeJs server. If you're following the regular usage, this should simply be the editor's URL minus the `editor` part (e.g., `http://127.0.0.1:3002/n3` for `http://127.0.0.1:3002/n3/editor`.

If you want to use the server's "link-shortening" service (to more easily share code samples; see usage), you'll need to have a mysql v.8+ database running, with the credentials filled into `config.js`. Also, you'll have to import the `db.sql` file. If you don't want to use this service, you can simply comment out the call to `n3.link` (see `editor/index.html`) and use the full url (`link` variable) for the generated link.
If you want to use the server's "link-shortening" service (to more easily share code samples; see usage), you'll need to have a mysql v.8+ database running, with the credentials filled into `./config/[file].js`. Also, you'll have to import the `db.sql` file. If you don't want to use this service, you can simply comment out the call to `n3.link` (see `editor/index.html`) and use the full url (`link` variable) for the generated link.

Run `./node app.js` to start the server.
The server will be accessible at `http://<hostname>:<port>/n3`, and the editor at `http://<hostname>:<port>/n3/editor`.
Expand Down
17 changes: 13 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const bodyParser = require('body-parser')
const cors = require('cors')
const path = require('path')

const { config } = require('./config.js')
const { config } = require('./config/main.js')
const tmp = require('./lib/tmp.js')
const eye = require('./lib/eye/eye.js')
// const cwm = require('./lib/cwm/cwm.js')
Expand All @@ -14,6 +14,9 @@ const spin3 = require('./lib/spin3/spin3.js')
const { generateLink, resolveLink } = require('./lib/gen_link.js')
const { checkBuiltinInput } = require('./lib/check_builtin_input.js')

// console.log(process);
// console.log(config);

const app = express()
app.use(cors())
app.use(bodyParser.json())
Expand All @@ -22,17 +25,23 @@ app.use(bodyParser.urlencoded({ extended: true }))
app.use('/n3/editor/s/*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/index.html"));
});
app.use('/n3/out', express.static("out"));
app.use('/n3/editor/out', express.static("out"));
app.use('/n3/editor', express.static(path.join(__dirname, "editor")));
app.use('/n3/config', express.static("config"));
app.use('/n3/out', express.static("out"));
app.use('/n3/spin3*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/spin3.html"));
});
app.use('/n3/sspin3*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/sspin3.html"));
});
// app.use('/n3/yspin3*', (req, res) => {
// res.sendFile(path.join(__dirname, "editor/yspin3.html"));
// });
app.use('/n3/sparql*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/sparql.html"));
});
app.use('/n3/editor', express.static(path.join(__dirname, "editor")));
app.use('/n3/lib/eyebrow', express.static(path.join(__dirname, "lib/eyebrow")));
app.use('/n3/config.js', express.static(path.join(__dirname, 'config.js')));

app.get('/n3', (request, response) => {
console.log('GET /')
Expand Down
7 changes: 1 addition & 6 deletions config.js → config/heroku.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,4 @@ config = {
},

path: "/Users/wvw/git/n3/n3-editor-js" // ??
}

if (typeof exports === 'object' && typeof module === 'object')
module.exports = {
config
};
}
7 changes: 1 addition & 6 deletions config_local.js → config/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,4 @@ config = {
},

path: "/Users/wvw/git/n3/n3-editor-js"
}

if (typeof exports === 'object' && typeof module === 'object')
module.exports = {
config
};
}
32 changes: 32 additions & 0 deletions config/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// heroku
if (typeof process === 'object') {
let name;
if (process.env.HOME && process.env.HOME == '/app') {
name = "heroku.js";
} else {
name = "local.js";
}

const location = `./${name}`;
require(location);

if (typeof exports === 'object' && typeof module === 'object')
module.exports = {
config
};

} else {
let name;
if (window.location.hostname === 'localhost') {
name = "local.js";
} else {
name = "heroku.js";
}

const location = `/n3/config/${name}`;
$.ajax({ async: false, url: location, dataType: 'script' })
.done(function (script, textStatus) { })
.fail(function (jqxhr, settings, exception) {
console.error(`Error getting config at "${location}": ${exception}`);
});
}
7 changes: 1 addition & 6 deletions config_ppr.js → config/ppr.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,4 @@ config = {
},

path: "/home/woensel/projects/n3-editor-js"
}

if (typeof exports === 'object' && typeof module === 'object')
module.exports = {
config
};
}
53 changes: 0 additions & 53 deletions config_heroku.js

This file was deleted.

2 changes: 1 addition & 1 deletion editor/codemirror-5.54.0/lib/codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 300px;
height: 327px;
color: black;
direction: ltr;
}
Expand Down
Loading