Skip to content

Commit

Permalink
Finish signing
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Dec 2, 2015
1 parent c9e6059 commit a61e94e
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 40 deletions.
Binary file not shown.
Binary file not shown.
Expand Up @@ -17,9 +17,9 @@
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0701</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7A1001</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
Expand Down
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>Medis Helper EH</string>
<key>CFBundleIdentifier</key>
<string>li.zihua.medis.helper.EH</string>
<string>li.zihua.medis.helper.EH</string>
<key>CFBundleName</key>
<string>Medis Helper EH</string>
<key>CFBundlePackageType</key>
Expand All @@ -19,9 +19,9 @@
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0701</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7A1001</string>
<key>LSUIElement</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
Expand Down
Binary file not shown.
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>Medis Helper NP</string>
<key>CFBundleIdentifier</key>
<string>li.zihua.medis.helper.NP</string>
<string>li.zihua.medis.helper.NP</string>
<key>CFBundleName</key>
<string>Medis Helper NP</string>
<key>CFBundlePackageType</key>
Expand All @@ -19,9 +19,9 @@
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0701</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7A1001</string>
<key>LSUIElement</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
Expand Down
Binary file not shown.
Expand Up @@ -5,7 +5,7 @@
<key>BuildMachineOSBuild</key>
<string>14F1021</string>
<key>CFBundleIdentifier</key>
<string>li.zihua.medis.helper</string>
<string>li.zihua.medis.helper</string>
<key>CFBundleName</key>
<string>Medis Helper</string>
<key>CFBundlePackageType</key>
Expand All @@ -15,9 +15,9 @@
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0701</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7A1001</string>
<key>LSUIElement</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
Expand Down
Binary file not shown.
16 changes: 8 additions & 8 deletions Medis.app/Contents/Info.plist
Expand Up @@ -5,31 +5,31 @@
<key>BuildMachineOSBuild</key>
<string>14F1021</string>
<key>CFBundleDisplayName</key>
<string>Medis</string>
<string>Medis</string>
<key>CFBundleExecutable</key>
<string>Electron</string>
<string>Electron</string>
<key>CFBundleIconFile</key>
<string>atom.icns</string>
<key>CFBundleIdentifier</key>
<string>li.zihua.medis</string>
<string>li.zihua.medis</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Medis</string>
<string>Medis</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<string>0.1.4</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<string>0.1.4</string>
<key>DTSDKBuild</key>
<string>15A278</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0710</string>
<string>0701</string>
<key>DTXcodeBuild</key>
<string>7B91b</string>
<string>7A1001</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Binary file modified Medis.app/Contents/MacOS/Electron
Binary file not shown.
Binary file modified Medis.app/Contents/Resources/atom.asar
Binary file not shown.
20 changes: 17 additions & 3 deletions Medis.app/Contents/Resources/default_app/index.html
Expand Up @@ -76,7 +76,11 @@
};
</script>

<h2 style="-webkit-app-region: drag">Welcome to Electron</h2>
<h2>
<script>
document.write(`Welcome to Electron (v${process.versions.electron})`)
</script>
</h2>

<p>
To run your app with Electron, execute the following command under your
Expand All @@ -87,8 +91,18 @@ <h2 style="-webkit-app-region: drag">Welcome to Electron</h2>

<p>
The <code>path-to-your-app</code> should be the path to your own Electron
app, you can read the <a href='https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md'>quick start</a>
guide in Electron's <a href='https://github.com/atom/electron/blob/master/docs'>docs</a>
app, you can read the
<script>
document.write(
`<a href='https://github.com/atom/electron/blob/v${process.versions.electron}/docs/tutorial/quick-start.md'>quick start</a>`
);
</script>
guide in Electron's
<script>
document.write(
`<a href='https://github.com/atom/electron/tree/v${process.versions.electron}/docs#readme'>docs</a>`
);
</script>
on how to write one.
</p>

Expand Down
16 changes: 12 additions & 4 deletions Medis.app/Contents/Resources/default_app/main.js
Expand Up @@ -148,7 +148,11 @@ app.once('ready', function() {
},
{
label: 'Documentation',
click: function() { shell.openExternal('https://github.com/atom/electron/tree/master/docs#readme') }
click: function() {
shell.openExternal(
`https://github.com/atom/electron/tree/v${process.versions.electron}/docs#readme`
)
}
},
{
label: 'Community Discussions',
Expand Down Expand Up @@ -189,11 +193,11 @@ app.once('ready', function() {
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
role: 'hideothers:'
role: 'hideothers'
},
{
label: 'Show All',
role: 'unhide:'
role: 'unhide'
},
{
type: 'separator'
Expand Down Expand Up @@ -249,7 +253,11 @@ if (option.file && !option.webdriver) {
} catch(e) {
if (e.code == 'MODULE_NOT_FOUND') {
app.focus();
dialog.showErrorBox('Error opening app', 'The app provided is not a valid electron app, please read the docs on how to write one:\nhttps://github.com/atom/electron/tree/master/docs\n\n' + e.toString());
dialog.showErrorBox(
'Error opening app',
'The app provided is not a valid Electron app, please read the docs on how to write one:\n' +
`https://github.com/atom/electron/tree/v${process.versions.electron}/docs\n\n${e.toString()}`
);
process.exit(1);
} else {
console.error('App threw an error when running', e);
Expand Down
35 changes: 22 additions & 13 deletions bin/sign
@@ -1,27 +1,36 @@
#!/bin/bash
mkdir sign
cp -r Medis.app sign

# Name of your app.
APP="Medis"
# The path of you app to sign.
APP_PATH="sign/Medis.app"
APP_PATH="sign/$APP.app"
# The path to the location you want to put the signed package.
RESULT_PATH="$APP.pkg"
# The name of certificates you requested.
APP_KEY="3rd Party Mac Developer Application: Zihua Li (35DFNA47LC)"
INSTALLER_KEY="3rd Party Mac Developer Installer: Zihua Li (35DFNA47LC)"

FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"
FW_PATH="$APP_PATH/Contents/Frameworks"

mkdir sign
cp -a "$APP.app" sign

echo "Signing..."
codesign --verbose -fs "$APP_KEY" --entitlements child.plist "$FW_PATH/Electron Framework.framework/Libraries/libnode.dylib"
codesign --verbose -fs "$APP_KEY" --entitlements child.plist "$FW_PATH/Electron Framework.framework/Versions/A"
codesign --verbose -fs "$APP_KEY" --entitlements child.plist "$FW_PATH/$APP Helper EH.app"
codesign --verbose -fs "$APP_KEY" --entitlements child.plist "$FW_PATH/$APP Helper NP.app"
codesign --verbose -fs "$APP_KEY" --entitlements child.plist "$FW_PATH/$APP Helper.app"
codesign --verbose -fs "$APP_KEY" --entitlements parent.plist "$APP_PATH"

echo ""
echo "Verifying signatures..."
codesign --verify --deep --display --verbose=4 "$APP_PATH"

codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/Electron Framework.framework/Libraries/libnode.dylib"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/Electron Framework.framework/Electron Framework"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/Electron Framework.framework/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Helper.app/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Helper EH.app/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$FRAMEWORKS_PATH/$APP Helper NP.app/"
codesign --deep -fs "$APP_KEY" --entitlements child.plist "$APP_PATH/Contents/MacOS/Electron"
codesign --deep -fs "$APP_KEY" --entitlements parent.plist "$APP_PATH"
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"

# rm -rf sign
# echo ""
# echo "Veriyfing Gatekeeper acceptance..."
# spctl --ignore-cache --no-cache --assess --type execute --verbose=4 "$APP_PATH"

rm -rf sign
26 changes: 26 additions & 0 deletions bin/tomedis
@@ -0,0 +1,26 @@
#!/bin/bash

APP_PATH="Medis.app"
FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"

perl -pi -e 's/Electron/Medis/g' "$APP_PATH/Contents/Info.plist"
perl -pi -e 's/com.github.electron/li.zihua.medis/g' "$APP_PATH/Contents/Info.plist"
mv "$FRAMEWORKS_PATH/Electron Helper EH.app" "$FRAMEWORKS_PATH/Medis Helper EH.app"
mv "$FRAMEWORKS_PATH/Electron Helper NP.app" "$FRAMEWORKS_PATH/Medis Helper NP.app"
mv "$FRAMEWORKS_PATH/Electron Helper.app" "$FRAMEWORKS_PATH/Medis Helper.app"

perl -pi -e 's/Electron/Medis/g' "$FRAMEWORKS_PATH/Medis Helper EH.app/Contents/Info.plist"
perl -pi -e 's/Electron/Medis/g' "$FRAMEWORKS_PATH/Medis Helper NP.app/Contents/Info.plist"
perl -pi -e 's/Electron/Medis/g' "$FRAMEWORKS_PATH/Medis Helper.app/Contents/Info.plist"

perl -pi -e 's/com.github.electron/li.zihua.medis/g' "$FRAMEWORKS_PATH/Medis Helper EH.app/Contents/Info.plist"
perl -pi -e 's/com.github.electron/li.zihua.medis/g' "$FRAMEWORKS_PATH/Medis Helper NP.app/Contents/Info.plist"
perl -pi -e 's/com.github.electron/li.zihua.medis/g' "$FRAMEWORKS_PATH/Medis Helper.app/Contents/Info.plist"

rm "$APP_PATH/Contents/Resources/atom.icns"
# rm "$APP_PATH/Contents/Resources/atom.asar"
cp "icns/MyIcon.icns" "$APP_PATH/Contents/Resources/atom.icns"

mv "$FRAMEWORKS_PATH/Medis Helper EH.app/Contents/MacOS/Electron Helper EH" "$FRAMEWORKS_PATH/Medis Helper EH.app/Contents/MacOS/Medis Helper EH"
mv "$FRAMEWORKS_PATH/Medis Helper NP.app/Contents/MacOS/Electron Helper NP" "$FRAMEWORKS_PATH/Medis Helper NP.app/Contents/MacOS/Medis Helper NP"
mv "$FRAMEWORKS_PATH/Medis Helper.app/Contents/MacOS/Electron Helper" "$FRAMEWORKS_PATH/Medis Helper.app/Contents/MacOS/Medis Helper"
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -9,7 +9,8 @@
"dev": "webpack --progress --colors --watch",
"deploy": "NODE_ENV=production ./bin/deploy",
"sign": "./bin/sign",
"unsign": "./bin/unsign"
"unsign": "./bin/unsign",
"tomedis": "./bin/tomedis"
},
"dependencies": {
"fixed-data-table-contextmenu": "^0.6.3",
Expand Down
6 changes: 6 additions & 0 deletions parent.plist
Expand Up @@ -4,5 +4,11 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>

0 comments on commit a61e94e

Please sign in to comment.