Skip to content

Commit

Permalink
clean settings and last API corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou committed Apr 13, 2020
1 parent bb18992 commit beba547
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Download and install KWC:
```bash
mkdir -p ~/kwc
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.6/kwc-alpha-0.0.6.zip && unzip kwc.zip && rm kwc.zip
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.7/kwc-alpha-0.0.7.zip && unzip kwc.zip && rm kwc.zip
```

Configure web_server in printer.cfg:
Expand All @@ -19,7 +19,7 @@ enable_cors: true
trusted_clients:
192.168.1.0/24
127.0.0.1
web_path: ~/kwc
allow_file_ops_when_printing: true
```

Example Klipper macros:
Expand Down Expand Up @@ -77,7 +77,6 @@ server.document-root = "/home/pi/kwc"
server.port = 81
```

`server.port` to port `81`
```bash
sudo usermod -a -G www-data pi
```
Expand Down Expand Up @@ -123,10 +122,10 @@ backend websocket
all comments are for webcam support. You can install MJPEG-Streamer with this [tutorial](https://github.com/cncjs/cncjs/wiki/Setup-Guide:-Raspberry-Pi-%7C-MJPEG-Streamer-Install-&-Setup-&-FFMpeg-Recording).


## Update KWC to V0.0.5
## Update KWC to V0.0.7
```
rm -R ~/kwc/*
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.6/kwc-alpha-0.0.6.zip && unzip kwc.zip && rm kwc.zip
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.7/kwc-alpha-0.0.7.zip && unzip kwc.zip && rm kwc.zip
```
and update your macros
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Vue.component('vue-headful', vueHeadful);
fetch('/config.json').then(res => res.json()).then(file => {
store.commit('setSettings', file);

Vue.use(JRPCWS, 'ws://' + file.socket.hostname + ':' + file.socket.port + '/websocket', {
Vue.use(JRPCWS, 'ws://' + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket', {
store: store,
reconnectEnabled: true,
reconnectInterval: file.socket.reconnectInterval,
reconnectAttempts: file.socket.reconnectAttempts,
reconnectInterval: store.state.socket.reconnectInterval,
reconnectAttempts: store.state.socket.reconnectAttempts,
});

new Vue({
Expand Down
10 changes: 5 additions & 5 deletions src/pages/Files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
<script>
import { mapState, mapGetters } from 'vuex';
import axios from 'axios';
import { hostname } from '../store/variables';
export default {
data () {
Expand Down Expand Up @@ -189,7 +188,6 @@
y: 0,
item: {}
},
hostname: hostname,
dropzone: {
visibility: 'hidden',
opacity: 0,
Expand All @@ -202,6 +200,8 @@
loadingUpload: state => state.socket.loadingGcodeUpload,
loadingRefresh: state => state.socket.loadingGcodeRefresh,
countPerPage: state => state.gui.gcodefiles.countPerPage,
hostname: state => state.socket.hostname,
port: state => state.socket.port,
}),
...mapGetters([
'is_printing'
Expand All @@ -219,7 +219,7 @@
formData.append('file', file);
this.$store.commit('setLoadingGcodeUpload', true);
axios.post('http://' + hostname + '/printer/files/upload',
axios.post('http://' + this.hostname + ':' + this.port + '/printer/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
Expand Down Expand Up @@ -288,14 +288,14 @@
downloadFile() {
let link = document.createElement("a");
link.download = name;
link.href = 'http://' + hostname + '/printer/files/' + this.contextMenu.item.filename;
link.href = 'http://' + this.hostname + ':' + this.port + '/printer/files/' + this.contextMenu.item.filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
removeFile() {
axios.delete(
'http://'+hostname+'/printer/files/'+this.contextMenu.item.filename
'http://'+ this.hostname + ':' + this.port +'/printer/files/'+this.contextMenu.item.filename
).then(() => {
this.$toast(this.contextMenu.item.filename+" successfully deleted.", {
icon: 'fa-trash'
Expand Down
3 changes: 1 addition & 2 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Vue from 'vue'
import router from "../plugins/router";
import store from "./index";
import axios from "axios";
import {hostname} from "./variables";


export default {
Expand Down Expand Up @@ -118,7 +117,7 @@ export default {
let formData = new FormData();
formData.append('file', file);

axios.post('http://' + hostname + '/printer/files/upload',
axios.post('http://' + state.socket.hostname + ':' + state.socket.port + '/printer/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
Expand Down

0 comments on commit beba547

Please sign in to comment.