Commit b8aa8eb3 authored by Freeman's avatar Freeman

Initial commit

parents
address.list*
*.pyc
logs/
tests
strakspos.cfg
Makefile
__pycache__/
venv
.vscode
dist
build
*.egg-info
.DS_Store
_helpers
.pypirc
\ No newline at end of file
# STRAKS POS Dockerfile
# Pull base image.
FROM python:3
# Define working directory.
WORKDIR /opt/strakspos
ADD . / /opt/strakspos/
RUN python install.py
RUN cp strakspos/strakspos.cfg.sample ./strakspos.cfg
#This is where you can input the payment addresses you want to use
#Supply either one or multiple address= or one xpub=
#RUN echo address=[addr] >> strakspos.cfg
#RUN echo xpub=[xpub] >> strakspos.cfg
# Define default command.
CMD [ "python", "./strakspos.py" ]
\ No newline at end of file
This diff is collapsed.
recursive-include strakspos/resources *
recursive-include strakspos/assets *
include strakspos/strakspos.cfg.sample
include README.md
\ No newline at end of file
![STRAKS-POS](strakspos/assets/repo_logo.png)
____________________________________
```
Licence: Apache Licence
Origin Author: Simon Volpert (https://github.com/simon-v/minipos/)
Port Maintainer: STRAKS Developers ([email protected])
Language: Python
Homepage: https://straks.tech/
```
STRAKS POS is a simple self-hosted point-of-sale server, intended for use by small merchants and brick-and-mortar stores, that can be operated from any device with a relatively modern web browser.
With STRAKS POS you can begin receiving STAK payments without exposing your funds to a third party, or even to your own cashiers at any point in the process, by simply giving it a list of STRAKS addresses or an extended public key to work with.
### Installation
To run STRAKS POS, you will need an Internet-connected computer with Python 3 and pip installed. Optionally git aswell.
The easiest way to install is using pip, note depending on your version of pip you may need to run pip3 instead of pip:
```
#Windows & Mac
pip install strakspos
#Linux
sudo pip3 install strakspos --install-option="--install-scripts=/usr/local/bin"
```
You can also install directly from the source code:
Using git
```
git clone https://github.com/straks/strakspos.git
cd strakspos
python install.py
```
If you do not have git installed use the following option
Using .zip:
```
download: https://github.com/straks/strakspos/archive/master.zip
unzip: strakspos.zip
cd strakspos-master
python install.py
```
### Setup
Once installed the server can be run in one of three ways. The first is a command the installiation will make avaiable in your terminal or command prompt named `strakspos`. The second is to run the package using python3 from the command line `python3 -m strakspos.main`. The third is to run the strakspos.py file `python3 strakspos.py` that is avaiable in the root directory of the source code downloaded from github or extracted from the .zip file.
The first time you run `strakspos` it will prompt you to enter either STRAKS addresses or an extended public key:
```
Welcome To STRAKS Point Of Sale
To begin please choose to add either STRAKS addresses or an extended public key (xpub)
[1] STRAKS Addresses
[2] xpub
```
Choose either option. For the addresses copy and paste the STRAKS addresses you want to include in the system, press q when you are done. For the extended public key generate it from the STRAKS electrum wallet 'Wallet->Information->Master Public key' and insert it into the prompt. STRAKS POS will then create a configuration file `strakspos.cfg` in the $HOME/.strakspos folder. It will use this as the defualt location for its data directory.
Additionally if you would like to supply a large amount of static STRAKS addresses, create an `address.list` file in the data directory that contains a newline seperated list of STRAKS addresses.
By default strakspos will look in the following directories in order for a strakspos.cfg file, if one is found it will use that as the default data directory.
* `$HOME/.strakspos`
* `$HOME/.config/strakspos`
* The current directory .
Additionally a data directory can be supplied as the first argument:
`strakspos /path/to/directory'`
Below are some of the other configuration options you may consider changing before starting the server:
* `currencies` - The fiat currencies you accept
* `taxrate` - The tax rate that can be optionally applied to payments
* `port` - The network port to host the point of sale server on (default: 8080)
* `label` - The label to display on the POS
* `allowed_ips` - The IP addresses that are allowed to access the site (default: 0.0.0.0 [all])
Finally, run the `strakspos`, and take note of the computer's IP address. You will use it to connect to the STRAKS POS server.
To obtain your computer's IP address use the following commands:
```
ifconfig / ipaddr - Mac/Linux
ipconfig - Windows
```
If you wish to run the STRAKS POS as a background task on Mac or Linux use the following, and take note of the process ID that is displayed.
`strakspos &`
A systemd service file has also been provided in the source code for use on linux machines.
### Usage
Navigate to the server's address and port from any device with a relatively modern browser.
In the request creation page, enter the amount you wish to charge. You can use the percent button to apply a sales tax or crypto discount to the amount you have entered. Press the green check mark button.
Have your buyer scan the resulting QR code with their STRAKS wallet and authorize the transaction. Alternatively, you can click/tap on the QR code to copy the request URI to clipboard and send it to your buyer in a text message.
Wait for the transaction to be detected by the system. Press the `Finish` button and hand the buyer his purchase (in any order).
To review your sales, use the built-in log browser, accessible from the triple bar button. You can view a daily, weekly, monthly and yearly summary, print it, or email it to yourself at the configured email address.
### Customization
If you would like to have a custom header and footer on your welcome and log pages, create files in your data directory named `welcome_footer.html`, `log_header.html` and `log_footer.html` with the desired HTML content.
Any file placed in the data directory overrides its counterpart in the library directory. Images and other files that you want to be directly accessible to the web browser should be placed in the `assets` subdirectory.
### Setting up with a web server
STRAKS POS doesn't need a web server to run, as it provides its own. It also doesn't care what the URL used to access it looks like, and will happily serve its content on a bare IP address, a subdomain or a directory. However, if you wish it to be accessible on port 80, you will need to set up a reverse proxy. An example Nginx configuration, is provided below
```
server {
server_name strakspos;
location /strakspos {
proxy_pass http://127.0.0.1:8080/;
proxy_cache off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header Server;
}
}
```
from subprocess import check_output
try:
check_output("pip3 install --upgrade pip", shell=True)
check_output("pip3 install -e .", shell=True)
except:
try:
check_output("pip install --upgrade pip", shell=True)
check_output("pip install -e .", shell=True)
except:
try:
check_output("python3 setup.py install", shell=True)
except:
try:
check_output("python setup.py install", shell=True)
except:
print("Failed to install!")
Pillow==5.1.0
strakspycoin==0.80
qrcode==6.0
six==1.11.0
urllib3==1.22
from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
version = '1.0.5'
install_requires = [
'Pillow==5.1.0',
'strakspycoin==0.80',
'qrcode==6.0',
'six==1.11.0',
'urllib3==1.22'
]
setup(name='strakspos',
version=version,
description="STRAKS POS",
long_description=README,
classifiers=[
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.6',
],
keywords='STRAKS STAK POS minipos',
author='Freeman',
author_email='[email protected]',
url='https://straks.tech',
license='Apache',
packages=['strakspos'],
#package_dir = {'src': 'minipos'},include_package_data=True,
zip_safe=False,
install_requires=install_requires,
entry_points={
'console_scripts':
['strakspos=strakspos.minipos:main']
},
include_package_data=True
)
from strakspos.minipos import main
main()
# MiniPOS systemctl unit file
#
# To use as a system unit:
# 1. Place this file in /etc/systemd/system/
# 2. Add the path to your data directory to the end of "ExecStart="
#
# To use as a user unit:
# 1. Place this file in $HOME/.config/systemd/user/
# 2. Add the path to your data directory to the end of "ExecStart="
# --OR--
# 2. Create your data directory in $HOME/.minipos or in $HOME/.config/minipos
#
# Once you are done, run "systemctl daemon-reload", "systemctl enable" and
# "systemctl start" as usual.
[Unit]
Description=STAKPOS
After=network.target
[Service]
Type=simple
ExecStart=/PATH/TO/stakpos
StandardError=null
[Install]
WantedBy=multi-user.target
/*anchor*/
a {
color: #667fa0;
}
a:hover {
color: #2A3542;
}
/*panel*/
.panel {
border: none;
box-shadow: none;
}
.panel-heading {
border-color:#eff2f7 ;
font-size: 16px;
font-weight: 300;
}
.panel-title {
color: #2A3542;
font-size: 14px;
font-weight: 400;
margin-bottom: 0;
margin-top: 0;
font-family: 'Open Sans', sans-serif;
}
/*label*/
.label {
padding: 0.5em 0.8em;
}
.label-default {
background-color: #a1a1a1;
}
.label-primary {
background-color: #59ace2;
}
.label-success {
background-color: #A9D86E;
}
.label-info {
background-color: #8175c7;
}
.label-warning {
background-color: #FCB322;
}
.label-danger {
background-color: #FF6C60;
}
.label-inverse {
background-color: #344860;
}
/*text color*/
.text-danger {
color: #FF6C60;
}
.text-muted {
color: #a1a1a1;
}
.text-primary {
color: #59ace2;
}
.text-warning {
color: #FCB322;
}
.text-success {
color: #A9D86E;
}
.text-info {
color: #8175c7;
}
/*modal*/
.modal-content {
box-shadow: none;
border: none;
}
.modal-header {
background: #00A8B3;
color: #fff;
border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
border-bottom: none;
}
.modal-header .close {
margin-top: 0;
}
/*text input*/
.form-control {
border: 1px solid #e2e2e4;
box-shadow: none;
color: #c2c2c2;
}
.form-control:focus, #focusedInput {
border: 1px solid #517397;
box-shadow: none;
}
.form-horizontal .control-label {
font-weight: 300;
font-size: 14px;
text-align: left;
}
input, textarea, select, button {
outline: none !important;
}
/*list*/
ul {
padding-left: 0;
}
/*button*/
.btn-default {
background-color: #bec3c7;
border-color: #bec3c7;
color: #fff;
}
.btn-default:hover, .btn-default:focus, .btn-default:active, .btn-default.active, .open .dropdown-toggle.btn-default {
background-color: #b0b5b9;
border-color: #b0b5b9;
color: #fff;
}
.btn-primary {
background-color: #41cac0;
border-color: #41cac0;
color: #FFFFFF;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary {
background-color: #39b2a9;
border-color: #39b2a9;
color: #FFFFFF;
}
.btn-success {
background-color: #78CD51;
border-color: #78CD51;
color: #FFFFFF;
}
.btn-success:hover, .btn-success:focus, .btn-success:active, .btn-success.active, .open .dropdown-toggle.btn-success {
background-color: #6dbb4a;
border-color: #6dbb4a;
color: #FFFFFF;
}
.btn-info {
background-color: #58c9f3;
border-color: #58c9f3;
color: #FFFFFF;
}
.btn-info:hover, .btn-info:focus, .btn-info:active, .btn-info.active, .open .dropdown-toggle.btn-info {
background-color: #53bee6;
border-color: #53BEE6;
color: #FFFFFF;
}
.btn-warning {
background-color: #f1c500;
border-color: #f1c500;
color: #FFFFFF;
}
.btn-warning:hover, .btn-warning:focus, .btn-warning:active, .btn-warning.active, .open .dropdown-toggle.btn-warning {
background-color: #e4ba00;
border-color: #e4ba00;
color: #FFFFFF;
}
.btn-danger {
background-color: #ff6c60;
border-color: #ff6c60;
color: #FFFFFF;
}
.btn-danger:hover, .btn-danger:focus, .btn-danger:active, .btn-danger.active, .open .dropdown-toggle.btn-danger {
background-color: #ec6459;
border-color: #ec6459;
color: #FFFFFF;
}
.btn-white {
box-shadow: none !important;
}
/*Rounded Button*/
.btn-round {
border-radius: 30px;
-webkit-border-radius: 30px;
}
/*shadow button*/
.btn-shadow.btn-default {
box-shadow: 0 4px #9c9c9c;
}
.btn-shadow.btn-primary {
box-shadow: 0 4px #29b392;
}
.btn-shadow.btn-success {
box-shadow: 0 4px #61a642;
}
.btn-shadow.btn-info {
box-shadow: 0 4px #1caadc;
}
.btn-shadow.btn-warning {
box-shadow: 0 4px #cab03f;
}
.btn-shadow.btn-danger {
box-shadow: 0 4px #d1595a;
}
/*dropdown shadow*/
.btn-group.open .dropdown-toggle, .btn-white.active, .btn:active, .btn.active {
box-shadow: none;
}
/*dropdown select bg*/
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
background-color: #495d74;
color: #FFFFFF;
text-decoration: none;
}
/*split dropdown btn*/
.btn-white {
background-clip: padding-box;
background-color: #FFFFFF;
border-color: rgba(150, 160, 180, 0.3);
box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.05) inset;
}
/*breadcrumbs*/
.breadcrumb {
background-color: #fff;
}
/*tab*/
.nav-tabs > li > a {
margin-right: 1px;
}
/*collapse*/
.panel-default > .panel-heading {
background-color: #FFFFFF;
border-color: #DDDDDD;
color: #797979;
}
/*nav inverse*/
.navbar-inverse {
background-color: #7087A3;
border-color: #7087A3;
}
.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus,
.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:focus{
background-color: #61748d;
}
.navbar-inverse .navbar-nav > li a:hover {
color: #2A3542;
}
.navbar-inverse .navbar-nav > li > ul > li a:hover {
color: #fff;
}
.navbar-inverse .navbar-brand {
color: #FFFFFF;
}
.navbar-inverse .navbar-nav > li > a {
color: #fff;
}
.navbar-inverse .navbar-nav > .dropdown > a .caret {
border-bottom-color: #fff;
border-top-color: #fff;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
color: #000;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover {
color: #fff;
}
/*nav justified*/
.nav-justified {
width: auto !important;
}
.nav-justified li:last-child > a:hover, .nav-justified li.active:last-child > a {
border-radius: 0 4px 0 0 !important;
-webkit-border-radius: 0 4px 0 0 !important;
}
/*list group*/
.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus {
background-color: #00A8B3;
border-color: #00A8B3;
color: #FFFFFF;
z-index: 2;
}
.list-group-item-heading {
font-weight: 300;
}
/*progress*/
.progress {
box-shadow: none;
background: #f0f2f7;
}
/*alert*/
.alert-success, .alert-danger, .alert-info, .alert-warning {
border: none;
}
/*table*/
.table thead > tr > th, .table tbody > tr > th, .table tfoot > tr > th, .table thead > tr > td, .table tbody > tr > td, .table tfoot > tr > td {
padding: 10px;
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/**
* Preloader
*/
$(document).ready(function($) {
var Body = $('body');
Body.addClass('preloader-site');
});
$(window).load(function() {
$('.preloader-wrapper').fadeOut();
$('body').removeClass('preloader-site');
});
/**
* Acordeon izquierdo
*/
$(function() {
$('#nav-accordion').dcAccordion({
eventType: 'click',
autoClose: true,
saveState: true,
disableLink: true,
speed: 'slow',
showCount: false,
autoExpand: true,
classExpand: 'dcjq-current-parent'
});
});
var Script = function () {
/**
* Sidebar dropdown
*/
jQuery('#sidebar .sub-menu > a').click(function () {
var o = ($(this).offset());
diff = 250 - o.top;
if(diff>0)
$("#sidebar").scrollTo("-="+Math.abs(diff),500);
else
$("#sidebar").scrollTo("+="+Math.abs(diff),500);
});
/**
* Sidebar toggle
*/
$(function() {
function responsiveView() {
var wSize = $(window).width();
if (wSize <= 768) {
$('#container').addClass('sidebar-close');
$('#sidebar > ul').hide();
}
if (wSize > 768) {
$('#container').removeClass('sidebar-close');
$('#sidebar > ul').show();
}
}
$(window).on('load', responsiveView);
$(window).on('resize', responsiveView);
});
$('.icon-reorder').click(function () {
if ($('#sidebar > ul').is(":visible") === true) {