From a34faefce0b184f0794bbcea50d7d6cba671083d Mon Sep 17 00:00:00 2001 From: hazzuk Date: Fri, 24 Jan 2025 21:39:33 +0000 Subject: [PATCH 1/8] chore(package.json): change values to elecord --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8c48d1d5672..e55ae7a7039 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "elecord-web", - "version": "1.11.90", + "version": "2.0.1", "description": "Privacy focused chat app for gamers", "author": "hazzuk", "repository": { "type": "git", "url": "https://github.com/elecordapp/elecord-web" }, - "license": "SEE LICENSE IN README.md", + "license": "AGPL-3.0-only", "files": [ "lib", "res", From 8b6f58337ef384c7f5de6ea76510afbe6046230b Mon Sep 17 00:00:00 2001 From: hazzuk Date: Fri, 24 Jan 2025 21:40:25 +0000 Subject: [PATCH 2/8] feat(authfooter): dynamically display app version --- src/components/views/auth/AuthFooter.tsx | 32 ++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/components/views/auth/AuthFooter.tsx b/src/components/views/auth/AuthFooter.tsx index 9eae8bb7262..4e660249598 100644 --- a/src/components/views/auth/AuthFooter.tsx +++ b/src/components/views/auth/AuthFooter.tsx @@ -7,16 +7,44 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com Please see LICENSE files in the repository root for full details. */ -import React, { ReactElement } from "react"; +import React, { ReactElement, useEffect, useState } from "react"; import SdkConfig from "../../../SdkConfig"; import { _t } from "../../../languageHandler"; +const fetchVersion = async (): Promise => { + try { + const res = await fetch("version", { + method: "GET", + cache: "no-cache", + }); + if (res.ok) { + const text = await res.text(); + return text.trim().replace(/^v/, ""); // Normalize version if it starts with 'v' + } + console.error("Failed to fetch version: ", res.status); + return "unknown"; + } catch (error) { + console.error("Error fetching version: ", error); + return "unknown"; + } +}; + const AuthFooter = (): ReactElement => { + const [version, setVersion] = useState(""); + + useEffect(() => { + const loadVersion = async () => { + const fetchedVersion = await fetchVersion(); + setVersion(fetchedVersion); + }; + loadVersion(); + }, []); + const brandingConfig = SdkConfig.getObject("branding"); const links = brandingConfig?.get("auth_footer_links") ?? [ { text: "About", url: "https://elecord.app" }, - { text: "v2.0.1", url: "https://github.com/elecordapp/elecord-web/releases" }, + { text: version ? `v${version}` : "Loading...", url: "https://github.com/elecordapp/elecord-web/releases" }, { text: "Privacy", url: "https://github.com/elecordapp/elecord-web/blob/master/PRIVACY.md" }, { text: "GitHub", url: "https://github.com/elecordapp/elecord-web" }, ]; From c49ea5beef19ce842e7b68a47e86b5488a4f7c26 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sat, 25 Jan 2025 03:18:44 +0000 Subject: [PATCH 3/8] fix(settings): remove static version number --- src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx index 96a713e4e82..db3a4d86932 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx @@ -64,7 +64,7 @@ export default class HelpUserSettingsTab extends React.Component const cryptoVersion = this.context.getCrypto()?.getVersion() ?? ""; return { - appVersion: `${_t("setting|help_about|brand_version", { brand })} 2.0.1 (${appVersion})`, + appVersion: `${_t("setting|help_about|brand_version", { brand })} (${appVersion})`, cryptoVersion: `${_t("setting|help_about|crypto_version")} ${cryptoVersion}`, }; } From dccdfbb202c8aa5468c46cb7ff7fd2dbfa00a324 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sat, 25 Jan 2025 03:19:19 +0000 Subject: [PATCH 4/8] fix(webpack.config): switch domain to elecord --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 91606e34d07..254b8b26298 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -18,7 +18,7 @@ const VersionFilePlugin = require("webpack-version-file-plugin"); dotenv.config(); let ogImageUrl = process.env.RIOT_OG_IMAGE_URL; -if (!ogImageUrl) ogImageUrl = "https://app.element.io/themes/element/img/logos/opengraph.png"; +if (!ogImageUrl) ogImageUrl = "https://web.elecord.app/themes/element/img/logos/opengraph.png"; const cssThemes = { // CSS themes From c77a3c6b72309110d4796b901140586be6b033fc Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sat, 25 Jan 2025 03:17:42 +0000 Subject: [PATCH 5/8] fix(authfooter): don't use a prefix for versioning --- src/components/views/auth/AuthFooter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/auth/AuthFooter.tsx b/src/components/views/auth/AuthFooter.tsx index 4e660249598..26792d30263 100644 --- a/src/components/views/auth/AuthFooter.tsx +++ b/src/components/views/auth/AuthFooter.tsx @@ -44,7 +44,7 @@ const AuthFooter = (): ReactElement => { const brandingConfig = SdkConfig.getObject("branding"); const links = brandingConfig?.get("auth_footer_links") ?? [ { text: "About", url: "https://elecord.app" }, - { text: version ? `v${version}` : "Loading...", url: "https://github.com/elecordapp/elecord-web/releases" }, + { text: version ? `${version}` : "Loading...", url: "https://github.com/elecordapp/elecord-web/releases" }, { text: "Privacy", url: "https://github.com/elecordapp/elecord-web/blob/master/PRIVACY.md" }, { text: "GitHub", url: "https://github.com/elecordapp/elecord-web" }, ]; From 76b037f7db0e087abcefb1dc060cfd1392cfd012 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sat, 25 Jan 2025 03:39:35 +0000 Subject: [PATCH 6/8] chore(scripts): shorten git version to match github --- scripts/get-version-from-git.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/get-version-from-git.sh b/scripts/get-version-from-git.sh index c8459dba445..ef6be6294ca 100755 --- a/scripts/get-version-from-git.sh +++ b/scripts/get-version-from-git.sh @@ -6,6 +6,6 @@ set -e # Since the deps are fetched from git, we can rev-parse -JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=12 HEAD) -VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop +JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=7 HEAD) +VECTOR_SHA=$(git rev-parse --short=7 HEAD) # use the ACTUAL SHA rather than assume develop echo $VECTOR_SHA-js-$JSSDK_SHA From 3639173eb1cb7acac4a9529e15ad5e5282af0211 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sat, 25 Jan 2025 03:47:17 +0000 Subject: [PATCH 7/8] chore(scripts): on release use standard version --- scripts/package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package.sh b/scripts/package.sh index e7f54d1a5cc..0b4b3e208d7 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -2,7 +2,7 @@ set -e -if [ -n "$DIST_VERSION" ]; then +if [ -n "$DIST_VERSION" ] && [ "$GITHUB_REF_NAME" != "release" ]; then version=$DIST_VERSION else version=`git describe --dirty --tags || echo unknown` From 77d5ba9c4ca88175e34a225f87be62c8dcccac38 Mon Sep 17 00:00:00 2001 From: hazzuk Date: Sun, 26 Jan 2025 00:02:26 +0000 Subject: [PATCH 8/8] fix(github): use latest commit sha For pull requests, GitHub Actions checks out the repo by simulating a merge commit of the PR. But we always want the SHA of the last commit, not the simulated merge commit. --- .github/workflows/build.yml | 1 + scripts/get-version-from-git.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2cc3dad7b1..44f7eb2289b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ env: # These must be set for fetchdep.sh to get the right branch REPOSITORY: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }} + COMMIT_SHA: ${{ github.event.pull_request.head.sha }} permissions: {} # No permissions required jobs: build: diff --git a/scripts/get-version-from-git.sh b/scripts/get-version-from-git.sh index ef6be6294ca..8641ab0ca51 100755 --- a/scripts/get-version-from-git.sh +++ b/scripts/get-version-from-git.sh @@ -7,5 +7,6 @@ set -e # Since the deps are fetched from git, we can rev-parse JSSDK_SHA=$(git -C node_modules/matrix-js-sdk rev-parse --short=7 HEAD) -VECTOR_SHA=$(git rev-parse --short=7 HEAD) # use the ACTUAL SHA rather than assume develop -echo $VECTOR_SHA-js-$JSSDK_SHA +#VECTOR_SHA=$(git rev-parse --short=7 HEAD) # use the ACTUAL SHA rather than assume develop +#echo $VECTOR_SHA-js-$JSSDK_SHA +echo "${COMMIT_SHA:0:7}-js-$JSSDK_SHA"