Skip to content

Commit

Permalink
Merge branch 'develop' into apt-formatting1
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastCicada authored Aug 17, 2023
2 parents c77004b + 661afe1 commit 596356d
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 18 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/build-installers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
name: core-registry-cadt-ui-mac-installer
path: ${{ github.workspace }}/dist/*.dmg


build_windows:
name: Build Windows Installer
runs-on: windows-2019
Expand All @@ -92,17 +93,31 @@ jobs:
npm install
- name: Build electron app
env:
CSC_LINK: ${{ secrets.WIN_CODE_SIGN_CERT }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CODE_SIGN_PASSWORD }}
run: npm run electron:package:win

# Windows Code Signing
- name: Get installer name for signing
shell: bash
run: |
FILE=$(find dist -type f -maxdepth 1 -name '*.exe')
echo "Installer file is $FILE"
echo "INSTALLER_FILE=$FILE" >> "$GITHUB_ENV"
- name: Sign windows artifacts
uses: chia-network/actions/digicert/windows-sign@main
with:
sm_api_key: ${{ secrets.SM_API_KEY }}
sm_client_cert_file_b64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
sm_client_cert_password: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
sm_code_signing_cert_sha1_hash: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
file: "${{ github.workspace }}/${{ env.INSTALLER_FILE }}"

- name: Upload Windows Installer
uses: actions/upload-artifact@v3
with:
name: core-registry-cadt-ui-windows-installer
path: ${{ github.workspace }}/dist/*.exe

path: "${{ github.workspace }}/${{ env.INSTALLER_FILE }}"
build_linux:
name: Build Linux Installer
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions src/components/blocks/MyAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,39 @@ const MyAccount = ({ openModal = false, onClose, isHeader = true }) => {
}
}, []);

useEffect(() => {
// Function to handle the message event
const handleMessage = event => {
if (event.origin !== window.location.origin) {
return;
}
console.log('Received message:', event.data);
if (
event?.data?.serverAddress &&
validateUrl(event?.data?.serverAddress)
) {
dispatch(
signIn({
apiKey: event?.data?.apiKey,
serverAddress: event?.data?.serverAddress,
}),
);
setServerAddress(null);
setApiKey(null);
setIsLogInModalOpen(false);
}
};

// Add the event listener
window.addEventListener('message', handleMessage, false);

// Return a function that will be called when the component unmounts
return () => {
// Remove the event listener
window.removeEventListener('message', handleMessage, false);
};
}, []);

return (
<StyledMyAccountContainer>
{isHeader && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const InnerContainer = styled('div')`
const Dashboard = withTheme(({ children }) => {
return (
<Main>
<Header />
{window.self === window.top && <Header />}
<InnerContainer>
<ErrorBoundary>
<LeftNav />
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const Header = () => {
</Body>
)}
</HomeOrgUidContainer>
<MyAccount />
{window.self === window.top && <MyAccount />}
<LocaleSwitcher />
</StyledLocalContainer>
</Headline>
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const AppNavigator = () => {
return (
<AppContainer>
{showProgressOverlay && <IndeterminateProgressOverlay />}
{!connectionCheck ? (
{!connectionCheck && window.self === window.top ? (
<MyAccount
openModal={true}
onClose={() => dispatch(getOrganizationData())}
Expand Down
12 changes: 6 additions & 6 deletions src/store/actions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ export const setNotificationMessage = (type, id) => {
export const signIn = ({ apiKey, serverAddress }) => {
return async dispatch => {
if (serverAddress) {
localStorage.setItem('serverAddress', serverAddress);
localStorage.setItem('cadtRemoteServerAddress', serverAddress);
let payload = { serverAddress };

if (apiKey) {
localStorage.setItem('apiKey', apiKey);
localStorage.setItem('cadtRemoteServerApiKey', apiKey);
payload = { ...payload, apiKey };
}

Expand All @@ -149,8 +149,8 @@ export const signIn = ({ apiKey, serverAddress }) => {

export const signOut = () => {
return async dispatch => {
localStorage.removeItem('apiKey');
localStorage.removeItem('serverAddress');
localStorage.removeItem('cadtRemoteServerApiKey');
localStorage.removeItem('cadtRemoteServerAddress');
dispatch({
type: actions.SIGN_USER_OUT,
payload: {
Expand All @@ -163,8 +163,8 @@ export const signOut = () => {

export const signInFromLocalStorage = () => {
return async dispatch => {
const apiKey = localStorage.getItem('apiKey');
const serverAddress = localStorage.getItem('serverAddress');
const apiKey = localStorage.getItem('cadtRemoteServerApiKey');
const serverAddress = localStorage.getItem('cadtRemoteServerAddress');

if (serverAddress) {
let payload = { serverAddress };
Expand Down
2 changes: 1 addition & 1 deletion src/store/actions/climateWarehouseActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,7 @@ export const getVintages = options => {

// TODO to replace with an extended wrapper that also adds try catch finally and also handles network connection and progress indicator dispatches
const fetchWrapper = async (url, payload) => {
const apiKey = localStorage.getItem('apiKey');
const apiKey = localStorage.getItem('cadtRemoteServerApiKey');

url = overrideURL(url);

Expand Down
2 changes: 1 addition & 1 deletion src/utils/urlUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const validateUrl = url => {
};

export const overrideURL = originalUrl => {
const serverAddress = localStorage.getItem('serverAddress');
const serverAddress = localStorage.getItem('cadtRemoteServerAddress');

// If serverAddress is valid, replace the domain of the original URL.
if (serverAddress && typeof serverAddress === 'string') {
Expand Down

0 comments on commit 596356d

Please sign in to comment.