Navpreet commited on
Commit
882caf7
·
1 Parent(s): fc8e45f

first commit

Browse files
Pyrebase-3.0.27-py3-none-any.whl ADDED
Binary file (9.56 kB). View file
 
Rabbit.web.py ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pyrebase
3
+ from datetime import datetime
4
+ from streamlit_option_menu import option_menu
5
+ from PIL import Image
6
+ import requests
7
+ import streamlit.components.v1 as components
8
+
9
+
10
+ #streamlit-1.16.0
11
+
12
+
13
+ im = Image.open("icons8-rabbit-100.png")
14
+ st.set_page_config(
15
+ page_title="Rabbit.web",
16
+ page_icon=im
17
+
18
+ )
19
+
20
+
21
+
22
+
23
+ def add_bg_from_url():
24
+ st.markdown(
25
+ f"""
26
+ <style>
27
+ .stApp {{
28
+ background-image: url("https://images.squarespace-cdn.com/content/v1/5fe4caeadae61a2f19719512/1609537599282-NP1M5U8V0U0NDWQY9QRR/Starfield");
29
+ background-attachment: fixed;
30
+ background-size: cover
31
+ }}
32
+ </style>
33
+ """,
34
+ unsafe_allow_html=True
35
+ )
36
+
37
+ add_bg_from_url()
38
+
39
+ hide_streamlit_style = """
40
+ <style>
41
+ #MainMenu {visibility: hidden;}
42
+ footer {visibility: hidden;}
43
+ </style>
44
+ """
45
+ st.markdown(hide_streamlit_style, unsafe_allow_html=True)
46
+
47
+ firebaseConfig = {
48
+ "apiKey": "AIzaSyDTY8XA0vTApBwTVurob82FFUOMBkWzg-w",
49
+ "authDomain": "none-d12f3.firebaseapp.com",
50
+ "projectId": "none-d12f3",
51
+ "storageBucket": "none-d12f3.appspot.com",
52
+ "databaseURL":"https://none-d12f3-default-rtdb.firebaseio.com/",
53
+ "messagingSenderId": "300216235483",
54
+ "appId": "1:300216235483:web:cf88ae462225f8ce16e3fe",
55
+ "measurementId": "G-MLZN385TMD"
56
+ };
57
+
58
+ firebase=pyrebase.initialize_app(firebaseConfig)
59
+ auth=firebase.auth()
60
+
61
+ data=firebase.database()
62
+ storage=firebase.storage()
63
+
64
+ 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)
65
+ labela=("<h1 style='font-family:arial;color:#228BE6;text-align:center'>Rabbit.web</h1>")
66
+ st.markdown(labela,unsafe_allow_html=True)
67
+ streamlit_style = """
68
+ <style>
69
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap');
70
+
71
+ html, body, [class*="css"] {
72
+ font-family: 'Roboto', sans-serif;
73
+ }
74
+ </style>
75
+ """
76
+ st.markdown(streamlit_style, unsafe_allow_html=True)
77
+ streamlitstyle = """
78
+ <style>
79
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap');
80
+
81
+ html, body, [class*="css"] {
82
+ font-family: 'Roboto', sans-serif;
83
+ }
84
+ </style>
85
+ """
86
+ st.sidebar.markdown(streamlitstyle, unsafe_allow_html=True)
87
+ 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)
88
+
89
+
90
+
91
+ label=("<h1 style='font-family:arial;color:#228BE6;text-align:center'>Rabbit.web</h1>")
92
+ st.sidebar.markdown(label,unsafe_allow_html=True)
93
+
94
+ labelb=("<h4 style='font-family:arial;color:#228BE6;text-align:center'>A perfect place to chat with your friend's</h4>")
95
+ st.sidebar.markdown(labelb,unsafe_allow_html=True)
96
+
97
+ choice=st.sidebar.selectbox("Sign in to your account or create an account :",["sign in","create an account"])
98
+
99
+
100
+
101
+ email=st.sidebar.text_input("",placeholder="Hello please enter you email")
102
+ passw=st.sidebar.text_input("",placeholder="Hello please enter your password",type="password")
103
+
104
+
105
+
106
+ if choice=="create an account":
107
+ handle=st.sidebar.text_input("",placeholder="Hello please enter your name")
108
+ subbt=st.sidebar.button("Create an new account")
109
+
110
+ if subbt:
111
+ user=auth.create_user_with_email_and_password(email,passw)
112
+ st.success("Your Rabbit.web account has created successfully !")
113
+
114
+ user=auth.sign_in_with_email_and_password(email,passw)
115
+ data.child(user["localId"]).child("Handle").set(handle)
116
+ data.child(user["localId"]).child("ID").set(user["localId"])
117
+ st.info("You have successfully logged in")
118
+
119
+
120
+
121
+
122
+
123
+ if choice=="sign in":
124
+
125
+ signin=st.sidebar.checkbox("sign in")
126
+
127
+
128
+ if signin:
129
+ user=auth.sign_in_with_email_and_password(email,passw)
130
+
131
+
132
+ nav = option_menu(menu_title=None, options=["Home", "Posts", "Settings","About us"],icons=["house", "book", "gear","info"],menu_icon="cast",default_index=0,orientation="verticle",styles={
133
+ "container": {"padding": "0!important", "background-color": "#1c1c1c"},
134
+ "icon": {"color": "lightblue", "font-size": "20px"},
135
+ "nav-link": {"text-align":"left", "margin":"0px", "--hover-color": "#1c1c1c"},
136
+ "nav-link-selected": {"background-color": "#228BE6","color":"#1c1c1c"},})
137
+
138
+ if nav =="Home":
139
+
140
+ post=st.text_input("",placeholder="share your thought with your friend's",max_chars=250)
141
+ add_post=st.button("Share your thought")
142
+
143
+
144
+
145
+ if add_post:
146
+ now=datetime.now()
147
+ dt=now.strftime("%d / %m / %y")
148
+ dtt=now.strftime("%I:%M %p")
149
+
150
+ post="Post: "+post+ ";"+" Posted on:"+ dt +" at "+dtt
151
+ results=data.child(user["localId"]).child("Posts").push(post)
152
+ st.balloons()
153
+ components.html("""<hr style="height:2px;border:none;color:#333;background-color:white;" /> """)
154
+ col1,col2=st.columns(2)
155
+
156
+ with col1:
157
+ nimg=data.child(user["localId"]).child("Image").get().val()
158
+ if nimg is not None:
159
+ v=data.child(user["localId"]).child("Image").get()
160
+ for img in v.each():
161
+ imgc=img.val()
162
+ st.image(imgc,use_column_width=True)
163
+
164
+ else:
165
+ st.info("Oop's no profile pic till now ")
166
+
167
+
168
+
169
+ with col2:
170
+ st.title("Post's :")
171
+ all_posts=data.child(user['localId']).child("Posts").get()
172
+
173
+ if all_posts.val() is not None:
174
+ for Posts in reversed(all_posts.each()):
175
+ st.success(Posts.val())
176
+
177
+ else:
178
+ st.info("Oop's no thought till now")
179
+ col3=st.columns(1)
180
+ with col1:
181
+ st.title("Bio :")
182
+ all_bio=data.child(user["localId"]).child("Bio").get()
183
+
184
+ if all_bio.val() is not None:
185
+
186
+ bio=data.child(user["localId"]).child("Bio").get()
187
+ for bio in bio.each():
188
+ bioc=bio.val()
189
+ st.info(bioc)
190
+ else:
191
+ st.info("Oop's no Bio till now")
192
+
193
+
194
+ elif nav =="Settings":
195
+ nimg=data.child(user["localId"]).child("Image").get().val()
196
+ if nimg is not None:
197
+ Image=data.child(user["localId"]).child("Image").get()
198
+ for img in Image.each():
199
+ imgc=img.val()
200
+ st.image(imgc)
201
+
202
+ expa=st.expander("Change your profile pic")
203
+
204
+ with expa:
205
+ newimgp=st.file_uploader("Please choose your profile pic")
206
+ upbt=st.button("Upload profile pic")
207
+ if upbt:
208
+ uid=user["localId"]
209
+ dataup=storage.child(uid).put(newimgp,user["idToken"])
210
+ aimgdata=storage.child(uid).get_url(dataup["downloadTokens"])
211
+
212
+ data.child(user["localId"]).child("Image").push(aimgdata)
213
+
214
+ st.info("Your profile pic is set successfully")
215
+ st.balloons()
216
+ else:
217
+ st.info("Oop's no profile pic till now")
218
+ newimgp=st.file_uploader("Please choose your profile pic")
219
+ upbt=st.button("Upload profile pic")
220
+ if upbt:
221
+ uid=user["localId"]
222
+ dataup=storage.child(uid).put(newimgp,user["idToken"])
223
+ aimgdata=storage.child(uid).get_url(dataup["downloadTokens"])
224
+ data.child(user["localId"]).child("Image").push(aimgdata)
225
+
226
+ bio=data.child(user["localId"]).child("Bio").get().val()
227
+ if bio is not None:
228
+ bio=data.child(user["localId"]).child("Bio").get()
229
+ for bio in bio.each():
230
+ bioc=bio.val()
231
+ st.info(bioc)
232
+
233
+ bioin=st.text_area("",placeholder="Enter your Bio to be uploaded eg: name,date of birth etc")
234
+ upbtn=st.button("Upload Bio")
235
+
236
+ if upbtn:
237
+
238
+
239
+
240
+ data.child(user["localId"]).child("Bio").push(bioin)
241
+
242
+ st.info("Your Bio is set successfully")
243
+ st.balloons()
244
+ else:
245
+ st.info("Oop's no Bio till now")
246
+ bioin=st.text_area("",placeholder="Enter your Bio to be uploaded eg: name,date of birth etc")
247
+ upbtn=st.button("Upload Bio")
248
+
249
+ if upbtn:
250
+
251
+
252
+ data.child(user["localId"]).child("Bio").push(bioin)
253
+
254
+ st.info("Your Bio is set successfully")
255
+ st.balloons()
256
+
257
+
258
+ elif nav=="Posts":
259
+ allu=data.get()
260
+ resa=[]
261
+
262
+ for ush in allu.each():
263
+
264
+ k=ush.val().get("Handle")
265
+ resa.append(k)
266
+
267
+ n = len(resa)
268
+
269
+ st.title("Search your Friend's :")
270
+ cho = st.selectbox('',resa)
271
+ pusha = st.button('Show Profile')
272
+
273
+ if pusha:
274
+ for ush in allu.each():
275
+ k=ush.val().get("Handle")
276
+ if k==cho:
277
+ l=ush.val().get("ID")
278
+
279
+ hn=data.child(l).child("Handle").get().val()
280
+
281
+ st.markdown(hn,unsafe_allow_html=True)
282
+ components.html("""<hr style="height:2px;border:none;color:#333;background-color:white;" /> """)
283
+ col1,col2=st.columns(2)
284
+ with col1:
285
+ nimg=data.child(l).child("Image").get().val()
286
+ if nimg is not None:
287
+ v=data.child(l).child("Image").get()
288
+ for img in v.each():
289
+ imgc=img.val()
290
+ st.image(imgc,use_column_width=True)
291
+
292
+ else:
293
+ st.info("Oop's no profile pic till now ")
294
+
295
+
296
+
297
+
298
+ with col2:
299
+ st.title("Post's :")
300
+ all_posts=data.child(l).child("Posts").get()
301
+ if all_posts.val() is not None:
302
+ for Posts in reversed(all_posts.each()):
303
+ st.success(Posts.val())
304
+ else:
305
+ st.info("Oop's no thought till now")
306
+ col3=st.columns(1)
307
+ with col1:
308
+ st.title("Bio :")
309
+ all_bio=data.child(l).child("Bio").get()
310
+
311
+ if all_bio.val() is not None:
312
+ bio=data.child(l).child("Bio").get()
313
+ for bio in bio.each():
314
+ bioc=bio.val()
315
+ st.info(bioc)
316
+ else:
317
+ st.info("Oop's no Bio till now")
318
+
319
+ else:
320
+ st.write("Rabbit.web")
321
+ st.write("Created and maintained by Navpreet Singh")
322
+ st.write("For help,feedback or suggestion contact our company at rabbitweb854@gmail.com")
323
+ st.write("For reporting a user on Rabbit.web contact us at rabbitweb854@gmail.com")
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
icons8-rabbit-100.png ADDED
packages.txt.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ pyrebase4
2
+ pyrebase
requirements.text.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ datetime
3
+ pycryptodome
4
+ pycryptodome==3.10.1
5
+ pyrebase4
6
+ streamlit_option_menu
7
+ PIL
8
+ requests
9
+ streamlit.components.v1
10
+ pyrebase