From a9b69fd6f519fcaf069200d487ea9456a8261b70 Mon Sep 17 00:00:00 2001 From: MattIPv4 Date: Fri, 5 Jun 2020 17:16:26 +0100 Subject: [PATCH] Centralise query string generation & fallback to hash if too long --- src/nginxconfig/generators/conf/nginx.conf.js | 8 ++--- .../templates/global_sections/tools.vue | 10 +++--- src/nginxconfig/util/share_query.js | 34 +++++++++++++++++++ src/nginxconfig/util/ssl_profiles.js | 1 - 4 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 src/nginxconfig/util/share_query.js diff --git a/src/nginxconfig/generators/conf/nginx.conf.js b/src/nginxconfig/generators/conf/nginx.conf.js index 8cda066..4d6f43c 100644 --- a/src/nginxconfig/generators/conf/nginx.conf.js +++ b/src/nginxconfig/generators/conf/nginx.conf.js @@ -24,19 +24,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import qs from 'qs'; import sslProfiles from '../../util/ssl_profiles'; -import exportData from '../../util/export_data'; import websiteConf from './website.conf'; +import shareQuery from '../../util/share_query'; export default (domains, global) => { const config = {}; // Source config['# Generated by nginxconfig.io'] = ''; - const data = exportData(domains.map((domain, index) => [domain, index]).filter(d => d[0] !== null), global); - const query = qs.stringify(data, { allowDots: true }); - config[`# ${window.location.protocol}//${window.location.host}${window.location.pathname}${query.length ? '?' : ''}${query}`] = ''; + const query = shareQuery(domains.map((domain, index) => [domain, index]).filter(d => d[0] !== null), global); + config[`# ${window.location.protocol}//${window.location.host}${window.location.pathname}${query}`] = ''; // Basic nginx conf config.user = global.nginx.user.computed; diff --git a/src/nginxconfig/templates/global_sections/tools.vue b/src/nginxconfig/templates/global_sections/tools.vue index 24b24cf..b3c8620 100644 --- a/src/nginxconfig/templates/global_sections/tools.vue +++ b/src/nginxconfig/templates/global_sections/tools.vue @@ -147,11 +147,10 @@ THE SOFTWARE.