File tree Expand file tree Collapse file tree 11 files changed +18
-20
lines changed Expand file tree Collapse file tree 11 files changed +18
-20
lines changed Original file line number Diff line number Diff line change 11import axios from "axios"
22import * as vscode from "vscode"
33
4- import type { ShareResponse } from "@roo-code/types"
4+ import { shareResponseSchema } from "@roo-code/types"
55import { getRooCodeApiUrl } from "./Config"
66import type { AuthService } from "./AuthService"
77import type { SettingsService } from "./SettingsService"
@@ -24,10 +24,6 @@ export class ShareService {
2424 */
2525 async shareTask ( taskId : string ) : Promise < boolean > {
2626 try {
27- if ( ! this . authService . hasActiveSession ( ) ) {
28- return false
29- }
30-
3127 const sessionToken = this . authService . getSessionToken ( )
3228 if ( ! sessionToken ) {
3329 return false
@@ -45,7 +41,7 @@ export class ShareService {
4541 } ,
4642 )
4743
48- const data = response . data as ShareResponse
44+ const data = shareResponseSchema . parse ( response . data )
4945 this . log ( "[share] Share link created successfully:" , data )
5046
5147 if ( data . success && data . shareUrl ) {
Original file line number Diff line number Diff line change @@ -109,8 +109,10 @@ export const ORGANIZATION_DEFAULT: OrganizationSettings = {
109109 * Share Types
110110 */
111111
112- export interface ShareResponse {
113- success : boolean
114- shareUrl ?: string
115- error ?: string
116- }
112+ export const shareResponseSchema = z . object ( {
113+ success : z . boolean ( ) ,
114+ shareUrl : z . string ( ) . optional ( ) ,
115+ error : z . string ( ) . optional ( ) ,
116+ } )
117+
118+ export type ShareResponse = z . infer < typeof shareResponseSchema >
Original file line number Diff line number Diff line change 8282 "custom_storage_path_set" : " Ruta d'emmagatzematge personalitzada establerta: {{path}}" ,
8383 "default_storage_path" : " S'ha reprès l'ús de la ruta d'emmagatzematge predeterminada" ,
8484 "settings_imported" : " Configuració importada correctament." ,
85- "share_link_copied" : " Enllaç de compartició copiat al portapapers! "
85+ "share_link_copied" : " Enllaç de compartició copiat al portapapers"
8686 },
8787 "answers" : {
8888 "yes" : " Sí" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " Benutzerdefinierter Speicherpfad festgelegt: {{path}}" ,
7979 "default_storage_path" : " Auf Standardspeicherpfad zurückgesetzt" ,
8080 "settings_imported" : " Einstellungen erfolgreich importiert." ,
81- "share_link_copied" : " Share-Link in die Zwischenablage kopiert! "
81+ "share_link_copied" : " Share-Link in die Zwischenablage kopiert"
8282 },
8383 "answers" : {
8484 "yes" : " Ja" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " Custom storage path set: {{path}}" ,
7979 "default_storage_path" : " Reverted to using default storage path" ,
8080 "settings_imported" : " Settings imported successfully." ,
81- "share_link_copied" : " Share link copied to clipboard! "
81+ "share_link_copied" : " Share link copied to clipboard"
8282 },
8383 "answers" : {
8484 "yes" : " Yes" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " Ruta de almacenamiento personalizada establecida: {{path}}" ,
7979 "default_storage_path" : " Se ha vuelto a usar la ruta de almacenamiento predeterminada" ,
8080 "settings_imported" : " Configuración importada correctamente." ,
81- "share_link_copied" : " ¡ Enlace de compartir copiado al portapapeles! "
81+ "share_link_copied" : " Enlace de compartir copiado al portapapeles"
8282 },
8383 "answers" : {
8484 "yes" : " Sí" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " Chemin de stockage personnalisé défini : {{path}}" ,
7979 "default_storage_path" : " Retour au chemin de stockage par défaut" ,
8080 "settings_imported" : " Paramètres importés avec succès." ,
81- "share_link_copied" : " Lien de partage copié dans le presse-papiers ! "
81+ "share_link_copied" : " Lien de partage copié dans le presse-papiers"
8282 },
8383 "answers" : {
8484 "yes" : " Oui" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " कस्टम स्टोरेज पाथ सेट किया गया: {{path}}" ,
7979 "default_storage_path" : " डिफ़ॉल्ट स्टोरेज पाथ का उपयोग पुनः शुरू किया गया" ,
8080 "settings_imported" : " सेटिंग्स सफलतापूर्वक इम्पोर्ट की गईं।" ,
81- "share_link_copied" : " साझा लिंक क्लिपबोर्ड पर कॉपी किया गया! "
81+ "share_link_copied" : " साझा लिंक क्लिपबोर्ड पर कॉपी किया गया"
8282 },
8383 "answers" : {
8484 "yes" : " हां" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " Percorso di archiviazione personalizzato impostato: {{path}}" ,
7979 "default_storage_path" : " Tornato al percorso di archiviazione predefinito" ,
8080 "settings_imported" : " Impostazioni importate con successo." ,
81- "share_link_copied" : " Link di condivisione copiato negli appunti! "
81+ "share_link_copied" : " Link di condivisione copiato negli appunti"
8282 },
8383 "answers" : {
8484 "yes" : " Sì" ,
Original file line number Diff line number Diff line change 7878 "custom_storage_path_set" : " 自定义存储路径已设置:{{path}}" ,
7979 "default_storage_path" : " 已恢复使用默认存储路径" ,
8080 "settings_imported" : " 设置已成功导入。" ,
81- "share_link_copied" : " 分享链接已复制到剪贴板! "
81+ "share_link_copied" : " 分享链接已复制到剪贴板"
8282 },
8383 "answers" : {
8484 "yes" : " 是" ,
You can’t perform that action at this time.
0 commit comments