From d16c4b294fd67dcc50ec3034708f69a475d99181 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Fri, 25 Jun 2021 15:38:52 +0200 Subject: [PATCH] 0.0.14 Signed-off-by: Julien Veyssier --- .gitignore | 1 + appinfo/database.xml | 125 ----------------- appinfo/info.xml | 4 +- js/gpxedit.js | 49 ++++--- .../Version000014Date20210625132243.php | 128 ++++++++++++++++++ 5 files changed, 161 insertions(+), 146 deletions(-) create mode 100644 .gitignore delete mode 100644 appinfo/database.xml create mode 100644 lib/Migration/Version000014Date20210625132243.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/appinfo/database.xml b/appinfo/database.xml deleted file mode 100644 index 71a37ee..0000000 --- a/appinfo/database.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - *dbname* - true - false - utf8 - - *dbprefix*gpxedit_tile_servers - - - id - integer - 0 - true - 1 - 4 - - - user - text - true - 64 - - - type - text - tile - true - 20 - - - servername - text - true - 300 - - - url - text - true - 300 - - - format - text - true - image/jpeg - 300 - - - layers - text - true - - 300 - - - version - text - true - 1.1.1 - 30 - - - opacity - text - true - 0.4 - 10 - - - transparent - text - true - true - 10 - - - minzoom - integer - true - 1 - 4 - - - maxzoom - integer - true - 18 - 4 - - - attribution - text - true - ??? - 300 - - -
- - *dbprefix*gpxedit_options - - - id - integer - 0 - true - 1 - 4 - - - user - text - true - 64 - - - jsonvalues - clob - true - - -
-
diff --git a/appinfo/info.xml b/appinfo/info.xml index 69b95ad..6718219 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,7 +3,7 @@ gpxedit GpxEdit - 0.0.13 + 0.0.14 agpl Julien Veyssier GpxEdit @@ -23,7 +23,7 @@ pgsql sqlite mysql - + OCA\GpxEdit\Settings\Admin diff --git a/js/gpxedit.js b/js/gpxedit.js index 2d23d1c..3a0784a 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -178,6 +178,17 @@ return str.indexOf(suffix, str.length - suffix.length) !== -1; } + function escapeHtml(text) { + const map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + } + return text.replace(/[&<>"']/g, (m) => { return map[m] }) + } + function load_map() { // change meta to send referrer // usefull for IGN tiles authentication ! @@ -628,11 +639,11 @@ gpxText = gpxText + '\n \n'; var trackName = $('#tracknameinput').val(); if (trackName) { - gpxText = gpxText + ' ' + escapeHTML(trackName) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(trackName) + '\n'; } var fileDesc = $('#desctext').val(); if (fileDesc) { - gpxText = gpxText + ' ' + escapeHTML(fileDesc) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(fileDesc) + '\n'; } var linkurl = $('#linkurlinput').val(); if (linkurl) { @@ -640,7 +651,7 @@ var linktext = $('#linktextinput').val(); if (linktext) { - gpxText = gpxText + ' ' + escapeHTML(linktext) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(linktext) + '\n'; } gpxText = gpxText + ' \n'; } @@ -720,7 +731,7 @@ alt = layer._latlng.alt; gpxText = gpxText + ' \n'; if (name) { - gpxText = gpxText + ' ' + escapeHTML(name) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(name) + '\n'; } else{ gpxText = gpxText + ' \n'; @@ -729,16 +740,16 @@ gpxText = gpxText + ' ' + alt + '\n'; } if (linkText && linkUrl) { - gpxText = gpxText + ' ' + escapeHTML(linkText) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(linkText) + '\n'; } if (comment) { - gpxText = gpxText + ' ' + escapeHTML(comment) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(comment) + '\n'; } if (symbol) { gpxText = gpxText + ' ' + symbol + '\n'; } if (description) { - gpxText = gpxText + ' ' + escapeHTML(description) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(description) + '\n'; } if (time) { gpxText = gpxText + ' \n'; @@ -748,19 +759,19 @@ else if(!layer.type || layer.type === 'track') { gpxText = gpxText + ' \n'; if (name) { - gpxText = gpxText + ' ' + escapeHTML(name) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(name) + '\n'; } else{ gpxText = gpxText + ' \n'; } if (comment) { - gpxText = gpxText + ' ' + escapeHTML(comment) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(comment) + '\n'; } if (linkText && linkUrl) { - gpxText = gpxText + ' ' + escapeHTML(linkText) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(linkText) + '\n'; } if (description) { - gpxText = gpxText + ' ' + escapeHTML(description) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(description) + '\n'; } gpxText = gpxText + ' \n'; for (i = 0; i < layer._latlngs.length; i++) { @@ -782,19 +793,19 @@ else if(layer.type === 'route') { gpxText = gpxText + ' \n'; if (name) { - gpxText = gpxText + ' ' + escapeHTML(name) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(name) + '\n'; } else{ gpxText = gpxText + ' \n'; } if (comment) { - gpxText = gpxText + ' ' + escapeHTML(comment) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(comment) + '\n'; } if (linkText && linkUrl) { - gpxText = gpxText + ' ' + escapeHTML(linkText) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(linkText) + '\n'; } if (description) { - gpxText = gpxText + ' ' + escapeHTML(description) + '\n'; + gpxText = gpxText + ' ' + escapeHtml(description) + '\n'; } for (i = 0; i < layer._latlngs.length; i++) { lat = layer._latlngs[i].lat; @@ -1294,9 +1305,9 @@ }).done(function (response) { if (response.done) { $('#'+type+'serverlist ul').prepend( - '
  • ' + - escapeHTML(sname) + '
  • ' @@ -1507,7 +1518,7 @@ showSavingAnimation(); var req = { path: saveFilePath, - content: gpxText + content: gpxText }; var url = OC.generateUrl('/apps/gpxedit/savegpx'); $.ajax({ diff --git a/lib/Migration/Version000014Date20210625132243.php b/lib/Migration/Version000014Date20210625132243.php new file mode 100644 index 0000000..b592956 --- /dev/null +++ b/lib/Migration/Version000014Date20210625132243.php @@ -0,0 +1,128 @@ +hasTable('gpxedit_tile_servers')) { + $table = $schema->createTable('gpxedit_tile_servers'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('user', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('type', 'string', [ + 'notnull' => true, + 'length' => 20, + 'default' => 'tile', + ]); + $table->addColumn('servername', 'string', [ + 'notnull' => true, + 'length' => 300, + ]); + $table->addColumn('url', 'string', [ + 'notnull' => true, + 'length' => 300, + ]); + $table->addColumn('format', 'string', [ + 'notnull' => true, + 'length' => 300, + 'default' => 'image/jpeg', + ]); + $table->addColumn('layers', 'string', [ + 'notnull' => true, + 'length' => 300, + 'default' => '', + ]); + $table->addColumn('version', 'string', [ + 'notnull' => true, + 'length' => 30, + 'default' => '1.1.1', + ]); + $table->addColumn('opacity', 'string', [ + 'notnull' => true, + 'length' => 10, + 'default' => '0.4', + ]); + $table->addColumn('transparent', 'string', [ + 'notnull' => true, + 'length' => 10, + 'default' => 'true', + ]); + $table->addColumn('minzoom', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 1, + ]); + $table->addColumn('maxzoom', 'integer', [ + 'notnull' => true, + 'length' => 4, + 'default' => 18, + ]); + $table->addColumn('attribution', 'string', [ + 'notnull' => true, + 'length' => 300, + 'default' => '???', + ]); + $table->setPrimaryKey(['id']); + } + + if (!$schema->hasTable('gpxedit_options')) { + $table = $schema->createTable('gpxedit_options'); + $table->addColumn('id', 'integer', [ + 'autoincrement' => true, + 'notnull' => true, + 'length' => 4, + ]); + $table->addColumn('user', 'string', [ + 'notnull' => true, + 'length' => 64, + ]); + $table->addColumn('jsonvalues', 'text', [ + 'notnull' => true, + ]); + $table->setPrimaryKey(['id']); + } + return $schema; + } + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + } +}