Skip to content

Commit 3e935f4

Browse files
committed
Moved code sharing on official route
1 parent 67dbc13 commit 3e935f4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

routes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ module.exports = (app) => {
4242
}
4343
});
4444

45-
app.get('/code',(req,res) => { res.render("editor"); });
45+
/*app.get('/code',(req,res) => { res.render("editor"); });
4646
4747
app.get('/code/:id', (req, res)=>{
4848
res.render("editor", {
4949
id: req.params.id
5050
});
51-
});
51+
});*/
5252

53-
app.get('/nicecode', (req, res) => {
53+
app.get('/code', (req, res) => {
5454
res.render("editor", {id: -1});
5555
});
56-
app.get('/nicecode/:id', (req, res) => {
56+
app.get('/code/:id', (req, res) => {
5757
res.render("editor", {id: req.params.id});
5858
});
5959

server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ io.on('connection', (socket) => {
239239
console.log("A trimis");
240240
socket.emit('editor_source', dbData);
241241
}
242-
else socket.emit('editor_source', {code: 'There is no source code saved with this id'});
242+
else socket.emit('editor_source', {code: '//There is no source code saved with this id'});
243243
}
244-
else socket.emit('editor_source', {code: 'There is no source code saved with this id'});
244+
else socket.emit('editor_source', {code: '//There is no source code saved with this id'});
245245
});
246246
});
247247

static/scripts/main_logic.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ function getEditorInstanceFromServer() {
3131
function populateEditorInstance(data) {
3232
console.log(JSON.stringify(data));
3333
editor.setValue(data.code, 1);
34+
if (data.breakpoints)
3435
for (var i = 0; i < data.breakpoints.length; i++) {
3536
var line = data.breakpoints[i].line;
3637
toggleBreakpoint(line-1);
3738
Global.breakpointsMap[line] = new BreakpointData(line, data.breakpoints[i].temporary,
3839
data.breakpoints[i].condition);
3940
}
4041
var newData = [];
42+
if (data.watches)
4143
for (var i = 0; i < data.watches.length; i++) {
4244
var wtext = data.watches[i].expr;
4345
addWithBackup({text: wtext});

0 commit comments

Comments
 (0)