File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,11 @@ export const check_for_updates_command = (
1717 )
1818
1919 if ( action === t ( 'command.check-for-updates-command.action.update' ) ) {
20- update_extension ( )
20+ if ( prompt_view_provider . update_info . latest_version_sha ) {
21+ update_extension ( {
22+ commit_sha : prompt_view_provider . update_info . latest_version_sha
23+ } )
24+ }
2125 }
2226 } else {
2327 vscode . window . showInformationMessage (
Original file line number Diff line number Diff line change @@ -159,9 +159,9 @@ export const install_specific_version_command = () => {
159159
160160 quick_pick . onDidAccept ( ( ) => {
161161 const selected = quick_pick . selectedItems [ 0 ]
162- if ( selected ) {
162+ if ( selected && selected . sha ) {
163163 quick_pick . hide ( )
164- update_extension ( selected . sha )
164+ update_extension ( { commit_sha : selected . sha } )
165165 }
166166 } )
167167
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ export const check_for_updates = async (
5656 return {
5757 is_available : true ,
5858 latest_version,
59+ latest_version_sha : vscode_tag . commit ?. sha ,
5960 current_version_age_days : age_days
6061 }
6162 } else {
Original file line number Diff line number Diff line change 11import * as vscode from 'vscode'
22import * as os from 'os'
33
4- export const update_extension = ( sha ?: string ) => {
4+ export const update_extension = ( params : { commit_sha : string } ) => {
55 const terminal = vscode . window . createTerminal ( 'CWC Updater' )
66 terminal . show ( )
77
8- const uriScheme = vscode . env . uriScheme
8+ const uri_scheme = vscode . env . uriScheme
99 const lang = vscode . env . language
10- const commitSha = sha || ''
1110
1211 if ( os . platform ( ) === 'win32' ) {
1312 terminal . sendText (
14- `powershell -c "& ([scriptblock]::Create((irm https://raw.githubusercontent.com/CodeWebChat/CWC/main/install.ps1))) '${ uriScheme } ' '${ lang } ' '${ commitSha } '"`
13+ `powershell -c "& ([scriptblock]::Create((irm https://raw.githubusercontent.com/CodeWebChat/CWC/main/install.ps1))) '${ uri_scheme } ' '${ lang } ' '${ params . commit_sha } '"`
1514 )
1615 } else {
1716 terminal . sendText (
18- `curl -fsSL https://raw.githubusercontent.com/CodeWebChat/CWC/main/install.sh | bash -s -- "${ uriScheme } " "${ lang } " "${ commitSha } "`
17+ `curl -fsSL https://raw.githubusercontent.com/CodeWebChat/CWC/main/install.sh | bash -s -- "${ uri_scheme } " "${ lang } " "${ params . commit_sha } "`
1918 )
2019 }
2120}
Original file line number Diff line number Diff line change 11import { update_extension } from '@/utils/update-extension'
2+ import { PromptViewProvider } from '../prompt-view-provider'
23
3- export const handle_update_extension = ( ) => {
4- update_extension ( )
4+ export const handle_update_extension = (
5+ prompt_view_provider : PromptViewProvider
6+ ) => {
7+ if ( prompt_view_provider . update_info . latest_version_sha ) {
8+ update_extension ( {
9+ commit_sha : prompt_view_provider . update_info . latest_version_sha
10+ } )
11+ }
512}
Original file line number Diff line number Diff line change @@ -840,7 +840,7 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
840840 } else if ( message . command === 'CLEAR_COMPLETED_TASKS' ) {
841841 await handlers . handle_clear_completed_tasks ( this )
842842 } else if ( message . command === 'UPDATE_EXTENSION' ) {
843- handlers . handle_update_extension ( )
843+ handlers . handle_update_extension ( this )
844844 } else if ( message . command === 'GET_UPDATE_INFO' ) {
845845 this . send_message ( {
846846 command : 'UPDATE_INFO' ,
Original file line number Diff line number Diff line change @@ -458,6 +458,7 @@ export interface SaveTasksMessage extends BaseMessage {
458458export type UpdateInfo = {
459459 is_available : boolean
460460 latest_version ?: string
461+ latest_version_sha ?: string
461462 current_version_age_days ?: number
462463}
463464
You can’t perform that action at this time.
0 commit comments