Merge branch 'webext'
This commit is contained in:
commit
79672540e6
7
Makefile
7
Makefile
@ -87,7 +87,7 @@ crx_contents := script.js eventPage.js icon16.png icon48.png icon128.png manifes
|
|||||||
|
|
||||||
release := \
|
release := \
|
||||||
$(foreach f, \
|
$(foreach f, \
|
||||||
$(foreach c,. -beta.,$(name)$(c)crx updates$(c)xml $(name)$(c)user.js $(name)$(c)meta.js) \
|
$(foreach c,. -beta.,$(name)$(c)crx updates$(c)xml updates$(c)json $(name)$(c)user.js $(name)$(c)meta.js) \
|
||||||
$(name)-noupdate.crx \
|
$(name)-noupdate.crx \
|
||||||
$(name)-noupdate.user.js \
|
$(name)-noupdate.user.js \
|
||||||
$(name).zip \
|
$(name).zip \
|
||||||
@ -184,6 +184,9 @@ testbuilds/crx$1/manifest.json : src/meta/manifest.json version.json $(template_
|
|||||||
testbuilds/updates$1.xml : src/meta/updates.xml version.json $(template_deps) | testbuilds/crx$1
|
testbuilds/updates$1.xml : src/meta/updates.xml version.json $(template_deps) | testbuilds/crx$1
|
||||||
$(template) $$< $$@ type=crx channel=$1
|
$(template) $$< $$@ type=crx channel=$1
|
||||||
|
|
||||||
|
testbuilds/updates$1.json : src/meta/updates.json version.json $(template_deps) | testbuilds/crx$1
|
||||||
|
$(template) $$< $$@ type=crx channel=$1
|
||||||
|
|
||||||
testbuilds/$(name)$1.crx.zip : \
|
testbuilds/$(name)$1.crx.zip : \
|
||||||
$(foreach f,$(crx_contents),testbuilds/crx$1/$(f)) \
|
$(foreach f,$(crx_contents),testbuilds/crx$1/$(f)) \
|
||||||
package.json version.json tools/zip-crx.js node_modules/jszip/package.json
|
package.json version.json tools/zip-crx.js node_modules/jszip/package.json
|
||||||
@ -342,7 +345,7 @@ stable : distready
|
|||||||
git push . HEAD:bstable
|
git push . HEAD:bstable
|
||||||
git tag -af stable -m "$(meta_name) v$(version)."
|
git tag -af stable -m "$(meta_name) v$(version)."
|
||||||
cd dist && git merge --no-commit -s ours stable
|
cd dist && git merge --no-commit -s ours stable
|
||||||
cd dist && git checkout stable "builds/$(name).*" builds/updates.xml
|
cd dist && git checkout stable "builds/$(name).*" builds/updates.xml builds/updates.json
|
||||||
cd dist && git commit -am "Move $(meta_name) v$(version) to stable channel."
|
cd dist && git commit -am "Move $(meta_name) v$(version) to stable channel."
|
||||||
|
|
||||||
web : index.html distready
|
web : index.html distready
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
"newIssue": "https://gitreports.com/issue/ccd0/4chan-x?issue_title=%title&details=%details",
|
"newIssue": "https://gitreports.com/issue/ccd0/4chan-x?issue_title=%title&details=%details",
|
||||||
"newIssueMaxLength": 8181,
|
"newIssueMaxLength": 8181,
|
||||||
"appid": "lacclbnghgdicfifcamcmcnilckjamag",
|
"appid": "lacclbnghgdicfifcamcmcnilckjamag",
|
||||||
|
"appidGecko": "4chan-x@4chan-x.net",
|
||||||
"chromeStoreID": "ohnjgmpcibpbafdlkimncjhflgedgpam",
|
"chromeStoreID": "ohnjgmpcibpbafdlkimncjhflgedgpam",
|
||||||
"recaptchaKey": "6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc",
|
"recaptchaKey": "6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc",
|
||||||
"youtubeAPIKey": "AIzaSyB5_zaen_-46Uhz1xGR-lz1YoUMHqCD6CE",
|
"youtubeAPIKey": "AIzaSyB5_zaen_-46Uhz1xGR-lz1YoUMHqCD6CE",
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
"BroadcastChannel": false,
|
"BroadcastChannel": false,
|
||||||
"GM_info": false,
|
"GM_info": false,
|
||||||
"cloneInto": false,
|
"cloneInto": false,
|
||||||
|
"XPCNativeWrapper": false,
|
||||||
"unsafeWindow": false,
|
"unsafeWindow": false,
|
||||||
"chrome": false,
|
"chrome": false,
|
||||||
"GM": false<%=
|
"GM": false<%=
|
||||||
|
|||||||
@ -23,10 +23,14 @@
|
|||||||
<% if (channel !== '-noupdate') { %> "update_url": "<%= meta.downloads %>updates<%= channel %>.xml",
|
<% if (channel !== '-noupdate') { %> "update_url": "<%= meta.downloads %>updates<%= channel %>.xml",
|
||||||
"key": "<%= meta.appid %>",
|
"key": "<%= meta.appid %>",
|
||||||
<% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
|
<% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
|
||||||
"permissions": [
|
"permissions": <%= JSON.stringify(meta.matches_only.concat(["storage"])) %>,
|
||||||
"storage"
|
|
||||||
],
|
|
||||||
"optional_permissions": [
|
"optional_permissions": [
|
||||||
"*://*/"
|
"*://*/"
|
||||||
]
|
],
|
||||||
|
"applications": {
|
||||||
|
"gecko": {
|
||||||
|
"id": "<%= meta.appidGecko %>"<% if (channel !== '-noupdate') { %>,
|
||||||
|
"update_url": "<%= meta.downloads %>updates<%= channel %>.json"
|
||||||
|
<% } %> }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/meta/updates.json
Normal file
12
src/meta/updates.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"addons": {
|
||||||
|
"<%= meta.appidGecko %>": {
|
||||||
|
"updates": [
|
||||||
|
{
|
||||||
|
"version": "<%= readJSON('/version.json').version %>",
|
||||||
|
"update_link": "<%= meta.downloads %><%= name %><%= channel %>.crx"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -45,6 +45,10 @@ $.ajax = do ->
|
|||||||
# With the `If-Modified-Since` header we only receive the HTTP headers and no body for 304 responses.
|
# With the `If-Modified-Since` header we only receive the HTTP headers and no body for 304 responses.
|
||||||
# This saves a lot of bandwidth and CPU time for both the users and the servers.
|
# This saves a lot of bandwidth and CPU time for both the users and the servers.
|
||||||
lastModified = {}
|
lastModified = {}
|
||||||
|
<% if (type === 'crx') { %>
|
||||||
|
if XPCNativeWrapper?
|
||||||
|
pageXHR = XPCNativeWrapper window.wrappedJSObject.XMLHttpRequest
|
||||||
|
<% } %>
|
||||||
|
|
||||||
(url, options={}, extra={}) ->
|
(url, options={}, extra={}) ->
|
||||||
{type, whenModified, upCallbacks, form} = extra
|
{type, whenModified, upCallbacks, form} = extra
|
||||||
@ -53,7 +57,11 @@ $.ajax = do ->
|
|||||||
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
|
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
|
||||||
# XXX https://bugs.chromium.org/p/chromium/issues/detail?id=643659
|
# XXX https://bugs.chromium.org/p/chromium/issues/detail?id=643659
|
||||||
url += "?s=#{whenModified}" if $.engine is 'blink' and whenModified
|
url += "?s=#{whenModified}" if $.engine is 'blink' and whenModified
|
||||||
r = new XMLHttpRequest()
|
xhr = XMLHttpRequest
|
||||||
|
<% if (type === 'crx') { %>
|
||||||
|
xhr = pageXHR or xhr
|
||||||
|
<% } %>
|
||||||
|
r = new xhr()
|
||||||
type or= form and 'post' or 'get'
|
type or= form and 'post' or 'get'
|
||||||
try
|
try
|
||||||
r.open type, url, true
|
r.open type, url, true
|
||||||
@ -415,9 +423,17 @@ $.get = $.oneItemSugar (data, cb) ->
|
|||||||
return unless $.crxWorking()
|
return unless $.crxWorking()
|
||||||
results = {}
|
results = {}
|
||||||
get = (area) ->
|
get = (area) ->
|
||||||
chrome.storage[area].get Object.keys(data), (result) ->
|
keys = Object.keys data
|
||||||
|
# XXX slow performance in Firefox
|
||||||
|
if $.engine is 'gecko' and area is 'sync' and keys.length > 3
|
||||||
|
keys = null
|
||||||
|
chrome.storage[area].get keys, (result) ->
|
||||||
if chrome.runtime.lastError
|
if chrome.runtime.lastError
|
||||||
c.error chrome.runtime.lastError.message
|
c.error chrome.runtime.lastError.message
|
||||||
|
if keys is null
|
||||||
|
result2 = {}
|
||||||
|
result2[key] = val for key, val of result when key of data
|
||||||
|
result = result2
|
||||||
for key of data
|
for key of data
|
||||||
$.oldValue[area][key] = result[key]
|
$.oldValue[area][key] = result[key]
|
||||||
results[area] = result
|
results[area] = result
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user