Skip to content

Commit

Permalink
Merge branch 'release/1.4.0' into released
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Jul 6, 2019
2 parents daa366d + d8a6f49 commit b176539
Show file tree
Hide file tree
Showing 114 changed files with 7,827 additions and 5,046 deletions.
36 changes: 0 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,7 @@ jobs:
- image: circleci/node:11.0
working_directory: ~/repo
steps:
# build holoflows-kit
- run:
name: Clone @holoflows/kit
command: |
cd ..
git clone -q --depth=1 https://github.com/DimensionDev/holoflows-kit
- restore_cache:
keys:
- v1-holoflows-{{ checksum "~/holoflows-kit/yarn.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-holoflows-
- run:
name: Install @holoflows/kit
command: |
cd ../holoflows-kit
yarn install --frozen-lockfile
- save_cache:
paths:
- ~/holoflows-kit/node_modules
key: v1-holoflows-{{ checksum "~/holoflows-kit/yarn.lock" }}
- run:
name: Build @holoflows/kit
command: |
cd ../holoflows-kit
yarn build
yarn link
# build maskbook
- checkout
- restore_cache:
keys:
- tsbuild-cache
- restore_cache:
keys:
- v1-maskbook-{{ .Branch }}-{{ checksum "yarn.lock" }}
Expand All @@ -50,7 +19,6 @@ jobs:
name: Build Maskbook
command: |
yarn install --frozen-lockfile
yarn link @holoflows/kit
yarn build
sudo apt-get install zip
cd build
Expand All @@ -59,10 +27,6 @@ jobs:
paths:
- node_modules
key: v1-maskbook-{{ .Branch }}-{{ checksum "yarn.lock" }}
- save_cache:
paths:
- .tscache/
key: tsbuild-cache
- store_artifacts:
path: Maskbook.zip
destination: /Maskbook.zip
Expand Down
54 changes: 33 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Maskbook · ![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square) ![Ciecle CI](https://img.shields.io/circleci/project/github/DimensionDev/Maskbook.svg?style=flat-square&logo=circleci) [![Join the chat at https://gitter.im/Maskbook/community](https://badges.gitter.im/Maskbook/community.svg)](https://gitter.im/Maskbook/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Chrome Web Store](https://img.shields.io/chrome-web-store/v/jkoeaghipilijlahjplgbfiocjhldnap.svg?logo=Maskbook&logoColor=%231c68f3&style=flat-square)
# Maskbook · ![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square) ![Circle CI](https://img.shields.io/circleci/project/github/DimensionDev/Maskbook.svg?style=flat-square&logo=circleci) [![Join the chat at https://gitter.im/Maskbook/community](https://badges.gitter.im/Maskbook/community.svg)](https://gitter.im/Maskbook/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Chrome Web Store](https://img.shields.io/chrome-web-store/v/jkoeaghipilijlahjplgbfiocjhldnap.svg?logo=Maskbook&logoColor=%231c68f3&style=flat-square)

Encrypt your posts & chats on You-Know-Where. Allow only your friends to decrypt.

For general introductions, see https://Maskbook.io/
For general introductions, see https://Maskbook.com/

[Install Maskbook on Chrome Web Store](https://chrome.google.com/webstore/detail/maskbook/jkoeaghipilijlahjplgbfiocjhldnap/)

Expand All @@ -11,41 +11,53 @@ For general introductions, see https://Maskbook.io/
- License: AGPL
- Code Style: Use [prettier](https://github.com/prettier/prettier)
- [Git flow](https://github.com/nvie/gitflow) enabled, `master` as the latest branch, `released` as the stable branch
- UI developing: Use `yarn start` / `npm start` to start a [Storybook](https://storybook.js.org/)
- Extension developing: Use `yarn watch` / `npm run watch` to start watch build for extension
- Crypto: We're using [ECDH SECP256-k1](https://en.wikipedia.org/wiki/ECC) and [AES-GCM](https://en.wikipedia.org/wiki/AES)
- Crypto: We're using [Elliptic Curve Cryptography (ECC)](https://en.wikipedia.org/wiki/ECC) of the [SECP256-k1](https://en.bitcoin.it/wiki/Secp256k1) parameters for [secret sharing](https://en.wikipedia.org/wiki/Elliptic-curve_Diffie–Hellman) and [AES-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode) for encryption
- Data transfer between users: We're using [gun.js](https://gun.eco)

### Prepare

After `Maskbook` and `@holoflows/kit` gets stable, we will directly add `@holoflows/kit` as a dependency. Currently, you need to install and build the latest version of `@holoflows/kit`.

#### Install dependencies

- `yarn install`

#### Prepare for library @holoflows/kit
#### Build and developing

- `cd ..`
- `git clone https://github.com/DimensionDev/holoflows-kit.git`
- `cd Holoflows-kit`
- `yarn install`
- `yarn build`
- `yarn link`
- `cd ../Maskbook`
- `yarn watch` runs a watching mode. Output files in `./dist/`. Load it as unpacked Chrome or Firefox extension
- `yarn build` build a production version. Output files in `./build/`
- `yarn test` to run test (we didn't have one yet)
- `yarn start` to start StoryBook. Used for UI only developing.

#### Install @holoflows/kit in Maskbook
#### Non-famous libraries we are using

- `yarn link @holoflows/kit`
- `@holoflows/kit` - A toolkit for extension developing
- `anchrome` - Use it to detect links in the text
- `construct-style-sheets-polyfill` - A polyfill for a web api
- `elliptic` - A crypto library, we use it to encrypt and decrypt
- `gun` - A decentralized graph databasem we use it to sync user's shared crypto key
- `pvtsutils` and `tiny-secp256k1` - A crypto library, we use it to zip and unzip SECP256k1 keys but not using it to encrypt/decrypt
- `serialijse` - A serialization / deserialization library
- `webcrypto-liner` - A wrapper library, it wrap `elliptic` into WebCrypto API

### Folder Structure

- ./public - Resource file
- ./src/components - UI Components
- ./src/crypto - Crypto related
- ./src/key-management - How we manage keys and user infos
- ./src/crypto - Crypto related (Note, in "alpha" version, the bigger number means the older version, our first payload version is alpha-42, and the latest version in July 1 2019 is alpha-40)
- ./src/key-management - **OLD Database**, deprecated, in most cases you don't need them.
- ./src/database - How we store data.
- - ./type.ts - Type definition for Identifier (used everywhere!)
- - ./{avatar,group,people,post}.ts - How we store these data in database
- - ./helpers - Helper methods for Services to use database easier
- - ./migrate - Migrate old database to new one.
- ./src/utils - Utils
- - ./components - Some general React Components
- - ./hooks - Some general React hooks
- - ./jss - (this folder is MIT Licensed) Custom Renderer that let JSS render styles into ShadowRoot
- - ./type-transform - Transform data types between each other
- ./src/extension
- - ./background-script - Scripts that running in the background page as a service
- - ./content-script - Script that be injected into the web page
- - ./injected-script - Script that will run in the main frame of the injected web page
- ./tests - Some tests for Crypto algorithms
- ./stories - Folder for StoryBook
- ./protocols - Some standard definitions of protocols that used in Maskbook
- ./network - How does Maskbook exchange information between users
- ./social-network/ - Maskbook's multiple network support (Work in progress)
64 changes: 39 additions & 25 deletions config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ const path = require('path')

process.env.BROWSER = 'none'
module.exports = function override(/** @type{import("webpack").Configuration} */ config, env) {
// CSP bans eval
// And non-inline source-map not working
if (env === 'development') config.devtool = 'inline-source-map'
// CSP bans eval and non-inline source-map not working
config.devtool = 'inline-source-map'
config.entry = {
app: path.join(__dirname, './src/index.tsx'),
contentscript: path.join(__dirname, './src/content-script.ts'),
Expand All @@ -17,11 +16,8 @@ module.exports = function override(/** @type{import("webpack").Configuration} */
// Leads a loading failure in background service
config.optimization.runtimeChunk = false
config.optimization.splitChunks = undefined

// Dismiss warning for gun.js
config.module.wrappedContextCritical = false
config.module.exprContextCritical = false
config.module.unknownContextCritical = false

config.plugins.push(
new (require('write-file-webpack-plugin'))({
Expand Down Expand Up @@ -55,29 +51,47 @@ module.exports = function override(/** @type{import("webpack").Configuration} */
)
}
// Let webpack build to es2017 instead of es5
for (const x of config.module.rules) {
if (!x.oneOf) continue
for (const rule of x.oneOf) {
// Replace babel-loader with ts-loader
if (rule.loader === require.resolve('babel-loader')) {
if (rule.include) {
rule.loader = require.resolve('ts-loader')
rule.options = {
config.module.rules = [
// from cra
{
parser: { requireEnsure: false },
},
// eslint omitted
{
oneOf: [
// url-loader from cra
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve('url-loader'),
options: { limit: 10000, name: 'static/media/[name].[hash:8].[ext]' },
},
// babel-loader omitted
// babel-loader omitted
// css module loader omitted
// css module loader omitted
// scss loader omitted
// scss (with css module) loader omitted,
// file-loader from cra
{
loader: require.resolve('file-loader'),
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
options: { name: 'static/media/[name].[hash:8].[ext]' },
},
// our own ts-loader
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: path.resolve(__dirname, './src'),
loader: require.resolve('ts-loader'),
options: {
transpileOnly: true,
compilerOptions: {
jsx: 'react',
},
}
}
}
}
}
config.module.rules.forEach(rule => {
// Remove the babel-loader
if (rule.oneOf) rule.oneOf = rule.oneOf.filter(x => x.loader !== require.resolve('babel-loader'))
})
// Disable the eslint linter. We have tslint.
config.module.rules = config.module.rules.filter(x => x.enforce !== 'pre')
},
},
],
},
]
// write-file-webpack-plugin conflict with this
// ! Don't upgrade webpack to 5 until they fix this
config.output.futureEmitAssets = false
Expand Down
78 changes: 43 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
{
"name": "maskbook",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"dependencies": {
"@material-ui/core": "^3.9.2",
"@material-ui/icons": "^3.0.2",
"@holoflows/kit": "https://github.com/DimensionDev/holoflows-kit",
"@material-ui/core": "^4.0.0",
"@material-ui/icons": "^4.0.0",
"@material-ui/styles": "^4.0.0",
"@types/classnames": "^2.2.7",
"@types/gun": "^0.9.1",
"@types/jest": "^24.0.6",
"@types/jest": "^24.0.13",
"@types/lodash-es": "^4.17.3",
"@types/node": "11.13.7",
"@types/react": "16.8.14",
"@types/react-dom": "16.8.4",
"@types/react-jss": "^8.6.3",
"@types/react-router-dom": "^4.3.2",
"@types/node": "^12.0.2",
"@types/react": "^16.8.18",
"@types/react-dom": "^16.8.4",
"@types/react-router-dom": "^4.3.3",
"@types/tiny-secp256k1": "^1.0.0",
"anchorme": "^1.1.2",
"classnames": "^2.2.6",
"construct-style-sheets-polyfill": "^2.0.1",
"copy-webpack-plugin": "^5.0.0",
"copy-webpack-plugin": "^5.0.3",
"elliptic": "^6.4.1",
"gun": "0.2019.422",
"idb": "^4.0.3",
"lodash-es": "^4.17.11",
"node-sass": "^4.11.0",
"npm-run-all": "^4.1.5",
"pvtsutils": "^1.0.4",
"react": "^16.8.3",
"react-app-rewired": "^2.1.0",
"react-app-rewired": "^2.1.3",
"react-dom": "^16.8.3",
"react-jss": "^8.6.1",
"react-jss": "^10.0.0-alpha.16",
"react-router-dom": "^5.0.0",
"react-scripts": "3.0.0",
"react-scripts": "^3.0.1",
"reflect-metadata": "^0.1.13",
"storybook-addon-material-ui": "0.9.0-alpha.18",
"tiny-secp256k1": "^1.1.0",
"ts-loader": "^5.4.3",
"serialijse": "^0.1.3",
"storybook-addon-material-ui": "^0.9.0-alpha.19",
"tiny-secp256k1": "^1.1.2",
"ts-loader": "^6.0.1",
"tslint": "^5.16.0",
"typed-db": "^1.0.1-1",
"typescript": "^3.4.4",
"typescript": "^3.5.1",
"web-ext-types": "^3.1.0",
"webcrypto-liner": "0.1.38",
"webextension-polyfill": "^0.4.0",
Expand All @@ -47,30 +50,35 @@
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"start": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public"
"build-storybook": "build-storybook -s public",
"postinstall": "cd node_modules/@holoflows/kit\nyarn\nyarn build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"@babel/core": "^7.4.3",
"@storybook/addon-actions": "^5.1.0-alpha.33",
"@storybook/addon-info": "^5.1.0-alpha.33",
"@storybook/addon-knobs": "^5.1.0-alpha.33",
"@storybook/addon-links": "^5.1.0-alpha.33",
"@storybook/addons": "^5.1.0-alpha.33",
"@storybook/react": "^5.1.0-alpha.33",
"@storybook/addon-actions": "^5.1.0-rc.1",
"@storybook/addon-info": "^5.1.0-rc.1",
"@storybook/addon-knobs": "^5.1.0-rc.1",
"@storybook/addon-links": "^5.1.0-rc.1",
"@storybook/addons": "^5.1.0-rc.1",
"@storybook/react": "^5.1.0-rc.1",
"@types/storybook__addon-actions": "^3.4.2",
"@types/storybook__addon-info": "^4.1.0",
"@types/storybook__addon-knobs": "^5.0.0",
"@types/storybook__addon-links": "^3.3.4",
"@types/storybook__react": "^4.0.1",
"awesome-typescript-loader": "^5.2.1"
"awesome-typescript-loader": "^5.2.1",
"react-devtools": "^3.6.1"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
21 changes: 13 additions & 8 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"$schema": "http://json.schemastore.org/chrome-manifest",
"name": "Maskbook",
"version": "1.3.0",
"version": "1.4.0",
"manifest_version": 2,
"content_scripts": [
{
"matches": ["https://www.facebook.com/*"],
"js": ["polyfill/adoptedStyleSheets.js", "polyfill/browser-polyfill.min.js", "js/contentscript.js"],
"run_at": "document_idle",
"all_frames": true
"matches": ["https://www.facebook.com/*", "https://m.facebook.com/*"],
"js": ["polyfill/browser-polyfill.min.js", "js/contentscript.js"],
"run_at": "document_idle"
}
],
"web_accessible_resources": ["*.css", "*.js", "*.jpg", "*.png"],
"permissions": ["https://www.facebook.com/*", "storage", "downloads", "background", "webNavigation"],
"permissions": [
"https://www.facebook.com/*",
"https://m.facebook.com/*",
"storage",
"downloads",
"background",
"webNavigation"
],
"background": {
"scripts": ["polyfill/webcrypto-liner.shim.js", "polyfill/browser-polyfill.min.js", "js/backgroundservice.js"]
},
Expand All @@ -27,6 +33,5 @@
"256": "256x256.png"
},
"homepage_url": "https://maskbook.io",
"description": "__MSG_manifest_description__",
"default_locale": "en"
"description": "Encrypt your posts & chats on You-Know-Where. Allow only your friends to decrypt."
}

0 comments on commit b176539

Please sign in to comment.