Code changes for rename
This commit is contained in:
parent
fd18843bd9
commit
989821f810
|
@ -25,14 +25,14 @@ var ptserver = express();
|
|||
|
||||
// Setup our PTServer
|
||||
ptserver.get('/',function(req,res){
|
||||
return res.send("You've connected to the PTServer, you're probably looking for the webapp.")
|
||||
return res.send("You've connected to the SLServer, you're probably looking for the webapp.")
|
||||
})
|
||||
|
||||
// Merge everything together
|
||||
|
||||
root.use('/ptserver',ptserver)
|
||||
root.use('/slserver',ptserver)
|
||||
root.get('*',function(req,res){
|
||||
return res.send('You\'ve connected to the PTServer, you\'re probably looking for the webapp.')
|
||||
return res.send('You\'ve connected to the SLServer, you\'re probably looking for the webapp.')
|
||||
})
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ root.get('*',function(req,res){
|
|||
|
||||
|
||||
var rootserver = require('http').createServer(root);
|
||||
var ptserver_io = require('socket.io')(rootserver,{path: '/ptserver/socket.io'});
|
||||
var ptserver_io = require('socket.io')(rootserver,{path: '/slserver/socket.io'});
|
||||
|
||||
|
||||
ptserver_io.on('connection', function(socket){
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
return this.$store.state.plex.user.thumb
|
||||
},
|
||||
logo: function () {
|
||||
return 'ptweb/logo-small-light.png'
|
||||
return 'slweb/logo-small-light.png'
|
||||
},
|
||||
isPlayer: function () {
|
||||
console.log('Router path is ' + this.$route.path)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<v-toolbar-item class="hidden-sm-and-down">
|
||||
<img style="height:70%;width:auto" v-bind:src="logo"/>
|
||||
</v-toolbar-item>
|
||||
<v-toolbar-item class="hidden-sm-and-down" v-for="link in links" :href="link.href" :target="link.target">{{ link.title }}</v-toolbar-item>
|
||||
<v-toolbar-item class="hidden-sm-and-down" v-for="link in links" :href="link.href" :target="link.target" :key="link.href">{{ link.title }}</v-toolbar-item>
|
||||
</v-toolbar-items>
|
||||
</v-toolbar>
|
||||
</template>
|
||||
|
@ -86,7 +86,7 @@
|
|||
return this.$store.state.plex.user.thumb
|
||||
},
|
||||
logo: function () {
|
||||
return 'ptweb/logo-small-light.png'
|
||||
return 'slweb/logo-small-light.png'
|
||||
},
|
||||
isPlayer: function () {
|
||||
console.log('Router path is ' + this.$route.path)
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
mounted: function () {
|
||||
var that = this
|
||||
console.log('Hello from join...')
|
||||
this.password = this.$route.query.ptpassword
|
||||
this.room = this.$route.query.ptroom
|
||||
this.server = this.$route.query.ptserver
|
||||
this.password = this.$route.query.sltpassword
|
||||
this.room = this.$route.query.slroom
|
||||
this.server = this.$route.query.slserver
|
||||
this.owner = this.$route.query.owner
|
||||
|
||||
if (this.room && this.server) {
|
||||
|
@ -54,7 +54,7 @@
|
|||
},
|
||||
computed: {
|
||||
logo: function () {
|
||||
return 'ptweb/logo-small-light.png'
|
||||
return 'slweb/logo-small-light.png'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -12,7 +12,7 @@ Vue.use(Router)
|
|||
// ==================== Router registration ====================
|
||||
export default new Router({
|
||||
mode: 'hash',
|
||||
base: '/ptweb/',
|
||||
base: '/slweb/',
|
||||
routes: [
|
||||
{path: '/', component: home},
|
||||
{path: '/sync', component: application},
|
||||
|
|
17
src/store.js
17
src/store.js
|
@ -40,7 +40,7 @@ if (process.env.NODE_ENV == 'development') {
|
|||
_webapp_socket = socketio.connect('' + window.location.hostname + ':8088', {
|
||||
'forceNew': true,
|
||||
'connect timeout': 1000,
|
||||
path: '/ptweb/socket.io'
|
||||
path: '/slweb/socket.io'
|
||||
})
|
||||
_webapp_socket.on('connection', function () {
|
||||
})
|
||||
|
@ -50,7 +50,7 @@ if (process.env.NODE_ENV == 'development') {
|
|||
} else {
|
||||
_webapp_socket = socketio.connect({
|
||||
'forceNew': true,
|
||||
'connect timeout': 1000, path: '/ptweb/socket.io'
|
||||
'connect timeout': 1000, path: '/slweb/socket.io'
|
||||
})
|
||||
_webapp_socket.on('connection', function () {
|
||||
})
|
||||
|
@ -384,7 +384,7 @@ const plexTogether = {
|
|||
_io: require('socket.io-client'),
|
||||
_socket: null,
|
||||
ptevents: new EventEmitter(),
|
||||
ptservers: [],
|
||||
slservers: [],
|
||||
connected: false,
|
||||
server: false,
|
||||
room: false,
|
||||
|
@ -486,7 +486,7 @@ const plexTogether = {
|
|||
console.log('Socket attempt connect on ' + address)
|
||||
state._socket = state._io.connect(address, {
|
||||
'forceNew': true,
|
||||
'connect timeout': 7000, path: '/ptserver/socket.io'
|
||||
'connect timeout': 7000, path: '/slserver/socket.io'
|
||||
})
|
||||
state._socket.on('connect', function (result) {
|
||||
// Good connection
|
||||
|
@ -545,11 +545,12 @@ const plexTogether = {
|
|||
let data = {
|
||||
urlOrigin: urlOrigin,
|
||||
owner: rootState.plex.user.username,
|
||||
ptserver: state.server,
|
||||
ptroom: state.room,
|
||||
ptpassword: state.password
|
||||
slserver: state.server,
|
||||
slroom: state.room,
|
||||
slpassword: state.password
|
||||
|
||||
}
|
||||
console.log('invite data', data)
|
||||
var that = this
|
||||
console.log('Invite link data below')
|
||||
console.log(data)
|
||||
|
@ -559,7 +560,7 @@ const plexTogether = {
|
|||
})
|
||||
webapp_socket.emit('shorten', data)
|
||||
|
||||
// Now we need to setup events for dealing with the PTServer.
|
||||
// Now we need to setup events for dealing with the SLServer.
|
||||
// We will regularly be recieving and sending data to and from the server.
|
||||
// We want to make sure we are listening for all the server events
|
||||
state._socket.on('poll-result', function (users) {
|
||||
|
|
26
webapp.js
26
webapp.js
|
@ -5,11 +5,11 @@
|
|||
|
||||
const args = require("args-parser")(process.argv)
|
||||
if (!args['url']){
|
||||
console.log('Missing required argument -url. EG. "node webapp.js --url=http://example.com/ptweb". This URL is used for redirecting invite links.')
|
||||
console.log('Missing required argument -url. EG. "node webapp.js --url=http://example.com/slweb". This URL is used for redirecting invite links.')
|
||||
return
|
||||
}
|
||||
var accessIp = args['url'] // EG 'http://95.231.444.12:8088/ptweb' or 'http://example.com/ptweb'
|
||||
if (accessIp.indexOf('/ptweb') == -1){
|
||||
if (accessIp.indexOf('/slweb') == -1){
|
||||
console.log('WARNING: /ptweb was not found in your url. Unless you have changed the URL Base make sure to include this.')
|
||||
}
|
||||
var PORT = 8088
|
||||
|
@ -37,7 +37,7 @@ root.use('/ptweb/', express.static(path.join(__dirname, 'dist')));
|
|||
|
||||
// Merge everything together
|
||||
|
||||
root.get('/ptweb/invite/:id', (req,res) => {
|
||||
root.get('/slweb/invite/:id', (req,res) => {
|
||||
console.log('handling an invite')
|
||||
let shortObj = shortenedLinks[req.params.id]
|
||||
if (!shortObj){
|
||||
|
@ -47,7 +47,7 @@ root.get('/ptweb/invite/:id', (req,res) => {
|
|||
console.log(JSON.stringify(shortObj, null, 4))
|
||||
return res.redirect(shortObj.fullUrl)
|
||||
})
|
||||
root.post('/ptweb/invite', (req, res) => {
|
||||
root.post('/slweb/invite', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
if (!req.body) {
|
||||
return res.send({
|
||||
|
@ -57,7 +57,7 @@ root.post('/ptweb/invite', (req, res) => {
|
|||
}
|
||||
console.log('Generating Invite URL via the API.')
|
||||
let data = {}
|
||||
let fields = ['ptserver', 'ptroom', 'ptpassword', 'owner']
|
||||
let fields = ['slserver', 'slroom', 'slpassword', 'owner']
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
if (!req.body[fields[i]]) {
|
||||
return res.send({
|
||||
|
@ -91,7 +91,7 @@ root.use(cors())
|
|||
|
||||
var rootserver = require('http').createServer(root);
|
||||
|
||||
var webapp_io = require('socket.io')(rootserver, { path: '/ptweb/socket.io'} )
|
||||
var webapp_io = require('socket.io')(rootserver, { path: '/slweb/socket.io'} )
|
||||
|
||||
function getUniqueId(){
|
||||
while (true){
|
||||
|
@ -108,21 +108,21 @@ function shortenObj(data){
|
|||
returnable.urlOrigin = accessIp
|
||||
returnable.owner = data.owner
|
||||
|
||||
returnable.ptserver = data.ptserver
|
||||
returnable.ptroom = data.ptroom
|
||||
returnable.ptpassword = data.ptpassword
|
||||
returnable.slserver = data.slserver
|
||||
returnable.slroom = data.slroom
|
||||
returnable.slpassword = data.slpassword
|
||||
|
||||
returnable.starttime = (new Date).getTime()
|
||||
returnable.id = getUniqueId()
|
||||
returnable.shortUrl = accessIp + '/invite/' + returnable.id
|
||||
|
||||
let params = {
|
||||
ptserver: data.ptserver,
|
||||
ptroom: data.ptroom,
|
||||
slserver: data.slserver,
|
||||
slroom: data.slroom,
|
||||
owner: data.owner
|
||||
}
|
||||
if (data.ptpassword){
|
||||
params.ptpassword = data.ptpassword
|
||||
if (data.slpassword){
|
||||
params.slpassword = data.slpassword
|
||||
}
|
||||
let query = ''
|
||||
for (let key in params) {
|
||||
|
|
Loading…
Reference in New Issue