Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Windows ARM64 and Linux ARM64 #357

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/models/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {

platform: {
type: 'string',
isIn: ['linux_32', 'linux_64', 'osx_64', 'osx_arm64', 'windows_32', 'windows_64'],
isIn: ['linux_32', 'linux_64', 'linux_arm64', 'osx_64', 'osx_arm64', 'windows_32', 'windows_64', 'windows_arm64'],
required: true
},

Expand Down
6 changes: 4 additions & 2 deletions api/services/PlatformService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ var PlatformService = {
LINUX: 'linux',
LINUX_32: 'linux_32',
LINUX_64: 'linux_64',
LINUX_ARM64: 'linux_arm64',
OSX: 'osx',
OSX_32: 'osx_32',
OSX_64: 'osx_64',
OSX_ARM64: 'osx_arm64',
WINDOWS: 'windows',
WINDOWS_32: 'windows_32',
WINDOWS_64: 'windows_64',
WINDOWS_ARM64: 'windows_arm64',
};

/**
Expand All @@ -37,9 +39,9 @@ PlatformService.detectFromRequest = function(req) {
var source = req.headers['user-agent'];
var ua = useragent.parse(source);

if (ua.isWindows) return [this.WINDOWS_32, this.WINDOWS_64];
if (ua.isWindows) return [this.WINDOWS_32, this.WINDOWS_64, this.WINDOWS_ARM64];
if (ua.isMac) return [this.OSX_64, this.OSX_ARM64]; // this.OSX_ARM64 until a bug with arm64 useragent is fixed
if (ua.isLinux64) return [this.LINUX_64, this.LINUX_32];
if (ua.isLinux64) return [this.LINUX_64, this.LINUX_32, this.LINUX_ARM64];
if (ua.isLinux) return [this.LINUX_32];
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ form(name='assetForm', role='form')
ngf-change='updateAssetName()',
ng-model='asset.file',
name='file',
ngf-accept="'.dmg,.zip,.deb,.exe,.nupkg,.blockmap'",
ngf-accept="'.dmg,.zip,.deb,.exe,.nupkg,.blockmap,.AppImage'",
ngf-max-size='500MB',
required='',
)
Expand All @@ -51,4 +51,4 @@ form(name='assetForm', role='form')
button.btn.btn-danger(type='button', ng-click='closeModal()') Cancel



8 changes: 6 additions & 2 deletions assets/js/core/data/data-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,23 @@
self.availablePlatforms = {
windows_64: 'Windows 64 bit',
windows_32: 'Windows 32 bit',
windows_arm64: 'Windows 64 bit ARM',
osx_64: 'OS X 64 bit Intel',
osx_arm64: 'OS X 64 bit ARM',
linux_64: 'Linux 64 bit',
linux_32: 'Linux 32 bit'
linux_32: 'Linux 32 bit',
linux_arm64: 'Linux 64 bit ARM'
};

self.filetypes = {
windows_64: ['.exe', '.msi'],
windows_32: ['.exe', '.msi'],
windows_arm64: ['.exe', '.msi'],
osx_64: ['.dmg', '.pkg', '.mas'],
osx_arm64: ['.dmg', '.pkg', '.mas'],
linux_64: ['.deb', '.gz', '.rpm', '.AppImage'],
linux_32: ['.deb', '.gz', '.rpm', '.AppImage']
linux_32: ['.deb', '.gz', '.rpm', '.AppImage'],
linux_arm64: ['.deb', '.gz', '.rpm', '.AppImage']
};

/**
Expand Down Expand Up @@ -520,45 +524,45 @@
};

// Process new asset/modified pushed from the server over SocketIO
$sails.on('asset', function(msg) {
if (!msg) {
return;
}
$log.log('Asset Received', msg);

const asset = normalizeAsset(msg.data);

if (!asset && msg.verb !== 'destroyed') {
$log.log('No asset provided with message. Reloading data.');
return self.initialize();
}

var notificationMessage = (asset || {}).name || '';

var versionIndex, index;

if (msg.verb === 'created') {
versionIndex = _.findIndex(self.data, {
id: asset.version.id // Sails sends the version
});

if (versionIndex === -1) {
// Our version of the database is out of sync from the remote, re-init
$log.log('Data out of sync, reloading.');
return self.initialize();
}

self.data[versionIndex].assets.unshift(asset);

Notification({
title: 'New Asset Available',
message: notificationMessage
});

$log.log('Sails sent a new asset.');

} else if (msg.verb === 'updated') {

Check notice on line 565 in assets/js/core/data/data-service.js

View check run for this annotation

codefactor.io / CodeFactor

assets/js/core/data/data-service.js#L527-L565

Complex Method
versionIndex = _.findIndex(self.data, function(version) {
index = _.findIndex(version.assets, {
id: msg.id // Sails sends back the old id for us
Expand Down
2 changes: 1 addition & 1 deletion assets/js/download/download-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ angular.module('app.releases', [])
self.platform = 'osx';
self.archs = ['64', 'arm64'];
} else {
self.archs = ['32', '64'];
self.archs = ['32', '64', 'arm64'];
}

self.setRouteParams = (channel, flavor) => {
Expand Down
41 changes: 31 additions & 10 deletions assets/js/download/download.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
.col-md-12
h2 Download our #{process.env.WEBSITE_APP_TITLE || 'Electron App'}
small.pull-right
| Channel:
| Channel:
select(
ng-model='vm.channel'
ng-options='channel for channel in vm.availableChannels'
ng-change='vm.getLatestReleases()'
)
small.pull-left
| Flavor:
| Flavor:
select(
ng-model='vm.flavor'
ng-options='flavor for flavor in vm.availableFlavors'
Expand All @@ -18,13 +18,13 @@
.row.text-center.padding-top-20(ng-if="vm.latestReleases")
.col-md-12(ng-if="vm.platform === 'osx' && vm.latestReleases['64']")
.jumbotron
h4 OS X
h4 OS X
span.text-muted 64 bit INTEL
a.btn.btn-success.btn-lg(
ng-click="vm.download(vm.latestReleases['64'])"
)
i.fa.fa-download.fa-5x
h5 {{ vm.latestReleases['64'].version }}
h5 {{ vm.latestReleases['64'].version }}
label.label.label-info(
ng-show="vm.latestReleases['64'].channel !== 'stable'"
)
Expand All @@ -38,13 +38,13 @@
)
.col-md-12(ng-if="vm.platform === 'osx' && vm.latestReleases['arm64']")
.jumbotron
h4 OS X
h4 OS X
span.text-muted 64 bit ARM
a.btn.btn-success.btn-lg(
ng-click="vm.download(vm.latestReleases['arm64'])"
)
i.fa.fa-download.fa-5x
h5 {{ vm.latestReleases['arm64'].version }}
h5 {{ vm.latestReleases['arm64'].version }}
label.label.label-info(
ng-show="vm.latestReleases['arm64'].channel !== 'stable'"
)
Expand All @@ -70,7 +70,7 @@
ng-click="vm.download(vm.latestReleases['32'])"
)
i.fa.fa-download.fa-5x
h5 {{ vm.latestReleases['32'].version }}
h5 {{ vm.latestReleases['32'].version }}
label.label.label-info(
ng-show="vm.latestReleases['32'].channel !== 'stable'"
)
Expand All @@ -91,7 +91,7 @@
ng-click="vm.download(vm.latestReleases['64'])"
)
i.fa.fa-download.fa-5x
h5 {{ vm.latestReleases['64'].version }}
h5 {{ vm.latestReleases['64'].version }}
label.label.label-info(
ng-show="vm.latestReleases['64'].channel !== 'stable'"
)
Expand All @@ -103,12 +103,33 @@
p.release-notes.text-muted(
ng-bind-html="vm.latestReleases['64'].notes"
)
div(
ng-if="vm.latestReleases['arm64']",
ng-class="vm.latestReleases['32'] || vm.latestReleases['64'] ? 'col-sm-6' : 'col-sm-12'"
)
h5.text-muted 64 bit ARM
a.btn.btn-success.btn-lg(
ng-click="vm.download(vm.latestReleases['arm64'])"
)
i.fa.fa-download.fa-5x
h5 {{ vm.latestReleases['arm64'].version }}
label.label.label-info(
ng-show="vm.latestReleases['arm64'].channel !== 'stable'"
)
| {{ vm.latestReleases['arm64'].channel }}
.padding-top-20.text-muted
span.timestamp(am-time-ago="vm.latestReleases['arm64'].createdAt")
.padding-top-20(ng-show="vm.latestReleases['arm64'].notes")
h4 Change Notes
p.release-notes.text-muted(
ng-bind-html="vm.latestReleases['arm64'].notes"
)

.row.text-center.padding-top-20(ng-if="!vm.latestReleases")
.col-md-12
h5.text-muted
| The {{ vm.flavor }} flavor has no {{ vm.channel }} releases available for {{ vm.platform }}.

.row.text-center.padding-20-0
.col-sm-8.col-sm-offset-2
h5.pointer(
Expand All @@ -120,7 +141,7 @@
div(ng-show="vm.showAllVersions")
.jumbotron(ng-repeat='version in vm.versions')
p.timestamp.text-muted(am-time-ago="version.createdAt")
h4 {{ version.name }}
h4 {{ version.name }}
label.label(
ng-class="version.channel.name === 'stable' ? 'label-success' : 'label-info'"
)
Expand Down