Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
dvcrn committed Sep 30, 2024
0 parents commit 206af10
Show file tree
Hide file tree
Showing 8 changed files with 773 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/luarocks
/lua
/lua_modules
/.luarocks
/dist
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist/out.lua: src/Main.hx src/JsonHelper.hx src/RequestHelper.hx src/Storage.hx src/Moneytree.hx
mkdir -p dist
cd src/ && haxe --lua ../dist/out.lua --main Main -D lua-vanilla -D lua-return
cp dist/out.lua /Users/david/Library/Containers/com.moneymoney-app.retail/Data/Library/Application\ Support/MoneyMoney/Extensions/moneytree.lua

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Moneytree extension for MoneyMoney

Adds support for accounts linked to https://getmoneytree.com/jp/home to MoneyMoney

## Authentication + Setup

You'll need the moneytree API key. Find it in dev tools when using the moneytree web version. Enter this key in `Moneytree.hx` at the very top, then do a `make` to build the .lua extension.

Login with your normal username + password

## License

MIT, commercial used excluded
29 changes: 29 additions & 0 deletions src/JsonHelper.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class JsonHelper {
public static function parse(jsonString:String):Dynamic {
#if lua
// Use MoneyMoney's JSON object if available
if (untyped __lua__("JSON")) {
return untyped __lua__("JSON(jsonString):dictionary()");
} else {
// Fallback to haxe.Json if JSON is not available
return haxe.Json.parse(jsonString);
}
#else
return haxe.Json.parse(jsonString);
#end
}

public static function stringify(data:Dynamic, ?args:Dynamic):String {
#if lua
// Use MoneyMoney's JSON object if available
if (untyped __lua__("JSON")) {
return untyped __lua__("JSON():set(data):json()");
} else {
// Fallback to haxe.Json if JSON is not available
return haxe.Json.stringify(data, args);
}
#else
return haxe.Json.stringify(data, args);
#end
}
}
Loading

0 comments on commit 206af10

Please sign in to comment.