├── .gitignore
├── .npmignore
├── .prettierrc.json
├── .stylelintrc.json
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── about.html
├── example
├── icon.png
├── index.html
├── main.js
└── package.json
├── package-lock.json
├── package.json
├── src
├── index.ts
├── renderer.ts
└── tsconfig.json
├── styles
└── ui.css
└── tslint.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | /src/*.js
4 | /src/*.js.map
5 | /src/*.d.ts
6 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /typings
2 | /.git
3 | /example
4 | npm-debug.log
5 | node_modules
6 | /src/*.ts
7 | !/src/*.d.ts
8 | /tsconfig.json
9 | /tslint.json
10 |
--------------------------------------------------------------------------------
/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "tabWidth": 4,
3 | "semi": true,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "printWidth": 120,
7 | "arrowParens": "avoid",
8 | "overrides": [
9 | {
10 | "files": [
11 | "*.ts",
12 | "*.tsx"
13 | ],
14 | "options": {
15 | "trailingComma": "all"
16 | }
17 | },
18 | {
19 | "files": "*.css",
20 | "options": {
21 | "tabWidth": 2,
22 | "printWidth": -1
23 | }
24 | },
25 | {
26 | "files": "*.md",
27 | "options": {
28 | "tabWidth": 2
29 | }
30 | }
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/.stylelintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "stylelint-config-standard"
3 | }
4 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | # [v1.15.2](https://github.com/rhysd/electron-about-window/releases/tag/v1.15.2) - 02 Nov 2021
3 |
4 | - Fix `AboutWindowInfo` type is not found (#71)
5 |
6 | [Changes][v1.15.2]
7 |
8 |
9 |
10 | # [v1.15.1](https://github.com/rhysd/electron-about-window/releases/tag/v1.15.1) - 25 Oct 2021
11 |
12 | - Fix the type definitions file for TypeScript is outdated (thanks @h3poteto, #70)
13 |
14 | [Changes][v1.15.1]
15 |
16 |
17 |
18 | # [v1.15.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.15.0) - 02 Oct 2021
19 |
20 | - Support Electron 14+ by removing dependency of `remote` module
21 | - Update all dependencies to the latest
22 |
23 | [Changes][v1.15.0]
24 |
25 |
26 |
27 | # [v1.14.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.14.0) - 09 Mar 2021
28 |
29 | - 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)
30 | - Disable context isolation on creating a `BrowserWindow` instance. It fixes this library does not work with Electron v12. (#64, thanks to @kondoumh)
31 |
32 | [Changes][v1.14.0]
33 |
34 |
35 |
36 | # [v1.13.4](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.4) - 05 Jun 2020
37 |
38 | - Allow to import this package without Electron runtime (#58)
39 |
40 | [Changes][v1.13.4]
41 |
42 |
43 |
44 | # [v1.13.3](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.3) - 03 Jun 2020
45 |
46 | - **Fix:** Broken at Electron v10 beta because `enableRemoteModule` is set to `false` by default from v10
47 | - **Fix:** Loading this module in renderer process did not work
48 |
49 | [Changes][v1.13.3]
50 |
51 |
52 |
53 | # [v1.13.2](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.2) - 13 Nov 2019
54 |
55 | - Supported Electron v7 (#50). Still should work with electron v6 or earlier.
56 | - Fixed given options object was modified while initialization (#49)
57 | - Improved CSS rules to fit to frameless window (#41)
58 | - Fixed CSS rule was not correct
59 | - Update dependencies
60 |
61 | [Changes][v1.13.2]
62 |
63 |
64 |
65 | # [v1.13.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.13.0) - 16 May 2019
66 |
67 | - Fixed this package did not work with Electron v5 #38
68 | - Added `about_page_dir` option for changing directory of HTML file #29
69 | - Added `win_title` option for changing title of window #31
70 | - Added `show_close_button` option for adding close button #34
71 |
72 | [Changes][v1.13.0]
73 |
74 |
75 |
76 | # [v1.12.0](https://github.com/rhysd/electron-about-window/releases/tag/v1.12.0) - 04 Jul 2018
77 |
78 | - Added `use_version_info` flag to hide version information #25
79 |
80 | [Changes][v1.12.0]
81 |
82 |
83 | [v1.15.2]: https://github.com/rhysd/electron-about-window/compare/v1.15.1...v1.15.2
84 | [v1.15.1]: https://github.com/rhysd/electron-about-window/compare/v1.15.0...v1.15.1
85 | [v1.15.0]: https://github.com/rhysd/electron-about-window/compare/v1.14.0...v1.15.0
86 | [v1.14.0]: https://github.com/rhysd/electron-about-window/compare/v1.13.4...v1.14.0
87 | [v1.13.4]: https://github.com/rhysd/electron-about-window/compare/v1.13.3...v1.13.4
88 | [v1.13.3]: https://github.com/rhysd/electron-about-window/compare/v1.13.2...v1.13.3
89 | [v1.13.2]: https://github.com/rhysd/electron-about-window/compare/v1.13.0...v1.13.2
90 | [v1.13.0]: https://github.com/rhysd/electron-about-window/compare/v1.12.0...v1.13.0
91 | [v1.12.0]: https://github.com/rhysd/electron-about-window/tree/v1.12.0
92 |
93 |
94 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 rhysd
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
15 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
17 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
18 | THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 'About This App' Window for [Electron](https://github.com/atom/electron) Apps
2 | =============================================================================
3 | [](https://www.npmjs.com/package/about-window)
4 |
5 | [This package](https://www.npmjs.com/package/about-window) provides 'About This App' window for [Electron](https://github.com/atom/electron) applications.
6 |
7 | - [x] Create 'About This App' window from given parameters
8 | - [x] Icon path
9 | - [x] Copy right
10 | - [x] App name and Versions
11 | - [x] Description
12 | - [x] Gather package information from package.json
13 | - [x] Automatically detect package.json
14 | - [x] Adjust window size to its contents automatically
15 | - [x] Optional close button
16 | - [x] CSS customizability
17 |
18 | You can install this module via [npm](https://www.npmjs.com/).
19 |
20 | ```sh
21 | $ npm install about-window
22 | ```
23 |
24 | ## Usage
25 |
26 | Only one function is exported as default. Please see [TypeScript type definition](index.d.ts).
27 | The function can be called from both main process and renderer process.
28 |
29 | ```typescript
30 | export default function openAboutWindow(info: {
31 | icon_path: string;
32 | product_name?: string;
33 | package_json_dir?: string;
34 | about_page_dir?: string;
35 | bug_report_url?: string;
36 | bug_link_text?: string;
37 | copyright?: string;
38 | homepage?: string;
39 | description?: string;
40 | license?: string;
41 | css_path?: string | string[];
42 | adjust_window_size?: boolean;
43 | win_options?: BrowserWindowOptions;
44 | use_version_info?: boolean | [string, string][];
45 | show_close_button?: string;
46 | app?: Electron.App;
47 | BrowserWindow?: typeof Electron.BrowserWindow;
48 | ipcMain?: Electron.IpcMain;
49 | }): BrowserWindow
50 | ```
51 |
52 | Only `icon_path` property is required, others are optional.
53 | I recommend to specify as below to extract information from package.json as much as possible.
54 | Path to package.json is also automatically detected if possible.
55 |
56 | ```typescript
57 | openAboutWindow({
58 | icon_path: 'path/to/icon.png'
59 | });
60 | ```
61 |
62 | If `string` value is passed to the first parameter, it is passed to `icon_path`. So following is a shorthand of above code:
63 |
64 | ```typescript
65 | openAboutWindow('path/to/icon.png');
66 | ```
67 |
68 | You can check [an example app](example) to know how to use this package.
69 |
70 | ```sh
71 | $ git clone https://github.com/rhysd/about-window.git
72 | $ cd about-window/example
73 | $ npm install
74 | $ npm start
75 |
76 | # Or for debug
77 | $ npm run debug
78 | ```
79 |
80 | ### Parameter's properties of `openAboutWindow()`
81 |
82 | | Name | Description | Type |
83 | |------|-------------|------|
84 | | `icon_path` | Path to icon file of the application. The path is passed to `src` property of `` element. **Required** | string |
85 | | `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 |
86 | | `bug_report_url` | URL to bug report page. If not specified, 'bugs' entry in package.json is used. **Optional** | string |
87 | | `copyright` | Copyright notice shown in window. If not specified, it is replaced with license description generated by 'license' entry of package.json. **Optional** | string |
88 | | `homepage` | URL of application's web page. If not specified, 'homepage' entry of package.json is used instead. **Optional** | string |
89 | | `description` | Description of the application. If not specified, 'description' entry of package.json is used instead. **Optional** | string |
90 | | `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 |
91 | | `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) |
92 | | `css_path` | Path(s) to user-defined CSS file. It will be inserted to DOM of the window. **Optional** | (array of) string |
93 | | `adjust_window_size` | Adjust the window size to its content not to show scroll bar. **Optional** | boolean |
94 | | `open_devtools` | For debug purpose, Chrome DevTools will start when the window is opened. **Optional** | boolean |
95 | | `use_inner_html` | If `true`, set the value with `.innerHTML` on copyright, license and description Default is `false`. **Optional** | boolean |
96 | | `bug_link_text` | Text for a bug report link. **Optional** | string |
97 | | `product_name` | Name of the application **Optional** | string |
98 | | `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 |
99 | | `show_close_button` | If this is a valid string, a close button with this string be displayed. **Optional** | string |
100 | | `about_page_dir` | Directory path which contains `about.html` which is rendered in 'About this app' window. **Optional** | string |
101 | | `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 |
102 | | `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 |
103 | | `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 |
104 |
105 | **Note:** If you set `use_inner_html` to `true`, please ensure that contents don't contain any untrusted external input
106 | in order to avoid XSS. Be careful.
107 |
108 | ### Open the window from non-main process
109 |
110 | 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.
111 |
112 | To mimic the APIs, use [`@electron/remote`](https://www.npmjs.com/package/@electron/remote) module.
113 |
114 | ```typescript
115 | import {app, BrowserWindow, ipcMain} from '@electron/remote';
116 |
117 | openAboutWindow({
118 | icon_path: 'path/to/icon.png'
119 | app,
120 | BrowserWindow,
121 | ipcMain,
122 | });
123 | ```
124 |
125 | ## Screen Shots
126 |
127 | ### Linux
128 |
129 | 
130 |
131 | ### OS X
132 |
133 | 
134 |
135 | ### Windows
136 |
137 | 
138 |
139 | ## License
140 |
141 | [MIT License](/LICENSE.txt).
142 |
143 |
--------------------------------------------------------------------------------
/about.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |