Skip to content

Commit a3e6168

Browse files
add option preview
1 parent 12ee340 commit a3e6168

File tree

7 files changed

+13
-16
lines changed

7 files changed

+13
-16
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
API_URL=http://localhost:8000/api
2+
PREVIEW_URL=http://localhost:9999
23
OAUTH2_GOOGLE_CLIENT_ID="string"
34
OAUTH2_GITHUB_CLIENT_ID="string"

quasar.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ module.exports = configure(function (/* ctx */) {
6969
CODESPACE_NAME: process.env.CODESPACE_NAME,
7070
GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:
7171
process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN,
72+
PREVIEW_URL: process.env.GITPOD_WORKSPACE_URL
73+
? process.env.GITPOD_WORKSPACE_URL.replace(
74+
"https://",
75+
"https://9999-"
76+
)
77+
: process.env.CODESPACE_NAME
78+
? `https://${process.env.CODESPACE_NAME}-9999.${process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}`
79+
: undefined,
7280
...require("dotenv").config().parsed,
7381
},
7482
rawDefine: {

src/boot/auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function loginWithGoogle() {
5454
// Parameters to pass to OAuth 2.0 endpoint.
5555
const params = {
5656
client_id: process.env.OAUTH2_GOOGLE_CLIENT_ID,
57-
redirect_uri: `${APP_URL}login?oauth2=true&type=google`,
57+
redirect_uri: `${location.origin}/login?oauth2=true&type=google`,
5858
response_type: "id_token",
5959
scope: "email profile openid",
6060
nonce: "1",
@@ -72,7 +72,7 @@ export function loginWithGithub() {
7272
// Parameters to pass to OAuth 2.0 endpoint.
7373
const params = {
7474
client_id: process.env.OAUTH2_GITHUB_CLIENT_ID,
75-
redirect_uri: `${APP_URL}login?oauth2=true&type=github`,
75+
redirect_uri: `${location.origin}login?oauth2=true&type=github`,
7676
scope: "read:user user:email",
7777
}
7878

src/components/sketch/SketchMain/Preview/Preview.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,7 @@ const watchFs = new WatcherFs()
5353
const iframeLoading = ref(true)
5454
// ====== /status ======
5555
56-
const srcIFrame = ref(
57-
process.env.GITPOD_WORKSPACE_URL
58-
? process.env.GITPOD_WORKSPACE_URL.replace("https://", "https://9999-")
59-
: process.env.CODESPACE_NAME
60-
? `https://${process.env.CODESPACE_NAME}-9999.${process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}`
61-
: "https://preview-fcanvas.github.io"
62-
)
56+
const srcIFrame = ref(process.env.PREVIEW_URL)
6357
6458
// eslint-disable-next-line functional/no-let
6559
let listenerGetFile: null | (() => void) = null

src/constants/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,4 @@ export const isNative =
33
import.meta.env.MODE === "ios" ||
44
import.meta.env.MODE === "electron"
55

6-
export const APP_URL = process.env.GITPOD_WORKSPACE_URL
7-
? process.env.GITPOD_WORKSPACE_URL.replace("https://", "https://9000-") + "/"
8-
: process.env.CODESPACE_NAME
9-
? `${process.env.CODESPACE_NAME}-9000.${process.env.GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/`
10-
: process.env.API_URL
11-
126
export const FILE_ICON_THEMES = ["material-icon-theme", "material-theme-icon"]

src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ declare namespace NodeJS {
44
VUE_ROUTER_MODE: "hash" | "history" | "abstract" | undefined
55
VUE_ROUTER_BASE: string | undefined
66
API_URL: string
7+
PREVIEW_URL: string
78
OAUTH2_GOOGLE_CLIENT_ID: string
89
OAUTH2_GITHUB_CLIENT_ID: string
910
}

src/globals.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
declare const API_URL: string

0 commit comments

Comments
 (0)