Fix navigation when accessing a page results in ACCESS DENIED, enable frame_load to load new frames

This commit is contained in:
Deon George 2024-01-05 21:34:06 +11:00
parent f111a45826
commit d958cdb09d
2 changed files with 12 additions and 8 deletions

15
main.js
View File

@ -946,7 +946,7 @@ while (bbs.online) {
// If we are editing a specific frame, attempt to load it
if (next_page) {
// In case we need to fall back.
var current = so;
//var current = so;
so.get(next_page);
// If the frame doesnt exist, check that the parent frame exists in case we are creating a new one
@ -960,8 +960,8 @@ while (bbs.online) {
log(LOG_DEBUG,'- ACTION_EDIT: check index: '+JSON.stringify(so)+' ('+String.fromCharCode(next_page.index.charCodeAt(0)-1)+')');
if (so.page.name.toString() === null) {
so = current;
current = undefined;
//so = current;
//current = undefined;
// sendbaseline ERR_PAGE
so.baselineSend('ERR_NO_PARENT',false);
action = mode = null;
@ -1007,7 +1007,6 @@ while (bbs.online) {
control = [];
log(LOG_DEBUG,'- ACTION_GOTO: ['+(next_page.toString()+']'));
var current = null;
// For logged in users, we'll see if this is a mail page.
if (user.number) {
@ -1087,6 +1086,7 @@ while (bbs.online) {
}
}
var current = so.page; // If we dont have access to the page we load, we need to revert
if (next_page !== null) {
if (! so.get(next_page)) {
log(LOG_DEBUG,'- Next Page: ['+(next_page.toString()+'] doesnt exist?'));
@ -1101,7 +1101,7 @@ while (bbs.online) {
// If the user has access to the frame
if (so.page.accessible) {
if (so.page.isMember && so.page.type === FRAME_TYPE_LOGIN) {
if (so.page.isMember && (so.page.type === FRAME_TYPE_LOGIN)) {
so.baselineSend('ALREADY_MEMBER',false);
action = mode = null;
break;
@ -1112,10 +1112,13 @@ while (bbs.online) {
so.baselineSend('ACCESS_DENIED',false);
action = mode = null;
// Reset the current frame to what it was.
so = current;
so.page = current;
current = undefined;
break;
}
current = undefined;
log(LOG_DEBUG,'- ACTION_GOTO: next_page ['+JSON.stringify(next_page)+'] last history ['+JSON.stringify(history[history.length-1])+']');
// Record our history

View File

@ -36,6 +36,7 @@ if (page.get(new PageObject(frame,index))) {
page.import(file,ext);
page.save();
} else {
throw new Error('Page '+frame+index+' doesnt exist?');
} else if (['vtx','tex'].indexOf(ext) !== -1) {
page.import(file,ext);
page.save();
}