Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/aiplugs/poshapp
Browse files Browse the repository at this point in the history
  • Loading branch information
iwate committed May 12, 2020
2 parents 63461e5 + 2af47ed commit 9d4ee04
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 71 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,47 @@ on:
branches: [ master ]

jobs:
build:

windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
node-version: 12.x
node-version: 14.x
- name: Prepare build lib
working-directory: ./src/Aiplugs.PoshApp/ElectronHostHook/
run: npm install
- name: Install tool
run: dotnet tool restore
- name: Build with dotnet
env:
CSC_LINK: ${{ secrets.CSC_LINK_WIN }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD_WIN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./src/Aiplugs.PoshApp/
run: dotnet tool run electronize build /target custom "win10-x64;win"
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
node-version: 14.x
- name: Prepare build lib
working-directory: ./src/Aiplugs.PoshApp/ElectronHostHook/
run: npm install
- name: Install tool
run: dotnet tool restore
- name: Build with dotnet
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK_MAC }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD_MAC }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./src/Aiplugs.PoshApp/
run: dotnet tool run electronize build /target osx
57 changes: 0 additions & 57 deletions .github/workflows/release.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ obj
*.user
node_modules
src/monaco-editor/dist
node-tar-extract
node-tar-extract
.DS_Store
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Business Source License 1.1
Parameters

Licensor: aiplugs (@iwate)
Licensed Work: poshapp(v.0.9.28)
Licensed Work: poshapp(v.0.9.30)
The Licensed Work is (c) 2019 aiplugs.
Additional Use Grant: You may make use of the Licensed Work, provided that
you may not use the Licensed Work for a Software
Expand All @@ -14,7 +14,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that
contractors) to access the functionality of the
Licensed Work.

Change Date: 2023-04-28
Change Date: 2023-05-06

Change License: Apache License, Version 2.0

Expand Down
65 changes: 65 additions & 0 deletions src/Aiplugs.PoshApp/ElectronHostHook/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/Aiplugs.PoshApp/ElectronHostHook/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "electronhosthook",
"private": true,
"version": "1.0.0",
"description": "",
"scripts": {},
"author": "aiplugs",
"license": "ISC",
"devDependencies": {
"electron-notarize": "^0.3.0"
}
}
20 changes: 15 additions & 5 deletions src/Aiplugs.PoshApp/Services/Powershell/PowershellWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
try
{
var host = new PowershellHost(new PowershellUI(this, new PowershellRawUI()));
var iss = InitialSessionState.CreateDefault();
iss.ExecutionPolicy = ExecutionPolicy.Unrestricted;
using var runspace = RunspaceFactory.CreateRunspace(host, iss);

using var runspace = CreateRunspace();

runspace.Open();

while (!stoppingToken.IsCancellationRequested)
Expand All @@ -57,6 +54,19 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
System.Diagnostics.Trace.WriteLine(ex.Message);
}
}

private Runspace CreateRunspace()
{
var host = new PowershellHost(new PowershellUI(this, new PowershellRawUI()));

if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
var iss = InitialSessionState.CreateDefault();
iss.ExecutionPolicy = ExecutionPolicy.Unrestricted;
return RunspaceFactory.CreateRunspace(host, iss);
}

return RunspaceFactory.CreateRunspace(host);
}
private async Task TryInvokeCommand(Runspace runspace)
{
if (_context.TryDequeueCommand(out var invokeCommand))
Expand Down
14 changes: 12 additions & 2 deletions src/Aiplugs.PoshApp/electron.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,26 @@
"appId": "com.aiplugs.poshapp",
"productName": "POSH App",
"copyright": "Copyright © 2019",
"buildVersion": "0.9.28",
"buildVersion": "0.9.30",
"compression": "maximum",
"generateUpdatesFilesForAllChannels": true,
"directories": {
"output": "../../../bin/Desktop"
},
"afterSign": "../../../notarize.js",
"win": {
"icon": "./bin/wwwroot/icon/poshapp-icon-256x256.ico"
},
"mac": {
"icon": "./bin/wwwroot/icon/poshapp-icon-512x512.icns"
"icon": "./bin/wwwroot/icon/poshapp-icon-512x512.icns",
"hardenedRuntime" : true,
"gatekeeperAssess": false,
"entitlements": "../../../entitlements.mac.plist",
"entitlementsInherit": "../../../entitlements.mac.plist",
"binaries": ["../../../bin/Desktop/mac/POSH App.app/Contents/Resources/bin/Aiplugs.PoshApp"]
},
"dmg": {

},
"linux": {
"icon": "./bin/wwwroot/icon/"
Expand Down
14 changes: 14 additions & 0 deletions src/Aiplugs.PoshApp/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
34 changes: 34 additions & 0 deletions src/Aiplugs.PoshApp/notarize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require('fs');
const path = require('path');
var electron_notarize = require('./ElectronHostHook/node_modules/electron-notarize');

module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== 'darwin') {
return;
}
console.log('afterSign hook triggered', params);

// Same appId in electron-builder.
let appId = 'com.aiplugs.poshapp'

let appPath = path.join(params.appOutDir, `${params.packager.appInfo.productFilename}.app`);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}

console.log(`Notarizing ${appId} found at ${appPath}`);

try {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
});
} catch (error) {
console.error(error);
}

console.log(`Done notarizing ${appId}`);
};

0 comments on commit 9d4ee04

Please sign in to comment.