Bitcoin Forum
May 03, 2024, 03:52:34 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 [5] 6 7 8 9 10 11 12 13 14 »  All
  Print  
Author Topic: [Free Script] Untitled Dice - Run your own bitcoin dice site (no server needed)  (Read 64322 times)
Nyau
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
July 06, 2015, 07:28:57 PM
 #81

I'm trying to get up my first website with this script, but I don't have SSL and it always redirects to https://.. I found this
Code:
// - Set this to true if you want users that come to http:// to be redirected
  //   to https://
But what do I have to set to true? There's nothing like this..
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
owlcatz
Legendary
*
Offline Offline

Activity: 3626
Merit: 1967



View Profile
July 06, 2015, 07:30:44 PM
 #82

I'm trying to get up my first website with this script, but I don't have SSL and it always redirects to https://.. I found this
Code:
// - Set this to true if you want users that come to http:// to be redirected
  //   to https://
But what do I have to set to true? There's nothing like this..

Those are comments in the code. There should be some code right underneath, like (This is just a guess)

$HTTPS == "true"

(Or something along those lines).  Good luck! Wink


Sorry, I didn't realize the source was on the OP.

This is javascript, so it's different:

Here is the default code, which is causing your redirects to https://
Code:
force_https_redirect: !isRunningLocally()

Since I'm not a Javascript person, I can only guess that removing the ! in front of that function call above will reverse the effect of what is there now - Here is the function it calls if it helps -

Code:
// :: Bool
function isRunningLocally() {
  return /^localhost/.test(window.location.host);
}

Edit - Or, you could try just replacing !isRunningLocally() with either :

true

or

"true"

and see if that fixes it.  Good luck! Smiley

.
I  C  Λ  R  U  S
██████████
██████▀▀▀██
████▀█████▀█
██████████
██████████
█████████████
░▄████
█████████████
███████████████████
███████████████████
████████░░░▀▀▀▀▀▀▀▀
████████▄▄▄████████
███████████████████
█████████████████▀
░░░██
▄▄▄█
█████
░░░██
░░░██
░░░██
░░░██
░░░
░░░
░░░
▄██████
█▌░▐██
███████▀
█████████████████████
██
███████████████████
██
███████████████████
██
████▀▀▀▀████▀▀█████
██
██░░▄▄░░██░░░█████
██
███▄▄██░░███░░█████
██
███▀▀▀▀░░▀██░░█████
██
██░░░░▄▄▄▄█▀░░▀████
██
██░░░░░░░░█░▀▀░████
██
███████████████████
██
███████████████████
██
███████████████████
█████████████████████
████
██
██
██
██

██
██
██
██
██
██
██
████
████
██
██
██
██

██
██
██
██
██
██
██
████
████
██
██
██
██

██
██
██
██
██
██
██
████
████
██









██
████
████
██









██
████
[/ce
Nyau
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
July 06, 2015, 08:05:59 PM
 #83

I'm trying to get up my first website with this script, but I don't have SSL and it always redirects to https://.. I found this
Code:
// - Set this to true if you want users that come to http:// to be redirected
  //   to https://
But what do I have to set to true? There's nothing like this..

Those are comments in the code. There should be some code right underneath, like (This is just a guess)

$HTTPS == "true"

(Or something along those lines).  Good luck! Wink


Sorry, I didn't realize the source was on the OP.

This is javascript, so it's different:

Here is the default code, which is causing your redirects to https://
Code:
force_https_redirect: !isRunningLocally()

Since I'm not a Javascript person, I can only guess that removing the ! in front of that function call above will reverse the effect of what is there now - Here is the function it calls if it helps -

Code:
// :: Bool
function isRunningLocally() {
  return /^localhost/.test(window.location.host);
}

Edit - Or, you could try just replacing !isRunningLocally() with either :

true

or

"true"

and see if that fixes it.  Good luck! Smiley

I know it's just comments in the code.. I'm noob, but not that big Cheesy

BTW: I removed the ! and it's working! Thanks! Smiley
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 06, 2015, 08:20:30 PM
 #84

I miss the TARGET to roll over or under...

Anyone can help me a bit to add this to the script?
owlcatz
Legendary
*
Offline Offline

Activity: 3626
Merit: 1967



View Profile
July 06, 2015, 09:28:14 PM
 #85


I know it's just comments in the code.. I'm noob, but not that big Cheesy

BTW: I removed the ! and it's working! Thanks! Smiley

No problem, and btw, I didn't mean to imply you were a noob, I just thought it was odd that you only included the comments and not the code.

Glad you got it working. Always hated Javascript myself, it can really be messy sometimes! Wink

.
I  C  Λ  R  U  S
██████████
██████▀▀▀██
████▀█████▀█
██████████
██████████
█████████████
░▄████
█████████████
███████████████████
███████████████████
████████░░░▀▀▀▀▀▀▀▀
████████▄▄▄████████
███████████████████
█████████████████▀
░░░██
▄▄▄█
█████
░░░██
░░░██
░░░██
░░░██
░░░
░░░
░░░
▄██████
█▌░▐██
███████▀
█████████████████████
██
███████████████████
██
███████████████████
██
████▀▀▀▀████▀▀█████
██
██░░▄▄░░██░░░█████
██
███▄▄██░░███░░█████
██
███▀▀▀▀░░▀██░░█████
██
██░░░░▄▄▄▄█▀░░▀████
██
██░░░░░░░░█░▀▀░████
██
███████████████████
██
███████████████████
██
███████████████████
█████████████████████
████
██
██
██
██

██
██
██
██
██
██
██
████
████
██
██
██
██

██
██
██
██
██
██
██
████
████
██
██
██
██

██
██
██
██
██
██
██
████
████
██









██
████
████
██









██
████
[/ce
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 07, 2015, 08:22:58 AM
 #86

Hi!!

I have a couple doubts, please it would be great if someone could HELP me!!!


- Where do I configure the Hedge and so??

- And why do the Domain appears like unverified??

- How can I add the TARGET (Under 50.5 or Over whatever) to the script?? (This is a important missing thing!)

Thanks in advance!!
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 07, 2015, 05:07:25 PM
 #87

No one can help me here??

 Huh
hamburger
Full Member
***
Offline Offline

Activity: 241
Merit: 107



View Profile WWW
July 07, 2015, 06:11:30 PM
 #88

No one can help me here??

 Huh

If you want to change the "Chance:", find in the app.js the following line of code

Code:
  multiplier: {
    str: '2.00',
    num: 2.00,
    error: undefined
  },

Set multiplier anything between 1 and 10 - just note the profit drop if the Chance increase an it will increase if the Chance decrease.





Datacoin : DHZ6H91fsDoBHbdqED3ysCJJ2TUh3zRMZD
Krugercoin : Yz3A9sTMp2yh5QLuAL8YQyvS5PdjHRHkkf
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 07, 2015, 06:16:39 PM
 #89

No one can help me here??

 Huh

If you want to change the "Chance:", find in the app.js the following line of code

Code:
  multiplier: {
    str: '2.00',
    num: 2.00,
    error: undefined
  },

Set multiplier anything between 1 and 10 - just note the profit drop if the Chance increase an it will increase if the Chance decrease.







I don't want to change the Chance, I want to add the target number.

Example for Multiplier x4, the Chance would be 24.75% and the Target would be > 75.24

I would like to show the target before Rolling the dice.

How can I implement this? I'm a bit lost here...
hamburger
Full Member
***
Offline Offline

Activity: 241
Merit: 107



View Profile WWW
July 07, 2015, 06:56:42 PM
 #90


I don't want to change the Chance, I want to add the target number.

Example for Multiplier x4, the Chance would be 24.75% and the Target would be > 75.24

I would like to show the target before Rolling the dice.

How can I implement this? I'm a bit lost here...

It is very important to explain exactly what you want. Do not expect people who are willing to take time to help you to just know what you are actually want.

If you want to display "Target" instead of "Chance"

Find the following code in app.js

Code:
 
    return el.div(
      {},
      el.span(
        {className: 'lead', style: { fontWeight: 'bold' }},
        'Chance: '
      ),
      innerNode
    );


Code:
 
    return el.div(
      {},
      el.span(
        {className: 'lead', style: { fontWeight: 'bold' }},
        'Target: '
      ),
      innerNode
    );


Then change the code to inverse the calculation

Find the following code in app.js

Code:
    // Just show '--' if chance can't be calculated
    var innerNode;
    if (isError) {
      innerNode = el.span(
        {className: 'lead'},
        ' --'
      );
    } else {
      innerNode = el.span(
        {className: 'lead'},
        ' ' + (winProb * 100).toFixed(2).toString() + '%'
      );
    }

change it to

Code:
    // Just show '--' if chance can't be calculated
    var innerNode;
    if (isError) {
      innerNode = el.span(
        {className: 'lead'},
        ' --'
      );
    } else {
      innerNode = el.span(
        {className: 'lead'},
        '  > ' + ((winProb * -100) + 100 ).toFixed(2).toString() + '%'
      );
    }

You site will display;

Target: > 75.24%

as simple as that!

Enjoy.

Datacoin : DHZ6H91fsDoBHbdqED3ysCJJ2TUh3zRMZD
Krugercoin : Yz3A9sTMp2yh5QLuAL8YQyvS5PdjHRHkkf
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 07, 2015, 07:02:44 PM
 #91

Hamburger you are right I will be more specific when asking!

I would like to show both but I think I will be able (I'll try!) to implement it with your explanation.

Thank you very very very much, I was struggling my small mind with this all day!!

Thanks again!!!
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 07, 2015, 07:10:50 PM
 #92

I'm having some difficulties to get the calculation for the <

 Huh
pescu23
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile WWW
July 07, 2015, 07:21:03 PM
 #93

got it!

I'm publishing it in case anyone is interested:

((winProb * - 100)*-1).toFixed(2).toString()
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
July 18, 2015, 11:12:50 PM
 #94

After installing this to my domain under the directory /dice it seems to have PERMANENTLY edited my server config.  Even after completely deleting the directory I installed this to it still redirects to moneypot.  I'd like to have my directory back for my own usage, what do I need to do to stop this auto-redirect?

coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
July 19, 2015, 04:46:56 PM
 #95

After installing this to my domain under the directory /dice it seems to have PERMANENTLY edited my server config.  Even after completely deleting the directory I installed this to it still redirects to moneypot.  I'd like to have my directory back for my own usage, what do I need to do to stop this auto-redirect?

SOLVED, it appears the issue was with my server and not this script. Since there is over 1,000 files it took longer to delete than my FTP manager lead me to believe.  Why does this app have over 1,000 files? Seems like a bit much for a site that just uses moneypot API. API is supposed to make things lightweight...

dan (OP)
Newbie
*
Offline Offline

Activity: 50
Merit: 0


View Profile
July 28, 2015, 02:02:02 AM
 #96

SOLVED, it appears the issue was with my server and not this script. Since there is over 1,000 files it took longer to delete than my FTP manager lead me to believe.  Why does this app have over 1,000 files? Seems like a bit much for a site that just uses moneypot API. API is supposed to make things lightweight...

Untitled Dice consists of three files (app.js, index.html, style.css) and about a dozen dependency files found in the vendor and node_modules folders. The rest of those files are nonessential cruft managed by Git and its package manager.

1500+ files are in the ".git" directory that Git creates whenever you clone a project. This folder contains all of the revisions made to a project over time and is only necessary for development purposes, so avoid pushing it to your production server.

1000+ files are in the "node_modules" directory. Untitled Dice uses a package manager called NPM to maintain that folder of dependencies. Even though Untitled Dice only uses 9 files within that folder, the NPM tool populates it with all the development files that each dependency comes with. You can see the actual files that Untitled Dice depends on right here: https://github.com/untitled-dice/untitled-dice.github.io/blob/master/index.html

One quick solution would be to zip the untitled-dice directory, FTP it to your server, and then unzip it there.

I'll look into isolating Untitled Dice's dependencies to make life easier for this workflow. Smiley
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
July 28, 2015, 04:36:51 AM
 #97

1500+ files are in the ".git" directory that Git creates whenever you clone a project. This folder contains all of the revisions made to a project over time and is only necessary for development purposes, so avoid pushing it to your production server.

Thanks for that explanation Dan, I was wondering why there were so many files included when I cloned it on github.

smeagol
Legendary
*
Offline Offline

Activity: 1008
Merit: 1005



View Profile
July 29, 2015, 03:45:47 AM
 #98

I put a script up at neodice.ga, it would be great if you could take a look and give me feedback!  (There is a rudimentary XP feature, if you have any ideas feel free to PM me)
dan (OP)
Newbie
*
Offline Offline

Activity: 50
Merit: 0


View Profile
August 13, 2015, 10:08:17 PM
Last edit: August 13, 2015, 10:33:00 PM by dan
 #99

v0.0.7 Release: Hooked up Moneypot's new socket/chat server

Moneypot just released a new socket-server which includes a better chat-server and pushes notifications when the user's unconfirmed and confirmed balances change.

This update doesn't change very many lines of code since the new chat-server has an almost identical API to the old one. If you want to check it out or if you want to implement this update on your own Untitled-Dice variant, you can see the changes here: https://github.com/untitled-dice/untitled-dice.github.io/commit/2e5a03fa0c683ab6f35fe7246ab538aa18f3cabd

What this changes about Untitled-Dice:

  • Chat messages are now saved in Moneypot's database and not forgotten when the chat-server resets.
  • Muted users are now saved in Moneypot's database and not forgotten when the chat-server resets.
  • The UI now instantly updates to reflect the user's unconfirmed balance and when the user's deposit is confirmed and ready to spend.

    For example, as soon as the user makes a bitcoin deposit to your app, Untitled-Dice displays it:

    https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/-vxm59n-.png

    And once a block confirms the deposit, Untitled-Dice rolls it into the user's balance:

    https://dl.dropboxusercontent.com/spa/quq37nq1583x0lf/1xv64a03.png

    In other words, users get instant peace of mind when they deposit into your app.
  • Mods now actually have /mute and /unmute power. With the previous chat-server, mods were powerless. Cheesy
  • HH:MM timestamps are now displayed next to chat messages: https://i.imgur.com/fAZ8FrQ.png
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



View Profile WWW
August 13, 2015, 10:23:37 PM
 #100

Very nice! Good update IMO, I think some people were confused about having to refresh to see their updated balance after a deposit.
Keep up the good work guys!

Pages: « 1 2 3 4 [5] 6 7 8 9 10 11 12 13 14 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!