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 |
+
import requests
|
| 7 |
+
import streamlit.components.v1 as components
|
| 8 |
+
import random
|
| 9 |
+
import json
|
| 10 |
+
from io import BytesIO
|
| 11 |
+
import feedparser
|
| 12 |
+
import urllib.request
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
#streamlit-1.16.0
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
im = Image.open("icons8-rabbit-100.png")
|
| 21 |
+
st.set_page_config(
|
| 22 |
+
page_title="Rabbit.web",
|
| 23 |
+
page_icon=im
|
| 24 |
+
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
#https://i.gifer.com/Cal.gif
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
hide_streamlit_style = """
|
| 34 |
+
<style>
|
| 35 |
+
#MainMenu {visibility: hidden;}
|
| 36 |
+
footer {visibility: hidden;}
|
| 37 |
+
</style>
|
| 38 |
+
"""
|
| 39 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
firebaseConfig = {
|
| 43 |
+
"apiKey": "AIzaSyCHnlRFW1_RTgZVVga8E-Rj4g7noddYzXA",
|
| 44 |
+
"authDomain": "rabbit1-bd232.firebaseapp.com",
|
| 45 |
+
"databaseURL": "https://rabbit1-bd232-default-rtdb.firebaseio.com",
|
| 46 |
+
"projectId": "rabbit1-bd232",
|
| 47 |
+
"storageBucket": "rabbit1-bd232.appspot.com",
|
| 48 |
+
"messagingSenderId": "291333251174",
|
| 49 |
+
"appId": "1:291333251174:web:6daeb9908880347a6ecda7",
|
| 50 |
+
"measurementId": "G-H1NRRJQRHT"
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
firebase=Firebase(firebaseConfig)
|
| 54 |
+
auth=firebase.auth()
|
| 55 |
+
|
| 56 |
+
data=firebase.database()
|
| 57 |
+
storage=firebase.storage()
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
query_params = {
|
| 62 |
+
"orderBy": "\"timestamp\"",
|
| 63 |
+
"limitToLast": 1
|
| 64 |
+
}
|
| 65 |
+
query_string = "?" + "&".join([f"{key}={value}" for key, value in query_params.items()])
|
| 66 |
+
|
| 67 |
+
latest_post = data.child("Posts").get(query_string).val()
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
st.markdown("<center><img src=https://img.icons8.com/ios-filled/100/228BE6/rabbit.png; alt=centered image; height=100; width=100> </center>",unsafe_allow_html=True)
|
| 80 |
+
labela=("<h1 style='font-family:arial;color:#228BE6;text-align:center'>Rabbit.web</h1>")
|
| 81 |
+
st.markdown(labela,unsafe_allow_html=True)
|
| 82 |
+
streamlit_style = """
|
| 83 |
+
<style>
|
| 84 |
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap');
|
| 85 |
+
|
| 86 |
+
html, body, [class*="css"] {
|
| 87 |
+
font-family: 'Roboto', sans-serif;
|
| 88 |
+
|
| 89 |
+
}
|
| 90 |
+
</style>
|
| 91 |
+
"""
|
| 92 |
+
st.markdown(streamlit_style, unsafe_allow_html=True)
|
| 93 |
+
streamlitstyle = """
|
| 94 |
+
<style>
|
| 95 |
+
sidebar,body,[class*="css"]{background-image: url("https://i.gifer.com/Cal.gif");
|
| 96 |
+
background-attachment: fixed;
|
| 97 |
+
background-size: cover
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
}
|
| 104 |
+
</style>
|
| 105 |
+
"""
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
st.sidebar.markdown(streamlitstyle, unsafe_allow_html=True)
|
| 110 |
+
st.sidebar.markdown("<center><img src=https://img.icons8.com/ios-filled/100/228BE6/rabbit.png ; alt=centered image; height=100; width=100> </center>",unsafe_allow_html=True)
|
| 111 |
+
|
| 112 |
+
placeholder = st.empty()
|
| 113 |
+
with placeholder.container():
|
| 114 |
+
label=("<h1 style='font-family:arial;color:#228BE6;text-align:center'>Welcome to Rabbit.web</h1>")
|
| 115 |
+
st.markdown(label,unsafe_allow_html=True)
|
| 116 |
+
label=("<h5 style='font-family:arial;color:#228BE6;text-align:left'>At Rabbit.web you can do the following thing's :</h5>")
|
| 117 |
+
st.markdown(label,unsafe_allow_html=True)
|
| 118 |
+
labelc=("<h5 style='font-family:arial;color:#228BE6;text-align:left'>~You can share your thought's </h5>")
|
| 119 |
+
st.markdown(labelc,unsafe_allow_html=True)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
labeld=("<h5 style='font-family:arial;color:#228BE6;text-align:left'>~You can see the post's from people</h5>")
|
| 123 |
+
st.markdown(labeld,unsafe_allow_html=True)
|
| 124 |
+
labeld=("<h5 style='font-family:arial;color:#228BE6;text-align:left'>~You can check the latest new's</h5>")
|
| 125 |
+
st.markdown(labeld,unsafe_allow_html=True)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
label=("<h1 style='font-family:arial;color:#228BE6;text-align:center'>Rabbit.web</h1>")
|
| 132 |
+
st.sidebar.markdown(label,unsafe_allow_html=True)
|
| 133 |
+
|
| 134 |
+
labelb=("<h4 style='font-family:arial;color:#228BE6;text-align:center'>A perfect place to chat with your friend's</h4>")
|
| 135 |
+
st.sidebar.markdown(labelb,unsafe_allow_html=True)
|
| 136 |
+
|
| 137 |
+
choice=st.sidebar.selectbox("Sign in to your account or create an account :",["sign in","create an account"])
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
email=st.sidebar.text_input("",placeholder="Hello please enter you email")
|
| 142 |
+
passw=st.sidebar.text_input("",placeholder="Hello please enter your password",type="password")
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
if choice=="create an account":
|
| 147 |
+
handle=st.sidebar.text_input("",placeholder="Hello please enter your name")
|
| 148 |
+
subbt=st.sidebar.button("Create an new account")
|
| 149 |
+
|
| 150 |
+
if subbt:
|
| 151 |
+
placeholder.empty()
|
| 152 |
+
user=auth.create_user_with_email_and_password(email,passw)
|
| 153 |
+
st.success("Your Rabbit.web account has created successfully !")
|
| 154 |
+
|
| 155 |
+
user=auth.sign_in_with_email_and_password(email,passw)
|
| 156 |
+
data.child(user["localId"]).child("Handle").set(handle)
|
| 157 |
+
data.child(user["localId"]).child("ID").set(user["localId"])
|
| 158 |
+
st.info("You can now log in")
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
if choice=="sign in":
|
| 164 |
+
|
| 165 |
+
signin=st.sidebar.checkbox("sign in")
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
if signin:
|
| 169 |
+
placeholder.empty()
|
| 170 |
+
user=auth.sign_in_with_email_and_password(email,passw)
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
#"Follower's" "list-task"
|
| 174 |
+
nav = option_menu(menu_title=None, options=["Home", "Friend's","New's", "Setting's","About us"],icons=["house","person","list-task", "gear","info"],menu_icon="cast",default_index=2,orientation="vertical",styles={
|
| 175 |
+
"container": {"padding": "0!important", "background-color": "#1c1c1c"},
|
| 176 |
+
"icon": {"color": "lightblue", "font-size": "15px"},
|
| 177 |
+
"nav-link": {"text-align":"left", "margin":"1px", "--hover-color": "#1c1c1c"},
|
| 178 |
+
"nav-link-selected": {"background-color": "#228BE6","color":"#1c1c1c"},})
|
| 179 |
+
|
| 180 |
+
if nav =="Home":
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
st.write(f"#### Share your thought's/post's :")
|
| 184 |
+
post=st.text_input("",placeholder="share your thought with your friend's",max_chars=250)
|
| 185 |
+
add_post=st.button("Share your thought")
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
if add_post:
|
| 196 |
+
now=datetime.now()
|
| 197 |
+
dt=now.strftime("%d / %m / %y")
|
| 198 |
+
dtt=now.strftime("%I:%M %p")
|
| 199 |
+
|
| 200 |
+
post="Post: "+post+ ";"+" Posted on:"+ dt +" at "+dtt
|
| 201 |
+
results=data.child(user["localId"]).child("Posts").push(post)
|
| 202 |
+
st.balloons()
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
# st.write("Upload an image")
|
| 206 |
+
|
| 207 |
+
# caption = st.text_input("",placeholder="Add a caption to your image")
|
| 208 |
+
# expan=st.expander("Upload an image")
|
| 209 |
+
|
| 210 |
+
# with expan:
|
| 211 |
+
# image = st.file_uploader("", type=["jpg", "jpeg", "png","mp3"])
|
| 212 |
+
|
| 213 |
+
# if image is None:
|
| 214 |
+
# st.warning("Please select an image")
|
| 215 |
+
#upbta=st.button("Upload the image and caption")
|
| 216 |
+
|
| 217 |
+
# if upbta:
|
| 218 |
+
# with st.spinner("Uploading image..."):
|
| 219 |
+
# storage.child("images/" + image.name).put(image)
|
| 220 |
+
# post_data = {"caption": caption,"image_url": storage.child("images/" + image.name).get_url(None) }
|
| 221 |
+
# data.child("posts").push(post_data)
|
| 222 |
+
#st.success("Post added successfully")'''
|
| 223 |
+
components.html("""<hr style="height:2px;border:none;color:#333;background-color:white;" /> """)
|
| 224 |
+
col1,col2=st.columns(2)
|
| 225 |
+
|
| 226 |
+
with col1:
|
| 227 |
+
nimg=data.child(user["localId"]).child("Image").get().val()
|
| 228 |
+
if nimg is not None:
|
| 229 |
+
v=data.child(user["localId"]).child("Image").get()
|
| 230 |
+
for img in v.each():
|
| 231 |
+
imgc=img.val()
|
| 232 |
+
|
| 233 |
+
st.markdown(f'<img src="{imgc}" width="200" height="200" style="border-radius:50%;">', unsafe_allow_html=True)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
else:
|
| 237 |
+
st.info("Oop's no profile pic till now ")
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
with col2:
|
| 243 |
+
st.title("Post's :")
|
| 244 |
+
st.write(f"###### ______________________________________________________")
|
| 245 |
+
all_posts=data.child(user['localId']).child("Posts").get()
|
| 246 |
+
all_imgs=data.child(user['localId']).child("images").get()
|
| 247 |
+
|
| 248 |
+
if all_posts.val() is not None:
|
| 249 |
+
for Posts in reversed(all_posts.each()):
|
| 250 |
+
|
| 251 |
+
st.success(Posts.val())
|
| 252 |
+
if st.button("🗑 Delete this post ",key=f"Delete_({Posts.key()})"):
|
| 253 |
+
data.child(user["localId"]).child("Posts").child(Posts.key()).remove()
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
st.write(f"###### ______________________________________________________")
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
else:
|
| 267 |
+
st.info("Oop's no thought till now")
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
# posts = data.child("posts").get()
|
| 271 |
+
#for post in posts.each():
|
| 272 |
+
#caption = post.val()["caption"]
|
| 273 |
+
#image_url = post.val()["image_url"]
|
| 274 |
+
|
| 275 |
+
#st.write(caption)
|
| 276 |
+
#response = requests.get(image_url)
|
| 277 |
+
#img = Image.open(BytesIO(response.content))
|
| 278 |
+
#st.image(img, caption=caption, use_column_width=True)
|
| 279 |
+
#components.html("""<hr style="height:2px;border:none;color:#333;background-color:white;" /> """)
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
col3=st.columns(1)
|
| 283 |
+
with col1:
|
| 284 |
+
st.title("Bio :")
|
| 285 |
+
all_bio=data.child(user["localId"]).child("Bio").get()
|
| 286 |
+
|
| 287 |
+
if all_bio.val() is not None:
|
| 288 |
+
|
| 289 |
+
bio=data.child(user["localId"]).child("Bio").get()
|
| 290 |
+
for bio in bio.each():
|
| 291 |
+
bioc=bio.val()
|
| 292 |
+
st.info(bioc)
|
| 293 |
+
else:
|
| 294 |
+
st.info("Oop's no Bio till now")
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
elif nav =="Setting's":
|
| 298 |
+
nimg=data.child(user["localId"]).child("Image").get().val()
|
| 299 |
+
if nimg is not None:
|
| 300 |
+
Image=data.child(user["localId"]).child("Image").get()
|
| 301 |
+
for img in Image.each():
|
| 302 |
+
imgc=img.val()
|
| 303 |
+
|
| 304 |
+
st.markdown(f'<img src="{imgc}" width="200" height="200" style="border-radius:50%;">', unsafe_allow_html=True)
|
| 305 |
+
|
| 306 |
+
expa=st.expander("Change your profile pic")
|
| 307 |
+
|
| 308 |
+
with expa:
|
| 309 |
+
newimgp=st.file_uploader("Please choose your profile pic")
|
| 310 |
+
upbt=st.button("Upload profile pic")
|
| 311 |
+
if upbt:
|
| 312 |
+
uid=user["localId"]
|
| 313 |
+
dataup=storage.child(uid).put(newimgp,user["idToken"])
|
| 314 |
+
aimgdata=storage.child(uid).get_url(dataup["downloadTokens"])
|
| 315 |
+
|
| 316 |
+
data.child(user["localId"]).child("Image").push(aimgdata)
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
st.info("Your profile pic is set successfully")
|
| 320 |
+
st.balloons()
|
| 321 |
+
else:
|
| 322 |
+
st.info("Oop's no profile pic till now")
|
| 323 |
+
newimgp=st.file_uploader("Please choose your profile pic")
|
| 324 |
+
upbt=st.button("Upload profile pic")
|
| 325 |
+
if upbt:
|
| 326 |
+
uid=user["localId"]
|
| 327 |
+
dataup=storage.child(uid).put(newimgp,user["idToken"])
|
| 328 |
+
aimgdata=storage.child(uid).get_url(dataup["downloadTokens"])
|
| 329 |
+
data.child(user["localId"]).child("Image").push(aimgdata)
|
| 330 |
+
|
| 331 |
+
bio=data.child(user["localId"]).child("Bio").get().val()
|
| 332 |
+
if bio is not None:
|
| 333 |
+
bio=data.child(user["localId"]).child("Bio").get()
|
| 334 |
+
for bio in bio.each():
|
| 335 |
+
bioc=bio.val()
|
| 336 |
+
st.info(bioc)
|
| 337 |
+
|
| 338 |
+
bioin=st.text_area("",placeholder="Enter your Bio to be uploaded eg: name,date of birth etc")
|
| 339 |
+
upbtn=st.button("Upload Bio")
|
| 340 |
+
|
| 341 |
+
if upbtn:
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
data.child(user["localId"]).child("Bio").push(bioin)
|
| 346 |
+
|
| 347 |
+
st.info("Your Bio is set successfully")
|
| 348 |
+
st.balloons()
|
| 349 |
+
else:
|
| 350 |
+
st.info("Oop's no Bio till now")
|
| 351 |
+
bioin=st.text_area("",placeholder="Enter your Bio to be uploaded eg: name,date of birth etc")
|
| 352 |
+
upbtn=st.button("Upload Bio")
|
| 353 |
+
|
| 354 |
+
if upbtn:
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
data.child(user["localId"]).child("Bio").push(bioin)
|
| 358 |
+
|
| 359 |
+
st.info("Your Bio is set successfully")
|
| 360 |
+
st.balloons()
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
elif nav=="Friend's":
|
| 364 |
+
allu=data.get()
|
| 365 |
+
resa=[]
|
| 366 |
+
|
| 367 |
+
for ush in allu.each():
|
| 368 |
+
|
| 369 |
+
k=ush.val().get("Handle")
|
| 370 |
+
resa.append(k)
|
| 371 |
+
|
| 372 |
+
n = len(resa)
|
| 373 |
+
|
| 374 |
+
st.title("Search your Friend's :")
|
| 375 |
+
cho = st.selectbox('',resa)
|
| 376 |
+
pusha = st.button('Show Profile')
|
| 377 |
+
|
| 378 |
+
if pusha:
|
| 379 |
+
for ush in allu.each():
|
| 380 |
+
k=ush.val().get("Handle")
|
| 381 |
+
if k==cho:
|
| 382 |
+
l=ush.val().get("ID")
|
| 383 |
+
|
| 384 |
+
hn=data.child(l).child("Handle").get().val()
|
| 385 |
+
|
| 386 |
+
st.markdown(hn,unsafe_allow_html=True)
|
| 387 |
+
components.html("""<hr style="height:2px;border:none;color:#333;background-color:white;" /> """)
|
| 388 |
+
col1,col2=st.columns(2)
|
| 389 |
+
with col1:
|
| 390 |
+
nimg=data.child(l).child("Image").get().val()
|
| 391 |
+
if nimg is not None:
|
| 392 |
+
v=data.child(l).child("Image").get()
|
| 393 |
+
for img in v.each():
|
| 394 |
+
imgc=img.val()
|
| 395 |
+
|
| 396 |
+
st.markdown(f'<img src="{imgc}" width="200" height="200" style="border-radius:50%;">', unsafe_allow_html=True)
|
| 397 |
+
|
| 398 |
+
else:
|
| 399 |
+
st.info("Oop's no profile pic till now ")
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
with col2:
|
| 407 |
+
st.title("Post's :")
|
| 408 |
+
st.write(f"###### ______________________________________________________")
|
| 409 |
+
all_posts=data.child(l).child("Posts").get()
|
| 410 |
+
if all_posts.val() is not None:
|
| 411 |
+
for Posts in reversed(all_posts.each()):
|
| 412 |
+
|
| 413 |
+
st.success(Posts.val())
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
st.write(f"###### ______________________________________________________")
|
| 421 |
+
|
| 422 |
+
else:
|
| 423 |
+
st.info("Oop's no thought till now")
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
|
| 427 |
+
col3=st.columns(1)
|
| 428 |
+
with col1:
|
| 429 |
+
st.title("Bio :")
|
| 430 |
+
all_bio=data.child(l).child("Bio").get()
|
| 431 |
+
|
| 432 |
+
if all_bio.val() is not None:
|
| 433 |
+
bio=data.child(l).child("Bio").get()
|
| 434 |
+
for bio in bio.each():
|
| 435 |
+
bioc=bio.val()
|
| 436 |
+
st.info(bioc)
|
| 437 |
+
else:
|
| 438 |
+
st.info("Oop's no Bio till now")
|
| 439 |
+
elif nav=="New's":
|
| 440 |
+
|
| 441 |
+
st.title("Have a look at today's latest new's :")
|
| 442 |
+
components.html("""<hr style="height:2px;border:none;color:#333;background-color:white;" /> """)
|
| 443 |
+
news_feed = feedparser.parse("https://rss.nytimes.com/services/xml/rss/nyt/World.xml")
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
for item in news_feed.entries:
|
| 447 |
+
try:
|
| 448 |
+
st.write(f"## {item.title}")
|
| 449 |
+
st.write(item.summary)
|
| 450 |
+
image_url = item.media_content[0]["url"]
|
| 451 |
+
image_file = urllib.request.urlopen(image_url)
|
| 452 |
+
image = Image.open(image_file)
|
| 453 |
+
st.write(f"[Read more]({item.link})")
|
| 454 |
+
|
| 455 |
+
st.image(image, caption="", use_column_width=True)
|
| 456 |
+
st.write(f"###### ______________________________________________________")
|
| 457 |
+
except:
|
| 458 |
+
st.write("")
|
| 459 |
+
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
#st.info("Sorry this page is currently under construction")
|
| 463 |
+
#st.markdown("<center><h1>⚠️</h1> </center>",unsafe_allow_html=True)
|
| 464 |
+
#st.components.v1.html('<iframe src="https://giphy.com/embed/hV1dkT2u1gqTUpKdKy" frameBorder=0></iframe>', width=800, height=800)
|
| 465 |
+
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
else:
|
| 469 |
+
st.write("Rabbit.web")
|
| 470 |
+
st.write("Created and maintained by Navpreet Singh")
|
| 471 |
+
st.write("For help,feedback or suggestion contact our company at rabbitweb854@gmail.com")
|
| 472 |
+
st.write("For reporting a user on Rabbit.web contact us at rabbitweb854@gmail.com")
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
#{"rules": {
|
| 476 |
+
# ".read": "now < 1682706600000", // 2023-4-29
|
| 477 |
+
# ".write": "now < 1682706600000", // 2023-4-29
|
| 478 |
+
#}
|
| 479 |
+
#}
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
|
| 486 |
+
|
| 487 |
+
|