Skip to content

Commit

Permalink
Attempt to auto-update (fixes #59)
Browse files Browse the repository at this point in the history
  • Loading branch information
el1t committed Aug 29, 2017
1 parent eb2cc83 commit 476cfb8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions platform/safari/Info.plist
Expand Up @@ -92,6 +92,8 @@
<string>All</string>
</dict>
</dict>
<key>Update Manifest URL</key>
<string>https://raw.githubusercontent.com/el1t/uBlock-Safari-releases/master/Update.plist</string>
<key>Website</key>
<string>https://www.github.com/el1t/uBlock-Safari</string>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions platform/safari/Update.plist
Expand Up @@ -6,15 +6,15 @@
<array>
<dict>
<key>CFBundleIdentifier</key>
<string>net.gorhill.uBlock</string>
<string>com.el1t.uBlock</string>
<key>Developer Identifier</key>
<string>96G4BAKDQ9</string>
<string>3NU33NW2M3</string>
<key>CFBundleShortVersionString</key>
<string>{version}</string>
<key>CFBundleVersion</key>
<string>{buildNumber}</string>
<key>URL</key>
<string>https://chrismatic.io/ublock/ublock-latest.safariextz</string>
<string>https://raw.githubusercontent.com/el1t/uBlock-Safari-releases/master/uBlock0.safariextz</string>
</dict>
</array>
</dict>
Expand Down
20 changes: 16 additions & 4 deletions tools/make-safari.sh
Expand Up @@ -28,12 +28,13 @@ cp platform/safari/Settings.plist $DES/
cp LICENSE.txt $DES/

# https://github.com/el1t/uBlock-Safari/issues/4
echo '*** uBlock0.safariextension: Adding extensions to extensionless assets...'
echo -n '*** uBlock0.safariextension: Adding extensions to extensionless assets...'
find $DES/assets/thirdparties -type f -regex '.*\/[^.]*' -exec mv {} {}.txt \;
echo ''

# Declare __MSG__ scripts inside client-injected.js
# Beware: this removes all newlines within each script
echo '*** uBlock0.safariextension: Injecting scripts into vapi-client...'
echo -n '*** uBlock0.safariextension: Injecting scripts into vapi-client...'
awkscript='BEGIN { p = 0 }
/^\/\/ __MSG__/ {
p = 1
Expand All @@ -56,9 +57,11 @@ if ! sed "${sedargs[@]}" $DES/js/vapi-client.js 2>/dev/null; then
sed ${sedargs[@]} $DES/js/vapi-client.js
fi
rm -f $DES/js/client-injected.js
echo ''

echo '*** uBlock0.safariextension: Generating Info.plist...'
echo -n '*** uBlock0.safariextension: Generating Info.plist...'
python tools/make-safari-meta.py $DES/
echo ''

if [ "$1" = all ]; then
if [ ! -f dist/certs/key.pem ] || [ ! -f dist/certs/SafariDeveloper.cer ]; then
Expand All @@ -67,10 +70,19 @@ if [ "$1" = all ]; then
fi
echo -n '*** uBlock0.safariextension: Creating signed extension...'
if ! bash ./tools/make-safari-sign.sh "$DES"; then
echo
echo '*** uBlock0.safariextension: Error signing extension'
exit 1
fi
echo ' done.'
echo ''

RELEASES=../uBlock-releases
if [ -d "$RELEASES" ]; then
echo -n '*** uBlock0.safariextension: Copying into releases directory...'
cp "${DES/safariextension/safariextz}" "$RELEASES"
cp "$DES/../Update.plist" "$RELEASES"
echo ''
fi
fi

echo '*** uBlock0.safariextension: Done.'
Expand Down

0 comments on commit 476cfb8

Please sign in to comment.