Ensure adhoc builds expire correctly
This commit is contained in:
parent
423a92df4d
commit
9bec59b70a
7 changed files with 39 additions and 16 deletions
|
@ -7,7 +7,7 @@ import { writeFileSync } from 'fs';
|
||||||
|
|
||||||
import { DAY } from '../util/durations';
|
import { DAY } from '../util/durations';
|
||||||
import { version } from '../../package.json';
|
import { version } from '../../package.json';
|
||||||
import { isAdhoc } from '../util/version';
|
import { isNotUpdatable } from '../util/version';
|
||||||
|
|
||||||
const unixTimestamp = parseInt(
|
const unixTimestamp = parseInt(
|
||||||
process.env.SOURCE_DATE_EPOCH ||
|
process.env.SOURCE_DATE_EPOCH ||
|
||||||
|
@ -16,7 +16,10 @@ const unixTimestamp = parseInt(
|
||||||
);
|
);
|
||||||
const buildCreation = unixTimestamp * 1000;
|
const buildCreation = unixTimestamp * 1000;
|
||||||
|
|
||||||
const buildExpiration = buildCreation + DAY * 90;
|
// NB: Build expirations are also determined via users' auto-update settings; see
|
||||||
|
// getExpirationTimestamp
|
||||||
|
const validDuration = isNotUpdatable(version) ? DAY * 30 : DAY * 90;
|
||||||
|
const buildExpiration = buildCreation + validDuration;
|
||||||
|
|
||||||
const localProductionPath = join(
|
const localProductionPath = join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
@ -26,7 +29,7 @@ const localProductionPath = join(
|
||||||
const localProductionConfig = {
|
const localProductionConfig = {
|
||||||
buildCreation,
|
buildCreation,
|
||||||
buildExpiration,
|
buildExpiration,
|
||||||
...(isAdhoc(version) ? { updatesEnabled: false } : {}),
|
...(isNotUpdatable(version) ? { updatesEnabled: false } : {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
|
|
|
@ -10,6 +10,7 @@ import * as log from '../../logging/log';
|
||||||
import type { StateType } from '../reducer';
|
import type { StateType } from '../reducer';
|
||||||
import type { ExpirationStateType } from '../ducks/expiration';
|
import type { ExpirationStateType } from '../ducks/expiration';
|
||||||
import { getRemoteBuildExpiration, getAutoDownloadUpdate } from './items';
|
import { getRemoteBuildExpiration, getAutoDownloadUpdate } from './items';
|
||||||
|
import { isNotUpdatable } from '../../util/version';
|
||||||
|
|
||||||
const NINETY_ONE_DAYS = 91 * DAY;
|
const NINETY_ONE_DAYS = 91 * DAY;
|
||||||
const THIRTY_ONE_DAYS = 31 * DAY;
|
const THIRTY_ONE_DAYS = 31 * DAY;
|
||||||
|
@ -32,7 +33,8 @@ export const getExpirationTimestamp = createSelector(
|
||||||
remoteBuildExpiration: number | undefined,
|
remoteBuildExpiration: number | undefined,
|
||||||
autoDownloadUpdate: boolean
|
autoDownloadUpdate: boolean
|
||||||
): number => {
|
): number => {
|
||||||
const localBuildExpiration = autoDownloadUpdate
|
const localBuildExpiration =
|
||||||
|
isNotUpdatable(window.getVersion()) || autoDownloadUpdate
|
||||||
? buildExpiration
|
? buildExpiration
|
||||||
: buildExpiration - SIXTY_DAYS;
|
: buildExpiration - SIXTY_DAYS;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { getPreferredReactionEmoji as getPreferredReactionEmojiFromStoredValue }
|
||||||
import { DurationInSeconds } from '../../util/durations';
|
import { DurationInSeconds } from '../../util/durations';
|
||||||
import * as Bytes from '../../Bytes';
|
import * as Bytes from '../../Bytes';
|
||||||
import { contactByEncryptedUsernameRoute } from '../../util/signalRoutes';
|
import { contactByEncryptedUsernameRoute } from '../../util/signalRoutes';
|
||||||
|
import { isNotUpdatable } from '../../util/version';
|
||||||
|
|
||||||
const DEFAULT_PREFERRED_LEFT_PANE_WIDTH = 320;
|
const DEFAULT_PREFERRED_LEFT_PANE_WIDTH = 320;
|
||||||
|
|
||||||
|
@ -215,8 +216,13 @@ export const getRemoteBuildExpiration = createSelector(
|
||||||
|
|
||||||
export const getAutoDownloadUpdate = createSelector(
|
export const getAutoDownloadUpdate = createSelector(
|
||||||
getItems,
|
getItems,
|
||||||
(state: ItemsStateType): boolean =>
|
(state: ItemsStateType): boolean => {
|
||||||
Boolean(state['auto-download-update'] ?? true)
|
if (isNotUpdatable(window.getVersion())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Boolean(state['auto-download-update'] ?? true);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getTextFormattingEnabled = createSelector(
|
export const getTextFormattingEnabled = createSelector(
|
||||||
|
|
|
@ -5,7 +5,7 @@ import semver from 'semver';
|
||||||
|
|
||||||
import type { OSType } from '../util/os/shared';
|
import type { OSType } from '../util/os/shared';
|
||||||
import { SystemTraySetting } from './SystemTraySetting';
|
import { SystemTraySetting } from './SystemTraySetting';
|
||||||
import { isProduction } from '../util/version';
|
import { isNotUpdatable, isProduction } from '../util/version';
|
||||||
|
|
||||||
const MIN_WINDOWS_VERSION = '8.0.0';
|
const MIN_WINDOWS_VERSION = '8.0.0';
|
||||||
|
|
||||||
|
@ -56,8 +56,15 @@ export const isMinimizeToAndStartInSystemTraySupported = (
|
||||||
OS: OSType
|
OS: OSType
|
||||||
): boolean => !OS.isWindows() && isSystemTraySupported(OS);
|
): boolean => !OS.isWindows() && isSystemTraySupported(OS);
|
||||||
|
|
||||||
export const isAutoDownloadUpdatesSupported = (OS: OSType): boolean =>
|
export const isAutoDownloadUpdatesSupported = (
|
||||||
OS.isWindows() || OS.isMacOS();
|
OS: OSType,
|
||||||
|
appVersion: string
|
||||||
|
): boolean => {
|
||||||
|
if (isNotUpdatable(appVersion)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return OS.isWindows() || OS.isMacOS();
|
||||||
|
};
|
||||||
|
|
||||||
export const shouldHideExpiringMessageBody = (
|
export const shouldHideExpiringMessageBody = (
|
||||||
OS: OSType,
|
OS: OSType,
|
||||||
|
|
|
@ -28,10 +28,10 @@ import { strictAssert } from '../util/assert';
|
||||||
import { drop } from '../util/drop';
|
import { drop } from '../util/drop';
|
||||||
import * as durations from '../util/durations';
|
import * as durations from '../util/durations';
|
||||||
import {
|
import {
|
||||||
isAdhoc,
|
|
||||||
isAlpha,
|
isAlpha,
|
||||||
isAxolotl,
|
isAxolotl,
|
||||||
isBeta,
|
isBeta,
|
||||||
|
isNotUpdatable,
|
||||||
isStaging,
|
isStaging,
|
||||||
} from '../util/version';
|
} from '../util/version';
|
||||||
|
|
||||||
|
@ -527,9 +527,9 @@ export abstract class Updater {
|
||||||
async #checkForUpdates(
|
async #checkForUpdates(
|
||||||
checkType: CheckType
|
checkType: CheckType
|
||||||
): Promise<UpdateInformationType | undefined> {
|
): Promise<UpdateInformationType | undefined> {
|
||||||
if (isAdhoc(packageJson.version)) {
|
if (isNotUpdatable(packageJson.version)) {
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
'checkForUpdates: not checking for updates, this is an adhoc build'
|
'checkForUpdates: not checking for updates, this is not an updatable build'
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -950,7 +950,7 @@ export function getUpdatesFileName(): string {
|
||||||
|
|
||||||
function getChannel(): string {
|
function getChannel(): string {
|
||||||
const { version } = packageJson;
|
const { version } = packageJson;
|
||||||
if (isAdhoc(version)) {
|
if (isNotUpdatable(version)) {
|
||||||
// we don't want ad hoc versions to update
|
// we don't want ad hoc versions to update
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ export const isAxolotl = (version: string): boolean =>
|
||||||
export const isAdhoc = (version: string): boolean =>
|
export const isAdhoc = (version: string): boolean =>
|
||||||
semver.parse(version)?.prerelease[0] === 'adhoc';
|
semver.parse(version)?.prerelease[0] === 'adhoc';
|
||||||
|
|
||||||
|
export const isNotUpdatable = (version: string): boolean => isAdhoc(version);
|
||||||
|
|
||||||
export const isStaging = (version: string): boolean =>
|
export const isStaging = (version: string): boolean =>
|
||||||
semver.parse(version)?.prerelease[0] === 'staging';
|
semver.parse(version)?.prerelease[0] === 'staging';
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,10 @@ async function renderPreferences() {
|
||||||
setGlobalDefaultConversationColor: ipcSetGlobalDefaultConversationColor,
|
setGlobalDefaultConversationColor: ipcSetGlobalDefaultConversationColor,
|
||||||
|
|
||||||
// Limited support features
|
// Limited support features
|
||||||
isAutoDownloadUpdatesSupported: Settings.isAutoDownloadUpdatesSupported(OS),
|
isAutoDownloadUpdatesSupported: Settings.isAutoDownloadUpdatesSupported(
|
||||||
|
OS,
|
||||||
|
MinimalSignalContext.getVersion()
|
||||||
|
),
|
||||||
isAutoLaunchSupported: Settings.isAutoLaunchSupported(OS),
|
isAutoLaunchSupported: Settings.isAutoLaunchSupported(OS),
|
||||||
isHideMenuBarSupported: Settings.isHideMenuBarSupported(OS),
|
isHideMenuBarSupported: Settings.isHideMenuBarSupported(OS),
|
||||||
isNotificationAttentionSupported: Settings.isDrawAttentionSupported(OS),
|
isNotificationAttentionSupported: Settings.isDrawAttentionSupported(OS),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue