瀏覽代碼

Merge pull request #162 from meienberger/feature/open-app-https

feat(apps): allow https protocol
Nicolas Meienberger 2 年之前
父節點
當前提交
36264cd9de

+ 7 - 1
packages/dashboard/src/generated/graphql.tsx

@@ -56,6 +56,7 @@ export type AppInfo = {
   categories: Array<AppCategoriesEnum>;
   description: Scalars['String'];
   form_fields: Array<FormField>;
+  https?: Maybe<Scalars['Boolean']>;
   id: Scalars['String'];
   name: Scalars['String'];
   port: Scalars['Float'];
@@ -301,6 +302,7 @@ export type GetAppQuery = {
       source: string;
       categories: Array<AppCategoriesEnum>;
       url_suffix?: string | null;
+      https?: boolean | null;
       form_fields: Array<{
         __typename?: 'FormField';
         type: FieldTypesEnum;
@@ -326,7 +328,7 @@ export type InstalledAppsQuery = {
     config: any;
     version?: number | null;
     updateInfo?: { __typename?: 'UpdateInfo'; current: number; latest: number; dockerVersion?: string | null } | null;
-    info?: { __typename?: 'AppInfo'; id: string; name: string; description: string; tipi_version: number; short_desc: string } | null;
+    info?: { __typename?: 'AppInfo'; id: string; name: string; description: string; tipi_version: number; short_desc: string; https?: boolean | null } | null;
   }>;
 };
 
@@ -352,6 +354,7 @@ export type ListAppsQuery = {
       short_desc: string;
       author: string;
       categories: Array<AppCategoriesEnum>;
+      https?: boolean | null;
     }>;
   };
 };
@@ -711,6 +714,7 @@ export const GetAppDocument = gql`
         source
         categories
         url_suffix
+        https
         form_fields {
           type
           label
@@ -770,6 +774,7 @@ export const InstalledAppsDocument = gql`
         description
         tipi_version
         short_desc
+        https
       }
     }
   }
@@ -846,6 +851,7 @@ export const ListAppsDocument = gql`
         short_desc
         author
         categories
+        https
       }
       total
     }

+ 1 - 0
packages/dashboard/src/graphql/queries/getApp.graphql

@@ -22,6 +22,7 @@ query GetApp($appId: String!) {
       source
       categories
       url_suffix
+      https
       form_fields {
         type
         label

+ 1 - 0
packages/dashboard/src/graphql/queries/installedApps.graphql

@@ -15,6 +15,7 @@ query InstalledApps {
       description
       tipi_version
       short_desc
+      https
     }
   }
 }

+ 1 - 0
packages/dashboard/src/graphql/queries/listApps.graphql

@@ -11,6 +11,7 @@ query ListApps {
       short_desc
       author
       categories
+      https
     }
     total
   }

+ 4 - 1
packages/dashboard/src/modules/Apps/containers/AppDetails.tsx

@@ -130,7 +130,10 @@ const AppDetails: React.FC<IProps> = ({ app, info }) => {
   };
 
   const handleOpen = () => {
-    window.open(`http://${internalIp}:${info.port}${info.url_suffix || ''}`, '_blank', 'noreferrer');
+    const { https } = info;
+    const protocol = https ? 'https' : 'http';
+
+    window.open(`${protocol}://${internalIp}:${info.port}${info.url_suffix || ''}`, '_blank', 'noreferrer');
   };
 
   const version = [info?.version || 'unknown', app?.version ? `(${app.version})` : ''].join(' ');

+ 3 - 0
packages/system-api/src/modules/apps/apps.types.ts

@@ -121,6 +121,9 @@ class AppInfo {
 
   @Field(() => GraphQLJSONObject, { nullable: true })
   requirements?: Requirements;
+
+  @Field(() => Boolean, { nullable: true })
+  https?: boolean;
 }
 
 @ObjectType()