From 25d437c0463d0d33640bf6a6694ee103393cff64 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Mon, 3 Apr 2023 21:23:47 -0700 Subject: [PATCH 1/4] fixed missing account reset lost in refactor --- net/web/src/access/login/useLogin.hook.js | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/net/web/src/access/login/useLogin.hook.js b/net/web/src/access/login/useLogin.hook.js index 0672a791..3774103a 100644 --- a/net/web/src/access/login/useLogin.hook.js +++ b/net/web/src/access/login/useLogin.hook.js @@ -1,7 +1,7 @@ import { useContext, useState, useEffect } from 'react'; import { AppContext } from 'context/AppContext'; import { getAvailable } from 'api/getAvailable'; -import { useNavigate } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; export function useLogin() { @@ -14,6 +14,7 @@ export function useLogin() { }); const navigate = useNavigate(); + const { search } = useLocation(); const app = useContext(AppContext); const updateState = (value) => { @@ -69,6 +70,29 @@ export function useLogin() { // eslint-disable-next-line }, []) + const access = async (token) => { + if (!state.busy) { + updateState({ busy: true }); + try { + await app.actions.access(token); + } + catch (err) { + console.log(err); + updateState({ busy: false }); + throw new Error('access failed: check your token'); + } + updateState({ busy: false }); + } + } + + useEffect(() => { + let params = new URLSearchParams(search); + let token = params.get("access"); + if (token) { + access(token); + } + }, []) + return { state, actions }; } From 2bd2cac961b8005a59ed28b9f83c2b77f36006b2 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Mon, 3 Apr 2023 21:28:35 -0700 Subject: [PATCH 2/4] fixing build with lint ignore --- net/web/src/access/login/useLogin.hook.js | 1 + 1 file changed, 1 insertion(+) diff --git a/net/web/src/access/login/useLogin.hook.js b/net/web/src/access/login/useLogin.hook.js index 3774103a..f9be90d0 100644 --- a/net/web/src/access/login/useLogin.hook.js +++ b/net/web/src/access/login/useLogin.hook.js @@ -91,6 +91,7 @@ export function useLogin() { if (token) { access(token); } + // eslint-disable-next-line }, []) return { state, actions }; From 94776a2874292cc971a4d89a6a205c1a816abc41 Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Tue, 4 Apr 2023 21:32:27 -0700 Subject: [PATCH 3/4] prepending https to shortened urls --- .../session/conversation/topicItem/useTopicItem.hook.js | 9 ++++++--- net/web/src/session/conversation/useConversation.hook.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js b/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js index e47e0b9b..dc7e21a3 100644 --- a/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js +++ b/app/mobile/src/session/conversation/topicItem/useTopicItem.hook.js @@ -200,21 +200,24 @@ export function useTopicItem(item, hosting, remove, contentKey) { }; const clickableText = (text) => { - var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol + const urlPatternn = new RegExp('^(https?:\\/\\/)?'+ // protocol '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string '(\\#[-a-z\\d_]*)?$','i'); // fragment locator + const hostPattern = new RegExp('^https?:\\/\\/', 'i'); + let clickable = []; let group = ''; const words = text == null ? [''] : text.split(' '); words.forEach((word, index) => { - if (!!pattern.test(word)) { + if (!!urlPatternn.test(word)) { clickable.push({ group }); group = ''; - clickable.push( Linking.openURL(sanitizeUrl(word))} style={{ fontStyle: 'italic' }}>{ sanitizeUrl(word) + ' ' }); + const url = !!hostPattern.test(word) ? word : `https://${word}`; + clickable.push( Linking.openURL(sanitizeUrl(url))} style={{ fontStyle: 'italic' }}>{ sanitizeUrl(word) + ' ' }); } else { group += `${word} `; diff --git a/net/web/src/session/conversation/useConversation.hook.js b/net/web/src/session/conversation/useConversation.hook.js index ff1608b4..a8783b8f 100644 --- a/net/web/src/session/conversation/useConversation.hook.js +++ b/net/web/src/session/conversation/useConversation.hook.js @@ -134,21 +134,24 @@ export function useConversation(cardId, channelId) { }, [state.contentKey]); const clickableText = (text) => { - var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol + const urlPattern = new RegExp('^(https?:\\/\\/)?'+ // protocol '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string '(\\#[-a-z\\d_]*)?$','i'); // fragment locator + const hostPattern = new RegExp('^https?:\\/\\/', 'i'); + let group = ''; let clickable = []; const words = text == null ? '' : DOMPurify.sanitize(text).split(' '); words.forEach((word, index) => { - if (!!pattern.test(word)) { + if (!!urlPattern.test(word)) { clickable.push({ group }); group = ''; - clickable.push({ `${word} ` }); + const url = !!hostPattern.test(word) ? word : `https://${word}`; + clickable.push({ `${word} ` }); } else { group += `${word} `; From d9bd196db68290989675214bcf590bfe000a03a1 Mon Sep 17 00:00:00 2001 From: balzack Date: Tue, 4 Apr 2023 22:32:44 -0700 Subject: [PATCH 4/4] resetting build number on new version release --- app/mobile/ios/Databag.xcodeproj/project.pbxproj | 12 ++++++------ app/mobile/ios/Databag/Info.plist | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/mobile/ios/Databag.xcodeproj/project.pbxproj b/app/mobile/ios/Databag.xcodeproj/project.pbxproj index c36d2958..6c790877 100644 --- a/app/mobile/ios/Databag.xcodeproj/project.pbxproj +++ b/app/mobile/ios/Databag.xcodeproj/project.pbxproj @@ -507,7 +507,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements; - CURRENT_PROJECT_VERSION = 34; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 3P65PQ7SUR; ENABLE_BITCODE = NO; INFOPLIST_FILE = Databag/Info.plist; @@ -516,7 +516,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.9; + MARKETING_VERSION = 1.10; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -541,7 +541,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements; - CURRENT_PROJECT_VERSION = 34; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 3P65PQ7SUR; INFOPLIST_FILE = Databag/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Databag; @@ -549,7 +549,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.9; + MARKETING_VERSION = 1.10; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -571,7 +571,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -643,7 +643,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; + CLANG_CXX_LANGUAGE_STANDARD = "c++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/app/mobile/ios/Databag/Info.plist b/app/mobile/ios/Databag/Info.plist index 6af1efa9..208d2a6b 100644 --- a/app/mobile/ios/Databag/Info.plist +++ b/app/mobile/ios/Databag/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 34 + 1 LSRequiresIPhoneOS NSAppTransportSecurity