-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from domino14/on-demand-blanks
[WIP] On-demand blank challenges
- Loading branch information
Showing
38 changed files
with
1,893 additions
and
676 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 |
---|---|---|
|
@@ -29,4 +29,4 @@ coverage | |
__pycache__ | ||
.vscode | ||
words | ||
wordsdir | ||
wordsdir |
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 +1 @@ | ||
CURRENT_VERSION = '1.1.2.0' | ||
CURRENT_VERSION = '1.1.3.0' |
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
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
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
2 changes: 1 addition & 1 deletion
2
djAerolith/wordwalls/static/js/wordwalls/challenge_results_modal.jsx
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
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,49 @@ | ||
import WordwallsAPI from './wordwalls_api'; | ||
|
||
function uniqueId() { | ||
return Math.random().toString(36).substring(2) | ||
+ (new Date()).getTime().toString(36); | ||
} | ||
|
||
class GenericRPC extends WordwallsAPI { | ||
/** | ||
* Generate a JSON RPC data packet. | ||
*/ | ||
constructor(rpcURL) { | ||
super(); | ||
this.RPCURL = rpcURL || null; | ||
} | ||
|
||
setRPCURL(url) { | ||
this.RPCURL = url; | ||
} | ||
|
||
fetchdata(method, params) { | ||
return { | ||
...this.fetchInit, | ||
body: JSON.stringify({ | ||
id: uniqueId(), | ||
jsonrpc: '2.0', | ||
method, | ||
params, | ||
}), | ||
}; | ||
} | ||
|
||
async rpcwrap(method, params) { | ||
if (!this.RPCURL) { | ||
await Promise.reject(new Error('No RPC URL was set.')); | ||
} | ||
// eslint-disable-next-line compat/compat | ||
const response = await fetch(this.RPCURL, this.fetchdata(method, params)); | ||
const data = await response.json(); | ||
if (response.ok && data.result) { | ||
// Use the `result` key - since this is JSONRPC | ||
return data.result; | ||
} | ||
// Otherwise, there's an error. | ||
throw new Error(data.error.message); | ||
} | ||
} | ||
|
||
export default GenericRPC; |
Oops, something went wrong.