Skip to content

Commit

Permalink
PRobably fix Bedrock and add filtering that partly works
Browse files Browse the repository at this point in the history
  • Loading branch information
Heath123 committed Aug 6, 2020
1 parent 4455769 commit 2e864ca
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
Binary file modified data/proxypass-pakkit.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions html/mainPage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ <h3>Scripting (beta)</h3>
</div>

</div>

<div class="search">
<input type="text" class="filter" id="filter" placeholder="Filter by name" onkeyup="updateFilter()">
</div>

<div class="container">
<div id="packets" class="split">
<div class="toolbar">
Expand Down
35 changes: 33 additions & 2 deletions html/mainPage/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ if (!proxyCapabilities.modifyPackets) {
// let currentPacket Not currently used
let currentPacketType

let lastFilter = ''
const filterInput = document.getElementById('filter')

function updateFilter () {
const newValue = filterInput.value
if (lastFilter !== newValue) {
lastFilter = newValue
deselectPacket()
refreshPackets()
}
}

setInterval(updateFilter, 100)

// TODO: Seperate them like this
/* let hiddenPackets = {
server: {}, client: {}
Expand Down Expand Up @@ -79,7 +93,7 @@ window.scriptEditor = CodeMirror.fromTextArea(document.getElementById('scriptEdi
})
resetScriptEditor()

function updateScript(fromCheckbox) {
function updateScript (fromCheckbox) {
if (!((fromCheckbox === true) || document.getElementById('enableScripting').checked)) return
ipcRenderer.send('scriptStateChange', JSON.stringify({ //
scriptingEnabled: document.getElementById('enableScripting').checked,
Expand Down Expand Up @@ -172,11 +186,28 @@ function refreshPackets () {
}
}

function isHiddenByFilter (packet) {
if (lastFilter === '') {
return false
}
console.log('Filter applied')
if (packet.meta.name.includes(lastFilter)) {
console.log(packet.meta.name, 'includes', lastFilter)
return false
}
/* if (JSON.stringify(packet.data).includes(lastFilter)) {
return false
} */
return true
}

function addPacketToDOM (packet, noUpdate) {
/* if (!noUpdate) {
var wasScrolledToBottom = (packetlist.parentElement.scrollTop >= (packetlist.parentElement.scrollHeight - packetlist.parentElement.offsetHeight))
} */
if (hiddenPackets.includes(packet.meta.name)) {
const hiddenByFilter = isHiddenByFilter(packet)

if (hiddenPackets.includes(packet.meta.name) || hiddenByFilter) {
updateHidden()
return
}
Expand Down
12 changes: 11 additions & 1 deletion html/mainPage/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body {
}

.container {
height: calc(100% - 120px);
height: calc(100% - 154px);
}

.split, .gutter.gutter-horizontal {
Expand Down Expand Up @@ -224,3 +224,13 @@ div#Scripting .CodeMirror.CodeMirror {
background: #242424;
height: calc(100vh - 52px);
}

div.search {
height: 34px;
}

input.filter {
box-sizing: border-box;
height: 28px;
width: 100%;
}
2 changes: 1 addition & 1 deletion html/startPage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h1 class='title'>pakkit</h1>
<option value="1.7.10">1.7.10</option>
</select>
<select id="version-bedrock" disabled style="width: 191px; display: none;">
<option value="1.15.2">1.14.60 (latest)</option>
<option value="1.15.2">1.16.x (latest)</option>
</select>
</p>
<br><br>
Expand Down
6 changes: 3 additions & 3 deletions src/setupDataFolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ exports.setup = function (osDataFolder, resourcesPath) {
if (!fs.existsSync(dataFolder + '/proxypass/proxypass-pakkit.jar')) {
fs.copyFileSync(resourcesPath + 'data/proxypass-pakkit.jar', dataFolder + '/proxypass/proxypass-pakkit.jar')
} else {
const packagedHash = md5File.sync(dataFolder + '/proxypass/proxypass-pakkit.jar')
console.log('The MD5 has of the packaged ProxyPass is', packagedHash)
const packagedHash = md5File.sync(resourcesPath + 'data/proxypass-pakkit.jar')
console.log('The MD5 hash of the packaged ProxyPass is', packagedHash)
const savedHash = md5File.sync(dataFolder + '/proxypass/proxypass-pakkit.jar')
console.log('The MD5 has of the saved ProxyPass is', savedHash)
console.log('The MD5 hash of the saved ProxyPass is', savedHash)
if (packagedHash === savedHash) {
console.log('Match! Not copying.')
} else {
Expand Down

0 comments on commit 2e864ca

Please sign in to comment.