Compare commits

...

5 Commits

  1. 2
      .github/workflows/publish.yml
  2. 2
      .github/workflows/tests.yml
  3. 2
      ozgursozluk/__init__.py
  4. 4
      ozgursozluk/configs.py
  5. 7
      ozgursozluk/scraper.py
  6. BIN
      ozgursozluk/static/btc.jpeg
  7. BIN
      ozgursozluk/static/btc.png
  8. 47
      ozgursozluk/static/style.css
  9. BIN
      ozgursozluk/static/xmr.png
  10. 4
      ozgursozluk/templates/author.html
  11. 19
      ozgursozluk/templates/donate.html
  12. 8
      ozgursozluk/templates/macros.html
  13. 22
      ozgursozluk/templates/settings.html
  14. 18
      ozgursozluk/utils.py
  15. 3
      ozgursozluk/views.py
  16. 8
      requirements.txt

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up latest Python
uses: actions/setup-python@v4

@ -8,7 +8,7 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:

@ -3,7 +3,7 @@ from flask import Flask
from ozgursozluk.configs import SECRET_KEY
__version__ = "0.7.5"
__version__ = "0.8.0"
__source_code__ = "https://github.com/beucismis/ozgursozluk"
__description__ = "a free and open source alternative ekşi sözlük front-end"

@ -3,9 +3,7 @@ from typing import Final
SECRET_KEY: Final = environ.get("OZGURSOZLUK_SECRET_KEY", "")
EKSI_SOZLUK_BASE_URL: Final = environ.get(
"EKSI_SOZLUK_BASE_URL", "https://eksisozluk1923.com"
)
EKSI_SOZLUK_BASE_URL: Final = environ.get("EKSI_SOZLUK_BASE_URL", "https://eksisozluk.com")
DEFAULT_THEME: Final = "light"
DEFAULT_DISPLAY_PINNED_TOPICS: Final = "true"

@ -58,6 +58,11 @@ class EksiSozluk:
"SearchForm.SortOrder": "Count",
}
response = self.request("GET", "/basliklar/ara", payload)
total_topic = response.find("p", class_="topic-list-description")
if not bool(int(total_topic.text.split(" ")[0])):
abort(404)
topic_list = response.find("ul", class_="topic-list").find_all("a", href=True)
for topic in topic_list:
@ -152,6 +157,6 @@ class EksiSozluk:
for topic in topic_list:
yield Debe(
int(topic["href"].split("/")[-1]),
int(topic["href"].split("/")[-1].split("?")[0]),
topic.find("span", class_="caption").text,
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

@ -58,16 +58,6 @@ form {
padding-top: 0.5rem;
}
form .settings-group {
display: flex;
align-items: center;
padding-bottom: 0.5rem;
}
form .settings-group > :last-child {
margin-left: auto;
}
form input, form select {
min-width: 35%;
box-sizing: content-box;
@ -95,6 +85,7 @@ form input, form select, form button {
}
.title {
padding-top: 2rem;
text-align: center;
font-weight: normal;
}
@ -175,19 +166,40 @@ form input, form select, form button {
.avatar {
border: 0;
width: 100px;
height: 100px;
width: 150px;
height: 150px;
margin: 0.5rem;
border-radius: 50%;
padding-top: 0.5rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.settings {
width: 100%;
margin: 0 auto;
max-width: 600px;
padding-top: 1rem;
margin: 2rem auto 1rem auto;
background-color: var(--entry-bg);
}
form .settings-group {
display: flex;
align-items: center;
padding: 0 0.5rem 0.5rem 0.5rem;
}
form .settings-group > :last-child {
margin-left: auto;
}
.donate {
width: 100%;
max-width: 600px;
padding: 0.5rem;
text-align: center;
margin: 2rem auto 1rem auto;
background-color: var(--entry-bg);
}
.donate p {
margin-top: 0;
}
@media screen and (max-width: 1000px) {
@ -215,3 +227,4 @@ form input, form select, form button {
grid-template-columns: none;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

@ -21,9 +21,7 @@
-
<small>{{ author.user_following_count }} following</small>
</br></br>
<a href="{{ url_for('search', q=author.nickname) }}">
if available go author topic
</a>
<a href="{{ url_for('search', q=author.nickname) }}">author topic</a>
</div>
</div>
{% if author.biography %}

@ -5,19 +5,14 @@
<meta name="description" content="{{ description }}">
{% endblock %}
{% block main %}
<div class="topic" style="max-width: 500px; text-align: center; padding-top: 1rem; word-wrap: break-word;">
<p>donate to the developer</p>
<div class="topic donate">
<p>
<b>bitcoin (btc):</b>
</br>
bc1q7gfc2azv79a9ttvreumkcfmdeyfqgc369m0xq2
donate to the developer <3
</br></br>
<b>bitcoin [btc]:</b></br>
3EEMjJwf1RE48iziynYYPweV1nsWguTUUz
</p>
<img src="{{ url_for('static', filename='btc.png') }}" width="180">
<p>
<b>monero (xmr):</b>
</br>
48Z3KoMWRPq7i185KKKjiXNkDgTQScUJH479BmEWkFjfPwFLtaxuxhPaSYTJrq3XhKTnWayTQCod78T16gTXyhNR625XLsH
</p>
<img src="{{ url_for('static', filename='xmr.png') }}" width="180">
</b>
<img src="{{ url_for('static', filename='btc.jpeg') }}" width="200">
</div>
{% endblock %}

@ -1,7 +1,13 @@
{% macro render_entry(entry, clickable_date) %}
<div class="entry">
{{ entry.content_html|safe }}
</br>
{% if
(request.cookies.get('display_entry_favorite_count') == 'true') or
(request.cookies.get('display_entry_author') == 'true') or
(request.cookies.get('display_entry_datetime') == 'true')
%}
</br>
{% endif %}
<div style="text-align: right;">
{% if request.cookies.get('display_entry_favorite_count') == 'true' %}
<small>{{ entry.favorite_count }} favorites</small>

@ -62,26 +62,24 @@
{% endfor %}
</select>
</div>
<div style="text-align: right; padding-top: 2rem; padding-bottom: 2rem;">
<div style="text-align: right; padding: 2rem 0.5rem 2rem 0.5rem;">
<button style="width: 100%;" type="submit">save</button>
</div>
</form>
<div style="text-align: center;">
note: settings are saved in browser cookies, clearing your cookies will reset them.
<div style="text-align: center; padding-bottom: 0.5rem;">
<b>note:</b> settings are saved in browser cookies, clearing your cookies will reset them.
also this website does not have an official affiliation with eksisozluk.com.
</br></br>
v{{ version }}
<b>v{{ version }}</b>
-
last commit:
<a href="{{ source_code }}/commit/{{ last_commit }}" target="_blank">{{ last_commit[:8] }}</a>
last commit(s):
{% if last_commit == None %}
<a href="{{ source_code }}/commits" target="_blank">go</a>
{% else %}
<a href="{{ source_code }}/commit/{{ last_commit }}" target="_blank">{{ last_commit[:8] }}</a>
{% endif %}
-
made with <3 on the <a href="{{ url_for('topic', path='thinkpad-t61--1883047') }}">t61</a>
</br></br>
contributors:
{% for contributor in contributors %}
<a href="https://github.com/{{ contributor['username'] }}">{{ contributor['username'] }}</a>
({{ contributor['total-commit'] }})
{% endfor %}
</div>
</div>
{% endblock %}

@ -2,6 +2,8 @@ from datetime import datetime, timedelta
import requests
import ozgursozluk
def expires() -> datetime:
"""One year later."""
@ -14,18 +16,8 @@ def last_commit() -> str:
request = requests.get("https://api.github.com/repos/beucismis/ozgursozluk/commits")
if request.status_code == 403:
return None
return request.json()[0]["sha"]
def contributors() -> list:
"""Get GitHub contributors."""
request = requests.get(
"https://api.github.com/repos/beucismis/ozgursozluk/contributors"
)
for contributor in request.json():
yield {
"username": contributor["login"],
"total-commit": contributor["contributions"],
}

@ -4,7 +4,7 @@ from flask import url_for, redirect, request, render_template
import ozgursozluk
from ozgursozluk.scraper import EksiSozluk
from ozgursozluk.utils import last_commit, expires, contributors
from ozgursozluk.utils import last_commit, expires
from ozgursozluk.configs import THEMES, DEFAULT_COOKIES
@ -18,7 +18,6 @@ def global_template_variables():
return dict(
themes=THEMES,
last_commit=last_commit(),
contributors=contributors(),
version=ozgursozluk.__version__,
source_code=ozgursozluk.__source_code__,
description=ozgursozluk.__description__,

@ -1,5 +1,5 @@
flask==2.2.5
gunicorn==20.1.0
flask==3.0.2
gunicorn==21.2.0
requests==2.31.0
fake-useragent==1.1.3
beautifulsoup4==4.12.2
fake-useragent==1.4.0
beautifulsoup4==4.12.3

Loading…
Cancel
Save