Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
lacymorrow committed Apr 13, 2022
2 parents b38f695 + fe746ab commit 9c7a305
Show file tree
Hide file tree
Showing 53 changed files with 198 additions and 54 deletions.
2 changes: 2 additions & 0 deletions CROSSOVER_ALERT_DISABLED
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
There was a bug in v2.7.4. Please manually update CrossOver
[Download the newest version here](https://github.com/lacymorrow/crossover/releases/latest)
Binary file added build/appx/LargeTile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/SmallTile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square150x150Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square150x150Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square150x150Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square150x150Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square310x310Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square310x310Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square310x310Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square310x310Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square310x310Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/appx/Square44x44Logo.targetsize-96.png
Binary file added build/appx/Square71x71Logo.scale-100.png
Binary file added build/appx/Square71x71Logo.scale-125.png
Binary file added build/appx/Square71x71Logo.scale-150.png
Binary file added build/appx/Square71x71Logo.scale-200.png
Binary file added build/appx/Square71x71Logo.scale-400.png
Binary file added build/appx/StoreLogo.png
Binary file added build/appx/StoreLogo.scale-150.png
Binary file added build/appx/StoreLogo.scale-300.png
Binary file added build/appx/StoreLogo.scale-71.png
Binary file added build/appx/Wide310x150Logo.png
Binary file added build/appx/Wide310x150Logo.scale-200.png
1 change: 1 addition & 0 deletions electron-builder-appx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ appx:
publisher: CN=C53C0091-1EEB-40B4-8537-082E06A4D328
publisherDisplayName: Fly5
showNameOnTiles: true
verifyUpdateCodeSignature: false
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "crossoverapp",
"name": "crossover",
"productName": "CrossOver",
"appId": "com.lacymorrow.crossover",
"version": "3.0.0",
Expand Down Expand Up @@ -53,7 +53,10 @@
"build:deb": "electron-builder --linux deb",
"build:snap": "electron-builder --linux snap",
"build:release": "rm -rf dist && yarn build:mac && yarn build:wl && yarn build:snap && yarn sh:copyexe",
"build:release:windows": "yarn build:windows && yarn sh:copyexe"
"build:release:snap": "electron-builder --linux snap && yarn snap:release",
"build:release:windows": "yarn build:windows && yarn sh:copyexe",
"snap:login:export": "snapcraft export-login --snaps crossover --channels edge,stable -",
"snap:release": "snapcraft upload --release=stable dist/*.snap"
},
"dependencies": {
"electron-debug": "^3.0.1",
Expand All @@ -64,8 +67,7 @@
"electron-updater": "4.3.1",
"electron-util": "^0.17.0",
"electron-winstore-auto-launch": "^2.0.6",
"iohook": "^0.9.3",
"nodemon": "^2.0.15"
"iohook": "^0.9.3"
},
"devDependencies": {
"@babel/core": "^7.17.8",
Expand All @@ -82,6 +84,7 @@
"husky": "^7.0.1",
"jimp": "^0.16.1",
"madge": "^5.0.1",
"nodemon": "^2.0.15",
"np": "^7.2.0",
"playwright": "^1.20.1",
"sass": "^1.26.5"
Expand Down
9 changes: 6 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Or download from the Snap Store
- <kbd>Control</kbd>-<kbd>Alt</kbd>-<kbd>Shift</kbd>-<kbd>X</kbd> to lock in place
- <kbd>Control</kbd>-<kbd>Alt</kbd>-<kbd>Shift</kbd>-<kbd>R</kbd> to reset app settings

[See usage...](#usage)
[See usage](#usage)

<p align="center">
<br />
Expand All @@ -100,8 +100,11 @@ Or download from the Snap Store
- Cross-platform: Windows, MacOS, and Linux support
- Support for multiple monitors
- Choose between center **Dot** or **Crosshair**
- Create duplicate crosshairs to mark more than one spot
- Customize crosshair size, color, and opacity
- Persistant settings remembers your choices automatically
- Customize SVG properties
- Light/Dark mode and custom app colors
- Persistent settings remember your choices automatically
- Automatically updates in the background to keep your features fresh _(Mac and Windows only)_

<sup>* </sup> Escape from Tarkov will not work with CrossOver ([#47](https://github.com/lacymorrow/crossover/issues/47#issuecomment-987762466))
Expand Down Expand Up @@ -162,7 +165,7 @@ _The AppImage needs to be [made executable](http://discourse.appimage.org/t/how-

# Usage

> ❌ marks the spot...
> ❌ marks the spot
**Position:** Click and drag the crosshair to anywhere on any screen. Double-click the bullseye to center the app.

Expand Down
4 changes: 3 additions & 1 deletion src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ const APP_WIDTH = 208
// 16/10: 220x352 16/9: 224x356

const DEFAULT_THEME = 'dark'
const ALERT_URL = 'https://raw.githubusercontent.com/lacymorrow/crossover/master/CROSSOVER_ALERT'
const HOMEPAGE_URL = 'https://lacymorrow.github.io/crossover'
const RELEASES_URL = 'https://github.com/lacymorrow/crossover/releases/latest'
const APP_ASPECT_RATIO = 16 / 10
const APP_HEIGHT_MEDIUM = 225
const APP_WIDTH_MEDIUM = 360
const APP_BACKGROUND_OPACITY = 0.6
const MAX_SHADOW_WINDOWS = 20
const MAX_SHADOW_WINDOWS = 14
const SETTINGS_WINDOW_DEVTOOLS = true
const SHADOW_WINDOW_OFFSET = 40

Expand All @@ -35,6 +36,7 @@ const config = {
APP_WIDTH_MEDIUM,
DEFAULT_THEME,
FILE_FILTERS,
ALERT_URL,
HOMEPAGE_URL,
RELEASES_URL,
MAX_SHADOW_WINDOWS,
Expand Down
5 changes: 4 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ const ready = async () => {
/* Press Play >>> */
init()

// Alert from developer
// alert.init()

console.timeEnd( 'init' )

}
Expand All @@ -168,7 +171,7 @@ module.exports = async () => {

await app.whenReady()

// Added 400 ms to fix the black background issue while using transparent window. More detais at https://github.com/electron/electron/issues/15947
// Added 400 ms to fix the black background issue while using transparent window. More details at https://github.com/electron/electron/issues/15947
setTimeout( ready, 400 )

}
43 changes: 43 additions & 0 deletions src/main/alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Developer Alerts
If a file named CROSSOVER_ALERT is found in the root of the master branch, users will see the alert pop up in a dialog.
Todo: Markdown
*/
const got = require( 'got' )
const { ALERT_URL } = require( '../config/config' )
const { checkboxTrue } = require( '../config/utils' )
const dialog = require( './dialog' )
const log = require( './log' )
const preferences = require( './preferences' ).init()

const init = async () => {

if ( !checkboxTrue( preferences.value( 'app.alerts' ), 'alerts' ) ) {

return

}

// We phone github here
const message = await got.get( ALERT_URL ).catch( error => {

log.info( 'No alerts found.', error )

} )

if ( message.body ) {

// notification( { title: 'CrossOver: Developer Update', body: message.body } )

dialog.openAlertDialog( message.body )

}

}

const alert = {
init,
}
module.exports = alert
92 changes: 59 additions & 33 deletions src/main/auto-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,74 @@ const { RELEASES_URL } = require( '../config/config' )
const notification = require( './notification' )
const dock = require( './dock' )

const FOUR_HOURS = 1000 * 60 * 60 * 4

const install = () => autoUpdater.quitAndInstall()

const update = () => {
const onDownloadProgress = progressObject => {

// Comment this before publishing your first version.
// It's commented out as it throws an error if there are no published versions.
if ( checkboxTrue( preferences.value( 'app.updates' ), 'updates' ) ) {
let message = 'Download speed: ' + progressObject.bytesPerSecond
message = message + ' - Downloaded ' + progressObject.percent + '%'
message = message + ' (' + progressObject.transferred + '/' + progressObject.total + ')'
log.info( message )

log.info( 'Setting: Automatic Updates' )
// Dock progress bar
windows.setProgress( progressObject.percent / 100 )

autoUpdater.logger = log
autoUpdater.on( 'update-available', () => {

sound.play( 'UPDATE' )
windows.win.webContents.send( 'set_info_icon', 'info' )
}

if ( is.linux ) {
const onUpdateAvailable = () => {

dialog.openUpdateDialog( () => {
sound.play( 'UPDATE' )
windows.win.webContents.send( 'set_info_icon', 'info' )

// AutoUpdater.downloadUpdate()
shell.openExternal( RELEASES_URL )
if ( is.linux ) {

} )
dialog.openUpdateDialog( () => {

}
// AutoUpdater.downloadUpdate()
shell.openExternal( RELEASES_URL )

} )

if ( !is.linux ) {
}

}

const onUpdateDownloaded = () => {

windows.setProgress( -1 )
dock.setBadge( '!' )
notification( { title: 'CrossOver has been Updated', body: 'Relaunch to take effect' } )
// sound.play( 'DONE' ) // uncomment if we make notification silent

}

const update = () => {

// Comment this before publishing your first version.
// It's commented out as it throws an error if there are no published versions.

// We trycatch here because appx throws errors
try {

autoUpdater.on( 'download-progress', progressObject => {
if ( checkboxTrue( preferences.value( 'app.updates' ), 'updates' ) ) {

let message = 'Download speed: ' + progressObject.bytesPerSecond
message = message + ' - Downloaded ' + progressObject.percent + '%'
message = message + ' (' + progressObject.transferred + '/' + progressObject.total + ')'
log.info( message )
log.info( 'Setting: Automatic Updates' )

// Dock progress bar
windows.setProgress( progressObject.percent / 100 )
autoUpdater.logger = log
autoUpdater.on( 'update-available', autoUpdate.onUpdateAvailable )

} )
if ( is.linux ) {

return

}

autoUpdater.on( 'update-downloaded', () => {
autoUpdater.on( 'download-progress', autoUpdate.onDownloadProgress )

windows.setProgress( -1 )
dock.setBadge( '!' )
notification( { title: 'CrossOver has been Updated', body: 'Relaunch to take effect' } )
// PlaySound( 'DONE' )
autoUpdater.on( 'update-downloaded', autoUpdate.onUpdateDownloaded )

} )
const FOUR_HOURS = 1000 * 60 * 60 * 4
setInterval( () => {

autoUpdater.checkForUpdates()
Expand All @@ -73,9 +89,19 @@ const update = () => {

}

} catch ( error ) {

log.error( error )

}

}

const autoUpdate = { install, update }
const autoUpdate = {
install,
onDownloadProgress,
onUpdateAvailable,
onUpdateDownloaded,
update,
}
module.exports = autoUpdate
56 changes: 51 additions & 5 deletions src/main/dialog.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
/* eslint no-useless-concat: 0 */
const path = require( 'path' )
const { app, dialog: electronDialog } = require( 'electron' )
const { app, dialog: electronDialog, shell } = require( 'electron' )
const log = require( 'electron-log' )
const { debugInfo, is, showAboutWindow } = require( 'electron-util' )

const { __static, FILE_FILTERS } = require( '../config/config.js' )
const { __static, FILE_FILTERS, HOMEPAGE_URL } = require( '../config/config.js' )
const set = require( './set.js' )
const notification = require( './notification.js' )
const preferences = require( './preferences.js' ).init()

const validButtonIndex = result => {

if ( typeof result === 'object' && typeof result.response === 'number' ) {

return result.response

}

return result

}

const openAboutWindow = () => {

Expand All @@ -18,6 +31,35 @@ const openAboutWindow = () => {

}

const openAlertDialog = async message => {

await electronDialog.showMessageBox( {
type: 'info',
title: 'CrossOver: Developer Update',
message,
buttons: [
'Turn off alerts', 'Open in browser…', 'Dismiss',
],
} ).then( result => {

const buttonIndex = validButtonIndex( result )

if ( buttonIndex === 0 ) {

return preferences.value( 'app.alerts', [] )

}

if ( buttonIndex === 1 ) {

return shell.openExternal( HOMEPAGE_URL )

}

} )

}

const openCustomImageDialog = async () => {

await electronDialog.showOpenDialog( {
Expand Down Expand Up @@ -54,7 +96,9 @@ const openReportCrashDialog = async crash => {
} )
.then( result => {

if ( result.response === 1 ) {
const buttonIndex = validButtonIndex( result )

if ( buttonIndex === 1 ) {

crash.submitIssue( 'https://github.com/lacymorrow/crossover/issues/new', {
title: `Error report for ${crash.versions.app}`,
Expand All @@ -65,7 +109,7 @@ const openReportCrashDialog = async crash => {

}

if ( result.response === 2 ) {
if ( buttonIndex === 2 ) {

app.quit()

Expand All @@ -82,8 +126,9 @@ const openUpdateDialog = async action => {
title: 'CrossOver Update Available',
message: '',
buttons: [ 'Update', 'Ignore' ],
} ).then( buttonIndex => {
} ).then( result => {

const buttonIndex = validButtonIndex( result )
if ( buttonIndex === 0 && typeof action === 'function' ) {

action()
Expand All @@ -96,6 +141,7 @@ const openUpdateDialog = async action => {

const dialog = {
openAboutWindow,
openAlertDialog,
openCustomImageDialog,
openReportCrashDialog,
openUpdateDialog,
Expand Down
Loading

0 comments on commit 9c7a305

Please sign in to comment.