Skip to content

Commit

Permalink
Merge pull request #526 from typerefinery-ai/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
wildone authored Jul 6, 2023
2 parents 0e29119 + 680aee3 commit 3f49f0f
Show file tree
Hide file tree
Showing 318 changed files with 111 additions and 11,248 deletions.
7 changes: 3 additions & 4 deletions electron/app/main/Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1315,10 +1315,9 @@ export class Service extends EventEmitter<ServiceEvent> {
if (this.isStarted) {
this.#logWrite(
"info",
`quick fail already started, isStarted:${this.isStarted}.`
)
this.#log(
`service ${this.#id} already started with pid ${this.#process?.pid}`
`quick fail already started, isStarted:${this.isStarted}, pid ${
this.#process?.pid
}.`
)
return
}
Expand Down
115 changes: 62 additions & 53 deletions electron/app/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ import { Service } from "./Service"

import updateElectronApp from "update-electron-app"

// add support for self signed certificates
app.commandLine.appendSwitch("ignore-certificate-errors", "true")

// // allow insecure hosts config
// let allowedInsecureHosts: [
// "^localhost$",
// "^127.0.0.1$",
// "^0.0.0.0$",
// "^10.",
// "^172.16.",
// "^192.168.",
// ".localhost$"
// ]

// setup crash reporter first
if (getEnvConfigWithDefault("CRASH_REPORTER_SUBMIT_URL")) {
// Start crash reporter before setting up logging
Expand Down Expand Up @@ -314,34 +328,24 @@ async function createWindow() {
}

//add override for certificate errors
app.on(
"certificate-error",
(event, webContents, url, error, certificate, callback) => {
logger.log("certificate-error", url)
let isValidDomain = false
const checkUrl = new URL(url)

if (
checkUrl.hostname === "localhost" ||
checkUrl.hostname === "127.0.0.1" ||
checkUrl.hostname === "0.0.0.0" ||
checkUrl.hostname.startsWith("10.") ||
checkUrl.hostname.startsWith("172.16.") ||
checkUrl.hostname.startsWith("192.168.") ||
checkUrl.hostname.endsWith(".localhost")
) {
isValidDomain = true
}

if (isValidDomain) {
// Verification logic.
event.preventDefault()
callback(true)
} else {
callback(false)
}
}
)
// app.on(
// "certificate-error",
// (event, webContents, url, error, certificate, callback) => {
// let isValidDomain = false
// const checkUrl = new URL(url)

// isValidDomain = isHostAllowedInsecure(checkUrl.hostname)
// logger.log("certificate-error", url, checkUrl.hostname, isValidDomain)

// if (isValidDomain) {
// // Verification logic.
// event.preventDefault()
// callback(true)
// } else {
// callback(false)
// }
// }
// )

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
Expand Down Expand Up @@ -421,31 +425,23 @@ app.whenReady().then(() => {
}
})

mainWindow.webContents.session.setCertificateVerifyProc(
(request, callback) => {
const { hostname } = request
logger.log(
`mainWindow.webContents.session.setCertificateVerifyPro ${hostname}`
)
// Verification logic.
// 0 - Indicates success and disables Certificate Transparency verification.
// -2 - Indicates failure.
// -3 - Uses the verification result from chromium.
if (
hostname === "localhost" ||
hostname === "127.0.0.1" ||
hostname === "0.0.0.0" ||
hostname.startsWith("10.") ||
hostname.startsWith("172.16.") ||
hostname.startsWith("192.168.") ||
hostname.endsWith(".localhost")
) {
callback(0)
} else {
callback(-2)
}
}
)
// mainWindow.webContents.session.setCertificateVerifyProc(
// (request, callback) => {
// const { hostname } = request
// logger.log(
// `mainWindow.webContents.session.setCertificateVerifyPro ${hostname}`
// )
// // Verification logic.
// // 0 - Indicates success and disables Certificate Transparency verification.
// // -2 - Indicates failure.
// // -3 - Uses the verification result from chromium.
// if (isHostAllowedInsecure(hostname)) {
// callback(0)
// } else {
// callback(-2)
// }
// }
// )

mainWindow.webContents.setWindowOpenHandler(({ url }) => {
// Dynamically give position to opened window
Expand Down Expand Up @@ -624,3 +620,16 @@ function addIpcEvents(window: BrowserWindow) {
)
})
}

// // check if host matches allow insecure hosts config
// function isHostAllowedInsecure(hostname: string): boolean {
// // check if host matches hosts regex
// for (const regex of allowedInsecureHosts) {
// if (hostname.match(regex)) {
// logger.log(`isHostAllowedInsecure ${hostname} true`)
// return true
// }
// }
// logger.log(`isHostAllowedInsecure ${hostname} false`)
// return false
// }
4 changes: 2 additions & 2 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"electronWindowTitle": "TypeRefinery",
"companyName": "Innovolve.ai",
"author": "TypeRefinery.ai",
"version": "2023.6.16",
"version": "2023.7.6",
"appWidth": 1366,
"appHeight": 768,
"proxy": "http://127.0.0.1:8000",
Expand Down Expand Up @@ -235,6 +235,10 @@
"installerIcon": "dist/main/assets/icon.ico",
"uninstallerIcon": "dist/main/assets/icon.ico"
},
"squirrelWindows": {
"iconUrl": "https://github.com/typerefinery-ai/typerefinery/blob/develop/electron/static/assets/icon.ico?raw=true",
"msi": true
},
"nsisWeb": {
"menuCategory": false,
"oneClick": false,
Expand Down
7 changes: 6 additions & 1 deletion services/_java/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# ignore cacert updates
**/jre17/lib/security/cacerts
win32/**
!win32/win32.zip
darwin/**
!darwin/darwin.zip
linux/**
!linux/linux.zip
64 changes: 0 additions & 64 deletions services/_java/win32/NOTICE

This file was deleted.

Binary file removed services/_java/win32/bin/WinFallbackLookup.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed services/_java/win32/bin/awt.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/dt_socket.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/fontmanager.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/freetype.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/instrument.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/j2gss.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/j2pcsc.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/j2pkcs11.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jaas.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jabswitch.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/jaccessinspector.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/jaccesswalker.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/java.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/java.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/javaaccessbridge.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/javajpeg.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/javaw.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/jawt.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jdwp.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jfr.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/jimage.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jli.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jrunscript.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/jsound.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/jsvml.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/keytool.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/kinit.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/klist.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/ktab.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/lcms.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/management.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/management_agent.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/management_ext.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/mlib_image.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/msvcp140.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/net.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/nio.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/prefs.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/rmi.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/rmiregistry.exe
Binary file not shown.
Binary file removed services/_java/win32/bin/server/classes.jsa
Binary file not shown.
Binary file removed services/_java/win32/bin/server/classes_nocoops.jsa
Binary file not shown.
Binary file removed services/_java/win32/bin/server/jvm.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/splashscreen.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/sspi_bridge.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/sunmscapi.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/ucrtbase.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/vcruntime140.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/vcruntime140_1.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/verify.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/w2k_lsa_auth.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/windowsaccessbridge-64.dll
Binary file not shown.
Binary file removed services/_java/win32/bin/zip.dll
Binary file not shown.
63 changes: 0 additions & 63 deletions services/_java/win32/conf/logging.properties

This file was deleted.

Loading

0 comments on commit 3f49f0f

Please sign in to comment.