Fix share logic
This commit is contained in:
@@ -2692,10 +2692,30 @@ function save_layout(exit) {
|
||||
var logic_JSON = JSON.stringify(globalLogicInfo)
|
||||
$.post('saveProject', { 'layout': layout_JSON, 'dataStorage': data_JSON, 'logicStorage': logic_JSON, 'projectName': globalProjectName, 'projectType': globalProjectType }, function(res) {
|
||||
if (res == 1) {
|
||||
$("#top_right_icon_3").attr('class', 'fa fa-save')
|
||||
showtext(JSLang[lang].saveSuccess)
|
||||
if (exit)
|
||||
window.location.href = 'logout'
|
||||
if(typeof globalShareKey != 'undefined')
|
||||
{
|
||||
$.post('updateShareContent', { 'shareid':globalShareKey, 'projectName': globalProjectName, 'projectLayout':layout_JSON, 'dataStorage': data_JSON, 'logicStorage': logic_JSON }, function(res) {
|
||||
if(res == 1)
|
||||
{
|
||||
$("#top_right_icon_3").attr('class', 'fa fa-save')
|
||||
showtext(JSLang[lang].saveSuccess)
|
||||
if (exit)
|
||||
window.location.href = 'logout'
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#top_right_icon_3").attr('class', 'fa fa-save')
|
||||
showtext(JSLang[lang].saveFail + res)
|
||||
}
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#top_right_icon_3").attr('class', 'fa fa-save')
|
||||
showtext(JSLang[lang].saveSuccess)
|
||||
if (exit)
|
||||
window.location.href = 'logout'
|
||||
}
|
||||
} else {
|
||||
$("#top_right_icon_3").attr('class', 'fa fa-save')
|
||||
showtext(JSLang[lang].saveFail + res)
|
||||
|
||||
@@ -1313,6 +1313,18 @@ var mixioServer = function() {
|
||||
res.redirect('/')
|
||||
})
|
||||
|
||||
app.post('/updateShareContent', function(req, res) {
|
||||
if (req.session.userName && req.body.shareid && req.body.projectName && req.body.projectLayout && req.body.dataStorage && req.body.logicStorage) {
|
||||
db.run("update `share` set projectLayout=?, dataStorage=?, logicStorage=?, projectName=? where shareid=? and userName=?", [req.body.projectLayout, req.body.dataStorage, req.body.logicStorage, req.body.projectName, req.body.shareid, req.session.userName], function(err) {
|
||||
if (err)
|
||||
console.log(err)
|
||||
else
|
||||
res.send('1')
|
||||
})
|
||||
} else
|
||||
res.redirect('/')
|
||||
})
|
||||
|
||||
app.get('/addShareKey', function(req, res) {
|
||||
var rString = randomString(6, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
||||
if (req.session.userName && req.query.projectName && req.query.projectPass) {
|
||||
|
||||
Reference in New Issue
Block a user