Skip to content

Commit 1d2b508

Browse files
authored
Merge pull request #70 from TorMap/development
Update master
2 parents c44d802 + 6914f15 commit 1d2b508

33 files changed

+601
-456
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ database. Currently, the required archive part makes up 33 GB for the available
66
. Processing of a descriptor type only starts after all descriptors of the same type have been downloaded and saved to
77
disk. Processed data can instantly be fetched by the frontend to be displayed on the world map.
88

9-
![UI screenshot](docs/UI-screenshot.jpg)
9+
![UI screenshot](docs/UI-screenshot.png)
1010

1111
## Development
1212

backend/build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ dependencies {
3737
kapt("org.springframework.boot:spring-boot-configuration-processor")
3838

3939
// OpenAPI generation and Swagger UI https://springdoc.org/
40-
implementation("org.springdoc:springdoc-openapi-ui:1.6.5")
41-
implementation("org.springdoc:springdoc-openapi-kotlin:1.6.5")
40+
implementation("org.springdoc:springdoc-openapi-ui:1.6.6")
41+
implementation("org.springdoc:springdoc-openapi-kotlin:1.6.6")
4242

4343
// Serialization
4444
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.1")
@@ -47,7 +47,7 @@ dependencies {
4747
runtimeOnly("com.h2database:h2:1.4.200")
4848

4949
// Run Flyway DB migration tool on startup https://flywaydb.org/
50-
implementation("org.flywaydb:flyway-core:8.4.3")
50+
implementation("org.flywaydb:flyway-core:8.4.4")
5151

5252
// Read .mmdb (MaxMind) DB files for IP lookups https://maxmind.github.io/MaxMind-DB/
5353
implementation("com.maxmind.geoip2:geoip2:3.0.0")
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
885 Bytes
Loading
Loading
14.7 KB
Binary file not shown.

docs/UI-screenshot.png

446 KB
Loading

frontend/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
"dependencies": {
66
"@emotion/react": "11.7.1",
77
"@emotion/styled": "11.6.0",
8-
"@mui/icons-material": "5.3.1",
9-
"@mui/lab": "5.0.0-alpha.66",
10-
"@mui/material": "5.3.1",
11-
"@mui/styles": "5.3.0",
8+
"@mui/icons-material": "5.4.1",
9+
"@mui/lab": "5.0.0-alpha.68",
10+
"@mui/material": "5.4.1",
11+
"@mui/styles": "5.4.1",
1212
"@react-leaflet/core": "1.1.1",
13-
"@testing-library/jest-dom": "5.16.1",
13+
"@testing-library/jest-dom": "5.16.2",
1414
"@testing-library/react": "12.1.2",
1515
"@testing-library/user-event": "13.5.0",
1616
"@types/geojson": "7946.0.8",
1717
"@types/jest": "27.4.0",
18-
"@types/node": "16.11.21",
19-
"@types/react": "17.0.38",
18+
"@types/node": "16.11.24",
19+
"@types/react": "17.0.39",
2020
"@types/react-dom": "17.0.11",
2121
"axios": "0.25.0",
2222
"date-fns": "2.28.0",
@@ -53,7 +53,7 @@
5353
"devDependencies": {
5454
"@babel/plugin-proposal-nullish-coalescing-operator": "7.16.7",
5555
"@types/leaflet": "1.7.9",
56-
"css-loader": "6.5.1",
56+
"css-loader": "6.6.0",
5757
"style-loader": "3.3.1"
5858
},
5959
"packageManager": "yarn@3.1.1"

frontend/public/index.html

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<link rel="preconnect" href="https://fonts.googleapis.com">
3636
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
3737
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/>
38+
<link rel="preconnect" href="https://a.basemaps.cartocdn.com">
39+
<link rel="preconnect" href="https://b.basemaps.cartocdn.com">
40+
<link rel="preconnect" href="https://c.basemaps.cartocdn.com">
41+
<link rel="preconnect" href="https://api.tormap.org">
3842

3943
<title>TorMap</title>
4044
</head>

frontend/src/components/accordion/AppSettings.tsx

+82-46
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from "@mui/material";
1414
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
1515
import {relayMustIncludeFlagOptions, Settings} from "../../types/settings";
16-
import {RelayFlagLabel, RelayType, RelayTypeLabel} from "../../types/relay";
16+
import {RelayFlagLabel, RelayType, RelayTypeLabel, RelayTypeTooltip} from "../../types/relay";
1717
import {tooltipTimeDelay} from "../../config";
1818
import {getIcon} from "../../types/icons";
1919
import {nameOfFactory} from "../../util/util";
@@ -36,7 +36,7 @@ export const AppSettings: FunctionComponent<Props> = ({elevation = 24}) => {
3636

3737
return (
3838
<>
39-
<Accordion elevation={elevation}>
39+
<Accordion elevation={elevation} defaultExpanded>
4040
<AccordionSummary
4141
expandIcon={<ExpandMoreIcon/>}
4242
aria-controls="panel2a-content"
@@ -46,34 +46,62 @@ export const AppSettings: FunctionComponent<Props> = ({elevation = 24}) => {
4646
</AccordionSummary>
4747
<AccordionDetails sx={{padding: "0px 8px 20px 8px"}}>
4848
<FormGroup>
49-
<FormControlLabel
49+
<Tooltip
5050
key={"Family"}
51-
control={<Switch checked={settings.sortFamily} onChange={changeSettings}/>}
52-
label={"Family"}
53-
name={nameOfSetting("sortFamily")}
54-
/>
55-
<FormControlLabel
51+
title={"Every verified relay family gets a somewhat unique looking color assigned. A circle's size is relative to the amount of relays located at it's center. Click a circle, to see details."}
52+
placement={"left"}
53+
enterDelay={tooltipTimeDelay}
54+
>
55+
<FormControlLabel
56+
key={"Family"}
57+
control={<Switch checked={settings.sortFamily} onChange={changeSettings}/>}
58+
label={"Family"}
59+
name={nameOfSetting("sortFamily")}
60+
/>
61+
</Tooltip>
62+
<Tooltip
5663
key={"Country"}
57-
control={<Switch checked={settings.sortCountry} onChange={changeSettings}/>}
58-
label={"Country"}
59-
name={nameOfSetting("sortCountry")}
60-
/>
61-
<FormControlLabel
64+
title={"Relays, which are located in the same country, will be painted in the same color. Select a country, to see specific stats for it."}
65+
placement={"left"}
66+
enterDelay={tooltipTimeDelay}
67+
>
68+
<FormControlLabel
69+
key={"Country"}
70+
control={<Switch checked={settings.sortCountry} onChange={changeSettings}/>}
71+
label={"Country"}
72+
name={nameOfSetting("sortCountry")}
73+
/>
74+
</Tooltip>
75+
<Tooltip
6276
key={"Coordinates"}
63-
control={<Switch checked={settings.aggregateCoordinates} onChange={changeSettings}/>}
64-
label={"Coordinates"}
65-
name={nameOfSetting("aggregateCoordinates")}
66-
/>
67-
<FormControlLabel
77+
title={"A circle is placed on the map when multiple relays are located at the same coordinates. A circle's size is relative to the amount of relays located at it's center. Click a circle, to see details."}
78+
placement={"left"}
79+
enterDelay={tooltipTimeDelay}
80+
>
81+
<FormControlLabel
82+
key={"Coordinates"}
83+
control={<Switch checked={settings.aggregateCoordinates} onChange={changeSettings}/>}
84+
label={"Coordinates"}
85+
name={nameOfSetting("aggregateCoordinates")}
86+
/>
87+
</Tooltip>
88+
<Tooltip
6889
key={"Density heatmap"}
69-
control={<Switch checked={settings.heatMap} onChange={changeSettings}/>}
70-
label={"Density heatmap"}
71-
name={nameOfSetting("heatMap")}
72-
/>
90+
title={"This heatmap visualizes how many relays are present in an area relative to others."}
91+
placement={"left"}
92+
enterDelay={tooltipTimeDelay}
93+
>
94+
<FormControlLabel
95+
key={"Density heatmap"}
96+
control={<Switch checked={settings.heatMap} onChange={changeSettings}/>}
97+
label={"Density heatmap"}
98+
name={nameOfSetting("heatMap")}
99+
/>
100+
</Tooltip>
73101
</FormGroup>
74102
</AccordionDetails>
75103
</Accordion>
76-
<Accordion elevation={elevation}>
104+
<Accordion elevation={elevation} defaultExpanded>
77105
<AccordionSummary
78106
expandIcon={<ExpandMoreIcon/>}
79107
aria-controls="panel2a-content"
@@ -84,26 +112,33 @@ export const AppSettings: FunctionComponent<Props> = ({elevation = 24}) => {
84112
<AccordionDetails sx={{padding: "0px 8px 20px 8px"}}>
85113
<FormGroup>
86114
{[RelayType.Exit, RelayType.Guard, RelayType.Other].map(relayType =>
87-
<FormControlLabel
115+
<Tooltip
88116
key={relayType}
89-
control={
90-
<Checkbox
91-
id={relayType.toString()}
92-
checked={settings.showRelayTypes[relayType]}
93-
onChange={changeSettings}
94-
/>
95-
}
96-
label={
97-
<Box
98-
display="flex"
99-
alignItems="center"
100-
>
101-
<span style={{paddingRight: "10px"}}>{RelayTypeLabel[relayType]}</span>
102-
{getIcon(relayType)}
103-
</Box>
104-
}
105-
name={showRelayTypesInput}
106-
/>
117+
title={RelayTypeTooltip[relayType]}
118+
placement={"left"}
119+
enterDelay={tooltipTimeDelay}
120+
>
121+
<FormControlLabel
122+
key={relayType}
123+
control={
124+
<Checkbox
125+
id={relayType.toString()}
126+
checked={settings.showRelayTypes[relayType]}
127+
onChange={changeSettings}
128+
/>
129+
}
130+
label={
131+
<Box
132+
display="flex"
133+
alignItems="center"
134+
>
135+
<span style={{paddingRight: "10px"}}>{RelayTypeLabel[relayType]}</span>
136+
{getIcon(relayType)}
137+
</Box>
138+
}
139+
name={showRelayTypesInput}
140+
/>
141+
</Tooltip>
107142
)}
108143
</FormGroup>
109144
</AccordionDetails>
@@ -114,7 +149,7 @@ export const AppSettings: FunctionComponent<Props> = ({elevation = 24}) => {
114149
aria-controls="panel2a-content"
115150
id="panel2a-header"
116151
>
117-
<Typography className={"heading"}>Relays must include flag</Typography>
152+
<Typography className={"heading"}>Relays must have flag</Typography>
118153
</AccordionSummary>
119154
<AccordionDetails sx={{padding: "0px 8px 20px 8px"}}>
120155
<FormGroup>
@@ -123,12 +158,13 @@ export const AppSettings: FunctionComponent<Props> = ({elevation = 24}) => {
123158
key={option.relayFlag}
124159
title={option.tooltip}
125160
placement={"left"}
126-
enterDelay={tooltipTimeDelay}>
161+
enterDelay={tooltipTimeDelay}
162+
>
127163
<FormControlLabel
128164
control={
129165
<Checkbox
130166
id={option.relayFlag.toString()}
131-
checked={settings.relaysMustIncludeFlag[option.relayFlag]}
167+
checked={settings.relaysMustHaveFlag[option.relayFlag]}
132168
onChange={changeSettings}
133169
/>
134170
}
@@ -141,7 +177,7 @@ export const AppSettings: FunctionComponent<Props> = ({elevation = 24}) => {
141177
<Box sx={{margin: "8px 8px"}}>
142178
<ExternalLink
143179
href={"https://github.com/torproject/torspec/blob/main/dir-spec.txt"}
144-
label={"More information about flags"}
180+
label={"Learn more"}
145181
/>
146182
</Box>
147183
</AccordionDetails>

frontend/src/components/buttons/SelectFamilyButton.tsx

+19-12
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,34 @@ import React, {FunctionComponent} from "react";
22
import {IconButton} from "@mui/material";
33
import {RelayFamilyIcon} from "../../types/icons";
44
import {useSettings} from "../../context/settings-context";
5+
import {calculateFamilyColor} from "../../util/layer-construction";
56

67
interface Props {
7-
newFamilyId: number,
8+
familyId: number,
89
furtherAction?: () => void,
910
}
1011

11-
export const SelectFamilyButton: FunctionComponent<Props> = ({newFamilyId, furtherAction}) => {
12+
export const SelectFamilyButton: FunctionComponent<Props> = ({familyId, furtherAction}) => {
1213
// App context
1314
const {settings, setSettings} = useSettings()
1415

1516
return (
16-
<IconButton aria-label="select family" onClick={() => {
17-
setSettings({
18-
...settings,
19-
selectedFamily: newFamilyId,
20-
sortFamily: true
21-
})
22-
if (furtherAction) {
23-
furtherAction()
24-
}
25-
}}>
17+
<IconButton
18+
aria-label="select family"
19+
onClick={() => {
20+
setSettings({
21+
...settings,
22+
selectedFamily: familyId,
23+
sortFamily: true
24+
})
25+
if (furtherAction) {
26+
furtherAction()
27+
}
28+
}}
29+
sx={{
30+
color: calculateFamilyColor(familyId)
31+
}}
32+
>
2633
{RelayFamilyIcon}
2734
</IconButton>
2835
)

frontend/src/components/date/DateSlider.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {FunctionComponent, useEffect, useState} from "react";
22
import {useDebounce} from "../../util/util";
3-
import {Mark, Slider} from "@mui/material";
3+
import {Slider} from "@mui/material";
4+
import {Mark} from "@mui/base";
45
import {useDate} from "../../context/date-context";
56
import {format} from "date-fns";
67

frontend/src/components/dialogs/family/FamiliesTable.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export const FamiliesTable: FunctionComponent<Props> = ({
3333
<TableCell scope="row">
3434
<Typography sx={{fontWeight: "bold",}}>Relay nicknames</Typography>
3535
</TableCell>
36-
<TableCell scope="" sx={{minWidth: "150px",}}>
37-
<Typography sx={{fontWeight: "bold",}}>Member count</Typography>
36+
<TableCell scope="" sx={{minWidth: "75px",}}>
37+
<Typography sx={{fontWeight: "bold",}}>Count</Typography>
3838
</TableCell>
3939
<TableCell scope="row">
4040
<Typography sx={{fontWeight: "bold",}}>Autonomous Systems</Typography>
@@ -59,7 +59,7 @@ export const FamiliesTable: FunctionComponent<Props> = ({
5959
<TableCell scope="row">
6060
<Typography>{family.nicknames}</Typography>
6161
</TableCell>
62-
<TableCell scope="row" sx={{minWidth: "150px",}}>
62+
<TableCell scope="row" sx={{minWidth: "75px",}}>
6363
<Typography>{family.memberCount}</Typography>
6464
</TableCell>
6565
<TableCell scope="row">

frontend/src/components/dialogs/family/FamilySelectionDialog.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface FamilySelectionProps {
1111
/**
1212
* Whether the modal should currently be visible
1313
*/
14-
showDialog: boolean
14+
shouldShowDialog: boolean
1515

1616
/**
1717
* Hide the modal
@@ -29,13 +29,15 @@ interface FamilySelectionProps {
2929
familyIds: number[]
3030
}
3131

32-
export interface FamilySelectionDialogProps extends Omit<FamilySelectionProps, "reloadSelectedDay"> {
32+
export interface FamilySelectionDialogProps {
33+
shouldShowDialog: boolean
34+
closeDialog: () => void
3335
isLoading: boolean
3436
familyIdentifiers?: RelayFamilyIdentifier[]
3537
}
3638

3739
export const FamilySelectionDialog: FunctionComponent<FamilySelectionProps> = ({
38-
showDialog,
40+
shouldShowDialog,
3941
closeDialog,
4042
reloadSelectedDay,
4143
familyIds,
@@ -79,16 +81,14 @@ export const FamilySelectionDialog: FunctionComponent<FamilySelectionProps> = ({
7981

8082
return (isLargeScreen ?
8183
<FamilySelectionDialogLarge
82-
showDialog={showDialog}
84+
shouldShowDialog={shouldShowDialog}
8385
closeDialog={closeDialog}
84-
familyIds={familyIds}
8586
isLoading={isLoading}
8687
familyIdentifiers={familyIdentifiers}
8788
/>
8889
: <FamilySelectionDialogSmall
89-
showDialog={showDialog}
90+
shouldShowDialog={shouldShowDialog}
9091
closeDialog={closeDialog}
91-
familyIds={familyIds}
9292
isLoading={isLoading}
9393
familyIdentifiers={familyIdentifiers}
9494
/>

0 commit comments

Comments
 (0)