🎨 Site > Improve URL
This commit is contained in:
+1
-1
@@ -198,7 +198,7 @@ class App
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open in browser
|
// Open in browser
|
||||||
const url = this.config.domain + '/' + project.slug
|
const url = this.config.domain
|
||||||
console.log('app'.green.bold + ' - ' + url.yellow)
|
console.log('app'.green.bold + ' - ' + url.yellow)
|
||||||
|
|
||||||
if(this.config.open)
|
if(this.config.open)
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ class Projects
|
|||||||
describe()
|
describe()
|
||||||
{
|
{
|
||||||
const result = {}
|
const result = {}
|
||||||
|
result.domain = this.config.domain
|
||||||
result.all = {}
|
result.all = {}
|
||||||
|
|
||||||
for(const _slug in this.all)
|
for(const _slug in this.all)
|
||||||
|
|||||||
-94
@@ -103,100 +103,6 @@ class Site
|
|||||||
{
|
{
|
||||||
this.express.use('/', express.static(path.join(__dirname, '../site/dist')))
|
this.express.use('/', express.static(path.join(__dirname, '../site/dist')))
|
||||||
|
|
||||||
// // Project route
|
|
||||||
// this.express.get('/' + _project.slug, (request, response) =>
|
|
||||||
// {
|
|
||||||
// response.send(`
|
|
||||||
// <a href="/${_project.slug}/download" download>download project</a>
|
|
||||||
// <a href="/${_project.slug}/files/empty.txt" download>download file</a>
|
|
||||||
|
|
||||||
// <form action="#" class="infos-form">
|
|
||||||
// <input type="text" class="name" value="" /> Name
|
|
||||||
// <input type="submit" value="send" />
|
|
||||||
// </form>
|
|
||||||
|
|
||||||
// <form action="#" class="message-form">
|
|
||||||
// <input type="text" class="text" value="Lorem ipsum" /> Text
|
|
||||||
// <input type="number" class="file" value="1" /> File
|
|
||||||
// <input type="line" class="line" value="2" /> Line
|
|
||||||
// <input type="submit" value="send" />
|
|
||||||
// </form>
|
|
||||||
|
|
||||||
// <div class="messages"></div>
|
|
||||||
|
|
||||||
// <script src="/socket.io/socket.io.js"></script>
|
|
||||||
// <script>
|
|
||||||
// const socket = io('${this.config.domain}/project/${_project.slug}/chat')
|
|
||||||
|
|
||||||
// socket.on('connect', () =>
|
|
||||||
// {
|
|
||||||
// console.log('connected')
|
|
||||||
// })
|
|
||||||
|
|
||||||
// // Infos
|
|
||||||
// const $infosForm = document.querySelector('.infos-form')
|
|
||||||
// const $name = $infosForm.querySelector('.name')
|
|
||||||
|
|
||||||
// $infosForm.addEventListener('submit', (event) =>
|
|
||||||
// {
|
|
||||||
// event.preventDefault()
|
|
||||||
|
|
||||||
// const name = $name.value
|
|
||||||
|
|
||||||
// socket.emit('update_infos', { name })
|
|
||||||
// })
|
|
||||||
|
|
||||||
// socket.on('infos', (data) =>
|
|
||||||
// {
|
|
||||||
// console.log('infos')
|
|
||||||
// console.log(data)
|
|
||||||
// $name.value = data.name
|
|
||||||
// })
|
|
||||||
|
|
||||||
// // Messages
|
|
||||||
// const $messages = document.querySelector('.messages')
|
|
||||||
// const $messageForm = document.querySelector('.message-form')
|
|
||||||
// const $text = $messageForm.querySelector('.text')
|
|
||||||
// const $file = $messageForm.querySelector('.file')
|
|
||||||
// const $line = $messageForm.querySelector('.line')
|
|
||||||
|
|
||||||
// $messageForm.addEventListener('submit', (event) =>
|
|
||||||
// {
|
|
||||||
// event.preventDefault()
|
|
||||||
|
|
||||||
// const text = $text.value
|
|
||||||
// const file = $file.value
|
|
||||||
// const line = $line.value
|
|
||||||
|
|
||||||
// socket.emit('message', { text, file, line })
|
|
||||||
// })
|
|
||||||
|
|
||||||
// socket.on('message', (data) =>
|
|
||||||
// {
|
|
||||||
// console.log('message')
|
|
||||||
// console.log(data)
|
|
||||||
|
|
||||||
// $message = document.createElement('div')
|
|
||||||
|
|
||||||
// const $author = document.createElement('div')
|
|
||||||
// $author.style.color = data.user.color
|
|
||||||
// $author.innerHTML = data.user.name
|
|
||||||
// $message.appendChild($author)
|
|
||||||
|
|
||||||
// const $info = document.createElement('div')
|
|
||||||
// $info.innerHTML = data.file + ':' + data.line
|
|
||||||
// $message.appendChild($info)
|
|
||||||
|
|
||||||
// const $text = document.createElement('div')
|
|
||||||
// $text.innerHTML = data.text
|
|
||||||
// $message.appendChild($text)
|
|
||||||
|
|
||||||
// $messages.appendChild($message)
|
|
||||||
// })
|
|
||||||
// </script>
|
|
||||||
// `)
|
|
||||||
// })
|
|
||||||
|
|
||||||
// Project download route
|
// Project download route
|
||||||
this.express.get('/' + _project.slug + '/download', (request, response) =>
|
this.express.get('/' + _project.slug + '/download', (request, response) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export default
|
|||||||
|
|
||||||
this.projectsSocket.on('update_projects', (data) =>
|
this.projectsSocket.on('update_projects', (data) =>
|
||||||
{
|
{
|
||||||
|
this.$store.commit('updateUrl', data.domain)
|
||||||
this.$store.commit('updateProjects', data.all)
|
this.$store.commit('updateProjects', data.all)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ export default
|
|||||||
|
|
||||||
computed:
|
computed:
|
||||||
{
|
{
|
||||||
project()
|
downloadUrl()
|
||||||
{
|
{
|
||||||
return this.$store.state.projects.current
|
return `${this.$store.state.url}/${this.$store.state.projects.current.slug}/files/${this.content.path.full}`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<a href="#" @click.prevent="onDifferencesClick">Differences <span v-if="differencesActive">(on)</span></a>
|
<a href="#" @click.prevent="onDifferencesClick">Differences <span v-if="differencesActive">(on)</span></a>
|
||||||
<a href="#" @click.prevent="onVersionsClick">Versions <span v-if="versionsActive">(on)</span></a>
|
<a href="#" @click.prevent="onVersionsClick">Versions <span v-if="versionsActive">(on)</span></a>
|
||||||
<a :href="`${project.slug}/files/${content.path.full}`" download>Download</a>
|
<a :href="downloadUrl" download>Download</a>
|
||||||
{{ content.path.directory }} {{ content.name }}
|
{{ content.path.directory }} {{ content.name }}
|
||||||
</header>
|
</header>
|
||||||
<versions :file="content" :content="content.versions" v-if="versionsActive"></versions>
|
<versions :file="content" :content="content.versions" v-if="versionsActive"></versions>
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ export default
|
|||||||
|
|
||||||
computed:
|
computed:
|
||||||
{
|
{
|
||||||
|
downloadUrl()
|
||||||
|
{
|
||||||
|
return `${this.$store.state.url}/${this.project.slug}/download`
|
||||||
|
},
|
||||||
|
|
||||||
project()
|
project()
|
||||||
{
|
{
|
||||||
return this.$store.state.projects.current
|
return this.$store.state.projects.current
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div>
|
<div>
|
||||||
{{ project.name }}
|
{{ project.name }}
|
||||||
<a :href="`${project.slug}/download`" download>Download</a>
|
<a :href="downloadUrl" download>Download</a>
|
||||||
|
|
||||||
<files-tree></files-tree>
|
<files-tree></files-tree>
|
||||||
<file v-if="file" :content="file"></file>
|
<file v-if="file" :content="file"></file>
|
||||||
|
|||||||
@@ -13,5 +13,18 @@ export default new Vuex.Store({
|
|||||||
chat: chatModule,
|
chat: chatModule,
|
||||||
projects: projectsModule,
|
projects: projectsModule,
|
||||||
files: filesModule
|
files: filesModule
|
||||||
|
},
|
||||||
|
|
||||||
|
state:
|
||||||
|
{
|
||||||
|
url: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
mutations:
|
||||||
|
{
|
||||||
|
updateUrl(state, data)
|
||||||
|
{
|
||||||
|
state.url = data
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user