mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-06 15:30:26 +00:00
Find/Replace 4spaces for Tab4, to make consistent with guidelines
This commit is contained in:
parent
e59eba9086
commit
f82425a20d
@ -317,37 +317,37 @@ Server.prototype.addAuthenticator = function(AuthenticatorClass) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.findMatchingRoute = function(request,state) {
|
Server.prototype.findMatchingRoute = function(request,state) {
|
||||||
for(var t=0; t<this.routes.length; t++) {
|
for(var t=0; t<this.routes.length; t++) {
|
||||||
var potentialRoute = this.routes[t],
|
var potentialRoute = this.routes[t],
|
||||||
pathRegExp = potentialRoute.path,
|
pathRegExp = potentialRoute.path,
|
||||||
pathname = state.urlInfo.pathname,
|
pathname = state.urlInfo.pathname,
|
||||||
match;
|
match;
|
||||||
if(state.pathPrefix) {
|
if(state.pathPrefix) {
|
||||||
if(pathname.substr(0,state.pathPrefix.length) === state.pathPrefix) {
|
if(pathname.substr(0,state.pathPrefix.length) === state.pathPrefix) {
|
||||||
pathname = pathname.substr(state.pathPrefix.length) || "/";
|
pathname = pathname.substr(state.pathPrefix.length) || "/";
|
||||||
match = potentialRoute.path.exec(pathname);
|
match = potentialRoute.path.exec(pathname);
|
||||||
} else {
|
} else {
|
||||||
match = false;
|
match = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match = potentialRoute.path.exec(pathname);
|
match = potentialRoute.path.exec(pathname);
|
||||||
}
|
}
|
||||||
// Allow POST as a synonym for PUT and DELETE because HTML doesn't allow these methods in forms
|
// Allow POST as a synonym for PUT and DELETE because HTML doesn't allow these methods in forms
|
||||||
if(match && (
|
if(match && (
|
||||||
request.method === potentialRoute.method ||
|
request.method === potentialRoute.method ||
|
||||||
(request.method === "POST" && (
|
(request.method === "POST" && (
|
||||||
potentialRoute.method === "PUT" ||
|
potentialRoute.method === "PUT" ||
|
||||||
potentialRoute.method === "DELETE"
|
potentialRoute.method === "DELETE"
|
||||||
))
|
))
|
||||||
)) {
|
)) {
|
||||||
state.params = [];
|
state.params = [];
|
||||||
for(var p=1; p<match.length; p++) {
|
for(var p=1; p<match.length; p++) {
|
||||||
state.params.push(match[p]);
|
state.params.push(match[p]);
|
||||||
}
|
}
|
||||||
return potentialRoute;
|
return potentialRoute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.methodMappings = {
|
Server.prototype.methodMappings = {
|
||||||
|
@ -23,26 +23,26 @@ exports.useACL = true;
|
|||||||
exports.entityName = "bag"
|
exports.entityName = "bag"
|
||||||
|
|
||||||
exports.handler = function(request,response,state) {
|
exports.handler = function(request,response,state) {
|
||||||
const bagName = state.params[0];
|
const bagName = state.params[0];
|
||||||
if(bagName) {
|
if(bagName) {
|
||||||
const result = $tw.mws.store.deleteBag(bagName);
|
const result = $tw.mws.store.deleteBag(bagName);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
state.sendResponse(302,{
|
state.sendResponse(302,{
|
||||||
"Content-Type": "text/plain",
|
"Content-Type": "text/plain",
|
||||||
"Location": "/"
|
"Location": "/"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
result.message,
|
result.message,
|
||||||
"utf8");
|
"utf8");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
@ -23,26 +23,26 @@ exports.useACL = true;
|
|||||||
exports.entityName = "recipe"
|
exports.entityName = "recipe"
|
||||||
|
|
||||||
exports.handler = function(request,response,state) {
|
exports.handler = function(request,response,state) {
|
||||||
const recipeName = state.params[0];
|
const recipeName = state.params[0];
|
||||||
if(recipeName) {
|
if(recipeName) {
|
||||||
const result = $tw.mws.store.deleteRecipe(recipeName);
|
const result = $tw.mws.store.deleteRecipe(recipeName);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
state.sendResponse(302,{
|
state.sendResponse(302,{
|
||||||
"Content-Type": "text/plain",
|
"Content-Type": "text/plain",
|
||||||
"Location": "/"
|
"Location": "/"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
result.message,
|
result.message,
|
||||||
"utf8");
|
"utf8");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
@ -30,25 +30,25 @@ exports.useACL = true;
|
|||||||
exports.entityName = "bag"
|
exports.entityName = "bag"
|
||||||
|
|
||||||
exports.handler = function(request,response,state) {
|
exports.handler = function(request,response,state) {
|
||||||
if(state.data.bag_name) {
|
if(state.data.bag_name) {
|
||||||
const result = $tw.mws.store.createBag(state.data.bag_name,state.data.description);
|
const result = $tw.mws.store.createBag(state.data.bag_name,state.data.description);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
state.sendResponse(302,{
|
state.sendResponse(302,{
|
||||||
"Content-Type": "text/plain",
|
"Content-Type": "text/plain",
|
||||||
"Location": "/"
|
"Location": "/"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
result.message,
|
result.message,
|
||||||
"utf8");
|
"utf8");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
@ -30,31 +30,31 @@ exports.useACL = true;
|
|||||||
exports.entityName = "recipe"
|
exports.entityName = "recipe"
|
||||||
|
|
||||||
exports.handler = function(request,response,state) {
|
exports.handler = function(request,response,state) {
|
||||||
var server = state.server,
|
var server = state.server,
|
||||||
sqlTiddlerDatabase = server.sqlTiddlerDatabase;
|
sqlTiddlerDatabase = server.sqlTiddlerDatabase;
|
||||||
|
|
||||||
if(state.data.recipe_name && state.data.bag_names) {
|
if(state.data.recipe_name && state.data.bag_names) {
|
||||||
const result = $tw.mws.store.createRecipe(state.data.recipe_name,$tw.utils.parseStringArray(state.data.bag_names),state.data.description);
|
const result = $tw.mws.store.createRecipe(state.data.recipe_name,$tw.utils.parseStringArray(state.data.bag_names),state.data.description);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
if(state.authenticatedUser) {
|
if(state.authenticatedUser) {
|
||||||
sqlTiddlerDatabase.assignRecipeToUser(state.data.recipe_name,state.authenticatedUser.user_id);
|
sqlTiddlerDatabase.assignRecipeToUser(state.data.recipe_name,state.authenticatedUser.user_id);
|
||||||
}
|
}
|
||||||
state.sendResponse(302,{
|
state.sendResponse(302,{
|
||||||
"Content-Type": "text/plain",
|
"Content-Type": "text/plain",
|
||||||
"Location": "/"
|
"Location": "/"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
},
|
},
|
||||||
result.message,
|
result.message,
|
||||||
"utf8");
|
"utf8");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.sendResponse(400,{
|
state.sendResponse(400,{
|
||||||
"Content-Type": "text/plain"
|
"Content-Type": "text/plain"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
@ -88,10 +88,10 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/get-index
|
|||||||
<$text text={{{ [<recipe-info>jsonget[description]] }}}/>
|
<$text text={{{ [<recipe-info>jsonget[description]] }}}/>
|
||||||
</div>
|
</div>
|
||||||
<div class="mws-wiki-card-actions">
|
<div class="mws-wiki-card-actions">
|
||||||
<form action={{{ [<recipe-info>jsonget[recipe_name]addprefix[/recipes/]] }}} method="post" onsubmit="return confirmRecipeDelete(this)">
|
<form action={{{ [<recipe-info>jsonget[recipe_name]addprefix[/recipes/]] }}} method="post" onsubmit="return confirmRecipeDelete(this)">
|
||||||
<input type="hidden" name="_method" value="DELETE"/>
|
<input type="hidden" name="_method" value="DELETE"/>
|
||||||
<button type="submit" class="mws-delete-button">Delete Recipe</button>
|
<button type="submit" class="mws-delete-button">Delete Recipe</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -133,19 +133,19 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/get-index
|
|||||||
<ul class="mws-vertical-list">
|
<ul class="mws-vertical-list">
|
||||||
<$list filter="[<bag-list>jsonindexes[]] :filter[<bag-list>jsonget<currentTiddler>,[bag_name].hide.system[]] :sort[<bag-list>jsonget<currentTiddler>,[bag_name]]" variable="bag-index" counter="counter">
|
<$list filter="[<bag-list>jsonindexes[]] :filter[<bag-list>jsonget<currentTiddler>,[bag_name].hide.system[]] :sort[<bag-list>jsonget<currentTiddler>,[bag_name]]" variable="bag-index" counter="counter">
|
||||||
<li class="mws-wiki-card">
|
<li class="mws-wiki-card">
|
||||||
<$let
|
<$let
|
||||||
bag-info={{{ [<bag-list>jsonextract<bag-index>] }}}
|
bag-info={{{ [<bag-list>jsonextract<bag-index>] }}}
|
||||||
bag-name={{{ [<bag-info>jsonget[bag_name]] }}}
|
bag-name={{{ [<bag-info>jsonget[bag_name]] }}}
|
||||||
>
|
>
|
||||||
<$transclude $variable="bagPill"/>
|
<$transclude $variable="bagPill"/>
|
||||||
<$text text={{{ [<bag-info>jsonget[description]] }}}/>
|
<$text text={{{ [<bag-info>jsonget[description]] }}}/>
|
||||||
<div class="mws-wiki-card-actions">
|
<div class="mws-wiki-card-actions">
|
||||||
<form action={{{ [<bag-info>jsonget[bag_name]addprefix[/bags/]] }}} method="post" onsubmit="return confirmBagDelete(this)">
|
<form action={{{ [<bag-info>jsonget[bag_name]addprefix[/bags/]] }}} method="post" onsubmit="return confirmBagDelete(this)">
|
||||||
<input type="hidden" name="_method" value="DELETE"/>
|
<input type="hidden" name="_method" value="DELETE"/>
|
||||||
<button type="submit" class="mws-delete-button">Delete Bag</button>
|
<button type="submit" class="mws-delete-button">Delete Bag</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</$let>
|
</$let>
|
||||||
</li>
|
</li>
|
||||||
</$list>
|
</$list>
|
||||||
</ul>
|
</ul>
|
||||||
@ -254,23 +254,23 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/get-index
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mws-delete-button {
|
.mws-delete-button {
|
||||||
background-color: #f44336;
|
background-color: #f44336;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-delete-button:hover {
|
.mws-delete-button:hover {
|
||||||
background-color: #d32f2f;
|
background-color: #d32f2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-wiki-card-actions {
|
.mws-wiki-card-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,34 +353,34 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/get-index
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mws-config-button:hover {
|
.mws-config-button:hover {
|
||||||
background-color: #45a049;
|
background-color: #45a049;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-modal-content {
|
.mws-modal-content {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-modal-section {
|
.mws-modal-section {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-modal-buttons {
|
.mws-modal-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-modal-button-primary {
|
.mws-modal-button-primary {
|
||||||
background-color: #4CAF50;
|
background-color: #4CAF50;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mws-modal-button-primary:hover {
|
.mws-modal-button-primary:hover {
|
||||||
background-color: #45a049;
|
background-color: #45a049;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user