Compare commits

...
Author SHA1 Message Date
Rejdukien 822a622d97 Change from websockets to regular pull-based approach 2021-02-14 19:45:46 +01:00
Rejdukien 1e7aba5297 PyImageStreamer websocket support 2021-02-14 17:41:26 +01:00
FrYakaTKoP 2634b37755 docs: custom.css slight reformat
Signed-off-by: Christoph Frei fryakatkop@gmail.com
2021-02-14 00:15:42 +01:00
FrYakaTKoP aaf50a403d docs: add custom.css example
Signed-off-by: Christoph Frei fryakatkop@gmail.com
2021-02-14 00:15:42 +01:00
FrYakaTKoP 5f06da45cf docs: update manager config in manual setup
new updatemanager config style in manual setup

Signed-off-by:  Christoph Frei <fryakatkop@gmail.com>
2021-02-13 03:09:23 +01:00
Stefan Dej 33bc3673ae bugfix: refresh metadata on refresh directory
Signed-off-by: Stefan Dej <meteyou@gmail.com>
2021-02-11 20:42:40 +01:00
13 changed files with 171 additions and 16 deletions

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

+40 -2
View File
@@ -6,11 +6,49 @@ nav_order: 99
permalink: /customizing/custom-css
---
## Custom-CSS
## Custom-CSS
The custom.css file allows you to customize the appearance of Mainsail
without the need of rebuilding it. All you need to do is to place a file
named "custom.css" into the configuration directory ".theme" and define
your css rules in there.
![screenshot](../assets/img/customizing/screenshot-custom-css.png)
![file-screenshot](../assets/img/customizing/screenshot-custom-css.png "custom.css file")
![example result](../assets/img/customizing/screenshot-custom-css-example-result.png "custom.css result")
### How to CSS
You need to be familiar with the CSS (**C**ascading **S**tyle **S**heets) syntax.
There are many resources to learn CSS online, for example:
- https://www.w3schools.com/css/default.asp
#### find the Element selector (example based on Chrome Browser)
Use your browser's built-in developer tools to find the right selector of the element you want to add your own flair to.
Open the developer tools:
right click anywhere on the page and select "inspect" (or F12 on the keyboard)
![open dev-tools](../assets/img/customizing/screenshot-custom-css-inspect.png "open dev-tools")
1. Activate the "inspector"
2. Select the desired element
3. Find the selector
4. Use the style editor and fiddle arround
![find element](../assets/img/customizing/screenshot-custom-css-find-element.png "find the right element")
![fiddle](../assets/img/customizing/screenshot-custom-css-fiddle.png "fiddle")
When you have achieved your desired appearance copy the full "section" including selector and curly braces
![fiddle 2](../assets/img/customizing/screenshot-custom-css-fiddle-2.png "fiddle 2")
Then copy it to the "custom.css" file (you can keep everything or only what you have added)
![example](../assets/img/customizing/screenshot-custom-css-example.png "custom.css example")
NOTE: After saving, your browser may need a uncached reload to show the change (https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache#Bypassing_cache)
+5 -2
View File
@@ -48,8 +48,11 @@ trusted_clients:
2a02:810d:9340:33f6::/64
[update_manager]
client_repo: meteyou/mainsail
client_path: ~/mainsail
[update_manager client mainsail]
type: web
repo: meteyou/mainsail
path: ~/mainsail
```
> 🔥 **trusted_clients - read carefully** 🔥
+1
View File
@@ -17,6 +17,7 @@
"vue-context": "^6.0.0",
"vue-github-api": "^0.1.7",
"vue-headful": "^2.1.0",
"vue-observe-visibility": "^1.0.0",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.2.2",
"vue-resource": "^1.5.1",
@@ -43,6 +43,16 @@
<v-switch v-model="boolNavi" hide-details label="Show in navigation" class="mt-0"></v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="py-2">
<v-switch v-model="adaptiveFps" hide-details label="(Experimental) Adaptive FPS" class="mt-0"></v-switch>
</v-col>
</v-row>
<v-row v-if="adaptiveFps">
<v-col class="py-2">
<v-text-field v-model="targetFps" hide-details label="Target FPS" class="mt-0"></v-text-field>
</v-col>
</v-row>
</v-container>
</v-card-text>
</v-card>
@@ -64,6 +74,8 @@
return this.$store.state.gui.webcam.url;
},
set(url) {
if(this.$store.state.gui.webcam.adaptiveFps)
url = url.replace("action=stream", "action=snapshot");
return this.$store.dispatch('gui/setSettings', { webcam: { url } });
}
},
@@ -107,6 +119,22 @@
return this.$store.dispatch('gui/setSettings', { webcam: { bool: showNav } });
}
},
adaptiveFps: {
get() {
return this.$store.state.gui.webcam.adaptiveFps;
},
set(useAdaptiveFps) {
return this.$store.dispatch('gui/setSettings', { webcam: { adaptiveFps: useAdaptiveFps } });
}
},
targetFps: {
get() {
return this.$store.state.gui.webcam.targetFps;
},
set(fps) {
return this.$store.dispatch('gui/setSettings', { webcam: { targetFps: fps } });
}
}
},
methods: {
+80 -11
View File
@@ -5,14 +5,14 @@
</style>
<template>
<v-card>
<v-card v-observe-visibility="visibilityChanged">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon left>mdi-webcam</v-icon>Webcam</span>
<span class="subheading"><v-icon left>mdi-webcam</v-icon>{{subHeading}}</span>
</v-toolbar-title>
</v-toolbar>
<v-card-text class="px-0 py-0 content">
<img :src="url" class="webcamImage" :style="webcamStyle" alt="Webcam"/>
<img :src="url" class="webcamImage" :style="webcamStyle" @load="onLoad" alt="Webcam"/>
</v-card-text>
</v-card>
</template>
@@ -23,12 +23,27 @@
export default {
data: function() {
return {
refresh: Math.ceil(Math.random() * Math.pow(10, 12))
}
refresh: Math.ceil(Math.random() * Math.pow(10, 12)),
connection: "",
imageData: "",
request_start_time: performance.now(),
start_time: performance.now(),
time: 0,
request_time: 0,
time_smoothing: 0.6,
request_time_smoothing: 0.1,
isVisible: true,
};
},
created: function () {
document.addEventListener("focus", () => this.handleRefreshChange(), false);
document.addEventListener("visibilitychange", this.handleRefreshChange, false);
if(this.webcamConfig.adaptiveFps) {
this.requestMjpeg();
}
},
components: {
@@ -37,14 +52,28 @@
...mapState({
'webcamConfig': state => state.gui.webcam
}),
url() {
let basicUrl = this.webcamConfig.url
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
const params = new URLSearchParams(basicUrl)
params.set('bypassCache', ""+this.refresh)
return decodeURIComponent(params.toString())
subHeading() {
return "Webcam" + (this.webcamConfig.adaptiveFps ? " - FPS: " + Math.round(1000 / this.time) : "");
},
url() {
if(!this.webcamConfig.adaptiveFps) {
let basicUrl = this.webcamConfig.url
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
const params = new URLSearchParams(basicUrl)
params.set('bypassCache', ""+this.refresh)
return decodeURIComponent(params.toString())
} else {
return this.imageData;
/*return 'data:image/jpeg;base64,' + btoa(
new Uint8Array(this.blobData)
.reduce((data, byte) => data.String.fromCharCode(byte), '')
)*/
}
},
webcamStyle() {
let transforms = '';
if (this.webcamConfig.flipX) {
@@ -69,6 +98,46 @@
if (!document.hidden) {
this.refresh = Math.ceil(Math.random() * Math.pow(10, 12))
}
},
onLoad() {
var end_time = performance.now();
var current_time = end_time - this.start_time;
this.time = (this.time * this.time_smoothing) + (current_time * (1.0 - this.time_smoothing));
this.start_time = end_time;
var target_time = 1000/this.webcamConfig.targetFps
var current_request_time = performance.now() - this.request_start_time;
this.request_time = (this.request_time * this.request_time_smoothing) + (current_request_time * (1.0 - this.request_time_smoothing));
var timeout = Math.max(0, target_time - this.request_time);
this.$nextTick(() => {
console.log(end_time + " " + timeout);
setTimeout(this.requestMjpeg, timeout);
})
},
requestMjpeg() {
if(!this.isVisible)
return;
this.request_start_time = performance.now();
let basicUrl = this.webcamConfig.url
if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
const params = new URLSearchParams(basicUrl)
params.set('bypassCache', ""+ this.refresh + (Math.random() * 1000))
this.$nextTick(() => {
this.imageData = decodeURIComponent(params.toString())
})
},
visibilityChanged(isVisible, entry) {
this.isVisible = isVisible;
console.log(entry);
if(isVisible)
this.requestMjpeg();
}
}
}
+2
View File
@@ -7,10 +7,12 @@ import './components'
import store from './store'
import router from './plugins/router'
import vueHeadful from 'vue-headful';
import VueObserveVisibility from 'vue-observe-visibility';
Vue.config.productionTip = false;
Vue.use(VueResource);
Vue.use(VueObserveVisibility);
Vue.http.headers.common['Content-Type'] = 'application/json';
Vue.http.headers.common['Access-Control-Allow-Origin'] = '*';
Vue.http.headers.common['Accept'] = 'application/json, text/plain, */*';
+15 -1
View File
@@ -45,7 +45,21 @@ export default {
if (payload.files && payload.files.length) {
for (let file of payload.files) {
if (!parent.find(element => (element.isDirectory === false && element.filename === file.filename))) {
const existingFile = parent.find(element => (element.isDirectory === false && element.filename === file.filename))
if (
existingFile && (
existingFile.size !== file.size ||
existingFile.modified.getTime() !== new Date(file.modified*1000).getTime()
)
) {
Vue.set(existingFile, 'modified', new Date(file.modified*1000))
Vue.set(existingFile, 'size', file.size)
if (existingFile.metadataPulled) {
Vue.prototype.$socket.sendObj("server.files.metadata", { filename: payload.requestParams.path+'/'+file.filename }, "files/getMetadata")
}
} else if (!existingFile) {
parent.push({
isDirectory: false,
filename: file.filename,