Showing preview only (548K chars total). Download the full file or copy to clipboard to get everything.
Repository: jeka-kiselyov/dimeshift
Branch: master
Commit: 440898e8e48b
Files: 202
Total size: 489.5 KB
Directory structure:
gitextract__uiwwo29/
├── .bowerrc
├── .gitignore
├── .rebooted
├── Gruntfile.js
├── LICENSE
├── Procfile
├── README.md
├── app.json
├── bower.json
├── config/
│ ├── config.json
│ ├── currencies.json
│ ├── pages.json
│ └── resources.json
├── data/
│ ├── cache/
│ │ └── .gitignore
│ ├── i18n/
│ │ ├── en.json
│ │ ├── ptbr.json
│ │ ├── ru.json
│ │ └── ua.json
│ ├── mailtemplates/
│ │ ├── registration.template
│ │ ├── remove_account.template
│ │ └── restore_password.template
│ └── min/
│ └── .gitignore
├── docs/
│ └── api.md
├── includes/
│ ├── api.js
│ ├── config.js
│ ├── demo.js
│ ├── errors.js
│ ├── exchange.js
│ ├── mailer.js
│ ├── models/
│ │ ├── authentication.js
│ │ ├── index.js
│ │ ├── plan.js
│ │ ├── transaction.js
│ │ ├── user.js
│ │ ├── wallet.js
│ │ └── wallet_access.js
│ ├── routes/
│ │ ├── exchange/
│ │ │ ├── exchange.apib
│ │ │ └── rates.js
│ │ ├── i18n/
│ │ │ ├── get.js
│ │ │ └── i18n.apib
│ │ ├── index.js
│ │ ├── plans/
│ │ │ ├── del.js
│ │ │ ├── get.js
│ │ │ ├── list.js
│ │ │ ├── plans.apib
│ │ │ ├── post.js
│ │ │ └── put.js
│ │ ├── stats/
│ │ │ ├── month.js
│ │ │ ├── stats.apib
│ │ │ ├── week.js
│ │ │ └── year.js
│ │ ├── users/
│ │ │ ├── get.js
│ │ │ ├── newpassword.js
│ │ │ ├── post.js
│ │ │ ├── put.js
│ │ │ ├── removeaccount.js
│ │ │ ├── restore.js
│ │ │ ├── signin.js
│ │ │ ├── signout.js
│ │ │ ├── users.apib
│ │ │ └── wallets/
│ │ │ └── list.js
│ │ └── wallets/
│ │ ├── accesses/
│ │ │ ├── accesses.apib
│ │ │ ├── del.js
│ │ │ ├── list.js
│ │ │ └── post.js
│ │ ├── delete.js
│ │ ├── get.js
│ │ ├── list.js
│ │ ├── plans/
│ │ │ └── list.js
│ │ ├── post.js
│ │ ├── put.js
│ │ ├── stats/
│ │ │ ├── month.js
│ │ │ ├── wallet_stats.apib
│ │ │ ├── week.js
│ │ │ └── year.js
│ │ ├── transactions/
│ │ │ ├── del.js
│ │ │ ├── list.js
│ │ │ ├── post.js
│ │ │ └── transactions.apib
│ │ └── wallets.apib
│ ├── servers/
│ │ ├── images_server.js
│ │ ├── index.js
│ │ ├── index_server.js
│ │ ├── minify_server.js
│ │ ├── public_server.js
│ │ └── static_file_server.js
│ ├── test/
│ │ ├── planning.test.js
│ │ ├── stats.test.js
│ │ └── wallet.test.js
│ └── test.js
├── index.js
├── package.json
├── public/
│ ├── css/
│ │ ├── .gitignore
│ │ ├── main.css
│ │ └── parts/
│ │ ├── dialogs/
│ │ │ ├── base.css
│ │ │ ├── registration.css
│ │ │ └── signin.css
│ │ ├── head.css
│ │ ├── home.css
│ │ ├── icons.css
│ │ ├── import.css
│ │ ├── overload.css
│ │ ├── page_transitions.css
│ │ ├── sticked_footer.css
│ │ ├── text_format.css
│ │ ├── wallets.css
│ │ └── widgets.css
│ ├── index.html
│ ├── jstemplates/
│ │ ├── 404.tpl
│ │ ├── dialogs/
│ │ │ ├── add_profit.tpl
│ │ │ ├── add_wallet.tpl
│ │ │ ├── change_language.tpl
│ │ │ ├── edit_wallet.tpl
│ │ │ ├── fill_profile.tpl
│ │ │ ├── hide_wallet.tpl
│ │ │ ├── registration.tpl
│ │ │ ├── remove_access.tpl
│ │ │ ├── remove_plan.tpl
│ │ │ ├── remove_transaction.tpl
│ │ │ ├── restore.tpl
│ │ │ ├── set_total_to.tpl
│ │ │ ├── signin.tpl
│ │ │ ├── transaction_details.tpl
│ │ │ └── wallet_accesses.tpl
│ │ ├── months.tpl
│ │ ├── pages/
│ │ │ ├── import/
│ │ │ │ └── xls.tpl
│ │ │ ├── index/
│ │ │ │ └── index.tpl
│ │ │ ├── plans/
│ │ │ │ ├── index.tpl
│ │ │ │ └── view.tpl
│ │ │ ├── profile/
│ │ │ │ └── index.tpl
│ │ │ ├── user/
│ │ │ │ ├── confirm.tpl
│ │ │ │ ├── index.tpl
│ │ │ │ ├── registration.tpl
│ │ │ │ ├── restore.tpl
│ │ │ │ ├── signin.tpl
│ │ │ │ └── update_password.tpl
│ │ │ └── wallets/
│ │ │ ├── index.tpl
│ │ │ └── view.tpl
│ │ └── parts/
│ │ ├── transactions.tpl
│ │ └── wallet_plans.tpl
│ └── scripts/
│ ├── .gitignore
│ ├── app/
│ │ ├── abstract/
│ │ │ ├── dialog.js
│ │ │ └── page.js
│ │ ├── collections/
│ │ │ ├── plans.js
│ │ │ ├── transactions.js
│ │ │ ├── users.js
│ │ │ ├── wallets.js
│ │ │ └── wallets_accesses.js
│ │ ├── exchange.js
│ │ ├── helper.js
│ │ ├── i18n.js
│ │ ├── local_storage.js
│ │ ├── log.js
│ │ ├── models/
│ │ │ ├── plan.js
│ │ │ ├── transaction.js
│ │ │ ├── user.js
│ │ │ ├── wallet.js
│ │ │ └── wallets_access.js
│ │ ├── router.js
│ │ ├── settings.js
│ │ ├── template_manager.js
│ │ ├── view_stack.js
│ │ └── views/
│ │ ├── charts/
│ │ │ └── balance.js
│ │ ├── dialogs/
│ │ │ ├── add_profit.js
│ │ │ ├── add_wallet.js
│ │ │ ├── change_language.js
│ │ │ ├── edit_wallet.js
│ │ │ ├── fill_profile.js
│ │ │ ├── hide_wallet.js
│ │ │ ├── logout.js
│ │ │ ├── registration.js
│ │ │ ├── remove_access.js
│ │ │ ├── remove_plan.js
│ │ │ ├── remove_transaction.js
│ │ │ ├── restore.js
│ │ │ ├── set_total_to.js
│ │ │ ├── signin.js
│ │ │ ├── transaction_details.js
│ │ │ └── wallet_accesses.js
│ │ ├── header.js
│ │ ├── pages/
│ │ │ ├── 404.js
│ │ │ ├── import_xls.js
│ │ │ ├── index.js
│ │ │ ├── plan.js
│ │ │ ├── plans.js
│ │ │ ├── profile.js
│ │ │ ├── update_password.js
│ │ │ ├── wallet.js
│ │ │ └── wallets.js
│ │ ├── parts/
│ │ │ ├── profile_change_password.js
│ │ │ ├── profile_remove_account.js
│ │ │ ├── transactions.js
│ │ │ └── wallet_plans.js
│ │ ├── tours/
│ │ │ ├── wallet.js
│ │ │ └── wallets.js
│ │ └── widgets/
│ │ └── index.js
│ ├── app.js
│ ├── functions.js
│ ├── setup.js
│ └── table_helper.js
└── tools/
├── check_i18n_files.js
└── harvest_i18n_strings.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .bowerrc
================================================
{
"directory": "public/vendors/"
}
================================================
FILE: .gitignore
================================================
node_modules
public/vendors
npm-debug.log
data/database.sqlite
================================================
FILE: .rebooted
================================================
rebooted
================================================
FILE: Gruntfile.js
================================================
module.exports = function(grunt) {
grunt.initConfig({
concurrent: {
dev: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
nodemon: {
dev: {
script: 'index.js',
options: {
ext: 'js,css,html,tpl',
watch: ['**/*.js', '**/*.tpl', '**/*.css', 'public/index.html', '**/*.json'],
nodeArgs: ['--debug'],
env: {
PORT: '8080'
},
// omit this property if you aren't serving HTML files and
// don't want to open a browser tab on start
callback: function(nodemon) {
nodemon.on('log', function(event) {
console.log(event.colour);
});
// opens browser on initial server start
nodemon.on('config:update', function() {
// Delay before server listens on port
setTimeout(function() {
require('open')('http://localhost:8080');
}, 1000);
});
// refreshes browser when server reboots
nodemon.on('restart', function() {
// Delay before server listens on port
setTimeout(function() {
require('fs').writeFileSync('.rebooted', 'rebooted');
}, 3000);
});
}
}
}
},
watch: {
server: {
files: ['.rebooted'],
options: {
livereload: true,
debounceDelay: 500
}
},
javascript: {
files: ['includes/**/*.js'],
tasks: "test"
}
},
env: {
options: {},
test: {
NODE_ENV: 'test'
},
apiary: {
APIARY_API_KEY: process.env.DIMESHIFT_APIARY_API_KEY // https://login.apiary.io/tokens
}
},
concat: {
options: {
separator: '\n \n',
},
dist: {
src: ["docs/api.md", "includes/routes/**/*.apib"],
dest: 'data/cache/api.apib'
}
},
exec: {
publish: ['apiary', 'publish', ['--api-name', 'dimeshift'].join('='), ['--path', 'data/cache/api.apib'].join('=')].join(' ')
},
run: {
test_server: {
options: {
wait: false
},
args: [
'index.js'
]
}
},
mochacli: {
options: {
require: [],
reporter: 'spec',
bail: true,
sort: true,
env: {
NODE_ENV: 'test'
}
},
all: ['includes/test/*.js']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-mocha-cli');
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('default', ['concurrent']);
grunt.registerTask('dev', ['concurrent']);
grunt.registerTask('test', ['env:test', 'run:test_server', 'mochacli', 'stop:test_server']);
grunt.registerTask('apiary', ['env:apiary', 'concat', 'exec:publish']);
};
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
================================================
FILE: Procfile
================================================
web: node index.js
================================================
FILE: README.md
================================================
# DimeShift - easiest way to track your expenses. Online. Open-source. Free
* node.js
* npm
* Front-end: jQuery, Bootstrap, Backbone.js with JSmart template engine.
* Back-end: Sequelize, SQLite database by default, easy to switch to MySQL or Postgree for production.
Demo:
----
[DimeShift](https://dimeshift.com/)
Desktop Application:
----
[DimeShift Desktop](https://github.com/jeka-kiselyov/dimeshift-desktop). Cross platform desktop app built on [Electron](http://electron.atom.io/)
Installation:
----
[](https://heroku.com/deploy?template=https://github.com/jeka-kiselyov/dimeshift)
or install from CLI:
```bash
mkdir dimeshift
cd dimeshift
git clone https://github.com/jeka-kiselyov/dimeshift.git .
npm install
```
* [Install npm](https://docs.npmjs.com/getting-started/installing-node) if you don't have it.
* [Install bower](http://bower.io/#install-bower) if you don't have it.
Run:
----
```bash
npm start
```
Open [localhost:8080](http://localhost:8080) in your browser.
Documentation:
----
[API](http://docs.dimeshift.apiary.io/)
Screenshots:
----




License
----
GNU Affero GPL
**Free Software, Hell Yeah!**
From Slavyansk, Ukraine. With Love
================================================
FILE: app.json
================================================
{
"name": "dimeshift",
"description": "Webapp to track and manage personal finances",
"repository": "https://github.com/jeka-kiselyov/dimeshift",
"logo": "https://raw.githubusercontent.com/jeka-kiselyov/dimeshift/master/public/images/homepage/screenshots/transactions.jpg",
"keywords": ["node", "finances", "money", "HTML5", "Sequelize", "Backbone.js", "Restify"],
"addons": ["heroku-postgresql:hobby-dev", "sparkpost:free"],
"env": {
"NODE_ENV": "heroku"
}
}
================================================
FILE: bower.json
================================================
{
"name": "DimeShift",
"version": "0.1.34",
"authors": [
"jeka911 <jeka911@gmail.com>"
],
"description": "",
"main": "app/public/scripts/app.js",
"moduleType": [
"globals"
],
"dependencies": {
"jquery": "1.10.2",
"jasmine": "https://github.com/pivotal/jasmine/releases/download/v2.0.2/jasmine-standalone-2.0.2.zip",
"jasmine-ajax": "https://raw.githubusercontent.com/pivotal/jasmine-ajax/master/lib/mock-ajax.js",
"jsmart": "2.13.1",
"backbone": "1.0.0",
"backbone.paginator": "https://github.com/backbone-paginator/backbone.paginator/archive/2.0.2.zip",
"underscore": "1.7.0",
"bootstrap": "3.3.4",
"magnific-popup": "*",
"bootstrap-clickonmouseover": "https://github.com/jeka-kiselyov/bootstrap-clickonmouseover/archive/master.zip",
"mprogress": "https://github.com/lightningtgc/MProgress.js/archive/master.zip",
"bootstrap-tour": "~0.10.2",
"js-xlsx": "~0.8.0",
"moment": "~2.10.6",
"eonasdan-bootstrap-datetimepicker": "^4.17.37",
"font-awesome": "fontawesome#^4.6.1"
}
}
================================================
FILE: config/config.json
================================================
{
"development": {
"port": 8080,
"database": {
"dialect": "sqlite",
"username": "root",
"password": "root",
"database": "walletjs",
"host": "127.0.0.1",
"storage": "data/database.sqlite"
},
"smtp": {
"host": "mailtrap.io",
"username": "38298e68fa9771771",
"password": "ab75f0affdd61a",
"port": "465"
},
"openexchangerates": {
"use_env_variable": false,
"app_id": "OPENEXCHANGERATES_APP_ID",
"update_interval": 86400
},
"default_from_email": "noreply@dimeshift.com",
"site_path": "http://localhost:8080/",
"minify": {
"javascript": true,
"css": true
}
},
"electron": {
"port": 0,
"database": {
"dialectModulePath": "../../includes/sqlite3.js",
"dialect": "sqlite",
"storage": "data/database.sqlite"
},
"smtp": null,
"openexchangerates": null,
"default_from_email": null,
"site_path": null,
"minify": {
"javascript": true,
"css": true
}
},
"test": {
"port": 8081,
"database": {
"dialect": "sqlite",
"storage": "data/database.sqlite"
},
"smtp": null,
"openexchangerates": {
"app_id": "234234234234234234234",
"update_interval": 86400
},
"default_from_email": "noreply@dimeshift.com",
"site_path": "http://localhost:8080/",
"minify": {
"javascript": false,
"css": false
}
},
"heroku": {
"database": {
"use_env_variable": "DATABASE_URL"
},
"smtp": {
"use_env_variables": true,
"host": "SPARKPOST_SMTP_HOST",
"username": "SPARKPOST_SMTP_USERNAME",
"password": "SPARKPOST_SMTP_PASSWORD",
"port": "SPARKPOST_SMTP_PORT"
},
"openexchangerates": {
"use_env_variable": true,
"app_id": "OPENEXCHANGERATES_APP_ID",
"update_interval": 86400
},
"default_from_email": "noreply@dimeshift.com",
"site_path": "http://dimeshift.com/",
"minify": {
"javascript": true,
"css": true
}
}
}
================================================
FILE: config/currencies.json
================================================
{
"AED": "United Arab Emirates Dirham",
"AFN": "Afghan Afghani",
"ALL": "Albanian Lek",
"AMD": "Armenian Dram",
"ANG": "Netherlands Antillean Guilder",
"AOA": "Angolan Kwanza",
"ARS": "Argentine Peso",
"AUD": "Australian Dollar",
"AWG": "Aruban Florin",
"AZN": "Azerbaijani Manat",
"BAM": "Bosnia-Herzegovina Convertible Mark",
"BBD": "Barbadian Dollar",
"BDT": "Bangladeshi Taka",
"BGN": "Bulgarian Lev",
"BHD": "Bahraini Dinar",
"BIF": "Burundian Franc",
"BMD": "Bermudan Dollar",
"BND": "Brunei Dollar",
"BOB": "Bolivian Boliviano",
"BRL": "Brazilian Real",
"BSD": "Bahamian Dollar",
"BTC": "Bitcoin",
"BTN": "Bhutanese Ngultrum",
"BWP": "Botswanan Pula",
"BYR": "Belarusian Ruble",
"BZD": "Belize Dollar",
"CAD": "Canadian Dollar",
"CDF": "Congolese Franc",
"CHF": "Swiss Franc",
"CLF": "Chilean Unit of Account (UF)",
"CLP": "Chilean Peso",
"CNY": "Chinese Yuan",
"COP": "Colombian Peso",
"CRC": "Costa Rican Colón",
"CUP": "Cuban Peso",
"CVE": "Cape Verdean Escudo",
"CZK": "Czech Republic Koruna",
"DJF": "Djiboutian Franc",
"DKK": "Danish Krone",
"DOP": "Dominican Peso",
"DZD": "Algerian Dinar",
"EEK": "Estonian Kroon",
"EGP": "Egyptian Pound",
"ERN": "Eritrean Nakfa",
"ETB": "Ethiopian Birr",
"EUR": "Euro",
"FJD": "Fijian Dollar",
"FKP": "Falkland Islands Pound",
"GBP": "British Pound Sterling",
"GEL": "Georgian Lari",
"GGP": "Guernsey Pound",
"GHS": "Ghanaian Cedi",
"GIP": "Gibraltar Pound",
"GMD": "Gambian Dalasi",
"GNF": "Guinean Franc",
"GTQ": "Guatemalan Quetzal",
"GYD": "Guyanaese Dollar",
"HKD": "Hong Kong Dollar",
"HNL": "Honduran Lempira",
"HRK": "Croatian Kuna",
"HTG": "Haitian Gourde",
"HUF": "Hungarian Forint",
"IDR": "Indonesian Rupiah",
"ILS": "Israeli New Sheqel",
"IMP": "Manx pound",
"INR": "Indian Rupee",
"IQD": "Iraqi Dinar",
"IRR": "Iranian Rial",
"ISK": "Icelandic Króna",
"JEP": "Jersey Pound",
"JMD": "Jamaican Dollar",
"JOD": "Jordanian Dinar",
"JPY": "Japanese Yen",
"KES": "Kenyan Shilling",
"KGS": "Kyrgystani Som",
"KHR": "Cambodian Riel",
"KMF": "Comorian Franc",
"KPW": "North Korean Won",
"KRW": "South Korean Won",
"KWD": "Kuwaiti Dinar",
"KYD": "Cayman Islands Dollar",
"KZT": "Kazakhstani Tenge",
"LAK": "Laotian Kip",
"LBP": "Lebanese Pound",
"LKR": "Sri Lankan Rupee",
"LRD": "Liberian Dollar",
"LSL": "Lesotho Loti",
"LTL": "Lithuanian Litas",
"LVL": "Latvian Lats",
"LYD": "Libyan Dinar",
"MAD": "Moroccan Dirham",
"MDL": "Moldovan Leu",
"MGA": "Malagasy Ariary",
"MKD": "Macedonian Denar",
"MMK": "Myanma Kyat",
"MNT": "Mongolian Tugrik",
"MOP": "Macanese Pataca",
"MRO": "Mauritanian Ouguiya",
"MTL": "Maltese Lira",
"MUR": "Mauritian Rupee",
"MVR": "Maldivian Rufiyaa",
"MWK": "Malawian Kwacha",
"MXN": "Mexican Peso",
"MYR": "Malaysian Ringgit",
"MZN": "Mozambican Metical",
"NAD": "Namibian Dollar",
"NGN": "Nigerian Naira",
"NIO": "Nicaraguan Córdoba",
"NOK": "Norwegian Krone",
"NPR": "Nepalese Rupee",
"NZD": "New Zealand Dollar",
"OMR": "Omani Rial",
"PAB": "Panamanian Balboa",
"PEN": "Peruvian Nuevo Sol",
"PGK": "Papua New Guinean Kina",
"PHP": "Philippine Peso",
"PKR": "Pakistani Rupee",
"PLN": "Polish Zloty",
"PYG": "Paraguayan Guarani",
"QAR": "Qatari Rial",
"RON": "Romanian Leu",
"RSD": "Serbian Dinar",
"RUB": "Russian Ruble",
"RWF": "Rwandan Franc",
"SAR": "Saudi Riyal",
"SBD": "Solomon Islands Dollar",
"SCR": "Seychellois Rupee",
"SDG": "Sudanese Pound",
"SEK": "Swedish Krona",
"SGD": "Singapore Dollar",
"SHP": "Saint Helena Pound",
"SLL": "Sierra Leonean Leone",
"SOS": "Somali Shilling",
"SRD": "Surinamese Dollar",
"STD": "São Tomé and Príncipe Dobra",
"SVC": "Salvadoran Colón",
"SYP": "Syrian Pound",
"SZL": "Swazi Lilangeni",
"THB": "Thai Baht",
"TJS": "Tajikistani Somoni",
"TMT": "Turkmenistani Manat",
"TND": "Tunisian Dinar",
"TOP": "Tongan Paʻanga",
"TRY": "Turkish Lira",
"TTD": "Trinidad and Tobago Dollar",
"TWD": "New Taiwan Dollar",
"TZS": "Tanzanian Shilling",
"UAH": "Ukrainian Hryvnia",
"UGX": "Ugandan Shilling",
"USD": "United States Dollar",
"UYU": "Uruguayan Peso",
"UZS": "Uzbekistan Som",
"VEF": "Venezuelan Bolívar Fuerte",
"VND": "Vietnamese Dong",
"VUV": "Vanuatu Vatu",
"WST": "Samoan Tala",
"XAF": "CFA Franc BEAC",
"XAG": "Silver (troy ounce)",
"XAU": "Gold (troy ounce)",
"XCD": "East Caribbean Dollar",
"XDR": "Special Drawing Rights",
"XOF": "CFA Franc BCEAO",
"XPF": "CFP Franc",
"YER": "Yemeni Rial",
"ZAR": "South African Rand",
"ZMK": "Zambian Kwacha (pre-2013)",
"ZMW": "Zambian Kwacha",
"ZWL": "Zimbabwean Dollar"
}
================================================
FILE: config/pages.json
================================================
{
"/*": "Index",
"/wallets": "Wallets",
"/profile": "Profile",
"/plans": "Plans",
"/plans/:id": "Plan",
"/wallets/:id": "Wallet",
"/wallets/:id/import": "ImportXLS",
"/user/updatepassword/:code/:hash": "UpdatePassword",
"/user/newpassword": "Index"
}
================================================
FILE: config/resources.json
================================================
{
"javascript": [
"./public/vendors/jquery/jquery.min.js",
"./public/vendors/bootstrap/js/modal.js",
"./public/vendors/bootstrap/js/button.js",
"./public/vendors/bootstrap/js/dropdown.js",
"./public/vendors/bootstrap/js/collapse.js",
"./public/vendors/bootstrap/js/tooltip.js",
"./public/vendors/bootstrap/js/popover.js",
"./public/vendors/bootstrap-tour/build/js/bootstrap-tour.js",
"./public/vendors/underscore/underscore-min.js",
"./public/vendors/backbone/backbone.js",
"./public/vendors/backbone.paginator/lib/backbone.paginator.min.js",
"./public/vendors/bootstrap-clickonmouseover/bootstrap.clickonmouseover.js",
"./public/vendors/magnific-popup/dist/jquery.magnific-popup.min.js",
"./public/vendors/mprogress/build/js/mprogress.min.js",
"./public/vendors/jsmart/jsmart.js",
"./public/scripts/functions.js",
"./public/scripts/app.js",
"./public/scripts/app/helper.js",
"./public/scripts/app/view_stack.js",
"./public/scripts/app/settings.js",
"./public/scripts/app/local_storage.js",
"./public/scripts/app/template_manager.js",
"./public/scripts/app/i18n.js",
"./public/scripts/app/exchange.js",
"./public/scripts/app/abstract/",
"./public/scripts/app/models/",
"./public/scripts/app/collections/",
"./public/scripts/app/views/dialogs/",
"./public/scripts/app/views/widgets/",
"./public/scripts/app/views/parts/",
"./public/scripts/app/views/pages/",
"./public/scripts/app/views/tours/",
"./public/scripts/app/views/charts/",
"./public/scripts/app/views/header.js",
"./public/scripts/app/log.js",
"./public/scripts/app/router.js",
"./public/scripts/setup.js"
],
"css": [
"./public/vendors/mprogress/build/css/mprogress.css",
"./public/vendors/magnific-popup/dist/magnific-popup.css",
"./public/vendors/bootstrap/dist/css/bootstrap.min.css",
"./public/vendors/font-awesome/css/font-awesome.css",
"./public/vendors/bootstrap-tour/build/css/bootstrap-tour.min.css",
"./public/vendors/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css",
"./public/css/main.css",
"./public/css/parts/",
"./public/css/parts/dialogs/"
]
}
================================================
FILE: data/cache/.gitignore
================================================
exchangerates.json
api.apib
================================================
FILE: data/i18n/en.json
================================================
{
"Nothing is found": "",
"Add Income": "",
"Amount": "",
"Description": "",
"Desciption": "",
"Add": "",
"Saving...": "",
"Add Wallet": "",
"Name": "",
"Currency": "",
"Select Currency": "",
"Edit Wallet": "",
"Save": "",
"Fill Profile": "",
"Username": "",
"Email": "",
"Password": "",
"Invalid username or password": "",
"Thank you! From now, you can sign in to your account any time from any device.": "",
"Are you sure that you want to hide": "",
"this wallet": "",
"wallet": "",
"Are you sure that you want to remove": "",
"You will be able to restore it from Trash folder": "",
"All wallet data(transactions etc.) will be lost": "",
"Yes, Hide It": "",
"Yes, Remove": "",
"Removing...": "",
"Cancel": "",
"Canceling...": "",
"Registration": "",
"Sign Up": "",
"Registration...": "",
"Thank you! Please check your email inbox for confirmation link": "",
"Already a member?": "",
"Sign In": "",
"Are you sure that you want to remove access for email": "",
"from this wallet": "",
"from wallet": "",
"Are you sure that you want to remove this transaction?": "",
"Restore Password": "",
"Restore": "",
"Processing...": "",
"Instructions have been sent to your email address": "",
"Don't have an account?": "",
"Register": "",
"Set Total To": "",
"Total": "",
"Set": "",
"Username or Email": "",
"Signing in...": "",
"Restore your password": "",
"Transaction Details": "",
"Date": "",
"Time": "",
"Remove": "",
"Users with access": "",
"to this wallet": "",
"to wallet": "",
"Only you have access to this wallet": "",
"Not registered yet": "",
"Remove Access": "",
"Add access": "",
"Give Access": "",
"January": "",
"February": "",
"March": "",
"April": "",
"May": "",
"June": "",
"July": "",
"August": "",
"September": "",
"October": "",
"November": "",
"December": "",
"january": "",
"february": "",
"march": "",
"april": "",
"may": "",
"june": "",
"july": "",
"august": "",
"september": "",
"october": "",
"november": "",
"december": "",
"Home": "",
"Settings": "",
"Your password has been successfully changed": "",
"Invalid current password": "",
"Passwords missmatch": "",
"New password is too short": "",
"Current Password": "",
"New Password": "",
"Repeat Password": "",
"Change Password": "",
"Update Password": "",
"Invalid Restore Password Code": "",
"Restore Password Code": "",
"Restore Password Hash": "",
"Your Wallets": "",
"You have no wallets": "",
"You have no hidden wallets": "",
"Hide": "",
"Edit": "",
"Manage Accesses": "",
"This wallet is shared with you by another user": "",
"Filter": "",
"Active": "",
"Trash": "",
"Access": "",
"Both": "",
"Yours": "",
"Shared with you": "",
"Wallets": "",
"or": "",
"set total to": "",
"Transactions": "",
"Describe expense and press Enter to add": "",
"Transaction amount": "",
"Expenses per day trends": "",
"No transactions for": "",
"Contact": "",
"Log Out": "",
"View Source on GitHub": "",
"Copyright": "",
"GNU Affero GPL License": "",
"Change DimeShift language": "",
"the easiest way to track your expenses": "",
"To demonstrate how simple it is": "",
"we don't even ask you to register": "",
"Just move your mouse pointer over": "",
"here": "",
"and start using wallet right now!": "",
"Just click": "",
"Screenshots": "",
"Easiest way to manage your personal finances online": "",
"Simple as it is": "",
"Any currency": "",
"Create as many wallets as you need": "",
"Internalization": "",
"Just click on the globe icon in top right corner": "",
"Open Source!": "",
"GNU Affero GPL Licensed. Please feel free to check out the code and fork it!": "",
"Please don't forget to let us know your email address, so you can sign in to DimeShift on your next visit": "",
"Do it": "",
"Here is quick introdution to DimeShift.<br><br>Our demo robot has created few sample wallets for you to check out.": "",
"But you can add as many as you want.<br><br>Different name, different currencies": "",
"There're few options availiable when you move your mouse over your wallet.<br><br>\n\tBut lets jump directly to wallet page.<br><br>Click any row to jump to it.\n\t": "",
"Let's start by adding some money to your wallet.<br><br>Click \"Add Profit\" button and fill the form in modal window. It's simple.": "",
"You can also set current total with \"Set Total To\" dialog.<br><br>\n\t\t\t\t\tWe don't ask you to track every transaction you've done(though you can). \n\t\t\t\t\tFeel free to update your DimeShift wallet every evening, or even once in few days.<br><br>\n\t\t\t\t\tClick \"set total to\" action link and fill the form to check how it works.": "",
"It's time to add some expense.<br><br>\n\tYou can add transaction with one string, e.g. \"99.93, best expense ever\".<br><br>\n\tPress Enter when tranasction description is ready.\n\t": "",
"Check out updated transactions list": "",
"Check out expenses per day trends. Simple chart that gets updated every time you add another tranasction.": "",
"Don't forget to fill your profile, so you can sign in to DimeShift next time.": "",
"Select file": "",
"Uploading...": "",
"Do not import": "",
"Expense amount": "",
"Preview": "",
"Import": "",
"Back": "",
"Import .xls file": "",
"Step 1. Select .xls file to import": "",
"Invalid xls file. Please select another one and try again": "",
"Please select your local .xls file": "",
"Step 2. Select columns to import": "",
"more rows": "",
"Amount and Date fields are required": "",
"Few more rows": "",
"Do not import transaction, if it's already in database": "",
"Step 4. Import": "",
"Finished": "",
"Import operation is finished": "",
"Check out you updated wallet": "",
"Step 3. Preview and settings": "",
"You don't have access to other users' wallets": "",
"Goals": "",
"Are you sure that you want to remove this plan?": "",
"Plan name": "",
"Plan your expenses": "",
"Your plans": "",
"View Report": "",
"Create new": "",
"Basic settings": "",
"Wallets to use for planning": "",
"Next": "",
"Plan settings": "",
"Current balance is": "",
"Calculate in different currency": "",
"And on": "",
"Plan is to keep": "",
"Set to": "",
"So you": "",
"can spend up to": "",
"have to get": "",
"on the next day": "",
"in next": "",
"days": "",
"per day": "",
"Confirm and save": "",
"Goal Details": "",
"From:": "",
"To:": "",
"From": "",
"to": "",
"Day by day report": "",
"Total On Start": "",
"Spent": "",
"Profit": "",
"Plan": "",
"Remove account": "",
"Security code": "",
"Demo account will be removed as soon as you do log out from it.": "",
"Please think twice. All account data will be lost.": "",
"has been mailed to your email. Please fill this form to finish account removal.": "",
"Your account has been removed. We will miss you :(": "",
"Invalid": "",
"There're no goals defined for this wallet": "",
"Set Goal": "",
"You": "",
"today": ""
}
================================================
FILE: data/i18n/ptbr.json
================================================
{
"Nothing is found": "Sem resultado",
"Add Income": "Adicionar Receita",
"Amount": "Valor",
"Description": "Descrição",
"Desciption": "",
"Add": "Adicionar",
"Saving...": "Salvando...",
"Add Wallet": "Adicionar Carteira",
"Name": "Nome",
"Currency": "Moeda",
"Select Currency": "Selecionar Moeda",
"Edit Wallet": "Editar Carteira",
"Save": "Salvar",
"Fill Profile": "Preencher Perfil",
"Username": "Usuário",
"Email": "Email",
"Password": "Senha",
"Invalid username or password": "Usuário ou senha inválidos",
"Thank you! From now, you can sign in to your account any time from any device.": "Obrigado! A partir de agora, você pode fazer login na sua conta a qualquer momento a partir de qualquer dispositivo.",
"Are you sure that you want to hide": "Tem certeza que você deseja ocultar",
"this wallet": "esta carteira",
"wallet": "carteira",
"Are you sure that you want to remove": "Tem certeza que você deseja ocultar",
"You will be able to restore it from Trash folder": "Você será capaz de restaurá-lo a partir da Lixeira",
"All wallet data(transactions etc.) will be lost": "Todos os dados da carteira (transações etc.) serão perdidos",
"Yes, Hide It": "Sim, oculte-o",
"Yes, Remove": "Sim, Remover",
"Removing...": "Removendo...",
"Cancel": "Cancelar",
"Canceling...": "Cancelando...",
"Registration": "Registro",
"Sign Up": "Inscrição",
"Registration...": "Registro...",
"Thank you! Please check your email inbox for confirmation link": "Obrigado! Por favor verifique sua caixa de entrada pelo link de confirmação",
"Already a member?": "Já é membro",
"Sign In": "Entrar",
"Are you sure that you want to remove access for email": "Tem certeza de que deseja remover o acesso de e-mail?",
"from this wallet": "desta carteira",
"from wallet": "da carteira",
"Are you sure that you want to remove this transaction?": "Tem certeza de que deseja remover esta transação?",
"Restore Password": "Restaurar Senha",
"Restore": "Restaurar",
"Processing...": "Processando",
"Instructions have been sent to your email address": "Instruções enviadas para seu email",
"Don't have an account?": "Sem uma conta?",
"Register": "Registrar",
"Set Total To": "Definir Total Para",
"Total": "Total",
"Set": "Definir",
"Username or Email": "Usuário ou Email",
"Signing in...": "Entrando",
"Restore your password": "Restaurar sua senha",
"Transaction Details": "Detalhes da Transação",
"Date": "Data",
"Time": "Hora",
"Remove": "Remover",
"Users with access": "Usuários com acesso",
"to this wallet": "para esta carteira",
"to wallet": "para carteira",
"Only you have access to this wallet": "Somente você tem acesso a esta carteira",
"Not registered yet": "Não registrado ainda",
"Remove Access": "Remover Acesso",
"Add access": "Adicionar acesso",
"Give Access": "Obter Acesso",
"January": "Janeiro",
"February": "Fevereiro",
"March": "Março",
"April": "Abril",
"May": "Maio",
"June": "Junho",
"July": "Julho",
"August": "Agosto",
"September": "Setembro",
"October": "Outubro",
"November": "Novembro",
"December": "Dezembro",
"january": "janeiro",
"february": "fevereiro",
"march": "março",
"april": "abril",
"may": "maio",
"june": "junho",
"july": "julho",
"august": "agosto",
"september": "setembro",
"october": "outubro",
"november": "novembro",
"december": "dezembro",
"Home": "Home",
"Settings": "Configurações",
"Your password has been successfully changed": "Sua senha foi atualizada com sucesso",
"Invalid current password": "Senha atual inválida",
"Passwords missmatch": "Senhas incompatíveis",
"New password is too short": "Nova senha é muito curta",
"Current Password": "Senha Atual",
"New Password": "NOva Senha",
"Repeat Password": "Repetir Senha",
"Change Password": "Alterar Senha",
"Update Password": "Atualizar Senha",
"Invalid Restore Password Code": "Código para restaurar senha inválido",
"Restore Password Code": "Código para restaurar senha",
"Restore Password Hash": "Hash para restaurar senha",
"Your Wallets": "Suas Carteiras",
"You have no wallets": "Você não possui carteiras",
"You have no hidden wallets": "Você não possui carteiras ocultas",
"Hide": "Ocultar",
"Edit": "Editar",
"Manage Accesses": "Gerenciar Acessos",
"This wallet is shared with you by another user": "Esta carteira é compartilhada com você por outro usuário",
"Filter": "Filtro",
"Active": "Ativo",
"Trash": "Lixo",
"Access": "Acesso",
"Both": "Ambos",
"Yours": "Seus",
"Shared with you": "Compartilhado com você",
"Wallets": "Carteiras",
"or": "ou",
"set total to": "definir total para",
"Transactions": "Transações",
"Describe expense and press Enter to add": "Descreva a despesa e pressione Enter para adicionar",
"Transaction amount": "Valor da transação",
"Expenses per day trends": "Tendencia de despesas por dia",
"No transactions for": "Sem transações para",
"Contact": "Contato",
"Log Out": "Encerrar",
"View Source on GitHub": "Ver origem no GitHub",
"Copyright": "Copyright",
"GNU Affero GPL License": "GNU Affero GPL License",
"Change DimeShift language": "Mudar linguagem DimeShift",
"the easiest way to track your expenses": "A maneira mais simples de gerenciar suas finanças",
"To demonstrate how simple it is": "Para demonstrar como é simples",
"we don't even ask you to register": "Não pediremos para registrar",
"Just move your mouse pointer over": "Basta mover o ponteiro do mouse sobre",
"here": "aqui",
"and start using wallet right now!": "e inicie usando a carteira agora mesmo!",
"Just click": "Basta clicar",
"Screenshots": "Screenshots",
"Easiest way to manage your personal finances online": "Maneira mais fácil de gerenciar suas finanças pessoais on-line",
"Simple as it is": "Simples como é",
"Any currency": "Qualquer moeda",
"Create as many wallets as you need": "Crie quantas carteiras precisar",
"Internalization": "Internacioanlização",
"Just click on the globe icon in top right corner": "",
"Please don't forget to let us know your email address, so you can sign in to DimeShift on your next visit": "Por favor, não se esqueça de nos informar seu endereço de e-mail, para entrar em sua próxima visita a DimeShift",
"Do it": "Faça",
"Here is quick introdution to DimeShift.<br><br>Our demo robot has created few sample wallets for you to check out.": "Rápida introdução a DimeShift.<br:<brNosso robô criou uma demonstração para que você vá para algumas carteiras de amostra.:",
"But you can add as many as you want.<br><br>Different name, different currencies": "Mas você pode adicionar quantos você quiser.<br><br>Diferentes nomes e moedas",
"There're few options availiable when you move your mouse over your wallet.<br><br>\n\tBut lets jump directly to wallet page.<br><br>Click any row to jump to it.\n\t": "Poucas opções são disponibilizadas quando você move o mouse sobre a sua carteira.<br><br>\n\tMas vamos pular diretamente para a página de carteira.<br><br>Clique em qualquer linha para saltar para ela.\n\t",
"Let's start by adding some money to your wallet.<br><br>Click \"Add Profit\" button and fill the form in modal window. It's simple.": "Vamos começar adicionando um pouco de dinheiro para a sua carteira.<br><br>Clique o botão \"Adicionar Beneficio\" e preencha o formulário na janela. É simples.",
"You can also set current total with \"Set Total To\" dialog.<br><br>\n\t\t\t\t\tWe don't ask you to track every transaction you've done(though you can). \n\t\t\t\t\tFeel free to update your DimeShift wallet every evening, or even once in few days.<br><br>\n\t\t\t\t\tClick \"set total to\" action link and fill the form to check how it works.": "Você pode definir o Total Atual com o diálogo \"Definir Total Para\".<br><br>\n\t\t\t\t\tNós não pedimos que você acompanhe todas as transações que você fez (embora você possa). \n\t\t\t\tSinta-se livre para atualizar sua carteira DimeShift todas as noites, ou mesmo uma vez em poucos dias.<br><br>\n\t\t\t\t\tClique no link \"Definir Total Para\" e preencha o formulário para ver como funciona.",
"It's time to add some expense.<br><br>\n\tYou can add transaction with one string, e.g. \"99.93, best expense ever\".<br><br>\n\tPress Enter when tranasction description is ready.\n\t": "É hora de adicionar alguma despesa.<br><br>\n\tVocê pode adicionar transação com um simples texto,ex:\"99.93, melhor gasto\".<br><br>\n\tPressione Enter quando a descrição da transação estiver pronta.\n\t",
"Check out updated transactions list": "Confira lista de transações atualizadas",
"Check out expenses per day trends. Simple chart that gets updated every time you add another tranasction.": "Confira as tendências de despesas por dia. Gráfico simples que é atualizado cada vez que você adicionar uma outra transação.",
"Don't forget to fill your profile, so you can sign in to DimeShift next time.": "Não se esqueça de preencher o seu perfil, de modo que você possa entrar na DimeShift da próxima vez.",
"Select file": "Selecionar arquivo",
"Uploading...": "Carregando...",
"Do not import": "Não importar",
"Expense amount": "Valor da despesa",
"Preview": "Visualizar",
"Import": "Importar",
"Back": "Voltar",
"Import .xls file": "Importar arquivo .xls",
"Step 1. Select .xls file to import": "Passo 1. Selecionar arquivo .xls para importar",
"Invalid xls file. Please select another one and try again": "Arquivo xls inválido. Por favor selecionar outro e tentar novamente",
"Please select your local .xls file": "Selecionar o local do seu arquivo .xls",
"Step 2. Select columns to import": "Passo 2. Selecionar colunas para importar",
"more rows": "mais linhas",
"Amount and Date fields are required": "Os campos valor e data são obrigatórios",
"Few more rows": "Poucas linhas a mais",
"Do not import transaction, if it's already in database": "Não importar transação, se ela já está no banco de dados",
"Step 4. Import": "Passo 4. Importar",
"Finished": "Terminado",
"Import operation is finished": "Operação de importação concluída",
"Check out you updated wallet": "Confira atualização de sua carteira",
"Step 3. Preview and settings": "Passo 3. Configuração e Visualização",
"Goals": "",
"Are you sure that you want to remove this plan?": "",
"Plan name": "",
"Plan your expenses": "",
"Your plans": "",
"View Report": "",
"Create new": "",
"Basic settings": "",
"Wallets to use for planning": "",
"Next": "",
"Plan settings": "",
"Current balance is": "",
"Calculate in different currency": "",
"And on": "",
"Plan is to keep": "",
"Set to": "",
"So you": "",
"can spend up to": "",
"have to get": "",
"on the next day": "",
"in next": "",
"days": "",
"per day": "",
"Confirm and save": "",
"Goal Details": "",
"From:": "",
"To:": "",
"From": "",
"to": "",
"Day by day report": "",
"Total On Start": "",
"Spent": "",
"Profit": "",
"Plan": "",
"Remove account": "",
"Security code": "",
"Demo account will be removed as soon as you do log out from it.": "",
"Please think twice. All account data will be lost.": "",
"has been mailed to your email. Please fill this form to finish account removal.": "",
"Your account has been removed. We will miss you :(": "",
"Invalid": "",
"You don't have access to other users' wallets": "",
"There're no goals defined for this wallet": "",
"Set Goal": "",
"You": "",
"today": ""
}
================================================
FILE: data/i18n/ru.json
================================================
{
"Nothing is found": "Ничего не найдено",
"Add Income": "Добавить доход",
"Amount": "Сумма",
"Description": "Описание",
"Add": "Добавить",
"Saving...": "Сохранение",
"Add Wallet": "Добавить кошелек",
"Name": "Название",
"Currency": "Валюта",
"Select Currency": "Выбрать валюту",
"Edit Wallet": "Редактировать кошелек",
"Save": "Сохранить",
"Fill Profile": "Заполнить профиль",
"Username": "Имя пользователя",
"Email": "",
"Password": "Пароль",
"Invalid username or password": "Неправильное имя пользователя или пароль",
"Thank you! From now, you can sign in to your account any time from any device.": "Спасибо! Теперь вы можете войти в ваш аккаунт с любого устройства.",
"Are you sure that you want to hide": "Вы уверены что хотите скрыть",
"this wallet": "этот кошелек",
"wallet": "кошелек",
"Are you sure that you want to remove": "Вы уверены что хотите удалить",
"You will be able to restore it from Trash folder": "Вы сможете восстановить его из Корзины",
"All wallet data(transactions etc.) will be lost": "Все данные, включая транзакции, будут утеряны",
"Yes, Hide It": "Да, спрятать",
"Yes, Remove": "Да, удалить",
"Removing...": "Удаление...",
"Cancel": "Отмена",
"Canceling...": "Отмена...",
"Registration": "Регистрация",
"Sign Up": "Зарегистрироваться",
"Registration...": "Регистрация...",
"Thank you! Please check your email inbox for confirmation link": "Спасибо. Мы отправили вам письмо с ссылкой для подтверждения вашей учетной записи",
"Already a member?": "Уже зарегистрированы?",
"Sign In": "Войти",
"Are you sure that you want to remove access for email": "Вы уверены что хотите удалить доступ для email",
"from this wallet": "для этого кошелька",
"from wallet": "для кошелька",
"Are you sure that you want to remove this transaction?": "Вы уверены что хотите удалить эту транзакцию?",
"Restore Password": "Восстановить пароль",
"Restore": "Восттановить",
"Processing...": "Обработка...",
"Instructions have been sent to your email address": "Инструкции отправлены на вашу электронную почту",
"Don't have an account?": "Еще нет учетной записи?",
"Register": "Зарегистрироваться",
"Set Total To": "Установить текущую сумму",
"Total": "Итого",
"Set": "Установить",
"Username or Email": "Имя пользователя или пароль",
"Signing in...": "Проверка...",
"Restore your password": "Восттановить ваш пароль",
"Transaction Details": "Детали транзакции",
"Date": "Дата",
"Time": "Время",
"Remove": "Удалить",
"Users with access": "Пользователи с доступом",
"to this wallet": "к этому кошельку",
"to wallet": "к кошельку",
"Only you have access to this wallet": "Только у вас есть доступ",
"Not registered yet": "Еще не зарегистрирован",
"Remove Access": "Лишить доступа",
"Add access": "Предоставить доступ",
"Give Access": "Предоставить доступ",
"January": "Январь",
"February": "Февраль",
"March": "Март",
"April": "Апрель",
"May": "Май",
"June": "Июнь",
"July": "Июль",
"August": "Август",
"September": "Сентябрь",
"October": "Октябрь",
"November": "Ноябрь",
"December": "Декабрь",
"january": "января",
"february": "февраля",
"march": "марта",
"april": "апреля",
"may": "мая",
"june": "июня",
"july": "июля",
"august": "августа",
"september": "сентября",
"october": "октября",
"november": "ноября",
"december": "декабря",
"Home": "Главная",
"Settings": "Настройки",
"Your password has been successfully changed": "Пароль успешно изменен",
"Invalid current password": "Неверный текущий пароль",
"Passwords missmatch": "Пароли не совпадают",
"New password is too short": "Новый пароль слишком короткий",
"Current Password": "Текущий пароль",
"New Password": "Новый пароль",
"Repeat Password": "Повторить новый пароль",
"Change Password": "Изменить пароль",
"Update Password": "Изменить пароль",
"Invalid Restore Password Code": "Неверный код восстановления пароля",
"Restore Password Code": "Код восстановления пароля",
"Restore Password Hash": "Хэш восстановления пароля",
"Your Wallets": "Ваши кошельки",
"You have no wallets": "У вас нет кошельков",
"You have no hidden wallets": "У вас нет скрытых кошельков",
"Hide": "Спрятать",
"Edit": "Редактировать",
"Manage Accesses": "Управление доступом",
"This wallet is shared with you by another user": "Доступ к этому кошельку предоставлен другим пользователем",
"Filter": "Фильтр",
"Active": "Активные",
"Trash": "Корзина",
"Access": "Доступ",
"Both": "Все",
"Yours": "Ваши",
"Shared with you": "Доступные вам",
"Wallets": "Кошельки",
"or": "или",
"set total to": "установить текущую сумму",
"Transactions": "Транзакции",
"Describe expense and press Enter to add": "Опишите транзакцию и нажмите Enter",
"Transaction amount": "Сумма операции",
"Expenses per day trends": "Тенденции дневных расходов",
"No transactions for": "Нет транзакций за",
"Contact": "Написать нам",
"Log Out": "Выйти",
"View Source on GitHub": "Исходный код на GitHub",
"Copyright": "Разработано в",
"GNU Affero GPL License": "под лицензией GNU Affero GPL",
"Change DimeShift language": "Выбрать язык интерфейса",
"the easiest way to track your expenses": "самый простой способ вести учет финансов",
"To demonstrate how simple it is": "Чтобы показать насколько",
"we don't even ask you to register": "мы даже не просим вас вводить данные в форму регистрации",
"Just move your mouse pointer over": "Просто наведите указатель мыши",
"here": "сюда",
"and start using wallet right now!": "и начните использовать DimeShift уже сейчас!",
"Just click": "Просто нажмите",
"Screenshots": "Скриншоты",
"Easiest way to manage your personal finances online": "Самый простой способ упорядочить ваши финансы",
"Simple as it is": "Проще не придумаешь",
"Any currency": "Любая валюта",
"Create as many wallets as you need": "Создавайте сколь угодно много кошельков",
"Internalization": "Локализации",
"Just click on the globe icon in top right corner": "Доступны несколько языков интерфейса",
"Please don't forget to let us know your email address, so you can sign in to DimeShift on your next visit": "Пожалуйста, заполните ваш профиль, чтобы вы смогли войти в вашу учетную запись в следующий раз",
"Do it": "Заполнить",
"Here is quick introdution to DimeShift.<br><br>Our demo robot has created few sample wallets for you to check out.": "Позвольте нам провести небольшой тур по основным функциям DimeShift<br><br>Наш робот создал пару тестовых кошельков для тестирования.",
"But you can add as many as you want.<br><br>Different name, different currencies": "Но вы можете создать их столько, сколько захотите.<br><br>В любой валюте, с любым названием.",
"There're few options availiable when you move your mouse over your wallet.<br><br>\n\tBut lets jump directly to wallet page.<br><br>Click any row to jump to it.\n\t": "Наведите указатель на строку с названием кошелька и появятся кнопки с дополнительными функциями.<br><br>Но давайте сразу перейдем на страницу кошелька. Нажмите на любой кошелек, чтобы продолжить.",
"Let's start by adding some money to your wallet.<br><br>Click \"Add Profit\" button and fill the form in modal window. It's simple.": "Давайте для начала добавим в кошелек немного денег :)<br><br>Нажмите на эту кнопку и заполните небольшую форму во всплывающем окне. Это просто.",
"You can also set current total with \"Set Total To\" dialog.<br><br>\n\t\t\t\t\tWe don't ask you to track every transaction you've done(though you can). \n\t\t\t\t\tFeel free to update your DimeShift wallet every evening, or even once in few days.<br><br>\n\t\t\t\t\tClick \"set total to\" action link and fill the form to check how it works.": "В отличии от других подобных систем, Dimeshift разрабатывали реалисты. Мы не просим вас вводить данные о каждой транзакции, иногда бывает проще в какой-то момент установить текущую сумму.<br><br>Это можно делать каждый вечер или даже раз в несколько дней.<br><br>Если вдруг вы забыли о своем решении вести учет, а через время вернулись к этой идее - не страшно, возвращайтесь к своим кошелькам в любое время.",
"It's time to add some expense.<br><br>\n\tYou can add transaction with one string, e.g. \"99.93, best expense ever\".<br><br>\n\tPress Enter when tranasction description is ready.\n\t": "Настало время указать расходы.<br><br>Можно описать транзакцию в одну строку, например '99.99, лучшая трата в моей жизни'<br><br>Нажмите Enter, когда будет готово",
"Check out updated transactions list": "Список транзакций обновился",
"Check out expenses per day trends. Simple chart that gets updated every time you add another tranasction.": "Каждая транзакция отображается на графике, наглядно показывая ваши траты",
"Don't forget to fill your profile, so you can sign in to DimeShift next time.": "Заполните ваш профиль, чтобы иметь возможность войти в него снова",
"Select file": "Выбрать файл",
"Uploading...": "Загрузка...",
"Do not import": "Не имортировать",
"Expense amount": "Сумма траты",
"Preview": "Предпросмотр",
"Import": "Импорт",
"Back": "Назад",
"Import .xls file": "Импорт файла Excel",
"Step 1. Select .xls file to import": "Шаг 1. Выберите файл для импорта",
"Invalid xls file. Please select another one and try again": "Неверный формат файла. Попробуйте загрузить другой файл",
"Please select your local .xls file": "Выберите .xls файл на вашем компьютере",
"Step 2. Select columns to import": "Шаг 2. Веберите столбцы для импорта",
"more rows": "дополнительных строк",
"Amount and Date fields are required": "Обязательные столбцы: сумма и дата",
"Few more rows": "Еще несколько строк",
"Do not import transaction, if it's already in database": "Не импортировать транзакцию, если она уже есть в базе данных",
"Step 4. Import": "Шаг 4. Импорт",
"Finished": "Завершено",
"Import operation is finished": "Импорт завершен",
"Check out you updated wallet": "Просмотрите ваш обновленный кошелек",
"Step 3. Preview and settings": "Шаг 3. Предпросмотр",
"You don't have access to other users' wallets": "У вас нет доступа к кошелькам других пользователей",
"Goals": "Цели",
"Are you sure that you want to remove this plan?": "Вы уверены, что хотите удалить эту цель?",
"Plan name": "Название цели",
"Plan your expenses": "Планирование расходов",
"Your plans": "Ваши цели",
"View Report": "Просмотреть отчет",
"Create new": "Создать новую",
"Basic settings": "Основные настройки",
"Wallets to use for planning": "Кошельки для планирования",
"Next": "Далее",
"Plan settings": "Настройки цели",
"Current balance is": "Текущий баланс",
"Calculate in different currency": "Пересчитать в другой валюте",
"And on": "И на дату",
"Plan is to keep": "Баланс должен быть",
"Set to": "Установить в",
"So you": "Итак, вы",
"can spend up to": "можете потратить до",
"have to get": "должны добавить",
"on the next day": "завтра",
"in next": "в следующие",
"days": "дней",
"per day": "в день",
"Confirm and save": "Подтвердить и сохранить",
"Goal Details": "Детали Цели",
"From:": "От:",
"To:": "До:",
"From": "От",
"to": "до",
"Day by day report": "Отчёт по дням",
"Total On Start": "Баланс в начале дня",
"Spent": "Траты",
"Profit": "Доход",
"Plan": "Цель",
"Remove account": "Удалить учетную запись",
"Security code": "Код безопасности",
"Demo account will be removed as soon as you do log out from it.": "Демострационный аккаунт будет удален после завершения текущей сессии",
"Please think twice. All account data will be lost.": "Уверены? Все данные будут удалены безвозвратно.",
"has been mailed to your email. Please fill this form to finish account removal.": "был отправлен на ваш email. Заполните эту форму и завершите процедуру удаления",
"Your account has been removed. We will miss you :(": "Аккаунт удалён. Печалька :( Мы будем скучать.",
"Invalid": "Неверный",
"There're no goals defined for this wallet": "Для этого кошелька не определены цели",
"Set Goal": "Установить цель",
"You": "Вы",
"today": "сегодня"
}
================================================
FILE: data/i18n/ua.json
================================================
{
"Nothing is found": "Нічого не знайдено",
"Add Income": "Додати прибуток",
"Amount": "Сума",
"Description": "Опис",
"Add": "Додати",
"Saving...": "Збереження...",
"Add Wallet": "Додати гаманець",
"Name": "Ім’я",
"Currency": "Валюта",
"Select Currency": "Вибрати валюту",
"Edit Wallet": "Редагувати гаманець",
"Save": "Зберегти",
"Fill Profile": "Заповнити профіль",
"Username": "Ім’я користувача",
"Email": "",
"Password": "Пароль",
"Invalid username or password": "Невірне ім’я користувача або пароль",
"Thank you! From now, you can sign in to your account any time from any device.": "Дякуємо! Відтепер, ви можете увійти в свій обліковий запис в будь-який час з будь-якого пристрою.",
"Are you sure that you want to hide": "Ви впевнені, що ви хочете приховати",
"this wallet": "цей гаманець",
"wallet": "гаманець",
"Are you sure that you want to remove": "Ви впевнені, що ви хочете видалити",
"You will be able to restore it from Trash folder": "Ви зможете відновити його з папки Приховані",
"All wallet data(transactions etc.) will be lost": "Всі дані гаманця будуть втрачені",
"Yes, Hide It": "Так, приховати",
"Yes, Remove": "Так, видалити",
"Removing...": "Обробка...",
"Cancel": "Скасувати",
"Canceling...": "Скасування...",
"Registration": "Реєстрація",
"Sign Up": "Зареєструватися",
"Registration...": "Реєстрація...",
"Thank you! Please check your email inbox for confirmation link": "Дякуємо! Будь ласка, перевірте свою поштову скриньку. Ми відправили вам повідомлення з посиланням підтвердження вашого облікового запису",
"Already a member?": "Вже зареєстровані?",
"Sign In": "Увійти",
"Are you sure that you want to remove access for email": "Ви впевнені, що хочете видалити доступ для цієї електронної пошти",
"from this wallet": "для цього гаманця",
"from wallet": "для гаманця",
"Are you sure that you want to remove this transaction?": "Ви впевнені, що хочете видалити цю транзакцію?",
"Restore Password": "Відновити пароль",
"Restore": "Відновити",
"Processing...": "Обробка...",
"Instructions have been sent to your email address": "Інструкції були відправлені на вашу електронну пошту",
"Don't have an account?": "Не маєте облікового запису?",
"Register": "Зареєструватися",
"Set Total To": "Встановити загальну суму у",
"Total": "Загальна сума",
"Set": "Встановити",
"Username or Email": "Ім’я користувача або електронна пошта",
"Signing in...": "Обробка...",
"Restore your password": "Відновити пароль",
"Transaction Details": "Деталі транзакції",
"Date": "Дата",
"Time": "Час",
"Remove": "Видалити",
"Users with access": "Користувачі з доступом",
"to this wallet": "до цього гаманця",
"to wallet": "до гаманця",
"Only you have access to this wallet": "Тільки ви маєте доступ до цього гаманця",
"Not registered yet": "Поки що не зареєстрований",
"Remove Access": "Видалити доступ",
"Add access": "Дозволити доступ",
"Give Access": "Дозволити доступ",
"January": "Січень",
"February": "Лютий",
"March": "Березень",
"April": "Квітень",
"May": "Травень",
"June": "Червень",
"July": "Липень",
"August": "Серпень",
"September": "Вересень",
"October": "Жовтень",
"November": "Листопад",
"December": "Грудень",
"january": "січня",
"february": "лютого",
"march": "березня",
"april": "квітня",
"may": "травня",
"june": "червня",
"july": "липня",
"august": "серпня",
"september": "вересня",
"october": "жовтня",
"november": "листопада",
"december": "грудня",
"Home": "Головна",
"Settings": "Налаштування",
"Your password has been successfully changed": "Ваш пароль змінено",
"Invalid current password": "Невірний поточний пароль",
"Passwords missmatch": "Паролі не збігаються",
"New password is too short": "Новий пароль занадто короткий",
"Current Password": "Поточний пароль",
"New Password": "Новий пароль",
"Repeat Password": "Повторити новий пароль",
"Change Password": "Змінитити пароль",
"Update Password": "Змінитити пароль",
"Invalid Restore Password Code": "Невірний код відновлення",
"Restore Password Code": "Код відновлення",
"Restore Password Hash": "Хеш відновлення",
"Your Wallets": "Ваші гаманці",
"You have no wallets": "У вас немає гаманців",
"You have no hidden wallets": "У вас немає прихованих гаманців",
"Hide": "Приховати",
"Edit": "Редагувати",
"Manage Accesses": "Доступ",
"This wallet is shared with you by another user": "Доступ до цього гаманця надано іншим користувачем",
"Filter": "Фільтр",
"Active": "Активні",
"Trash": "Приховані",
"Access": "Доступ",
"Both": "Будь-які",
"Yours": "Ваші",
"Shared with you": "Інших користувачів",
"Wallets": "Гаманці",
"or": "чи",
"set total to": "встановити загальну суму у",
"Transactions": "Транзакції",
"Describe expense and press Enter to add": "Опишіть витрату і натисніть Enter",
"Transaction amount": "Сума транзакції",
"Expenses per day trends": "Тенденції витрат за день",
"No transactions for": "Немає транзакцій за",
"Contact": "Зв’язатися з нами",
"Log Out": "Вийти",
"View Source on GitHub": "Код на GitHub",
"Copyright": "Розроблено у",
"GNU Affero GPL License": "ліцензія GNU Affero GPL",
"Change DimeShift language": "Змінитити мову",
"the easiest way to track your expenses": "найпростіший спосіб ведення обліку фінансів",
"To demonstrate how simple it is": "Щоб продемонструвати як це просто",
"we don't even ask you to register": "ми навіть не просимо вас зареєструватися",
"Just move your mouse pointer over": "Просто наведіть курсор миші",
"here": "сюди",
"and start using wallet right now!": "і почніть використовувати DimeShift прямо зараз!",
"Just click": "Просто натисніть",
"Screenshots": "Скріншоти",
"Easiest way to manage your personal finances online": "",
"Simple as it is": "",
"Any currency": "",
"Create as many wallets as you need": "",
"Internalization": "",
"Just click on the globe icon in top right corner": "",
"Please don't forget to let us know your email address, so you can sign in to DimeShift on your next visit": "Будь ласка, заповніть ваш профіль, щоб ви змогли увійти в ваш обліковий запис наступного разу",
"Do it": "Заповнити",
"Here is quick introdution to DimeShift.<br><br>Our demo robot has created few sample wallets for you to check out.": "Дозвольте нам провести невеликий тур по основним функціям DimeShift.<br><br> Наш робот створив пару тестових гаманців для тестування.",
"But you can add as many as you want.<br><br>Different name, different currencies": "Але ви можете створити їх стільки, скільки забажаєте.<br><br>У будь-якій валюті, з будь-якою назвою.",
"There're few options availiable when you move your mouse over your wallet.<br><br>\n\tBut lets jump directly to wallet page.<br><br>Click any row to jump to it.\n\t": "Наведіть курсор на рядок з назвою гаманця і з'являться кнопки з додатковими функціями.<br><br>Але спочатку перейдімо на сторінку гаманця. Натисніть на будь-який гаманець, щоб продовжити.",
"Let's start by adding some money to your wallet.<br><br>Click \"Add Profit\" button and fill the form in modal window. It's simple.": "Для початку додамо в гаманець трохи грошей :)<br><br>Натисніть на цю кнопку і заповніть невелику форму у спливаючому віконці. Це просто.",
"You can also set current total with \"Set Total To\" dialog.<br><br>\n\t\t\t\t\tWe don't ask you to track every transaction you've done(though you can). \n\t\t\t\t\tFeel free to update your DimeShift wallet every evening, or even once in few days.<br><br>\n\t\t\t\t\tClick \"set total to\" action link and fill the form to check how it works.": "На відміну від інших подібних систем, DimeShift розробляли реалісти. Ми не просимо вас вводити дані про кожну транзакцію, іноді буває простіше в якийсь момент встановити поточну суму.<br><br>Це можна робити щовечора або навіть раз на кілька днів.<br><br>Якщо раптом ви забули про своє рішення вести облік, а через час повернулися до цієї ідеї - все окей, повертайтеся до своїх гаманців в будь-який час.",
"It's time to add some expense.<br><br>\n\tYou can add transaction with one string, e.g. \"99.93, best expense ever\".<br><br>\n\tPress Enter when tranasction description is ready.\n\t": "Настав час вказати витрати.<br><br>Можна описати транзакцію в один рядок, наприклад '99.99, краща трата в моєму житті'<br><br>Натисніть Enter, коли опис буде готовим",
"Check out updated transactions list": "Список транзакцій оновився",
"Check out expenses per day trends. Simple chart that gets updated every time you add another tranasction.": "Кожна транзакція відображається на графіку, наочно демонструючі ваші витрати",
"Don't forget to fill your profile, so you can sign in to DimeShift next time.": "Заповніть ваш профіль, щоб мати можливість увійти до нього наступного разу",
"Select file": "Вибрати файл",
"Uploading...": "Завантаження...",
"Do not import": "Не імпортувати",
"Expense amount": "Сума витрати",
"Preview": "Переглянути",
"Import": "Імпорт",
"Back": "Назад",
"Import .xls file": "Імпорт файла Excel",
"Step 1. Select .xls file to import": "Крок 1. Вибрати файл",
"Invalid xls file. Please select another one and try again": "Невірний формат файлу. Спробуйте інший файл",
"Please select your local .xls file": "Завантажте файл .xls з вашого комп’ютеру",
"Step 2. Select columns to import": "Крок 2. Вибрати сповпці для імпорту",
"more rows": "додаткових строк",
"Amount and Date fields are required": "Обов'язкові стовпці: сума і дата",
"Few more rows": "Ще кілька рядків",
"Do not import transaction, if it's already in database": "Не імпортувати транзакцію, якщо вона вже є в базі даних",
"Step 4. Import": "Крок 4. Імпорт",
"Finished": "Завершено",
"Import operation is finished": "Імпорт завершений",
"Check out you updated wallet": "Перегляньте ваш оновлений гаманець",
"Step 3. Preview and settings": "Крок 3. Перегляд",
"You don't have access to other users' wallets": "Інші користувачі не надавали вам доступ до своїх гаманців",
"Goals": "Цілі",
"Are you sure that you want to remove this plan?": "Ви впевнені, що хочете видалити цю ціль?",
"Plan name": "Назва цілі",
"Plan your expenses": "Планування витрат",
"Your plans": "Ваші цілі",
"View Report": "Звіт",
"Create new": "Додати нову",
"Basic settings": "Основні налаштування",
"Wallets to use for planning": "Гаманці для планування",
"Next": "Далі",
"Plan settings": "Налаштування цілі",
"Current balance is": "Поточний баланс",
"Calculate in different currency": "Перерахувати в іншій валюті",
"And on": "І на дату",
"Plan is to keep": "Баланс повинен становити",
"Set to": "Встановити у",
"So you": "Отже, ви",
"can spend up to": "можете витратити",
"have to get": "повинні додати",
"on the next day": "завтра",
"in next": "у наступні",
"days": "днів",
"per day": "у день",
"Confirm and save": "Підтвердити і зберегти",
"Goal Details": "Деталі цілі",
"From:": "Від:",
"To:": "До:",
"From": "Від",
"to": "до",
"Day by day report": "Звіт по днях",
"Total On Start": "Баланс на початку дня",
"Spent": "Витрати",
"Profit": "Дохід",
"Plan": "Ціль",
"Remove account": "Видалити аккаунт",
"Security code": "Код безпеки",
"Demo account will be removed as soon as you do log out from it.": "Демостраціонний аккаунт буде видалений після завершення поточної сесії",
"Please think twice. All account data will be lost.": "Впевнені? Усі дані будуть видалені безповоротно.",
"has been mailed to your email. Please fill this form to finish account removal.": "був відправлений на ваш email. Заповніть цю форму і завершіть процедуру видалення",
"Your account has been removed. We will miss you :(": "Аккаунт видалений :( Шкода, повертайтеся при першій нагоді, будемо чекати.",
"Invalid": "Невірній",
"There're no goals defined for this wallet": "Для цього гаманця не визначені цілі",
"Set Goal": "Встановити ціль",
"You": "Ви",
"today": "сьогодні"
}
================================================
FILE: data/mailtemplates/registration.template
================================================
Thank you for joining DimeShift
<div style="background: #31b0d5; padding: 10px;">
<a href="%site_path%" style="font-size: 20px; color: white; text-decoration: none;">$ dimeshift</a>
<div style="background: #ffffff; padding: 10px;">
<p>We appreciate your interest.</p>
<p>- The DimeShift Team</p>
</div>
</div>
================================================
FILE: data/mailtemplates/remove_account.template
================================================
Remove your DimeShift account
<div style="background: #31b0d5; padding: 10px;">
<a href="%site_path%" style="font-size: 20px; color: white; text-decoration: none;">$ dimeshift</a>
<div style="background: #ffffff; padding: 10px;">
<p>Hi %login%,</p>
<p>
Here's your code to remove DimeShift account: %remove_account_code%
</p>
<p> </p>
<p>- The DimeShift Team</p>
</div>
</div>
================================================
FILE: data/mailtemplates/restore_password.template
================================================
Restore your DimeShift password
<div style="background: #31b0d5; padding: 10px;">
<a href="%site_path%" style="font-size: 20px; color: white; text-decoration: none;">$ dimeshift</a>
<div style="background: #ffffff; padding: 10px;">
<p>Hi %login%,</p>
<p>
Use this link to restore your password:
<a href="%site_path%user/updatepassword/%password_restore_code%/%password_restore_hash%">%site_path%user/updatepassword/%password_restore_code%/%password_restore_hash%</a>
</p>
<p> </p>
<p>- The DimeShift Team</p>
</div>
</div>
================================================
FILE: data/min/.gitignore
================================================
*
!.gitignore
================================================
FILE: docs/api.md
================================================
FORMAT: 1A
HOST: http://dimeshift.com/
# DimeShift
[DimeShift](http://dimeshift.com) ([github.com/jeka-kiselyov/dimeshift](https://github.com/jeka-kiselyov/dimeshift))
DimeShift API is simple. You'll love it.
# Authentication
Set authCode HTTP header for authentication. Obtain authCode with Create a New User or Authenticate User methods.
```
request.setRequestHeader('authCode', '421a5bbd0624efebf12b2cbe5454b753');
```
================================================
FILE: includes/api.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var fs = require('fs');
var path = require('path');
var getVisitorIp = function(req) {
var ipAddr = req.headers["x-forwarded-for"];
if (ipAddr) {
var list = ipAddr.split(",");
ipAddr = list[list.length - 1];
} else {
ipAddr = req.connection.remoteAddress;
}
return ipAddr;
};
exports.requireSignedIn = function(req, callback) {
var cookies = req.cookies;
var auth_code = cookies.logged_in_user || '';
var ip = getVisitorIp(req);
if (auth_code === '')
throw new errors.HaveNoRightsError();
db.User.getByAuthCode({
auth_code: auth_code,
ip: ip
}).then(function(user) {
if (typeof(callback) == 'function')
callback(user);
}, function(err) {
throw new errors.HaveNoRightsError();
});
};
exports.getVisitorIp = getVisitorIp;
var i18n_path = path.join(__dirname, '../data/i18n');
var i18n_cache = {};
exports.geti18njson = function(code) {
if (typeof(i18n_cache[code]) !== 'undefined')
return i18n_cache[code];
i18n_cache[code] = fs.readFileSync(path.join(i18n_path, code + '.json'), 'utf8');
return i18n_cache[code];
};
var getParam = function(req, name, def) {
if (typeof(req.body) !== 'undefined' && typeof(req.body[name]) !== 'undefined')
return req.body[name];
else if (typeof(req.params) !== 'undefined' && typeof(req.params[name]) !== 'undefined')
return req.params[name];
else
return def;
};
exports.getParam = getParam;
================================================
FILE: includes/config.js
================================================
var rfr = require('rfr');
var env = process.env.NODE_ENV || 'development';
var config = rfr('config/config.json');
var net = require('net');
if (typeof(config[env]) == 'undefined')
config = config['development'];
else
config = config[env];
config['env'] = env;
config['resources'] = rfr('config/resources.json');
if (config['port'] === 0) {
var portrange = 45032
function getPort(cb) {
var port = portrange
portrange += 1
var server = net.createServer()
server.listen(port, function(err) {
server.once('close', function() {
cb(port)
})
server.close()
})
server.on('error', function(err) {
getPort(cb)
})
}
config['port'] = getPort;
}
module.exports = config;
================================================
FILE: includes/demo.js
================================================
var sequelize = require('sequelize');
exports.fillDemoAccount = function(user, callback) {
return new sequelize.Promise(function(resolve, reject) {
var rand = function(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
var currency = 'USD';
var wallet_1_name = 'Sample Cash Wallet';
var wallet_2_name = 'Sample Bank Account Wallet';
var initial_1_description = 'Profit';
var initial_2_description = 'My freelance work';
var initial_1_amount = 4000 + rand(0, 50) * 100;
var initial_2_amount = 3000 + rand(0, 50) * 100;
var now = Date.now() / 1000 | 0;
var descriptions_1 = [
'Vodka',
'Beer',
'Candies',
'Date with Sammy',
'Sausages',
'Food',
'Foods',
'Eat out',
'Mall',
'Cinema',
'Gas',
'Wi-Fi access',
'Wi-Fi',
'Wine'
];
var descriptions_2 = [
'Hosting',
'Custom Software',
'Amazon S3',
'Amazon AWS',
'Wordpress template',
'Translations',
'Data Gathering',
'CSS work',
'Adwords',
'PPC Campaign',
'PPM Campaign',
'Content writing',
'iStock',
'Shutterstock',
'Gettyimages',
'Photobank'
];
var t_to_add_1 = [];
var total_1 = initial_1_amount;
t_to_add_1.push({
amount: initial_1_amount,
description: initial_1_description,
datetime: now - 70 * 24 * 60 * 60
});
for (var i = 29; i > 0; i--) {
var amount = rand(0, (initial_1_amount / 30)) + (rand(0, 100) * 0.01);
var description = descriptions_1[Math.floor(Math.random() * descriptions_1.length)];
var datetime = now - ((i - rand(0, 80) * 0.01) * 24 * 60 * 60);
total_1 = total_1 - amount;
t_to_add_1.push({
amount: -amount,
description: description,
datetime: datetime
});
if (total_1 < 300) {
var amount = rand(100, 1000);
t_to_add_1.push({
amount: amount,
description: initial_1_description,
datetime: datetime + rand(10, 1000)
});
total_1 = total_1 + amount;
}
}
var t_to_add_2 = [];
var total_2 = initial_2_amount;
t_to_add_2.push({
amount: initial_2_amount,
description: initial_2_description,
datetime: now - 50 * 24 * 60 * 60
});
for (var i = 19; i > 0; i--) {
var amount = rand(10, 11 + (initial_2_amount / 20));
var description = descriptions_2[Math.floor(Math.random() * descriptions_2.length)];
var datetime = now - ((i - rand(0, 80) * 0.01) * 24 * 60 * 60);
if (rand(0, 5) === 1)
amount = amount - 0.01;
total_2 = total_2 - amount;
t_to_add_2.push({
amount: -amount,
description: description,
datetime: datetime
});
if (total_2 < 1000) {
var amount = rand(1, 10) * 100;
t_to_add_2.push({
amount: amount,
description: initial_2_description,
datetime: datetime + rand(10, 1000)
});
total_2 = total_2 + amount;
}
}
sequelize.Promise.map([wallet_1_name, wallet_2_name], function(name) {
return user.createWallet({
name: name,
currency: currency
});
}).spread(function(wallet_1, wallet_2) {
/// @todo: do with raw query. Too slow now.
sequelize.Promise.map(t_to_add_1, function(data) {
return wallet_1.insertTransaction({
description: data.description,
amount: data.amount,
datetime: data.datetime
});
}).then(function() {
sequelize.Promise.map(t_to_add_2, function(data) {
return wallet_2.insertTransaction({
description: data.description,
amount: data.amount,
datetime: data.datetime
});
}).then(function() {
resolve();
});
});
});
});
}
================================================
FILE: includes/errors.js
================================================
var restify = require('restify');
var util = require('util');
var restifyErrors = require('restify-errors');
function ValidationError(err) {
restifyErrors.RestError.call(this, {
restCode: 'ValidationError',
statusCode: 666,
message: [],
constructorOpt: ValidationError
});
this.name = 'ValidationError';
if (typeof(err.errors) !== 'undefined') {
for (var k in err.errors)
this.message.push(err.errors[k].message);
} else {
console.log(err);
this.message.push("" + err);
}
};
util.inherits(ValidationError, restifyErrors.RestError);
function HaveNoRightsError() {
restifyErrors.RestError.call(this, {
restCode: 'HaveNoRightsError',
statusCode: 6969,
message: 'You have no rights to call this API method with this parameters. Try to check auth hash',
constructorOpt: HaveNoRightsError
});
this.name = 'HaveNoRightsError';
};
util.inherits(HaveNoRightsError, restifyErrors.RestError);
function NotFoundError() {
restifyErrors.RestError.call(this, {
restCode: 'NotFoundError',
statusCode: 404,
message: 'Nothing is found. Please check item id',
constructorOpt: NotFoundError
});
this.name = 'NotFoundError';
};
util.inherits(NotFoundError, restifyErrors.RestError);
exports.ValidationError = ValidationError;
exports.HaveNoRightsError = HaveNoRightsError;
exports.NotFoundError = NotFoundError;
================================================
FILE: includes/exchange.js
================================================
var path = require('path');
var oxr = require('open-exchange-rates');
var fx = require('money');
var fs = require('fs');
var rfr = require('rfr');
var config = rfr('includes/config.js');
var openExchangeRatesAppId = null;
var openExchangeRatesUpdateInterval = null;
if (config.openexchangerates) {
openExchangeRatesAppId = config.openexchangerates.app_id || '';
openExchangeRatesUpdateInterval = config.openexchangerates.update_interval || 86400;
if (config.openexchangerates.use_env_variable)
openExchangeRatesAppId = process.env[openExchangeRatesAppId];
}
var cache_filename = path.join(__dirname, '..', 'data/cache/exchangerates.json');
var cached = null;
var reloadRates = function(callback) {
if (!openExchangeRatesAppId) {
console.error("Please specify openexchangerates -> app_id in config.json to enable currency conversion");
if (typeof(callback) === 'function')
callback(cached);
}
oxr.latest(function() {
cached = {};
cached.rates = oxr.rates;
cached.base = oxr.base;
fs.writeFile(cache_filename, JSON.stringify(cached, null, 2), function(){
if (typeof(callback) === 'function')
callback(cached);
});
});
};
var reloadIfNeeded = function(callback) {
fs.stat(cache_filename, function(err, stats) {
if (!stats || (stats.mtime.getTime() / 1000) < (Date.now() / 1000 | 0) - openExchangeRatesUpdateInterval) {
reloadRates(callback);
}
});
};
var cached = {
rates: {},
base: 'USD'
};
oxr.set({
app_id: openExchangeRatesAppId
});
try {
cached = JSON.parse("" + fs.readFileSync(cache_filename, 'utf8'));
} catch (e) {
console.log("No cached exchange rates\n");
}
if (cached && typeof(cached.rates) !== 'undefined' && typeof(cached.base) !== 'undefined') {
fx.rates = cached.rates;
fx.base = cached.base;
reloadIfNeeded();
} else {
reloadRates(function() {
fx.rates = cached.rates;
fx.base = cached.base;
});
}
var getRates = function() {
reloadIfNeeded();
return cached;
};
var convert = function(value, from, to) {
var ret = value;
try {
ret = fx(value).from(from).to(to);
} catch (e) {
ret = value;
}
return ret;
};
exports.fx = fx;
exports.convert = convert;
exports.getRates = getRates;
// fx(100).from('HKD').to('GBP'); // ~8.0424
================================================
FILE: includes/mailer.js
================================================
var nodemailer = require('nodemailer');
var rfr = require('rfr');
var fs = require('fs');
var config = rfr('includes/config.js');
var transporter = null;
if (config && config.smtp) {
if (config.smtp.use_env_variables) {
transporter = nodemailer.createTransport({
host: process.env[config.smtp.host],
port: process.env[config.smtp.port],
auth: {
user: process.env[config.smtp.username],
pass: process.env[config.smtp.password]
}
});
} else {
transporter = nodemailer.createTransport({
host: config.smtp.host,
port: config.smtp.port,
auth: {
user: config.smtp.username,
pass: config.smtp.password
}
});
}
if (config.default_from_email)
transporter.default_from_email = config.default_from_email;
}
var default_replaces = {};
if (config.site_path)
default_replaces.site_path = config.site_path;
var __mailtemplates_cache = {};
var sendMail = function(to, subject, html) {
if (transporter !== null)
transporter.sendMail({
from: transporter.default_from_email,
to: to,
subject: subject,
html: html
});
}
var sendTemplate = function(templateName, to, replaces) {
var doSend = function() {
var subject = __mailtemplates_cache[templateName].subject;
var body = __mailtemplates_cache[templateName].body;
for (var k in replaces) {
subject = subject.split('%' + k + '%').join(replaces[k]);
body = body.split('%' + k + '%').join(replaces[k]);
}
for (var k in default_replaces) {
subject = subject.split('%' + k + '%').join(default_replaces[k]);
body = body.split('%' + k + '%').join(default_replaces[k]);
}
sendMail(to, subject, body);
};
if (typeof(__mailtemplates_cache[templateName]) === 'undefined') {
fs.readFile('./data/mailtemplates/' + templateName + '.template', function(err, data) {
var lines = ("" + data).split("\n");
var subject = lines.shift();
var body = lines.join("\n");
__mailtemplates_cache[templateName] = {
subject: subject,
body: body
};
doSend();
});
} else {
doSend();
}
}
exports.transporter = transporter;
exports.send = sendMail;
exports.sendTemplate = sendTemplate;
================================================
FILE: includes/models/authentication.js
================================================
var crypto = require('crypto');
module.exports = function(sequelize, DataTypes) {
var Authentication = sequelize.define('Authentication', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
auth_code: DataTypes.STRING(100)
}, {
timestamps: false,
indexes: [{
unique: true,
fields: ['auth_code']
}],
freezeTableName: true,
tableName: 'authentications',
classMethods: {},
instanceMethods: {}
});
return Authentication;
};
================================================
FILE: includes/models/index.js
================================================
var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var rfr = require('rfr');
var basename = path.basename(module.filename);
var config = rfr('includes/config.js');
var db = {};
var options = {
logging: false
};
if (config.database.use_env_variable) {
var sequelize = new Sequelize(process.env[config.database.use_env_variable], options);
} else {
options.host = config.database.host || null;
options.dialect = config.database.dialect || null;
options.storage = config.database.storage || null;
if (options.storage)
options.storage = path.join(rfr.root, options.storage);
if (config.database.dialectModulePath)
options.dialectModulePath = path.join(rfr.root, config.database.dialectModulePath);
var sequelize = new Sequelize(config.database.database, config.database.username, config.database.password, options);
}
fs
.readdirSync(__dirname)
.filter(function(file) {
return (file.indexOf('.') !== 0) && (file !== basename);
})
.forEach(function(file) {
if (file.slice(-3) !== '.js') return;
var model = sequelize['import'](path.join(__dirname, file));
db[model.name] = model;
});
Object.keys(db).forEach(function(modelName) {
if (db[modelName].associate) {
db[modelName].associate(db);
}
});
sequelize.db = db;
db.sequelize = sequelize;
db.Sequelize = Sequelize;
//// Foreign keys
db['Authentication'].belongsTo(db['User'], {
foreignKey: 'user_id',
constraints: false
});
db['User'].hasMany(db['Authentication'], {
foreignKey: 'user_id',
constraints: false,
onDelete: 'CASCADE'
});
db['Wallet'].belongsTo(db['User'], {
foreignKey: 'user_id',
constraints: false
});
db['User'].hasMany(db['Wallet'], {
foreignKey: 'user_id',
constraints: false,
onDelete: 'CASCADE'
});
db['Transaction'].belongsTo(db['User'], {
foreignKey: 'user_id',
constraints: false
});
db['Transaction'].belongsTo(db['Wallet'], {
foreignKey: 'wallet_id',
constraints: false
});
db['User'].hasMany(db['Transaction'], {
foreignKey: 'user_id',
constraints: false
});
db['Wallet'].hasMany(db['Transaction'], {
foreignKey: 'wallet_id',
constraints: false,
onDelete: 'CASCADE'
});
db['WalletAccess'].belongsTo(db['Wallet'], {
foreignKey: 'wallet_id',
constraints: false
});
db['WalletAccess'].belongsTo(db['User'], {
as: 'OriginalUser',
foreignKey: 'original_user_id'
});
db['WalletAccess'].belongsTo(db['User'], {
as: 'ToUser',
foreignKey: 'to_user_id'
});
db['Wallet'].hasMany(db['WalletAccess'], {
foreignKey: 'wallet_id',
constraints: false,
onDelete: 'CASCADE'
});
db['User'].hasMany(db['WalletAccess'], {
foreignKey: 'to_user_id',
constraints: false,
onDelete: 'SET NULL'
});
db['Plan'].belongsTo(db['User'], {
foreignKey: 'user_id',
constraints: false
});
db['User'].hasMany(db['Plan'], {
foreignKey: 'user_id',
constraints: false,
onDelete: 'CASCADE'
});
db['Plan'].belongsToMany(db['Wallet'], {
as: 'wallets',
through: 'plan_wallets',
foreignKey: 'plan_id',
otherKey: 'wallet_id'
});
db['Wallet'].belongsToMany(db['Plan'], {
as: 'Plans',
through: 'plan_wallets',
foreignKey: 'wallet_id',
otherKey: 'plan_id'
});
module.exports = db;
================================================
FILE: includes/models/plan.js
================================================
var rfr = require('rfr');
var exchange = rfr('includes/exchange.js');
module.exports = function(sequelize, DataTypes) {
var Plan = sequelize.define('Plan', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
name: DataTypes.STRING(255),
goal_balance: {
type: DataTypes.FLOAT(),
defaultValue: 0
},
goal_currency: {
type: DataTypes.STRING(10),
defaultValue: 'USD'
},
goal_datetime: {
type: DataTypes.INTEGER
},
start_balance: {
type: DataTypes.FLOAT(),
defaultValue: 0
},
start_currency: {
type: DataTypes.STRING(10),
defaultValue: 'USD'
},
start_datetime: {
type: DataTypes.INTEGER
},
end_balance: {
type: DataTypes.FLOAT(),
defaultValue: 0
},
status: {
type: DataTypes.ENUM('active', 'finished'),
defaultValue: 'active',
field: "status",
validate: {
isIn: {
args: [
['active', 'finished']
],
msg: "Invalid plan status"
}
}
}
}, {
timestamps: false,
indexes: [],
freezeTableName: true,
tableName: 'plans',
classMethods: {},
instanceMethods: {
checkIfFinished: function() {
var plan = this;
return new sequelize.Promise(function(resolve, reject) {
if (plan.status == 'finished') {
resolve(plan);
return;
}
var currentDateTime = (Date.now() / 1000 | 0);
if (plan.goal_datetime <= currentDateTime) {
plan.status = 'finished';
plan.getCurrentTotal().then(function(total) {
plan.end_balance = total;
return plan.save();
}).then(function(plan) {
resolve(plan);
});
} else {
resolve(plan);
}
});
},
updateWalletsIds: function(wallets_ids) {
var plan = this;
/// remove duplicate elements
wallets_ids = wallets_ids.reduce(function(p, c) {
if (p.indexOf(c) < 0) p.push(c);
return p;
}, []);
return new sequelize.Promise(function(resolve, reject) {
/// need to check if all wallets are user's wallets
sequelize.db.Wallet.findAll({
where: {
id: {
$in: wallets_ids
}
}
}).then(function(wallets) {
var goodWalletsCount = 0;
for (var k in wallets_ids) {
for (var j in wallets)
if (wallets[j].id == wallets_ids[k] && wallets[j].user_id == plan.user_id)
goodWalletsCount++;
}
if (goodWalletsCount != wallets_ids.length)
throw "Invalid wallets ids";
plan.setWallets(wallets_ids).then(function() {
plan.save().then(function(plan) {
resolve(plan);
});
});
});
});
},
getCurrentTotal: function() {
var plan = this;
return new sequelize.Promise(function(resolve, reject) {
plan.getWallets().then(function(wallets) {
var balance = 0;
var walletTotal = 0;
for (var k in wallets) {
walletTotal = exchange.convert(wallets[k].total, wallets[k].currency, plan.goal_currency);
balance += walletTotal;
}
resolve(balance);
});
});
},
setDefaultValues: function() {
var plan = this;
return new sequelize.Promise(function(resolve, reject) {
if (!plan.start_datetime)
plan.start_datetime = Date.now() / 1000 | 0;
if (!plan.status)
plan.status = 'active';
if (!plan.name)
plan.name = 'Undefined';
if (!plan.start_currency && plan.goal_currency)
plan.start_currency = plan.goal_currency;
if (!plan.goal_currency && plan.start_currency)
plan.goal_currency = plan.start_currency;
if (!plan.start_balance && !plan.isNewRecord) {
/// get start_balance from wallets
plan.getWallets().then(function(wallets) {
var start_balance = 0;
// @todo: use exchange rates to recalculate
for (var k in wallets)
start_balance += wallets[k].total;
plan.start_balance = start_balance;
resolve(plan);
});
} else {
resolve(plan);
}
});
}
}
});
return Plan;
};
================================================
FILE: includes/models/transaction.js
================================================
var crypto = require('crypto');
module.exports = function(sequelize, DataTypes) {
var Transaction = sequelize.define('Transaction', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
description: DataTypes.STRING(255),
type: {
type: DataTypes.ENUM('profit', 'expense'),
defaultValue: 'expense',
validate: {
isIn: {
args: [
['profit', 'expense']
],
msg: "Invalid transaction type"
}
}
},
subtype: {
type: DataTypes.ENUM('setup', 'confirmed', 'planned'),
defaultValue: 'confirmed',
validate: {
isIn: {
args: [
['setup', 'confirmed', 'planned']
],
msg: "Invalid transaction subtype"
}
}
},
amount: {
type: DataTypes.FLOAT(),
defaultValue: 0
},
abs_amount: {
type: DataTypes.FLOAT(),
defaultValue: 0
},
datetime: {
type: DataTypes.INTEGER,
field: "datetime"
}
}, {
timestamps: false,
indexes: [
],
freezeTableName: true,
tableName: 'transactions',
classMethods: {},
instanceMethods: {
deleteAndCheckWallet: function() {
var setUpDiff = -this.amount;
var wallet_id = this.wallet_id;
var this_datetime = this.datetime;
var this_id = this.id;
var that = this;
return new sequelize.Promise(function(resolve, reject) {
var setUpTransaction = null;
sequelize.db.Transaction.findOne({
where: {
wallet_id: wallet_id,
subtype: 'setup',
datetime: {
$gte: this_datetime
},
id: {
$ne: this_id
}
},
order: 'datetime ASC'
}).then(function(setupTransaction) {
if (setupTransaction) {
setupTransaction.amount -= setUpDiff;
setupTransaction.save().then(function(setupTransaction) {
that.destroy();
resolve();
});
} else {
sequelize.query("UPDATE wallets SET total = total + :diff WHERE id = :id", {
replacements: {
diff: setUpDiff,
id: wallet_id
}
}).then(function() {
that.destroy();
resolve();
});
}
}, function(err) {
console.log(err);
});
});
}
}
});
return Transaction;
};
================================================
FILE: includes/models/user.js
================================================
var crypto = require('crypto');
var rfr = require('rfr');
var demo = rfr('includes/demo.js');
var mailer = rfr('includes/mailer.js');
var moment = require('moment');
module.exports = function(sequelize, DataTypes) {
var User = sequelize.define('User', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
email: {
type: DataTypes.STRING(255),
validate: {
isEmail: {
msg: "Invalid email"
},
isUnique: function(value, next) {
var that = this;
sequelize.db.User.findOne({
where: {
email: value,
id: {
$ne: this.id
}
},
attributes: ['id']
})
.then(function(foundUser) {
if (foundUser)
throw new Error('Email is already in use');
next();
}).catch(function(err) {
throw new Error('Email is already in use');
});
}
}
},
type: {
type: DataTypes.STRING(20),
defaultValue: 'default',
validate: {
isIn: {
args: [
['default', 'facebook']
],
msg: "Invalid user type"
}
}
},
password: DataTypes.STRING(50),
login: {
type: DataTypes.STRING(255),
validate: {
isUnique: function(value, next) {
var that = this;
sequelize.db.User.findOne({
where: {
login: value,
id: {
$ne: this.id
}
},
attributes: ['id']
})
.then(function(foundUser) {
if (foundUser)
throw new Error('This username is already in use');
next();
}).catch(function(err) {
throw new Error('This username is already in use');
});
}
}
},
is_demo: {
type: DataTypes.INTEGER,
defaultValue: 0,
allowNull: false
},
is_admin: {
type: DataTypes.INTEGER,
defaultValue: 0,
allowNull: false
},
registration_date: DataTypes.INTEGER,
activity_date: DataTypes.INTEGER,
registration_ip: DataTypes.STRING(20),
activity_ip: DataTypes.STRING(20),
confirmation_code: DataTypes.STRING(255),
remove_account_code: DataTypes.STRING(255),
password_restore_code: DataTypes.STRING(255),
is_banned: {
type: DataTypes.INTEGER,
defaultValue: 0,
allowNull: false
}
}, {
timestamps: false,
freezeTableName: true,
tableName: 'users',
classMethods: {
hashPassword: function(password) {
return crypto.createHash('md5').update(password + 'password_salt').digest("hex");
},
register: function(params) {
var params = params || {};
var type = params.type || 'default';
var login = params.login || '';
var password = params.password || '';
var email = params.email || '';
var ip = params.ip || null;
var is_demo = 0;
if (email == 'demo@demo.com') {
email = 'email' + Math.random() + '@example.com';
login = 'login' + Math.random();
password = 'password' + Math.random();
type = 'default';
is_demo = 1;
}
password = this.hashPassword(password);
return new sequelize.Promise(function(resolve, reject) {
var user = sequelize.db.User.build({
type: type,
email: email,
login: login,
password: password
});
user.registration_date = Date.now() / 1000 | 0;
user.registration_ip = ip;
user.is_demo = is_demo;
user.save().then(function(user) {
if (is_demo) {
demo.fillDemoAccount(user).then(function() {
resolve(user);
});
} else {
sequelize.db.WalletAccess.checkAccessForNewUser(user);
resolve(user);
}
}, function(err) {
reject(err);
});
});
},
registerDemo: function(params, callback) {
},
removeOldDemoAccounts: function() {
var maxTimestamp = (Date.now() / 1000 | 0) - 2 * 24 * 60 * 60;
return sequelize.query("DELETE FROM users WHERE is_demo = 1 AND registration_date < :max_timestamp", {
replacements: {
max_timestamp: maxTimestamp
}
});
},
updatePassword: function(code, hash, password) {
return new sequelize.Promise(function(resolve, reject) {
if (password.length < 6)
return reject('Password is too short');
sequelize.db.User.findOne({
where: {
password_restore_code: code
}
}).then(function(user) {
if (!user)
return reject('Invalid reset password code');
var restore_password_hash = sequelize.db.User.hashPassword(user.id + user.password_restore_code);
if (hash != restore_password_hash)
return reject('Invalid reset password code');
password = sequelize.db.User.hashPassword(password);
user.password = password;
return user.save();
}).then(function(user) {
resolve(user);
}, function(err) {
reject(err);
});
});
},
resetPassword: function(email) {
var restore_password_hash = '';
return new sequelize.Promise(function(resolve, reject) {
sequelize.db.User.findOne({
where: {
email: email
}
}).then(function(user) {
if (!user)
return reject('Can not find this email in our database');
user.password_restore_code = sequelize.db.User.hashPassword("" + user.id + Math.random());
restore_password_hash = sequelize.db.User.hashPassword(user.id + user.password_restore_code);
return user.save();
}).then(function(user) {
mailer.sendTemplate('restore_password', user.email, {
login: user.login,
password_restore_code: user.password_restore_code,
password_restore_hash: restore_password_hash
});
return resolve(user);
}).catch(function(e) {
return reject('Can not find this email in our database');
});
});
},
getByAuthCode: function(params, callback) {
var params = params || {};
var ip = params.ip || null;
var auth_code = params.auth_code || null;
return new sequelize.Promise(function(resolve, reject) {
sequelize.db.Authentication.findOne({
where: {
auth_code: auth_code
}
}).then(function(authentication) {
if (!authentication)
return reject('Invalid auth code');
return authentication.getUser();
}).then(function(user) {
user.activity_ip = ip;
user.activity_date = Date.now() / 1000 | 0;
user.save();
return resolve(user);
}).catch(function(e) {
return reject('Invalid auth code');
});
});
},
signIn: function(params) {
var params = params || {};
var username = params.username || '';
var password = params.password || '';
password = this.hashPassword(password);
return sequelize.db.User.findOne({
where: {
$or: [{
login: username
}, {
email: username
}],
password: password
}
});
}
},
instanceMethods: {
auth: function(params) {
var md5sum = crypto.createHash('md5');
var hash = '' + md5sum.update('' + Math.random() + this.id).digest('hex');
return this.createAuthentication({
auth_code: hash
});
},
signOut: function() {
return sequelize.query("SELECT * FROM `authentications` WHERE user_id = :user_id", {
replacements: {
user_id: this.id
}
});
},
removeAccount: function() {
var user = this;
return new sequelize.Promise(function(resolve, reject) {
user.remove_account_code = sequelize.db.User.hashPassword("del" + user.id + Math.random());
user.save().then(function(user) {
mailer.sendTemplate('remove_account', user.email, {
login: user.login,
remove_account_code: user.remove_account_code
});
return resolve(user);
});
});
},
removeAccountConfirm: function(code) {
var user = this;
return new sequelize.Promise(function(resolve, reject) {
if (user.remove_account_code && user.remove_account_code == code)
return user.destroy().then(function() {
return resolve(true);
});
else
return resolve(false);
});
},
fillProfile: function(params) {
var params = params || {};
var login = params.login || '';
var email = params.email || '';
var password = params.password || '';
var ip = params.ip || null;
password = sequelize.db.User.hashPassword(password);
if (this.is_demo) {
this.login = login;
this.email = email;
this.password = password;
this.is_demo = 0;
this.registration_ip = ip;
sequelize.db.WalletAccess.checkAccessForNewUser(this);
} else
return false;
return this.save();
},
update: function(params) {
var params = params || {};
var password = params.password || '';
var current_password = params.current_password || '';
current_password = sequelize.db.User.hashPassword(current_password);
if (current_password == this.password) {
password = sequelize.db.User.hashPassword(password);
this.password = password;
} else {
return false;
}
return this.save();
},
insertWallet: function(params) {
var params = params || {};
var name = params.name || '';
var currency = params.currency || 'USD';
return this.createWallet({
name: name,
currency: currency
});
},
getSharedWallets: function() {
return sequelize.query("SELECT wallets.* FROM wallets JOIN wallet_accesses ON wallet_accesses.wallet_id = wallets.id WHERE wallet_accesses.to_user_id = :user_id", {
replacements: {
user_id: this.id
},
model: sequelize.db.Wallet
});
},
getUserPlans: function(id) {
var where = {
'user_id': this.id
};
if (typeof(id) !== 'undefined')
where['id'] = id;
return sequelize.db.Plan.findAll({
attributes: ['id', 'user_id', 'name', 'goal_balance', 'goal_currency', 'goal_datetime', 'start_balance', 'start_currency', 'start_datetime', 'end_balance', 'status'],
where: where,
include: [{
model: sequelize.db.Wallet,
as: 'wallets',
attributes: ['id', 'name', 'total'],
through: {
attributes: []
}
}]
});
},
getUserPlan: function(id) {
var user = this;
return new sequelize.Promise(function(resolve, reject) {
user.getUserPlans(id).then(function(plans) {
if (plans.length > 0)
resolve(plans[0]);
else
resolve(null);
});
});
},
addUserPlan: function(data) {
var wallets_ids = data.wallets || [];
var user = this;
/// remove duplicate elements
wallets_ids = wallets_ids.reduce(function(p, c) {
if (p.indexOf(c) < 0) p.push(c);
return p;
}, []);
return new sequelize.Promise(function(resolve, reject) {
/// need to check if all wallets are user's wallets
sequelize.db.Wallet.findAll({
where: {
id: {
$in: wallets_ids
}
}
}).then(function(wallets) {
var goodWalletsCount = 0;
for (var k in wallets_ids) {
for (var j in wallets)
if (wallets[j].id == wallets_ids[k] && wallets[j].user_id == user.id)
goodWalletsCount++;
}
if (goodWalletsCount != wallets_ids.length)
throw "Invalid wallets ids";
user.createPlan(data).then(function(plan) {
plan.setWallets(wallets_ids).then(function() {
return plan.setDefaultValues();
}).then(function() {
return plan.save();
}).then(function(plan) {
resolve(plan);
});
});
});
});
},
getWalletIfHasAccess: function(wallet_id) {
return sequelize.db.WalletAccess.getWalletIfHasAccess(this, wallet_id);
},
getStats: function(params) {
var user = this;
var period = params.period || 'week';
if (period != 'week' && period != 'month' && period != 'year')
period = 'week';
var utcOffset = params.utcOffset || 0;
var wallet_id = params.wallet_id || null;
return new sequelize.Promise(function(resolve, reject) {
var now = moment();
now.utcOffset(utcOffset);
var retPeriods = [];
var walletsCurrencies = {};
var lowestTimestamp = now.unix();
var highestTimestamp = now.unix();
var count = 7;
if (period == 'month')
count = 31;
else if (period == 'year')
count = 12;
for (var i = 0; i < count; i++)
{
var newPeriod = {
month: now.month() + 1,
year: now.year(),
utcOffset: now.format('Z')
};
if (period == 'year')
now.startOf('month');
else {
newPeriod.day = now.date();
now.startOf('day');
}
newPeriod.fromTimestamp = now.unix(); // >=
if (newPeriod.fromTimestamp < lowestTimestamp)
lowestTimestamp = newPeriod.fromTimestamp;
if (period == 'year')
now.endOf('month');
else
now.endOf('day');
newPeriod.toTimestamp = now.unix(); // <=
if (newPeriod.toTimestamp > highestTimestamp)
highestTimestamp = newPeriod.toTimestamp;
if (period == 'year')
now.subtract(1, 'months');
else
now.subtract(1, 'days');
retPeriods.push(newPeriod);
}
user.getWallets().then(function(wallets){
var foundWallet = false;
if (wallets) {
for (var k in wallets) {
if ((wallet_id && wallets[k].id == wallet_id) || !wallet_id)
{
walletsCurrencies[wallets[k].id] = wallets[k].currency;
foundWallet = true;
}
}
}
if (!foundWallet)
return resolve(null);
var allCurrencies = [];
for (k in walletsCurrencies)
if (allCurrencies.indexOf(walletsCurrencies[k]) == -1)
allCurrencies.push(walletsCurrencies[k]);
for (k in retPeriods) {
retPeriods[k].stats = {};
for (var ak in allCurrencies)
retPeriods[k].stats[allCurrencies[ak]] = {
expense: 0,
profit: 0
}
};
var where = {
user_id: user.id,
datetime: {
$lte: highestTimestamp,
$gte: lowestTimestamp
}
};
if (wallet_id > 0)
where.wallet_id = wallet_id;
sequelize.db.Transaction.findAll({
where: where
}).then(function(transactions){
if (transactions)
for (var kt in transactions)
for (var kp in retPeriods)
{
if (transactions[kt].datetime >= retPeriods[kp].fromTimestamp && transactions[kt].datetime <= retPeriods[kp].toTimestamp)
{
var currency = walletsCurrencies[transactions[kt].wallet_id];
if (transactions[kt].amount < 0)
retPeriods[kp].stats[currency].expense += Math.abs(transactions[kt].amount);
else
retPeriods[kp].stats[currency].profit += Math.abs(transactions[kt].amount);
}
}
for (var k in retPeriods)
{
delete retPeriods[k].fromTimestamp;
delete retPeriods[k].toTimestamp;
}
resolve(retPeriods);
});
});
});
}
}
});
return User;
};
================================================
FILE: includes/models/wallet.js
================================================
var crypto = require('crypto');
module.exports = function(sequelize, DataTypes) {
var Wallet = sequelize.define('Wallet', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
name: DataTypes.STRING(255),
type: {
type: DataTypes.ENUM('default', 'user'),
defaultValue: 'default',
validate: {
isIn: {
args: [
['default', 'user']
],
msg: "Invalid wallet type"
}
}
},
status: {
type: DataTypes.ENUM('active', 'hidden'),
defaultValue: 'active',
validate: {
isIn: {
args: [
['active', 'hidden']
],
msg: "Invalid wallet status"
}
}
},
currency: {
type: DataTypes.STRING(10),
defaultValue: 'USD'
},
total: {
type: DataTypes.FLOAT(),
defaultValue: 0
}
}, {
timestamps: false,
indexes: [
],
freezeTableName: true,
tableName: 'wallets',
classMethods: {},
instanceMethods: {
giveAccess: function(params) {
var params = params || {};
var email = params.email || '';
var original_user_id = this.user_id;
var that = this;
return new sequelize.Promise(function(resolve, reject) {
sequelize.db.User.findOne({
where: {
email: email
}
}).
then(function(user) {
if (user)
return that.createWalletAccess({
to_email: email,
to_user_id: user.id,
original_user_id: original_user_id
});
else
return that.createWalletAccess({
to_email: email,
original_user_id: original_user_id
});
})
.then(function(wallet_access) {
resolve(wallet_access);
}, function(err) {
reject(err);
});
});
},
setTotalTo: function(params) {
var params = params || {};
var amount = parseFloat(params.amount, 10) || 0;
var diff = amount - this.total;
params.subtype = 'setup';
params.amount = diff;
return this.insertTransaction(params);
},
insertTransaction: function(params) {
var params = params || {};
var description = params.description || '';
var amount = parseFloat(params.amount, 10) || 0;
var abs_amount = Math.abs(amount);
var subtype = params.subtype || 'confirmed';
var currentDateTime = (Date.now() / 1000 | 0);
var datetime = currentDateTime;
var inThePast = false;
if (parseInt(params.datetime)) {
datetime = parseInt(params.datetime);
if (datetime < currentDateTime)
inThePast = true;
}
var type = 'expense';
if (amount >= 0)
type = 'profit';
var user_id = this.user_id;
var that = this;
return new sequelize.Promise(function(resolve, reject) {
that.createTransaction({
description: description,
amount: amount,
abs_amount: abs_amount,
subtype: subtype,
datetime: datetime,
type: type,
user_id: user_id
}).then(function(transaction) {
/// proccess successful calculation
if (!inThePast) {
that.total = that.total + transaction.amount;
that.save().done(function(res) {
resolve(transaction);
});
} else {
/// need to recalculate
/// find setup transaction after this current one we've added
sequelize.db.Transaction.findOne({
where: {
wallet_id: that.id,
subtype: 'setup',
datetime: {
$gt: datetime
}
},
order: 'datetime ASC'
}).then(function(setup_transaction) {
if (setup_transaction) {
/// there's setup transaction
setup_transaction.amount = setup_transaction.amount + transaction.amount;
setup_transaction.save().done(function(res) {
resolve(transaction);
});
} else {
/// no setup transaction, update wallet
that.total = that.total + transaction.amount;
that.save().done(function(res) {
resolve(transaction);
});
}
});
}
}, function(err) {
reject(err);
});
});
},
getWalletPlans: function() {
var wallet = this;
return new sequelize.Promise(function(resolve, reject) {
sequelize.db.Plan.findAll({
attributes: ['id'],
where: {
'user_id': wallet.user_id
},
include: [{
model: sequelize.db.Wallet,
as: 'wallets',
attributes: ['id', 'name', 'total'],
where: {
id: wallet.id
},
through: {
attributes: []
}
}]
}).then(function(plans) {
var ids = [];
for (var k in plans)
ids.push(plans[k].id);
sequelize.db.Plan.findAll({
attributes: ['id', 'user_id', 'name', 'goal_balance', 'goal_currency', 'goal_datetime', 'start_balance', 'start_currency', 'start_datetime', 'end_balance', 'status'],
where: {
id: {
$in: ids
}
},
include: [{
model: sequelize.db.Wallet,
as: 'wallets',
attributes: ['id', 'name', 'total'],
through: {
attributes: []
}
}]
}).then(function(plans) {
resolve(plans);
});
});
});
}
}
});
return Wallet;
};
================================================
FILE: includes/models/wallet_access.js
================================================
module.exports = function(sequelize, DataTypes) {
var Authentication = sequelize.define('WalletAccess', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
to_email: {
type: DataTypes.STRING(255),
validate: {
isEmail: {
msg: "Invalid email"
}
}
},
}, {
timestamps: false,
indexes: [{
unique: true,
fields: ['to_email']
}],
freezeTableName: true,
tableName: 'wallet_accesses',
classMethods: {
checkAccessForNewUser: function(user) {
var email = user.email;
var new_user_id = user.id;
sequelize.db.WalletAccess.findAll({
where: {
to_email: email,
to_user_id: null
}
})
.then(function(wallet_accesses) {
wallet_accesses.forEach(function(wallet_access) {
wallet_access.to_user_id = new_user_id;
wallet_access.save();
});
});
},
getWalletIfHasAccess: function(user, wallet_id) {
return new sequelize.Promise(function(resolve, reject) {
sequelize.db.Wallet.findOne({
where: {
id: wallet_id
}
})
.then(function(wallet) {
if (!wallet)
resolve(null);
if (wallet.user_id == user.id)
resolve(wallet);
else {
sequelize.query("SELECT wallets.* FROM wallets JOIN wallet_accesses ON wallet_accesses.wallet_id = wallets.id WHERE wallets.id = :wallet_id AND wallet_accesses.to_user_id = :user_id", {
replacements: {
user_id: user.id,
wallet_id: wallet_id
},
model: sequelize.db.Wallet
})
.then(function(wallets) {
if (!wallets.length)
resolve(null);
else
resolve(wallets[0]);
}, function(err) {
reject(err);
});
}
});
});
}
},
instanceMethods: {}
});
return Authentication;
};
================================================
FILE: includes/routes/exchange/exchange.apib
================================================
# Group Exchange Rates
### Get Exchange Rates [GET /api/exchange/rates]
Get cached exchange rates from OpenExchangeRates (if API key is defined in config files) or from Yahoo FX.
+ Response 200 (application/json)
+ Body
{
"base":"USD",
"rates": {
"AED":3.673,
"AFN":68.37,
"ZAR":14.5653,
"ZMK":5189.5,
"ZMW":9.2,
"ZWL":322.355
}
}
================================================
FILE: includes/routes/exchange/rates.js
================================================
var rfr = require('rfr');
var api = rfr('includes/api.js');
var exchange = rfr('includes/exchange.js');
exports.route = '/api/exchange/rates';
exports.method = 'get';
exports.handler = function(req, res, next) {
res.send(exchange.getRates());
next();
};
================================================
FILE: includes/routes/i18n/get.js
================================================
var rfr = require('rfr');
var api = rfr('includes/api.js');
exports.route = '/api/i18n/bycode/:code';
exports.method = 'get';
exports.handler = function(req, res, next) {
var code = req.params.code || en;
var body = api.geti18njson(code);
res.writeHead(200, {
'Content-Length': Buffer.byteLength(body),
'Content-Type': 'application/json'
});
res.write(body);
res.end();
next();
};
================================================
FILE: includes/routes/i18n/i18n.apib
================================================
# Group i18n
### Get language strings [GET /api/i18n/bycode/{code}]
Get i18n json file for selected locale.
+ Parameters
+ code: ua (string) - language code
+ Response 200 (application/json)
+ Body
{
"Nothing is found": "Sem resultado",
"Add Income": "Adicionar Receita",
"Amount": "Valor",
"...": "..."
}
================================================
FILE: includes/routes/index.js
================================================
var fs = require('fs');
var routes = [];
var done = false;
var callback;
var walk = function(dir, done) {
var results = [];
fs.readdir(dir, function(err, list) {
if (err) return done(err);
var i = 0;
(function next() {
var file = list[i++];
if (!file) return done(null, results);
file = dir + '/' + file;
fs.stat(file, function(err, stat) {
if (stat && stat.isDirectory()) {
walk(file, function(err, res) {
results = results.concat(res);
next();
});
} else {
results.push(file);
next();
}
});
})();
});
};
walk(__dirname, function(err, results) {
if (err) throw err;
results.forEach(function(file) {
if (file.indexOf('index.js') == -1 && file.slice(-3) === '.js') {
var name = file.substr(file.lastIndexOf('/'), file.indexOf('.'));
var inc = require(file);
routes.push({
handler: inc.handler,
route: inc.route,
method: inc.method,
docs: inc.docs
});
}
});
done = true;
if (typeof callback == 'function')
callback(routes);
});
module.exports = function(cb) {
if (done)
cb(routes);
else
callback = cb;
}
================================================
FILE: includes/routes/plans/del.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/plans/:plan_id';
exports.method = 'del';
exports.handler = function(req, res, next) {
var plan_id = req.params.plan_id || 0;
api.requireSignedIn(req, function(user) {
db.Plan.findOne({
where: {
id: plan_id,
user_id: user.id
}
})
.then(function(plan) {
if (!plan) throw new errors.HaveNoRightsError();
return plan.destroy();
}).then(function(plan) {
res.send(true);
next();
});
});
};
================================================
FILE: includes/routes/plans/get.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/plans/:plan_id';
exports.method = 'get';
exports.handler = function(req, res, next) {
var plan_id = parseInt(req.params.plan_id || 0, 10);
api.requireSignedIn(req, function(user) {
user.getUserPlan(plan_id).then(function(resPlan) {
resPlan.checkIfFinished().then(function(plan) {
res.send(plan);
next();
});
});
});
};
================================================
FILE: includes/routes/plans/list.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/plans';
exports.method = 'get';
exports.handler = function(req, res, next) {
api.requireSignedIn(req, function(user) {
user.getUserPlans().then(function(plans) {
var resPlans = [];
for (var k in plans)
resPlans.push(plans[k].checkIfFinished());
db.sequelize.Promise.all(resPlans).then(function() {
res.send(plans);
next();
});
});
});
};
================================================
FILE: includes/routes/plans/plans.apib
================================================
# Group Goals
### List User Goals [GET /api/plans]
Get list of user's goals
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
"id":1,
"name":"",
"goal_balance":1000,
"goal_currency":"USD",
"goal_datetime":null,
"start_balance":2138.02,
"start_currency":"USD",
"start_datetime":null,
"status":"active",
"wallets": [
{
"id":1,
"name":"Sample Bank Account Wallet",
"total":2138.02
}
]
}
]
### Add New Goal [POST /api/plans]
Create new goal for currently signed in user's account
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ name: Somegoalname (string, required) - Goal name.
+ start_currency: USD (string, required) - currency identifier. USD, EUR, BTC etc
+ goal_currency: USD (string, required) - currency identifier. USD, EUR, BTC etc
+ start_balance: 2138.02 (number, required) - Current balance of wallets used in this plan
+ goal_balance: 1000 (number, required) - Current balance of wallets used in this plan
+ start_datetime: (number, required) - Current unix timestamp
+ goal_datetime: (number, required) - Goal unix timestamp
+ wallets: [12,13] (array, required) - Array of wallets ids for this goal
+ Response 200 (application/json)
+ Body
{
"id":1,
"name":"",
"goal_balance":30,
"goal_currency":"USD",
"goal_datetime":23423,
"start_balance":2138.02,
"start_currency":"USD",
"start_datetime":22333,
"status":"active",
"wallets": [
{
"id":1,
"name":"Sample Bank Account Wallet",
"total":2138.02
}
]
}
### Update Goal [PUT /api/plans/{plan_id}]
Update goal
+ Parameters
+ plan_id (number) - ID of the Plan in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ name: Somegoalname (string, required) - Goal name.
+ goal_currency: USD (string, required) - currency identifier. USD, EUR, BTC etc
+ goal_balance: 1000 (number, required) - Current balance of wallets used in this plan
+ goal_datetime: (number, required) - Goal unix timestamp
+ wallets: [12,13] (array, required) - Array of wallets ids for this goal
+ Response 200 (application/json)
+ Body
{
"id":1,
"name":"",
"goal_balance":30,
"goal_currency":"USD",
"goal_datetime":23423,
"start_balance":2138.02,
"start_currency":"USD",
"start_datetime":22333,
"status":"active",
"wallets": [
{
"id":1,
"name":"Sample Bank Account Wallet",
"total":2138.02
}
]
}
### Remove Goal [DELETE /api/plans/{plan_id}]
Remove goal from database
+ Parameters
+ plan_id (number) - ID of the Plan in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
true
================================================
FILE: includes/routes/plans/post.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/plans';
exports.method = 'post';
exports.handler = function(req, res, next) {
var data = {
name: api.getParam(req, 'name', 'Undefined'),
goal_balance: api.getParam(req, 'goal_balance', 0),
goal_currency: api.getParam(req, 'goal_currency', ''),
goal_datetime: api.getParam(req, 'goal_datetime', 0),
start_balance: api.getParam(req, 'start_balance', 0),
start_currency: api.getParam(req, 'start_currency', ''),
start_datetime: api.getParam(req, 'start_datetime', 0),
status: api.getParam(req, 'status', 'active'),
wallets: api.getParam(req, 'wallets', 0)
};
api.requireSignedIn(req, function(user) {
user.addUserPlan(data).then(function(plan) {
/// loads it from db, to be sure:
user.getUserPlan(plan.id).then(function(resPlan) {
res.send(resPlan);
next();
});
});
});
};
================================================
FILE: includes/routes/plans/put.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/plans/:plan_id';
exports.method = 'put';
exports.handler = function(req, res, next) {
var plan_id = req.params.plan_id || 0;
var data = {
name: api.getParam(req, 'name', null),
goal_balance: api.getParam(req, 'goal_balance', null),
goal_currency: api.getParam(req, 'goal_currency', null),
goal_datetime: api.getParam(req, 'goal_datetime', null),
wallets: api.getParam(req, 'wallets', null)
};
api.requireSignedIn(req, function(user) {
db.Plan.findOne({
where: {
id: plan_id,
user_id: user.id
}
})
.then(function(plan) {
if (data.name !== null) plan.name = data.name;
if (data.goal_balance !== null) plan.goal_balance = data.goal_balance;
if (data.goal_currency !== null) plan.goal_currency = data.goal_currency;
if (data.goal_datetime !== null) plan.goal_datetime = data.goal_datetime;
if (data.wallets !== null)
return plan.updateWalletsIds(data.wallets);
else
return plan.save();
}).then(function(plan) {
/// loads it from db, to be sure:
user.getUserPlan(plan.id).then(function(resPlan) {
res.send(resPlan);
next();
});
});
});
};
================================================
FILE: includes/routes/stats/month.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/stats/month';
exports.method = 'get';
exports.handler = function(req, res, next) {
var utcoffset = parseInt(req.params.utcoffset || 0, 10); // http://momentjs.com/docs/#/manipulating/utc-offset/
api.requireSignedIn(req, function(user) {
user.getStats({period: 'month', utcOffset: utcoffset}).then(function(stats){
res.send(stats);
next();
});
});
};
================================================
FILE: includes/routes/stats/stats.apib
================================================
# Group Statistics
### Get Recent Week User Statistics [GET /api/stats/week]
Get recent week user statistics
+ Request (application/json)
+ Attributes (object)
+ utcoffset: (number) - Timezone offset. In hours or minutes. http://momentjs.com/docs/#/manipulating/utc-offset/
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
month: 4,
year: 2016,
day: 21,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 20,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 19,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 18,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 17,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 16,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 15,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
}
]
### Get Recent Month User Statistics [GET /api/stats/month]
Get recent month user statistics
+ Request (application/json)
+ Attributes (object)
+ utcoffset: (number) - Timezone offset. In hours or minutes. http://momentjs.com/docs/#/manipulating/utc-offset/
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
month: 4,
year: 2016,
day: 21,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 3,
year: 2016,
day: 22,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
}
]
### Get Recent Year User Statistics [GET /api/stats/year]
Get recent year user statistics
+ Request (application/json)
+ Attributes (object)
+ utcoffset: (number) - Timezone offset. In hours or minutes. http://momentjs.com/docs/#/manipulating/utc-offset/
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
month: 4,
year: 2016,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 2,
year: 2016,
utcOffset: '-03:00',
stats:
{
UAH:
{
expense: 0,
profit: 198
},
USD:
{
expense: 90,
profit: 11.99
}
}
}
]
================================================
FILE: includes/routes/stats/week.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/stats/week';
exports.method = 'get';
exports.handler = function(req, res, next) {
var utcoffset = parseInt(req.params.utcoffset || 0, 10); // http://momentjs.com/docs/#/manipulating/utc-offset/
api.requireSignedIn(req, function(user) {
user.getStats({period: 'week', utcOffset: utcoffset}).then(function(stats){
res.send(stats);
next();
});
});
};
================================================
FILE: includes/routes/stats/year.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/stats/year';
exports.method = 'get';
exports.handler = function(req, res, next) {
var utcoffset = parseInt(req.params.utcoffset || 0, 10); // http://momentjs.com/docs/#/manipulating/utc-offset/
api.requireSignedIn(req, function(user) {
user.getStats({period: 'year', utcOffset: utcoffset}).then(function(stats){
res.send(stats);
next();
});
});
};
================================================
FILE: includes/routes/users/get.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var api = rfr('includes/api.js');
var mailer = rfr('includes/mailer.js');
exports.route = '/api/users';
exports.method = 'get';
exports.handler = function(req, res, next) {
api.requireSignedIn(req, function(user) {
res.send({
login: user.login,
email: user.email,
id: user.id,
is_demo: user.is_demo
});
next();
});
};
================================================
FILE: includes/routes/users/newpassword.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var ValidationError = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/users/newpassword';
exports.method = 'post';
exports.handler = function(req, res, next) {
var code = api.getParam(req, 'code', '');
var hash = api.getParam(req, 'hash', '');
var password =api.getParam(req, 'password', '');
db.User.updatePassword(code, hash, password).then(function(user) {
res.send(true);
next();
}, function(e) {
throw e;
});
};
================================================
FILE: includes/routes/users/post.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var ValidationError = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/users';
exports.method = 'post';
exports.handler = function(req, res, next) {
var body = req.body || {};
var login = api.getParam(req, 'login', '');
var type = api.getParam(req, 'type', 'default');
var password = api.getParam(req, 'password', '');
var email = api.getParam(req, 'email', '');
var ip = api.getVisitorIp(req);
var gotUser = null;
db.User.removeOldDemoAccounts();
db.User.register({
login: login,
type: type,
password: password,
email: email,
ip: ip
}).then(function(user) {
gotUser = user;
return user.auth();
}).then(function(authentication) {
res.setCookie('logged_in_user', authentication.auth_code, {
path: '/',
maxAge: 365 * 24 * 60 * 60
});
res.setCookie('is_logged_in_user', '1', {
path: '/',
maxAge: 365 * 24 * 60 * 60
});
res.send({
id: gotUser.id,
email: gotUser.email,
login: gotUser.login,
is_demo: gotUser.is_demo,
auth_code: authentication.auth_code
});
next();
}).catch(function(e) {
throw e;
});
return true;
};
================================================
FILE: includes/routes/users/put.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/users/:user_id';
exports.method = 'put';
exports.handler = function(req, res, next) {
var user_id = req.params.user_id;
var password = api.getParam(req, 'login', null);
var email = api.getParam(req, 'email', null);
var login = api.getParam(req, 'login', null);
var current_password = api.getParam(req, 'current_password', null);
var ip = api.getVisitorIp(req);
api.requireSignedIn(req, function(user) {
var promise = false;
if (user.is_demo)
promise = user.fillProfile({
email: email,
login: login,
password: password,
ip: ip
});
else
promise = user.update({
password: password,
current_password: current_password
});
if (promise === false)
throw new errors.HaveNoRightsError();
promise.then(function(user) {
res.send({
login: user.login,
email: user.email,
id: user.id,
is_demo: user.is_demo
});
next();
});
});
};
================================================
FILE: includes/routes/users/removeaccount.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/users/:user_id/removeaccount';
exports.method = 'post';
exports.handler = function(req, res, next) {
var user_id = parseInt(req.params.user_id || 0, 10);
var code = api.getParam(req, 'code', null);
api.requireSignedIn(req, function(user) {
if (user_id != user.id)
throw 'Invalid user id';
if (code === null) /// first step, no code parameter
{
user.removeAccount().then(function(user) {
res.send(true);
next();
});
} else {
/// second step, with code
db.User.findOne({
where: {
id: user_id,
remove_account_code: code
}
}).then(function(user) {
if (!user) {
res.send(false);
next();
}
user.removeAccountConfirm(code).then(function(success) {
res.send(success);
next();
});
});
}
});
};
================================================
FILE: includes/routes/users/restore.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/users/restore';
exports.method = 'post';
exports.handler = function(req, res, next) {
var email = api.getParam(req, 'email', '');
db.User.resetPassword(email).then(function(user) {
res.send(true);
next();
}, function(e) {
throw e;
});
};
================================================
FILE: includes/routes/users/signin.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/users/signin';
exports.method = 'post';
exports.handler = function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
var username = api.getParam(req, 'username', '');
var password = api.getParam(req, 'password', '');
console.log(username);
console.log(password);
var gotUser = null;
db.User.signIn({
username: username,
password: password
}).then(function(user) {
gotUser = user;
return user.auth();
}).then(function(authentication) {
res.setCookie('logged_in_user', authentication.auth_code, {
path: '/',
maxAge: 365 * 24 * 60 * 60
});
res.setCookie('is_logged_in_user', '1', {
path: '/',
maxAge: 365 * 24 * 60 * 60
});
res.send({
id: gotUser.id,
email: gotUser.email,
login: gotUser.login,
is_demo: gotUser.is_demo,
auth_code: authentication.auth_code
});
next();
}).catch(function(e) {
throw e;
});
return true;
};
================================================
FILE: includes/routes/users/signout.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var api = rfr('includes/api.js');
exports.route = '/api/users/signout';
exports.method = 'post';
exports.handler = function(req, res, next) {
var cookies = req.cookies;
var auth_code = cookies.logged_in_user || '';
res.setCookie('logged_in_user', null, {
path: '/',
maxAge: -1
});
res.setCookie('is_logged_in_user', null, {
path: '/',
maxAge: -1
});
res.send(true);
next();
};
================================================
FILE: includes/routes/users/users.apib
================================================
# Group Users
### User [GET /api/users]
### Get Signed In User Details [GET /api/users]
Get currently signed in user details.
+ Request
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
{
"id": 23,
"email": "example@gmail.com",
"login": "userlogin",
"is_demo": 0
}
### List User Wallets [GET /api/users/:user_id/wallets]
Get list of current user's wallets
+ Parameters
+ user_id (number) - ID of the User in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
"id":4,
"name":"Cash",
"status":"active",
"currency":"EUR",
"total":300,
"origin":"mine"
},
{
"id":32,
"name":"Bitcoins",
"status":"active",
"currency":"BTC",
"total":12.99,
"origin":"shared"
}
]
### Sign In [POST /api/users/signin]
Sign in user using username and password. Returns user record with auth_code property. Use this auth_code for signing next API calls.
+ Request (application/json)
+ Attributes (object)
+ username: userlogin (string) - username or email
+ password: Hahahahahaha (string, required)
+ Response 200 (application/json)
+ Body
{
"id": 23,
"email": "example@gmail.com",
"login": "userlogin",
"is_demo": 0,
"auth_code": "017957d841c8f6927c612ea1d6602c3f"
}
### Register New User [POST /api/users]
Register new user. Returns user record with auth_code property. Use this auth_code for signing next API calls.
+ Request (application/json)
+ Attributes (object)
+ email: example@example.com (string, required)
+ login: userlogin (string, required)
+ type: default (string)
+ password: lovesecurity (string, required)
+ Response 200 (application/json)
+ Body
{
"id": 23,
"email": "example@gmail.com",
"login": "userlogin",
"is_demo": 0,
"auth_code": "017957d841c8f6927c612ea1d6602c3f"
}
### Fill Demo Account [PUT /api/users/:user_id]
Fill demo account.
+ Parameters
+ user_id (number) - ID of the User in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ email: example@example.com (string, required)
+ login: userlogin (string, required)
+ password: dolovesecurity (string, required)
+ Response 200 (application/json)
+ Body
{
"id": 23,
"email": "example@gmail.com",
"login": "userlogin",
"is_demo": 0
}
### Update User Password [PUT /api/users/:user_id]
Update user password.
+ Parameters
+ user_id (number) - ID of the User in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ current_password: lovesecurity (string, required)
+ password: dolovesecurity (string, required)
+ Response 200 (application/json)
+ Body
{
"id": 23,
"email": "example@gmail.com",
"login": "userlogin",
"is_demo": 0
}
### Reset User Password [POST /api/users/restore]
Start reset password procedure. Generate restore code and hash and send message to user's email.
+ Request (application/json)
+ Attributes (object)
+ email: example@example.com (string, required)
+ Response 200 (application/json)
+ Body
true
### Set New User Password [POST /api/users/newpassword]
Update user's password using code and hash generated with 'Reset User Password' API method.
+ Request (application/json)
+ Attributes (object)
+ code: 234234 (string, required)
+ hash: 345345345 (string, required)
+ password: dolovesecurity (string, required)
+ Response 200 (application/json)
+ Body
true
### Sign Out [POST /api/users/signout]
Signs out current user. And invalidates auth_code.
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ username: userlogin (string) - username or email
+ password: Hahahahahaha (string, required)
+ Response 200 (application/json)
+ Body
true
### Remove User Account [POST /api/users/{user_id}/removeaccount]
Start user account remove process. Sends email to user with confirmation code.
+ Parameters
+ user_id (number) - ID of the User in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
true
### Confirm User Account Removal [POST /api/users/{user_id}/removeaccount]
Confirm user account removal.
+ Parameters
+ user_id (number) - ID of the User in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ code: 223425234 (string, required) - confirmation code
+ Response 200 (application/json)
+ Body
true
================================================
FILE: includes/routes/users/wallets/list.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var api = rfr('includes/api.js');
exports.route = '/api/users/:user_id/wallets';
exports.method = 'get';
exports.handler = function(req, res, next) {
api.requireSignedIn(req, function(user) {
db.sequelize.Promise.join(
user.getWallets(),
user.getSharedWallets(),
function(own, shared) {
res.send(
shared.map(
function(wallet) {
return {
id: wallet.id,
name: wallet.name,
status: wallet.status,
currency: wallet.currency,
total: wallet.total,
origin: 'shared'
};
}
).concat(
own.map(
function(wallet) {
return {
id: wallet.id,
name: wallet.name,
status: wallet.status,
currency: wallet.currency,
total: wallet.total,
origin: 'mine'
};
}
)
)
);
next();
}
);
});
};
================================================
FILE: includes/routes/wallets/accesses/accesses.apib
================================================
# Group Wallet Access
### List Wallet Accesses [GET /api/wallets/{wallet_id}/accesses]
Get list of accesses to wallet
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
"id":11,
"to_email":"example@gmail.com",
"wallet_id":4,
"original_user_id":1,
"to_user_id":null
},
{
"id":12,
"to_email":"example2@gmail.com",
"wallet_id":4,
"original_user_id":1,
"to_user_id":88
}
]
### Add new access to wallet [POST /api/wallets/{wallet_id}/accesses]
Add new access to wallet. User registered(already or later) with to_email will be able to view wallet.
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ wallet_id: 1 (number, required) - Wallet ID. Should be the same as in URL param
+ to_email: example2@gmail.com (string, required) - Email
+ Response 200 (application/json)
+ Body
{
"id":12,
"to_email":"example2@gmail.com",
"wallet_id":4,
"original_user_id":1,
"to_user_id":88
}
### Remove Wallet Access [DELETE /api/wallets/{wallet_id}/accesses/{wallet_access_id}]
Remove access to wallet. Works only if called by original wallet owner.
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ wallet_access_id (number) - ID of the WalletAccess in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
true
================================================
FILE: includes/routes/wallets/accesses/del.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/accesses/:wallet_access_id';
exports.method = 'del';
exports.handler = function(req, res, next) {
var wallet_id = req.params.wallet_id || 0;
var wallet_access_id = req.params.wallet_access_id || 0;
api.requireSignedIn(req, function(user) {
db.WalletAccess.findOne({
where: {
id: wallet_access_id,
wallet_id: wallet_id,
original_user_id: user.id
}
})
.then(function(wallet_access) {
if (!wallet_access) throw new errors.HaveNoRightsError();
return wallet_access.destroy();
}).then(function(wallet_access) {
res.send(true);
next();
});
});
};
================================================
FILE: includes/routes/wallets/accesses/list.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/accesses';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id
}
})
.then(function(wallet) {
if (!wallet) throw new errors.HaveNoRightsError();
return db.WalletAccess.findAll({
where: {
wallet_id: wallet_id
}
});
})
.then(function(wallet_accesses) {
res.send(wallet_accesses);
next();
});
});
};
================================================
FILE: includes/routes/wallets/accesses/post.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/accesses';
exports.method = 'post';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(api.getParam(req, 'wallet_id', 0), 10);
var to_email = api.getParam(req, 'to_email', '');
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id
}
})
.then(function(wallet) {
if (!wallet) throw new errors.HaveNoRightsError();
return wallet.giveAccess({
email: to_email
});
}).then(function(wallet_access) {
res.send(wallet_access);
next();
}, function(err) {
throw err;
});
});
};
================================================
FILE: includes/routes/wallets/delete.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id';
exports.method = 'del';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id,
status: 'hidden'
}
})
.then(function(wallet) {
return wallet.destroy();
}).then(function(wallet) {
res.send(true);
next();
});
});
};
================================================
FILE: includes/routes/wallets/get.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
api.requireSignedIn(req, function(user) {
user.getWalletIfHasAccess(wallet_id)
.then(function(wallet) {
if (!wallet)
throw new errors.NotFoundError();
res.send(wallet);
next();
});
});
};
================================================
FILE: includes/routes/wallets/list.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var api = rfr('includes/api.js');
exports.route = '/api/wallets';
exports.method = 'get';
exports.handler = function(req, res, next) {
api.requireSignedIn(req, function(user) {
db.sequelize.Promise.join(
user.getWallets(),
user.getSharedWallets(),
function(own, shared) {
res.send(
shared.map(
function(wallet) {
return {
id: wallet.id,
name: wallet.name,
status: wallet.status,
currency: wallet.currency,
total: wallet.total,
origin: 'shared'
};
}
).concat(
own.map(
function(wallet) {
return {
id: wallet.id,
name: wallet.name,
status: wallet.status,
currency: wallet.currency,
total: wallet.total,
origin: 'mine'
};
}
)
)
);
next();
}
);
});
};
================================================
FILE: includes/routes/wallets/plans/list.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/plans';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id
}
})
.then(function(wallet) {
if (!wallet) throw new errors.HaveNoRightsError();
return wallet.getWalletPlans();
})
.then(function(plans) {
var resPlans = [];
for (var k in plans)
resPlans.push(plans[k].checkIfFinished());
db.sequelize.Promise.all(resPlans).then(function() {
res.send(plans);
next();
});
});
});
};
================================================
FILE: includes/routes/wallets/post.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets';
exports.method = 'post';
exports.handler = function(req, res, next) {
var name = api.getParam(req, 'name', '');
var currency = api.getParam(req, 'currency', 'USD');
api.requireSignedIn(req, function(user) {
user.insertWallet({
name: name,
currency: currency
})
.then(function(wallet) {
res.send(wallet);
next();
});
});
};
================================================
FILE: includes/routes/wallets/put.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id';
exports.method = 'put';
exports.handler = function(req, res, next) {
var wallet_id = req.params.wallet_id || 0;
var name = api.getParam(req, 'name', null);
var currency = api.getParam(req, 'currency', null);
var status = api.getParam(req, 'status', null);
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id
}
})
.then(function(wallet) {
if (name !== null) wallet.name = name;
if (currency !== null) wallet.currency = currency;
if (status !== null) wallet.status = status;
return wallet.save();
}).then(function(wallet) {
res.send(wallet);
next();
});
});
};
================================================
FILE: includes/routes/wallets/stats/month.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/stats/month';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
var utcoffset = parseInt(req.params.utcoffset || 0, 10); // http://momentjs.com/docs/#/manipulating/utc-offset/
api.requireSignedIn(req, function(user) {
user.getStats({period: 'month', utcOffset: utcoffset, wallet_id: wallet_id}).then(function(stats){
res.send(stats);
next();
});
});
};
================================================
FILE: includes/routes/wallets/stats/wallet_stats.apib
================================================
# Group Wallet Statistics
### Get Recent Week Wallet Statistics [GET /api/wallets/{wallet_id}/stats/week]
Get recent week user statistics
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Attributes (object)
+ utcoffset: (number) - Timezone offset. In hours or minutes. http://momentjs.com/docs/#/manipulating/utc-offset/
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
month: 4,
year: 2016,
day: 21,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 20,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 19,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 18,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 17,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 16,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 4,
year: 2016,
day: 15,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
}
]
### Get Recent Month Wallet Statistics [GET /api/wallets/{wallet_id}/stats/month]
Get recent month wallet statistics
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Attributes (object)
+ utcoffset: (number) - Timezone offset. In hours or minutes. http://momentjs.com/docs/#/manipulating/utc-offset/
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
month: 4,
year: 2016,
day: 21,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 3,
year: 2016,
day: 22,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
}
]
### Get Recent Year Wallet Statistics [GET /api/wallets/{wallet_id}/stats/year]
Get recent year wallet statistics
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Attributes (object)
+ utcoffset: (number) - Timezone offset. In hours or minutes. http://momentjs.com/docs/#/manipulating/utc-offset/
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
month: 4,
year: 2016,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
},
{
month: 2,
year: 2016,
utcOffset: '-03:00',
stats:
{
USD:
{
expense: 90,
profit: 11.99
}
}
}
]
================================================
FILE: includes/routes/wallets/stats/week.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/stats/week';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
var utcoffset = parseInt(req.params.utcoffset || 0, 10); // http://momentjs.com/docs/#/manipulating/utc-offset/
api.requireSignedIn(req, function(user) {
user.getStats({period: 'week', utcOffset: utcoffset, wallet_id: wallet_id}).then(function(stats){
res.send(stats);
next();
});
});
};
================================================
FILE: includes/routes/wallets/stats/year.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/stats/year';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
var utcoffset = parseInt(req.params.utcoffset || 0, 10); // http://momentjs.com/docs/#/manipulating/utc-offset/
api.requireSignedIn(req, function(user) {
user.getStats({period: 'year', utcOffset: utcoffset, wallet_id: wallet_id}).then(function(stats){
res.send(stats);
next();
});
});
};
================================================
FILE: includes/routes/wallets/transactions/del.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/transactions/:transaction_id';
exports.method = 'del';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
var transaction_id = parseInt(req.params.transaction_id || 0, 10);
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id
}
})
.then(function(wallet) {
if (!wallet) throw new errors.NotFoundError();
return db.Transaction.findOne({
where: {
id: transaction_id,
wallet_id: wallet.id
}
});
}).then(function(transaction) {
if (!transaction) throw new errors.NotFoundError();
return transaction.deleteAndCheckWallet();
}).then(function() {
res.send(true);
next();
})
});
};
================================================
FILE: includes/routes/wallets/transactions/list.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/transactions';
exports.method = 'get';
exports.handler = function(req, res, next) {
var wallet_id = parseInt(req.params.wallet_id || 0, 10);
var to = parseInt(req.params.to || 0, 10);
var from = parseInt(req.params.from || 0, 10);
if (to === 0 || from === 0) {
to = Math.floor(Date.now() / 1000);
from = to - 24 * 60 * 60 * 31;
}
api.requireSignedIn(req, function(user) {
user.getWalletIfHasAccess(wallet_id)
.then(function(wallet) {
if (!wallet) throw new errors.HaveNoRightsError();
return db.Transaction.findAll({
where: {
wallet_id: wallet.id,
datetime: {
$lte: to,
$gt: from
}
},
order: [['datetime', 'DESC']]
});
}).then(function(transactions) {
res.send(transactions);
next();
});
});
};
================================================
FILE: includes/routes/wallets/transactions/post.js
================================================
var rfr = require('rfr');
var db = rfr('includes/models');
var errors = rfr('includes/errors.js');
var api = rfr('includes/api.js');
exports.route = '/api/wallets/:wallet_id/transactions';
exports.method = 'post';
exports.handler = function(req, res, next) {
var body = req.body || {};
var wallet_id = api.getParam(req, 'wallet_id', 0);
var amount = api.getParam(req, 'amount', 0);
var description = api.getParam(req, 'description', '');
var subtype = api.getParam(req, 'subtype', 'confirmed');
var datetime = api.getParam(req, 'datetime', null);
api.requireSignedIn(req, function(user) {
db.Wallet.findOne({
where: {
id: wallet_id,
user_id: user.id
}
})
.then(function(wallet) {
if (!wallet) throw new errors.HaveNoRightsError();
if (subtype == 'setup')
return wallet.setTotalTo({
description: description,
amount: amount
});
else
return wallet.insertTransaction({
description: description,
amount: amount,
datetime: datetime
});
}).then(function(transaction) {
res.send(transaction);
next();
});
});
};
================================================
FILE: includes/routes/wallets/transactions/transactions.apib
================================================
# Group Transactions
### List Wallet Transactions [GET /api/wallets/{wallet_id}/transactions]
Get list of wallet's transactions
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Attributes (object)
+ from: (number) - From unix timestamp. Default is now() - 1 month
+ to: (string) - To unix timestamp. Default is now()
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Response 200 (application/json)
+ Body
[
{
"id":53402,
"description":"Desc",
"amount":-42.33,
"abs_amount":42.33,
"subtype":"confirmed",
"datetime":1449706027,
"type":"expense",
"user_id":1,
"wallet_id":2103
},
{
"id":53412,
"description":"Text",
"amount":0.99,
"abs_amount":0.99,
"subtype":"confirmed",
"datetime":1449736027,
"type":"profit",
"user_id":1,
"wallet_id":2103
}
]
### Add New Transaction [POST /api/wallets/{wallet_id}/transactions]
Add new transaction
+ Parameters
+ wallet_id (number) - ID of the Wallet in the form of an integer
+ Request (application/json)
+ Headers
authCode: 421a5bbd0624efebf12b2cbe5454b753
+ Attributes (object)
+ wallet_id: 1 (number, required) - Wallet ID. Should be the same as in URL param
+ amount: 9.99 (number, required) - Transaction amount
+ description: Some description (string) - Transaction description
+ subtype: confirmed (string) - Transaction subtype. Default is 'confirmed'. If subtype is 'setup', it sets wallet total to amount.
+ datetime: (number) - Default is current unix timestamp
+ Response 200 (application/json)
+ Body
{
"id":53402,
"description":"Desc",
"amount":-42.33,
"abs_amount":42.33,
"subtype":"confirmed",
"datetime":1449706027,
"type":"expense",
"user_id":1,
"wallet_id":2103
}
### Remove Transaction [DELETE /api/wallets/{wallet_id}/transaction
gitextract__uiwwo29/
├── .bowerrc
├── .gitignore
├── .rebooted
├── Gruntfile.js
├── LICENSE
├── Procfile
├── README.md
├── app.json
├── bower.json
├── config/
│ ├── config.json
│ ├── currencies.json
│ ├── pages.json
│ └── resources.json
├── data/
│ ├── cache/
│ │ └── .gitignore
│ ├── i18n/
│ │ ├── en.json
│ │ ├── ptbr.json
│ │ ├── ru.json
│ │ └── ua.json
│ ├── mailtemplates/
│ │ ├── registration.template
│ │ ├── remove_account.template
│ │ └── restore_password.template
│ └── min/
│ └── .gitignore
├── docs/
│ └── api.md
├── includes/
│ ├── api.js
│ ├── config.js
│ ├── demo.js
│ ├── errors.js
│ ├── exchange.js
│ ├── mailer.js
│ ├── models/
│ │ ├── authentication.js
│ │ ├── index.js
│ │ ├── plan.js
│ │ ├── transaction.js
│ │ ├── user.js
│ │ ├── wallet.js
│ │ └── wallet_access.js
│ ├── routes/
│ │ ├── exchange/
│ │ │ ├── exchange.apib
│ │ │ └── rates.js
│ │ ├── i18n/
│ │ │ ├── get.js
│ │ │ └── i18n.apib
│ │ ├── index.js
│ │ ├── plans/
│ │ │ ├── del.js
│ │ │ ├── get.js
│ │ │ ├── list.js
│ │ │ ├── plans.apib
│ │ │ ├── post.js
│ │ │ └── put.js
│ │ ├── stats/
│ │ │ ├── month.js
│ │ │ ├── stats.apib
│ │ │ ├── week.js
│ │ │ └── year.js
│ │ ├── users/
│ │ │ ├── get.js
│ │ │ ├── newpassword.js
│ │ │ ├── post.js
│ │ │ ├── put.js
│ │ │ ├── removeaccount.js
│ │ │ ├── restore.js
│ │ │ ├── signin.js
│ │ │ ├── signout.js
│ │ │ ├── users.apib
│ │ │ └── wallets/
│ │ │ └── list.js
│ │ └── wallets/
│ │ ├── accesses/
│ │ │ ├── accesses.apib
│ │ │ ├── del.js
│ │ │ ├── list.js
│ │ │ └── post.js
│ │ ├── delete.js
│ │ ├── get.js
│ │ ├── list.js
│ │ ├── plans/
│ │ │ └── list.js
│ │ ├── post.js
│ │ ├── put.js
│ │ ├── stats/
│ │ │ ├── month.js
│ │ │ ├── wallet_stats.apib
│ │ │ ├── week.js
│ │ │ └── year.js
│ │ ├── transactions/
│ │ │ ├── del.js
│ │ │ ├── list.js
│ │ │ ├── post.js
│ │ │ └── transactions.apib
│ │ └── wallets.apib
│ ├── servers/
│ │ ├── images_server.js
│ │ ├── index.js
│ │ ├── index_server.js
│ │ ├── minify_server.js
│ │ ├── public_server.js
│ │ └── static_file_server.js
│ ├── test/
│ │ ├── planning.test.js
│ │ ├── stats.test.js
│ │ └── wallet.test.js
│ └── test.js
├── index.js
├── package.json
├── public/
│ ├── css/
│ │ ├── .gitignore
│ │ ├── main.css
│ │ └── parts/
│ │ ├── dialogs/
│ │ │ ├── base.css
│ │ │ ├── registration.css
│ │ │ └── signin.css
│ │ ├── head.css
│ │ ├── home.css
│ │ ├── icons.css
│ │ ├── import.css
│ │ ├── overload.css
│ │ ├── page_transitions.css
│ │ ├── sticked_footer.css
│ │ ├── text_format.css
│ │ ├── wallets.css
│ │ └── widgets.css
│ ├── index.html
│ ├── jstemplates/
│ │ ├── 404.tpl
│ │ ├── dialogs/
│ │ │ ├── add_profit.tpl
│ │ │ ├── add_wallet.tpl
│ │ │ ├── change_language.tpl
│ │ │ ├── edit_wallet.tpl
│ │ │ ├── fill_profile.tpl
│ │ │ ├── hide_wallet.tpl
│ │ │ ├── registration.tpl
│ │ │ ├── remove_access.tpl
│ │ │ ├── remove_plan.tpl
│ │ │ ├── remove_transaction.tpl
│ │ │ ├── restore.tpl
│ │ │ ├── set_total_to.tpl
│ │ │ ├── signin.tpl
│ │ │ ├── transaction_details.tpl
│ │ │ └── wallet_accesses.tpl
│ │ ├── months.tpl
│ │ ├── pages/
│ │ │ ├── import/
│ │ │ │ └── xls.tpl
│ │ │ ├── index/
│ │ │ │ └── index.tpl
│ │ │ ├── plans/
│ │ │ │ ├── index.tpl
│ │ │ │ └── view.tpl
│ │ │ ├── profile/
│ │ │ │ └── index.tpl
│ │ │ ├── user/
│ │ │ │ ├── confirm.tpl
│ │ │ │ ├── index.tpl
│ │ │ │ ├── registration.tpl
│ │ │ │ ├── restore.tpl
│ │ │ │ ├── signin.tpl
│ │ │ │ └── update_password.tpl
│ │ │ └── wallets/
│ │ │ ├── index.tpl
│ │ │ └── view.tpl
│ │ └── parts/
│ │ ├── transactions.tpl
│ │ └── wallet_plans.tpl
│ └── scripts/
│ ├── .gitignore
│ ├── app/
│ │ ├── abstract/
│ │ │ ├── dialog.js
│ │ │ └── page.js
│ │ ├── collections/
│ │ │ ├── plans.js
│ │ │ ├── transactions.js
│ │ │ ├── users.js
│ │ │ ├── wallets.js
│ │ │ └── wallets_accesses.js
│ │ ├── exchange.js
│ │ ├── helper.js
│ │ ├── i18n.js
│ │ ├── local_storage.js
│ │ ├── log.js
│ │ ├── models/
│ │ │ ├── plan.js
│ │ │ ├── transaction.js
│ │ │ ├── user.js
│ │ │ ├── wallet.js
│ │ │ └── wallets_access.js
│ │ ├── router.js
│ │ ├── settings.js
│ │ ├── template_manager.js
│ │ ├── view_stack.js
│ │ └── views/
│ │ ├── charts/
│ │ │ └── balance.js
│ │ ├── dialogs/
│ │ │ ├── add_profit.js
│ │ │ ├── add_wallet.js
│ │ │ ├── change_language.js
│ │ │ ├── edit_wallet.js
│ │ │ ├── fill_profile.js
│ │ │ ├── hide_wallet.js
│ │ │ ├── logout.js
│ │ │ ├── registration.js
│ │ │ ├── remove_access.js
│ │ │ ├── remove_plan.js
│ │ │ ├── remove_transaction.js
│ │ │ ├── restore.js
│ │ │ ├── set_total_to.js
│ │ │ ├── signin.js
│ │ │ ├── transaction_details.js
│ │ │ └── wallet_accesses.js
│ │ ├── header.js
│ │ ├── pages/
│ │ │ ├── 404.js
│ │ │ ├── import_xls.js
│ │ │ ├── index.js
│ │ │ ├── plan.js
│ │ │ ├── plans.js
│ │ │ ├── profile.js
│ │ │ ├── update_password.js
│ │ │ ├── wallet.js
│ │ │ └── wallets.js
│ │ ├── parts/
│ │ │ ├── profile_change_password.js
│ │ │ ├── profile_remove_account.js
│ │ │ ├── transactions.js
│ │ │ └── wallet_plans.js
│ │ ├── tours/
│ │ │ ├── wallet.js
│ │ │ └── wallets.js
│ │ └── widgets/
│ │ └── index.js
│ ├── app.js
│ ├── functions.js
│ ├── setup.js
│ └── table_helper.js
└── tools/
├── check_i18n_files.js
└── harvest_i18n_strings.js
SYMBOL INDEX (27 symbols across 8 files)
FILE: includes/config.js
function getPort (line 16) | function getPort(cb) {
FILE: includes/errors.js
function ValidationError (line 5) | function ValidationError(err) {
function HaveNoRightsError (line 24) | function HaveNoRightsError() {
function NotFoundError (line 35) | function NotFoundError() {
FILE: includes/servers/images_server.js
function serveImage (line 8) | function serveImage(opts) {
FILE: includes/servers/index_server.js
function serveIndex (line 4) | function serveIndex(opts) {
FILE: includes/servers/minify_server.js
function serve (line 13) | function serve(name) {
FILE: includes/servers/static_file_server.js
function serveStatic (line 8) | function serveStatic(opts) {
FILE: public/scripts/functions.js
function isEmail (line 1) | function isEmail(email) {
function md5cycle (line 7) | function md5cycle(x, k) {
function cmn (line 88) | function cmn(q, a, b, x, s, t) {
function ff (line 93) | function ff(a, b, c, d, x, s, t) {
function gg (line 97) | function gg(a, b, c, d, x, s, t) {
function hh (line 101) | function hh(a, b, c, d, x, s, t) {
function ii (line 105) | function ii(a, b, c, d, x, s, t) {
function md51 (line 109) | function md51(s) {
function md5blk (line 145) | function md5blk(s) { /* I figured global was faster. */
function rhex (line 159) | function rhex(n) {
function hex (line 167) | function hex(x) {
function md5 (line 173) | function md5(s) {
function add32 (line 183) | function add32(a, b) {
function add32 (line 188) | function add32(x, y) {
FILE: public/scripts/table_helper.js
function sort (line 8) | function sort(column) {
function show_search (line 13) | function show_search() {
function do_search (line 18) | function do_search() {
function remove_search (line 23) | function remove_search() {
function remove_item (line 29) | function remove_item(item_id) {
Condensed preview — 202 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (576K chars).
[
{
"path": ".bowerrc",
"chars": 35,
"preview": "{\n\t\"directory\": \"public/vendors/\"\n}"
},
{
"path": ".gitignore",
"chars": 62,
"preview": "node_modules\npublic/vendors\nnpm-debug.log\ndata/database.sqlite"
},
{
"path": ".rebooted",
"chars": 8,
"preview": "rebooted"
},
{
"path": "Gruntfile.js",
"chars": 3149,
"preview": "module.exports = function(grunt) {\n\n grunt.initConfig({\n concurrent: {\n dev: {\n tasks: ['nodemon', 'watc"
},
{
"path": "LICENSE",
"chars": 34521,
"preview": " GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C)"
},
{
"path": "Procfile",
"chars": 18,
"preview": "web: node index.js"
},
{
"path": "README.md",
"chars": 1801,
"preview": "# DimeShift - easiest way to track your expenses. Online. Open-source. Free\n* node.js\n* npm\n* Front-end: jQuery, Bootstr"
},
{
"path": "app.json",
"chars": 469,
"preview": "{\n\t\"name\": \"dimeshift\",\n\t\"description\": \"Webapp to track and manage personal finances\",\n\t\"repository\": \"https://github.c"
},
{
"path": "bower.json",
"chars": 1068,
"preview": "{\n \"name\": \"DimeShift\",\n \"version\": \"0.1.34\",\n \"authors\": [\n \"jeka911 <jeka911@gmail.com>\"\n ],\n \"description\": \""
},
{
"path": "config/config.json",
"chars": 2061,
"preview": "{\n \"development\": {\n \"port\": 8080,\n \"database\": {\n \"dialect\": \"sqlite\",\n \"username\": \"root\",\n \"pas"
},
{
"path": "config/currencies.json",
"chars": 4609,
"preview": "{\n\t\"AED\": \"United Arab Emirates Dirham\",\n\t\"AFN\": \"Afghan Afghani\",\n\t\"ALL\": \"Albanian Lek\",\n\t\"AMD\": \"Armenian Dram\",\n\t\"AN"
},
{
"path": "config/pages.json",
"chars": 259,
"preview": "{\n\t\"/*\": \"Index\",\n\t\"/wallets\": \"Wallets\",\n\t\"/profile\": \"Profile\",\n\t\"/plans\": \"Plans\",\n\t\"/plans/:id\": \"Plan\",\n\t\"/wallets/"
},
{
"path": "config/resources.json",
"chars": 2148,
"preview": "{\n\t\"javascript\": [\n\t\t\"./public/vendors/jquery/jquery.min.js\",\n\t\t\"./public/vendors/bootstrap/js/modal.js\",\n\t\t\"./public/ve"
},
{
"path": "data/cache/.gitignore",
"chars": 27,
"preview": "exchangerates.json\napi.apib"
},
{
"path": "data/i18n/en.json",
"chars": 7172,
"preview": "{\n \"Nothing is found\": \"\",\n \"Add Income\": \"\",\n \"Amount\": \"\",\n \"Description\": \"\",\n \"Desciption\": \"\",\n \"Add\": \"\",\n "
},
{
"path": "data/i18n/ptbr.json",
"chars": 11544,
"preview": "{\n \"Nothing is found\": \"Sem resultado\",\n \"Add Income\": \"Adicionar Receita\",\n \"Amount\": \"Valor\",\n \"Description\": \"Des"
},
{
"path": "data/i18n/ru.json",
"chars": 12136,
"preview": "{\n \"Nothing is found\": \"Ничего не найдено\",\n \"Add Income\": \"Добавить доход\",\n \"Amount\": \"Сумма\",\n \"Description\": \"Оп"
},
{
"path": "data/i18n/ua.json",
"chars": 12039,
"preview": "{\n \"Nothing is found\": \"Нічого не знайдено\",\n \"Add Income\": \"Додати прибуток\",\n \"Amount\": \"Сума\",\n \"Description\": \"О"
},
{
"path": "data/mailtemplates/registration.template",
"chars": 322,
"preview": "Thank you for joining DimeShift\n\n<div style=\"background: #31b0d5; padding: 10px;\">\n\t<a href=\"%site_path%\" style=\"font-si"
},
{
"path": "data/mailtemplates/remove_account.template",
"chars": 400,
"preview": "Remove your DimeShift account\n\n<div style=\"background: #31b0d5; padding: 10px;\">\n\t<a href=\"%site_path%\" style=\"font-size"
},
{
"path": "data/mailtemplates/restore_password.template",
"chars": 550,
"preview": "Restore your DimeShift password\n\n<div style=\"background: #31b0d5; padding: 10px;\">\n\t<a href=\"%site_path%\" style=\"font-si"
},
{
"path": "data/min/.gitignore",
"chars": 13,
"preview": "*\n!.gitignore"
},
{
"path": "docs/api.md",
"chars": 428,
"preview": "FORMAT: 1A\nHOST: http://dimeshift.com/\n\n# DimeShift\n\n[DimeShift](http://dimeshift.com) ([github.com/jeka-kiselyov/dimesh"
},
{
"path": "includes/api.js",
"chars": 1477,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar fs = require('fs'"
},
{
"path": "includes/config.js",
"chars": 700,
"preview": "var rfr = require('rfr');\nvar env = process.env.NODE_ENV || 'development';\nvar config = rfr('config/config.json');\nvar n"
},
{
"path": "includes/demo.js",
"chars": 3544,
"preview": "var sequelize = require('sequelize');\n\nexports.fillDemoAccount = function(user, callback) {\n\treturn new sequelize.Promis"
},
{
"path": "includes/errors.js",
"chars": 1385,
"preview": "var restify = require('restify');\nvar util = require('util');\nvar restifyErrors = require('restify-errors');\n\nfunction V"
},
{
"path": "includes/exchange.js",
"chars": 2222,
"preview": "var path = require('path');\nvar oxr = require('open-exchange-rates');\nvar fx = require('money');\nvar fs = require('fs');"
},
{
"path": "includes/mailer.js",
"chars": 2131,
"preview": "var nodemailer = require('nodemailer');\nvar rfr = require('rfr');\nvar fs = require('fs');\n\nvar config = rfr('includes/co"
},
{
"path": "includes/models/authentication.js",
"chars": 482,
"preview": "var crypto = require('crypto');\n\nmodule.exports = function(sequelize, DataTypes) {\n\tvar Authentication = sequelize.defin"
},
{
"path": "includes/models/index.js",
"chars": 3204,
"preview": "var fs = require('fs');\nvar path = require('path');\nvar Sequelize = require('sequelize');\nvar rfr = require('rfr');\nvar "
},
{
"path": "includes/models/plan.js",
"chars": 3998,
"preview": "var rfr = require('rfr');\nvar exchange = rfr('includes/exchange.js');\n\nmodule.exports = function(sequelize, DataTypes) {"
},
{
"path": "includes/models/transaction.js",
"chars": 2208,
"preview": "var crypto = require('crypto');\n\nmodule.exports = function(sequelize, DataTypes) {\n\tvar Transaction = sequelize.define('"
},
{
"path": "includes/models/user.js",
"chars": 14931,
"preview": "var crypto = require('crypto');\nvar rfr = require('rfr');\nvar demo = rfr('includes/demo.js');\nvar mailer = rfr('includes"
},
{
"path": "includes/models/wallet.js",
"chars": 5203,
"preview": "var crypto = require('crypto');\n\nmodule.exports = function(sequelize, DataTypes) {\n\tvar Wallet = sequelize.define('Walle"
},
{
"path": "includes/models/wallet_access.js",
"chars": 1888,
"preview": "module.exports = function(sequelize, DataTypes) {\n\tvar Authentication = sequelize.define('WalletAccess', {\n\t\tid: {\n\t\t\tty"
},
{
"path": "includes/routes/exchange/exchange.apib",
"chars": 530,
"preview": "# Group Exchange Rates\n\n### Get Exchange Rates [GET /api/exchange/rates]\n\nGet cached exchange rates from OpenExchangeRat"
},
{
"path": "includes/routes/exchange/rates.js",
"chars": 257,
"preview": "var rfr = require('rfr');\nvar api = rfr('includes/api.js');\nvar exchange = rfr('includes/exchange.js');\n\nexports.route ="
},
{
"path": "includes/routes/i18n/get.js",
"chars": 395,
"preview": "var rfr = require('rfr');\nvar api = rfr('includes/api.js');\n\nexports.route = '/api/i18n/bycode/:code';\nexports.method = "
},
{
"path": "includes/routes/i18n/i18n.apib",
"chars": 359,
"preview": "# Group i18n\n\n### Get language strings [GET /api/i18n/bycode/{code}]\n\nGet i18n json file for selected locale.\n\n+ Paramet"
},
{
"path": "includes/routes/index.js",
"chars": 1236,
"preview": "var fs = require('fs');\nvar routes = [];\n\nvar done = false;\nvar callback;\n\nvar walk = function(dir, done) {\n var result"
},
{
"path": "includes/routes/plans/del.js",
"chars": 594,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/plans/get.js",
"chars": 498,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/plans/list.js",
"chars": 527,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/plans/plans.apib",
"chars": 3975,
"preview": "# Group Goals\n\n### List User Goals [GET /api/plans]\n\nGet list of user's goals\n\n+ Request (application/json)\n\n + Heade"
},
{
"path": "includes/routes/plans/post.js",
"chars": 973,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/plans/put.js",
"chars": 1299,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/stats/month.js",
"chars": 522,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/stats/stats.apib",
"chars": 5888,
"preview": "# Group Statistics\n\n### Get Recent Week User Statistics [GET /api/stats/week]\n\nGet recent week user statistics\n\n+ Reques"
},
{
"path": "includes/routes/stats/week.js",
"chars": 520,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/stats/year.js",
"chars": 520,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/users/get.js",
"chars": 398,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar api = rfr('includes/api.js');\nvar mailer = rfr('includes/"
},
{
"path": "includes/routes/users/newpassword.js",
"chars": 527,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar ValidationError = rfr('includes/errors.js');\nvar api = rf"
},
{
"path": "includes/routes/users/post.js",
"chars": 1187,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar ValidationError = rfr('includes/errors.js');\nvar api = rf"
},
{
"path": "includes/routes/users/put.js",
"chars": 1067,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/users/removeaccount.js",
"chars": 942,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/users/restore.js",
"chars": 407,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/users/signin.js",
"chars": 1061,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/users/signout.js",
"chars": 455,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar api = rfr('includes/api.js');\n\nexports.route = '/api/user"
},
{
"path": "includes/routes/users/users.apib",
"chars": 5462,
"preview": "# Group Users\n\n### User [GET /api/users]\n### Get Signed In User Details [GET /api/users]\n\nGet currently signed in user d"
},
{
"path": "includes/routes/users/wallets/list.js",
"chars": 941,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar api = rfr('includes/api.js');\n\nexports.route = '/api/user"
},
{
"path": "includes/routes/wallets/accesses/accesses.apib",
"chars": 2033,
"preview": "# Group Wallet Access\n\n### List Wallet Accesses [GET /api/wallets/{wallet_id}/accesses]\n\nGet list of accesses to wallet\n"
},
{
"path": "includes/routes/wallets/accesses/del.js",
"chars": 776,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/accesses/list.js",
"chars": 725,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/accesses/post.js",
"chars": 782,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/delete.js",
"chars": 595,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/get.js",
"chars": 521,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/list.js",
"chars": 925,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar api = rfr('includes/api.js');\n\nexports.route = '/api/wall"
},
{
"path": "includes/routes/wallets/plans/list.js",
"chars": 809,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/post.js",
"chars": 523,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/put.js",
"chars": 855,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/stats/month.js",
"chars": 621,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/stats/wallet_stats.apib",
"chars": 4839,
"preview": "# Group Wallet Statistics\n\n### Get Recent Week Wallet Statistics [GET /api/wallets/{wallet_id}/stats/week]\n\nGet recent w"
},
{
"path": "includes/routes/wallets/stats/week.js",
"chars": 619,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/stats/year.js",
"chars": 619,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/transactions/del.js",
"chars": 941,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/transactions/list.js",
"chars": 963,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/transactions/post.js",
"chars": 1120,
"preview": "var rfr = require('rfr');\nvar db = rfr('includes/models');\nvar errors = rfr('includes/errors.js');\nvar api = rfr('includ"
},
{
"path": "includes/routes/wallets/transactions/transactions.apib",
"chars": 2770,
"preview": "# Group Transactions\n\n### List Wallet Transactions [GET /api/wallets/{wallet_id}/transactions]\n\nGet list of wallet's tra"
},
{
"path": "includes/routes/wallets/wallets.apib",
"chars": 4333,
"preview": "# Group Wallets\n\n### List User Wallets [GET /api/wallets]\n\nGet list of current user's wallets\n\n+ Request (application/js"
},
{
"path": "includes/servers/images_server.js",
"chars": 2745,
"preview": "'use strict';\n\nvar rfr = require('rfr');\nvar fs = require('fs');\nvar path = require('path');\nvar mime = require('mime');"
},
{
"path": "includes/servers/index.js",
"chars": 243,
"preview": "var fs = require('fs');\nvar servers = {};\n\nfs.readdirSync(__dirname).forEach(function(file) {\n\tif (file == \"index.js\") r"
},
{
"path": "includes/servers/index_server.js",
"chars": 313,
"preview": "var restify = require('restify');\n\n\nfunction serveIndex(opts) {\n\tvar indexFile = opts.indexFile || 'index.html';\n\tvar in"
},
{
"path": "includes/servers/minify_server.js",
"chars": 8088,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar zlib = require('zlib');\nvar path = require('path');\n\nvar UglifyJS = require(\""
},
{
"path": "includes/servers/public_server.js",
"chars": 205,
"preview": "var restify = require('restify');\nvar rfr = require('rfr');\nvar path = require('path');\n\nvar server = restify.plugins.se"
},
{
"path": "includes/servers/static_file_server.js",
"chars": 4165,
"preview": "'use strict';\n\nvar fs = require('fs');\nvar path = require('path');\nvar mime = require('mime');\nvar escapeRE = require('e"
},
{
"path": "includes/test/planning.test.js",
"chars": 12299,
"preview": "var hippie = require('hippie');\nvar rfr = require('rfr');\nvar expect = require('chai').expect;\nvar assert = require('cha"
},
{
"path": "includes/test/stats.test.js",
"chars": 5670,
"preview": "var hippie = require('hippie');\nvar rfr = require('rfr');\nvar expect = require('chai').expect;\nvar assert = require('cha"
},
{
"path": "includes/test/wallet.test.js",
"chars": 10976,
"preview": "var hippie = require('hippie');\nvar rfr = require('rfr');\nvar expect = require('chai').expect;\nvar assert = require('cha"
},
{
"path": "includes/test.js",
"chars": 4399,
"preview": "var hippie = require('hippie');\nvar expect = require('chai').expect;\nvar Sequelize = require('sequelize');\nvar rfr = req"
},
{
"path": "index.js",
"chars": 2266,
"preview": "var CookieParser = require('restify-cookies');\nvar restify = require('restify');\nvar rfr = require('rfr');\nvar db = rfr("
},
{
"path": "package.json",
"chars": 1767,
"preview": "{\n \"name\": \"dimeshift\",\n \"version\": \"0.1.42\",\n \"description\": \"Webapp to track and manage personal finances\",\n \"main"
},
{
"path": "public/css/.gitignore",
"chars": 14,
"preview": "dist/*\nfonts/*"
},
{
"path": "public/css/main.css",
"chars": 5,
"preview": "\r\r\r\r\r"
},
{
"path": "public/css/parts/dialogs/base.css",
"chars": 129,
"preview": ".modal-loading {\n\theight: 100px;\n\ttext-indent: -9999px;\n\tbackground: white url('/images/loading.gif') center center no-r"
},
{
"path": "public/css/parts/dialogs/registration.css",
"chars": 617,
"preview": "\n.social_signin {\n\ttext-align: left;\n\tmargin-bottom: 20px;\n}\n\n.registration_dialog h3, .signin_dialog h3 {\n\tmargin: 0;\n\t"
},
{
"path": "public/css/parts/dialogs/signin.css",
"chars": 1027,
"preview": "\n.dialog_signin {\n\t-webkit-touch-callout: none;\n\t-webkit-user-select: none;\n\t-khtml-user-select: none;\n\t-moz-user-select"
},
{
"path": "public/css/parts/head.css",
"chars": 3025,
"preview": ".navbar-inverse {\n\tborder-radius: 0;\n\tbackground: white;\n\tborder-bottom: 1px solid #DDDDDD;\n\tmin-height: 45px;\n\toverflow"
},
{
"path": "public/css/parts/home.css",
"chars": 585,
"preview": ".home_features {\n\n}\n\n.home_features img {\n\tmargin-top: 10px;\n\tmargin-right: 5px;\n}\n\n.home_features .media-heading {\n\tmar"
},
{
"path": "public/css/parts/icons.css",
"chars": 4938,
"preview": ".btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsi"
},
{
"path": "public/css/parts/import.css",
"chars": 222,
"preview": "\n.sample_cell {\n\tmax-height: 40px;\n\tmax-width: 190px;\n\tword-wrap: break-word;\n\toverflow: hidden;\n}\n\n.import_row_type {\n\t"
},
{
"path": "public/css/parts/overload.css",
"chars": 858,
"preview": "#wrap {\n\tbackground-color: #F8F8F8;\n}\n\n.row.no-gutter {\n margin-left: 0;\n margin-right: 0;\n}\n\n.row.no-gutter [class*='"
},
{
"path": "public/css/parts/page_transitions.css",
"chars": 292,
"preview": "\n.page_holder {\n}\n\n.page {\n}\n\n.page_loading {\n\tbackground: url('/images/loading.gif') center center no-repeat;\n\tmin-heig"
},
{
"path": "public/css/parts/sticked_footer.css",
"chars": 587,
"preview": "html, body {\n\theight: 100%; /* The html and body elements cannot have any padding or margin. */\n\tmargin: 0;\n\tpadding: 0;"
},
{
"path": "public/css/parts/text_format.css",
"chars": 335,
"preview": "\n\n.text_format {\n\n}\n\n.text_format img {\n\tmax-width: 100%;\n}\n\n.text_format img[style*=\"float: left\"] {\n\tmargin: 0 10px 5p"
},
{
"path": "public/css/parts/wallets.css",
"chars": 987,
"preview": ".wallet_total {\n\tfont-size: 24px;\n}\n\na.action {\n\tborder-bottom: 1px dashed #2a6496;\n\ttext-decoration: none;\n}\n\na.action:"
},
{
"path": "public/css/parts/widgets.css",
"chars": 215,
"preview": ".widget h1:first-child {\n\tmargin-top: 0;\n}\n.widget h2:first-child {\n\tmargin-top: 0;\n}\n.widget h3:first-child {\n\tmargin-t"
},
{
"path": "public/index.html",
"chars": 4890,
"preview": "<!DOCTYPE HTML>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n\t<!--"
},
{
"path": "public/jstemplates/404.tpl",
"chars": 32,
"preview": "<h1>{t}Nothing is found{/t}</h1>"
},
{
"path": "public/jstemplates/dialogs/add_profit.tpl",
"chars": 1501,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/add_wallet.tpl",
"chars": 1714,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/change_language.tpl",
"chars": 1328,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/edit_wallet.tpl",
"chars": 1616,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/fill_profile.tpl",
"chars": 1914,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/hide_wallet.tpl",
"chars": 1648,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/registration.tpl",
"chars": 2872,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/remove_access.tpl",
"chars": 1123,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/remove_plan.tpl",
"chars": 975,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/remove_transaction.tpl",
"chars": 982,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/restore.tpl",
"chars": 1615,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/set_total_to.tpl",
"chars": 1232,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/signin.tpl",
"chars": 2211,
"preview": "<div class=\"modal-dialog\">\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <button type=\"butto"
},
{
"path": "public/jstemplates/dialogs/transaction_details.tpl",
"chars": 2079,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/dialogs/wallet_accesses.tpl",
"chars": 2665,
"preview": "<div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" "
},
{
"path": "public/jstemplates/months.tpl",
"chars": 348,
"preview": "{t}January{/t}\n{t}February{/t}\n{t}March{/t}\n{t}April{/t}\n{t}May{/t}\n{t}June{/t}\n{t}July{/t}\n{t}August{/t}\n{t}September{/"
},
{
"path": "public/jstemplates/pages/import/xls.tpl",
"chars": 5526,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{tp}Home{/tp}</a></li>\n <li><a href=\"{$settings->site_pa"
},
{
"path": "public/jstemplates/pages/index/index.tpl",
"chars": 2719,
"preview": "<h1>DimeShift – {tp}the easiest way to track your expenses{/tp}</h1>\r\n\r\n<p>{tp}To demonstrate how simple it is{/tp"
},
{
"path": "public/jstemplates/pages/plans/index.tpl",
"chars": 7235,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{tp}Home{/tp}</a></li>\n <li class=\"active\">{tp}Plan your"
},
{
"path": "public/jstemplates/pages/plans/view.tpl",
"chars": 7554,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{tp}Home{/tp}</a></li>\n <li><a href=\"{$settings->site_pa"
},
{
"path": "public/jstemplates/pages/profile/index.tpl",
"chars": 4142,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{tp}Home{/tp}</a></li>\n <li class=\"active\">{tp}Settings{"
},
{
"path": "public/jstemplates/pages/user/confirm.tpl",
"chars": 307,
"preview": "<h4>Confirm your email address</h4>\r\n\r\n{if $confirmed}\r\n<div class=\"alert alert-success\">\r\n Your email has been confirme"
},
{
"path": "public/jstemplates/pages/user/index.tpl",
"chars": 20,
"preview": "<h2>Dashboard</h2>\r\n"
},
{
"path": "public/jstemplates/pages/user/registration.tpl",
"chars": 80,
"preview": "<script>\r\n $(function(){\r\n App.showDialog('Registration');\r\n });\r\n</script>"
},
{
"path": "public/jstemplates/pages/user/restore.tpl",
"chars": 75,
"preview": "<script>\r\n $(function(){\r\n App.showDialog('Restore');\r\n });\r\n</script>"
},
{
"path": "public/jstemplates/pages/user/signin.tpl",
"chars": 74,
"preview": "<script>\r\n $(function(){\r\n App.showDialog('Signin');\r\n });\r\n</script>"
},
{
"path": "public/jstemplates/pages/user/update_password.tpl",
"chars": 2011,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{t}Home{/t}</a></li>\n <li class=\"active\">{t}Update Passw"
},
{
"path": "public/jstemplates/pages/wallets/index.tpl",
"chars": 4640,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{tp}Home{/tp}</a></li>\n <li class=\"active\">{tp}Your Wall"
},
{
"path": "public/jstemplates/pages/wallets/view.tpl",
"chars": 3541,
"preview": "<ul class=\"breadcrumb\">\n <li><a href=\"{$settings->site_path}\">{tp}Home{/tp}</a></li>\n <li><a href=\"{$settings->site_pa"
},
{
"path": "public/jstemplates/parts/transactions.tpl",
"chars": 2644,
"preview": "{if $state == 'loading'}\n\t<div class=\"list-group-item\">\n\t\t<div class=\"page_loading\"></div>\n\t</div>\n{else}\n<div id=\"trans"
},
{
"path": "public/jstemplates/parts/wallet_plans.tpl",
"chars": 1711,
"preview": "\n\n\n<div class=\"panel panel-default\">\n\t<div class=\"panel-heading\">\n\t\t<h3 class=\"panel-title\">{tp}Goals{/tp}</h3>\n\t</div>\n"
},
{
"path": "public/scripts/.gitignore",
"chars": 6,
"preview": "dist/*"
},
{
"path": "public/scripts/app/abstract/dialog.js",
"chars": 2185,
"preview": "// dialog.js\nApp.Views.Abstract.Dialog = Backbone.View.extend({\n\n\tel: $(\"#dialog_wrapper\"),\n\tisVisible: false,\n\tfocusOnI"
},
{
"path": "public/scripts/app/abstract/page.js",
"chars": 4169,
"preview": "// page.js\nApp.Views.Abstract.Page = Backbone.View.extend({\n\n\tisReady: false,\n\trequiresSignedIn: false,\n\twidgets: [],\n\tp"
},
{
"path": "public/scripts/app/collections/plans.js",
"chars": 439,
"preview": "//plans.js\nApp.Collections.Plans = Backbone.Collection.extend({\n\tmodel: App.Models.Plan,\n\tuser_id: false,\n\twallet_id: fa"
},
{
"path": "public/scripts/app/collections/transactions.js",
"chars": 6282,
"preview": "//transactions.js\nApp.Collections.Transactions = Backbone.Collection.extend({\n\n model: App.Models.Transaction,\n wa"
},
{
"path": "public/scripts/app/collections/users.js",
"chars": 162,
"preview": "//users.js\nApp.Collections.Users = Backbone.Collection.extend({\n\tmodel: App.Models.User,\n\turl: function() {\n\t\treturn App"
},
{
"path": "public/scripts/app/collections/wallets.js",
"chars": 585,
"preview": "//wallets.js\nApp.Collections.Wallets = Backbone.Collection.extend({\n model: App.Models.Wallet,\n user_id: false,\n "
},
{
"path": "public/scripts/app/collections/wallets_accesses.js",
"chars": 404,
"preview": "//wallets_accesses.js\nApp.Collections.WalletsAccesses = Backbone.Collection.extend({\n\n\tmodel: App.Models.WalletsAccess,\n"
},
{
"path": "public/scripts/app/exchange.js",
"chars": 1321,
"preview": "// exchange.js\nApp.exchange = {\n\trates: {},\n\tbase: 'USD',\n\tloaded: false,\n\tloadRates: function(callback) {\n\t\t// @todo: r"
},
{
"path": "public/scripts/app/helper.js",
"chars": 911,
"preview": "// helper.js\nApp.helper = {\n\n\tloadedAdditionalScripts: {},\n\tloadAdditionalScripts: function(scripts, callback) {\n\t\tvar t"
},
{
"path": "public/scripts/app/i18n.js",
"chars": 1657,
"preview": "// i18n.js\nApp.i18n = {\n\n\tstrings: {},\n\tloaded: false,\n\tsetLanguage: function(languageCode, callback) {\n\t\tthis.languageC"
},
{
"path": "public/scripts/app/local_storage.js",
"chars": 1108,
"preview": "// local_storage.js\nApp.localStorage = {\n\n\tinvalidate: function(currentVersion) {\n\t\tvar prev = this.get('current_app_ver"
},
{
"path": "public/scripts/app/log.js",
"chars": 1356,
"preview": "// log.js\nApp.log = {\n\n\tcurrentURL: null,\n\tcurrentTitle: null,\n\tcurrentVisitTime: null,\n\thasToForce: false,\n\tsetURL: fun"
},
{
"path": "public/scripts/app/models/plan.js",
"chars": 6874,
"preview": "// plan.js\nApp.Models.Plan = Backbone.Model.extend({\n\n\tdefaults: {\n\t\tname: null,\n\t},\n\tloadedWallets: [],\n\ttransactions: "
},
{
"path": "public/scripts/app/models/transaction.js",
"chars": 738,
"preview": "// transaction.js\nApp.Models.Transaction = Backbone.Model.extend({\n\n defaults: function() {\n return {\n "
},
{
"path": "public/scripts/app/models/user.js",
"chars": 9663,
"preview": "// user.js\nApp.Models.User = Backbone.Model.extend({\n\n\tvalidate: function(attrs, options) {\n\t\tvar errors = [];\n\n\t\tif (ty"
},
{
"path": "public/scripts/app/models/wallet.js",
"chars": 5035,
"preview": "// wallet.js\nApp.Models.Wallet = Backbone.Model.extend({\n\n defaults: {\n name: null,\n type: null,\n "
},
{
"path": "public/scripts/app/models/wallets_access.js",
"chars": 710,
"preview": "// wallets_access.js\nApp.Models.WalletsAccess = Backbone.Model.extend({\n\n defaults: {\n wallet_id: null,\n "
},
{
"path": "public/scripts/app/router.js",
"chars": 3121,
"preview": "// router.js\nApp.router = new(Backbone.Router.extend({\n\n setUrl: function(path) {\n this.navigate(path);\n },\n redir"
},
{
"path": "public/scripts/app/settings.js",
"chars": 6469,
"preview": "// settings.js\nApp.settings = {\n\n\tsitePath: site_path,\n\tapiEntryPoint: site_path + '/api/',\n\ttemplatePath: site_path + '"
},
{
"path": "public/scripts/app/template_manager.js",
"chars": 10610,
"preview": "// template_manager.js\nApp.templateManager = {\n\n\t_cache: {},\n\t_templates: {},\n\t_loadingStates: {},\n\t_loadingCallbacks: {"
},
{
"path": "public/scripts/app/view_stack.js",
"chars": 1508,
"preview": "// view_stack.js\nApp.viewStack = {\n\n\tstack: {},\n\tinStackCount: 0,\n\taddView: function(name, params, view) {\n\t\tif (!App.se"
},
{
"path": "public/scripts/app/views/charts/balance.js",
"chars": 9756,
"preview": "// balance.js\nApp.Views.Charts.Balance = Backbone.View.extend({\n\n\tevents: {},\n\tchart: false,\n\taTransactions: [],\n\t_data:"
},
{
"path": "public/scripts/app/views/dialogs/add_profit.js",
"chars": 607,
"preview": "// add_profit.js\nApp.Views.Dialogs.AddProfit = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'add_profit',\n\tevents: {"
},
{
"path": "public/scripts/app/views/dialogs/add_wallet.js",
"chars": 1185,
"preview": "// add_wallet.js\nApp.Views.Dialogs.AddWallet = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'add_wallet',\n\tevents: {"
},
{
"path": "public/scripts/app/views/dialogs/change_language.js",
"chars": 1008,
"preview": "// change_language.js\nApp.Views.Dialogs.ChangeLanguage = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'change_langua"
},
{
"path": "public/scripts/app/views/dialogs/edit_wallet.js",
"chars": 1102,
"preview": "// edit_wallet.js\nApp.Views.Dialogs.EditWallet = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'edit_wallet',\n\tevents"
},
{
"path": "public/scripts/app/views/dialogs/fill_profile.js",
"chars": 1296,
"preview": "// fill_profile.js\nApp.Views.Dialogs.FillProfile = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'fill_profile',\n\teve"
},
{
"path": "public/scripts/app/views/dialogs/hide_wallet.js",
"chars": 583,
"preview": "// hide_wallet.js\nApp.Views.Dialogs.HideWallet = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'hide_wallet',\n\tevents"
},
{
"path": "public/scripts/app/views/dialogs/logout.js",
"chars": 321,
"preview": "// logout.js\nApp.Views.Dialogs.Logout = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'logout', // don't need templat"
},
{
"path": "public/scripts/app/views/dialogs/registration.js",
"chars": 1334,
"preview": "// registration.js\nApp.Views.Dialogs.Registration = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'registration',\n\tev"
},
{
"path": "public/scripts/app/views/dialogs/remove_access.js",
"chars": 953,
"preview": "// remove_access.js\nApp.Views.Dialogs.RemoveAccess = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'remove_access',\n\t"
},
{
"path": "public/scripts/app/views/dialogs/remove_plan.js",
"chars": 688,
"preview": "// remove_plan.js\nApp.Views.Dialogs.RemovePlan = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'remove_plan',\n\tevents"
},
{
"path": "public/scripts/app/views/dialogs/remove_transaction.js",
"chars": 1196,
"preview": "// remove_transaction.js\nApp.Views.Dialogs.RemoveTransaction = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'remove_"
},
{
"path": "public/scripts/app/views/dialogs/restore.js",
"chars": 1196,
"preview": "// restore.js\nApp.Views.Dialogs.Restore = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'restore',\n\tevents: {\n\t\t\"subm"
},
{
"path": "public/scripts/app/views/dialogs/set_total_to.js",
"chars": 616,
"preview": "// set_total_to.js\nApp.Views.Dialogs.SetTotalTo = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'set_total_to',\n\teven"
},
{
"path": "public/scripts/app/views/dialogs/signin.js",
"chars": 1716,
"preview": "// signin.js\nApp.Views.Dialogs.Signin = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'signin',\n\tevents: {\n\t\t\"submit "
},
{
"path": "public/scripts/app/views/dialogs/transaction_details.js",
"chars": 902,
"preview": "// transaction_details.js\nApp.Views.Dialogs.TransactionDetails = App.Views.Abstract.Dialog.extend({\n\n\tdialogName: 'trans"
},
{
"path": "public/scripts/app/views/dialogs/wallet_accesses.js",
"chars": 2216,
"preview": "// wallet_accesses.js\nApp.Views.Dialogs.WalletAccesses = App.Views.Abstract.Dialog.extend({\n\n\tstatus: 'loading',\n\tdialog"
},
{
"path": "public/scripts/app/views/header.js",
"chars": 867,
"preview": "// header.js\nApp.Views.Header = Backbone.View.extend({\n\n\tel: $(\"#header\"),\n\tevents: {},\n\n\trender: function() {\n\t\tthis.se"
},
{
"path": "public/scripts/app/views/pages/404.js",
"chars": 229,
"preview": "// 404.js\nApp.Views.Pages.NotFound = App.Views.Abstract.Page.extend({\n\n\ttemplateName: '404',\n\ttitle: 'Nothing is found. "
},
{
"path": "public/scripts/app/views/pages/import_xls.js",
"chars": 12488,
"preview": "// import_xls.js\nApp.Views.Pages.ImportXLS = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/import/xls',\n\taddit"
},
{
"path": "public/scripts/app/views/pages/index.js",
"chars": 2741,
"preview": "// index.js\nApp.Views.Pages.Index = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/index/index',\n\tcategory: 'ho"
},
{
"path": "public/scripts/app/views/pages/plan.js",
"chars": 3712,
"preview": "// plan.js\nApp.Views.Pages.Plan = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/plans/view',\n\tcategory: 'plan'"
},
{
"path": "public/scripts/app/views/pages/plans.js",
"chars": 12951,
"preview": "// plans.js\nApp.Views.Pages.Plans = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/plans/index',\n\tcategory: 'pl"
},
{
"path": "public/scripts/app/views/pages/profile.js",
"chars": 1685,
"preview": "// profile.js\nApp.Views.Pages.Profile = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/profile/index',\n\tcategor"
},
{
"path": "public/scripts/app/views/pages/update_password.js",
"chars": 2663,
"preview": "// update_password.js\nApp.Views.Pages.UpdatePassword = App.Views.Abstract.Page.extend({\n\tevents: {\n\t\t\"submit #update_pas"
},
{
"path": "public/scripts/app/views/pages/wallet.js",
"chars": 4844,
"preview": "// wallet.js\nApp.Views.Pages.Wallet = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/wallets/view',\n\tcategory: "
},
{
"path": "public/scripts/app/views/pages/wallets.js",
"chars": 3643,
"preview": "// wallets.js\nApp.Views.Pages.Wallets = App.Views.Abstract.Page.extend({\n\n\ttemplateName: 'pages/wallets/index',\n\tcategor"
},
{
"path": "public/scripts/app/views/parts/profile_change_password.js",
"chars": 2164,
"preview": "// profile_change_password.js\nApp.Views.Parts.ProfileChangePassword = Backbone.View.extend({\n\n\tevents: {\n\t\t\"submit #chan"
},
{
"path": "public/scripts/app/views/parts/profile_remove_account.js",
"chars": 1712,
"preview": "// profile_remove_account.js\nApp.Views.Parts.ProfileRemoveAccount = Backbone.View.extend({\n\n\tevents: {\n\t\t\"submit #remove"
},
{
"path": "public/scripts/app/views/parts/transactions.js",
"chars": 2109,
"preview": "// transactions.js\nApp.Views.Parts.Transactions = Backbone.View.extend({\n\n\ttemplateName: 'parts/transactions',\n\tel: $(\"#"
},
{
"path": "public/scripts/app/views/parts/wallet_plans.js",
"chars": 2079,
"preview": "// wallet_plans.js\nApp.Views.Parts.WalletPlans = Backbone.View.extend({\n\n\ttemplateName: 'parts/wallet_plans',\n\tevents: {"
},
{
"path": "public/scripts/app/views/tours/wallet.js",
"chars": 2755,
"preview": "// wallet.js\nApp.Tours.Wallet = {\n\ttour: null,\n\tpage: null,\n\tfinish: function() {\n\t\tApp.eraseCookie('show_tour_Wallet');"
},
{
"path": "public/scripts/app/views/tours/wallets.js",
"chars": 1640,
"preview": "// wallets.js\nApp.Tours.Wallets = {\n\ttour: null,\n\tpage: null,\n\tfinish: function() {\n\t\tApp.eraseCookie('show_tour_Wallets"
},
{
"path": "public/scripts/app/views/widgets/index.js",
"chars": 0,
"preview": ""
},
{
"path": "public/scripts/app.js",
"chars": 4862,
"preview": "// app.js\nwindow.App = {\n\n\tModels: {},\n\tCollections: {},\n\tViews: {\n\t\tAbstract: {},\n\t\tDialogs: {},\n\t\tPages: {},\n\t\tWidgets"
},
{
"path": "public/scripts/functions.js",
"chars": 5910,
"preview": "function isEmail(email) {\n\tvar re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-"
},
{
"path": "public/scripts/setup.js",
"chars": 45,
"preview": "// setup.js\n$(function() {\n\n\tApp.init();\n\n});"
},
{
"path": "public/scripts/table_helper.js",
"chars": 857,
"preview": "$(function() {\r\n\r\n\t$('body').append(\"<form id='table_helper_sort_form' method='post'><input type='hidden' name='order_by"
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the jeka-kiselyov/dimeshift GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 202 files (489.5 KB), approximately 142.0k tokens, and a symbol index with 27 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.