Skip to content
Snippets Groups Projects
Unverified Commit 1241bb66 authored by Francisco Javier López's avatar Francisco Javier López
Browse files

Initial commit

parent 70691df9
No related merge requests found
......@@ -2,6 +2,7 @@
import { mapState } from 'vuex';
import initTerminal from '~/terminal/';
import initSyncProxy from '~/sync_proxy'
export default {
components: {},
......@@ -37,6 +38,8 @@ export default {
updated() {
if (this.terminalRunning) {
this.terminal = initTerminal();
debugger
initSyncProxy({url: this.wsTerminalPath});
}
},
beforeDestroy() {
......
import SyncProxy from './sync_proxy';
export default () => new SyncProxy({ selector: '#terminal' });
import $ from 'jquery';
export default class GLSyncProxy {
constructor(options = {}) {
this.container = document.querySelector(options.selector);
debugger
this.setSocketUrl();
debugger
this.createTerminal();
}
setSocketUrl() {
const { protocol, hostname, port } = window.location;
const wsProtocol = protocol === 'https:' ? 'wss://' : 'ws://';
const path = this.container.dataset.projectPath;
this.socketUrl = `${wsProtocol}${hostname}:${port}${path}`;
}
createTerminal() {
// this.terminal = new Terminal(this.options);
debugger
this.socket = new WebSocket(this.socketUrl, ['terminal.gitlab.com']);
this.socket.binaryType = 'arraybuffer';
this.socket.onopen = () => {
this.runProxy();
};
this.socket.onerror = () => {
console.log("Sync Connection Shutdown");
};
}
runProxy() {
const decoder = new TextDecoder('utf-8');
const encoder = new TextEncoder('utf-8');
// this.terminal.on('data', data => {
// this.socket.send(encoder.encode(data));
// });
socket.send(encoder.encode('Hello Server!'));
this.socket.addEventListener('message', ev => {
this.terminal.write(decoder.decode(ev.data));
});
}
}
......@@ -291,6 +291,7 @@ def features
end
def feature_available?(feature)
return true
return false if trial? && expired?
features.include?(feature)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment