From 8602c744c175a5984450e669065d3be765df7946 Mon Sep 17 00:00:00 2001 From: Deathamns Date: Mon, 8 Dec 2014 14:55:33 +0100 Subject: [PATCH] Safari: fetch data from Info.plist for vAPI.app --- platform/safari/vapi-background.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index 376bc33ae..54b073be7 100644 --- a/platform/safari/vapi-background.js +++ b/platform/safari/vapi-background.js @@ -36,9 +36,15 @@ vAPI.safari = true; /******************************************************************************/ +var xhr = new XMLHttpRequest; +xhr.overrideMimeType('application/x-javascript;charset=utf-8'); +xhr.open('GET', 'Info.plist', false); +xhr.send(); +xhr = xhr.responseText; + vAPI.app = { - name: 'µBlock', - version: '0.7.2.0' + name: xhr.match(/DisplayName<\S+[^>]+>([^<]+)/)[1], + version: xhr.match(/ShortVersionString<\S+[^>]+>([^<]+)/)[1] }; /******************************************************************************/