Skip to content

Commit

Permalink
Merge pull request #17 from IshShogun/feature-networks
Browse files Browse the repository at this point in the history
Security features and add network button with functionality
  • Loading branch information
betterbrand authored Feb 21, 2024
2 parents 00d807a + 087679b commit 357195d
Show file tree
Hide file tree
Showing 120 changed files with 16,241 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_COMM_SERVER_URL=https://metamask-sdk-socket.metafi.codefi.network/
17 changes: 17 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/electron",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"ignorePatterns": [".webpack/*", "out/*"]
}
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build
on: [pull_request]

jobs:
build_on_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@master
with:
node-version: 18
- name: install dependencies
run: npm install
- name: build
run: npm run make

build_on_mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/setup-node@master
with:
node-version: 18
- name: install dependencies
run: npm install
- name: build
run: npm run make

build_on_win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@master
with:
node-version: 18
- name: install dependencies
run: npm install
- name: build
run: npm run make
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release
on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/setup-node@master
with:
node-version: 18
- name: install dependencies
run: npm install
- name: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run publish
99 changes: 99 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock
.DS_Store

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
yarn.lock

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Webpack
.webpack/

# Vite
.vite/

# Electron-Forge
out/

# Ollama
blobs/
manifests/

package-lock.json
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn run pretty
17 changes: 17 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"cSpell.words": [
"asar",
"codefi",
"metafi",
"notarytool",
"ollama",
"qrcode",
"relocator",
"Roboto",
"submod",
"svgr"
],
"[typescript]": {
"editor.tabSize": 2
}
}
14 changes: 14 additions & 0 deletions entitlements.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>
7 changes: 7 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare namespace NodeJS {
interface ProcessEnv {
APPLE_ID: string;
APPLE_ID_PASSWORD: string;
APPLE_TEAM_ID: string;
}
}
139 changes: 139 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { MakerDMG } from '@electron-forge/maker-dmg';
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
import { WebpackPlugin } from '@electron-forge/plugin-webpack';
import { PublisherGithub } from '@electron-forge/publisher-github';
import fs from 'fs';
import path from 'path';
import { exec } from 'child_process';

import { mainConfig, mainDevConfig } from './webpack.main.config';
import { rendererConfig } from './webpack.renderer.config';

const config: ForgeConfig = {
packagerConfig: {
asar: true,
name: 'morpheus',
extraResource: ['./src/executables/'],
icon: 'src/frontend/assets/images/circle-mor-logo',
osxSign: {
identity: process.env.APPLE_DEVELOPER_ID,
optionsForFile: () => {
return {
entitlements: './entitlements.plist',
};
},
},
...(process.env.APPLE_ID &&
process.env.APPLE_ID_PASSWORD &&
process.env.APPLE_TEAM_ID && {
osxNotarize: {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
},
}),
},
hooks: {
postPackage: async (_, { platform, outputPaths }) => {
const platformFile =
platform === 'darwin'
? 'ollama-darwin'
: platform === 'win32'
? 'ollama.exe'
: 'ollama-linux';

const outputResourceFolder = `${outputPaths[0]}${platform === 'darwin' ? '/morpheus.app/Contents' : ''}/resources/executables/`;

fs.readdir(outputResourceFolder, (err, files) => {
if (err) {
throw err;
}

files.forEach((file) => {
const localPath = path.join(outputResourceFolder, file);

if (file !== platformFile) {
//fs.unlinkSync(localPath);
} else {
platform !== 'win32' ? exec(`chmod +x ${localPath}`) : fs.chmodSync(localPath, 755);
}
});
});
},
},
rebuildConfig: {},
makers: [
new MakerSquirrel({
setupIcon: 'src/frontend/assets/images/circle-mor-logo.ico',
}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({
options: {
icon: 'src/frontend/assets/images/MOR_logo_circle.iconset/icon_512x512.png',
maintainer: 'Morpheus',
homepage: 'https://www.mor.org',
categories: ['Utility'],
},
}),
new MakerDMG({
icon: 'src/frontend/assets/images/circle-mor-logo.icns',
format: 'ULFO',
background: 'src/frontend/assets/images/dmgbg.svg',
overwrite: true,
additionalDMGOptions: {
window: {
size: {
width: 600,
height: 600,
},
},
},
// contents: [
// {
// x: 410,
// y: 220,
// type: 'link',
// path: '/Applications',
// },
// ],
}),
],
publishers: [
new PublisherGithub({
repository: {
owner: 'MorpheusAIs',
name: 'Node',
},
draft: true,
}),
],
plugins: [
new AutoUnpackNativesPlugin({}),
new WebpackPlugin({
mainConfig: process.env.NODE_ENV === 'development' ? mainDevConfig : mainConfig,
devContentSecurityPolicy:
"connect-src 'self' unsafe-inline ws://localhost:* https://metamask-sdk-socket.metafi.codefi.network wss://metamask-sdk-socket.metafi.codefi.network data:",
renderer: {
config: rendererConfig,
entryPoints: [
{
html: './src/backend/index.html',
js: './src/backend/renderer.ts',
name: 'main_window',
preload: {
js: './src/backend/preload.ts',
},
},
],
},
}),
],
};

export default config;
Loading

0 comments on commit 357195d

Please sign in to comment.