-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,126 additions
and
796 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
uses: lnbits/lnbits/.github/workflows/lint.yml@dev | ||
tests: | ||
runs-on: ubuntu-latest | ||
needs: [lint] | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: lnbits/lnbits/.github/actions/prepare@dev | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Run pytest | ||
uses: pavelzw/pytest-action@v2 | ||
env: | ||
LNBITS_BACKEND_WALLET_CLASS: FakeWallet | ||
PYTHONUNBUFFERED: 1 | ||
DEBUG: true | ||
with: | ||
verbose: true | ||
job-summary: true | ||
emoji: false | ||
click-to-expand: true | ||
custom-pytest: poetry run pytest | ||
report-title: 'test (${{ matrix.python-version }})' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create github release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.ref_name }} | ||
run: | | ||
gh release create "$tag" --generate-notes | ||
pullrequest: | ||
needs: [release] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.EXT_GITHUB }} | ||
repository: lnbits/lnbits-extensions | ||
path: './lnbits-extensions' | ||
|
||
- name: setup git user | ||
run: | | ||
git config --global user.name "alan" | ||
git config --global user.email "[email protected]" | ||
- name: Create pull request in extensions repo | ||
env: | ||
GH_TOKEN: ${{ secrets.EXT_GITHUB }} | ||
repo_name: '${{ github.event.repository.name }}' | ||
tag: '${{ github.ref_name }}' | ||
branch: 'update-${{ github.event.repository.name }}-${{ github.ref_name }}' | ||
title: '[UPDATE] ${{ github.event.repository.name }} to ${{ github.ref_name }}' | ||
body: 'https://github.com/lnbits/${{ github.event.repository.name }}/releases/${{ github.ref_name }}' | ||
archive: 'https://github.com/lnbits/${{ github.event.repository.name }}/archive/refs/tags/${{ github.ref_name }}.zip' | ||
run: | | ||
cd lnbits-extensions | ||
git checkout -b $branch | ||
# if there is another open PR | ||
git pull origin $branch || echo "branch does not exist" | ||
sh util.sh update_extension $repo_name $tag | ||
git add -A | ||
git commit -am "$title" | ||
git push origin $branch | ||
# check if pr exists before creating it | ||
gh config set pager cat | ||
check=$(gh pr list -H $branch | wc -l) | ||
test $check -ne 0 || gh pr create --title "$title" --body "$body" --repo lnbits/lnbits-extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"semi": false, | ||
"arrowParens": "avoid", | ||
"insertPragma": false, | ||
"printWidth": 80, | ||
"proseWrap": "preserve", | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"useTabs": false, | ||
"bracketSameLine": false, | ||
"bracketSpacing": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,144 @@ | ||
const mapSatspots = (obj) => { | ||
obj._data = _.clone(obj); | ||
const mapSatspots = obj => { | ||
obj._data = _.clone(obj) | ||
obj.closing_date = Quasar.date.formatDate( | ||
new Date(obj.closing_date), | ||
"YYYY-MM-DD HH:mm", | ||
); | ||
return obj; | ||
}; | ||
'YYYY-MM-DD HH:mm' | ||
) | ||
return obj | ||
} | ||
|
||
window.app = Vue.createApp({ | ||
el: "#vue", | ||
el: '#vue', | ||
mixins: [windowMixin], | ||
data() { | ||
return { | ||
satspots: [], | ||
players: { | ||
show: false, | ||
data: [], | ||
data: [] | ||
}, | ||
satspotsTable: { | ||
columns: [ | ||
{ name: "id", align: "left", label: "ID", field: "id" }, | ||
{ name: "name", align: "left", label: "Name", field: "name" }, | ||
{name: 'id', align: 'left', label: 'ID', field: 'id'}, | ||
{name: 'name', align: 'left', label: 'Name', field: 'name'}, | ||
{ | ||
name: "closing_date", | ||
align: "right", | ||
label: "Closing Date", | ||
field: "closing_date", | ||
name: 'closing_date', | ||
align: 'right', | ||
label: 'Closing Date', | ||
field: 'closing_date' | ||
}, | ||
{ | ||
name: "buy_in", | ||
align: "left", | ||
label: "buy_in", | ||
field: "buy_in", | ||
name: 'buy_in', | ||
align: 'left', | ||
label: 'buy_in', | ||
field: 'buy_in' | ||
}, | ||
{ | ||
name: "haircut", | ||
align: "left", | ||
label: "haircut", | ||
field: "haircut", | ||
name: 'haircut', | ||
align: 'left', | ||
label: 'haircut', | ||
field: 'haircut' | ||
}, | ||
{ | ||
name: "completed", | ||
align: "left", | ||
label: "completed", | ||
field: "completed", | ||
}, | ||
name: 'completed', | ||
align: 'left', | ||
label: 'completed', | ||
field: 'completed' | ||
} | ||
], | ||
pagination: { | ||
rowsPerPage: 10, | ||
}, | ||
rowsPerPage: 10 | ||
} | ||
}, | ||
formDialogSatspot: { | ||
show: false, | ||
fixedAmount: true, | ||
data: { | ||
name: "", | ||
name: '', | ||
number_of_players: 2, | ||
buy_in: 1000, | ||
wallet: null, | ||
}, | ||
}, | ||
}; | ||
wallet: null | ||
} | ||
} | ||
} | ||
}, | ||
methods: { | ||
exportCSV() { | ||
LNbits.utils.exportCSV(this.satspotsTable.columns, this.satspots); | ||
LNbits.utils.exportCSV(this.satspotsTable.columns, this.satspots) | ||
}, | ||
async getSatspotGames() { | ||
await LNbits.api | ||
.request( | ||
"GET", | ||
"/satspot/api/v1/satspot", | ||
this.g.user.wallets[0].adminkey, | ||
'GET', | ||
'/satspot/api/v1/satspot', | ||
this.g.user.wallets[0].adminkey | ||
) | ||
.then((response) => { | ||
.then(response => { | ||
if (response.data != null) { | ||
this.satspots = response.data; | ||
this.satspots = response.data | ||
} | ||
}) | ||
.catch((err) => { | ||
LNbits.utils.notifyApiError(err); | ||
}); | ||
.catch(err => { | ||
LNbits.utils.notifyApiError(err) | ||
}) | ||
}, | ||
async openPlayers(players) { | ||
this.players.show = true; | ||
this.players.data = players.split(","); | ||
this.players.show = true | ||
this.players.data = players.split(',') | ||
}, | ||
async createGame() { | ||
const date = new Date(this.formDialogSatspot.data.closing_date); | ||
const unixTimestamp = Math.floor(date.getTime() / 1000); | ||
const date = new Date(this.formDialogSatspot.data.closing_date) | ||
const unixTimestamp = Math.floor(date.getTime() / 1000) | ||
const data = { | ||
name: this.formDialogSatspot.data.name, | ||
buy_in: this.formDialogSatspot.data.buy_in, | ||
closing_date: parseInt(unixTimestamp), | ||
haircut: this.formDialogSatspot.data.haircut, | ||
}; | ||
haircut: this.formDialogSatspot.data.haircut | ||
} | ||
const wallet = _.findWhere(this.g.user.wallets, { | ||
id: this.formDialogSatspot.data.wallet, | ||
}); | ||
id: this.formDialogSatspot.data.wallet | ||
}) | ||
try { | ||
const response = await LNbits.api.request( | ||
"POST", | ||
"/satspot/api/v1/satspot", | ||
'POST', | ||
'/satspot/api/v1/satspot', | ||
wallet.adminkey, | ||
data, | ||
); | ||
data | ||
) | ||
if (response.data) { | ||
this.satspots = response.data.map(mapSatspots); | ||
this.formDialogSatspot.show = false; | ||
this.satspots = response.data.map(mapSatspots) | ||
this.formDialogSatspot.show = false | ||
} | ||
} catch (error) { | ||
LNbits.utils.notifyApiError(error); | ||
LNbits.utils.notifyApiError(error) | ||
} | ||
}, | ||
deleteSatspot(satpotid) { | ||
const satspot = _.findWhere(this.satspots, { id: satpotid }); | ||
const satspot = _.findWhere(this.satspots, {id: satpotid}) | ||
|
||
LNbits.utils | ||
.confirmDialog("Are you sure you want to delete this satspot?") | ||
.confirmDialog('Are you sure you want to delete this satspot?') | ||
.onOk(() => { | ||
LNbits.api | ||
.request( | ||
"DELETE", | ||
"/satspot/api/v1/satspot/" + satpotid, | ||
_.findWhere(this.g.user.wallets, { id: satspot.wallet }).adminkey, | ||
'DELETE', | ||
'/satspot/api/v1/satspot/' + satpotid, | ||
_.findWhere(this.g.user.wallets, {id: satspot.wallet}).adminkey | ||
) | ||
.then((response) => { | ||
.then(response => { | ||
this.satspots = _.reject( | ||
this.satspots, | ||
(obj) => obj.id === satpotid, | ||
); | ||
obj => obj.id === satpotid | ||
) | ||
}) | ||
.catch((err) => { | ||
LNbits.utils.notifyApiError(err); | ||
}); | ||
}); | ||
}, | ||
.catch(err => { | ||
LNbits.utils.notifyApiError(err) | ||
}) | ||
}) | ||
} | ||
}, | ||
async created() { | ||
// CHECK COINFLIP SETTINGS | ||
await this.getSatspotGames(); | ||
}, | ||
}); | ||
await this.getSatspotGames() | ||
} | ||
}) |
Oops, something went wrong.