diff --git a/announcements-builtin.json b/announcements-builtin.json new file mode 100644 index 0000000..66d0a1b --- /dev/null +++ b/announcements-builtin.json @@ -0,0 +1,7 @@ +[ + { + "id": "new-icon", + "title": "💡 Discussion: New icon", + "url": "https://github.com/VSCodium/vscodium/discussions/1218" + } +] diff --git a/patches/feat-announcements.patch b/patches/feat-announcements.patch new file mode 100644 index 0000000..d4f2de3 --- /dev/null +++ b/patches/feat-announcements.patch @@ -0,0 +1,101 @@ +diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts +index 2c18fde..e1031dd 100644 +--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts ++++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.ts +@@ -312,2 +312,8 @@ configurationRegistry.registerConfiguration({ + }, ++ 'workbench.welcomePage.extraAnnouncements': { ++ scope: ConfigurationScope.MACHINE, ++ type: 'boolean', ++ default: true, ++ description: localize('workbench.welcomePage.extraAnnouncements', "When enabled, the get started page loads additional announcements from VSCodium's repository.") ++ }, + 'workbench.startupEditor': { +diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts +index 9564618..eb8adfe 100644 +--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts ++++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts +@@ -116,4 +116,8 @@ type GettingStartedActionEvent = { + type RecentEntry = (IRecentFolder | IRecentWorkspace) & { id: string }; ++type AnnouncementEntry = { id: string, title: string, url: string }; + + const REDUCED_MOTION_KEY = 'workbench.welcomePage.preferReducedMotion'; ++ ++const BUILTIN_ANNOUNCEMENTS: AnnouncementEntry[] = [/* BUILTIN_ANNOUNCEMENTS */]; ++ + export class GettingStartedPage extends EditorPane { +@@ -148,2 +152,4 @@ export class GettingStartedPage extends EditorPane { + private gettingStartedList?: GettingStartedIndexList; ++ private announcementList?: GettingStartedIndexList; ++ private announcementData?: AnnouncementEntry[]; + +@@ -760,3 +766,2 @@ export class GettingStartedPage extends EditorPane { + +- + const leftColumn = $('.categories-column.categories-column-left', {},); +@@ -767,2 +772,3 @@ export class GettingStartedPage extends EditorPane { + const gettingStartedList = this.buildGettingStartedWalkthroughsList(); ++ const announcementList = await this.buildAnnouncementList(); + +@@ -777,3 +783,3 @@ export class GettingStartedPage extends EditorPane { + this.container.classList.remove('noWalkthroughs'); +- reset(leftColumn, startList.getDomElement(), recentList.getDomElement()); ++ reset(leftColumn, startList.getDomElement(), recentList.getDomElement(), announcementList.getDomElement()); + reset(rightColumn, gettingStartedList.getDomElement()); +@@ -783,3 +789,3 @@ export class GettingStartedPage extends EditorPane { + this.container.classList.add('noWalkthroughs'); +- reset(leftColumn, startList.getDomElement()); ++ reset(leftColumn, startList.getDomElement(), announcementList.getDomElement()); + reset(rightColumn, recentList.getDomElement()); +@@ -930,2 +936,51 @@ export class GettingStartedPage extends EditorPane { + ++ private async buildAnnouncementList(): Promise> { ++ const renderAnnouncement = (announcement: AnnouncementEntry) => { ++ const { title, url } = announcement; ++ const li = $('li'); ++ ++ const anchor: HTMLLinkElement = $('a'); ++ anchor.href = url; ++ anchor.innerText = title; ++ anchor.target = '_blank'; ++ li.appendChild(anchor); ++ ++ return li; ++ }; ++ ++ if (this.announcementList) { this.announcementList.dispose(); } ++ ++ const announcementList = this.announcementList = new GettingStartedIndexList({ ++ title: localize('announcements', "VSCodium Announcements"), ++ klass: 'announcements', ++ limit: 5, ++ empty: $('.empty-recent', {}, localize('noAnnouncements', "There are no current announcements.")), ++ renderElement: renderAnnouncement, ++ contextService: this.contextService ++ }); ++ ++ if (!this.announcementData) { ++ const showExtras = this.configurationService.getValue('workbench.welcomePage.extraAnnouncements'); ++ ++ if (showExtras) { ++ const branch = this.productService.quality === 'insider' ? 'insider' : 'master'; ++ const res = await fetch(`https://raw.githubusercontent.com/VSCodium/vscodium/${branch}/announcements-extra.json`); ++ ++ if (res.ok) { ++ var extraAnnouncements = await res.json() as AnnouncementEntry[]; ++ ++ this.announcementData = [...extraAnnouncements, ...BUILTIN_ANNOUNCEMENTS]; ++ } else { ++ this.announcementData = BUILTIN_ANNOUNCEMENTS; ++ } ++ } else { ++ this.announcementData = BUILTIN_ANNOUNCEMENTS; ++ } ++ } ++ ++ announcementList.setEntries(this.announcementData); ++ ++ return announcementList; ++ } ++ + private buildStartList(): GettingStartedIndexList { diff --git a/prepare_vscode.sh b/prepare_vscode.sh index 5997571..b06f849 100755 --- a/prepare_vscode.sh +++ b/prepare_vscode.sh @@ -164,6 +164,9 @@ setpath "package" "release" $( echo "${RELEASE_VERSION}" | sed -n -E "s/^(.*)\.( replace 's|Microsoft Corporation|VSCodium|' package.json +# announcements +replace "s|\\[\\/\\* BUILTIN_ANNOUNCEMENTS \\*\\/\\]|$( cat ../announcements-builtin.json | tr -d '\n' )|" src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts + ../undo_telemetry.sh replace 's|Microsoft Corporation|VSCodium|' build/lib/electron.js