From 989821f8103b8357d0d9d4275515db559f7af79f Mon Sep 17 00:00:00 2001 From: samcm Date: Sat, 30 Dec 2017 13:07:51 +1100 Subject: [PATCH] Code changes for rename --- server.js | 8 ++++---- src/App.vue | 2 +- src/components/Navbar.vue | 4 ++-- src/components/join.vue | 8 ++++---- src/router/index.js | 2 +- src/store.js | 17 +++++++++-------- webapp.js | 26 +++++++++++++------------- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/server.js b/server.js index 03841754..d16a8983 100644 --- a/server.js +++ b/server.js @@ -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){ diff --git a/src/App.vue b/src/App.vue index e8a360b0..49d42f50 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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) diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index 625e49d5..478f4df0 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -19,7 +19,7 @@ - {{ link.title }} + {{ link.title }} @@ -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) diff --git a/src/components/join.vue b/src/components/join.vue index 0c168282..99f3bb45 100644 --- a/src/components/join.vue +++ b/src/components/join.vue @@ -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: { diff --git a/src/router/index.js b/src/router/index.js index 50240ff3..7e8a42f4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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}, diff --git a/src/store.js b/src/store.js index 71af0e79..b1b4c27c 100644 --- a/src/store.js +++ b/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) { diff --git a/webapp.js b/webapp.js index 7d740760..02d36567 100644 --- a/webapp.js +++ b/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) {