mirror of
https://github.com/cupcakearmy/unpixel.git
synced 2026-04-02 12:25:22 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 928b69b4fb | |||
| b17f5db58e | |||
| 064287c34f | |||
| 317c88641d | |||
| 39398da265 | |||
| c045ab43bf | |||
| 67276e0119 | |||
| 50a24f847f | |||
| 72ee5d7641 | |||
| 46704211fa | |||
| 5a5a2755f1 | |||
| f5741e381d | |||
| eeae431e79 | |||
| 30319197c6 |
22
.github/workflows/release.yml
vendored
Normal file
22
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Build
|
||||
run: yarn run dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
20
README.md
20
README.md
@@ -14,6 +14,24 @@ To combat and alleviate the symptoms there is the famous 20/20/20 rule that aims
|
||||
|
||||
This is not medical advice. Read more [here](https://en.wikipedia.org/wiki/Computer_vision_syndrome) and [here](https://www.aoa.org/healthy-eyes/eye-and-vision-conditions/computer-vision-syndrome).
|
||||
|
||||
## 📦 Install
|
||||
## 📦 Installation
|
||||
|
||||
Head to the [release page](https://github.com/cupcakearmy/unpixel/releases) and grab the latest for your platform.
|
||||
|
||||
- For `macOS` you can downlaod the `.dmg` image.
|
||||
- For `Windows` download the `.exe`.
|
||||
- For `Linux` either the `.AppImage` or `.deb`, you will know what fits you 😉.
|
||||
|
||||
## Building / Development
|
||||
|
||||
1. Clone the repo
|
||||
2. `yarn install`
|
||||
3. `yarn dist` to build for all platforms
|
||||
|
||||
Alternatevly you can run `yarn build` and the `yarn electron-builder -m` for `macOS`, `-l` fir `linux` or `-w` for `windows`.
|
||||
|
||||
## RELEASE
|
||||
|
||||
1. Create a draft release with the new version. (e.g. tag with `v1.2.3`).
|
||||
2. Push to master and github workflow will build and upload assets to the draft matching the version of `package.json` and draft.
|
||||
3. When ready publish release.
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
appId: "io.nicco.app.unpixel"
|
||||
# productName: "UnPixel"
|
||||
files:
|
||||
- assets
|
||||
- dist
|
||||
directories:
|
||||
output: "./out"
|
||||
mac:
|
||||
target: "dmg"
|
||||
target:
|
||||
- dmg
|
||||
identity: null
|
||||
win:
|
||||
target: "nsis"
|
||||
target:
|
||||
- nsis
|
||||
linux:
|
||||
category: "Utility"
|
||||
category: "Utility"
|
||||
target:
|
||||
- AppImage
|
||||
- deb
|
||||
@@ -11,7 +11,7 @@
|
||||
"repository": {
|
||||
"url": "https://github.com/cupcakearmy/unpixel"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.5",
|
||||
"main": "./dist/back/index.js",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
@@ -22,7 +22,6 @@
|
||||
"build:back": "parcel build --target back ./src/back/index.ts",
|
||||
"build": "run-s build:*",
|
||||
"pack": "electron-builder -mwl",
|
||||
"pack:dev": "electron-builder -m",
|
||||
"dist": "rm -rf .parcel-cache dist && run-s build pack"
|
||||
},
|
||||
"browserslist": [
|
||||
@@ -53,8 +52,10 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0-0",
|
||||
"@types/auto-launch": "^5.0.1",
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"@types/semver": "^7.3.4",
|
||||
"electron": "^12.0.0",
|
||||
"electron-builder": "^22.10.5",
|
||||
"npm-run-all": "^4.1.5",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import dayjs from 'dayjs'
|
||||
import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
|
||||
import { join } from 'path'
|
||||
import os from 'os'
|
||||
import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
|
||||
import dayjs from 'dayjs'
|
||||
import logger from 'electron-log'
|
||||
|
||||
import { DEV } from '.'
|
||||
@@ -48,30 +49,23 @@ export default class Banner {
|
||||
},
|
||||
width: 1200,
|
||||
height: 600,
|
||||
}
|
||||
if (!DEV) {
|
||||
Object.assign(options, {
|
||||
resizable: false,
|
||||
movable: false,
|
||||
simpleFullscreen: true,
|
||||
fullscreen: true,
|
||||
transparent: true,
|
||||
})
|
||||
fullscreen: true,
|
||||
simpleFullscreen: os.platform() === 'darwin',
|
||||
}
|
||||
this.window = new BrowserWindow(options)
|
||||
|
||||
const entry = join(__dirname, '../front/banner/index.html')
|
||||
this.window.loadFile(entry)
|
||||
|
||||
if (!DEV) {
|
||||
this.window.maximize()
|
||||
if (DEV) {
|
||||
this.window.webContents.toggleDevTools()
|
||||
} else {
|
||||
this.window.setAlwaysOnTop(true, 'floating', 99)
|
||||
this.window.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })
|
||||
this.window.setFullScreenable(false)
|
||||
} else {
|
||||
this.window.webContents.toggleDevTools()
|
||||
this.window.setMovable(false)
|
||||
this.window.setResizable(false)
|
||||
this.window.focus()
|
||||
}
|
||||
this.window.focus()
|
||||
}
|
||||
|
||||
static close() {
|
||||
|
||||
@@ -8,6 +8,10 @@ import Updater from './updater'
|
||||
|
||||
export const DEV = !app.isPackaged
|
||||
|
||||
// Enforce single instance
|
||||
const isMain = app.requestSingleInstanceLock()
|
||||
if (!isMain) app.quit()
|
||||
|
||||
// Disable gpu
|
||||
app.disableHardwareAcceleration()
|
||||
app.commandLine.appendSwitch('disable-software-rasterizer')
|
||||
@@ -18,7 +22,7 @@ app
|
||||
.whenReady()
|
||||
.then(() => {
|
||||
logger.log('Initializing')
|
||||
if (!DEV) app.dock.hide()
|
||||
if (!DEV) app.dock?.hide()
|
||||
TrayUtility.init()
|
||||
Settings.init()
|
||||
Banner.init()
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class Settings {
|
||||
|
||||
static open() {
|
||||
if (this.win) return
|
||||
this.win = new BrowserWindow({
|
||||
Settings.win = new BrowserWindow({
|
||||
width: 400,
|
||||
height: 575,
|
||||
center: true,
|
||||
@@ -74,6 +74,7 @@ export default class Settings {
|
||||
|
||||
const entry = join(__dirname, '../front/settings/index.html')
|
||||
Settings.win.loadFile(entry)
|
||||
Settings.win.setMenu(null)
|
||||
|
||||
if (DEV) {
|
||||
Settings.win.setSize(800, 485)
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class TrayUtility {
|
||||
|
||||
static setStatus(status: string) {
|
||||
this.menu[0].label = status
|
||||
this.tray.setContextMenu(this.build())
|
||||
this.tray?.setContextMenu(this.build())
|
||||
}
|
||||
|
||||
private static build() {
|
||||
|
||||
@@ -7,7 +7,7 @@ import pkg from '../../package.json'
|
||||
|
||||
const current = semver.coerce(pkg.version)
|
||||
const url = 'https://api.github.com/repos/cupcakearmy/unpixel/tags'
|
||||
const interval = 1000 * 60 * 60 * 10 // 10 Minutes
|
||||
const interval = 1000 * 60 * 15 // 10 Minutes
|
||||
|
||||
export default class Updater {
|
||||
static init() {
|
||||
@@ -20,8 +20,9 @@ export default class Updater {
|
||||
url,
|
||||
})
|
||||
// parse tags and reverse sort them to get the highest
|
||||
const tags = data.map((d) => semver.coerce(d.name)).sort(semver.rcompare)
|
||||
const tags = data.map((d: any) => semver.coerce(d.name)).sort(semver.rcompare)
|
||||
const latest = tags[0]
|
||||
if (!current) throw new Error('Could not determine current version')
|
||||
if (semver.lt(current, latest)) {
|
||||
logger.info('New version available')
|
||||
dialog
|
||||
|
||||
@@ -7,15 +7,17 @@ import { render } from 'react-dom'
|
||||
// @ts-ignore
|
||||
import chime from 'url:../assets/chime.mp3'
|
||||
|
||||
const useKeyPress = (handler) => {
|
||||
const handlerRef = useRef<(e: KeyboardEvent) => void>()
|
||||
const useKeyPress = (handler: (e: KeyboardEvent) => void) => {
|
||||
const handlerRef = useRef<typeof handler>()
|
||||
|
||||
useEffect(() => {
|
||||
handlerRef.current = handler
|
||||
}, [handler])
|
||||
|
||||
useEffect(() => {
|
||||
const fn = (event) => handlerRef.current(event)
|
||||
const fn = (event: KeyboardEvent) => {
|
||||
if (handlerRef.current) handlerRef.current(event)
|
||||
}
|
||||
window.addEventListener('keydown', fn)
|
||||
return () => {
|
||||
window.removeEventListener('keydown', fn)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* @import 'hiq/dist/hiq.css'; */
|
||||
@import 'spectre.css/dist/spectre.min.css';
|
||||
@import 'tachyons/css/tachyons.min.css';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback } from 'react'
|
||||
import React from 'react'
|
||||
|
||||
import Link from './ExternalLink'
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const Footer: React.FC = () => {
|
||||
<div className="flex justify-center items-center">
|
||||
<Link link="https://github.com/cupcakearmy" text="Github" />
|
||||
<div className="ph1"> - </div>
|
||||
<Link link="https://nicco.io/support" text="Support" />
|
||||
<Link link="https://nicco.io/support" text="Support / Donate" />
|
||||
</div>
|
||||
<div className="code o-20 mt1">
|
||||
<small>version: {version}</small>
|
||||
|
||||
72
tsconfig.json
Normal file
72
tsconfig.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es2018" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */,
|
||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
// "outDir": "./", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"strictNullChecks": true /* Enable strict null checks. */,
|
||||
"strictFunctionTypes": true /* Enable strict checking of function types. */,
|
||||
"strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */,
|
||||
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
|
||||
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
|
||||
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
"resolveJsonModule": true,
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
|
||||
/* Advanced Options */
|
||||
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||
}
|
||||
}
|
||||
10
yarn.lock
10
yarn.lock
@@ -1584,6 +1584,11 @@
|
||||
dependencies:
|
||||
defer-to-connect "^1.0.1"
|
||||
|
||||
"@types/auto-launch@^5.0.1":
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/auto-launch/-/auto-launch-5.0.1.tgz#388a047edc0e754d8e8978cbd9ed4672b36be2c4"
|
||||
integrity sha512-+KQ+/koZ7sJXnf5cnCANofY6yXAdYJNEoVZEuWcwJfuWbUp9u6l09I7KhwD+ivU+cdz7JId4V5ukxscWtHdSuw==
|
||||
|
||||
"@types/debug@^4.1.5":
|
||||
version "4.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
|
||||
@@ -1660,6 +1665,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275"
|
||||
integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA==
|
||||
|
||||
"@types/semver@^7.3.4":
|
||||
version "7.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb"
|
||||
integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ==
|
||||
|
||||
"@types/verror@^1.10.3":
|
||||
version "1.10.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/verror/-/verror-1.10.4.tgz#805c0612b3a0c124cf99f517364142946b74ba3b"
|
||||
|
||||
Reference in New Issue
Block a user