Skip to content

Commit

Permalink
make it work on localhost (for testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
gka committed Oct 14, 2017
1 parent 01e738e commit db82a11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/embed.js

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

4 changes: 3 additions & 1 deletion src/embed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import comments_tpl from './comments.jst.html';
const endpoint = `${host}/comments/${slug}`;
const target = opts.schnackTarget;

document.domain = url.host.split('.').slice(1).join('.');
if (url.hostname != 'localhost') {
document.domain = url.host.split('.').slice(1).join('.');
}

function refresh() {

Expand Down
4 changes: 2 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ dbHandler.init()
.catch(err => console.error(err.message));

const schnack_url = url.parse(config.schnack_host);
if (!schnack_url.host) {
if (!schnack_url.hostname) {
console.error(`"${config.schnack_host}" doesn't appear to be a proper URL. Did you forget "http://"?`);
process.exit(-1);
}
const schnack_domain = schnack_url.host.split('.').slice(1).join('.');
const schnack_domain = schnack_url.hostname.split('.').slice(1).join('.');

function run(db) {
app.use(cors({
Expand Down

0 comments on commit db82a11

Please sign in to comment.