Skip to content

Commit

Permalink
add vendors
Browse files Browse the repository at this point in the history
  • Loading branch information
zag committed Jan 8, 2022
1 parent 084403c commit 7edbdad
Show file tree
Hide file tree
Showing 13 changed files with 711 additions and 2 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
],
"category": "public.app-category.productivity",
"hardenedRuntime": true,
"entitlements": "./node_modules/electron-builder-notarize/entitlements.mac.inherit.plist",
"provisioningProfile": "build/embedded.provisionprofile"
"entitlements": "./node_modules/electron-builder-notarize/entitlements.mac.inherit.plist"
},
"dmg": {
"icon": "dist-assets/dmg-icon.icns",
Expand Down
3 changes: 3 additions & 0 deletions vendors/about-window/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-standard"
}
84 changes: 84 additions & 0 deletions vendors/about-window/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<a name="v1.15.1"></a>
# [v1.15.1](https://github.com/rhysd/electron-about-window/releases/tag/v1.15.1) - 25 Oct 2021

- Fix the type definitions file for TypeScript is outdated (thanks @h3poteto, #70)

[Changes][v1.15.1]


<a name="v1.15.0"></a>
# [v1.15.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.15.0) - 02 Oct 2021

- Support Electron 14+ by removing dependency of `remote` module
- Update all dependencies to the latest

[Changes][v1.15.0]


<a name="v1.14.0"></a>
# [v1.14.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.14.0) - 09 Mar 2021

- Allow to specify custom version entries for version information. See [the example code](https://github.com/rhysd/electron-about-window/blob/a0a81c918fb02f8cf9772df7df5ee55ee5de6ae9/example/main.js#L38-L46) for the usage. (#53, thanks to @noob9527)
- Disable context isolation on creating a `BrowserWindow` instance. It fixes this library does not work with Electron v12. (#64, thanks to @kondoumh)

[Changes][v1.14.0]


<a name="v1.13.4"></a>
# [v1.13.4](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.4) - 05 Jun 2020

- Allow to import this package without Electron runtime (#58)

[Changes][v1.13.4]


<a name="v1.13.3"></a>
# [v1.13.3](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.3) - 03 Jun 2020

- **Fix:** Broken at Electron v10 beta because `enableRemoteModule` is set to `false` by default from v10
- **Fix:** Loading this module in renderer process did not work

[Changes][v1.13.3]


<a name="v1.13.2"></a>
# [v1.13.2](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.2) - 13 Nov 2019

- Supported Electron v7 (#50). Still should work with electron v6 or earlier.
- Fixed given options object was modified while initialization (#49)
- Improved CSS rules to fit to frameless window (#41)
- Fixed CSS rule was not correct
- Update dependencies

[Changes][v1.13.2]


<a name="v1.13.0"></a>
# [v1.13.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.0) - 16 May 2019

- Fixed this package did not work with Electron v5 #38
- Added `about_page_dir` option for changing directory of HTML file #29
- Added `win_title` option for changing title of window #31
- Added `show_close_button` option for adding close button #34

[Changes][v1.13.0]


<a name="v1.12.0"></a>
# [v1.12.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.12.0) - 04 Jul 2018

- Added `use_version_info` flag to hide version information #25

[Changes][v1.12.0]


[v1.15.1]: https://github.com/rhysd/electron-about-window/compare/v1.15.0...v1.15.1
[v1.15.0]: https://github.com/rhysd/electron-about-window/compare/v1.14.0...v1.15.0
[v1.14.0]: https://github.com/rhysd/electron-about-window/compare/v1.13.4...v1.14.0
[v1.13.4]: https://github.com/rhysd/electron-about-window/compare/v1.13.3...v1.13.4
[v1.13.3]: https://github.com/rhysd/electron-about-window/compare/v1.13.2...v1.13.3
[v1.13.2]: https://github.com/rhysd/electron-about-window/compare/v1.13.0...v1.13.2
[v1.13.0]: https://github.com/rhysd/electron-about-window/compare/v1.12.0...v1.13.0
[v1.12.0]: https://github.com/rhysd/electron-about-window/tree/v1.12.0

<!-- Generated by https://github.com/rhysd/changelog-from-release -->
19 changes: 19 additions & 0 deletions vendors/about-window/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015 rhysd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.

142 changes: 142 additions & 0 deletions vendors/about-window/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
'About This App' Window for [Electron](https://github.com/atom/electron) Apps
=============================================================================
[![npm version](https://badge.fury.io/js/about-window.svg)](https://www.npmjs.com/package/about-window)

[This package](https://www.npmjs.com/package/about-window) provides 'About This App' window for [Electron](https://github.com/atom/electron) applications.

- [x] Create 'About This App' window from given parameters
- [x] Icon path
- [x] Copy right
- [x] App name and Versions
- [x] Description
- [x] Gather package information from package.json
- [x] Automatically detect package.json
- [x] Adjust window size to its contents automatically
- [x] Optional close button
- [x] CSS customizability

You can install this module via [npm](https://www.npmjs.com/).

```sh
$ npm install about-window
```

## Usage

Only one function is exported as default. Please see [TypeScript type definition](index.d.ts).
The function can be called from both main process and renderer process.

```typescript
export default function openAboutWindow(info: {
icon_path: string;
product_name?: string;
package_json_dir?: string;
about_page_dir?: string;
bug_report_url?: string;
bug_link_text?: string;
copyright?: string;
homepage?: string;
description?: string;
license?: string;
css_path?: string | string[];
adjust_window_size?: boolean;
win_options?: BrowserWindowOptions;
use_version_info?: boolean | [string, string][];
show_close_button?: string;
app?: Electron.App;
BrowserWindow?: typeof Electron.BrowserWindow;
ipcMain?: Electron.IpcMain;
}): BrowserWindow
```

Only `icon_path` property is required, others are optional.
I recommend to specify as below to extract information from package.json as much as possible.
Path to package.json is also automatically detected if possible.

```typescript
openAboutWindow({
icon_path: 'path/to/icon.png'
});
```

If `string` value is passed to the first parameter, it is passed to `icon_path`. So following is a shorthand of above code:

```typescript
openAboutWindow('path/to/icon.png');
```

You can check [an example app](example) to know how to use this package.

```sh
$ git clone https://github.com/rhysd/about-window.git
$ cd about-window/example
$ npm install
$ npm start

# Or for debug
$ npm run debug
```

### Parameter's properties of `openAboutWindow()`

| Name | Description | Type |
|------|-------------|------|
| `icon_path` | Path to icon file of the application. The path is passed to `src` property of `<img>` element. **Required** | string |
| `package_json_dir` | Path to directory which contains package.json. If not specified, it will try to detect a path to package.json. If also failed, it gives up and show less information in 'About This App' window. **Optional** | string |
| `bug_report_url` | URL to bug report page. If not specified, 'bugs' entry in package.json is used. **Optional** | string |
| `copyright` | Copyright notice shown in window. If not specified, it is replaced with license description generated by 'license' entry of package.json. **Optional** | string |
| `homepage` | URL of application's web page. If not specified, 'homepage' entry of package.json is used instead. **Optional** | string |
| `description` | Description of the application. If not specified, 'description' entry of package.json is used instead. **Optional** | string |
| `license` | License of the application. If not specified, 'license' entry of package.json is used instead. This property is used when `copyright` is not specified. **Optional** | string |
| `win_options` | Options of 'About This App' window. It is merged into default options. **Optional** | [BrowserWindow options object](https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions) |
| `css_path` | Path(s) to user-defined CSS file. It will be inserted to DOM of the window. **Optional** | (array of) string |
| `adjust_window_size` | Adjust the window size to its content not to show scroll bar. **Optional** | boolean |
| `open_devtools` | For debug purpose, Chrome DevTools will start when the window is opened. **Optional** | boolean |
| `use_inner_html` | If `true`, set the value with `.innerHTML` on copyright, license and description Default is `false`. **Optional** | boolean |
| `bug_link_text` | Text for a bug report link. **Optional** | string |
| `product_name` | Name of the application **Optional** | string |
| `use_version_info` | If is `false`, nothing will be displayed, if is `true`, the versions of electron, chrome, node, and v8 will be displayed, if is an array of string tuple, its entries will be displayed. Default is `true`. **Optional** | boolean |
| `show_close_button` | If this is a valid string, a close button with this string be displayed. **Optional** | string |
| `about_page_dir` | Directory path which contains `about.html` which is rendered in 'About this app' window. **Optional** | string |
| `app` | [app](https://www.electronjs.org/docs/latest/api/app) instance to use. This property is necessary only when using on renderer processes. **Optional** | Electron.App |
| `BrowserWindow` | Constructor of [BrowserWindow](https://www.electronjs.org/docs/latest/api/browser-window) to use. This property is necessary only when using on renderer processes. **Optional** | Electron.BrowserWindow |
| `ipcMain` | [ipcMain](https://www.electronjs.org/docs/latest/api/ipc-main) instance to use. This property is necessary only when using on renderer processes. **Optional** | Electron.IpcMain |

**Note:** If you set `use_inner_html` to `true`, please ensure that contents don't contain any untrusted external input
in order to avoid XSS. Be careful.

### Open the window from non-main process

Since `openAboutWindow()` depends on several APIs only available on main process, they must be provided by caller when it is called on non-main process.

To mimic the APIs, use [`@electron/remote`](https://www.npmjs.com/package/@electron/remote) module.

```typescript
import {app, BrowserWindow, ipcMain} from '@electron/remote';

openAboutWindow({
icon_path: 'path/to/icon.png'
app,
BrowserWindow,
ipcMain,
});
```

## Screen Shots

### Linux

![Linux screenshot](https://raw.githubusercontent.com/rhysd/ss/master/about-window/about-window-linux.png)

### OS X

![OS X screenshot](https://raw.githubusercontent.com/rhysd/ss/master/about-window/about-window-os-x.png)

### Windows

![Windows screenshot](https://raw.githubusercontent.com/rhysd/ss/master/about-window/about-window-windows.jpg)

## License

[MIT License](/LICENSE.txt).

27 changes: 27 additions & 0 deletions vendors/about-window/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<title>About This App</title>
<link rel="stylesheet" href="./styles/ui.css">
</head>
<body>
<div class="logo">
<img id="app-icon" alt="App icon" height="200">
</div>
<h2 class="title"></h2>
<h3 class="description"></h3>
<div class="copyright"></div>
<table class="versions"></table>
<div class="buttons"></div>
<footer class="footer">
<div class="link bug-report-link"></div>
</footer>

<!-- https://github.com/electron/electron/issues/2863 -->
<script>var exports = exports || {};</script>

<script src="./src/renderer.js"></script>
</body>
</html>
46 changes: 46 additions & 0 deletions vendors/about-window/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "about-window",
"version": "1.15.2",
"description": "'About App' window for Electron application",
"main": "src/index.js",
"typings": "src/index.d.ts",
"scripts": {
"dep": "npm install",
"build": "tsc -p src/",
"watch": "tsc --watch -p src/",
"tslint": "tslint -p ./src",
"stylelint": "stylelint styles/*.css",
"check-formatting": "prettier --check '**/*.ts'",
"lint": "npm run tslint && npm run stylelint && npm run check-formatting",
"prettier": "prettier --write '**/*.ts'",
"example": "NODE_ENV=production electron ./example",
"debug": "electron ./example",
"start": "npm run dep && npm run build && npm run example",
"preversion": "npm run lint && npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rhysd/electron-about-window.git"
},
"keywords": [
"Electron",
"electron-component",
"about",
"window"
],
"author": "rhysd <lin90162@yahoo.co.jp>",
"license": "MIT",
"bugs": {
"url": "https://github.com/rhysd/electron-about-window/issues"
},
"homepage": "https://github.com/rhysd/electron-about-window#readme",
"devDependencies": {
"@types/node": "^16.x",
"electron": "^15.1.0",
"prettier": "^2.4.1",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0",
"tslint": "^6.1.2",
"typescript": "^4.4.3"
}
}
36 changes: 36 additions & 0 deletions vendors/about-window/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
export interface LicenseEntry {
type: string;
url: string;
}
export interface PackageJson {
productName?: string;
description?: string;
homepage?: string;
license?: string | LicenseEntry;
bugs?: {
url: string;
};
}
export interface AboutWindowInfo {
icon_path: string;
product_name?: string;
copyright?: string;
homepage?: string;
description?: string;
package_json_dir?: string;
about_page_dir?: string;
license?: string;
bug_report_url?: string;
css_path?: string | string[];
adjust_window_size?: boolean;
win_options?: Electron.BrowserWindowConstructorOptions;
open_devtools?: boolean;
use_inner_html?: boolean;
bug_link_text?: string;
use_version_info?: boolean | [string, string][];
show_close_button?: string;
app?: Electron.App;
BrowserWindow?: typeof Electron.BrowserWindow;
ipcMain?: Electron.IpcMain;
}
export default function openAboutWindow(info_or_img_path: AboutWindowInfo | string): Electron.BrowserWindow;
Loading

0 comments on commit 7edbdad

Please sign in to comment.