Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

898 B
Raw Blame
const prereleasePattern = /-(?:alpha|beta|rc)(?:[.-]|\d|$)/i;

const getAppleSiliconDownloadURL = (version) => {
    const packageName = `siyuan-${version}-mac-arm64.dmg`;
    if (prereleasePattern.test(version)) {
        return `https://github.com/siyuan-note/siyuan/releases/download/v${version}/${packageName}`;
    }
    return `https://release.liuyun.io/siyuan/${packageName}`;
};

const shouldDownloadAppleSilicon = (response) => response === 0;

const shouldShowAppleSiliconWarning = ({
    isDevelopment,
    isPackaged,
    platform,
    runningUnderARM64Translation,
    simulateRosetta,
}) => {
    if (!isPackaged && isDevelopment && simulateRosetta) {
        return true;
    }
    return isPackaged && platform === "darwin" && runningUnderARM64Translation;
};

module.exports = {
    getAppleSiliconDownloadURL,
    shouldDownloadAppleSilicon,
    shouldShowAppleSiliconWarning,
};