Skip to content
Snippets Groups Projects
Select Git revision
  • 1505-improve-tagging-of-released-docker-images
  • develop default protected
  • master
  • 1518-update-django-allauth
  • 1515-update-click
  • 1434-update-pyld
  • heyarne/funkwhale-enhancement/linting
  • 1481
  • profile-menu-redesign
  • update-frontend-dependencies
  • fix-track-table
  • back-option-for-edits
  • album-sliders
  • cherry-pick-31413fe6
  • 1108-remove-jwt-and-switch-to-oauth-for-ui-auth
  • set-sast-config-2
  • set-sast-config-1
  • 1121-download
  • plugins-v3
  • plugins-v2
  • 1.1.2
  • 1.1.1
  • 1.1
  • 1.1-rc2
  • 1.1-rc1
  • 1.0.1
  • 1.0
  • 1.0-rc1
  • 0.21.2
  • 0.21.1
  • 0.21
  • 0.21-rc2
  • 0.21-rc1
  • 0.20.1
  • 0.20.0
  • 0.20.0-rc1
  • 0.19.1
  • 0.19.0
  • 0.19.0-rc2
  • 0.19.0-rc1
40 results

index.js

Blame
  • Forked from funkwhale / funkwhale
    3793 commits behind the upstream repository.
    index.js 29.66 KiB
    import Vue from 'vue'
    import Router from 'vue-router'
    import store from '@/store'
    
    Vue.use(Router)
    
    function adminPermissions (to, from, next) {
      if (store.state.auth.authenticated === true && store.state.auth.availablePermissions.settings === true) {
        next()
      } else {
        console.log('Not authenticated. Redirecting to library.')
        next({ name: 'library.index' })
      }
    }
    
    function moderatorPermissions (to, from, next) {
      if (store.state.auth.authenticated === true && store.state.auth.availablePermissions.moderation === true) {
        next()
      } else {
        console.log('Not authenticated. Redirecting to library.')
        next({ name: 'library.index' })
      }
    }
    
    function libraryPermissions (to, from, next) {
      if (store.state.auth.authenticated === true && store.state.auth.availablePermissions.library === true) {
        next()
      } else {
        console.log('Not authenticated. Redirecting to library.')
        next({ name: 'library.index' })
      }
    }
    
    console.log('PROCESS', process.env)
    export default new Router({
      mode: 'history',
      linkActiveClass: 'active',
      base: process.env.VUE_APP_ROUTER_BASE_URL || '/',
      scrollBehavior (to, from, savedPosition) {
        if (to.meta.preserveScrollPosition) {
          return savedPosition
        }
        return new Promise(resolve => {
          setTimeout(() => {
            if (to.hash) {
              resolve({ selector: to.hash })
            }
            const pos = savedPosition || { x: 0, y: 0 }
            resolve(pos)
          }, 100)
        })
      },
      routes: [
        {
          path: '/',
          name: 'index',
          component: () =>
            import(/* webpackChunkName: "core" */ '@/components/Home')
        },
        {
          path: '/front',
          name: 'front',
          redirect: to => {
            const { hash, query } = to
            return { name: 'index', hash, query }
          }
        },
        {
          path: '/about',
          name: 'about',