Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overview node don't honor codeEditor #1950

Open
mathdesc opened this issue Nov 17, 2024 · 3 comments
Open

Overview node don't honor codeEditor #1950

mathdesc opened this issue Nov 17, 2024 · 3 comments

Comments

@mathdesc
Copy link

mathdesc commented Nov 17, 2024

Describe the bug

The audience can modify the presenter notes in the overview despite #1059.
I would expect codeEditor set false to prevent !isPresenter clients to prevent this

Minimal reproduction

  1. Setting slides frontmatter with
presenter: dev
editor: false
selectable: true

1 . Presenter starting slide with:
slidev --open --log error --remote=presenterPass --bind=localserver.ip

  1. Presenter go to localserver.ip/presenter and enter the password to start the presentation with its notes embedded in presentation
  2. Audience go to localserver.ip/ to attend the talk yet cannot go to presenter view nor notes from entry node without password
  3. BUT audience can go to overview, which enables to changes notes from there
  4. Resulting in notes overrides

Environment

  • Slidev version: latest release v0.49.29
  • Browser: tested with chrome, firefox ... I suppose any
  • OS: linux ... I suppose any
@mathdesc
Copy link
Author

mathdesc commented Nov 17, 2024

  • One radical way to address this could be to disable overview for audience, since they could rely on the quick overview.
  • A good way would be to enable/disable the overview notes modification require isPresenter client and a passwordSet
  • Or a even better one could be to disable syncing of notes, letting audience take any local notes directly from the slidedeck. In this case the ability to retrieve their notes would be a concern (that could be addressed with web local storage dump mapping slideno, local notes, PNG b64encode of the slide)

Edit:
There is no good way since overview node is not routed/differentiated by presenter/audience role : there is no presenter/overview to which apply a v-if isPresentercondition to.

@mathdesc
Copy link
Author

mathdesc commented Nov 17, 2024

I find a workaround not as radical to disable note editing in the overview, when a password is set even if editor is true

--- node_modules/@slidev/client/pages/overview.vue	2024-11-17 22:18:15.722967683 +0100
+++ node_modules/@slidev/client/pages/overview.vue.orig	2024-11-17 22:08:40.966328165 +0100
@@ -32,9 +32,6 @@
 const totalWords = computed(() => wordCounts.value.reduce((a, b) => a + b, 0))
 const totalClicks = computed(() => slides.value.map(route => getSlideClicks(route)).reduce((a, b) => a + b, 0))
 
-const passwordSet = typeof (configs.remote) === 'string' && configs.remote.length
-
-
 const clicksContextMap = new WeakMap<SlideRoute, ClicksContext>()
 function getClicksContext(route: SlideRoute) {
   // We create a local clicks context to calculate the total clicks of the slide
@@ -164,7 +161,7 @@
             <carbon:presentation-file />
           </IconButton>
           <IconButton
-            v-if="route.meta?.slide &&  (configs.editor && !passwordSet)"
+            v-if="route.meta?.slide"
             class="mr--3 op0 group-hover:op80"
             title="Open in editor"
             @click="openInEditor(`${route.meta.slide.filepath}:${route.meta.slide.start}`)"
@@ -200,8 +197,8 @@
             @dblclick="getClicksContext(route).current = CLICKS_MAX"
           />
         </div>
-        <div  v-if="configs.editor && !passwordSet" class="py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100">
-          <IconButton 
+        <div class="py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100">
+          <IconButton
             title="Edit Note"
             class="rounded-full w-9 h-9 text-sm"
             :class="edittingNote === route.no ? 'important:op0' : ''"
@@ -210,7 +207,7 @@
             <carbon:pen />
           </IconButton>
         </div>
-        <NoteEditable v-if="configs.editor && !passwordSet"
+        <NoteEditable
           :no="route.no"
           class="max-w-250 w-250 text-lg rounded p3"
           :auto-height="true"

And

--- node_modules/@slidev/cli/node_modules/@slidev/client/pages/overview.vue	2024-11-17 22:08:53.318276716 +0100
+++ node_modules/@slidev/cli/node_modules/@slidev/client/pages/overview.vue.orig	2024-11-17 22:08:53.318276716 +0100
@@ -14,7 +14,6 @@
 import ClicksSlider from '../internals/ClicksSlider.vue'
 import { CLICKS_MAX } from '../constants'
 import { useNav } from '../composables/useNav'
-import { configs } from '../env'
 
 const cardWidth = 450
 
@@ -29,8 +28,6 @@
 const totalWords = computed(() => wordCounts.value.reduce((a, b) => a + b, 0))
 const totalClicks = computed(() => slides.value.map(route => getSlideClicks(route)).reduce((a, b) => a + b, 0))
 
-const passwordSet = typeof (configs.remote) === 'string' && configs.remote.length
-
 const activeSlide = shallowRef<SlideRoute>()
 const clicksContextMap = new WeakMap<SlideRoute, ClicksContext>()
 function getClicksContext(route: SlideRoute) {
@@ -176,7 +173,7 @@
             <carbon:presentation-file />
           </IconButton>
           <IconButton
-            v-if="__DEV__ &&  (configs.editor && !passwordSet) && route.meta?.slide"
+            v-if="__DEV__ && route.meta?.slide"
             class="mr--3 op0 group-hover:op80"
             title="Open in editor"
             @click="openInEditor(`${route.meta.slide.filepath}:${route.meta.slide.start}`)"
@@ -211,7 +208,7 @@
             @click="activeSlide = route"
           />
         </div>
-        <div  v-if="configs.editor && !passwordSet" class="py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100">
+        <div class="py3 mt-0.5 mr--8 ml--4 op0 transition group-hover:op100">
           <IconButton
             title="Edit Note"
             class="rounded-full w-9 h-9 text-sm"
@@ -221,7 +218,7 @@
             <carbon:pen />
           </IconButton>
         </div>
-        <NoteEditable  v-if="configs.editor && !passwordSet"
+        <NoteEditable
           :no="route.no"
           class="max-w-250 w-250 text-lg rounded p3"
           :auto-height="true"

@mathdesc
Copy link
Author

mathdesc commented Nov 17, 2024

An implementation of the radical way could be adding the passwordGuard function on beforeEnter of route /overview in node_modules/@slidev/cli/node_modules/@slidev/client/setup/routes.ts.

routes.push(
...
      {
        name: 'overview',
        path: '/overview',
        component: () => import('../pages/overview.vue'),
        beforeEnter: passwordGuard,
      },
...
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants