Commit Graph

1203 Commits

Author SHA1 Message Date
Brad Fitzpatrick 6a68c7dea3 server/perkeepd/ui: fix size of swarm logo
Change-Id: I66aaf4053e5a129d112fe389cf222004ace3f20d
2018-04-25 13:43:40 -07:00
Brad Fitzpatrick f636f75b75 server/perkeepd/ui: change foursquare logo to swarm logo
Upstream rebranded.

Change-Id: I0ce6e98f29c5c3fe59ec9ac905cf4bb8976f0a4f
2018-04-25 13:31:48 -07:00
mpl 66e6766571 pkg/gpgchallenge: use long form when looking for key ID
We migrated to using the long form for key IDs sometime ago, but we
never updated the client of the gpgchallenge accordingly, so in
functions that take a keyID as an argument, it would fail to find the
given long keyID within a key ring.

However, for usability reasons, we want to keep the short form in the
hostname of the instance (and hence as the DNS entry), so we revert to
using the short form when perkeepd is setting its host name.

Change-Id: I8373016671fdead32780a04f6d64045e81cc9cd1
2018-04-23 21:44:25 -07: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 38d0075c3a all: make log lines a bit more consistent
Change-Id: I06c5bbe072c9857ca3afbf97d14146b9cd96a49e
2018-04-22 08:51:43 -07:00
mpl aaac9635d2 pkg/search: allow empty expression
We had checks in place to return an error if a search query had both
no constraint and no expression. However:
1) we accepted " " as a valid search expression (which is the
work-around that was used by the web UI for the index page)
2) the rest of the code seems to be coping well if we remove these
checks, which this CL does.

This allows us to remove the q=" " trick in the web UI, which does not
seem to be breaking anything, and has the side-effect of improving the
map aspect story (issue 1081). Because with this change, the index page
is not considered anymore as the result of a search query, which means
if one then clicks on an image, one then gets to the image permanode as
a "standalone" item, instead of as one item part of set.
As a consequence:
1) If one then clicks on the map aspect, one gets only this item on the
map (with the proper zoom level), instead of all the items from the
index page.
2) The other side of the coin is left/right navigation does not "work"
anymore in this context, since the item is not part of a set anymore.

In other words, this change makes the index page (i.e. the empty search)
a somewhat particular case, and makes it behave a little differently
from the result of any other (non-empty) search.

Updates issue #1081

Change-Id: Ibbb1711c67c7cf8adaf94ab5d2c68c3755e4983b
2018-04-21 17:44:43 -07:00
Brad Fitzpatrick 46f31ba425 server/perkeepd/ui: rename UI menu from Camli to Perkeep
Also disable the annoying mouse hover enter/exit behavior. Require
clicks. TODO: more focus events elsewhere should close the menu, but
this is better than before.

Also, rename the PIGGY variable to KEEPY for now, in prep for changing
the logo from a pig to the Keepy the Perkeep Parakeet mascot.

Updates #981

Change-Id: I48d9dd7267701b39122836aaad708726b1c105ac
2018-04-21 12:37:52 -07:00
Brad Fitzpatrick ca76a40bbc Rename camlistored to perkeepd.
Updates #981

Change-Id: I8fe43c240c149074c23128a89ab426af9cbf94b4
2018-04-21 11:06:09 -07:00
mpl f8ef262ff9 make.go: clean up, notably remove the tmp source code mirroring
Fixes #1004

Change-Id: Iea01cfc601b8dd8f2a81fe5da40cdd272b164bb1
2018-04-17 19:39:46 +02:00
mpl a2359a934f server/camlistored/ui: relax requirements for thumber
We actually don't need to know the filename of an image for a valid
thumber to be created, so this change is removing such a strict check,
which was making foursquare venue photos not be displayed.

Also fix broken initialization of the thumber in foursquare container.

Change-Id: Iefb36fc403a3c1101d83f6af916b447e149f5acf
2018-03-31 00:11:38 +02:00
mpl 7bdd826360 pkg/importer: pick the "best" importer account when several exist
We still need to figure out the root cause of the problem, i.e.
why a sha224 importer node was created in the first place, when a
valid sha1 one already existed. Next CL.

Updates #1069

Change-Id: I00b4aab9a4f67b9c4ee198774378630615f6d11d
2018-03-02 16:02:18 +01:00
Mathieu Lonjaret 0fee217fe0 Merge "web UI: disable key nav when editing permanode attributes" 2018-02-21 18:50:57 +00:00
mpl ed47d7f303 web UI: disable key nav when editing permanode attributes
Also, only reset new row on first load, as opposed to on every React
update.

Fixes #923
Fixes #1059

Change-Id: I6ebaa31ca3509c4b53944861d7f3c5896547b425
2018-02-21 17:59:19 +01:00
Attila Tajti b71c054373 pkg/blobserver/overlay: add “overlay” blobserver type
The blobserver uses a base blobserver in read-only mode,
and uses another stage blobserver to record changes.

In a sense it is a read-write view on the master
blobserver that never changes base itself.

Change-Id: I39c7d7bbac713c32fd17710fab43754b546ebb3b
2018-02-21 05:51:00 +01:00
mpl 86da8c822c camnetdns: use Lets Encrypt http-01 challenge
Fixes #1033

Change-Id: I83b654ee1b33912e92c2b41339dec45de3b13456
2018-02-21 00:12:15 +01:00
Mathieu Lonjaret 14758c0d1e Merge "server/camlistored: add inline query parameter, and set Content-Disposition" 2018-02-20 22:30:36 +00:00
mpl 3d519b2773 server/camlistored: add inline query parameter, and set Content-Disposition
The download handler was setting the Content-Disposition to attachment
when the MIME type was "application/octet-stream". That means when e.g.
a plain text file (and probably others) is (incorrectly) detected as
"application/octet-stream", it is saved to disk instead of being opened
as text by the browser, when using the "View Original" button of the web
UI.
Conversely, when using the "Download" button of the web UI, the file
should always be saved to disk, and never be opened by the browser.

Therefore, we add the ?inline request parameter to the downloadhandler
GET handler to unambiguously request whether the response should have an
inline or an attachment Content-Disposition.

The View Original button action now always requests an inlined response.

The Download button action now detects whether the selection was only
about one file, and if yes it requests the file as an attachment
(instead of using the POST handler that zips all the requested files).

Change-Id: I4bbc42f17fb4ea0aff9e17056e80156611d4b419
2018-02-20 23:27:22 +01:00
mpl 0d96057201 pk/blobserver/blobpacked: check large storage integrity
Check that all blobpacked zips are in the blobpacked meta, and
vice-versa (that all entries in meta do exist as a zip in large
storage).

As the current recovery code would not fix the case of stale entries
(large blobRefs in the blobpacked index of large blobs that don't exist
anymore), this change also adds a new recovery mode, which wipes the
existing blobpacked index, before rebuilding it.

In doing so, the recovery var in blobpacked pkg, as well as the
flagRecovery in camlistored.go have been changed to ints instead of bools,
to take into account that we now have several modes of operation for
recovery.

Fixes #946

Change-Id: I1fe76b805af34933e362d70c9f27bfd5403e3f3a
2018-02-17 02:53:24 +01: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
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
Brad Fitzpatrick f9f109ffa1 all: more Camlistore to Perkeep renamings
Updates #981

Change-Id: I7fd4958bceaa4ada63d07aacf08af11cc03f32d7
2018-01-30 13:31:59 -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 d4ff75359c pkg/client: reduce the number of New constructors, return error by default
This removes NewDefault and NewFromParams.

Now the default way to create a client is:

    client.New() -> (*Client, error)

Specifying a server is optional and now requires
client.OptionServer(server).

If the caller really wants to log.Fatal on error, they can use
client.NewOrFail.

Also, some of the boilerplate from GopherJS callers is now promoted to
be the default behavior in the client package.

Change-Id: Icb106cf3e13cc492fe5b2f7f240e1ad4227eaf33
2018-01-24 07:42:04 -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 1d3ab02349 Merge "blobserver, all: add contexts to ReceiveBlob, Fetch & million resulting deps" 2018-01-19 01:43:58 +00: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
Attila Tajti 761bff63c0 server/camlistored: add sha224 support to web UI
The web UI support the old sha1 blob hash only.

Add initial support for sha224 blob refs.

Also add sha2.js and sha224.js to goog/crypt in the embedded resources.

Change-Id: If52d75d254d6163a737c56cf1676be1ef7eddb31
2018-01-17 16:07:04 +01:00
mpl e9e9da4bf8 server/camlistored: use Let's Encrypt http-01 challenge
As the priority is to fix GCE instances, the port for the http-01
challenge is not configurable for now (80) even not on GCE, but it will
be in a follow-up change.

update golang.org/x/crypto/* (for acme) to rev
13931e22f9e72ea58bb73048bc752b48c6d4d4ac
update golang.org/x/sys/* to rev
fff93fa7cd278d84afc205751523809c464168ab (because unix is a dep of
crypto)

remove warning about Let's Encrypt security issue from pkg/deploy/gce

I had to manually exclude vendor/golang.org/x/crypto/acme/jws_test.go
for now because it contains a private key, and git whines about it, and
i could not override it.

Fixes #1033

Change-Id: Ie4f2049e97892dee9ab513300a5f12e64976aec8
2018-01-16 23:43:13 +01:00
Magnus Landerblom e4970b542d server/camlistored: don't use deprecated lastModifiedDate for uploaded file
Use web standard lastModified instead of the deprecated lastModifiedDate.

See warning at top of:
https://developer.mozilla.org/en-US/docs/Web/API/File/lastModifiedDate

Change-Id: I0b975dc17129de4b68b279e9acd44bbac4bf3f2f
2018-01-15 22:27:00 +00:00
Tamás Gulácsi 2ba0c43003 pkg/blobserver/union: add "union" blobserver type
This blobserver is just "cat"ing the given "read" storages.
This is read-only, so you should use some other storage to augment this for
writing and removing - for example the "cond" storage is perfect for this.

My use-case is to use blobpacked with large=diskpacked, small=filesystem,
but consolidate the small blob storage into a diskpacked + filesystem
after the filesystem becomes huge.

Another use-case is joining separately built camlistore servers into one.
(For me, they have to be separated later, so I've built them separately,
but I've to use it joined for a month).

Change-Id: I4e7e42cd59286f0f34da2f6ff01e44439771d53c
2018-01-12 06:54:24 +01: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
mpl b5b668b661 pkg/client: force nil transport when on the browser
Calls to net.Dial* are prohibited with GopherJS. This can happen if the
client's transport is set by the user.

This change forces transportForConfig to return nil when the client
package is compiled with gopherjs, in order to make sure that a call to
newClient returns a client with a nil transport.

Change-Id: I577457bd7d924d31710168086dc2b394df3d1ae0
2018-01-03 16:38:47 +01: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
Mathieu Lonjaret ef4af89ea4 Merge "server/camlistored: add "Select all" button to web UI" 2018-01-02 16:40:02 +00: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
mpl a630f8dce3 server/camlistored: add "Select all" button to web UI
Fixes #842

Change-Id: Id69754d2d54f84b3441293d6631c2fa94135829d
2018-01-02 02:10:18 +01: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
Mathieu Lonjaret ece9b76f41 Merge "server/camlistored/ui: revert ref predicate to constraint" 2018-01-01 22:46:34 +00:00
Brad Fitzpatrick 9ca28d644b Merge "pkg/serverinit: on GCE, reset name if instance name is in camlistore.net" 2017-12-31 02:04:05 +00:00
Govert Versluis 8548962dbe Add Azure blobserver support.
Fixes #425

Change-Id: I02bb29e6503bfef0894cbfde0c2a3304cf70c932
2017-12-29 12:39:49 -08:00
Daniel Heath 59ac14caa5 Vendor OpenSans (apache 2 licence)
Change-Id: Ie74b37efc007011b32810fd91c65b7750588a76e
2017-12-29 10:22:49 -08: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 f28eb3cce8 Remove appengine server and the old python blobserver
Change-Id: I734f4621f77ce902050e9b37805e7f8912f75e97
2017-11-30 19:13:37 -08:00
Mathieu Lonjaret 7e9a0f9d42 Merge "camlistored/ui: reset new attribute row on navigation" 2017-11-29 20:44:28 +00:00
Paul Lindner 3e703921d1 vendor: update myitcv.io/react and react javascript library
Update myitcv.io/react to revision:
  bca7c66b77ed8a5b86fb77cff70914c4a7cc3ce5

Update react, react-dom to v15.6.2 based on instructions in
  https://reactjs.org/blog/2017/09/25/react-v15.6.2.html

Add vendor/embed/react/update.sh script to assist with future updates

Update mobile UI to fix problems documented here:
  https://reactjs.org/warnings/legacy-factories.html

Update mobile.html and debug_console.html to use minified js

Fixes #977

Change-Id: I15ea81822e4f85669b321d5b3eb8b169f534def7
2017-11-27 08:55:30 -08:00
Paul Lindner b09cd377d7 Switch to stdlib context from golang.org/x/net/context
This switches most usages of the pre-1.7 context library to use the
standard library.  Remaining usages are in:

  app/publisher/main.go
  pkg/fs/...

Change-Id: Ia74acc39499dcb39892342a2c9a2776537cf49f1
2017-11-26 01:12:26 -08:00
mpl 1d70d377cf camlistored/ui: reset new attribute row on navigation
When on the permanode details aspect, and navigating from one permanode
to the next, if some change had already been started on the new
attribute row, the change would "propagate" to the next permanode, which
is not desirable.

That is because the state of the new attribute row was not reset on
navigation, which this change does.

Fixes #923

Change-Id: I6dee8763b2c1fcac4b3592b21adc954eab9d0ffe
2017-11-23 17:50:15 +01:00
Mathieu Lonjaret 39cd6029e3 Merge "server/camlistored/ui: remove useless crossorigin and integrity for leaflet" 2017-10-08 03:05:18 +00:00
mpl b95aa162d7 server/camlistored/ui: remove useless crossorigin and integrity for leaflet
I had pasted them from an example when I started to work on the map
aspect, and forgot to look up their meaning/use afterwards.

Fixes #964

Change-Id: Ic92dcd9641a7fad49707c24f114b370f2c887828
2017-10-06 01:09:56 +02:00
mpl 4784b22aeb pkg/serverinit: on GCE, reset name if instance name is in camlistore.net
On GCE, on startup, we did not set the camliNetIP in the high-level
config if the camlistore-hostname instance var vas already set.

The camliNetIP presence in the config is the signal for the server
that it should be configured as part of camlistore.net (and in
particular that it should update the record for its name on the
camlistore.net DNS server). Part of this configuration is to set the
camlistore-hostname var for the instance.

Therefore, a server which had been configured once as described above,
would not, on a subsequent restart, behave as if part of camlistore.net
and would skip the related configuration code path. Unless the
camlistore-hostname var was manually wiped before restart.

As this manual step is not an obvious one, this CL changes the
initialization, so that if a camlistore-hostname var is set, but the
value is a subdomain of "camlistore.net", the var is treated as empty
and initialization proceeds as if with a new server.

Fixes #963

Change-Id: Iab70185d7b90ef7e70bb831d363ff9d525922e35
2017-10-04 17:36:02 +02:00
mpl 52b139ea6c vendor: update Google Closure
To rev 37a4c36ce6286bb78bceb20579fecdfe7a759e02

Fix vendor/embed/closure/updatelibrary.go to now fetch from github.
Fix pkg/misc/closure/gendeps.go to work with new addDependency calls.

Fixes #903
Fixes #961

Change-Id: Ie555cf9bf5a8624845095fb3351482a690a2571c
2017-10-03 17:33:49 +02:00
mpl 5f0a625e76 server/camlistored: cross-browser scrollTop getter
It looks like our vendored version of goog.dom.getDocumentScrollElement().scrollTop
does not work anymore for all browsers, as infinite scrolling is broken
for some.

This change is a work-around while we're working on a cleaner fix, like
seeing if an updated closure lib works correctly.

Fixes #961

Change-Id: I713529ff796f50ff7cf9234befbf6abbfb75e3cb
2017-10-03 16:10:32 +02:00
mpl 72a5abcfb5 server/camlistored/ui: revert ref predicate to constraint
The Blob aspect in the web UI for non-permanodes is broken, because the
initial search now uses a ref: predicate instead of a Constraint. That
is because for now, expression searches (as opposed to constraint searches)
only match permanodes, so the initial search on the concerned blob
fails. See issue #944.

Until we figure out whether we want to allow non-permanode expression
searches, this change therefore reverts that initial search to a constraint
instead of a ref: predicate search.

And since the getQueryExprOrRef function in search_session.js still uses
a ref: predicate, the map aspect (for the single node case) is not
affected.

Issue #944

Change-Id: I5c4b4d0bca704a550b6a730f24b8e96568c5c8b6
2017-09-08 01:33:23 +02:00
Mathieu Lonjaret 94a9d6a37c Merge "pkg/server: make DownloadHandler also handle directories when zipping" 2017-09-06 12:42:13 +00: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
mpl 1a830e5444 server/camlistored/ui: map aspect, add switch for clustering
controlled by the CAMLI_DEV_MAP_CLUSTERING env var

Change-Id: I7d790ca354e4c06b45833affb94337cb120ec7d3
2017-08-30 20:10:46 +02:00
Paul Jolly 4581abc238 vendor: upgrade to use myitcv.io/react
myitcv.io/react replaces github.com/myitcv/gopherjs/react.

This commits also includes relevant changes to reflect the new API of
myitcv.io/react:

https://github.com/myitcv/react/wiki/Changelog

myitcv.io/react
rev 0b147f16090bc5007116c494ca7ea95f78ee4a16

myitcv.io/gogenerate (required by myitcv.io/react/cmd/reactGen)
rev bd69a94c96953d20e106734856b69d71c8fa122b

github.com/gopherjs/jsbuiltin (required by myitcv.io/react)
rev 67703bfb044e3192fbcab025c3aeaeedafad1f2f

Change-Id: I1951519d30455915aa2f75fbb418057f8075e27c
2017-08-30 08:46:33 +01:00
mpl 088cdae82d server/camlistored/ui: map aspect improvements
-keep the browser URL bar in sync with the current search/zoom-level

-introduce the "map:" predicate, to be used as the current viewport in
the map aspect. This was previously achieved with the locrect predicate. We
try to keep this new predicate unknown to the server, and replaced on
the fly by an equivalent locrect predicate.

-stay on the map aspect when the search expression has a map predicate.
Same thing when loading a URL with a map predicate parameter: try to
load directly on map aspect, instead of going to search aspect first.

-make sure there's only at most one map query in flight at all times

Change-Id: Ibf928ee5c926670c221f212f14ca9799e1e7bb79
2017-08-29 18:13:07 +00:00
mpl be17ff99a1 server/camlistored/ui: map aspect, initialize on world view
Change-Id: I7493a71653efe4552e90764e16d903465fa69fb1
2017-08-23 19:57:58 +02:00
mpl 13e170994d server/camlistored/ui: map aspect, remove local OSM proxy
It was accidentally submitted with
3d405cd9ac

Change-Id: Id722cc2da355af8a02824a40b2bb19d9788f83ea
2017-08-23 17:39:44 +02:00
Mathieu Lonjaret 531b074ae4 Merge "server/camlistored/ui: map aspect, freeze marker cluster" 2017-08-23 14:35:01 +00:00
mpl 3d405cd9ac server/camlistored/ui: map aspect, freeze marker cluster
Add a plugin to the markers cluster, strongly inspired (but trimmed, and
modified) from https://github.com/ghybs/Leaflet.MarkerCluster.Freezable
to freeze the markers cluster as it is on each zoom level.

Fixes #940

Change-Id: Id7f1ed8182a5bd701c6c47e02b144a67f9b69b36
2017-08-22 19:53:23 +02:00
Mathieu Lonjaret ee8960864b Merge "pkg/search: add "ref:" predicate support" 2017-08-21 16:47:00 +00:00
mpl d1d8075c00 server/camlistore/ui: map aspect, remove unused code
Change-Id: Iebcff716614796b37128be89ed220cd278ad640d
2017-08-21 16:57:52 +02:00
mpl f0d679edeb server/camlistored/ui: map aspect, actually delay redrawing
Change-Id: I303a122b5409c72f131dfc030954eec89a05d2fc
2017-08-19 01:42:47 +02:00
mpl 2d3b781103 pkg/search: add "ref:" predicate support
The "ref:prefix" search predicate is simply the equivalent of the

Constraint {
	BlobRefPrefix: prefix,
}

search constraint.

The "ref:prefix" search expression was already supported by the search
box of the web UI, but as opposed to (all, I think) other search
expressions, it was not supported server-side. Which means, it had to be
converted to a search Constraint as the above, before being sent in the
query.

This change therefore fixes this inconsistency. In addition, but
relatedly, since the map aspect relies on expressing the zoom-level as a
locrect expression, it is much simpler if the search query it uses only
has to be constructed from search expressions, and without search
constraints. So if we want to be able to support marking a single node
search with the map aspect, while dealing only with search expressions,
this change is necessary.

Fixes #939

Change-Id: Ia58f410198ecd1f7e0981321da370d687df3a120
2017-08-17 01:23:55 +02:00
mpl 1bd8f09c44 server/camlistored/ui: use marker cluster in map aspect
Let the map aspect cluster markers by proximity, using the Marker
Clustering plugin for Leaflet.

Since we already do the work of spreading markers evenly server-side,
this plugin is a bit redundant.

However, it is still usefull as it allows us to request e.g. 1000 nodes,
and display a representation of all these nodes, without actually
displaying them all individually. This offers a work-around for the
bugs/glitches described in
https://github.com/camlistore/camlistore/issues/937

Even better, it allows us to re-enable the use of the awesome markers
that were introduced in e4b7db8274, but
that we had to disable because of the aforementioned glitches.

Also, added the 2x awesome marker images that the leaflet awesome markers
plugin uses for retina/mobile displays.

https://github.com/Leaflet/Leaflet.markercluster vendored in
vendor/embed/leaflet at version 1.0.6

Related: issue #947

Change-Id: I28c1184ad171af5eca953bb05f4a943d3573bfb4
2017-08-17 00:56:04 +02:00
mpl 7832801040 server/camlistored/ui: on zooming/panning on map aspect, do new search
This change makes zooming and panning on the map aspect send a new
"MapSort" search query, so that the (1000, by default) most relevant
results for the currently displayed area always appear as markers
after a zoom/pan.

This required completely "lifting up" (in React lingo) the currentSearch
state out of the Header class, and into the Index class, which should
have already been done in a56372830a. This
is necessary because we need the expression in the search box to be mutable
both by the user('s input) and by the map aspect, which represents the
zoom level as a trailing "locrect" predicate in the search expression.

Fixes #938

Change-Id: I0004c9ff09f03b4f1d95a35e54605689eebf0c1a
2017-08-16 21:39:46 +02:00
mpl a56372830a server/camlistored/ui: prepare for map aspect zoom level
This change adds the logic to:
1) once a map aspect is loaded, get the area that includes all the
displayed results (the "zoom level")
2) modify the current query search predicate so that it includes the
above zoom-level as a locrect predicate
3) propagate that predicate change to the predicate that is displayed in
the search box, through the newly introduced currentSearch parameter
(a state parameter of the Index instance).

Change-Id: I955e6195ba71b2000c68c28278a534cec87f5311
2017-08-03 17:38:16 +02:00
mpl 49b97b2244 server/camlistored/ui: use search.MapSort in map aspect
Also make use of the new "locrect" search predicate, which allows us to
drop support for raw query with coordinates.

Also revert for now to using the native leaflet markers instead of the
AwesomeMarkers icons, as something in their style seems to be interfering
badly with the UI.

Fixes #934

Change-Id: Idd85eeb42673c43a216bce81c26a6bff5ad0c08a
2017-08-01 02:04:32 +02:00
Tilman Dilo 92b866d819 server/camlistored: listen for SIGTERM
Systemd by default sends SIGTERM to child processes when shutting down
or restarting a service, which is not handled by camlistored and results
in a hard kill.

This change makes camlistored listen for SIGTERM next to SIGINT to allow
graceful shutdowns. The log message for SIGHUP is adjusted for
consistency.

Change-Id: Ia9be84b0b2284343e1776042fdfc99363110bfb1
2017-07-11 00:07:06 +02:00
mpl e4b7db8274 server/camlistored/ui: improve map aspect search and markers
Notably:

-do not load any markers on an empty search query, because that would
mean loading absolutely all of the items with a location, which seems
like a bad idea.

-use different markers for different nodes. For now, foursquare
checkins, file images, and files have their own marker.

-vendor in https://github.com/lvoogdt/Leaflet.awesome-markers to achieve
the above, which relies on Font Awesome, which we already have in.
icons available for the markers: http://fontawesome.io/icons/

-when no location can be inferred from the search query, set the view to
encompass all markers that were drawn.

-when a location search is known, draw a rectangle representing the
results zone.

-use thumber for image in marker popup

-use title, if possible, instead of blobRef for link text in marker
popup

-switch to directly using OpenStreetMap tiles, instead of MapBox ones.

https://storage.googleapis.com/camlistore-screenshots/Screenshot_20170622-232359.png

Change-Id: Ibc84fa988aea8b8d3a2588ee8790adf6d9b5ad7a
2017-07-06 01:03:03 +02:00
Mathieu Lonjaret 2c5c524412 Merge "server/camlistored/ui: add map aspect" 2017-06-20 22:23:10 +00:00
mpl d2ced13e5e server/camlistored/ui: add map aspect
To display permanodes with a location on a map graphical interface (like
Google Maps, Open Street Map, etc).

Screenshots:
https://storage.googleapis.com/camlistore-screenshots/Screenshot_20170620-230922.png
https://storage.googleapis.com/camlistore-screenshots/Screenshot_20170620-231221.png
https://storage.googleapis.com/camlistore-screenshots/Screenshot_20170620-235006.png

Lots more features possible, but I think this is a good point to add it
as an mvp. TODOs in the code.

Using leaflet.js version 1.0.3, and tiles from mapbox.com (Open Street
Map).

Change-Id: Ib31610c122de633c5268174928c22c1cc481f388
2017-06-21 00:21:02 +02:00
mpl 04afc9ae8a pkg/server: add recovery option on web UI and instance page
When the blobpacked index gets corrupted/destroyed, it needs to be
rebuilt and hence camlistored refuses to start without the -recovery
flag being set if it detects it is needed.

This is a problem on GCE, because camlistored is handled by systemd, and
so the only way to restart camlistored with -recovery is to edit the
systemd service, then issue 'systemctl daemon-reload', and 'systemctl
restart camlistored'. Then revert the change for the next time
camlistored restarts. This is not user-friendly.

This change adds a check on camlistored startup based on the presence
and value (as a boolean) of the "camlistore-recovery" key as an instance
attribute. Therefore, the user only has to add the
("camlistore-recovery", "true") attribute in the Custom metadata of
their Google Cloud instance page to switch to recovery mode. (And
restart the instance).

As an additional feature (for non-GCE users), this change also adds the
option to restart the server in recovery mode from the status page of
the web UI.

Change-Id: I44f5ca293ddd0a0033fc5d9c2edca1bac0ee9c8f
2017-06-07 23:00:50 +02:00
mpl 8fa2ec5a06 camlistored/ui: refresh blob and permanode aspects state on navigation
Fixes #922

Change-Id: I02c3c01947f7ab29681fb96e69e6b1f17fa7b067
2017-04-28 19:35:22 +02:00
mpl 86679899f5 camlistored/ui: fix share URL dialog for all pages
The code to find the prefix URL that is used to display the share URL on
after successfully sharing an item, worked only on the main web UI page.
This change makes it work on hopefully any page.

Change-Id: I05e085f91ef7ebe39f880104e52ca487b80c607a
2017-04-27 19:12:10 +02:00
mpl dace68256b camlistored/ui: connect temp form to DOM before submitting
The download action of the web UI uses an ephemeral form, that we do not
connect to the DOM, behind the scenes. However, according to
https://html.spec.whatwg.org/multipage/forms.html#form-submission-algorithm,
step 2., a form must be connected to the DOM in order for it to be
submitted.

This change connects the form right before submitting, and removes it
from the DOM right after submission.

Fixes #921

Change-Id: I4d993c633c60a369ce4260f84731a64e8b955c76
2017-04-26 17:59:29 +02:00
Mathieu Lonjaret 9095ea9a00 Merge "server/camlistored/ui: enable multi-items sharing" 2017-04-17 15:55:39 +00:00
mpl 9e34d14ef5 pkg/serverinit: enable sharing on GCE by default
The default server config on GCE (as deployed by the launcher) did not
have a share handler. This CL adds one, so that users can benefit from
the new sharing feature from the web UI.

Also, the button for sharing from the web UI does not appear anymore if
the config that the web UI gets from the discovery does not have a
"shareRoot", because it's a strong hint that the server does not have a
share handler.

Change-Id: I6c444995339fda8dba864b1d6729fb7c1b6d72bd
2017-04-05 16:17:46 +02:00
mpl 0e55a06f5c server/camlistored/ui: enable multi-items sharing
Sharing through the web UI was limited to a selection of one (permanode)
file or directory.

This change enables sharing of all the selected items, as long as they
are (permanodes of) files or directories, by creating a new directory
blob containing the selected items. The new directory is the item
getting shared. For clarity, and hopefully helping with search later,
the new directory is named "shared-YYYYMMDDhhmmss".

Change-Id: Iabd2266c9af85f3e8fbfa56ce98f653c0ce0f1ee
2017-03-31 01:22:52 +02:00
mpl 77dfe8046d server/camlistored/ui: add "Share" feature
To share a file or directory through Camlistore's sharing
mechanism (https://camlistore.org/doc/sharing).

Only single-item sharing supported for now.

On success, the share URL is displayed in a dialog.
If the item is a file, it can be fetched with any HTTP client through
that URL. If the item is a dir, the share URL is of the claim, so one
must follow the transitive chain of sharing to get the directory's
children, i.e. use camget -shared.

Fixes #880

Change-Id: I324a684dec10225e5b8314dda7f1b77a0de6f727
2017-03-23 00:44:18 +01:00
mpl 71090f7c80 pkg/server: add files "zipper" to DownloadHandler
We want to add a feature for clients (the web UI), where they can select
a bunch of files and ask the server for a zip archive of all these files.

This CL modifies the DownloadHandler so it does exactly that upon
reception of a POST request with a query parameter of the form
files=sha1-foo,sha1-bar,sha1-baz

This CL also adds a new button to the contextual sidebar of the web UI,
that takes care of sending the download request to the server.

known limitations: only permanodes with file as camliContent are
accepted as a valid selection (i.e. no sets, or static-dirs, etc) for
now.

Implementation detail:
We're creating an ephemeral DOM form on the fly to send the request.
The reason is: if we sent it as a Go http request, we'd have to read
the response manually and then we'd have no way of writing it to disk.
If we did it with an xhr, we could write the response to disk by
creating a File or Blob and then using URL.createObjectURL(), but we'd
have to keep the response in memory while doing so, which is
unacceptable for large enough archives.

Fixes #899

Change-Id: I104f7c5bd10ab3369e28d33752380dd12b5b3e6b
2017-03-17 00:59:19 +01:00
mpl ceb5ea5b10 web UI: add "About" menu entry and dialog
This change adds an "About" entry to the header menu, that pops up an
"About" dialog when clicked on.

But, under this innocent sounding feature is actually a more important
change: this feature is partly added through the use of gopherjs
generated code. In addition, the element added (a menu item) is
integrated
seamlessly into the menu as a React element, thanks to the use of
github.com/myitcv/gopherjs/react.

pkg/env had to be broken with build tags, because importing
"cloud.google.com/go/compute/metadata" (or one of its deps) seems to be
breaking the generated javascript.
https://github.com/camlistore/camlistore/issues/904

github.com/myitcv/gopherjs/react at rev
c04b811da4a086defd882a94cc1901da2d2158b0

honnef.co/go/js/dom at rev 24aa052bc5c63cfb9383bf59493ee48621ca788c

Issue #904
Fixes #798

Change-Id: Ic09b94014d520277f8178727293787ece468babd
2017-03-07 00:24:07 +01:00
Mathieu Lonjaret a3d7e6183b Merge "camlistored/ui: remove deprecated getDOMNode calls" 2017-02-14 22:48:34 +00:00
mpl f4fc8921cd camlistored/ui: remove deprecated getDOMNode calls
getDOMNode is deprecated:
https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#dom-node-refs

Also fix a couple of component instanciations that still didn't use React.createElement.

Change-Id: Ic15d353be3815796d0aa6a3591c215056805a5bf
2017-02-13 18:12:49 +01:00
Steve Armstrong b2fb893b48 ui: Fix js error on all search queries
React would bail out with:

    Uncaught TypeError: this.refs.searchbox.getDOMNode is not a function
      at Object.getSearchNode_ (http://localhost:3179/ui/header.js:321:33)

Change-Id: I26e3474ed08c9339eda2e78de87b458a4130c746
2017-02-12 22:47:53 -08:00
mpl 4d12c68989 camlistored: do not use syslog on windows
Change-Id: I351c45739c517c107a5f16fee4298af75086d81d
2017-02-08 02:16:21 +01:00
mpl 1e69b9f784 vendor: update cloud.google.com/go/logging to V2 API
In addition to API changes, the V2 logging API uses
google.golang.org/grpc, which does not rely directly on net/http. This
is a problem for us because, among other things, when needed (on
CoreOS), we insert the system Root CAs in the TLSConfig of the
default http client through httputil.InstallCerts, which has no effect
on google.golang.org/grpc calls. Therefore, we switch to
github.com/bradfitz/grpc-go instead, which does rely on net/http.

And since GRPC requires HTTP/2, we also now need to manually configure
the default transport (since we're already modifying it) to be HTTP/2
enabled.

Related dependencies updated/added:

updated:

cloud.google.com/go/logging
a64eb5d53f434cc548fd6b2898b5a3e8a0c31b78

github.com/golang/protobuf
8ee79997227bf9b34611aee7946ae64735e6fd93

added:

github.com/bradfitz/grpc-go
188a132adcfba339f1f2d5da52498451341f9ee8
as a replacement for google.golang.org/grpc

github.com/googleapis/gax-go
da06d194a00e19ce00d9011a13931c3f6f6887c7

google.golang.org/genproto/googleapis/logging
08f135d1a31b6ba454287638a3ce23a55adace6f

google.golang.org/genproto/googleapis/datastore
08f135d1a31b6ba454287638a3ce23a55adace6f

google.golang.org/api/support/bundler
e4c04685e5d7db47ff294aa9e514b3a638c431c9

google.golang.org/genproto/googleapis/rpc/status
08f135d1a31b6ba454287638a3ce23a55adace6f

Fixes #873

Change-Id: I3ba14c94122dd9f1b88ef61c2dc26430690d28a9
2017-02-06 19:59:24 +01:00
Filippo Valsorda 3fb504426a camlistored: add -syslog flag
Change-Id: I5ee14834d3083ed1e40dfbb3fc79fc5b5239caf2
2017-02-04 23:15:53 +00:00
Eric Drechsel 2b093f38c8 vendor: update react to 15.4.2
The main motivation is that we want to use gopherjs +
github.com/myitcv/gopherjs/react , which requires a recent react.

This CL also fully switches to only using minified js files.

The changes in server/camlistored/ui are the result of some react
API changes, such as:

 - wraps component instantiation in React.createElement
 - React.classSet -> classNames
 - Need tbody between table and tr in a couple places
 - component array elts need unique keys (longstanding warning)
 - change root elt from body to a child div (to fix warning)
 - don't check isMounted in container render function
 - fix a bunch of style keys using kebab-case instead of camelCase

Change-Id: Idc22d07704688ccde3e4f67d4f188a5ad32b6e32
2017-01-25 19:11:58 +01:00
mpl 7f59a27060 website: run on staging instance
Add the -staging flag to camweb so one can deploy on a staging
instance.
The instance name is then "camweb-staging" instead of "camweb", and its
hostname is "staging.camlistore.net", instead of "camlistore.org".

server/camnetdns: automatically and regularly discovers the IP of the
"camweb-staging" instance, so it can keep the record for
"staging.camlistore.net" up to date.

Change-Id: I7d64a774049ac01472666ee7e351fd6fb5e4c287
2017-01-24 15:34:37 +01:00
Mathieu Lonjaret f12b9fea60 Merge "pkg/deploy: no self-signed certs, name in camlistore.net" 2017-01-18 21:40:49 +00:00
Mathieu Lonjaret 8a17e7252b Merge "pkg/sorted/mysql: drop tables on reindex" 2017-01-18 18:14:06 +00:00
mpl af77128123 pkg/sorted/mysql: drop tables on reindex
When reindexing on a (My)SQL based sorted.KeyValue, we should recreate
the database schema from scratch, which means dropping the tables.

However, index.Reindex just calls Wipe on the newly created
sorted.KeyValue, which only deletes the rows, and does not drop the
tables.

Therefore, this CL changes the implementation of Wipe in the MySQL case,
so that it takes care of dropping the tables, and doing everything that
needs to be done afterwards to set up the sorted.KeyValue.

In addition, with the introduction of the sorted.NeedWipeError, we detect
upon initialization of a sorted.KeyValue if it failed because it needed
a schema update. If that is the case, and we're in reindex mode, we can
fix the sorted.KeyValue with a Wipe and carry on.

Finally, we introduce the new sorted.NewKeyValueMaybeWipe function that
automatically wipes a KeyValue when a NeedWipeError was returned upon
its creation.

Next, do the same with other sorted SQLs.

Fixes #806

Change-Id: I2032781cbf453a364880bd3e2e8b3c09aac7aed9
2017-01-16 19:10:05 +01:00
mpl 8813375592 pkg/deploy: no self-signed certs, name in camlistore.net
This CL changes the GCE launcher to work with the new features of
camlistored: i.e. that it can automatically get a hostname in
camlistore.net, and that it can get an HTTPS certificate from Let's
Encrypt, for said hostname.

In order for the user to easily (without having to look at the logs)
know what their hostname is, camlistored stores it as the
"camlistore-hostname" key in the custom metadata of the GCE instance.
The deployer can then query for that key, to report the hostname on the
instance creation success page.

Change-Id: Iaaef2d51f34fa5e1e0ee90097919abab7ee72a12
2017-01-13 16:47:04 +01:00
Mathieu Lonjaret d864e35802 Merge "server/camlistored: request a name in camlistore.net" 2017-01-13 14:50:31 +00:00
mpl 620388bd57 server/camlistored: request a name in camlistore.net
In order to use HTTPS, one must have a certificate, and one must have a
domain name for which the certificate is valid.
The first part is solved by the use of Let's Encrypt. For the second
part, we want to provide to any Camlistore instance a name such as
<gpgKeyId>.camlistore.net, where gpgKeyId is the fingerprint of its GPG
key. The DNS for camlistore.net agrees to add a record for that name if
and only if the Camlistore instance can prove it owns the GPG key, as
well as the IP address bound to that name in the DNS record.

A protocol such as the above is already implemented in pkg/gpgchallenge.

This CL:
- uses the client-side of the gpgchallenge protocol in camlistored, so
that it can claim a hostname in camlistore.net on startup (and then use
that hostname when requesting a certificate from Let's Encrypt).
- adds the configuration parameter "CamliNetIP" for the high-level
config. This parameter specifies the IP address that camlistored will
supply during the gpgpchallenge, so it can  prove to the DNS server that
we own this address.

Fixes #722

Change-Id: I6bf4ec149b6dffd0ae93a6fa7bf208b2e8a05445
2017-01-13 00:43:24 +01:00