build: add preview channel
Signed-off-by: Grigorii K. Shartsev <[email protected]>
This commit is contained in:
1 parent
cb1f756990
commit
a5bef9e14f
13 files changed
+132
-74
No files matched your search
+8
-2
@@ -2,9 +2,15 @@
|
||||
# Set it to reuse a specific locally cloned Talk
|
||||
# Defaults to "spreed" folder in the repository root
|
||||
# Example: /var/www/nextcloud/apps-extra/spreed
|
||||
TALK_PATH=spreed
|
||||
# TALK_PATH=spreed
|
||||
|
||||
# List of hosts allowed in the Content Security Policy for `default-src` in the development server
|
||||
# Defaults to "*" which might be unsafe during development - you can set it to allow only your hosts
|
||||
# Example: https://nextcloud.local wss://signaling.nextcloud.local wss://notify_push.nextcloud.local
|
||||
NEXTCLOUD_DEV_SERVER_HOSTS=*
|
||||
# NEXTCLOUD_DEV_SERVER_HOSTS=*
|
||||
|
||||
# Application channel - stable, beta, or dev
|
||||
# Defines built-in Talk app version set in package.json
|
||||
# Beta channel is displayed on UI
|
||||
# Defaults to "dev" on local development and "stable" on the release:package script
|
||||
# CHANNEL=dev
|
||||
@@ -29,6 +29,8 @@ module.exports = {
|
||||
WELCOME_WINDOW_PRELOAD_WEBPACK_ENTRY: 'readonly',
|
||||
// Build constants
|
||||
IS_DESKTOP: 'readonly',
|
||||
__IS_DESKTOP__: 'readonly',
|
||||
__CHANNEL__: 'readonly',
|
||||
__VERSION_TAG__: 'readonly',
|
||||
__TALK_VERSION_TAG__: 'readonly',
|
||||
},
|
||||
|
||||
+3
-1
@@ -40,7 +40,9 @@
|
||||
"typecheck": "vue-tsc --noEmit"
|
||||
},
|
||||
"talk": {
|
||||
"stable": "v20.1.1"
|
||||
"stable": "v20.1.1",
|
||||
"beta": "v21.0.0-beta.2",
|
||||
"dev": "main"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/svg": "^7.4.47",
|
||||
|
||||
@@ -36,7 +36,8 @@ function help() {
|
||||
|
||||
Args:
|
||||
--help - show help
|
||||
--version - Optionally a specific Talk version/branch to build with, for example, v20.0.0-rc.1 or main. Default is package.json/talk.stable.
|
||||
--version - Optionally a specific Talk version/branch to build with, for example, v20.0.0-rc.1 or main. Default is package.json/talk.
|
||||
--channel [CHANNEL] - Release channel: stable, beta, or dev. Default is stable.
|
||||
--windows - build Windows package
|
||||
--linux - build Linux package
|
||||
--mac - build macOS package using universal architecture (recommended)
|
||||
@@ -54,7 +55,8 @@ function help() {
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
async function prepareRelease() {
|
||||
const version = argv.version ?? packageJson.talk.stable
|
||||
const CHANNEL = process.env.CHANNEL || argv.channel || 'stable'
|
||||
const TALK_VERSION = argv.version || packageJson.talk[CHANNEL]
|
||||
|
||||
// Default to the current platform
|
||||
if (!argv.windows && !argv.linux && !argv.mac && !argv['mac-x64'] && !argv['mac-arm64']) {
|
||||
@@ -62,7 +64,7 @@ async function prepareRelease() {
|
||||
argv[platform] = true
|
||||
}
|
||||
|
||||
echo`Packaging Nextcloud Talk v${packageJson.version} with Talk ${version}...`
|
||||
echo`Packaging Nextcloud Talk v${packageJson.version} with Talk ${TALK_VERSION}...`
|
||||
|
||||
// Git wrapper for Talk repository
|
||||
const gitSpreed = (command) => $`git --git-dir=${talkDotGit} --work-tree=${TALK_PATH} ${command}`
|
||||
@@ -81,22 +83,22 @@ async function prepareRelease() {
|
||||
if ((await gitSpreed(['status', '-s'])).stdout) {
|
||||
exit('❌ You have uncommitted changes in the Talk repository', 1)
|
||||
}
|
||||
echo`[3.2/5] Fetching Talk ${version} from origin`
|
||||
echo`[3.2/5] Fetching Talk ${TALK_VERSION} from origin`
|
||||
await spinner(
|
||||
`Fetching Talk ${version} from origin`,
|
||||
() => gitSpreed(['fetch', '--no-tags', '--depth=1', 'origin', 'tag', version]),
|
||||
`Fetching Talk ${TALK_VERSION} from origin`,
|
||||
() => gitSpreed(['fetch', '--no-tags', '--depth=1', 'origin', 'tag', TALK_VERSION]),
|
||||
)
|
||||
echo`[3.3/5] Checkout Talk ${version}`
|
||||
echo`[3.3/5] Checkout Talk ${TALK_VERSION}`
|
||||
await spinner(
|
||||
`Checkout Talk ${version}`,
|
||||
() => gitSpreed(['checkout', version]),
|
||||
`Checkout Talk ${TALK_VERSION}`,
|
||||
() => gitSpreed(['checkout', TALK_VERSION]),
|
||||
)
|
||||
} else {
|
||||
echo`- No Talk has been found in ${TALK_PATH}`
|
||||
echo`[3/5] Cloning Talk@${version} to ${TALK_PATH}`
|
||||
echo`[3/5] Cloning Talk@${TALK_VERSION} to ${TALK_PATH}`
|
||||
await spinner(
|
||||
`Cloning Talk@${version} to ${TALK_PATH}`,
|
||||
() => $`git clone --branch=${version} --depth=1 -- https://github.com/nextcloud/spreed ${TALK_PATH}`,
|
||||
`Cloning Talk@${TALK_VERSION} to ${TALK_PATH}`,
|
||||
() => $`git clone --branch=${TALK_VERSION} --depth=1 -- https://github.com/nextcloud/spreed ${TALK_PATH}`,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -117,6 +119,7 @@ async function prepareRelease() {
|
||||
// Build and package
|
||||
echo`[5/5] Packaging...`
|
||||
$.env.TALK_PATH = TALK_PATH
|
||||
$.env.CHANNEL = CHANNEL
|
||||
argv.windows && await spinner('Package Windows', () => $`npm run build:windows && npm run package:windows`)
|
||||
argv.linux && await spinner('Package Linux', () => $`npm run build:linux && npm run package:linux`)
|
||||
argv.mac && await spinner('Package MacOS', () => $`npm run build:mac && npm run package:mac`)
|
||||
|
||||
@@ -15,24 +15,30 @@ const packageJson = require('../../package.json')
|
||||
let cachedNewLatestVersion
|
||||
|
||||
/**
|
||||
* Request the latest release with GitHub REST API and get version from tag name
|
||||
*
|
||||
* @see https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release
|
||||
* @return {Promise<string>} Version tag, for example, v0.2.1
|
||||
* Request the latest release version of Nextcloud Talk on GitHub releases
|
||||
* @param {boolean} beta - Whether to use beta release channel
|
||||
* @return {Promise<string>} Version tag, for example, v1.0.2-beta
|
||||
*/
|
||||
async function getLatestReleaseVersion() {
|
||||
function getLatestReleaseVersion(beta = false) {
|
||||
return beta ? getLatestBetaReleaseVersion() : getLatestStableReleaseVersion()
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the latest beta release version of Nextcloud Talk on GitHub releases
|
||||
* @see https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28
|
||||
* @return {Promise<string>} Version tag, for example, v1.0.2-beta
|
||||
*/
|
||||
async function getLatestBetaReleaseVersion() {
|
||||
try {
|
||||
const response = await fetch('https://api.github.com/repos/nextcloud-releases/talk-desktop/releases/latest', {
|
||||
const response = await fetch('https://api.github.com/repos/nextcloud-releases/talk-desktop/releases', {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
},
|
||||
})
|
||||
const data = await response.json()
|
||||
const releases = await response.json()
|
||||
if (response.ok) {
|
||||
return data?.tag_name
|
||||
} else {
|
||||
console.error(data)
|
||||
return semver.maxSatisfying(releases.map((release) => release.tag_name), '*', { includePrerelease: true })
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
@@ -40,8 +46,30 @@ async function getLatestReleaseVersion() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Show native notification about new version. It opens the releases page on click
|
||||
*
|
||||
* Request the latest stable release version of Nextcloud Talk on GitHub releases
|
||||
* @see https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release
|
||||
* @return {Promise<string>} Version tag, for example, v1.0.2
|
||||
*/
|
||||
async function getLatestStableReleaseVersion() {
|
||||
try {
|
||||
const response = await fetch('https://api.github.com/repos/nextcloud-releases/talk-desktop/releases/latest', {
|
||||
headers: {
|
||||
Accept: 'application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28',
|
||||
},
|
||||
})
|
||||
const release = await response.json()
|
||||
if (response.ok) {
|
||||
return release.tag_name
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show native notification about the new version.
|
||||
* It opens the release page on click.
|
||||
* @param {string} version - New version
|
||||
*/
|
||||
function notifyAboutNewVersion(version) {
|
||||
@@ -50,7 +78,7 @@ function notifyAboutNewVersion(version) {
|
||||
body: `Nextcloud Talk ${version} is now available to download from the release page. Click to open the page.`,
|
||||
})
|
||||
notification.on('click', () => {
|
||||
shell.openExternal('https://github.com/nextcloud-releases/talk-desktop/releases/latest')
|
||||
shell.openExternal(`https://github.com/nextcloud-releases/talk-desktop/releases/${version}`)
|
||||
})
|
||||
notification.show()
|
||||
}
|
||||
@@ -64,8 +92,8 @@ function notifyAboutNewVersion(version) {
|
||||
* @return {Promise<boolean>} true if there is a new version
|
||||
*/
|
||||
async function checkForNewVersion({ showNotification = false, forceRequest = false }) {
|
||||
// Request new version or get cached
|
||||
const latest = (!forceRequest && cachedNewLatestVersion) ? cachedNewLatestVersion : await getLatestReleaseVersion()
|
||||
// Request a new version or get cached
|
||||
const latest = (!forceRequest && cachedNewLatestVersion) ? cachedNewLatestVersion : await getLatestReleaseVersion(__CHANNEL__ === 'beta')
|
||||
|
||||
// Something goes wrong... No worries, we will try again later.
|
||||
if (!latest) {
|
||||
@@ -119,9 +147,5 @@ function stopReleaseNotificationScheduler() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getLatestReleaseVersion,
|
||||
notifyAboutNewVersion,
|
||||
checkForNewVersion,
|
||||
setupReleaseNotificationScheduler,
|
||||
stopReleaseNotificationScheduler,
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import { appData } from '../../app/AppData.js'
|
||||
import { MIN_REQUIRED_NEXTCLOUD_VERSION, MIN_REQUIRED_TALK_VERSION } from '../../constants.js'
|
||||
import { refetchAppData } from '../../app/appData.service.js'
|
||||
|
||||
const isPreview = false
|
||||
const channel = __CHANNEL__
|
||||
|
||||
const version = window.TALK_DESKTOP.packageInfo.version
|
||||
const rawServerUrl = ref('')
|
||||
@@ -183,7 +183,7 @@ async function login() {
|
||||
</form>
|
||||
</div>
|
||||
<div class="spacer">
|
||||
<footer v-if="isPreview" class="footer">
|
||||
<footer v-if="channel !== 'stable'" class="footer">
|
||||
Nextcloud Talk Desktop {{ version }}
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Vendored
+3
@@ -46,6 +46,8 @@ declare module '@nextcloud/vue/dist/Composables/useHotKey.js' {
|
||||
|
||||
// Built-time constants
|
||||
declare const IS_DESKTOP: true
|
||||
declare const __IS_DESKTOP__: true
|
||||
declare const __CHANNEL__: 'stable' | 'beta'
|
||||
declare const __VERSION_TAG__: string
|
||||
declare const __TALK_VERSION_TAG__: string
|
||||
|
||||
@@ -88,6 +90,7 @@ declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
NODE_ENV: 'production' | 'development'
|
||||
CHANNEL: 'stable' | 'beta'
|
||||
NEXTCLOUD_DEV_SERVER_HOSTS: string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export function generateDiagnosisReport() {
|
||||
},
|
||||
server: appData.credentials
|
||||
? {
|
||||
channel: __CHANNEL__,
|
||||
version: appData.version.nextcloud?.string ?? 'Not available',
|
||||
talkVersion: appData.version.talk ?? 'Not available',
|
||||
notifications: !!(appData.capabilities as any)?.notifications, // eslint-disable-line
|
||||
@@ -55,6 +56,7 @@ export function generateDiagnosisReportMD() {
|
||||
${table('Nextcloud Talk Desktop', {
|
||||
Version: report.talkDesktop.version,
|
||||
'Built-in Talk version': report.talkDesktop.builtInTalkVersion,
|
||||
'Release channel': __CHANNEL__,
|
||||
'Operating system': report.platform.os,
|
||||
'Executable Path': report.talkDesktop.execPath,
|
||||
...(window.systemInfo.isLinux
|
||||
|
||||
@@ -16,7 +16,7 @@ useUserStatusStore()
|
||||
useUserStatusHeartbeat()
|
||||
useAppConfigStore()
|
||||
|
||||
const isPreview = false
|
||||
const channel = __CHANNEL__
|
||||
|
||||
// TODO: add a proper type for userMetadata
|
||||
const user = appData.userMetadata! as { id: string; 'display-name': string }
|
||||
@@ -44,12 +44,15 @@ useHotKey('Escape', pushToRoot)
|
||||
<header id="header" class="title-bar">
|
||||
<div class="title-bar__inner">
|
||||
<div v-if="!OS.isMac"
|
||||
class="title-bar__title-wrapper"
|
||||
class="title-bar__title"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click="pushToRoot">
|
||||
<span class="title-bar__title">Nextcloud Talk</span>
|
||||
<span v-if="isPreview" class="title-bar__preview-badge">Preview</span>
|
||||
Nextcloud Talk
|
||||
</div>
|
||||
|
||||
<div v-if="channel !== 'stable'" class="title-bar__channel">
|
||||
{{ channel }}
|
||||
</div>
|
||||
|
||||
<div class="spacer" />
|
||||
@@ -75,14 +78,14 @@ useHotKey('Escape', pushToRoot)
|
||||
}
|
||||
|
||||
.title-bar__inner {
|
||||
padding: 0 calc(var(--body-container-margin) + 4px) 0 var(--body-container-margin);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
/* Save space for native title bar buttons */
|
||||
/* If there is no system area - inline with navigation items */
|
||||
/* Note: titlebar-area-x always represents left offset */
|
||||
/* Logical properties cannot be used here */
|
||||
margin-left: env(titlebar-area-x, 0);
|
||||
margin-left: max(env(titlebar-area-x, 0), 3 * var(--default-grid-baseline));
|
||||
margin-right: auto;
|
||||
width: env(titlebar-area-width, 100%);
|
||||
}
|
||||
@@ -93,31 +96,23 @@ useHotKey('Escape', pushToRoot)
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.title-bar__title-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
margin-inline-start: calc(var(--default-grid-baseline) * 3);
|
||||
.title-bar__title {
|
||||
margin-inline-end: calc(var(--default-grid-baseline) * 2);
|
||||
position: relative;
|
||||
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
&:focus-visible::after {
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.title-bar__title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.title-bar__preview-badge {
|
||||
margin-inline-start: var(--default-grid-baseline);
|
||||
.title-bar__channel {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex: 1 0 auto;
|
||||
height: 100%;
|
||||
/* Allow to drag the window using header */
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
</style>
|
||||
@@ -119,6 +119,10 @@
|
||||
right: 15%;
|
||||
top: -80%;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<title>Nextcloud Talk</title>
|
||||
</head>
|
||||
@@ -136,6 +140,7 @@
|
||||
<div class="cloud" style="--height: 40px; animation: animateCloud 10s linear infinite; top: 100px; left: 150px"></div>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
<div class="footer"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -13,6 +13,10 @@ import { applyAxiosInterceptors } from '../shared/setupWebPage.js'
|
||||
const quitButton = document.querySelector('.quit')
|
||||
quitButton.addEventListener('click', () => window.TALK_DESKTOP.quit())
|
||||
|
||||
if (__CHANNEL__ !== 'stable') {
|
||||
document.querySelector('.footer').textContent = __VERSION_TAG__
|
||||
}
|
||||
|
||||
window.TALK_DESKTOP.getSystemInfo().then(os => {
|
||||
quitButton.classList.remove('hidden')
|
||||
if (os.isMac) {
|
||||
|
||||
+27
-18
@@ -2,24 +2,33 @@
|
||||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
const { DefinePlugin } = require('webpack')
|
||||
|
||||
const CHANNEL = process.env.CHANNEL ?? 'dev'
|
||||
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /native_modules[/\\].+\.node$/,
|
||||
use: 'node-loader',
|
||||
},
|
||||
{
|
||||
test: /[/\\]node_modules[/\\].+\.(m?js|node)$/,
|
||||
parser: { amd: false },
|
||||
use: {
|
||||
loader: '@vercel/webpack-asset-relocator-loader',
|
||||
options: {
|
||||
outputAssetBase: 'native_modules',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /native_modules[/\\].+\.node$/,
|
||||
use: 'node-loader',
|
||||
},
|
||||
{
|
||||
test: /[/\\]node_modules[/\\].+\.(m?js|node)$/,
|
||||
parser: { amd: false },
|
||||
use: {
|
||||
loader: '@vercel/webpack-asset-relocator-loader',
|
||||
options: {
|
||||
outputAssetBase: 'native_modules',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new DefinePlugin({
|
||||
__CHANNEL__: JSON.stringify(CHANNEL),
|
||||
}),
|
||||
],
|
||||
}
|
||||
@@ -11,6 +11,7 @@ const webpack = require('webpack')
|
||||
const { mergeWithRules } = require('webpack-merge')
|
||||
|
||||
const TALK_PATH = path.resolve(__dirname, process.env.TALK_PATH ?? 'spreed')
|
||||
const CHANNEL = process.env.CHANNEL ?? 'dev'
|
||||
|
||||
/**
|
||||
* appName and appVersion constants are set by process.env.npm_package_* in @nextcloud/webpack-vue-config.
|
||||
@@ -93,6 +94,7 @@ const webpackRendererConfig = mergeWithRules({
|
||||
options: 'replace',
|
||||
},
|
||||
},
|
||||
plugins: 'append',
|
||||
})(commonTalkWebpackConfig, {
|
||||
output: {
|
||||
assetModuleFilename: '[name][ext]?v=[contenthash]',
|
||||
@@ -162,6 +164,7 @@ const webpackRendererConfig = mergeWithRules({
|
||||
|
||||
new webpack.DefinePlugin({
|
||||
IS_DESKTOP: true,
|
||||
__CHANNEL__: JSON.stringify(CHANNEL),
|
||||
__VERSION_TAG__: JSON.stringify(getFullVersion()),
|
||||
__TALK_VERSION_TAG__: JSON.stringify(getFullVersion(TALK_PATH)),
|
||||
'process.env.NEXTCLOUD_DEV_SERVER_HOSTS': JSON.stringify(process.env.NEXTCLOUD_DEV_SERVER_HOSTS),
|
||||
|
||||
Reference in new issue
Block a user