-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migration to go mod, moving from standard library http handler to echo #17
base: master
Are you sure you want to change the base?
Conversation
@navaneeth please review |
6298cdc
to
3ab20c5
Compare
3ab20c5
to
070c3f9
Compare
I don't know Go, is echo a HTTP library like express in nodejs ? Would it be possible to add an authentication to only allow some people to add words with |
Yes, It is possible. We can do it without any extra libraries. They have a middleware. We can do the same without any third party library. On request, encode username and password in base64 format and send it on Authentication header, decode and string match credentials and can proceed. |
I tried the branch, but getting this error on learn handler.
gives :
|
main.go
Outdated
varnamdConfig = initConfig() | ||
startedAt = time.Now() | ||
|
||
runtime.GOMAXPROCS(runtime.NumCPU()) | ||
flag.Parse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be called before initConfig() is called, otherwise flag values won't be set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check this today.
Running |
try PS: Make sure you have mentioned content-type |
There was an issue, which I mistaken for a json element key. I resolved it. But I found out that request's content type is not 'application/json' but 'form-url-encoded'. The request is made from https://github.com/varnamproject/varnamd/blob/master/ui/javascripts/varnam.js#L77 It is in the minified form. @subins2000 could you send me a patch by adding content type as 'application/json' ? |
moved to draft as I found a bug in download content encoding |
Can confirm, learn endpoint now gives a "success" response. Thanks for the fix! |
There is a default value in varnamd, without any config file, it will run on port 8080. as a workaroud, we can add env variable as well as config flag. (Thanks for pointing out ibus-varnam's varnamd dependency. I forgot that) |
Perhaps allow usage of flags that'll override the config file ? |
…o feat/gomod-echo
…ual word, pattern mapping to channel
1f62ad1 resolved this |
Add endpoint for downloading Varnam Symbol Table, Removing Word, Cache Improvements
* Add endpoint for uploading a file and learning from it * Add /learn/upload enpoint for files to be uploaded and learnt * Make /learn endpoints under auth * refactored code * Refactor, move functions to better suited files, use temp dir for upload * Disable auth by default * Change tmpdir Co-authored-by: Joice <[email protected]>
* Add /packs, /packs/:langCode endpoint, basic packs structure * Funcs should return errors too * Add /packs/:langCode/:packIdentifier endpoint for downloading a pack * Add endpoint to download pack from upstream * Enable internal API by default * Add learning from pack file * Add endpoint to get a pack version info & a /download to download that pack
There are so many changes. Not sure I have gone through and tested fully. @joicemjoseph , @subins2000 tested this? |
Yep. There are a lot of changes. Yet more changes are on pipeline. We have tested. But, Subin have made some PR to my fork. I will merge them. Then we can merge this PR. How that would be. |
@joicemjoseph Sure. That makes sense |
* Add different endpoints for pack & diff pack versions * Show 404 if no pack found * packs.json should be updated when a new pack is downloaded from upstream * Disallow pack download if already installed * Test upstream URL * Refactor better * Assign small-caps JSON property names
@navaneeth This PR is now complete. It'd be great if you can give org access to both of us so that we can work straight on varnamd (with PRs of course) skipping the fork of a fork changes. |
* Remove usage of packs.json and use pack.json inside different packs * Update pack.json when packs are downloaded * Packs are now trained files to import from and not files to learn from * Show error if pack import failed, don't update pack.json then * Cache packs info for faster requests and avoid recurrent disk reads * Compress pack downloads into gzip, considerable filesize decrease * Use new vpf extension for pack file * division is the correct way to convert to int
.vlf - Varnam Learnings File
We've been running this changed varnamd here and on the desktop app. 90% of these changes have been tested and works well. Recommending this to be merged. |
No description provided.