Skip to content

Loading…

Safari: fetch data from Info.plist for vAPI.app #407

Merged
merged 1 commit into from

2 participants

@Deathamns

No description provided.

@gorhill gorhill merged commit dd4f9ae into chrisaljoudi:master
@Deathamns Deathamns deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2014
  1. @Deathamns
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 2 deletions.
  1. +8 −2 platform/safari/vapi-background.js
View
10 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]
};
/******************************************************************************/
Something went wrong with that request. Please try again.