Skip to content

Commit

Permalink
Merge pull request #2988 from hollaex/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
abeikverdi authored Aug 26, 2024
2 parents 622884b + 17ffb2b commit 97facc6
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 78 deletions.
106 changes: 74 additions & 32 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,46 @@ if command apt -v > /dev/null 2>&1; then

fi

if ! command docker compose version > /dev/null 2>&1; then

if command docker-compose --version | grep -q '^docker-compose version 1'; then

printf "\n\033[93mHollaEx CLI requires docker compose v2 to operate. Installing it now...\033[39m\n"
echo -e "\n\033[91mWarning: Detected Docker Compose v1 instead of v2.\033[39m"
echo "HollaEx CLI v3+ requires Docker Compose v2."

if [[ ! $IS_APT_UPDATED ]]; then
if command sudo apt list --installed docker-compose; then

echo "Updating APT list"
sudo apt update
echo "Removing Docker-Compose v1 through the APT..."

sudo apt remove -y docker-compose

else

echo "To proceed, please uninstall the current Docker Compose v1 and then run the install.sh script."
echo -e "The install.sh script will automatically install Docker Compose v2 for you.\n"

exit 1;

fi

if command sudo apt install -y docker-compose-v2; then
fi

if ! command -v docker-compose > /dev/null 2>&1; then

printf "\n\033[93mHollaEx CLI requires docker-compose v2 to operate. Installing it now...\033[39m\n"

if command sudo curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose; then

chmod +x /usr/local/bin/docker-compose

printf "\n\033[92mdocker compose v2 has been successfully installed!\033[39m\n"
printf "\n\033[92mdocker compose v2has been successfully installed!\033[39m\n"

echo "Info: $(docker compose version)"
echo "Info: $(docker-compose version)"


else

printf "\n\033[91mFailed to install docker compose v2.\033[39m\n"
echo "Please review the logs and try to manually install it. - 'sudo apt install -y docker compose'."
echo "Please review the logs and try to manually install it. - 'https://github.com/docker/compose/releases'."
exit 1;

fi
Expand All @@ -116,6 +136,8 @@ if command apt -v > /dev/null 2>&1; then

echo "Info: $(jq --version)"



else

printf "\n\033[91mFailed to install jq.\033[39m\n"
Expand Down Expand Up @@ -265,26 +287,34 @@ elif command brew -v > /dev/null 2>&1; then

fi

if ! command docker compose version > /dev/null 2>&1; then
if command docker-compose --version | grep -q '^docker-compose version 1'; then

printf "\n\033[93mHollaEx CLI requires docker compose to operate. Installing it now...\033[39m\n"
echo -e "\n\033[91mError: Detected Docker Compose v1 instead of v2.\033[39m"
echo "HollaEx CLI v3+ requires Docker Compose v2."
echo "To proceed, please uninstall the current Docker Compose v1 and then run the install.sh script."
echo -e "The install.sh script will automatically install Docker Compose v2 for you.\n"

if [[ ! $IS_BREW_UPDATED ]]; then
exit 1;

echo "Updating Homebrew list"
brew update
fi
fi

if command brew install docker compose; then
if ! command -v docker-compose > /dev/null 2>&1; then

printf "\n\033[92mdocker compose has been successfully installed!\033[39m\n"
printf "\n\033[93mHollaEx CLI requires docker-compose v2 to operate. Installing it now...\033[39m\n"

echo "Info: $(docker compose version)"
if command sudo curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose; then

chmod +x /usr/local/bin/docker-compose

printf "\n\033[92mdocker compose v2has been successfully installed!\033[39m\n"

echo "Info: $(docker-compose version)"


else

printf "\n\033[91mFailed to install docker compose.\033[39m\n"
echo "Please review the logs and try to manually install it. - 'brew install docker compose'."
printf "\n\033[91mFailed to install docker compose v2.\033[39m\n"
echo "Please review the logs and try to manually install it. - 'https://github.com/docker/compose/releases'."
exit 1;

fi
Expand Down Expand Up @@ -428,21 +458,33 @@ elif command yum --version > /dev/null 2>&1; then

fi

if ! command docker compose version > /dev/null 2>&1; then
if command docker-compose --version | grep -q '^docker-compose version 1'; then

echo -e "\n\033[91mError: Detected Docker Compose v1 instead of v2.\033[39m"
echo "HollaEx CLI v3+ requires Docker Compose v2."
echo "To proceed, please uninstall the current Docker Compose v1 and then run the install.sh script."
echo -e "The install.sh script will automatically install Docker Compose v2 for you.\n"

printf "\n\033[93mHollaEx CLI requires docker compose to operate. Installing it now...\033[39m\n"
exit 1;

fi

if command sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker compose; then
if ! command -v docker-compose > /dev/null 2>&1; then

sudo chmod +x /usr/local/bin/docker compose
printf "\n\033[93mHollaEx CLI requires docker-compose v2 to operate. Installing it now...\033[39m\n"

printf "\n\033[92mdocker compose has been successfully installed!\033[39m\n"
if command sudo curl -SL https://github.com/docker/compose/releases/download/v2.29.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose; then

echo "Info: $(docker compose version)"
chmod +x /usr/local/bin/docker-compose

printf "\n\033[92mdocker compose v2has been successfully installed!\033[39m\n"

echo "Info: $(docker-compose version)"


else

printf "\n\033[91mFailed to install docker compose.\033[39m\n"
printf "\n\033[91mFailed to install docker compose v2.\033[39m\n"
echo "Please review the logs and try to manually install it. - 'https://github.com/docker/compose/releases'."
exit 1;

Expand Down Expand Up @@ -532,15 +574,15 @@ elif command yum --version > /dev/null 2>&1; then

fi

if ! command docker -v > /dev/null 2>&1 || ! command docker compose version > /dev/null 2>&1 || ! command curl --version > /dev/null 2>&1 || ! command jq --version > /dev/null 2>&1 || ! command nslookup -version > /dev/null 2>&1 || ! command psql --version > /dev/null 2>&1; then
if ! command docker -v > /dev/null 2>&1 || ! command docker-compose version > /dev/null 2>&1 || ! command curl --version > /dev/null 2>&1 || ! command jq --version > /dev/null 2>&1 || ! command nslookup -version > /dev/null 2>&1 || ! command psql --version > /dev/null 2>&1; then

if command docker -v > /dev/null 2>&1; then

IS_DOCKER_INSTALLED=true

fi

if command docker compose version > /dev/null 2>&1; then
if command docker-compose version > /dev/null 2>&1; then

IS_DOCKER_COMPOSE_INSTALLED=true

Expand Down Expand Up @@ -589,7 +631,7 @@ if ! command docker -v > /dev/null 2>&1 || ! command docker compose version > /d

fi

# docker compose installation status check
# docker compose v2installation status check
if [[ "$IS_DOCKER_COMPOSE_INSTALLED" ]]; then

printf "\033[92mdocker compose: Installed\033[39m\n"
Expand Down Expand Up @@ -731,8 +773,8 @@ function kit_cross_compatibility_converter() {

if command docker ps | grep local.*-nginx > /dev/null ; then

docker compose -f $(pwd)/nginx/docker-compose.yaml down
docker compose -f $(pwd)/nginx/docker-compose.yaml up -d
docker-compose -f $(pwd)/nginx/docker-compose.yaml down
docker-compose -f $(pwd)/nginx/docker-compose.yaml up -d

fi

Expand Down
2 changes: 1 addition & 1 deletion server/api/swagger/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const definition = {
swagger: '2.0',
info: {
title: 'HollaEx Kit',
version: '2.11.5'
version: '2.12.0'
},
host: 'api.hollaex.com',
basePath: '/v2',
Expand Down
1 change: 1 addition & 0 deletions server/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,5 @@ exports.ADDRESSBOOK_MISSING_FIELDS = 'Each address must contain both address, ne
exports.ADDRESSBOOK_ALREADY_EXISTS = 'Address label already exists in the payload';
exports.ADDRESSBOOK_NOT_FOUND = 'User address book not found';
exports.PAYMENT_DETAIL_NOT_FOUND = 'Payment detail not found';
exports.UNAUTHORIZED_UPDATE_METHOD = 'You cannot update verified payment method';
exports.P2P_DEAL_NOT_FOUND = 'P2P Deal not found!';
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.11.5",
"version": "2.12.0",
"private": false,
"description": "HollaEx Kit",
"keywords": [
Expand Down
5 changes: 5 additions & 0 deletions server/utils/hollaex-tools-lib/tools/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const {
ADDRESSBOOK_MISSING_FIELDS,
PAYMENT_DETAIL_NOT_FOUND,
ADDRESSBOOK_ALREADY_EXISTS,
UNAUTHORIZED_UPDATE_METHOD,
ADDRESSBOOK_NOT_FOUND
} = require(`${SERVER_PATH}/messages`);
const { publisher, client } = require('./database/redis');
Expand Down Expand Up @@ -3428,6 +3429,10 @@ const updatePaymentDetail = async (id, data, isAdmin = false) => {
sendEmail(MAILTYPE.BANK_VERIFIED, user.email, { bankAccounts: paymentDetail?.details?.fields }, user.settings);
}

if (!isAdmin && paymentDetail.status === 3) {
throw new Error(UNAUTHORIZED_UPDATE_METHOD);
}

await paymentDetail.update(data, {
fields: [
'name',
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.11.5
2.12.0
1 change: 0 additions & 1 deletion web/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ NODE_ENV=production

REACT_APP_PUBLIC_URL=http://yourdomain.com
REACT_APP_SERVER_ENDPOINT=http://localhost/api
REACT_APP_STREAM_ENDPOINT=ws://localhost/stream

REACT_APP_NETWORK=mainnet

Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hollaex-kit",
"version": "2.11.5",
"version": "2.12.0",
"private": true,
"dependencies": {
"@ant-design/compatible": "1.0.5",
Expand Down
8 changes: 8 additions & 0 deletions web/src/containers/P2P/P2POrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ const P2POrder = ({
p2pWs.onopen = (evt) => {
setWs(p2pWs);
setReady(true);

setInterval(() => {
p2pWs.send(
JSON.stringify({
op: 'ping',
})
);
}, 55000);
};

return () => {
Expand Down
89 changes: 48 additions & 41 deletions web/src/containers/P2P/P2PProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,24 +368,26 @@ const P2PProfile = ({
>
<div>{method.system_name}</div>
</div>
<div
onClick={() => {
setSelectedMethod(method);
setAddMethodDetails(true);
}}
className="whiteTextP2P"
style={{
cursor: 'pointer',
position: 'relative',
top: 5,
}}
>
<EditWrapper stringId="P2P.EDIT_UPPERCASE">
<span style={{ textDecoration: 'underline' }}>
{STRINGS['P2P.EDIT_UPPERCASE']}
</span>
</EditWrapper>
</div>
{info?.status !== 3 && (
<div
onClick={() => {
setSelectedMethod(method);
setAddMethodDetails(true);
}}
className="whiteTextP2P"
style={{
cursor: 'pointer',
position: 'relative',
top: 5,
}}
>
<EditWrapper stringId="P2P.EDIT_UPPERCASE">
<span style={{ textDecoration: 'underline' }}>
{STRINGS['P2P.EDIT_UPPERCASE']}
</span>
</EditWrapper>
</div>
)}
<div
onClick={async () => {
const found = myMethods.find(
Expand Down Expand Up @@ -649,36 +651,41 @@ const P2PProfile = ({
</Button>
<Button
onClick={async () => {
const newSelected = [
...(myMethods?.map((x) => x.details) || []),
];
try {
const newSelected = [
...(myMethods?.map((x) => x.details) || []),
];

const Index = newSelected.findIndex(
(x) => x.system_name === selectedMethod.system_name
);
const Index = newSelected.findIndex(
(x) => x.system_name === selectedMethod.system_name
);

newSelected[Index].fields = selectedMethod.fields;
newSelected[Index].fields = selectedMethod.fields;

const payload = newSelected[Index];
const payload = newSelected[Index];

const found = myMethods.find(
(x) => x?.details?.system_name === selectedMethod?.system_name
);
const found = myMethods.find(
(x) =>
x?.details?.system_name === selectedMethod?.system_name
);

await updateP2PPaymentMethod({
id: found.id,
details: payload,
});
await updateP2PPaymentMethod({
id: found.id,
details: payload,
});

fetchP2PPaymentMethods({ is_p2p: true })
.then((res) => {
setMyMethods(res.data);
})
.catch((err) => err);
fetchP2PPaymentMethods({ is_p2p: true })
.then((res) => {
setMyMethods(res.data);
})
.catch((err) => err);

message.success(STRINGS['P2P.PAYMENT_METHOD_UPDATED']);
setRefresh(!refresh);
setAddMethodDetails(false);
message.success(STRINGS['P2P.PAYMENT_METHOD_UPDATED']);
setRefresh(!refresh);
setAddMethodDetails(false);
} catch (error) {
message.error(error.data.message);
}
}}
style={{
flex: 1,
Expand Down

0 comments on commit 97facc6

Please sign in to comment.