Commit Graph

218 Commits

Author SHA1 Message Date
Brad Fitzpatrick 7e486bd9a7 all: address misc staticcheck warnings
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-14 17:02:10 -08:00
Brad Fitzpatrick bc9fbcd89e chip away at some staticcheck warnings
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-13 15:57:55 -08:00
Brad Fitzpatrick c2334642fb internal/netutil, pkg/schema: remove nocgo tag; os/user has its own nowadays
The os/user package nowadays says:

    When cgo is available, and the required routines are implemented
    in libc for a particular platform, cgo-based (libc-backed) code
    is used. This can be overridden by using osusergo build tag,
    which enforces the pure Go implementation.

So we don't need to work around it anymore.

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2024-01-11 19:47:49 -08:00
Brad Fitzpatrick bec657b7e2 Remove legacy +build comments; use go:build only
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-12-31 09:18:39 -08:00
Brad Fitzpatrick a549aab217 Remove legacy Google AppEngine alternate implementations
AppEngine lets you do just about anything these days. No need to cater
to the ancient limited version.

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-12-31 08:50:03 -08:00
Oleksandr Redko 001c417e73
all: replace deprecated io/ioutil with io and os (#1647) 2023-01-23 10:25:14 -08:00
Michael Hoffmann f06efdb51f misc: remove sha1 from tests, remove testhooks, minor cleanups 2023-01-13 07:58:19 -08:00
Brad Fitzpatrick 6614d23428 schema: simplify parseSuperset
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-01-13 07:48:53 -08:00
Brad Fitzpatrick 921894783b all: gofmt for Go 1.19
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2022-12-31 22:45:40 -08:00
Michael Hoffmann 215de258f2 fuse: misc fixes
* propagate more context cancelations from pkg/client
* convert ErrCancel to fuse.EINTR to enable clients to handle interrupts
* improve interrupt handling in fs_test.go
* fix race in mutDir between rename and first populate
2022-07-01 07:39:38 -07:00
luz paz d605f86c82 Fix various typos
Found via `codespell -q 3 -S ./clients/web/embed,./clients/chrome -L ba,everytime,impres,keypair,msdos,pres,ro,te,ue`
2022-05-02 14:31:09 -07:00
Eng Zer Jun 2977046a4c all: use `T.TempDir` to create temporary directory
The directory created by `T.TempDir()` and is automatically removed when
the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-04 08:18:24 -08:00
Michael Hoffmann 5b6e59539d cleanup: remove pkg/test/asserts
This PR removes the deprecated pk/test/asserts.
2022-03-04 08:17:07 -08:00
Alexandre Viau e2bad19a87
EntityFetcher: require fingerprint (#1374)
EntityFetcher no longer supports key ids. This isn't required anymore as
its only user (`SignRequest.Sign()`) now passes fingerprints.
2021-08-10 09:35:43 -04:00
Alexandre Viau fb961cf310
make codebase go-vet-clean (#1379)
Co-authored-by: Bob Glickstein <bobg@emphatic.com>
2021-07-26 21:19:53 -04:00
aviau 751f5ed3a4 signer: deprecate KeyId()
`signer.KeyId()` was only used in a counter-productive way
by comparing it with half of a long ID.

Also use this opportunity to return the full fingerprint from
ParseArmoredPublicKey. NewSigner was the only caller of this
function.
2021-01-24 12:02:48 -05:00
aviau 231ba4233f pkg/schema: create CamliType type
Create a CamliType type in pkg/schema and use it in a couple of
packages.

It can be implemented in other packages as we go.
2021-01-19 00:47:58 -05:00
mpl 2a85cb7142 internal/rollsum: replace with go4.org/rollsum
Fixes #1253

Change-Id: I64aac5739a18d2e19494881dcceff9d43355fac2
2019-02-23 01:48:18 +01:00
Angel 3dbb01138f pkg/importer: add "instapaper" importer for Instapaper service
A working importer for the Instapaper service. The importer imports
bookmarks, full text articles, and highlights. A blob item handler for
Instapaper highlight permanodes is included to show summarized highlight
content from the server UI.

Also, this CL updates github.com/garyburd.com/go-auth to rev
bca2e7f09a178fd36b034107a00e2323bca6a82e in order to get support for
XAuth requests.

Fixes #1208

Change-Id: I72e0c40b245c7eec4a44bb475fcaa96a0ee9a1c5
2018-11-26 07:57:08 -05:00
Stephen Searles 350b369030 pkg/schema: expose signer and signature information on claims
This will allow consumers of pkg/schema to do things like verify the
signature on claims.

Fixes #1167

Change-Id: Iec76e382e18d91f82694412bc855ac5be82df825
2018-05-14 08:45:36 -04:00
Brad Fitzpatrick e25375ca22 schema: skip symlink tests on Windows
Change-Id: I7b076d886883ac0ed19df0cc5d3797cfc04b1c75
2018-05-01 14:17:35 -07:00
mpl db2604f981 pkg/schema: break static-sets in subsets for large directories
The current maximum size for a schema blob is 1MB. For a large enough
directory (~20000 children), the resulting static-set JSON schema is
over that maximum size.

We could increase that maximum, but we would eventually hit the maximum
blob size (16MB), which would only allow for ~300000 children. Even if
that is an uncommon size, it is technically possible to have such large
directories, so I don't think it would be reasonable to restrict users
to such a limit. So it does not seems like enough of a solution.

The solution proposed in this CL is to spread the children of a
directory (when they are more numerous than a given maximum, here set to
10000) onto several static-sets, recursively if needed. These
static-sets (subsets of the whole lot of children) are stored in the new
"mergeSets" field of their parent static-set schema. The actual fileRefs
or dirRefs, are still stored in the "members" field of the subset they were
spread in. The "mergeSets" and "members" field of a static-set are therefore
mutually exclusive.

Fixes #924

Change-Id: Ibe47b50795d5288fe904d3cce0cc7f780d313408
2018-02-09 01:36:38 +01: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
Paul Lindner 459c75410e all: more renaming of Camlistore to Perkeep
Change-Id: I118e3cbcf20d80afeffc84f001388c4556f21628
2018-01-30 03:02:56 -08:00
Brad Fitzpatrick 38c2a87ad2 cmd/camtool: add "camtool whoami" subcommand
Also clean up and document the client package.

And misc cleanups.

Change-Id: I385d9948d8735deb37814ac45ac58851d8e58c75
2018-01-23 14:02:32 -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
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 27bacd3df1 pkg/blob, all: support SHA-224 blobrefs, make them the default
Updates #537

Change-Id: I3966697cbdb05ca4b380974be604deebdaa258c2
2018-01-08 16:34:41 -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 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
Brad Fitzpatrick 815575e493 Merge "pkg/rollsum: fix uint8 overflow" 2017-12-29 19:41:36 +00:00
Paul Lindner e97eae91dc all: lint fixes for "don't use leading k in Go names"
Change-Id: I8647c1dcc0535b1fc8dc0e1b1ca4623c23d6ac7c
2017-12-13 11:31:25 -08:00
Paul Lindner 15feaeb24c all: lint fixes for 'error strings should not be capitalized or end with punctuation or a newline'
Change-Id: I9c3766a51ac8be694ae76befff4b6fa9a85e34eb
2017-12-11 06:13:25 -08:00
Paul Lindner fa46c3935d Correct various misspelled words
Change-Id: I236e880526e4c2b0bd318da041983d557e0aa885
2017-09-11 08:33:31 -07:00
mpl 5fef0785f2 pkg/server: make DownloadHandler also handle directories when zipping
The DownloadHandler only accepted file schemas as input for building a
zip archive so far.

It can now zip directories and their contents as well.

Non-regular files (socket, fifo, symlink) are now handled too.

As previously, no compression is applied when zipping.

When the DownloadHandler's Fetcher is a caching fetcher, all the files
that are supposed to be included in the archive are read, so we can
report reading errors even before starting to create the archive. We now
also take advantage of this optimization to build a
blobRef->filepath mapping when checking the files. Then, when the zip
archive is actually being built, the file path can be looked up in the
map, instead of having to assemble it again with recursive concatenation
of directory names.

Change-Id: I853c495798a9a43e12f3386603a70560ff46a237
2017-09-06 00:06:45 +02:00
Tamás Gulácsi 0bfa352bae pkg/importer: add gphotos, a Google Photos importer
Uses the Google Drive API to import photos from the Google Photos folder
in Google Drive.

Still a work in progress, so not yet added to allimporters.

Issues #874 #896

Change-Id: I9b9bffe071434b2a55be667579c3699a3addb8ed
2017-05-08 18:41:34 +02:00
mpl 353e1e8873 pkg/schema: make sure claim date becomes signature time
It seems that signing a claim schema does not automatically set the
claim date to the signature time, which I believe should be the case.

This change adds a test to demonstrate the issue, and the fix that makes
the test pass.

Fixes #917

Change-Id: I55d6c75cbe3c3c4c1d6e5b69f6d26277d0d12728
2017-04-21 17:08:03 +02:00
mpl 5a24ffd854 new app: scanning cabinet
WARNING: this app is still experimental, and even its data schema might
change. Do not use in production.

This change adds a Camlistore-based port of the scanning cabinet app
originally created by Brad Fitzpatrick:
https://github.com/bradfitz/scanningcabinet

Some of it is inspired from the App Engine Go port of Patrick Borgeest:
https://bitbucket.org/pborgeest/nometicland

The data schema is roughly as follows:

-a scan is a permanode, with the node type: "scanningcabinet:scan".
-a scan's camliContent attribute is set to the actual image file.
-a scan also holds the "dateCreated" attribute, as well as the
"document" attribute, which references the document this scan is a part
of (if any).

-a document is a permanode, with the node type: "scanningcabinet:doc".
-a document page, is modeled by the "camliPath:sha1-xxx" = "pageNumber"
relation, where sha1-xxx is the blobRef of a scan.
-a document can also hold the following attributes: "dateCreated",
"tag", "locationText", "title", "startDate", and "paymentDueDate".

Known caveats, in decreasing order of concern:
-the data schema might still change.
-the scancab tool, to actually create and upload the files from physical
documents, is practically untested (since I do not own a scanner).
-some parts, in particular related to searches, are probably
sub-optimized.
-the usual unavoidable bugs.

Change-Id: If6afc509e13f7c21164a3abd276fec075a3813bb
2017-02-15 17:14:45 +01:00
mpl 3d048ca304 vendor: rm code.google.com/p/go.crypto/openpgp
And add golang.org/x/crypto/openpgp instead, at rev
ede567c8e044a5913dad1d1af3696d9da953104c
As well as golang.org/x/crypto/cast5 , as a dep.

Change-Id: I385fb0cd0eef438b43fa1dcd2a36e6a1442fd3b1
2016-11-28 19:34:32 +01:00
mpl faac33f409 app/publisher: infinite scrolling of set members
Done with gopherjs and jquery.

Some build tagging added in pkg/schema and pkg/netutil because
gopherjs does not support cgo (so no os/user).

Issue #798

Change-Id: Ib1e1e94185f75cdf696aa2dd31c57fa9e3af84a1
2016-07-15 00:34:52 +02:00
Filippo Valsorda 3d4b74d86e schema/dirreader: limit I/O concurrency in Readdir
The comment was right: a directory with too many entries depleted all my
file descriptors.  I want my file descriptors back.

Change-Id: Iacdd95f06a7f5b2a2e7d4676b17eb33f86060ad2
2016-05-22 00:27:49 +01:00
Kate Pek 96ed8597a4 schema/nodeaddr: add GivenName, FamilyName
Change-Id: I82b5365d24acf14537719e903e463f0030e80ec5
2016-04-29 21:32:48 -05:00
Brad Fitzpatrick 75d60962f6 Move remaining stuff in third_party/* to vendor/*
Change-Id: Ifbcc02817083cba68d8c1acec3e6ec50e8f61149
2016-04-20 16:49:15 -07:00
Tamás Gulácsi 7402cc0efd Delete misc unused objects
Using honnef.co/go/unused/cmd/unused

Change-Id: I672b3cb77f09e9bd80dcdc149cde4f7f2939e451
2016-04-06 17:59:51 +02:00
Tamás Gulácsi 8d6b156a0b Misc syntax cleanup found by gosimple.
https://github.com/dominikh/go-simple

Thanks to Dominik Honnef for this great little tool!

Change-Id: I789b3a37e18f535df1ff0da47c0366ed01b2429e
2016-04-04 17:19:57 +02: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 e0d719ba21 pkg/types: remove
Most of it replaced with vendor/go4.org/types and
vendor/go4.org/readerutil

u32 went where needed in pkg/blobserver/*
invertedBool went in pkg/types/serverconfig
atomics64 went in pkg/fs

Change-Id: I230426cda35be4b45ed67e869f14e6fdae89be22
2016-02-05 18:28:47 +01:00
mpl 6af01f6c71 vendor: move pkg/images dependencies from third_party
This change is in anticipation of moving pkg/images to go4.org, where it
should not depend on packages in third_party.

So:
third_party/github.com/nf/cr2 -> vendor/github.com/nf/cr2
third_party/github.com/rwcarlsen/goexif -> vendor/github.com/rwcarlsen/goexif
third_party/golang.org/x/image/tiff -> vendor/golang.org/x/image/tiff

Note that third_party/go/pkg/image/jpeg was also a dependency of
pkg/images. We had vendored image/jpeg from tip at the time because it
offered advantages over the version from Go1.3
(https://github.com/camlistore/camlistore/issues/463).
Since we now depend on Go1.5, we can go back to depend on the stdlib
version, so we simply remove third_party/go/pkg/image/jpeg and adjust
the imports accordingly.

Change-Id: Ifc8ffae0551102e644a0a0c67f3ff89e04df15c7
2015-12-18 22:15:33 +01:00
mpl 8d76f0563b vendor: go4.org/syncutil/singleflight
Previously pkg/singleflight

Imported from github.com/camlistore/go4/ at rev
039bcc4ca7e407e5611cbdf15a1f208be0bceda0

Also reimport vendor/go4.org/syncutil because some of it got split into
github.com/camlistore/go4/syncutil/syncdebug

Change-Id: Iaf48de71928d17e0410442ea6f5bef7262ba60d2
2015-11-24 17:28:28 +01:00