Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 24e604b

Browse files
starpitk8s-ci-robot
authored andcommitted
fix: update UpdateChecker to point to new kubernetes-sigs/kui repo
This also introduces a way for custom clients to specify their own repo. See plugin-client-default/config.d/repo.json for an example.
1 parent c9ea936 commit 24e604b

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"url": "https://github.com/kubernetes-sigs/kui"
3+
}

plugins/plugin-electron-components/src/components/UpdateChecker.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,23 @@ import '../../web/scss/components/UpdateChecker/_index.scss'
3131

3232
const strings = i18n('plugin-core-support')
3333

34-
/** Releases page */
35-
const RELEASE = (tag: string) => `https://github.com/IBM/kui/releases/tag/v${tag}`
34+
/** Default repo/org */
35+
const repo = 'kubernetes-sigs/kui'
36+
37+
/** Base URL for feeds */
38+
const baseUrl = () => {
39+
try {
40+
return require('@kui-shell/client/config.d/repo.json').url
41+
} catch (err) {
42+
return `https://github.com/${repo}`
43+
}
44+
}
3645

37-
/** Base URL for image references */
38-
const baseUrl = 'https://github.com'
46+
/** Releases page */
47+
const RELEASE = (tag: string) => `${baseUrl()}/releases/tag/v${tag}`
3948

4049
/** Releases feed */
41-
const FEED = `${baseUrl}/IBM/kui/releases.atom`
50+
const FEED = () => `${baseUrl()}/releases.atom`
4251

4352
/** By default, check for updates once a day */
4453
const DEFAULT_INTERVAL = 24 * 60 * 60 * 1000
@@ -123,7 +132,7 @@ export default class UpdateChecker extends React.PureComponent<Props, State> {
123132

124133
/** Ping the release feed to check for the latest release */
125134
private checkForUpdates() {
126-
needle('get', FEED, { json: true })
135+
needle('get', FEED(), { json: true })
127136
.then(res => {
128137
const entryForLatestVersion = res.body.children
129138
.filter(_ => _.name === 'entry')
@@ -245,7 +254,7 @@ export default class UpdateChecker extends React.PureComponent<Props, State> {
245254
<Markdown
246255
source={this.state.entryForLatestVersion.content}
247256
contentType="text/html"
248-
baseUrl={baseUrl}
257+
baseUrl={baseUrl()}
249258
/>
250259
</React.Fragment>
251260
),

0 commit comments

Comments
 (0)