Comments (5)
In particular, the scan list is generated on the server side and doesn't update when a new scan is made.
Yeah, I typically only look at the web UI when troubleshooting something. Otherwise, I interact with my scan2drive instance via an M5Stack microcontroller running an M5ez based UI (M5ez/M5ez#125), which in turn uses MQTT.
But, yes, if you’re scanning via the web UI, then it would indeed be nice if the list of scans was updated, at the very least when a new scan was triggered via the UI, but ideally whenever a new scan enters the system.
In this case it'd be much easier to trigger updates of the UI when a new scan is available (possibly using something like SWR or react query, though it's hard to be enthusiastic about dealing with Node/npm and that ball of magic).
Yeah, I understand the appeal of using some ready-made solution for keeping state updated.
scan2drive used to be on Polymer, but updating that turned out to be such a disproportionate amount of work that I switched to materialize in commit 8b1bcff, so I certainly share your distaste of npm and the fast-paced javascript ecosystem in general.
If we had to use a JavaScript framework, I would be more interested in Angular over React, purely based on it being the technology stack that’s more often used in my bubble. But ideally we didn’t need to resort to either.
I wonder if there is a solution that fits better into a minimalist Go project? In another projects, I ended up using the EventSource API (https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events), which is actually not that much work if you only need it in one place, say, a scan list…
I hope that answers some of your questions, but feel free to ask follow-up questions if you have any :)
from scan2drive.
Do you have any wider plans for the UI? I started chipping away at making the scan UI work again but got sidetracked with thoughts of what else might need doing.
In particular, the scan list is generated on the server side and doesn't update when a new scan is made. There's a comment somewhere about using web events to achieve this but another approach could be separating the UI into a REST API that the server exposes and a frontend that uses it. In this case it'd be much easier to trigger updates of the UI when a new scan is available (possibly using something like SWR or react query, though it's hard to be enthusiastic about dealing with Node/npm and that ball of magic).
I wanted to see if you had any thoughts on any of this before poking around. I see there's also a bit of overlap between thr httpingest API and what I suggested above.
from scan2drive.
Hm, EventSource seems doable, and there's https://pkg.go.dev/github.com/donovanhide/eventsource for the server side. I'll do some when-I-find-time poking around with this.
from scan2drive.
EventSource is pretty easy to speak on the server side even without extra packages, BTW:
w.Header().Set("Content-Type", "text/event-stream")
- wrap your JSON record in EventSource framing:
rdr = bytes.NewReader(append(append([]byte("data: "), b...), []byte("\n\n")...))
- flush data to the client:
if f, ok := w.(http.Flusher); ok { f.Flush() }
from scan2drive.
Yes, I saw that it looked straightforward and intended to see what else, if anything, a canned library offered (eg simplified error handing and so on).
The m5stack implementation sounds great and is very tempting, too..
from scan2drive.
Related Issues (20)
- race condition: setup mode redirect might run into transient HTTP 404
- main.go:846: undefined: s HOT 2
- add zoom function to scan thumbnails
- Add upspin server availing scans HOT 1
- create thumbnails asynchronously for button-triggered scans HOT 1
- Which scanners does it support? HOT 2
- eSCL (“AirScan”) support HOT 1
- neonjpeg-created images cannot be loaded by Go HOT 4
- Consider supporting other authentication providers and sinks
- scan2drive.zekjur.net https listener is currently hardcoded in the source HOT 1
- scan2drive doesn't append DNSSD Domain to scanner service for Avahi-style name resolution HOT 1
- Update Google Drive Libraries HOT 5
- Listen address/oauth redirect trouble HOT 3
- Support airscan-only operation on MacOS? HOT 3
- investigate using machine learning for OCR
- gokr-packer exiting with status 2 after `*grpc.ClientConn has no field or method State` HOT 1
- Investigate using ARM NEON instructions to speed up image processing HOT 6
- Unify internal/g3 with image/jpeg/writer.go
- Unable to read client secret file: open /perm/client_secret_... HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scan2drive.