Commit Graph

50 Commits

Author SHA1 Message Date
U-GINA-PC\gina 8e56f1b305 Reduce dependency on OS in determining if file is video.
Introduce magic.IsVideoFileName, add test for it.

Fixes this error:

--- FAIL: TestIsVideo (0.08s)
    search_test.go:41: IsVideo failed video=true filename=movie.mkv mimetype=application/octet-stream
FAIL
FAIL	perkeep.org/pkg/types/camtypes	0.399s

Discussion about this problem is here:
https://groups.google.com/forum/#!topic/perkeep/Wdb_0Os6ZkY

Change-Id: I14f54bd60c9495d6aa665036b83c813673608ad7
2019-04-02 09:56:09 -07:00
Brad Fitzpatrick 7c03aef51f internal/magic: add mkv as a known video extension
Change-Id: Ifb868a26e7f1f6a9a5603b9ffb791282a19a34b1
2019-03-28 15:13:02 -07:00
mpl 2a85cb7142 internal/rollsum: replace with go4.org/rollsum
Fixes #1253

Change-Id: I64aac5739a18d2e19494881dcceff9d43355fac2
2019-02-23 01:48:18 +01:00
Viktor e6fb16557f internal/geocode: use viewport if bounds is not defined
The bounds response from google geo api is optional and for many searches not
returned at all. Use viewport in those cases.

Change-Id: Iaf0a055720fd6cc0a2c87e93b8e22315798a0b35
2018-08-23 19:39:47 +02:00
Mathieu Lonjaret e66f5ce20a Merge "server/perkeepd/ui: display search query errors" 2018-08-02 17:56:49 +00:00
Euan Kemp 90042fe296 pkg/blobserver/s3: use official aws client
vendor: add github.com/aws/aws-sdk-go at rev bc3f534c19ffdf835e524e11f0f825b3eaf541c3

This changes all uses of the s3 client to be the official aws-sdk-go. As
such, it also deletes the previous client maintained in internal.

There are a few notable changes that come with this:

1. An 'aws_region' key is added to the low-level config. The
   'get-bucket-location' call is used to identify the correct region
   rather than using the redirect returned to determine it.
2. Deleting multiple objects at once is much faster (batches of up to
   1000 vs 1 at a time).
3. Retriable errors are retried automatically (see #1184).
4. Newer APIs are used for some operations (v2 / batch apis).

An unfortunate result of 4 is that this is technically a backwards
incompatible change. An IAM policy which used to be sufficient for
perkeep may no longer permit some of the new api calls (even if they're
not doing anything different really).

Fixes #1184, #911

Change-Id: I077fe88def18b7e9a14267820773245e7003634c
2018-07-31 15:51:31 -07:00
mpl 933ecd89df server/perkeepd/ui: display search query errors
This change:
-on startup, makes perkeepd log instruction about the Google geocoding
key, if it is not found in Perkeep configuration directory.
-in the web UI, makes search query errors from the search session show
up in a dialog, instead of just being logged in the javascript console.
Among other things, it will allow users to be more readily informed
that their loc: queries are failing because they don't have a geocode
key setup.

According to the Google geocoding team, we should not share a geocoding
API key (too risky/expensive), and using an API key is the only way to
make geocoding requests. So we have to let users deal with it themselves
unfortunately.

Updates #1115
Fixes #1116

Change-Id: I461e7f06a04ffd874678ab8233185999024cb3d8
2018-06-26 02:25:32 +02:00
Brad Fitzpatrick f3f38f0c76 perkeepd, serverinit, gce: opaque-ify serverinit.Config, trim camlistored.go
This change has two major parts, which were interwoven enough to do
them in one change:

1) make serverinit.Config fully opaque, in prep for TOML configs #1134

2) shrink the massive server/perkeepd/camlistored.go file. It was out
   of control and had a bunch of code that better belonged
   elsewhere. This change moves a few hundred lines of code from
   camlistored.go into more logical places: internal/osutil/gce for
   GCE stuff, serverinit for config stuff (KeyRingAndId), etc.

I also added a TODO to make it possible to compile perkeepd without
any GCE stuff, which I saw as a possible and worthy goal only after
moving everything away.

Updates #1134

Change-Id: Iea6f84c5aca9c70b97806f4a201ec35e0f630e3b
2018-05-13 15:50:10 -07:00
mpl b76a4f6727 internal/osutil: revert to using "test safe" func for identitySecretRing
And while we're at it, rename said func (CamliConfigDir) to
PerkeepConfigDir.

Fixes #1161

Change-Id: Ia8c9b5826046437b77c8e16ee91912e31ad319a3
2018-05-12 02:12:03 +02:00
Brad Fitzpatrick 245bb63fff osutil: fix Windows use old Camlistore-named APPDATA directory
Fixes #1150

Change-Id: Ia2843437abbaba96e936c1c0f46bf8b171a2e28e
2018-05-07 20:52:13 -07:00
Brad Fitzpatrick 789f861964 all: rename some references to .config/camlistore to .config/perkeep
Updates #981

Change-Id: Id76fe17d80380bdb973bc85ec8f54ba9500aff40
2018-05-02 21:36:29 -07:00
Brad Fitzpatrick 12894d4630 all: Windows fixes (don't listen on file descriptors in test.World, etc)
test/integration: don't listen on file descriptors.
make.go: unrelated, but options to make it much faster.
internal/images: t.Skip on HEIC dependency failures

Fixes #1140
Updates golang/go#25210

Change-Id: I8092155411826d6ed1f8d85230b753d1369044af
2018-05-01 21:38:19 -07:00
Brad Fitzpatrick 3b1828d79f pkg/test: remove check that GOPATH is set
We can also use the implicit one, so don't require an explicit one.

Change-Id: Ie4712be849f40b8f8cc30f99d019dd863944289f
2018-05-01 14:13:41 -07:00
Brad Fitzpatrick bf119f08c4 internal/osutil: remove hard-coded /tmp to fix tests on Windows
Change-Id: If0594ef866d6b20d2e235f4734efbb4e1d6a37d4
2018-05-01 12:44:12 -07:00
Brad Fitzpatrick 3aca4399c5 internal: fix compilation errors in tests
Not found earlier due to #1138

Change-Id: I1601554adb746f7b67cd361e8779d5092e8b3696
2018-05-01 12:31:33 -07:00
Brad Fitzpatrick c698ff5add misc/docker/heiftojpeg: switch to ImageMagick
Still slow, but no more ffmpeg child processes, and I'm confident
ImageMagick will improve over time. There are actually ImageMagick
commits in the past few hours that look promising. We have a demo
tomorrow, so we're not going to bump our git rev & Docker image to the
latest ImageMagick master yet.

Updates #969

Change-Id: I7a8545821cae4214ea521d7cb46aa235ae3f0ed3
2018-04-27 16:26:14 -07:00
Brad Fitzpatrick 6b88e2a73f internal/images: broaden pattern that matches HEIC images
A bunch of mine had a larger initial ftyp box, which broke the second
part of the pattern. But the second part of the pattern doesn't matter
anyway.  This only needs to casually recognize them. A later full
parse will determine what they really are.

This also adds some new debugging when CAMLI_DEBUG is true.

Change-Id: Ib4adc9b5447a64ba4682624e42b55f1d65779ef7
2018-04-27 12:29:00 -07:00
mpl 8b30515218 internal/geocode: change Lookup behavior wrt to AltLookupFn
Even when AltLookupFun was defined, Lookup used to fallthrough after the
AltLookupFn, depending on what AltLookupFn returned.
This means in some cases, our tests in pkg/search did end up calling the
Google API (which was not intended). We found out because with the new
dependency on an API key for the Google service, we now rely on reading
the key from the config dir, which is wired to panic if it is accessed
during tests.

This change therefore simplifies Lookup, by making it return the results
of the AltLookupFn call, if AltLookupFn exists.

Change-Id: Ie196f892f36d309c725a6e869094364d49cffdc8
2018-04-25 18:01:39 -07:00
Brad Fitzpatrick 70a9c72528 geocode: support the now-required Google API key and document how to configure
Change-Id: Ic4f01c7bf0ad37d06ee76aad53ad99a91d986c03
2018-04-25 11:20:47 -07:00
Mathieu Lonjaret 36bb53527f Merge "cmd: rename camget to pk-get, and make it a mode of pk" 2018-04-23 03:52:06 +00:00
mpl 7a27eb42eb cmd: rename camget to pk-get, and make it a mode of pk
A couple of related fixes and renames too.

Updates #981
Fixes #1056

Change-Id: Id47a933c77422edfb9db41d34c38ed9d0d7a1846
2018-04-22 20:50:54 -07:00
Brad Fitzpatrick 01af2e3134 Merge "internal/osutil: move the config dir to perkeep" 2018-04-22 20:16:48 +00:00
Brad Fitzpatrick a062b701c9 all: more log spam & logging consistency cleanup
Change-Id: Ibc38c2eed86e75afb064ba25ba586494c813f56c
2018-04-22 11:30:02 -07:00
mpl 2bb666ccf6 all: rename remaining occurrences of camput
Also removed misc/buildbot while at it (which contained camput
references) since we don't use it anymore at all.

TODO: the OSX app seems to be relying on finding a binary in ../bin,
which we do not use anymore. This will probably need fixing.

Updates #981

Change-Id: I14220fbad2e81181330fca4bb2d2e5fe170e1bd6
2018-04-21 16:20:24 -07:00
Brad Fitzpatrick 9ce352249c internal/osutil: move the config dir to perkeep
Updates #981

Change-Id: I71ceea6395d31851e8502a2f397acb22056fe1b0
2018-04-21 12:50:24 -07:00
Brad Fitzpatrick 614b3f4cee internal/images: use tmpfs for heiftojpeg's /tmp dir for ffmpeg scratch space
Change-Id: Ia1691e17fb8bd95dfb3333aab67bd180a4d6fe58
2018-04-21 12:06:05 -07:00
Brad Fitzpatrick ca76a40bbc Rename camlistored to perkeepd.
Updates #981

Change-Id: I8fe43c240c149074c23128a89ab426af9cbf94b4
2018-04-21 11:06:09 -07:00
mpl 3014bd7413 pkg/index: read EXIF bytes when HEIC file
Updates #969

Change-Id: I11cc1668b853fe5bc2d076addda1a60c08be1dc5
2018-04-18 17:39:38 +02:00
mpl 149212b828 internal/images: reset err to nil on no EXIF found
the changes to DecodeConfig in ce955adf48
moved the call to image.DecodeConfig to before the call to exif.Decode,
because we need to do that for the HEIF case.

After the call to exif.Decode, if err is nil and is not a short read
error, we ignore the error and the code goes on. To mark that intent,
we should have explicitly set the err to nil at this point. However,
that omission did not matter before
ce955adf48 because image.DecodeConfig
was the last setter of the error.

Now that it has moved up, we do have to explicitly reset the err to nil.
While we were at it, we rewrote the whole logic to be easier to read.

This seems to fix all the tests in pkg/index and pkg/search.

Change-Id: Id0b711179ccb1365b851d3e86ecb70d47ac358b4
2018-04-18 03:41:14 +02:00
mpl 4050d088dc internal/images: gate docker pull for thumbnails
Fixes #1091

Change-Id: I31fda636cec4b4ae06c74cc2c04b6986f10222c3
2018-04-17 17:13:50 +02:00
mpl ce955adf48 pkg/index: start support for HEIC images
Just enough to index an image's dimensions, and display its thumbnails
in the web UI.
Works with docker too.

Udates #969

Change-Id: Ie443cced4f785c332ca98f09eb647f00e53a532e
2018-04-17 02:53:55 +02:00
mpl 132f912df8 internal/images: start support for HEIF
Use it in pkg/server for thumbnailing, but it will actually not be
called until we add basic indexation/description of HEIF too.

Updates #969

Change-Id: I3e4e40534feaff70f404d96d4e87c8dd057f880d
2018-04-13 02:46:59 +02:00
Brad Fitzpatrick 4a27c0e90d internal/magic: recognize heic images
Updates #969

Change-Id: I3357dda3178cf07fd8122a3ec4ab2b5aec8495ad
2018-04-11 15:27:36 -07:00
Brad Fitzpatrick a3f7f2285c internal/magic: use field names in struct literals
In prep for next CL adding a field.

Change-Id: Ia53e20112e3592bd3ba6df353f6869ec2ecd208f
2018-04-09 21:42:39 -07:00
Paul Lindner 50a99bad81 internal/fakefsnotify: remove fakefsnotify, no longer in use.
Change-Id: I0b1d919ccf6c882ef3a5f2e95785b5c34c314b20
2018-02-11 21:20:02 -08:00
Paul Lindner 84b2c6b3e4 all: various lint fixes
- correct logging that logged functions instead of their value
- use ID vs Id naming
- use correct function names in comments

Change-Id: I61562cef7ebac7337ec6c85312cdf7915cb1a84b
2018-02-05 11:59:00 -08:00
Mathieu Lonjaret 6e8a5930c9 all: make server advertise when it has legacy SHA-1 indexes, use that info
when its wholeref index lines contain any "sha1-" wholeref lines.

Then, have the client use that info when uploading files to also
compute the sha-1 (in addition to the sha-224) and ask the server for
both.

By client, we mean changes to cmd/camput, to pkg/client functions (for
camput and other Go clients, such as the apps), and to the web UI.

Also, add a -sha1 mode to devcam server, as well as the
CAMLI_SHA1_ENABLED env var, to facilitate testing/debugging of the
legacy sha1 mode.  Fix/document unrelated options in devcam server
while we're at it.

Change-Id: I369679d2a4719f6f8b409f78dd4d065e13a3f62f
2018-01-31 01:10:52 +01:00
Paul Lindner 459c75410e all: more renaming of Camlistore to Perkeep
Change-Id: I118e3cbcf20d80afeffc84f001388c4556f21628
2018-01-30 03:02:56 -08:00
Paul Lindner 6d2d9714de all: simpify constructs by running gofmt -s on all code
Change-Id: Idc12ddcfe8f735d77c6baa942f5bb7a2c7d9b40b
2018-01-21 10:27:12 -08:00
Brad Fitzpatrick 194d4f9443 blobserver, all: add contexts to ReceiveBlob, Fetch & million resulting deps
I had intended for this to be a small change.

I was going to just add context.Context to the BlobReceiver interface,
but then I saw blob.Fetcher could also use one, so I decided to do two
in one CL.

And then it got a bit infectious and ended up touching everything.

I ended up doing SubFetch in the process by necessity.

At a certain point I finally started using context.TODO() in a few
spots, but not too many. But removing context.TODO() will come in the
future. There are more blob storage interfaces lacking context, too,
like RemoveBlobs.

Updates #733

Change-Id: Idf273180b3f8e397ac5929c6d7f520ccc5cdce08
2018-01-18 16:22:16 -08:00
mpl 14286029ff internal/httputil: remove unused CertFingerPrints
It became unused in 8813375592 , when we
started using Let's Encrypt in pkg/deploy/gce

Fixes #1000

Change-Id: Id88e035ea8246fe0d4637489e9e97a59e223fd0d
2018-01-16 00:41:04 +01:00
Brad Fitzpatrick 38f10a7bd0 all, testhooks: use sha224 by default, add hook for some tests to use sha-1
Remove the blob.SHA{1,224}From{Bytes,String} constructors too. No
longer used. This adds blob.RefFromBytes which was missing. We had
blob.RefFromString. Now everything uses blob.RefFrom* instead of
specifying a hash function.

Some tests set a flag to force use of SHA-1 because there was too much
golden data to update. We can remove those one-by-one over time as we
fix up tests.

Updates #537

Change-Id: Ibe6428089a6221594c2b751f53f98b03b5a28dc2
2018-01-09 20:03:38 -08:00
Brad Fitzpatrick 0e8980b54b blobserver: change BlobStatter interface, simplify proxycache
This addresses a long-standing TODO in the BlobStatter interface to
clean it up. Just like all new Go programmers, I misused channels in
APIs. I should've cleaned this up years ago.

While here, I also added a context.

The rest should get contexts later.

This also cleans up a few things here & there.

The pkg/client statting no longer does batching, which added a lot of
complexity. There was a comment saying something like "once we have
SPDY, we can delete this". Well, we have HTTP/2 now, so seems
deletable.

All tests pass.

Change-Id: I034ce07d9b70e5cc9e5482213368993e638d4bc8
2018-01-08 16:54:52 -08:00
Brad Fitzpatrick 9265c980de all: change github.com/camlistore/camlistore to github.com/perkeep/perkeep
Change-Id: I0d612bf450e9e8d9ce0767c5a0cb0c44c0d8704f
2018-01-05 19:49:59 -08:00
Brad Fitzpatrick 57648c6b83 all: update copyright holder from Google Inc to The Perkeep Authors
The AUTHORS file is the list of copyright holders.
2018-01-03 16:52:49 -08:00
Brad Fitzpatrick c3d05cdce9 Move more packages out of pkg/ and into internal/
Moved hashutil, httputil, osutil, netutil,
images, media, magic, video, and rollsum.
2018-01-02 21:03:30 -08:00
Brad Fitzpatrick 11e9c5567c Move some packages from perkeep.org/pkg to perkeep.org/internal
Notably: pkg/misc all moves.

And pkg/googlestorage is deleted, since it's not used. Only the
x/net/http2/h2demo code used to use it, but that ended in
https://go-review.googlesource.com/33230 (our vendored code is old).
So just nuke that dir for now. When it's refreshed, it'll either be
gone (dep prune) or new enough to not need googlestorage.

Also move pkg/pools, pkg/leak, and pkg/geocode to internal.

More remains.

Change-Id: I2640c4d18424062fdb8461ba451f1ce26719ae9d
2018-01-01 20:54:48 -08:00
Brad Fitzpatrick d6a0b05df0 Rename import paths from camlistore.org to perkeep.org.
Part of the project renaming, issue #981.

After this, users will need to mv their $GOPATH/src/camlistore.org to
$GOPATH/src/perkeep.org. Sorry.

This doesn't yet rename the tools like camlistored, camput, camget,
camtool, etc.

Also, this only moves the lru package to internal. More will move to
internal later.

Also, this doesn't yet remove the "/pkg/" directory. That'll likely
happen later.

This updates some docs, but not all.

devcam test now passes again, even with Go 1.10 (which requires vet
checks are clean too). So a bunch of vet tests are fixed in this CL
too, and a bunch of other broken tests are now fixed (introduced from
the past week of merging the CL backlog).

Change-Id: If580db1691b5b99f8ed6195070789b1f44877dd4
2018-01-01 16:03:34 -08:00
Will Norris 77ed42edf8 add canonical import paths
The import path was added to the go file that included the package
documentation if one existed.  Otherwise, I used what seemed to be the
primary file for the package.

Fixes #689

Change-Id: If51be0e86529fd6f179e80af6781e639f8550fd2
2016-03-13 19:57:14 -07:00
mpl da4b48926c camput file: move chanworker code to an internal chanworker pkg
First one of a series to refactor files.go

Change-Id: I4ec775674bca07c641d88f8392b2a03bb4c6fa7b
2015-03-30 17:51:18 +02:00