mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-01 03:20:08 +00:00
fixed root page access issues...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fe18674f50
commit
b28191a79f
@ -351,11 +351,11 @@ module = {
|
|||||||
: path
|
: path
|
||||||
path = this.normalize(path, 'string')
|
path = this.normalize(path, 'string')
|
||||||
var name = path == '/' ?
|
var name = path == '/' ?
|
||||||
this.ROOT_PAGE
|
['', this.ROOT_PAGE]
|
||||||
: this.basename(path)
|
: [this.basename(path)]
|
||||||
return name == '' ?
|
return name == '' ?
|
||||||
this.ALTERNATIVE_PAGES.slice()
|
this.ALTERNATIVE_PAGES.slice()
|
||||||
: [name, ...this.ALTERNATIVE_PAGES] },
|
: [...name, ...this.ALTERNATIVE_PAGES] },
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -239,39 +239,28 @@ module.BaseStore = {
|
|||||||
return path in this.data
|
return path in this.data
|
||||||
&& path },
|
&& path },
|
||||||
exists: async function(path){
|
exists: async function(path){
|
||||||
// XXX SANITIZE...
|
var {path, args} =
|
||||||
path = pwpath.sanitize(path, 'string')
|
pwpath.splitArgs(
|
||||||
/*/
|
pwpath.sanitize(path, 'string'))
|
||||||
path = pwpath.normalize(path, 'string')
|
|
||||||
//*/
|
// NOTE: all paths at this point and in store are
|
||||||
var {path, args} = pwpath.splitArgs(path)
|
// absolute, so we check both with the leading
|
||||||
var res = (await this.__exists__(path))
|
// '/' and without it to make things a bit more
|
||||||
// NOTE: all paths at this point and in store are
|
// relaxed and return the actual matching path...
|
||||||
// absolute, so we check both with the leading
|
var res = await this.__exists__(path)
|
||||||
// '/' and without it to make things a bit more
|
// NOTE: res can be '' and thus we can't simply chain via || here...
|
||||||
// relaxed and return the actual matching path...
|
typeof(res) != 'string'
|
||||||
// XXX SANITIZE...
|
&& (res = await this.__exists__('/'+ path))
|
||||||
|| (await this.__exists__('/'+ path))
|
|
||||||
/*/
|
// delegate to .next...
|
||||||
|| (await this.__exists__(
|
typeof(res) != 'string'
|
||||||
path[0] == '/' ?
|
&& (this.next || {}).__exists__
|
||||||
path.slice(1)
|
&& (res = await this.next.__exists__(path))
|
||||||
: ('/'+ path)))
|
typeof(res) != 'string'
|
||||||
//*/
|
&& (this.next || {}).__exists__
|
||||||
// delegate to .next...
|
&& (res = await this.next.__exists__('/'+path))
|
||||||
|| ((this.next || {}).__exists__
|
|
||||||
&& (await this.next.__exists__(path)
|
if(typeof(res) != 'string'){
|
||||||
// XXX SANITIZE...
|
|
||||||
|| await this.next.__exists__('/'+path)))
|
|
||||||
/*/
|
|
||||||
|| await this.next.__exists__(
|
|
||||||
path[0] == '/' ?
|
|
||||||
path.slice(1)
|
|
||||||
: ('/'+ path))))
|
|
||||||
//*/
|
|
||||||
// normalize the output...
|
|
||||||
|| false
|
|
||||||
if(!res){
|
|
||||||
return false }
|
return false }
|
||||||
return pwpath.joinArgs(res, args) },
|
return pwpath.joinArgs(res, args) },
|
||||||
// find the closest existing alternative path...
|
// find the closest existing alternative path...
|
||||||
@ -555,7 +544,7 @@ module.BaseStore = {
|
|||||||
return this }
|
return this }
|
||||||
path = pwpath.splitArgs(path).path
|
path = pwpath.splitArgs(path).path
|
||||||
path = await this.exists(path)
|
path = await this.exists(path)
|
||||||
if(path){
|
if(typeof(path) == 'string'){
|
||||||
await this.__delete__(path)
|
await this.__delete__(path)
|
||||||
// XXX CACHED
|
// XXX CACHED
|
||||||
this.__cache_remove(path)
|
this.__cache_remove(path)
|
||||||
@ -743,7 +732,7 @@ module.MetaStore = {
|
|||||||
null,
|
null,
|
||||||
function(res, path){
|
function(res, path){
|
||||||
var s = this.substore(path)
|
var s = this.substore(path)
|
||||||
return res == false ?
|
return typeof(res) != 'string' ?
|
||||||
(this.next ?
|
(this.next ?
|
||||||
this.next.exists(path)
|
this.next.exists(path)
|
||||||
: res)
|
: res)
|
||||||
@ -865,8 +854,8 @@ module.CachedStore = {
|
|||||||
|
|
||||||
var Store =
|
var Store =
|
||||||
module.Store =
|
module.Store =
|
||||||
//MetaStore
|
MetaStore
|
||||||
CachedStore
|
//CachedStore
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,16 @@
|
|||||||
* - images
|
* - images
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* XXX BUG: can't .get(..) data from substore root...
|
||||||
* XXX IndexedDB: after editing a page for some reason we do not see the
|
* XXX IndexedDB: after editing a page for some reason we do not see the
|
||||||
* final version until a full refresh -- cache???
|
* final version until a full refresh -- cache???
|
||||||
|
* ...this seems to disappeared after moving external stores
|
||||||
|
* from / to /Stores...
|
||||||
* XXX Chrome started spamming CORS error:
|
* XXX Chrome started spamming CORS error:
|
||||||
* Access to manifest at 'file:///L:/work/pWiki/manifest.json'
|
* Access to manifest at 'file:///L:/work/pWiki/manifest.json'
|
||||||
* from origin 'null' ...
|
* from origin 'null' ...
|
||||||
* not sure why...
|
* not sure why...
|
||||||
* XXX test: can we store the file handler with permissions in a ServiceWorker??
|
* XXX test: can we store the file handler with permissions in a ServiceWorker??
|
||||||
* XXX store: add an indexedDB backend -- save on serialization...
|
|
||||||
* - idb-keyval
|
|
||||||
* - native???
|
|
||||||
* XXX might be a good idea to wrap the wysiwig editor into a separate template
|
* XXX might be a good idea to wrap the wysiwig editor into a separate template
|
||||||
* and use it in the main edit template to make it user-selectable...
|
* and use it in the main edit template to make it user-selectable...
|
||||||
* XXX generalize html/dom api...
|
* XXX generalize html/dom api...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user