Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

master
Aevann1 2022-09-16 10:41:32 +02:00
commit bb1852709b
44 changed files with 107 additions and 322 deletions

View File

@ -1,61 +1,59 @@
/*common*/ /*common*/
:root { :root {
--muted: #666 ; --muted: #666;
--black: #444; --black: #444;
--primary: #b40457; --bgc: white;
--grey1: #888; --primary: #b40457;
--grey2: #999; --grey: #888;
--upvote: #ff8b60; --upvote: #ff8b60;
--downvote: #9393ff; --downvote: #9393ff;
--sticky: #228822; --sticky: #228822;
} }
body { body {
background-image: url(/i/classic2.webp); background-image: url(/i/classic2.webp);
background-color: var(--bgc) !important;
} }
* { * {
border-color: var(--muted) !important; border-color: var(--muted) !important;
} }
#frontpage .container, #thread .container { #frontpage .container, #thread .container {
max-width: 2160px; max-width: 2160px;
} }
.sidebar { .sidebar {
background-color: white; background-color: var(--bgc);
border-radius: 0px; border-radius: 0px;
margin-top: 0; margin-top: 0;
margin-right: 0; margin-right: 0;
} }
.no-gutters { .no-gutters {
margin-top: 1rem; margin-top: 1rem;
} }
.navbar { #mobile-bottom-navigation-bar, .navbar {
background-color: white !important background-color: var(--bgc) !important;
} }
.btn-primary { .btn-primary {
background-color: var(--primary) !important; background-color: var(--primary) !important;
color:white; color:white;
} }
.dropdown-menu { .dropdown-menu {
background-color: white; background-color: var(--bgc);
} }
.dropdown-item i { .dropdown-item i {
color: var(--muted) !important; color: var(--muted) !important;
}
#mobile-bottom-navigation-bar {
background-color: white !important;
} }
input, textarea, .form-control { input, textarea, .form-control {
background-color:white !important; background-color: var(--bgc) !important;
border: 1px solid;
} }
/*decoration*/ /*decoration*/
@ -71,10 +69,6 @@ input, textarea, .form-control {
color: var(--muted); color: var(--muted);
} }
.pronouns {
background-color: white;
}
.fa-thumbtack.text-admin { .fa-thumbtack.text-admin {
color: var(--sticky); color: var(--sticky);
} }
@ -84,86 +78,82 @@ input, textarea, .form-control {
} }
.tooltip { .tooltip {
background-color:white; background-color: var(--bgc);
} }
/*front page*/ /*front page*/
a.btn-block[href~="/submit"] { a.btn-block[href~="/submit"] {
display:none; display:none;
} }
.sorting { .sorting {
float:left !important; float:left !important;
padding-top: 5px !important; padding-top: 5px !important;
} }
#frontpage #main-content-col .row:first-child { #frontpage #main-content-col .row:first-child {
background-image: url(/i/classic1.webp); background-image: url(/i/classic1.webp);
background-position:center; background-position:center;
background-repeat: repeat-x; background-repeat: repeat-x;
margin-top: -12px; margin-top: -12px;
margin-bottom:-15px; margin-bottom:-15px;
} }
.sorting .btn { .sorting .btn {
color: white; color: white;
text-shadow: -1px -1px 0 black,1px -1px 0 black,-1px 1px 0 black,1px 1px 0 black; text-shadow: -1px -1px 0 black,1px -1px 0 black,-1px 1px 0 black,1px 1px 0 black;
border:none; border:none;
} }
#frontpage .sorting .text-primary { #frontpage .sorting .text-primary {
color: yellow !important; color: yellow !important;
text-decoration: underline; text-decoration: underline;
background-color:transparent !important; background-color:transparent !important;
} }
#frontpage #dropdownMenuButton, #frontpage #dropdownMenuButton2, .sorting .dropdown i { #frontpage #dropdownMenuButton, #frontpage #dropdownMenuButton2, .sorting .dropdown i {
color: yellow; color: yellow;
} }
.card { .card {
border-color: var(--grey2) !important; border-color: var(--grey) !important;
} }
.modal-content { .modal-content {
background-color: white background-color: var(--bgc);
} }
#frontpage .post-title a:not(:visited) { #frontpage .post-title a:not(:visited) {
color: #369; color: #369;
} }
#frontpage .card.stickied .post-title a { #frontpage .card.stickied .post-title a {
color: var(--sticky); color: var(--sticky);
} }
/*posts*/ /*posts*/
#thread .container, #thread .card {
background: transparent !important;
}
@media (min-width: 992px){ @media (min-width: 992px){
#thread #main-content-col { #thread #main-content-col {
padding-left:3rem; padding-left:3rem;
padding-right: 3rem; padding-right: 3rem;
} }
} }
.comment-section, .comment { .comment-section, .comment {
background-color: white; background-color: var(--bgc);
} }
blockquote { blockquote {
background-color: var(--grey1); background-color: var(--grey);
color: white; color: white;
} }
/*userpage*/ /*userpage*/
.jumbotron { .jumbotron {
color: var(--grey2); color: var(--grey);
} }
/*casino*/ /*casino*/
#casino-game-wrapper .row-cols-1, #casino-game-wrapper .row-cols-2 { #casino-game-wrapper .row-cols-1, #casino-game-wrapper .row-cols-2 {
background-image: none !important; background-image: none !important;
} }

View File

@ -1,222 +1,7 @@
@import 'classic.css?v=4005'; @import 'classic.css?v=4010';
/*navbar*/ :root {
.navbar-light, .navbar .container-fluid, #mobile-bottom-navigation-bar { --muted: #999 !important;
background-color: var(--black2) !important; --black: #999 !important;
--bgc: #222 !important;
} }
.form-inline.search input {
background-color: var(--black1) !important;
}
.nav-link.active {
color: var(--white) !important;
box-shadow: inset 0 -2px 0 var(--white) !important;
}
.nav-link {
color: var(--gray) !important;
}
/*common*/
body, .card, #main-content-row {
background-color: var(--black2) !important;
/*background-image: var(--bg2);*/
color: var(--white);
}
.posts .card {
border-color: var(--black3) !important;
}
.arrow-up::before, .arrow-down::before, .score {
color: var(--black1);
}
.post-title a {
color: var(--gray) !important;
}
.flaggers, .flaggers a {
background-color: var(--black2) !important;
color: var(--black1) !important;
border-color: var(--gray);
}
.dropdown-menu, .dropdown-menu a {
color: var(--gray);
background-color: var(--black2);
}
.popover, .pop-username, .pop-bio, .popover-user-profile, .popover-user-profile * {
background-color: var(--black2);
color: var(--gray);
border-color: var(--black1) !important;
}
.text-muted {
color: var(--gray) !important;
}
/*frontpage*/
#frontpage .sidebar {
background-color: var(--black2) !important;
color: var(--gray);
}
#frontpage .dropdown .btn {
background-color:transparent !important;
color:yellow;
text-shadow: -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black !important;
border-color: transparent;
font-size: 1.3rem;
}
#frontpage .dropdown-toggle, #frontpage i.fas.mr-1 {
color:yellow !important;
}
/*post*/
.post-meta, .post-actions a, .post-actions button, .nav-link .fas, label, small, .comment-actions * {
color: var(--gray) !important;
}
.comment, .comment-text, .comment-section, .comment-body, .post-body {
background-color: var(--black2);
color: var(--gray) !important;
}
blockquote {
border-left: 2px solid #c5c1ad !important;
background-color: var(--black3) !important;
color: var(--gray) !important;
}
.form-control, .comment-box.form-control.rounded {
background-color: var(--black2) !important;
color: var(--black1) !important;
}
#thread #dropdownMenuButton {
background-color: var(--red) !important;
color: white !important;
border-color: transparent;
}
.btn.format {
background-color: transparent !important;
color: var(--black1) !important;
border-color: transparent !important;
}
/*leaderboard*/
#settings2 .bg-white {
background-color: var(--black2) !important;
}
/*submit*/
#submit .row.fixed-bottom {
background-color: var(--black2) !important
}
/*assorted patches I don't feel like categorizing*/
#followers-table td {
color: var(--black1);
}
#mobile-bottom-navigation-bar .text-primary {
color: var(--red) !important;
}
#mobile-bottom-navigation-bar .text-muted {
color: var(--black1) !important;
}
#settings2 .nav-link.active .fas {
color: var(--gray) !important;
}
#navbarResponsive .nav-link {
color: var(--black1) !important;
}
.mobile-nav-icon {
color: var(--black1);
}
/*patch*/
#settings2 .text-muted {
color: var(--black3)!important;
}
.btn-primary:hover, .btn-secondary:hover {
background-color: var(--red-hover) !important;
color: white!important;
border-color: var(--red-hover)
}
.dropdown-menu a:hover {
color: var(--red);
background-color: #fff;
font-weight: bold;
}
#navbarResponsive .nav-link:hover i {
color: var(--red) !important;
}
.btn-secondary:focus, .btn-secondary.focus {
box-shadow: none;
background-color: white!important;
color: var(--red)!important;
border-color: var(--red);
}
a.nav-link:hover {
color: white !important
}
.nav.settings-nav {
border: 1px solid var(--red-hover)
}
#thread .anchor.comment {
border-left: 2px solid var(--black1)!important;
}
.notifs .comment-collapse-desktop {
border-left: 2px solid var(--black1)!important;
}
.srd {
background-color: var(--black3) !important
}
#navbar .form-control.w-100 {
color: var(--white) !important;
}
/*chat*/
.chat-message {
color: var(--white) !important;
}
.sidebar
{
background-color: #202020 !important;
border-radius: 0px;
margin-top: 0px;
}
.modal-content {
background-color: var(--black2);
}
.tooltip-inner {
color: #d8d8d8 !important;
background-color: #313131 !important;
}
h5.post-title a:visited {
color: #6e6e6e !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -173,6 +173,35 @@ class User(Base):
def __repr__(self): def __repr__(self):
return f"<User(id={self.id}, username={self.username})>" return f"<User(id={self.id}, username={self.username})>"
def pay_account(self, currency, amount):
if currency == 'coins':
g.db.query(User).filter(User.id == self.id).update({ User.coins: User.coins + amount })
else:
g.db.query(User).filter(User.id == self.id).update({ User.procoins: User.procoins + amount })
g.db.flush()
def charge_account(self, currency, amount):
in_db = g.db.query(User).filter(User.id == self.id).one()
succeeded = False
if currency == 'coins':
account_balance = in_db.coins
if account_balance >= amount:
g.db.query(User).filter(User.id == self.id).update({ User.coins: User.coins - amount })
succeeded = True
elif currency == 'procoins':
account_balance = in_db.procoins
if account_balance >= amount:
g.db.query(User).filter(User.id == self.id).update({ User.procoins: User.procoins - amount })
succeeded = True
if succeeded: g.db.flush()
return succeeded
@property @property
@lazy @lazy

View File

@ -71,15 +71,11 @@ def get_active_roulette_games():
def charge_gambler(gambler, amount, currency): def charge_gambler(gambler, amount, currency):
currency_gambler_holds = getattr(gambler, currency) charged = gambler.charge_account(currency, amount)
can_afford = currency_gambler_holds >= amount
if not can_afford: if not charged:
raise Exception("Gambler cannot afford charge.") raise Exception("Gambler cannot afford charge.")
setattr(gambler, currency, currency_gambler_holds - amount)
g.db.add(gambler)
def gambler_placed_roulette_bet(gambler, bet, which, amount, currency): def gambler_placed_roulette_bet(gambler, bet, which, amount, currency):
if not bet in ( if not bet in (
@ -172,10 +168,8 @@ def spin_roulette_wheel():
coin_winnings = gambler_payout['coins'] coin_winnings = gambler_payout['coins']
procoin_winnings = gambler_payout['procoins'] procoin_winnings = gambler_payout['procoins']
setattr(gambler, 'coins', gambler.coins + coin_winnings) gambler.pay_account('coins', coin_winnings)
setattr(gambler, 'procoins', gambler.procoins + procoin_winnings) gambler.pay_account('procoins', procoin_winnings)
g.db.add(gambler)
# Notify the winners. # Notify the winners.
notification_text = f"Winning number: {number}\nCongratulations! One or more of your roulette bets paid off!\n" notification_text = f"Winning number: {number}\nCongratulations! One or more of your roulette bets paid off!\n"

View File

@ -18,22 +18,16 @@ payout_to_symbols = {
def casino_slot_pull(gambler, wager_value, currency): def casino_slot_pull(gambler, wager_value, currency):
over_min = wager_value >= minimum_bet over_min = wager_value >= minimum_bet
under_max = wager_value <= maximum_bet under_max = wager_value <= maximum_bet
currency_value = getattr(gambler, currency) charged = gambler.charge_account(currency, wager_value)
has_proper_funds = currency_value >= wager_value
if (over_min and under_max and has_proper_funds):
setattr(gambler, currency, currency_value - wager_value)
gambler.winnings -= wager_value
if (over_min and under_max and charged):
payout = determine_payout() payout = determine_payout()
reward = wager_value * payout reward = wager_value * payout
currency_value = getattr(gambler, currency, 0) gambler.pay_account(currency, reward)
setattr(gambler, currency, currency_value + reward)
gambler.winnings += reward
symbols = build_symbols(payout) symbols = build_symbols(payout)
text = build_text(wager_value, payout, currency) text = build_text(wager_value, payout, currency)
game_state = { game_state = {
"symbols": symbols, "symbols": symbols,
"text": text "text": text

View File

@ -80,15 +80,11 @@ def get_active_twentyone_game_state(gambler):
def charge_gambler(gambler, amount, currency): def charge_gambler(gambler, amount, currency):
currency_gambler_holds = getattr(gambler, currency) charged = gambler.charge_account(currency, amount)
can_afford = currency_gambler_holds >= amount
if not charged:
if not can_afford:
raise Exception("Gambler cannot afford charge.") raise Exception("Gambler cannot afford charge.")
setattr(gambler, currency, currency_gambler_holds - amount)
g.db.add(gambler)
def create_new_game(gambler, wager, currency): def create_new_game(gambler, wager, currency):
existing_game = get_active_twentyone_game(gambler) existing_game = get_active_twentyone_game(gambler)
@ -245,12 +241,10 @@ def handle_payout(gambler, state, game):
else: else:
raise Exception("Attempted to payout a game that has not finished.") raise Exception("Attempted to payout a game that has not finished.")
currency_gambler_holds = getattr(gambler, game.currency) gambler.pay_account(game.currency, payout)
setattr(gambler, game.currency, currency_gambler_holds + payout)
game.active = False game.active = False
g.db.add(game) g.db.add(game)
g.db.add(gambler)
return payout return payout

View File

@ -144,11 +144,10 @@ def approve_marsey(v, name):
new_path = f'/asset_submissions/marseys/original/{name}.{i.format.lower()}' new_path = f'/asset_submissions/marseys/original/{name}.{i.format.lower()}'
rename(highquality, new_path) rename(highquality, new_path)
if v.id != author.id: author.coins += 250
author.coins += 250 g.db.add(author)
g.db.add(author) msg = f"@{v.username} has approved a marsey you made: :{marsey.name}:\nYou have received 250 coins as a reward!"
msg = f"@{v.username} has approved a marsey you made: :{marsey.name}:\nYou have received 250 coins as a reward!" send_repeatable_notification(author.id, msg)
send_repeatable_notification(author.id, msg)
if v.id not in (author.id, marsey.submitter_id): if v.id not in (author.id, marsey.submitter_id):
msg = f"@{v.username} has approved a marsey you submitted: :{marsey.name}:" msg = f"@{v.username} has approved a marsey you submitted: :{marsey.name}:"
@ -341,4 +340,4 @@ def remove_hat(v, name):
os.remove(f"/asset_submissions/hats/{hat.name}.webp") os.remove(f"/asset_submissions/hats/{hat.name}.webp")
os.remove(f"/asset_submissions/hats/{hat.name}") os.remove(f"/asset_submissions/hats/{hat.name}")
return {"message": f"'{hat.name}' removed!"} return {"message": f"'{hat.name}' removed!"}

View File

@ -205,4 +205,4 @@ def roulette_player_placed_bet(v):
return {"success": True, "bets": bets, "gambler": {"coins": v.coins, "procoins": v.procoins}} return {"success": True, "bets": bets, "gambler": {"coins": v.coins, "procoins": v.procoins}}
except: except:
return {"error": "Unable to place a bet."}, 400 return {"error": "Unable to place a bet."}, 400

View File

@ -3,8 +3,8 @@ set CACHE_VER = {
'css/main.css': 4025, 'css/main.css': 4025,
'css/catalog.css': 4007, 'css/catalog.css': 4007,
'css/4chan.css': 4007, 'css/4chan.css': 4007,
'css/classic.css': 4009, 'css/classic.css': 4010,
'css/classic_dark.css': 4007, 'css/classic_dark.css': 4008,
'css/coffee.css': 4007, 'css/coffee.css': 4007,
'css/dark.css': 4007, 'css/dark.css': 4007,
'css/dramblr.css': 4007, 'css/dramblr.css': 4007,