-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jason/20250113-anonymous-user' into jason/20250119-revi…
…sed-security
- Loading branch information
Showing
21 changed files
with
272 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ build/ | |
.vscode/ | ||
|
||
*.tsv | ||
|
||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
## 애플 클라이언트 JWT 갱신 | ||
## 애플 로그인용 Client Secret 갱신 | ||
|
||
6 개월에 한번씩 갱신해줘야 합니다 | ||
`secret.txt` 파일을 열면 team id, service id, key id, 그리고 authKey 가 저장되어 있습니다. | ||
authKey 에 해당하는 내용을 `authkey.p8` 파일을 만들어 붙여넣고 `generate_client_secret.py` 에 적절한 값을 넣어 실행합니다. | ||
service id, key id 그리고 authKey 는 테섭용과 실섭용이 구분되어 있으니 각각 스크립트에 입력하고 두번 실행해야 합니다. | ||
|
||
`secret.txt` 파일에 있는 저장되어 있는 값을 추출해서 `authkey.p8` 파일을 만든 뒤 `generate_client_secret.py` 파일을 실행합니다 | ||
JWT 의 최대 유효기간이 6개월이라서 6개월마다 갱신해야 합니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...eploying_apps/local_script/src/main/kotlin/club/staircrusher/place/StationLngLatFinder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package club.staircrusher.place | ||
|
||
import club.staircrusher.findLngLat | ||
import club.staircrusher.place.infra.adapter.out.web.KakaoMapsService | ||
import club.staircrusher.place.infra.adapter.out.web.KakaoProperties | ||
|
||
private const val kakaoApiKey = "test key" | ||
private val kakaoMapsService = KakaoMapsService(KakaoProperties(kakaoApiKey)) | ||
|
||
val originalStationNames = listOf( | ||
"압구정로데오","여의도","을지로입구","혜화","숙대입구(갈월)","을지로3가","종각","서초","신논현","충무로","삼성중앙","경복궁(정부서울청사)","상왕십리","종로5가","봉천","영등포시장","동대문역사문화공원","서대문","중랑","광화문(세종문화회관)","회현(남대문시장)","을지로3가","남영","명동","신도림","암사","종로3가","안국","불광","종로3가","시청","용산","신설동","합정","신촌","시청","고속터미널","충무로","이태원","청량리(서울시립대입구)","서울숲","사가정","동대입구","마포","문래","미아사거리","신촌","동대문","수유(강북구청)","영등포","한성대입구(삼선교)","독산","서울역","동대문역사문화공원","신설동","연신내","신설동","구로디지털단지","가산디지털단지","청량리(서울시립대입구)","신당","종로3가","한남","선릉","총신대입구(이수)","서울대입구(관악구청)","국회의사당","동대문","성수","약수","영등포구청","왕십리(성동구청)","왕십리(성동구청)","등촌","금천구청","화곡","논현","오류동","잠실새내","성신여대입구(돈암)","회기","신림","동묘앞","신사","약수","효창공원앞","연신내","삼각지","신당","구의(광진구청)","쌍문","군자(능동)","신림","가산디지털단지","성신여대입구(돈암)","까치산","압구정","디지털미디어시티","한티","언주","역삼","여의도","상봉(시외버스터미널)","공덕","뚝섬","낙성대","녹사평(용산구청)","군자(능동)","삼성(무역센터)","불광","아차산(어린이대공원후문)","신대방삼거리","천호(풍납토성)","건대입구","천호(풍납토성)","사당","안암(고대병원앞)","서울대벤처타운","가양","동묘앞","둔촌동","신논현","구로","홍대입구","선릉","구파발","노량진","석촌","대치","강남구청","신정네거리","공릉(서울과학기술대)","학동","디지털미디어시티","발산","명일","영등포구청","방배","건대입구","강동","신사","길동","공덕","망원","남부터미널(예술의전당)","강남","홍대입구","홍대입구","신도림","선정릉","양재(서초구청)","송정","먹골","송파","이대","상도","상봉(시외버스터미널)","신용산","당산","석계","노원","잠실(송파구청)","송파나루","당산","매봉","창동","선정릉","사당","강남","석촌","교대(법원.검찰청)","상수","강남구청","논현","노원","노량진","수서","잠실(송파구청)","양재(서초구청)","문정","고덕","교대(법원.검찰청)","서울역","가락시장","가락시장","강변(동서울터미널)","오목교(목동운동장앞)","마곡", | ||
) | ||
fun main() { | ||
val lngLatResults = kakaoMapsService.findLngLat(originalStationNames.map { | ||
if ("(" in it) { | ||
it.split("(")[0] | ||
} else { | ||
it | ||
} + "역" | ||
}) | ||
println(lngLatResults) | ||
println(buildString { | ||
appendLine("지하철역,lng,lat") | ||
originalStationNames.zip(lngLatResults).forEach { (originalStationName, lngLatResult) -> | ||
appendLine("$originalStationName,${lngLatResult.lng},${lngLatResult.lat}") | ||
} | ||
}) | ||
} |
1 change: 1 addition & 0 deletions
1
app-server/subprojects/deploying_apps/local_script/src/main/python/.python-version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.9.9 |
66 changes: 66 additions & 0 deletions
66
...ps/local_script/src/main/python/club_quests_target_places/crawl_places_nearby_stations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import csv | ||
import requests | ||
|
||
# API endpoint and authorization token | ||
API_URL = "https://api.staircrusher.club/admin/places/startCrawling" | ||
AUTH_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJfYiI6IlwiYWRtaW5cIiIsImlzcyI6Im91ci1tYXAtc2VydmVyIiwiZXhwIjoxNzYwNTQzODIwfQ.IkHTLjaKS8iuhTCuLgCBQ-Y2ClxthrjV4opanjrIoJK5yFFCFPFL_bWl7N--MoEIIzeWq0w5pHdWA91QM-kGfQ" | ||
HEADERS = { | ||
"authorization": AUTH_TOKEN, | ||
"content-type": "application/json" | ||
} | ||
|
||
# Function to calculate boundary vertices for 250m squares within the given area | ||
def calculate_boundary_vertices(lng, lat, distance_km=1): | ||
delta = distance_km / 111.32 # Approx. km per degree latitude | ||
eighth_delta = delta / 8 | ||
|
||
# Define offsets for the 16 smaller 250m squares | ||
offsets = [ | ||
(-3 * eighth_delta, -3 * eighth_delta), (-1 * eighth_delta, -3 * eighth_delta), (1 * eighth_delta, -3 * eighth_delta), (3 * eighth_delta, -3 * eighth_delta), | ||
(-3 * eighth_delta, -1 * eighth_delta), (-1 * eighth_delta, -1 * eighth_delta), (1 * eighth_delta, -1 * eighth_delta), (3 * eighth_delta, -1 * eighth_delta), | ||
(-3 * eighth_delta, 1 * eighth_delta), (-1 * eighth_delta, 1 * eighth_delta), (1 * eighth_delta, 1 * eighth_delta), (3 * eighth_delta, 1 * eighth_delta), | ||
(-3 * eighth_delta, 3 * eighth_delta), (-1 * eighth_delta, 3 * eighth_delta), (1 * eighth_delta, 3 * eighth_delta), (3 * eighth_delta, 3 * eighth_delta), | ||
] | ||
|
||
# Generate boundary vertices for each square | ||
squares = [] | ||
for offset_lng, offset_lat in offsets: | ||
square = [ | ||
{"lng": lng + offset_lng - eighth_delta, "lat": lat + offset_lat - eighth_delta}, | ||
{"lng": lng + offset_lng + eighth_delta, "lat": lat + offset_lat - eighth_delta}, | ||
{"lng": lng + offset_lng + eighth_delta, "lat": lat + offset_lat + eighth_delta}, | ||
{"lng": lng + offset_lng - eighth_delta, "lat": lat + offset_lat + eighth_delta}, | ||
{"lng": lng + offset_lng - eighth_delta, "lat": lat + offset_lat - eighth_delta}, | ||
] | ||
squares.append(square) | ||
return squares | ||
|
||
# Function to send a crawling request for a given set of boundary vertices | ||
def send_crawling_request(boundary_vertices): | ||
payload = {"boundaryVertices": boundary_vertices} | ||
response = requests.post(API_URL, headers=HEADERS, json=payload) | ||
if response.status_code == 200: | ||
print("Crawling started successfully.") | ||
else: | ||
print(f"Failed to start crawling: {response.status_code}, {response.text}") | ||
|
||
# Main function to process the CSV and initiate crawling | ||
def main(): | ||
input_csv = "subway_stations.csv" # Replace with your CSV file name | ||
|
||
with open(input_csv, newline='', encoding='utf-8') as csvfile: | ||
reader = csv.DictReader(csvfile) | ||
for row in reader: | ||
station_name = row["지하철역"] | ||
longitude = float(row["lng"]) | ||
latitude = float(row["lat"]) | ||
|
||
print(f"Processing station: {station_name} ({longitude}, {latitude})") | ||
|
||
# Calculate boundary vertices for smaller squares | ||
squares = calculate_boundary_vertices(longitude, latitude, 1) # 1 km as total area | ||
for square in squares: | ||
send_crawling_request(square) | ||
|
||
if __name__ == "__main__": | ||
main() |
39 changes: 39 additions & 0 deletions
39
...ript/src/main/python/club_quests_target_places/generate_subway_stations_insert_queries.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import csv | ||
|
||
def generate_chunked_insert_queries(csv_file, table_name, chunk_size=1000): | ||
insert_queries = [] | ||
values = [] | ||
with open(csv_file, newline='', encoding='utf-8') as csvfile: | ||
separator = ',\n' | ||
reader = csv.DictReader(csvfile) | ||
for i, row in enumerate(reader, start=1): | ||
station_name = row['지하철역'] | ||
lng = float(row['lng']) | ||
lat = float(row['lat']) | ||
|
||
# Prepare value for the query | ||
value = f"('{station_name}', {lng}, {lat}, ST_SetSRID(ST_MakePoint({lng}, {lat}), 4326))" | ||
values.append(value) | ||
|
||
# When chunk_size is reached, generate an INSERT query | ||
if i % chunk_size == 0: | ||
query = f"INSERT INTO {table_name} (name, lng, lat, geom) VALUES\n{separator.join(values)};" | ||
insert_queries.append(query) | ||
values = [] # Reset values for the next chunk | ||
|
||
# Add remaining rows as the final query | ||
if values: | ||
query = f"INSERT INTO {table_name} (name, lng, lat, geom) VALUES\n{separator.join(values)};" | ||
insert_queries.append(query) | ||
|
||
return insert_queries | ||
|
||
if __name__ == "__main__": | ||
# Usage | ||
csv_file = "subway_stations.csv" # Replace with your CSV file name | ||
table_name = "data_subway_station" # Replace with your table name | ||
queries = generate_chunked_insert_queries(csv_file, table_name, chunk_size=1000) | ||
|
||
# Print queries | ||
for query in queries: | ||
print(query) |
21 changes: 21 additions & 0 deletions
21
...deploying_apps/local_script/src/main/python/club_quests_target_places/subway_stations.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
지하철역,lng,lat | ||
강남,127.02800140627488,37.49808633653005 | ||
석촌,127.107004062699,37.5054141216925 | ||
교대(법원.검찰청),127.013867969161,37.4927431676548 | ||
상수,126.92242989321456,37.54776618366393 | ||
강남구청,127.0413109462156,37.51721617197854 | ||
논현,127.02165424259898,37.51120000205266 | ||
노원,127.063449137455,37.6563403513278 | ||
노량진,126.940893179777,37.5135856714992 | ||
수서,127.104469788175,37.4852951142482 | ||
잠실(송파구청),127.10023101886318,37.51331105877401 | ||
양재(서초구청),127.03416413380752,37.48457681195669 | ||
문정,127.122484886901,37.4860310539381 | ||
고덕,127.15416500963447,37.55504766830918 | ||
교대(법원.검찰청),127.013867969161,37.4927431676548 | ||
서울역,126.96974961781686,37.55332892758497 | ||
가락시장,127.118262745146,37.4930992522183 | ||
가락시장,127.118262745146,37.4930992522183 | ||
강변(동서울터미널),127.094741101863,37.5351180385975 | ||
오목교(목동운동장앞),126.875307312696,37.5245340839144 | ||
마곡,126.82469691791624,37.56022863776301 |
Oops, something went wrong.