Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions packages/web-app-external/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<template>
<div v-if="isCollabora" id="chrome-colors" class="bg-role-chrome text-role-on-chrome hidden" />
<div v-if="isLoading" class="size-full flex justify-center items-center">
<oc-spinner size="large" />
</div>
Expand All @@ -15,6 +16,7 @@
<div v-for="(item, key, index) in formParameters" :key="index">
<input :name="key" :value="item" type="hidden" />
</div>
<input v-if="isCollabora" name="css_variables" :value="getCollaboraCss()" type="hidden" />
</form>
<iframe
ref="appIframe"
Expand Down Expand Up @@ -111,9 +113,9 @@ const appName = computed(() => {
})

const appUrl = ref<string>()
const formParameters = ref({})
const formParameters = ref<Record<string, string>>({})
const method = ref<string>()
const subm = useTemplateRef<HTMLInputElement>('subm')
const subm = useTemplateRef('subm')
const isLoading = computed(() => loadAppUrl.isRunning || getSharedDriveItemTask.isRunning)

const iFrameTitle = computed(() => {
Expand All @@ -130,6 +132,17 @@ const errorPopup = (error: string) => {
})
}

const getCollaboraCss = () => {
const chromeEl = document.getElementById('chrome-colors')
if (!chromeEl) {
return ''
}
const chromeStyle = window.getComputedStyle(chromeEl)
const chromeColor = chromeStyle.getPropertyValue('background-color')
const onChromeColor = chromeStyle.getPropertyValue('color')
return `--co-body-bg=${chromeColor};--co-color-main-text=${onChromeColor}`
}

const loadAppUrl = useTask(function* (signal, viewMode: string) {
try {
if (isReadOnly && viewMode === 'write') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`The app provider extension > should be able to load an iFrame via get 1`] = `
"<iframe src="https://example.test/d12ab86/loe009157-MzBw" class="size-full" title="&quot;example-app&quot; app content area" allowfullscreen=""></iframe>
"<!--v-if-->

<iframe src="https://example.test/d12ab86/loe009157-MzBw" class="size-full" title="&quot;example-app&quot; app content area" allowfullscreen=""></iframe>

<!--v-if-->"
`;

exports[`The app provider extension > should be able to load an iFrame via post 1`] = `
"<!--v-if-->

<!--v-if-->

<div class="size-full">
<form action="https://example.test/d12ab86/loe009157-MzBw" target="app-iframe" method="post"><input type="submit" class="hidden" value="[object Object]">
<div><input name="access_token" type="hidden" value="asdfsadfsadf"></div>
<div><input name="access_token_ttl" type="hidden" value="123456"></div>
<!--v-if-->
</form> <iframe name="app-iframe" class="size-full" title="&quot;example-app&quot; app content area" allowfullscreen=""></iframe>
</div>"
`;

exports[`The app provider extension > should fail for unauthenticated users 1`] = `
"<div class="size-full flex justify-center items-center">
"<!--v-if-->

<div class="size-full flex justify-center items-center">
<oc-spinner-stub size="large"></oc-spinner-stub>
</div>

Expand Down