Commit Graph

297 Commits

Author SHA1 Message Date
Mykola Orliuk
8991419c68 ;all: drop dummy decodeRawOpts 2019-11-18 17:38:39 -08:00
Alejandro García Montoro
4efd0242da web: Modify the --cors option to require a specific origin
- Modified the cors option to require a String
- Moved the logic to build the cors policy to WebOptions.hs
- Specify the --cors "*" example in the cors option help
- Added utf8-string dependency to convert a String into a ByteString
2019-10-07 14:54:18 -10:00
Alejandro García Montoro
e96dfe832f web: Allow CORS to be enabled in hledger-web
Add a --cors option to the CLI to enable simple cross-origin requests
2019-10-07 14:54:18 -10:00
Simon Michael
4db14ef70f ;api: another round of hledger-api purging; fix the build 2019-09-11 14:49:22 -07:00
Simon Michael
e70c7123b7 web: ?sidebar= hides the sidebar, like ?sidebar=0 2019-08-17 17:17:30 +01:00
Simon Michael
ef1bd24edc web: don't disable /add PUT with --serve-api, that's considered API 2019-08-17 17:17:30 +01:00
Simon Michael
a154ea72c0 web: with --serve-api, also disable the header/sidebar HTML 2019-08-17 17:17:30 +01:00
Simon Michael
c3da82043b web: --serve-api disables server-side UI; startup logging cleanups 2019-08-16 23:55:56 -07:00
Caleb Maclennan
11d9e5eb6a code: Strip extraneous trailing whitespace from Haskell sources 2019-07-15 16:40:49 +01:00
Simon Michael
6a62bd6437 web, api: update for MarketPrice/PriceDirective change 2019-06-13 15:50:01 -07:00
Simon Michael
adb6ee40eb lib: clarify price types (#131)
dropped journalPrices

renamed Price to AmountPrice,  AKA "transaction price"

renamed MarketPrice to PriceDirective.

added new MarketPrice (more pure form of PriceDirective without the amount style information)

Prices is now a more efficient data structure, but not used yet.
2019-06-13 15:50:01 -07:00
Henning Thielemann
1fa4419cd1 web: register page: clip linked accounts to 40 characters
This was the behaviour before adding the links.
2019-06-13 10:12:44 -07:00
Henning Thielemann
adbdbf002c web: avoid spaces before commas in register account links 2019-06-13 10:12:44 -07:00
Henning Thielemann
ac96bcfdf0 web: add links to accounts in register transactions 2019-06-13 10:12:44 -07:00
Simon Michael
faf85d91e3 cli: restore --aux-date and --effective as --date2 aliases (#1034)
These Ledger-ish spellings were dropped over the years, to improve
--help's layout. Now they work again, but are considered hidden flags
so --help doesn't show them automatically (but I decided to mention
them manually in --date2's description).
2019-06-02 08:48:41 -07:00
Simon Michael
7ef3ddd1e6 web: fix build breakage 2019-05-23 22:25:28 -07:00
Simon Michael
20bc386b80 restore TransactionsReport
hledger-web's register chart uses it, I didn't see it
because it's called from a hamlet template.
2019-05-23 22:15:40 -07:00
Simon Michael
54c1529638 lib: drop TransactionsReport, BalanceHistoryReport
They seem unused.
2019-05-23 21:55:19 -07:00
Simon Michael
7c14e10858 web: /accounts: return all accounts, not just top-level ones (#985)
Accounts are returned as a flat list, in tree order, with asubs fields
empty.
2019-03-09 15:47:06 -08:00
Simon Michael
92fb24b1af web: note some Account JSON issues (#985)
[ci skip]
2019-03-09 15:28:30 -08:00
Simon Michael
16157bc711 lib, web: tweaks to keep building with GHC 7 2019-03-01 15:07:17 -08:00
Jakub Zárybnický
6becbc78f3 cli, web, ui: Replace withJournalDo* variants 2019-03-01 05:42:30 -08:00
Simon Michael
8cf39e55e0 web: more Decimal FromJSON notes
[ci skip]
2019-02-21 17:13:47 -08:00
Simon Michael
115643a024 web: silence one more pesky warning 2019-02-20 20:45:09 -08:00
Simon Michael
0bc16d4af6 lib, cli, web: rename porigin -> poriginal 2019-02-20 20:23:54 -08:00
Simon Michael
2dc716cdb4 web: support adding new transactions via JSON PUT (#316)
A single transaction can be added by PUT to /add.
(I read that PUT, not POST, should be used to create;
perhaps the web add form should also use PUT ?)

As with the web form, the `add` capability is required (and enabled by
default).

Here's how to test with curl:

$ curl -s http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @in.json; echo

New readJsonFile/writeJsonFile helpers in Hledger.Web.Json
are handy for generating test data. Eg:

>>> writeJsonFile "in.json" (head $ jtxns samplejournal)
2019-02-20 20:23:51 -08:00
Simon Michael
b46212ae50 web: better ToJSON instances, new FromJSON instances, utilities (#316) 2019-02-20 20:23:45 -08:00
Jakub Zárybnický
861baadb2b web: Re-add 'balanced transaction' validation to add form 2019-02-20 14:57:04 -08:00
Simon Michael
7e0b74d431 web: fix warnings 2019-02-19 07:29:08 -08:00
Simon Michael
afd7931ca0 web: add the same 6 JSON routes as in hledger-api (#316) 2019-02-18 23:57:58 -08:00
Simon Michael
34c43489f8 web: document --capabilities/--capabilities-header, editing
[ci skip]
2019-02-18 14:40:14 -08:00
Simon Michael
10b45c75aa web: fix tooltips showing transactions (fixes #927) 2019-02-18 07:55:29 -08:00
Alex Chen
3d2584d869 lib: switch to megaparsec 7 2018-09-30 20:15:12 -06:00
Simon Michael
0f83fb91c1 ui, web: fix build after tests cleanup 2018-09-03 08:43:57 -07:00
Simon Michael
cd67f8ea68 tests: clear out old boilerplate 2018-08-31 18:12:17 -07:00
Simon Michael
d778a92561 tests: export HUnit/EasyTest from Hledger.Utils.Test; more helpers 2018-08-18 15:19:59 +01:00
Simon Michael
1e0a7ec8f1 remove some unneeded CPP pragmas 2018-08-02 08:25:49 +01:00
Jakub Zárybnický
466558968b web: Fix compilation errors for all 'stack.yaml's 2018-06-25 12:00:18 +02:00
Jakub Zárybnický
8d1ee38627 web: Add missing capability guards to /manage and /download 2018-06-24 23:17:56 +02:00
Jakub Zárybnický
483283ec43 web: Add capabilities guards and conditional widget rendering 2018-06-24 16:25:22 +02:00
Jakub Zárybnický
e8668e2a5c web: Conform layout to the rest of hledger-* packages 2018-06-24 14:18:06 +02:00
Jakub Zárybnický
9beec88727 web: Move sources to src/ subdirectory 2018-06-24 14:13:04 +02:00
Jakub Zárybnický
50e97e05fd web: Clean up imports 2018-06-24 14:13:03 +02:00
Simon Michael
6a96683691 web: make --auto and multiple -f options work again
I think we lost one or both of these at the time of ecf49b1e.
2018-06-20 00:26:37 -07:00
Simon Michael
061aad0431 remove some CPP that's obsolete since we require base 4.8+ 2018-06-04 17:33:21 -07:00
Dmitry Astapov
d82370d10b lib, app, web: remove differences between command line and journal file aliases 2018-04-17 16:09:11 -07:00
Dmitry Astapov
f6ec26e321 lib, app, web, ui: rename readJournalFile[s]WithOpts to readJournalFile, same for tryReader[s]WithOpts 2018-04-17 15:25:02 -07:00
Dmitry Astapov
37607beaea lib, app, web: use readJournalFileWithOpts instead of readJournalFile whenever possible 2018-04-17 14:33:32 -07:00
Dmitry Astapov
ecf49b1e4b lib: auto postings generated before amount inference and balance checks (#729) 2018-04-17 14:33:32 -07:00
Simon Michael
f8e781462d ui, web: use/support new -V, --forecast, --auto 2017-12-29 16:53:37 -08:00
Simon Michael
e5f794d2cb cli,ui,web: a @FILE argument reads flags & args from FILE, one per line 2017-09-30 06:49:31 -10:00
Simon Michael
fead7c5138 cli, ui, web: make -NUM a shortcut for --depth NUM 2017-09-22 16:14:30 -10:00
Jakub Zárybnický
13a6584440 ui, web: Enable --pivot and --anon in ui and web (#474) 2017-09-04 20:45:31 -07:00
Simon Michael
7e896572a7 make --help and -h the same, drop --man and --info for now (#579) 2017-07-07 02:08:34 +01:00
Simon Michael
b402fc7e7d lib: optserror -> usageError, consolidate with other error functions (#529) 2017-03-29 08:00:51 -07:00
Simon Michael
1bcc091a44 web: add --host, rename --server to --serve (#429)
This came up in the context of Docker, but it seems it wasn't possible
for hledger-web to serve remote clients directly (without a proxy)
because of 127.0.0.1 being hardcoded ? Now that can be
changed with --host=IPADDR. The default base url also
uses this address, rather than "localhost" being hardcoded.

Also, the --server flag sounded too close in meaning to --host so
I've renamed it to --serve. The old spelling is still accepted,
at least through the next major release I suppose.
2016-11-21 07:38:58 -08:00
Simon Michael
b7071dee84 lib: use Data.Default directly, not via cmdargs 2016-07-29 10:15:48 -07:00
Simon Michael
739c8dc4cc web: preserve initial query when journal changes (#314)
The initial query specified by command line arguments is now preserved
when the journal is reloaded. This does not appear in the web UI, it's
like an invisible extra filter.
2016-04-28 21:48:30 -07:00
Simon Michael
df1040014e web: exit if an instance is already running (#226)
Also
- pause for 0.1s before opening the browser, to ensure the app is ready
- don't open a browser if the app fails to start
- terminate the server thread more carefully on exit, may resolve some
  lingering background thread issues eg on windows
2016-04-22 11:21:33 -07:00
Simon Michael
42c12fe631 cli, ui, web, api: --info, --man, info & man cmds 2016-04-19 19:21:29 -07:00
Simon Michael
f9362707b6 ui, web, api: fix -h, --help 2016-04-18 16:43:51 -07:00
Simon Michael
b4a72da355 web: fix stack ghci duplicate main error 2016-04-18 15:26:54 -07:00
Simon Michael
6fb76d979f web: fix typo in "-f -" warning 2016-01-25 09:07:37 -08:00
Simon Michael
09430f09da web: fix --file-url option (#285)
Finish the rename begun by 3fb5e25.
2015-09-28 10:06:36 -10:00
Simon Michael
2c3f1b672e web: disallow -f- which doesn't work (fixes #202)
hledger-web -f- gives

[Error#yesod-core] <stdin>: hGetContents: illegal operation (handle is closed)

and I can't see why. Just disallow it.
2015-09-27 08:17:12 -10:00
Simon Michael
3fa3926ee9 web: clarify which libs we are calling to start up 2015-09-27 08:16:30 -10:00
Simon Michael
74512814ec cli/ui/web: rename X.Options modules to X.XOptions
Make these modules' names more like the heavily-used types they
define (CliOpts, UIOpts, WebOpts). This is consistent with
RawOptions and ReportOptions, and helps with code navigation.
2015-08-28 12:43:51 -07:00
Simon Michael
f3dd5eb830 fix options breakage with GHC < 7.10 2015-08-28 11:17:49 -07:00
Simon Michael
2af8d7598e cli, web: fix options breakage 2015-08-28 10:49:43 -07:00
Simon Michael
0de0f6ab01 group related imports 2015-06-04 09:45:43 -07:00
Simon Michael
bb8918a709 web: fix build breakage from #165 (fixes #268) 2015-06-04 09:44:58 -07:00
Simon Michael
83209b862c tools: fix overuse of -XCPP breaking make test etc. 2015-04-07 19:28:57 -07:00
Simon Michael
ebba1b09f2 web: fix more ghc 7.10 import warnings (#239) 2015-04-07 18:49:33 -07:00
Simon Michael
b0d71e3ccc web: declare a bunch of language pragmas
Makes the code more declarative, and makes building without cabal easier.
2015-04-07 18:35:41 -07:00
gwern
d1618aaca8 strip trailing whitespace from all Haskell files 2014-10-14 18:48:24 -07:00
Simon Michael
f30deee197 web: fix compilation after recent lib changes 2014-07-03 09:37:02 -07:00
Simon Michael
702f900ec0 web: fix warnings 2014-05-23 09:02:20 -07:00
Ryan Desfosses
b60da51386 made the following changes to resolve deprecated warnings:
replaced hamletToRepHtml with giveUrlRenderer
  updated type RepHtml to Html
  replaced settingsPort with setPort
2014-05-21 07:30:54 -04:00
Simon Michael
e6a1339370 cli: options help polish 2014-05-01 07:22:44 -07:00
Simon Michael
3fb5e25fd4 web: rename --static-root to --file-url 2014-04-30 08:48:23 -07:00
Simon Michael
a9c83f0ce1 web: add Peter Simons' patch fixing Data.Conduit.Network HostIPv4 error (#171)
(cherry picked from commit 993cae3a74)

Conflicts:
	hledger-web/Hledger/Web/Main.hs
2014-04-17 12:35:42 -07:00
Xinruo Sun
0275485bf9 web: add a --static-root option to customize static files root 2013-12-15 12:20:07 +08:00
Simon Michael
02fea186a3 web: fix debug option breakage in Main 2013-12-08 19:48:51 -08:00
Simon Michael
a66a715eeb command line options API updates, possibly fixing hledger-web build 2013-09-22 22:31:06 -07:00
Simon Michael
080eb866ec web: clean up language extensions a bit, make autoweb works again 2013-06-04 18:23:55 -07:00
Simon Michael
c744451dfa web: loosen "starting web browser" message for servers 2013-06-01 11:40:00 -07:00
Simon Michael
8873ffbe77 web: fix auto-exit in local mode, clarify startup messages 2013-05-01 12:02:47 -07:00
Simon Michael
c9b6dd8819 web: --server flag re-enables long-running, request-logging mode; output cleanups 2013-05-01 07:23:59 -07:00
Simon Michael
0a47715b17 web: also launch a browser at startup; auto-terminate after 2m or on enter
We're now using the wai-handler-launch middleware. This injects a
script in each page that pings the server repeatedly, and terminates
the server if it gets no pings (ie there are no browser tabs
displaying the app) for two minutes. The server can also be easily
terminated at the console by pressing enter, yesod devel style.
2013-04-20 20:02:50 -07:00
Simon Michael
0a77eba02e web: try using wai-launch-handler.. not working yet 2013-04-20 10:03:15 -07:00
Simon Michael
d5e575c862 web: remove io-storage 2013-04-09 12:53:21 -07:00
Simon Michael
0df4a235af web: set up journal for yesod devel, store it in App (fixes #101)
The web app's journal state is now kept in the yesod App as an IORef,
instead of using io-storage.
yesod devel now works; it uses the journal file specified by
$LEDGER_FILE, or ~/.hledger.journal.

web: update journal state handling, fix yesod devel - WIP
2013-04-09 12:41:22 -07:00
Simon Michael
3d33673b25 web: obey command-line query options at startup again 2012-11-15 17:53:10 +00:00
Simon Michael
cfbd8bb956 web: update for yesod 1.1.3
Build with latest yesod. Also reorganise to conform more closely with
yesod's standard scaffold layout to reduce upgrade effort.
2012-11-15 17:48:48 +00:00
Simon Michael
f441bbd946 web: add missing CPP pragma 2012-10-13 14:57:42 +00:00
Simon Michael
00f22819ae balance report speedup
This refactoring fixes an O(n^2) slowdown in the balance command with
large numbers of accounts. It's now speedy, and the implementation is
clearer. To facilitate this, the Account type now represents a tree of
accounts which can easily be traversed up or down (and/or flattened
into a list).

Benchmark on a 2010 macbook:

    +-------------------------------------------++--------------+------------+--------+
    |                                           || before:      | after:     |        |
    |                                           || hledger-0.18 | hledgeropt | ledger |
    +===========================================++==============+============+========+
    | -f data/100x100x10.journal     balance    ||         0.21 |       0.07 |   0.09 |
    | -f data/1000x1000x10.journal   balance    ||        10.13 |       0.47 |   0.62 |
    | -f data/1000x10000x10.journal  balance    ||        40.67 |       0.67 |   1.01 |
    | -f data/10000x1000x10.journal  balance    ||        15.01 |       3.22 |   2.36 |
    | -f data/10000x1000x10.journal  balance aa ||         4.77 |       4.40 |   2.33 |
    +-------------------------------------------++--------------+------------+--------+
2012-10-21 17:18:18 +00:00
Simon Michael
f03b020e2f set version with CPP instead of cabal-file-th; make building more robust
hledger and hledger-web were reading their version number (and program
name) from their cabal files at compile time using cabal-file-th,
which allowed the version number be maintained in one place (per
package).

This meant you had to be in same directory as the cabal file when
building, which made life more complicated, eg emacs compilation mode
could not jump to errors. Also, it slowed down building slightly, and
is a factor in hledger Debian packages being unavailable on a number
of platforms (we also use TH for report templates).

Now, the build version is set with a CPP VERSION flag, which seems
simpler overall. For cabal builds, this needs to be configured
manually in a few more places in each cabal file. For makefile builds,
it is set it to the name of the most recent darcs tag (which should be
more useful than the old behaviour). If not set, it defaults to the
blank string, useful eg for haddock. And, all makefile builds now run
from the top directory.
2012-10-13 19:21:17 +00:00
Simon Michael
155cb0eafe web: fix compilation error with -fblaze_html_0_5 flag 2012-07-08 00:18:39 +00:00
Simon Michael
4b11890e02 web: fix a build error 2012-03-07 16:42:35 +00:00
Simon Michael
28d86aca53 web: fix excess angle bracket in add form 2012-04-01 21:07:01 +00:00
Simon Michael
25b514b721 web: fix js error breaking second use of add form (#72) 2012-04-01 21:08:30 +00:00
Simon Michael
bb131f1b8c web: add closing angle brackets which yesod 1.0 requires 2012-04-01 20:30:44 +00:00
Simon Michael
296a4d1bb2 web: better hamlet override 2012-04-03 17:53:12 +00:00
Simon Michael
64b6316785 web: revert unintended hunk in Settings.hs 2012-04-03 17:43:49 +00:00
Simon Michael
acc5139c54 tools: makefile updates 2012-04-03 17:12:47 +00:00
Simon Michael
f298aac874 web: fix account balance rendering 2012-05-29 03:18:24 +00:00
Simon Michael
f35b961c86 web: update for yesod 1.0 2012-05-29 02:53:33 +00:00
Simon Michael
98274b481d more build warnings 2012-05-06 20:44:23 +00:00
Simon Michael
88f69e12e2 fix Dates exports for hledger-web 2012-04-16 17:09:27 +00:00
Simon Michael
93dd7bd064 web: simplify ifdef 2012-05-29 16:43:13 +00:00
Simon Michael
b4514cc37d web: don't munge static file names in dev mode 2012-05-29 03:09:43 +00:00
Simon Michael
f6f615196f web: define our own hamlet so it can be tweaked for debugging 2012-04-01 20:49:36 +00:00
Simon Michael
cfa59cc4f8 web: Hledger.Web api cleanup, haddocks 2012-04-01 20:29:10 +00:00
Simon Michael
2912a11929 web: officially drop GHC 6.12 support, fix build warnings with 7.0, 7.2, 7.4 2012-03-29 23:24:48 +00:00
Simon Michael
7f3b990394 docs: fix api docs 2012-03-07 16:05:04 +00:00
Simon Michael
5b749ab8a2 web: work around static file problem by skipping etag parameter 2012-05-29 16:45:24 +00:00
Simon Michael
88212f26e8 simplify journal parser names 2012-05-09 15:34:05 +00:00
Simon Michael
e1b1b8bce8 rename Matcher to Query, simplify constructors 2012-05-16 07:12:49 +00:00
Simon Michael
0c73d91f94 web: fix static file embedding in non-dev builds 2012-03-09 18:52:31 +00:00
Simon Michael
a27eb7c29f more matcher -> query renaming 2012-05-16 07:37:24 +00:00
Simon Michael
c27707f578 web: bump version, upgrade to yesod 0.10 2012-03-05 07:52:36 +00:00
Simon Michael
6eb7ad28e1 refactor/beef up readJournal/readJournalFile 2012-03-23 16:21:41 +00:00
Simon Michael
48460b0130 fix missing chart regression (#72) 2012-01-03 13:00:28 +00:00
Simon Michael
03359b48d3 web: prevent flot js error which broke add form fields after adding a transaction (#72) 2012-01-03 12:14:22 +00:00
Simon Michael
7f60e3504c web: fix $ quoting 2012-01-03 10:46:39 +00:00
Simon Michael
fd22dde57b web: needed to escape literal dollar signs in hamlet templates 2012-01-02 13:19:12 +00:00
Simon Michael
015dacb0d7 web: add form should reject blank account names (#81) 2012-01-04 11:35:39 +00:00
Simon Michael
0bd7fffaf7 web: dodge a yesod-core regression breaking add form redirect (#53) 2012-01-12 15:44:32 +00:00
Simon Michael
1b834afb20 web: avoid problematic redirect after submitting the add form 2012-01-03 12:43:30 +00:00
Simon Michael
c686645fab refactor: update version number handling 2012-01-31 06:01:31 +00:00
Simon Michael
9040821e8d web: fix ghc 6.12 incompatibility in Settings.hs 2011-10-26 17:30:17 +00:00
Simon Michael
db7f4d1b3d use cabal-file-th to get executable name and version from cabal files 2011-10-19 19:53:42 +00:00
Simon Michael
959d8a4591 web: clean up name clash with Yesod.Core 2011-10-19 19:57:12 +00:00
Simon Michael
9347f3169d bump hledger-web version 2011-10-05 00:49:06 +00:00
Simon Michael
bcc616823d bump just hledger-web version 2011-10-05 00:28:18 +00:00
Simon Michael
5c07a465da web: simplify static path definitions 2011-10-04 22:44:39 +00:00
Simon Michael
7f91a97d19 fix yesod haddock breakage 2011-09-14 02:42:18 +00:00
Simon Michael
187a7a1cc7 web: obey at least some command-line options, like --cost
Report filtering options like --period, and filter pattern arguments, are still ignored.
2011-09-14 19:53:05 +00:00
Simon Michael
4ca655b6a0 web: follow yesod file naming more closely 2011-09-12 23:37:55 +00:00
Simon Michael
4c52dd5b76 web: production build now has all web content embedded, dev build uses ./static (#63) 2011-09-12 23:30:29 +00:00
Simon Michael
c7c67efc1c web: adjust --help to indicate command-line arguments are not expected
Arguments are still accepted and ignored, since I can't see how to disallow them with cmdargs
2011-09-14 22:53:29 +00:00
Simon Michael
f6e15a2a80 fix warning 2011-09-19 03:25:19 +00:00
Simon Michael
fda4085e80 clarification 2011-09-20 15:23:08 +00:00
Simon Michael
15c39ac6c9 web: prevent an infinite redirect when custom base url has a trailing slash 2011-09-20 15:23:55 +00:00
Simon Michael
85b2307e78 web: modify the default base url when a custom port is specified 2011-09-19 03:25:12 +00:00
Simon Michael
2b5bd268b9 web: hide old title and search form when adding/editing 2011-09-21 22:42:06 +00:00
Simon Michael
0311595d3b web: editform title 2011-09-21 22:42:15 +00:00
Simon Michael
7bc67a7f00 web: update for yesod 0.9 2011-09-12 18:41:43 +00:00
Simon Michael
6f0f1acf7e fix hledger-web build error 2011-09-27 16:29:43 +00:00
Simon Michael
9b2a5f56e1 only the add and web commands auto-create the journal file 2011-09-23 03:53:14 +00:00