mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-28 07:34:13 +00:00
add and fix checks for daemon version and input data for short URI related functions
This commit is contained in:
parent
3e92986db0
commit
ee7f84d2b6
@ -808,7 +808,17 @@ function openRequestShortURIForm() {
|
|||||||
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
txtMessage: 'You can\'t short links because you are not logged in.'
|
txtMessage: 'You can\'t short links because you are not logged in.'
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (parseInt(twisterVersion) < 93500) {
|
||||||
|
alertPopup({
|
||||||
|
//txtTitle: polyglot.t(''), add some title (not 'error', please) or just KISS
|
||||||
|
txtMessage: 'You can\'t short links because twister daemon is obsolete!\n'
|
||||||
|
+ 'Version 0.9.35 or higher is required. Please keep your twister up to date.'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var uri = prompt('enter a link, watch yourself carefully'); // FIXME
|
var uri = prompt('enter a link, watch yourself carefully'); // FIXME
|
||||||
newShortURI(uri,
|
newShortURI(uri,
|
||||||
function (req, uriLong, uriShort) {
|
function (req, uriLong, uriShort) {
|
||||||
@ -852,10 +862,6 @@ function fetchShortenedURI(req) {
|
|||||||
applyShortenedURI(req, twister.URIs[req]);
|
applyShortenedURI(req, twister.URIs[req]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (parseInt(twisterVersion) < 93500) {
|
|
||||||
console.warn('can\'t fetch URI "' + req + '": daemon is obsolete, version 0.9.35 or higher is required');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
decodeShortURI(req,
|
decodeShortURI(req,
|
||||||
function (req, ret) {
|
function (req, ret) {
|
||||||
|
@ -324,6 +324,10 @@ function newRtMsg(postData, msg) {
|
|||||||
|
|
||||||
function newShortURI(uri, cbFunc, cbReq) {
|
function newShortURI(uri, cbFunc, cbReq) {
|
||||||
if (!uri || !defaultScreenName) return;
|
if (!uri || !defaultScreenName) return;
|
||||||
|
if (parseInt(twisterVersion) < 93500) {
|
||||||
|
console.warn('can\'t short URI "' + uri + '": daemon is obsolete, version 0.9.35 or higher is required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i in twister.URIs)
|
for (var i in twister.URIs)
|
||||||
if (twister.URIs[i] === uri) {
|
if (twister.URIs[i] === uri) {
|
||||||
|
@ -113,6 +113,12 @@ function dhtget(peerAlias, resource, multi, cbFunc, cbReq, timeoutArgs) {
|
|||||||
// the expanded url is returned to callback
|
// the expanded url is returned to callback
|
||||||
// null is passed to callback in case of an error
|
// null is passed to callback in case of an error
|
||||||
function decodeShortURI(locator, cbFunc, cbReq, timeoutArgs) {
|
function decodeShortURI(locator, cbFunc, cbReq, timeoutArgs) {
|
||||||
|
if (!locator) return;
|
||||||
|
if (parseInt(twisterVersion) < 93500) {
|
||||||
|
console.warn('can\'t fetch URI "' + req + '": daemon is obsolete, version 0.9.35 or higher is required');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_dhtgetPendingMap[locator]) {
|
if (_dhtgetPendingMap[locator]) {
|
||||||
_dhtgetAddPending(locator, cbFunc, cbReq);
|
_dhtgetAddPending(locator, cbFunc, cbReq);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user