Skip to content

Commit

Permalink
SonarCloud fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabi committed Sep 18, 2023
1 parent 238d6be commit 5e1439f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
.vscode
/dist/client/bundle.js
/dist/client/bundle.js.LICENSE.txt
bundle.js
bundle.js.LICENSE.txt
.DS_Store
docker
10 changes: 8 additions & 2 deletions docker/chainviz.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
FROM node:18.17.1-bookworm-slim
WORKDIR /usr/src/app
COPY . .
RUN npm install
RUN adduser chainviz
COPY ./package.json ./
COPY ./tsconfig.json ./
COPY ./src ./src
COPY ./dist ./dist
RUN chown -R chainviz:chainviz /usr/src/app
USER chainviz
RUN npm install --ignore-scripts
RUN npm run build
EXPOSE 8080
CMD [ "node", "dist/server/server.js" ]
12 changes: 7 additions & 5 deletions src/client/data/data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ class DataStore {
async connectSubstrateRPC() {
try {
// connection timeout handling
await setAsyncTimeout(async (done) => {
this.substrateClient = await ApiPromise.create({
provider: new WsProvider(this.network.rpcURL),
});
done(0);
await setAsyncTimeout((done) => {
(async () => {
this.substrateClient = await ApiPromise.create({
provider: new WsProvider(this.network.rpcURL),
});
done(0);
})();
}, Constants.CONNECTION_TIMEOUT_MS);
this.eventBus.dispatch<string>(ChainvizEvent.SUBSTRATE_API_READY);
} catch (error) {
Expand Down
8 changes: 4 additions & 4 deletions src/client/data/kusama-paras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export const KUSAMA_PARAS: Para[] = [
},
},
{
homepage: 'http://apron.network/',
homepage: 'https://apron.network/',
info: 'kpron',
isUnreachable: true,
paraId: 2019,
Expand Down Expand Up @@ -568,7 +568,7 @@ export const KUSAMA_PARAS: Para[] = [
},
},
{
homepage: 'http://robonomics.network/',
homepage: 'https://robonomics.network/',
info: 'robonomics',
paraId: 2048,
providers: {
Expand All @@ -584,7 +584,7 @@ export const KUSAMA_PARAS: Para[] = [
},
},
{
homepage: 'http://robonomics.network/',
homepage: 'https://robonomics.network/',
info: 'robonomics',
isUnreachable: true,
paraId: 2240,
Expand Down Expand Up @@ -671,7 +671,7 @@ export const KUSAMA_PARAS: Para[] = [
},
},
{
homepage: 'http://subgame.org/',
homepage: 'https://subgame.org/',
info: 'subgame',
paraId: 2018,
providers: {
Expand Down
4 changes: 2 additions & 2 deletions src/client/data/polkadot-paras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const POLKADOT_PARAS: Para[] = [
},
},
{
homepage: 'http://www.coinversation.io/',
homepage: 'https://www.coinversation.io/',
info: 'coinversation',
paraId: 2027,
providers: {
Expand Down Expand Up @@ -578,7 +578,7 @@ export const POLKADOT_PARAS: Para[] = [
},
},
{
homepage: 'http://subgame.org/',
homepage: 'https://subgame.org/',
info: 'subgame',
paraId: 2017,
providers: {
Expand Down
10 changes: 8 additions & 2 deletions src/client/ui/logo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ enum CharacterType {
}

function getRandomShapeType(): ShapeType {
const random = Math.floor(Math.random() * 7);
const crypto = window.crypto;
const typedArray = new Uint8Array(1);
crypto.getRandomValues(typedArray);
const random = typedArray[0] % 7;
if (random == 0) {
return ShapeType.Shape0;
} else if (random == 1) {
Expand All @@ -53,7 +56,10 @@ function getRandomShapeType(): ShapeType {
}

function getRandomCharacterType(): CharacterType {
const random = Math.floor(Math.random() * 4);
const crypto = window.crypto;
const typedArray = new Uint8Array(1);
crypto.getRandomValues(typedArray);
const random = typedArray[0] % 4;
if (random == 0) {
return CharacterType.Word;
} else if (random == 1) {
Expand Down

0 comments on commit 5e1439f

Please sign in to comment.