Skip to content

Commit aff32dc

Browse files
committed
Disable supported repo if no license uploaded
1 parent d495dd6 commit aff32dc

27 files changed

+40
-6
lines changed

src/components/license/Updater.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import { Check, CheckCircleOutline, CopyAll, Update, Upgrade } from '@mui/icons-
66
import { systemUpdate } from '../../actions/misc';
77
import { fetchUpdateLogData } from '../../actions/logs';
88
import { copyToClipboard } from '../../utils';
9-
import { connect } from 'react-redux';
9+
import { connect, useSelector } from 'react-redux';
1010
import { withTranslation } from 'react-i18next';
11+
import moment from 'moment';
1112

1213
const styles = theme => ({
1314
data: {
@@ -39,14 +40,17 @@ const styles = theme => ({
3940
const Loader = () => <CircularProgress color='inherit' size={20}/>;
4041

4142
const Updater = props => {
43+
const license = useSelector(state => state.license);
44+
const supportedReposAvailable = license ? moment().isBefore(license?.notAfter) : false;
4245
const [state, setState] = useState({
4346
checkLoading: false,
4447
updateLoading: false,
4548
upgradeLoading: false,
4649
copied: false,
4750
});
4851
const [updateLog, setUpdateLog] = useState([]);
49-
const [repo, setRepo] = useState(localStorage.getItem("packageRepository") || "supported");
52+
const [repo, setRepo] = useState(localStorage.getItem("packageRepository")
53+
|| (supportedReposAvailable ? "supported" : "community"));
5054

5155
useEffect(() => {
5256
const listener = window.addEventListener('beforeunload', onBeforeUnload)
@@ -127,7 +131,11 @@ const Updater = props => {
127131
className={classes.select}
128132
size='small'
129133
>
130-
<MenuItem value="supported">Supported</MenuItem>
134+
{supportedReposAvailable ?
135+
<MenuItem value="supported">Supported</MenuItem> :
136+
<Tooltip placement='top' title={t("License required to fetch supported repositories")}>
137+
<span><MenuItem value="supported" disabled>Supported</MenuItem></span>
138+
</Tooltip>}
131139
<MenuItem value="community">Community</MenuItem>
132140
</TextField>
133141
<Button
@@ -137,7 +145,7 @@ const Updater = props => {
137145
className={classes.updateButton}
138146
disabled={updating}
139147
>
140-
Check for updates
148+
Check for updates
141149
</Button>
142150
<Button
143151
variant='contained'
@@ -146,15 +154,15 @@ const Updater = props => {
146154
className={classes.updateButton}
147155
disabled={updating}
148156
>
149-
Update
157+
Update
150158
</Button>
151159
<Button
152160
variant='contained'
153161
onClick={handleUpdate("upgrade")}
154162
startIcon={upgradeLoading ? <Loader/> : <Upgrade />}
155163
disabled={updating}
156164
>
157-
Upgrade
165+
Upgrade
158166
</Button>
159167
</div>
160168
<Paper elevation={0} className={classes.logs}>

src/i18n/ar-DZ.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "",
268268
"Learned": "",
269269
"License": "",
270+
"License required to fetch supported repositories": "",
270271
"List": "",
271272
"Listname": "",
272273
"Live status": "",

src/i18n/ar-SA.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "",
268268
"Learned": "",
269269
"License": "",
270+
"License required to fetch supported repositories": "",
270271
"List": "",
271272
"Listname": "",
272273
"Live status": "",

src/i18n/ca-ES.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "",
268268
"Learned": "",
269269
"License": "",
270+
"License required to fetch supported repositories": "",
270271
"List": "",
271272
"Listname": "",
272273
"Live status": "",

src/i18n/cs-CZ.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "Poslední aktualizace (sekundy)",
268268
"Learned": "Naučil se",
269269
"License": "Licence",
270+
"License required to fetch supported repositories": "",
270271
"List": "Seznam",
271272
"Listname": "Název seznamu",
272273
"Live status": "Živý stav",

src/i18n/da-DK.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "Sidst opdateret (sekunder)",
268268
"Learned": "Lærte",
269269
"License": "Licens",
270+
"License required to fetch supported repositories": "",
270271
"List": "Liste",
271272
"Listname": "Liste navn",
272273
"Live status": "Live-status",

src/i18n/de-DE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@
266266
"Last updated (seconds)": "Zuletzt aktualisiert (Sekunden)",
267267
"Learned": "Gelernt",
268268
"License": "Lizenz",
269+
"License required to fetch supported repositories": "Es wird eine Lizenz benötigt, um die unterstützten Repositories verwenden zu können",
269270
"List": "Liste",
270271
"Listname": "Listenname",
271272
"Live status": "Echtzeitstatus",

src/i18n/el-GR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "Τελευταία ενημέρωση (δευτερόλεπτα)",
268268
"Learned": "Έμαθα",
269269
"License": "Άδεια",
270+
"License required to fetch supported repositories": "",
270271
"List": "Λίστα",
271272
"Listname": "Όνομα λίστας",
272273
"Live status": "Ζωντανή κατάσταση",

src/i18n/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@
270270
"Last updated (seconds)": "Last updated (seconds)",
271271
"Learned": "Learned",
272272
"License": "License",
273+
"License required to fetch supported repositories": "License required to fetch supported repositories",
273274
"List": "List",
274275
"Listname": "Listname",
275276
"Live status": "Live status",

src/i18n/es-ES.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"Last updated (seconds)": "Última actualización (segundos)",
268268
"Learned": "Aprendido",
269269
"License": "Licencia",
270+
"License required to fetch supported repositories": "",
270271
"List": "Lista",
271272
"Listname": "Nombre de la lista",
272273
"Live status": "Estado en vivo",

0 commit comments

Comments
 (0)