Compare commits
19 commits
master
...
pastk-2gen
Author | SHA1 | Date | |
---|---|---|---|
8e5aca6c78 | |||
7ca1ea3d26 | |||
b2ed907ed7 | |||
2eb6e54edc | |||
1bc7ef354c | |||
0621e7159d | |||
8e9a34478a | |||
63233c8ebc | |||
87bdc4f547 | |||
07e53b0271 | |||
3c7d80cc96 | |||
020d0c2721 | |||
70236ca811 | |||
981a9efa77 | |||
34fa9c9a1d | |||
7bdd7863bf | |||
42b5b0e3e0 | |||
824bcd0d60 | |||
61d7618cb2 |
|
@ -21,7 +21,7 @@ IndentCaseLabels: false
|
|||
NamespaceIndentation: None
|
||||
PointerAlignment: Middle
|
||||
SortIncludes: true
|
||||
Standard: c++20
|
||||
Standard: c++17
|
||||
IncludeBlocks: Regroup
|
||||
IncludeCategories:
|
||||
# Tests --------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
6aa73face8b5eb8e026cfafa40d1983d4a0502c0
|
||||
480fa6c2fcf53be296504ac6ba8e6b3d70f92b42
|
||||
a6ede2b1466f0c9d8a443600ef337ba6b5832e58
|
||||
1377b81bf1cac72bb6da192da7fed6696d5d5281
|
||||
|
|
78
.github/CODEOWNERS
vendored
|
@ -1,69 +1,9 @@
|
|||
# All non-assigned.
|
||||
* @organicmaps/mergers
|
||||
# Visual design.
|
||||
/android/app/src/main/res/drawable*/ @organicmaps/design
|
||||
/android/app/src/main/res/font/ @organicmaps/design
|
||||
/android/app/src/main/res/mipmap*/ @organicmaps/design
|
||||
/data/*.ttf @organicmaps/design
|
||||
/data/resources-svg/ @organicmaps/design
|
||||
/data/search-icons/ @organicmaps/design
|
||||
/iphone/Maps/Images.xcassets/ @organicmaps/design
|
||||
# Android.
|
||||
/android/ @organicmaps/android
|
||||
/android/app/src/main/java/app/organicmaps/car/ @organicmaps/android-auto
|
||||
/docs/ANDROID_LOCATION_TEST.md @organicmaps/android
|
||||
/docs/JAVA_STYLE.md @organicmaps/android
|
||||
# no owner for translation changes
|
||||
/android/app/src/main/res/values*/strings.xml
|
||||
# iOS.
|
||||
/iphone/ @organicmaps/ios
|
||||
/xcode/ @organicmaps/ios
|
||||
/docs/OBJC_STYLE.md @organicmaps/ios
|
||||
# no owner for translation changes
|
||||
/iphone/plist.txt
|
||||
/iphone/Maps/LocalizedStrings/
|
||||
# Qt
|
||||
/qt/ @organicmaps/qt
|
||||
# Rendering
|
||||
/drape/ @organicmaps/rendering
|
||||
/drape_frontend/ @organicmaps/rendering
|
||||
# Map Data.
|
||||
/tools/python/maps_generator/ @organicmaps/data
|
||||
/generator/ @organicmaps/data
|
||||
/topography_generator/ @organicmaps/data
|
||||
/data/borders/ @organicmaps/data
|
||||
/data/conf/isolines/ @organicmaps/data
|
||||
/docs/SUBWAY_GENERATION.md @organicmaps/data
|
||||
/docs/MAPS.md @organicmaps/data
|
||||
/docs/EXPERIMENTAL_PUBLIC_TRANSPORT_SUPPORT.md @organicmaps/data
|
||||
# no owner (changed often to add a new POI)
|
||||
/generator/generator_tests/osm_type_test.cpp
|
||||
# Map Styles.
|
||||
/data/styles/ @organicmaps/styles
|
||||
/data/types.txt @organicmaps/styles
|
||||
/data/visibility.txt @organicmaps/styles
|
||||
/data/mapcss-mapping.csv @organicmaps/styles
|
||||
/data/replaced_tags.txt @organicmaps/styles
|
||||
/data/classificator.txt @organicmaps/styles
|
||||
/data/drules_* @organicmaps/styles
|
||||
/docs/STYLES.md
|
||||
/tools/kothic/ @organicmaps/styles
|
||||
# DevOps.
|
||||
/.github/workflows @organicmaps/devops
|
||||
/android/*gradle* @organicmaps/devops
|
||||
/docs/RELEASE_MANAGEMENT.md @organicmaps/devops
|
||||
/xcode/fastlane/ @organicmaps/devops
|
||||
# Growth.
|
||||
README.md @organicmaps/growth
|
||||
/.github/FUNDING.yml @organicmaps/growth
|
||||
/android/app/src/fdroid/play/ @organicmaps/growth
|
||||
/android/app/src/google/play/ @organicmaps/growth
|
||||
/iphone/metadata/ @organicmaps/growth
|
||||
# Legal.
|
||||
LEGAL @organicmaps/legal
|
||||
LICENSE @organicmaps/legal
|
||||
NOTICE @organicmaps/legal
|
||||
CONTRIBUTORS @organicmaps/legal
|
||||
/docs/CODE_OF_CONDUCT.md @organicmaps/legal
|
||||
/docs/DCO.md @organicmaps/legal
|
||||
/docs/GOVERNANCE.md @organicmaps/legal
|
||||
# Require legal approval for all new graphics
|
||||
android/app/src/main/res/drawable*/ @organicmaps/legal
|
||||
android/app/src/main/res/fonts/ @organicmaps/legal
|
||||
android/app/src/main/res/mipmap*/ @organicmaps/legal
|
||||
data/*.ttf @organicmaps/legal
|
||||
data/resources*/ @organicmaps/legal
|
||||
data/search-icons/ @organicmaps/legal
|
||||
data/styles/clear/style-*/ @organicmaps/legal
|
||||
iphone/Maps/Images.xcassets/ @organicmaps/legal
|
||||
|
|
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -2,7 +2,7 @@
|
|||
name: Feature Request
|
||||
about: Suggest an idea for Organic Maps
|
||||
title: ''
|
||||
labels: []
|
||||
labels: [Enhancement]
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
|
27
.github/workflows/android-beta.yaml
vendored
|
@ -56,24 +56,19 @@ jobs:
|
|||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Restore beta keys
|
||||
- name: Checkout private keys
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ secrets.PRIVATE_REPO }}
|
||||
ssh-key: ${{ secrets.PRIVATE_SSH_KEY }}
|
||||
ref: master
|
||||
path: private.git
|
||||
|
||||
- name: Configure repo with private keys
|
||||
shell: bash
|
||||
run: |
|
||||
echo "$PRIVATE_H" | base64 -d > private.h
|
||||
echo "$FIREBASE_APP_DISTRIBUTION_JSON" | base64 -d > android/app/firebase-app-distribution.json
|
||||
echo "$GOOGLE_SERVICES_JSON" | base64 -d > android/app/google-services.json
|
||||
echo "$SECURE_PROPERTIES" | base64 -d > android/app/secure.properties
|
||||
echo "$RELEASE_KEYSTORE" | base64 -d > android/app/release.keystore
|
||||
env:
|
||||
PRIVATE_H: ${{ secrets.PRIVATE_H }}
|
||||
FIREBASE_APP_DISTRIBUTION_JSON: ${{ secrets.FIREBASE_APP_DISTRIBUTION_JSON }}
|
||||
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
|
||||
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
|
||||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
./configure.sh ./private.git
|
||||
rm -rf ./private.git
|
||||
|
||||
- name: Compile
|
||||
shell: bash
|
||||
|
|
|
@ -15,11 +15,6 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
sparse-checkout: |
|
||||
android
|
||||
tools/python/check_store_metadata.py
|
||||
|
||||
- name: Check metadata
|
||||
run: ./tools/python/check_store_metadata.py android
|
||||
|
|
25
.github/workflows/android-check.yaml
vendored
|
@ -23,10 +23,10 @@ on:
|
|||
- packaging/**
|
||||
- platform/*apple*
|
||||
- platform/*_ios*
|
||||
- platform/*_linux*
|
||||
- platform/*_mac*
|
||||
- platform/*qt*
|
||||
- platform/*_win*
|
||||
- platform/*_linux*
|
||||
- platform/*_mac*
|
||||
- platform/*qt*
|
||||
- platform/*_win*
|
||||
- pyhelpers/**
|
||||
- qt*/**
|
||||
- skin_generator/**
|
||||
|
@ -51,7 +51,7 @@ jobs:
|
|||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure in Open Source mode
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
@ -66,12 +66,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [WebDebug, FdroidDebug]
|
||||
include:
|
||||
- flavor: WebDebug
|
||||
arch: arm64
|
||||
- flavor: FdroidDebug
|
||||
arch: arm32
|
||||
flavor: [WebDebug, FdroidBeta]
|
||||
# Cancels previous jobs if the same branch or PR was updated again.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ matrix.flavor }}-${{ github.event.pull_request.number || github.ref }}
|
||||
|
@ -93,7 +88,7 @@ jobs:
|
|||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure in Open Source mode
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
@ -111,11 +106,11 @@ jobs:
|
|||
run: |
|
||||
cmake --version
|
||||
ninja --version
|
||||
./gradlew -P${{ matrix.arch }} assemble${{ matrix.flavor }}
|
||||
./gradlew -Parm64 assemble${{ matrix.flavor }}
|
||||
|
||||
- name: Upload ${{ matrix.flavor }} apk
|
||||
- name: Upload arm64-v8a ${{ matrix.flavor }} apk
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android-${{ matrix.flavor }}
|
||||
name: android-arm64-v8a-${{ matrix.flavor }}
|
||||
path: android/app/build/outputs/apk/**/OrganicMaps-*.apk
|
||||
if-no-files-found: error
|
||||
|
|
31
.github/workflows/android-monkey.yaml
vendored
|
@ -56,26 +56,19 @@ jobs:
|
|||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Restore beta keys
|
||||
- name: Checkout private keys
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ secrets.PRIVATE_REPO }}
|
||||
ssh-key: ${{ secrets.PRIVATE_SSH_KEY }}
|
||||
ref: master
|
||||
path: private.git
|
||||
|
||||
- name: Configure repo with private keys
|
||||
shell: bash
|
||||
run: |
|
||||
echo "$PRIVATE_H" | base64 -d > private.h
|
||||
echo "$FIREBASE_TEST_LAB_JSON" | base64 -d > android/app/firebase-test-lab.json
|
||||
echo "$FIREBASE_APP_DISTRIBUTION_JSON" | base64 -d > android/app/firebase-app-distribution.json
|
||||
echo "$GOOGLE_SERVICES_JSON" | base64 -d > android/app/google-services.json
|
||||
echo "$SECURE_PROPERTIES" | base64 -d > android/app/secure.properties
|
||||
echo "$RELEASE_KEYSTORE" | base64 -d > android/app/release.keystore
|
||||
env:
|
||||
PRIVATE_H: ${{ secrets.PRIVATE_H }}
|
||||
FIREBASE_TEST_LAB_JSON: ${{ secrets.FIREBASE_TEST_LAB_JSON }}
|
||||
FIREBASE_APP_DISTRIBUTION_JSON: ${{ secrets.FIREBASE_APP_DISTRIBUTION_JSON }}
|
||||
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
|
||||
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
|
||||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
./configure.sh ./private.git
|
||||
rm -rf ./private.git
|
||||
|
||||
- name: Compile
|
||||
shell: bash
|
||||
|
@ -98,5 +91,5 @@ jobs:
|
|||
--device model=a10,version=29,orientation=landscape \
|
||||
--device model=cactus,version=27 \
|
||||
--device model=sailfish,version=25 \
|
||||
--device model=harpia,version=23 \
|
||||
--device model=hammerhead,version=23 \
|
||||
--timeout 15m
|
||||
|
|
17
.github/workflows/android-release-metadata.yaml
vendored
|
@ -26,14 +26,19 @@ jobs:
|
|||
ref: master
|
||||
path: screenshots
|
||||
|
||||
- name: Restore release keys
|
||||
- name: Checkout private keys
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ secrets.PRIVATE_REPO }}
|
||||
ssh-key: ${{ secrets.PRIVATE_SSH_KEY }}
|
||||
ref: master
|
||||
path: private.git
|
||||
|
||||
- name: Configure repo with private keys
|
||||
shell: bash
|
||||
run: |
|
||||
echo "$PRIVATE_H" | base64 -d > private.h
|
||||
echo "$GOOGLE_PLAY_JSON" | base64 -d > android/app/google-play.json
|
||||
env:
|
||||
PRIVATE_H: ${{ secrets.PRIVATE_H }}
|
||||
GOOGLE_PLAY_JSON: ${{ secrets.GOOGLE_PLAY_JSON }}
|
||||
./configure.sh ./private.git
|
||||
rm -rf ./private.git
|
||||
|
||||
- name: Upload
|
||||
shell: bash
|
||||
|
|
36
.github/workflows/android-release.yaml
vendored
|
@ -29,9 +29,9 @@ jobs:
|
|||
version=$(tools/unix/version.sh ios_version)
|
||||
# +1 because below a "Bump versions" commit is created.
|
||||
# TODO: Find a way to refactor FDroid versioning without that additional commit.
|
||||
build=$(($(tools/unix/version.sh count) + 1))
|
||||
build=$(($(tools/unix/version.sh ios_build) + 1))
|
||||
code=$(($(tools/unix/version.sh android_code) + 1))
|
||||
tag=$version-$build-android
|
||||
tag=$version-$build-android-rc
|
||||
echo "::set-output name=version::$version"
|
||||
echo "::set-output name=build::$build"
|
||||
echo "::set-output name=tag::$tag"
|
||||
|
@ -100,26 +100,19 @@ jobs:
|
|||
ref: master
|
||||
path: screenshots
|
||||
|
||||
- name: Restore release keys
|
||||
- name: Checkout private keys
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ secrets.PRIVATE_REPO }}
|
||||
ssh-key: ${{ secrets.PRIVATE_SSH_KEY }}
|
||||
ref: master
|
||||
path: private.git
|
||||
|
||||
- name: Configure repo with private keys
|
||||
shell: bash
|
||||
run: |
|
||||
echo "$PRIVATE_H" | base64 -d > private.h
|
||||
echo "$GOOGLE_PLAY_JSON" | base64 -d > android/app/google-play.json
|
||||
echo "$HUAWEI_APPGALLERY_JSON" | base64 -d > android/app/huawei-appgallery.json
|
||||
echo "$AGCONNECT_SERVICES_JSON" | base64 -d > android/app/agconnect-services.json
|
||||
echo "$SECURE_PROPERTIES" | base64 -d > android/app/secure.properties
|
||||
echo "$RELEASE_KEYSTORE" | base64 -d > android/app/release.keystore
|
||||
env:
|
||||
PRIVATE_H: ${{ secrets.PRIVATE_H }}
|
||||
GOOGLE_PLAY_JSON: ${{ secrets.GOOGLE_PLAY_JSON }}
|
||||
HUAWEI_APPGALLERY_JSON: ${{ secrets.HUAWEI_APPGALLERY_JSON }}
|
||||
AGCONNECT_SERVICES_JSON: ${{ secrets.AGCONNECT_SERVICES_JSON }}
|
||||
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
|
||||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
./configure.sh ./private.git
|
||||
rm -rf ./private.git
|
||||
|
||||
- name: Set up SDK
|
||||
shell: bash
|
||||
|
@ -155,8 +148,7 @@ jobs:
|
|||
{
|
||||
cat ${{ env.RELEASE_NOTES }}
|
||||
echo ""
|
||||
echo "See [a detailed announce](https://organicmaps.app/news/) on our website when app updates are published in all stores."
|
||||
echo "You can get automatic app updates from GitHub [using Obtainium](https://github.com/organicmaps/organicmaps/wiki/Installing-Organic-Maps-from-GitHub-using-Obtainium)."
|
||||
echo "See [more details](https://organicmaps.app/news/) on our website when apps are published."
|
||||
echo ""
|
||||
echo "sha256sum:"
|
||||
echo -e '\n```'
|
||||
|
|
10
.github/workflows/appstream-check.yaml
vendored
|
@ -9,14 +9,10 @@ on:
|
|||
jobs:
|
||||
validate-appstream:
|
||||
name: Validate appstream metadata xml
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
sparse-checkout: |
|
||||
packaging/app.organicmaps.desktop.metainfo.xml
|
||||
|
||||
- name: Install appstream validator and flatpak Builder
|
||||
shell: bash
|
||||
|
@ -34,7 +30,3 @@ jobs:
|
|||
- name: Lint appstream data with flatpak Builder
|
||||
shell: bash
|
||||
run: flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream packaging/app.organicmaps.desktop.metainfo.xml
|
||||
|
||||
- name: Run appstreamcli in pedantic mode
|
||||
shell: bash
|
||||
run: flatpak run --command=appstreamcli org.flatpak.Builder validate --pedantic packaging/app.organicmaps.desktop.metainfo.xml
|
||||
|
|
10
.github/workflows/cleanup_caches.yml
vendored
|
@ -9,18 +9,22 @@ jobs:
|
|||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cleanup
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
|
||||
REPO=${{ github.repository }}
|
||||
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
|
||||
|
||||
echo "Fetching list of cache key"
|
||||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
|
||||
|
||||
## Setting this to not fail the workflow while deleting cache keys.
|
||||
## Setting this to not fail the workflow while deleting cache keys.
|
||||
set +e
|
||||
echo "Deleting caches..."
|
||||
for cacheKey in $cacheKeysForPR
|
||||
|
|
20
.github/workflows/coverage-check.yaml
vendored
|
@ -33,7 +33,7 @@ concurrency:
|
|||
jobs:
|
||||
should-run-check:
|
||||
name: Should run coverage
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
run-from-pr: ${{ steps.run-from-pr.outputs.run-from-pr }}
|
||||
manually-triggered: ${{ steps.manually-triggered.outputs.manually-triggered }}
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
coverage:
|
||||
needs: should-run-check
|
||||
name: Generate coverage report
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ needs.should-run-check.outputs.run-from-pr == 'true' || needs.should-run-check.outputs.manually-triggered == 'true'}}
|
||||
steps:
|
||||
- name: Free disk space by removing .NET, Android and Haskell
|
||||
|
@ -85,16 +85,14 @@ jobs:
|
|||
libgl1-mesa-dev \
|
||||
libglvnd-dev \
|
||||
qt6-base-dev \
|
||||
libfreetype-dev \
|
||||
libharfbuzz-dev \
|
||||
libqt6svg6-dev \
|
||||
qt6-positioning-dev \
|
||||
libqt6positioning6-plugins \
|
||||
libqt6positioning6 \
|
||||
llvm \
|
||||
gcovr
|
||||
llvm
|
||||
pip install gcovr
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
@ -106,8 +104,8 @@ jobs:
|
|||
- name: CMake
|
||||
shell: bash
|
||||
env:
|
||||
CC: clang-18
|
||||
CXX: clang++-18
|
||||
CC: clang-14
|
||||
CXX: clang++-14
|
||||
CMAKE_C_COMPILER_LAUNCHER: ccache
|
||||
CMAKE_CXX_COMPILER_LAUNCHER: ccache
|
||||
# -g1 should slightly reduce build time.
|
||||
|
@ -124,14 +122,14 @@ jobs:
|
|||
shell: bash
|
||||
working-directory: build
|
||||
env:
|
||||
QT_QPA_PLATFORM: "offscreen"
|
||||
# drape_tests - requires X Window
|
||||
# generator_integration_tests - https://github.com/organicmaps/organicmaps/issues/225
|
||||
# opening_hours_integration_tests - https://github.com/organicmaps/organicmaps/issues/219
|
||||
# opening_hours_supported_features_tests - https://github.com/organicmaps/organicmaps/issues/219
|
||||
# routing_integration_tests - https://github.com/organicmaps/organicmaps/issues/221
|
||||
# shaders_tests - https://github.com/organicmaps/organicmaps/issues/223
|
||||
# world_feed_integration_tests - https://github.com/organicmaps/organicmaps/issues/215
|
||||
CTEST_EXCLUDE_REGEX: "generator_integration_tests|opening_hours_integration_tests|opening_hours_supported_features_tests|routing_benchmarks|routing_integration_tests|routing_quality_tests|search_quality_tests|storage_integration_tests|shaders_tests|world_feed_integration_tests"
|
||||
CTEST_EXCLUDE_REGEX: "drape_tests|generator_integration_tests|opening_hours_integration_tests|opening_hours_supported_features_tests|routing_benchmarks|routing_integration_tests|routing_quality_tests|search_quality_tests|storage_integration_tests|shaders_tests|world_feed_integration_tests"
|
||||
run: |
|
||||
sudo locale-gen en_US
|
||||
sudo locale-gen en_US.UTF-8
|
||||
|
|
30
.github/workflows/desktop-file-check.yaml
vendored
|
@ -1,30 +0,0 @@
|
|||
name: Validate .desktop file
|
||||
on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
pull_request:
|
||||
paths:
|
||||
- qt/res/app.organicmaps.desktop.desktop
|
||||
- .github/workflows/desktop-file-check.yaml # Run check on self change
|
||||
|
||||
jobs:
|
||||
validate-desktop-file:
|
||||
name: Validate .desktop file
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
sparse-checkout: |
|
||||
qt/res/app.organicmaps.desktop.desktop
|
||||
|
||||
- name: Install desktop-file-validate tool
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y \
|
||||
desktop-file-utils
|
||||
|
||||
- name: Validate desktop file
|
||||
shell: bash
|
||||
run: desktop-file-validate qt/res/app.organicmaps.desktop.desktop && echo "Successfully validated .desktop file"
|
31
.github/workflows/ios-beta.yaml
vendored
|
@ -33,9 +33,9 @@ on:
|
|||
jobs:
|
||||
ios-beta:
|
||||
name: Apple TestFlight
|
||||
runs-on: macos-15
|
||||
runs-on: macos-14
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
LANG: en_US.UTF-8 # Fastlane complains that the terminal is using ASCII.
|
||||
LANGUAGE: en_US.UTF-8
|
||||
LC_ALL: en_US.UTF-8
|
||||
|
@ -52,23 +52,18 @@ jobs:
|
|||
- name: Parallel submodules checkout
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(sysctl -n hw.logicalcpu) * 20))
|
||||
|
||||
- name: Restore beta keys
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p xcode/keys
|
||||
echo "$PRIVATE_H" | base64 -d > private.h
|
||||
echo "$APPSTORE_JSON" | base64 -d > xcode/keys/appstore.json
|
||||
echo "$CERTIFICATES_DEV_P12" | base64 -d > xcode/keys/CertificatesDev.p12
|
||||
echo "$CERTIFICATES_DISTR_P12" | base64 -d > xcode/keys/CertificatesDistr.p12
|
||||
env:
|
||||
PRIVATE_H: ${{ secrets.PRIVATE_H }}
|
||||
APPSTORE_JSON: ${{ secrets.APPSTORE_JSON }}
|
||||
CERTIFICATES_DEV_P12: ${{ secrets.CERTIFICATES_DEV_P12 }}
|
||||
CERTIFICATES_DISTR_P12: ${{ secrets.CERTIFICATES_DISTR_P12 }}
|
||||
- name: Checkout private keys
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ secrets.PRIVATE_REPO }}
|
||||
ssh-key: ${{ secrets.PRIVATE_SSH_KEY }}
|
||||
ref: master
|
||||
path: private.git
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
- name: Configure repo with private keys
|
||||
run: |
|
||||
./configure.sh ./private.git
|
||||
rm -rf ./private.git
|
||||
|
||||
- name: Compile and upload to TestFlight
|
||||
run: |
|
||||
|
|
5
.github/workflows/ios-check-metadata.yaml
vendored
|
@ -14,11 +14,6 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
sparse-checkout: |
|
||||
iphone/metadata
|
||||
tools/python/check_store_metadata.py
|
||||
|
||||
- name: Check metadata
|
||||
run: ./tools/python/check_store_metadata.py ios
|
||||
|
|
8
.github/workflows/ios-check.yaml
vendored
|
@ -35,9 +35,9 @@ on:
|
|||
jobs:
|
||||
ios-check:
|
||||
name: Build iOS
|
||||
runs-on: macos-15
|
||||
runs-on: macos-14
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
LANG: en_US.UTF-8 # Fastlane complains that the terminal is using ASCII.
|
||||
LANGUAGE: en_US.UTF-8
|
||||
LC_ALL: en_US.UTF-8
|
||||
|
@ -59,7 +59,7 @@ jobs:
|
|||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(sysctl -n hw.logicalcpu) * 20))
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
@ -78,7 +78,7 @@ jobs:
|
|||
-scheme OMaps \
|
||||
-configuration Debug \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 16 Pro Max,OS=latest' \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
|
||||
-quiet \
|
||||
-resultBundlePath ${{ env.TEST_RESULTS_BUNDLE_NAME }}.xcresult \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
|
|
21
.github/workflows/ios-release.yaml
vendored
|
@ -5,9 +5,9 @@ on:
|
|||
jobs:
|
||||
ios-release:
|
||||
name: iOS Release
|
||||
runs-on: macos-15
|
||||
runs-on: macos-14
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
LANG: en_US.UTF-8 # Fastlane complains that the terminal is using ASCII.
|
||||
LANGUAGE: en_US.UTF-8
|
||||
LC_ALL: en_US.UTF-8
|
||||
|
@ -16,13 +16,20 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Restore release keys
|
||||
- name: Checkout private keys
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ secrets.PRIVATE_REPO }}
|
||||
ssh-key: ${{ secrets.PRIVATE_SSH_KEY }}
|
||||
ref: master
|
||||
path: ./private.git
|
||||
|
||||
- name: Configure repo with private keys
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p xcode/keys
|
||||
echo "$APPSTORE_JSON" | base64 -d > xcode/keys/appstore.json
|
||||
env:
|
||||
APPSTORE_JSON: ${{ secrets.APPSTORE_JSON }}
|
||||
mkdir -p xcode/keys/
|
||||
cp -p ./private.git/xcode/keys/appstore.json xcode/keys/
|
||||
rm -rf ./private.git
|
||||
|
||||
- name: Checkout screenshots
|
||||
uses: actions/checkout@v4
|
||||
|
|
34
.github/workflows/linux-check.yaml
vendored
|
@ -20,9 +20,9 @@ on:
|
|||
- packaging/**
|
||||
- platform/*apple*
|
||||
- platform/*_android*
|
||||
- platform/*_ios*
|
||||
- platform/*_mac*
|
||||
- platform/*_win*
|
||||
- platform/*_ios*
|
||||
- platform/*_mac*
|
||||
- platform/*_win*
|
||||
- pyhelpers/**
|
||||
- tools/**
|
||||
- '!tools/python/test_server/**'
|
||||
|
@ -31,7 +31,7 @@ on:
|
|||
jobs:
|
||||
linux-no-unity:
|
||||
name: Linux no unity build
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
# Cancels previous jobs if the same branch or PR was updated again.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-no-unity-${{ github.event.pull_request.number || github.ref }}
|
||||
|
@ -61,17 +61,13 @@ jobs:
|
|||
libgl1-mesa-dev \
|
||||
libglvnd-dev \
|
||||
libharfbuzz-dev \
|
||||
libxrandr-dev \
|
||||
libxinerama-dev \
|
||||
libxcursor-dev \
|
||||
libxi-dev \
|
||||
qt6-base-dev \
|
||||
libqt6svg6-dev \
|
||||
qt6-positioning-dev \
|
||||
libqt6positioning6-plugins \
|
||||
libqt6positioning6
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
@ -83,8 +79,8 @@ jobs:
|
|||
- name: CMake
|
||||
shell: bash
|
||||
env:
|
||||
CC: clang-18
|
||||
CXX: clang++-18
|
||||
CC: clang-14
|
||||
CXX: clang++-14
|
||||
CMAKE_C_COMPILER_LAUNCHER: ccache
|
||||
CMAKE_CXX_COMPILER_LAUNCHER: ccache
|
||||
# -g1 should slightly reduce build time.
|
||||
|
@ -99,11 +95,11 @@ jobs:
|
|||
|
||||
linux-matrix:
|
||||
name: Linux builds and tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [{ CXX: g++-14, CC: gcc-14 }, { CXX: clang++-18, CC: clang-18 }]
|
||||
compiler: [{ CXX: g++-12, CC: gcc-12 }, { CXX: clang++-14, CC: clang-14 }]
|
||||
CMAKE_BUILD_TYPE: [Debug, RelWithDebInfo]
|
||||
# Cancels previous jobs if the same branch or PR was updated again.
|
||||
concurrency:
|
||||
|
@ -128,21 +124,19 @@ jobs:
|
|||
run: |
|
||||
sudo apt update -y
|
||||
sudo apt install -y \
|
||||
g++-12 \
|
||||
gcc-12 \
|
||||
ninja-build \
|
||||
libgl1-mesa-dev \
|
||||
libglvnd-dev \
|
||||
libharfbuzz-dev \
|
||||
libxrandr-dev \
|
||||
libxinerama-dev \
|
||||
libxcursor-dev \
|
||||
libxi-dev \
|
||||
qt6-base-dev \
|
||||
libqt6svg6-dev \
|
||||
qt6-positioning-dev \
|
||||
libqt6positioning6-plugins \
|
||||
libqt6positioning6
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
@ -173,14 +167,14 @@ jobs:
|
|||
shell: bash
|
||||
working-directory: build
|
||||
env:
|
||||
QT_QPA_PLATFORM: "offscreen"
|
||||
# drape_tests - requires X Window
|
||||
# generator_integration_tests - https://github.com/organicmaps/organicmaps/issues/225
|
||||
# opening_hours_integration_tests - https://github.com/organicmaps/organicmaps/issues/219
|
||||
# opening_hours_supported_features_tests - https://github.com/organicmaps/organicmaps/issues/219
|
||||
# routing_integration_tests - https://github.com/organicmaps/organicmaps/issues/221
|
||||
# shaders_tests - https://github.com/organicmaps/organicmaps/issues/223
|
||||
# world_feed_integration_tests - https://github.com/organicmaps/organicmaps/issues/215
|
||||
CTEST_EXCLUDE_REGEX: "generator_integration_tests|opening_hours_integration_tests|opening_hours_supported_features_tests|routing_benchmarks|routing_integration_tests|routing_quality_tests|search_quality_tests|storage_integration_tests|shaders_tests|world_feed_integration_tests"
|
||||
CTEST_EXCLUDE_REGEX: "drape_tests|generator_integration_tests|opening_hours_integration_tests|opening_hours_supported_features_tests|routing_benchmarks|routing_integration_tests|routing_quality_tests|search_quality_tests|storage_integration_tests|shaders_tests|world_feed_integration_tests"
|
||||
run: |
|
||||
sudo locale-gen en_US
|
||||
sudo locale-gen en_US.UTF-8
|
||||
|
|
6
.github/workflows/macos-check.yaml
vendored
|
@ -30,9 +30,9 @@ on:
|
|||
jobs:
|
||||
macos-matrix:
|
||||
name: macOS builds and tests
|
||||
runs-on: macos-15
|
||||
runs-on: macos-14
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer
|
||||
DEVELOPER_DIR: /Applications/Xcode_15.3.app/Contents/Developer
|
||||
HOMEBREW_NO_ANALYTICS: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
strategy:
|
||||
|
@ -57,7 +57,7 @@ jobs:
|
|||
run: |
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install ninja qt@6
|
||||
|
||||
- name: Configure repository
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
|
22
.github/workflows/stale.yml
vendored
|
@ -1,22 +0,0 @@
|
|||
name: Close stale PRs
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *" # Runs every day at midnight
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-pr-stale: 180 # 6 months before warning
|
||||
days-before-pr-close: 365 # Closed after 12 months
|
||||
stale-pr-label: "stale"
|
||||
stale-pr-message: "Hi! This PR has been inactive for 6 months. If it's still relevant, please update it to let us know you’d like to keep it open 😊"
|
||||
close-pr-message: "This PR has been automatically closed after 12 months of inactivity."
|
||||
days-before-issue-stale: -1 # Issues are never stale
|
||||
days-before-issue-close: -1 # Issues are never closed
|
||||
remove-stale-when-updated: true
|
31
.github/workflows/strings-check.yaml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Validate translation strings
|
||||
on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/strings-check.yaml # Run check on self change
|
||||
- data/strings/strings.txt
|
||||
- data/strings/types_strings.txt
|
||||
- data/strings/sound.txt
|
||||
- data/countries_names.txt
|
||||
- iphone/plist.txt
|
||||
- tools/python/strings_utils.py
|
||||
|
||||
jobs:
|
||||
validate-translation-strings:
|
||||
name: Validate translation strings
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3'
|
||||
|
||||
- name: Validate string files
|
||||
shell: bash
|
||||
run: |
|
||||
for f in data/strings/strings.txt data/strings/types_strings.txt data/strings/sound.txt data/countries_names.txt iphone/plist.txt; do
|
||||
./tools/python/strings_utils.py --validate $f -o
|
||||
done;
|
||||
git diff --exit-code
|
6
.gitignore
vendored
|
@ -16,11 +16,10 @@ screenlog.0
|
|||
|
||||
data/styles/*/*/out/*
|
||||
data/resources-*_design/*
|
||||
data/drules_proto_default_design.bin
|
||||
data/drules_proto_design.bin
|
||||
data/colors_design.txt
|
||||
data/patterns_design.txt
|
||||
data/bookmarks
|
||||
data/edits.xml
|
||||
|
||||
# Compiled Python
|
||||
*.pyc
|
||||
|
@ -85,7 +84,7 @@ data/[0-9][0-9][0-9][0-9][0-9][0-9]
|
|||
data/gps_track.dat
|
||||
# temporary files for downloader
|
||||
data/settings.ini
|
||||
data/test_data/world_feed_integration_tests_data
|
||||
data/world_feed_integration_tests_data
|
||||
|
||||
# benchmark results
|
||||
data/benchmarks/*.trace
|
||||
|
@ -147,7 +146,6 @@ iphone/Maps/app.omaps/
|
|||
|
||||
*.autosave
|
||||
|
||||
# CMake
|
||||
cmake-build-*
|
||||
build/
|
||||
|
||||
|
|
51
.gitmodules
vendored
|
@ -1,67 +1,64 @@
|
|||
[submodule "tools/osmctools"]
|
||||
path = tools/osmctools
|
||||
url = ../osmctools.git
|
||||
url = https://github.com/organicmaps/osmctools.git
|
||||
[submodule "tools/kothic"]
|
||||
path = tools/kothic
|
||||
url = ../kothic.git
|
||||
url = https://github.com/organicmaps/kothic.git
|
||||
[submodule "tools/macdeployqtfix"]
|
||||
path = tools/macdeployqtfix
|
||||
url = https://github.com/aurelien-rainone/macdeployqtfix.git
|
||||
[submodule "3party/protobuf/protobuf"]
|
||||
path = 3party/protobuf/protobuf
|
||||
url = ../protobuf.git
|
||||
url = https://github.com/organicmaps/protobuf.git
|
||||
[submodule "tools/twine"]
|
||||
path = tools/twine
|
||||
url = https://github.com/organicmaps/twine.git
|
||||
[submodule "3party/Vulkan-Headers"]
|
||||
path = 3party/Vulkan-Headers
|
||||
url = ../Vulkan-Headers.git
|
||||
url = https://github.com/KhronosGroup/Vulkan-Headers.git
|
||||
[submodule "3party/boost"]
|
||||
path = 3party/boost
|
||||
url = ../boost.git
|
||||
url = https://github.com/boostorg/boost.git
|
||||
branch = boost-1.76.0
|
||||
ignore = dirty
|
||||
[submodule "3party/just_gtfs"]
|
||||
path = 3party/just_gtfs
|
||||
url = ../just_gtfs.git
|
||||
url = https://github.com/organicmaps/just_gtfs.git
|
||||
branch = for-usage-as-submodule
|
||||
[submodule "3party/expat"]
|
||||
path = 3party/expat
|
||||
url = ../libexpat.git
|
||||
url = https://github.com/libexpat/libexpat.git
|
||||
branch = R_2_2_9
|
||||
[submodule "3party/glm"]
|
||||
path = 3party/glm
|
||||
url = ../glm.git
|
||||
url = https://github.com/g-truc/glm.git
|
||||
[submodule "3party/icu/icu"]
|
||||
path = 3party/icu/icu
|
||||
url = ../icu.git
|
||||
url = https://github.com/unicode-org/icu.git
|
||||
[submodule "3party/freetype/freetype"]
|
||||
path = 3party/freetype/freetype
|
||||
url = ../freetype.git
|
||||
url = https://github.com/organicmaps/freetype.git
|
||||
[submodule "3party/googletest"]
|
||||
path = 3party/googletest
|
||||
url = ../googletest.git
|
||||
url = https://github.com/google/googletest.git
|
||||
[submodule "3party/fast_double_parser"]
|
||||
path = 3party/fast_double_parser
|
||||
url = ../fast_double_parser.git
|
||||
url = https://github.com/lemire/fast_double_parser.git
|
||||
[submodule "3party/pugixml/pugixml"]
|
||||
path = 3party/pugixml/pugixml
|
||||
url = ../pugixml.git
|
||||
url = https://github.com/zeux/pugixml.git
|
||||
[submodule "3party/jansson/jansson"]
|
||||
path = 3party/jansson/jansson
|
||||
url = ../jansson.git
|
||||
url = https://github.com/akheron/jansson.git
|
||||
[submodule "3party/gflags"]
|
||||
path = 3party/gflags
|
||||
url = ../gflags
|
||||
url = https://github.com/gflags/gflags
|
||||
[submodule "3party/fast_obj"]
|
||||
path = 3party/fast_obj
|
||||
url = ../fast_obj
|
||||
url = https://github.com/thisistherk/fast_obj
|
||||
[submodule "3party/harfbuzz/harfbuzz"]
|
||||
path = 3party/harfbuzz/harfbuzz
|
||||
url = ../harfbuzz.git
|
||||
url = https://github.com/harfbuzz/harfbuzz.git
|
||||
[submodule "3party/utfcpp"]
|
||||
path = 3party/utfcpp
|
||||
url = ../utfcpp.git
|
||||
[submodule "3party/glfw"]
|
||||
path = 3party/glfw
|
||||
url = ../glfw.git
|
||||
[submodule "3party/CMake-MetalShaderSupport"]
|
||||
path = 3party/CMake-MetalShaderSupport
|
||||
url = ../CMake-MetalShaderSupport.git
|
||||
[submodule "3party/imgui/imgui"]
|
||||
path = 3party/imgui/imgui
|
||||
url = ../imgui.git
|
||||
url = https://github.com/nemtrif/utfcpp.git
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 989857d2e5e54869c35ad06fb21a67d12a2dbc67
|
|
@ -22,6 +22,7 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY)
|
|||
set(EXPAT_DTD OFF)
|
||||
set(EXPAT_NS ON)
|
||||
add_subdirectory(expat/expat)
|
||||
add_library(expat::expat ALIAS expat)
|
||||
|
||||
# Configure Jansson library.
|
||||
set(JANSSON_BUILD_DOCS OFF)
|
||||
|
@ -56,9 +57,11 @@ endif()
|
|||
|
||||
add_subdirectory(agg)
|
||||
add_subdirectory(bsdiff-courgette)
|
||||
add_subdirectory(liboauthcpp)
|
||||
add_subdirectory(minizip)
|
||||
add_subdirectory(open-location-code)
|
||||
add_subdirectory(opening_hours)
|
||||
add_subdirectory(sdf_image)
|
||||
add_subdirectory(stb_image)
|
||||
add_subdirectory(succinct)
|
||||
|
||||
|
@ -66,19 +69,4 @@ add_subdirectory(vulkan_wrapper)
|
|||
|
||||
if (PLATFORM_DESKTOP)
|
||||
add_subdirectory(libtess2)
|
||||
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "")
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
|
||||
set(GLFW_INSTALL OFF CACHE BOOL "")
|
||||
set(GLFW_VULKAN_STATIC OFF CACHE BOOL "")
|
||||
set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "")
|
||||
# Disable ARC for glfw and re-enable after it because it's globally set in the root CMakeLists.txt
|
||||
set(CMAKE_OBJC_FLAGS "")
|
||||
add_subdirectory(glfw)
|
||||
set_target_properties(glfw PROPERTIES UNITY_BUILD OFF)
|
||||
set_target_properties(glfw PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC NO)
|
||||
set(CMAKE_OBJC_FLAGS -fobjc-arc)
|
||||
|
||||
add_subdirectory(imgui)
|
||||
endif()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 595c8d4794410a4e64b98dc58d27c0310d7ea2fd
|
||||
Subproject commit 31aa7f634b052d87ede4664053e85f3f4d1d50d3
|
|
@ -1 +1 @@
|
|||
Subproject commit ab7968a0bbcf574a7859240d1d8443f58ed6f6cf
|
||||
Subproject commit 564e2ac16907019696cdaba8a93e3588ec596062
|
|
@ -1 +1 @@
|
|||
Subproject commit a0dc7d5efacbe2b744211289c276e2b9168bd4ae
|
||||
Subproject commit 059a4aa71df6c0f5ef90306db64e2ee546696db7
|
|
@ -1 +1 @@
|
|||
Subproject commit 252029ddac664370bdda3f0761675785d92a1573
|
||||
Subproject commit efec03532ef65984786e5e32dbc81f6e6a55a115
|
|
@ -1 +1 @@
|
|||
Subproject commit 42629f744269e004907a6fb4f16c6c7f69acc586
|
||||
Subproject commit 1a8060257a96401a9555a476bd13c3a87502c9b5
|
|
@ -1 +1 @@
|
|||
Subproject commit 97069edd163b66ce11e8152bee3055b2fa627e15
|
||||
Subproject commit 920c5502cc3ddda88f6c7d85ee834ac611bb11cc
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 21fea01161e0d6b70c0c5c1f52dc8e7a7df14a50
|
|
@ -17,7 +17,6 @@ target_compile_options(${PROJECT_NAME}
|
|||
-fno-rtti
|
||||
-fno-exceptions
|
||||
-fno-threadsafe-statics
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-format-pedantic>
|
||||
)
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
|
@ -37,5 +36,3 @@ target_compile_definitions(${PROJECT_NAME}
|
|||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Freetype::Freetype)
|
||||
|
||||
add_library(harfbuzz::harfbuzz ALIAS harfbuzz)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 788b469ad5e5f78611f665b6eb17afd0eb040f21
|
||||
Subproject commit 2da79f70a1d562d883bdde5b74f6603374fb7023
|
|
@ -32,13 +32,10 @@ add_library(icuuc
|
|||
icu/icu4c/source/common/locbased.h
|
||||
icu/icu4c/source/common/locid.cpp
|
||||
icu/icu4c/source/common/loclikely.cpp
|
||||
icu/icu4c/source/common/loclikelysubtags.cpp
|
||||
icu/icu4c/source/common/loclikelysubtags.h
|
||||
icu/icu4c/source/common/locmap.cpp
|
||||
icu/icu4c/source/common/locutil.cpp
|
||||
icu/icu4c/source/common/locutil.h
|
||||
icu/icu4c/source/common/lsr.h
|
||||
icu/icu4c/source/common/lsr.cpp
|
||||
icu/icu4c/source/common/messageimpl.h
|
||||
icu/icu4c/source/common/msvcres.h
|
||||
icu/icu4c/source/common/mutex.h
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7750081bda4b3bc1768ae03849ec70f67ea10625
|
||||
Subproject commit 680f521746a3bd6a86f25f25ee50a62d88b489cf
|
|
@ -1,16 +0,0 @@
|
|||
project(imgui)
|
||||
|
||||
set(SRC
|
||||
imgui/imgui_draw.cpp
|
||||
imgui/imgui_tables.cpp
|
||||
imgui/imgui_widgets.cpp
|
||||
imgui/imgui.cpp
|
||||
imgui/backends/imgui_impl_glfw.cpp
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} ${SRC})
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE ${OMIM_ROOT}/3party/glfw/include
|
||||
PUBLIC ${OMIM_ROOT}/3party/imgui/imgui
|
||||
PUBLIC .
|
||||
)
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 6982ce43f5b143c5dce5fab0ce07dd4867b705ae
|
9
3party/liboauthcpp/.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Build (by)products
|
||||
build/CMakeCache.txt
|
||||
build/CMakeFiles
|
||||
build/Makefile
|
||||
build/cmake_install.cmake
|
||||
build/liboauthcpp.a
|
||||
build/simple_auth
|
||||
build/simple_request
|
||||
build/tests
|
21
3party/liboauthcpp/CMakeLists.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
project(oauthcpp)
|
||||
|
||||
set(SRC
|
||||
include/liboauthcpp/liboauthcpp.h
|
||||
src/base64.cpp
|
||||
src/HMAC_SHA1.cpp
|
||||
src/SHA1.cpp
|
||||
src/urlencode.cpp
|
||||
src/liboauthcpp.cpp
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} ${SRC})
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE src
|
||||
PUBLIC include
|
||||
)
|
||||
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-shorten-64-to-32>
|
||||
)
|
21
3party/liboauthcpp/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
Copyright (c) 2011 Stanford University (liboauthcpp)
|
||||
Copyright (C) 2011 by swatkat (swatkat.thinkdigitATgmailDOTcom) (libtwitcurl)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
172
3party/liboauthcpp/README.md
Normal file
|
@ -0,0 +1,172 @@
|
|||
liboauthcpp
|
||||
-----------
|
||||
|
||||
liboauthcpp is a pure C++ library for performing OAuth requests. It
|
||||
doesn't contain any networking code -- you provide for performing HTTP
|
||||
requests yourself, however you like -- instead focusing on performing
|
||||
OAuth-specific functionality and providing a nice interface for it.
|
||||
If you already have infrastructure for making HTTP requests and are
|
||||
looking to add OAuth support, liboauthcpp is for you.
|
||||
|
||||
liboauthcpp currently implements OAuth 1.0a (see
|
||||
http://tools.ietf.org/html/rfc5849).
|
||||
|
||||
Buildbot
|
||||
--------
|
||||
[](http://travis-ci.org/sirikata/liboauthcpp)
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
You should only need:
|
||||
|
||||
* CMake
|
||||
* A C++ compiler for your platform (e.g. g++, Microsoft Visual C++)
|
||||
|
||||
Compiling
|
||||
---------
|
||||
|
||||
The build process is simple:
|
||||
|
||||
cd liboauthcpp
|
||||
cd build
|
||||
cmake .
|
||||
make # or open Visual Studio and build the solution
|
||||
|
||||
If your own project uses CMake you can also include
|
||||
build/CMakeLists.txt directly into your project and reference the
|
||||
target "oauthcpp", a static library, in your project.
|
||||
|
||||
Percent (URL) Encoding
|
||||
----------------------
|
||||
|
||||
To get correct results, you need to pass your URL properly encoded to
|
||||
liboauthcpp. If you are not at all familiar, you should probably start
|
||||
by reading the [URI Spec](http://tools.ietf.org/html/rfc3986), especially
|
||||
Section 2. Alternatively,
|
||||
[this article](http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding)
|
||||
gives a more readable overview.
|
||||
|
||||
The basic idea is that there are 3 classes of characters: reserved,
|
||||
unreserved, and other. Reserved characters are special characters that
|
||||
are used in the URI syntax itself, e.g. ':' (after the scheme), '/'
|
||||
(the hierarchical path separator), and '?' (prefixing the query
|
||||
string). Unreserved characters are characters that are always safe to
|
||||
include unencoded, e.g. the alphanumerics. Other characters must
|
||||
always be encoded, mainly covering special characters like ' ', '<' or
|
||||
'>', and '{' or '}'.
|
||||
|
||||
The basic rule is that reserved characters must be encoded if they
|
||||
appear in any part of the URI when not being used as a
|
||||
separator. Unreserved characters are always safe. And the other
|
||||
characters they didn't know if they would be safe or not so they must
|
||||
always be encoded.
|
||||
|
||||
Unfortunately, the reserved set is a bit more complicated. They are
|
||||
broken down into 'general delimiters' and 'sub delimiters'. The ones
|
||||
already mentioned, like ':', can appear in many forms of URIs (say,
|
||||
http, ftp, about, gopher, mailto, etc. Those are called general
|
||||
delimiters. Others (e.g. '(', ')', '!', '$', '+', ',', '=', and more)
|
||||
are called subdelimiters because their use depends on the URI
|
||||
scheme. Worse, their use depends on the *part of the URI*. Depending
|
||||
on the particular URI scheme, these may or may not have to be encoded,
|
||||
and it might also depend on where they appear. (As an example, an '&'
|
||||
in an http URI isn't an issue if it appears in the path -- before the
|
||||
query string -- i.e. before a '?' appears. Worse, '=' can appear unencoded in
|
||||
the path, or in a query parameter value, but not in a query parameter key since
|
||||
it would be interpreted as the end of the key.)
|
||||
|
||||
*Additionally*, in many cases it is permitted to encode a character
|
||||
unnecessarily and the result is supposed to be the same. This means
|
||||
that it's possible to percent encode some URLs in multiple ways
|
||||
(e.g. encoding the unreserved set unnecessarily). It is possible, but not
|
||||
guaranteed, that if you pass *exactly* the same URI to liboauthcpp and the
|
||||
OAuth server, it will handle it regardless of the variant of encoding, so long
|
||||
as it is a valid encoding.
|
||||
|
||||
The short version: percent encoding a URL properly is non-trivial and
|
||||
you can even encode the same URL multiple ways, but has to be done
|
||||
correctly so that the OAuth signature can be computed. Sadly,
|
||||
"correctly" in this case really means "in whatever way the server your
|
||||
interacting with wants it encoded".
|
||||
|
||||
Internally, liboauthcpp needs to do another step of percent encoding,
|
||||
but the OAuth spec is very precise about how that works (none of these
|
||||
scheme-dependent issues). liboauth applies this percent encoding, but
|
||||
assumes that you have encoded your URLs properly. This assumption
|
||||
makes sense since the actual request is made separately, and the URI
|
||||
has to be specified in it, so you should already have a form which the
|
||||
server will accept.
|
||||
|
||||
However, in order to aid you, a very simple percent encoding API is exposed. It
|
||||
should help you encode URLs minimally and in a way that many services accept. In
|
||||
most cases you should use `HttpPercentEncodePath()`,
|
||||
`HttpPercentEncodeQueryKey()`, and `HttpPercentEncodeQueryValue()` to encode
|
||||
those parts of your http URL, then combine them and pass them to liboauthcpp for
|
||||
signing.
|
||||
|
||||
|
||||
Thread Safety
|
||||
-------------
|
||||
|
||||
liboauthcpp doesn't provide any thread safety guarantees. That said, there is
|
||||
very little shared state, and some classes (e.g. Consumer) are naturally
|
||||
immutable and therefore thread safe. Similarly, nearly the entire library uses
|
||||
no static/shared state, so as long as you create separate objects for separate
|
||||
threads, you should be safe.
|
||||
|
||||
The one exception is nonces: the Client class needs to generate a nonce for
|
||||
authorization. To do so, the random number generator needs to be seeded. We do
|
||||
this with the current time, but fast, repeated use of the Client class from
|
||||
different threads could result in the same nonce. To avoid requiring an entire
|
||||
thread library just for this one case, you can call Client::initialize()
|
||||
explicitly before using the Client from multiple threads. For single-threaded
|
||||
use, you are not required to call it.
|
||||
|
||||
Demos
|
||||
-----
|
||||
There are two demos included in the demos/ directory, and they are built by
|
||||
default with the instructions above. In both, you enter key/secret information
|
||||
and it generates URLs for you to visit (in a browser) and copy data back into
|
||||
the program.
|
||||
|
||||
simple_auth should be executed first. It starts with only a consumer key and
|
||||
secret and performs 3-legged auth: you enter in consumer keys, it generates URLs
|
||||
to authenticate the user and generate access tokens. It requires 3 steps:
|
||||
request_token, authorize, and access_token (which correspond the URLs
|
||||
accessed). At the end of this process, you'll be provided an access key/secret
|
||||
pair which you can use to access actual resources.
|
||||
|
||||
simple_request actually does something useful now that your application is
|
||||
authorized. Enter your consumer key/secret and the access key/secret from
|
||||
simple_auth (or which you've generated elsewhere) and it will generate a URL you
|
||||
can use to access your home timeline in JSON format. It adds a parameter to ask
|
||||
for only 5 entries (demonstrating that signing works properly over additional
|
||||
query parameters). This is a one-step process -- it just gives you the URL and
|
||||
you get the results in your browser.
|
||||
|
||||
In both, the URLs accessed are specified at the top of the demo
|
||||
files. simple_auth requires URLs for request_token, authorize_url, and
|
||||
access_token. Some providers require additional parameters (notably an
|
||||
oauth_callback for Twitter, even if its out of band, or oob), which you can also
|
||||
specify in that location. simple_request only needs the URL of the resource
|
||||
being accessed (i.e. the URL for the home_timeline JSON data used by default in
|
||||
the demo), with optional parameters stored as a query string.
|
||||
|
||||
Both demos only use GET requests with query strings, but all HTTP methods
|
||||
(e.g. POST, PUT, DELETE) and approaches to sending parameters (e.g. HTTP
|
||||
headers, url-encoded body) should be supported in the API.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
liboauthcpp is MIT licensed. See the LICENSE file for more details.
|
||||
|
||||
liboauthcpp is mostly taken from libtwitcurl
|
||||
(http://code.google.com/p/twitcurl/), which is similarly licensed. It
|
||||
mostly serves to isolate the OAuth code from libtwitcurl's Twitter and
|
||||
cURL specific code.
|
||||
|
||||
libtwitcurl also borrowed code from other projects:
|
||||
twitcurl uses HMAC_SHA1 from http://www.codeproject.com/KB/recipes/HMACSHA1class.aspx
|
||||
twitcurl uses base64 from http://www.adp-gmbh.ch/cpp/common/base64.html
|
286
3party/liboauthcpp/include/liboauthcpp/liboauthcpp.h
Normal file
|
@ -0,0 +1,286 @@
|
|||
#ifndef __LIBOAUTHCPP_LIBOAUTHCPP_H__
|
||||
#define __LIBOAUTHCPP_LIBOAUTHCPP_H__
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
#include <ctime>
|
||||
|
||||
namespace OAuth {
|
||||
|
||||
namespace Http {
|
||||
typedef enum _RequestType
|
||||
{
|
||||
Invalid = 0,
|
||||
Head,
|
||||
Get,
|
||||
Post,
|
||||
Delete,
|
||||
Put
|
||||
} RequestType;
|
||||
} // namespace Http
|
||||
|
||||
typedef std::list<std::string> KeyValueList;
|
||||
typedef std::multimap<std::string, std::string> KeyValuePairs;
|
||||
|
||||
typedef enum _LogLevel
|
||||
{
|
||||
LogLevelNone = 0,
|
||||
LogLevelDebug = 1
|
||||
} LogLevel;
|
||||
|
||||
/** Set the log level. Log messages are sent to stderr. Currently, and for the
|
||||
* foreseeable future, logging only consists of debug messages to help track
|
||||
* down protocol implementation issues.
|
||||
*/
|
||||
void SetLogLevel(LogLevel lvl);
|
||||
|
||||
/** Deprecated. Complete percent encoding of URLs. Equivalent to
|
||||
* PercentEncode.
|
||||
*/
|
||||
std::string URLEncode(const std::string& decoded);
|
||||
|
||||
/** Percent encode a string value. This version is *thorough* about
|
||||
* encoding: it encodes all reserved characters (even those safe in
|
||||
* http URLs) and "other" characters not specified by the URI
|
||||
* spec. If you're looking to encode http:// URLs, see the
|
||||
* HttpEncode* functions.
|
||||
*/
|
||||
std::string PercentEncode(const std::string& decoded);
|
||||
|
||||
/** Percent encodes the path portion of an http URL (i.e. the /foo/bar
|
||||
* in http://foo/bar?a=1&b=2). This encodes minimally, so reserved
|
||||
* subdelimiters that have no meaning in the path are *not* encoded.
|
||||
*/
|
||||
std::string HttpEncodePath(const std::string& decoded);
|
||||
|
||||
/** Percent encodes a query string key in an http URL (i.e. 'a', 'b' in
|
||||
* http://foo/bar?a=1&b=2). This encodes minimally, so reserved subdelimiters
|
||||
* that have no meaning in the query string are *not* encoded.
|
||||
*/
|
||||
std::string HttpEncodeQueryKey(const std::string& decoded);
|
||||
|
||||
/** Percent encodes a query string value in an http URL (i.e. '1', '2' in
|
||||
* http://foo/bar?a=1&b=2). This encodes minimally, so reserved subdelimiters
|
||||
* that have no meaning in the query string are *not* encoded.
|
||||
*/
|
||||
std::string HttpEncodeQueryValue(const std::string& decoded);
|
||||
|
||||
/** Parses key value pairs into a map.
|
||||
* \param encoded the encoded key value pairs, i.e. the url encoded parameters
|
||||
* \returns a map of string keys to string values
|
||||
* \throws ParseError if the encoded data cannot be decoded
|
||||
*/
|
||||
KeyValuePairs ParseKeyValuePairs(const std::string& encoded);
|
||||
|
||||
class ParseError : public std::runtime_error {
|
||||
public:
|
||||
ParseError(const std::string msg)
|
||||
: std::runtime_error(msg)
|
||||
{}
|
||||
};
|
||||
|
||||
class MissingKeyError : public std::runtime_error {
|
||||
public:
|
||||
MissingKeyError(const std::string msg)
|
||||
: std::runtime_error(msg)
|
||||
{}
|
||||
};
|
||||
|
||||
/** A consumer of OAuth-protected services. It is the client to an
|
||||
* OAuth service provider and is usually registered with the service
|
||||
* provider, resulting in a consumer *key* and *secret* used to
|
||||
* identify the consumer. The key is included in all requests and the
|
||||
* secret is used to *sign* all requests. Signed requests allow the
|
||||
* consumer to securely perform operations, including kicking off
|
||||
* three-legged authentication to enable performing operations on
|
||||
* behalf of a user of the service provider.
|
||||
*/
|
||||
class Consumer {
|
||||
public:
|
||||
Consumer(const std::string& key, const std::string& secret);
|
||||
|
||||
const std::string& key() const { return mKey; }
|
||||
const std::string& secret() const { return mSecret; }
|
||||
|
||||
private:
|
||||
const std::string mKey;
|
||||
const std::string mSecret;
|
||||
};
|
||||
|
||||
/** An OAuth credential used to request authorization or a protected
|
||||
* resource.
|
||||
*
|
||||
* Tokens in OAuth comprise a *key* and a *secret*. The key is
|
||||
* included in requests to identify the token being used, but the
|
||||
* secret is used only in the signature, to prove that the requester
|
||||
* is who the server gave the token to.
|
||||
*
|
||||
* When first negotiating the authorization, the consumer asks for a
|
||||
* *request token* that the live user authorizes with the service
|
||||
* provider. The consumer then exchanges the request token for an
|
||||
* *access token* that can be used to access protected resources.
|
||||
*/
|
||||
class Token {
|
||||
public:
|
||||
Token(const std::string& key, const std::string& secret);
|
||||
Token(const std::string& key, const std::string& secret, const std::string& pin);
|
||||
|
||||
/** Construct a token, extracting the key and secret from a set of
|
||||
* key-value pairs (e.g. those parsed from an request or access
|
||||
* token request).
|
||||
*/
|
||||
static Token extract(const KeyValuePairs& response);
|
||||
/** Construct a token, extracting the key and secret from a raw,
|
||||
* encoded response.
|
||||
*/
|
||||
static Token extract(const std::string& requestTokenResponse);
|
||||
|
||||
const std::string& key() const { return mKey; }
|
||||
const std::string& secret() const { return mSecret; }
|
||||
|
||||
const std::string& pin() const { return mPin; }
|
||||
void setPin(const std::string& pin_) { mPin = pin_; }
|
||||
|
||||
private:
|
||||
|
||||
const std::string mKey;
|
||||
const std::string mSecret;
|
||||
std::string mPin;
|
||||
};
|
||||
|
||||
class Client {
|
||||
public:
|
||||
/** Perform static initialization. This will be called automatically, but
|
||||
* you can call it explicitly to ensure thread safety. If you do not call
|
||||
* this explicitly before using the Client class, the same nonce may be
|
||||
* generated twice.
|
||||
*/
|
||||
static void initialize();
|
||||
/** Alternative initialize method which lets you specify the seed and
|
||||
* control the timestamp used in generating signatures. This only exists
|
||||
* for testing purposes and should not be used in practice.
|
||||
*/
|
||||
static void initialize(int nonce, time_t timestamp);
|
||||
|
||||
/** Exposed for testing only.
|
||||
*/
|
||||
static void __resetInitialize();
|
||||
|
||||
/** Construct an OAuth Client using only a consumer key and
|
||||
* secret. You can use this to start a three-legged
|
||||
* authentication (to acquire an access token for a user) or for
|
||||
* simple two-legged authentication (signing with empty access
|
||||
* token info).
|
||||
*
|
||||
* \param consumer Consumer information. The caller must ensure
|
||||
* it remains valid during the lifetime of this object
|
||||
*/
|
||||
Client(const Consumer* consumer);
|
||||
/** Construct an OAuth Client with consumer key and secret (yours)
|
||||
* and access token key and secret (acquired and stored during
|
||||
* three-legged authentication).
|
||||
*
|
||||
* \param consumer Consumer information. The caller must ensure
|
||||
* it remains valid during the lifetime of this object
|
||||
* \param token Access token information. The caller must ensure
|
||||
* it remains valid during the lifetime of this object
|
||||
*/
|
||||
Client(const Consumer* consumer, const Token* token);
|
||||
|
||||
~Client();
|
||||
|
||||
/** Build an OAuth HTTP header for the given request. This version provides
|
||||
* only the field value.
|
||||
*
|
||||
* \param eType the HTTP request type, e.g. GET or POST
|
||||
* \param rawUrl the raw request URL (should include query parameters)
|
||||
* \param rawData the raw HTTP request data (can be empty)
|
||||
* \param includeOAuthVerifierPin if true, adds oauth_verifier parameter
|
||||
* \returns a string containing the HTTP header
|
||||
*/
|
||||
std::string getHttpHeader(const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData = "",
|
||||
const bool includeOAuthVerifierPin = false);
|
||||
/** Build an OAuth HTTP header for the given request. This version gives a
|
||||
* fully formatted header, i.e. including the header field name.
|
||||
*
|
||||
* \param eType the HTTP request type, e.g. GET or POST
|
||||
* \param rawUrl the raw request URL (should include query parameters)
|
||||
* \param rawData the raw HTTP request data (can be empty)
|
||||
* \param includeOAuthVerifierPin if true, adds oauth_verifier parameter
|
||||
* \returns a string containing the HTTP header
|
||||
*/
|
||||
std::string getFormattedHttpHeader(const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData = "",
|
||||
const bool includeOAuthVerifierPin = false);
|
||||
/** Build an OAuth HTTP header for the given request.
|
||||
*
|
||||
* \param eType the HTTP request type, e.g. GET or POST
|
||||
* \param rawUrl the raw request URL (should include query parameters)
|
||||
* \param rawData the raw HTTP request data (can be empty)
|
||||
* \param includeOAuthVerifierPin if true, adds oauth_verifier parameter
|
||||
* \returns a string containing the query string, including the query
|
||||
* parameters in the rawUrl
|
||||
*/
|
||||
std::string getURLQueryString(const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData = "",
|
||||
const bool includeOAuthVerifierPin = false);
|
||||
private:
|
||||
/** Disable default constructur -- must provide consumer
|
||||
* information.
|
||||
*/
|
||||
Client();
|
||||
|
||||
static bool initialized;
|
||||
static int testingNonce;
|
||||
static time_t testingTimestamp;
|
||||
|
||||
/* OAuth data */
|
||||
const Consumer* mConsumer;
|
||||
const Token* mToken;
|
||||
std::string m_nonce;
|
||||
std::string m_timeStamp;
|
||||
|
||||
/* OAuth related utility methods */
|
||||
bool buildOAuthTokenKeyValuePairs( const bool includeOAuthVerifierPin, /* in */
|
||||
const std::string& rawData, /* in */
|
||||
const std::string& oauthSignature, /* in */
|
||||
KeyValuePairs& keyValueMap /* out */,
|
||||
const bool urlEncodeValues /* in */,
|
||||
const bool generateTimestamp /* in */);
|
||||
|
||||
bool getStringFromOAuthKeyValuePairs( const KeyValuePairs& rawParamMap, /* in */
|
||||
std::string& rawParams, /* out */
|
||||
const std::string& paramsSeperator /* in */ );
|
||||
|
||||
typedef enum _ParameterStringType {
|
||||
QueryStringString,
|
||||
AuthorizationHeaderString
|
||||
} ParameterStringType;
|
||||
// Utility for building OAuth HTTP header or query string. The string type
|
||||
// controls the separator and also filters parameters: for query strings,
|
||||
// all parameters are included. For HTTP headers, only auth parameters are
|
||||
// included.
|
||||
std::string buildOAuthParameterString(
|
||||
ParameterStringType string_type,
|
||||
const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData,
|
||||
const bool includeOAuthVerifierPin);
|
||||
|
||||
bool getSignature( const Http::RequestType eType, /* in */
|
||||
const std::string& rawUrl, /* in */
|
||||
const KeyValuePairs& rawKeyValuePairs, /* in */
|
||||
std::string& oAuthSignature /* out */ );
|
||||
|
||||
void generateNonceTimeStamp();
|
||||
};
|
||||
|
||||
} // namespace OAuth
|
||||
|
||||
#endif // __LIBOAUTHCPP_LIBOAUTHCPP_H__
|
59
3party/liboauthcpp/src/HMAC_SHA1.cpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
//******************************************************************************
|
||||
//* HMAC_SHA1.cpp : Implementation of HMAC SHA1 algorithm
|
||||
//* Comfort to RFC 2104
|
||||
//*
|
||||
//******************************************************************************
|
||||
#include "HMAC_SHA1.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
|
||||
void CHMAC_SHA1::HMAC_SHA1(BYTE *text, int text_len, BYTE *key, int key_len, BYTE *digest)
|
||||
{
|
||||
memset(SHA1_Key, 0, SHA1_BLOCK_SIZE);
|
||||
|
||||
/* repeated 64 times for values in ipad and opad */
|
||||
memset(m_ipad, 0x36, sizeof(m_ipad));
|
||||
memset(m_opad, 0x5c, sizeof(m_opad));
|
||||
|
||||
/* STEP 1 */
|
||||
if (key_len > SHA1_BLOCK_SIZE)
|
||||
{
|
||||
CSHA1::Reset();
|
||||
CSHA1::Update((UINT_8 *)key, key_len);
|
||||
CSHA1::Final();
|
||||
|
||||
CSHA1::GetHash((UINT_8 *)SHA1_Key);
|
||||
}
|
||||
else
|
||||
memcpy(SHA1_Key, key, key_len);
|
||||
|
||||
/* STEP 2 */
|
||||
for (int i=0; i<(int)sizeof(m_ipad); i++)
|
||||
{
|
||||
m_ipad[i] ^= SHA1_Key[i];
|
||||
}
|
||||
|
||||
/* STEP 4 */
|
||||
CSHA1::Reset();
|
||||
CSHA1::Update((UINT_8 *)m_ipad, sizeof(m_ipad));
|
||||
CSHA1::Update((UINT_8 *)text, text_len);
|
||||
CSHA1::Final();
|
||||
|
||||
char szReport[SHA1_DIGEST_LENGTH];
|
||||
CSHA1::GetHash((UINT_8 *)szReport);
|
||||
|
||||
/* STEP 5 */
|
||||
for (int j=0; j<(int)sizeof(m_opad); j++)
|
||||
{
|
||||
m_opad[j] ^= SHA1_Key[j];
|
||||
}
|
||||
|
||||
/*STEP 7 */
|
||||
CSHA1::Reset();
|
||||
CSHA1::Update((UINT_8 *)m_opad, sizeof(m_opad));
|
||||
CSHA1::Update((UINT_8 *)szReport, SHA1_DIGEST_LENGTH);
|
||||
CSHA1::Final();
|
||||
|
||||
CSHA1::GetHash((UINT_8 *)digest);
|
||||
}
|
37
3party/liboauthcpp/src/HMAC_SHA1.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
100% free public domain implementation of the HMAC-SHA1 algorithm
|
||||
by Chien-Chung, Chung (Jim Chung) <jimchung1221@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __HMAC_SHA1_H__
|
||||
#define __HMAC_SHA1_H__
|
||||
|
||||
#include "SHA1.h"
|
||||
|
||||
typedef unsigned char BYTE ;
|
||||
|
||||
class CHMAC_SHA1 : public CSHA1
|
||||
{
|
||||
public:
|
||||
|
||||
enum {
|
||||
SHA1_DIGEST_LENGTH = 20,
|
||||
SHA1_BLOCK_SIZE = 64
|
||||
} ;
|
||||
|
||||
private:
|
||||
BYTE m_ipad[SHA1_BLOCK_SIZE];
|
||||
BYTE m_opad[SHA1_BLOCK_SIZE];
|
||||
|
||||
// This holds one SHA1 block's worth of data, zero padded if necessary.
|
||||
char SHA1_Key[SHA1_BLOCK_SIZE];
|
||||
|
||||
public:
|
||||
CHMAC_SHA1() {}
|
||||
|
||||
void HMAC_SHA1(BYTE *text, int text_len, BYTE *key, int key_len, BYTE *digest);
|
||||
};
|
||||
|
||||
|
||||
#endif /* __HMAC_SHA1_H__ */
|
283
3party/liboauthcpp/src/SHA1.cpp
Normal file
|
@ -0,0 +1,283 @@
|
|||
/*
|
||||
100% free public domain implementation of the SHA-1 algorithm
|
||||
by Dominik Reichl <dominik.reichl@t-online.de>
|
||||
Web: http://www.dominik-reichl.de/
|
||||
|
||||
Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
|
||||
- You can set the endianness in your files, no need to modify the
|
||||
header file of the CSHA1 class any more
|
||||
- Aligned data support
|
||||
- Made support/compilation of the utility functions (ReportHash
|
||||
and HashFile) optional (useful, if bytes count, for example in
|
||||
embedded environments)
|
||||
|
||||
Version 1.5 - 2005-01-01
|
||||
- 64-bit compiler compatibility added
|
||||
- Made variable wiping optional (define SHA1_WIPE_VARIABLES)
|
||||
- Removed unnecessary variable initializations
|
||||
- ROL32 improvement for the Microsoft compiler (using _rotl)
|
||||
|
||||
======== Test Vectors (from FIPS PUB 180-1) ========
|
||||
|
||||
SHA1("abc") =
|
||||
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
||||
|
||||
SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
|
||||
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
||||
|
||||
SHA1(A million repetitions of "a") =
|
||||
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
||||
*/
|
||||
|
||||
#include "SHA1.h"
|
||||
#include <cassert>
|
||||
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
#define SHA1_MAX_FILE_BUFFER 8000
|
||||
#endif
|
||||
|
||||
// Rotate x bits to the left
|
||||
#ifndef ROL32
|
||||
#ifdef _MSC_VER
|
||||
#define ROL32(_val32, _nBits) _rotl(_val32, _nBits)
|
||||
#else
|
||||
#define ROL32(_val32, _nBits) (((_val32)<<(_nBits))|((_val32)>>(32-(_nBits))))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SHA1_LITTLE_ENDIAN
|
||||
#define SHABLK0(i) (m_block->l[i] = \
|
||||
(ROL32(m_block->l[i],24) & 0xFF00FF00) | (ROL32(m_block->l[i],8) & 0x00FF00FF))
|
||||
#else
|
||||
#define SHABLK0(i) (m_block->l[i])
|
||||
#endif
|
||||
|
||||
#define SHABLK(i) (m_block->l[i&15] = ROL32(m_block->l[(i+13)&15] ^ m_block->l[(i+8)&15] \
|
||||
^ m_block->l[(i+2)&15] ^ m_block->l[i&15],1))
|
||||
|
||||
CSHA1::CSHA1()
|
||||
{
|
||||
m_block = (SHA1_WORKSPACE_BLOCK *)m_workspace;
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
CSHA1::~CSHA1()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void CSHA1::Reset()
|
||||
{
|
||||
// SHA1 initialization constants
|
||||
m_state[0] = 0x67452301;
|
||||
m_state[1] = 0xEFCDAB89;
|
||||
m_state[2] = 0x98BADCFE;
|
||||
m_state[3] = 0x10325476;
|
||||
m_state[4] = 0xC3D2E1F0;
|
||||
|
||||
m_count[0] = 0;
|
||||
m_count[1] = 0;
|
||||
}
|
||||
|
||||
void CSHA1::Transform(UINT_32 *state, UINT_8 *buffer)
|
||||
{
|
||||
// Copy state[] to working vars
|
||||
UINT_32 a = state[0], b = state[1], c = state[2], d = state[3], e = state[4];
|
||||
|
||||
memcpy(m_block, buffer, 64);
|
||||
|
||||
// SHA-1 rounds
|
||||
#define _R0(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK0(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
|
||||
#define _R1(v,w,x,y,z,i) { z+=((w&(x^y))^y)+SHABLK(i)+0x5A827999+ROL32(v,5); w=ROL32(w,30); }
|
||||
#define _R2(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0x6ED9EBA1+ROL32(v,5); w=ROL32(w,30); }
|
||||
#define _R3(v,w,x,y,z,i) { z+=(((w|x)&y)|(w&x))+SHABLK(i)+0x8F1BBCDC+ROL32(v,5); w=ROL32(w,30); }
|
||||
#define _R4(v,w,x,y,z,i) { z+=(w^x^y)+SHABLK(i)+0xCA62C1D6+ROL32(v,5); w=ROL32(w,30); }
|
||||
|
||||
// 4 rounds of 20 operations each. Loop unrolled.
|
||||
_R0(a,b,c,d,e, 0); _R0(e,a,b,c,d, 1); _R0(d,e,a,b,c, 2); _R0(c,d,e,a,b, 3);
|
||||
_R0(b,c,d,e,a, 4); _R0(a,b,c,d,e, 5); _R0(e,a,b,c,d, 6); _R0(d,e,a,b,c, 7);
|
||||
_R0(c,d,e,a,b, 8); _R0(b,c,d,e,a, 9); _R0(a,b,c,d,e,10); _R0(e,a,b,c,d,11);
|
||||
_R0(d,e,a,b,c,12); _R0(c,d,e,a,b,13); _R0(b,c,d,e,a,14); _R0(a,b,c,d,e,15);
|
||||
_R1(e,a,b,c,d,16); _R1(d,e,a,b,c,17); _R1(c,d,e,a,b,18); _R1(b,c,d,e,a,19);
|
||||
_R2(a,b,c,d,e,20); _R2(e,a,b,c,d,21); _R2(d,e,a,b,c,22); _R2(c,d,e,a,b,23);
|
||||
_R2(b,c,d,e,a,24); _R2(a,b,c,d,e,25); _R2(e,a,b,c,d,26); _R2(d,e,a,b,c,27);
|
||||
_R2(c,d,e,a,b,28); _R2(b,c,d,e,a,29); _R2(a,b,c,d,e,30); _R2(e,a,b,c,d,31);
|
||||
_R2(d,e,a,b,c,32); _R2(c,d,e,a,b,33); _R2(b,c,d,e,a,34); _R2(a,b,c,d,e,35);
|
||||
_R2(e,a,b,c,d,36); _R2(d,e,a,b,c,37); _R2(c,d,e,a,b,38); _R2(b,c,d,e,a,39);
|
||||
_R3(a,b,c,d,e,40); _R3(e,a,b,c,d,41); _R3(d,e,a,b,c,42); _R3(c,d,e,a,b,43);
|
||||
_R3(b,c,d,e,a,44); _R3(a,b,c,d,e,45); _R3(e,a,b,c,d,46); _R3(d,e,a,b,c,47);
|
||||
_R3(c,d,e,a,b,48); _R3(b,c,d,e,a,49); _R3(a,b,c,d,e,50); _R3(e,a,b,c,d,51);
|
||||
_R3(d,e,a,b,c,52); _R3(c,d,e,a,b,53); _R3(b,c,d,e,a,54); _R3(a,b,c,d,e,55);
|
||||
_R3(e,a,b,c,d,56); _R3(d,e,a,b,c,57); _R3(c,d,e,a,b,58); _R3(b,c,d,e,a,59);
|
||||
_R4(a,b,c,d,e,60); _R4(e,a,b,c,d,61); _R4(d,e,a,b,c,62); _R4(c,d,e,a,b,63);
|
||||
_R4(b,c,d,e,a,64); _R4(a,b,c,d,e,65); _R4(e,a,b,c,d,66); _R4(d,e,a,b,c,67);
|
||||
_R4(c,d,e,a,b,68); _R4(b,c,d,e,a,69); _R4(a,b,c,d,e,70); _R4(e,a,b,c,d,71);
|
||||
_R4(d,e,a,b,c,72); _R4(c,d,e,a,b,73); _R4(b,c,d,e,a,74); _R4(a,b,c,d,e,75);
|
||||
_R4(e,a,b,c,d,76); _R4(d,e,a,b,c,77); _R4(c,d,e,a,b,78); _R4(b,c,d,e,a,79);
|
||||
|
||||
#undef _R0
|
||||
#undef _R1
|
||||
#undef _R2
|
||||
#undef _R3
|
||||
#undef _R4
|
||||
|
||||
// Add the working vars back into state
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
|
||||
// Wipe variables
|
||||
#ifdef SHA1_WIPE_VARIABLES
|
||||
a = b = c = d = e = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Use this function to hash in binary data and strings
|
||||
void CSHA1::Update(UINT_8 *data, UINT_32 len)
|
||||
{
|
||||
UINT_32 i, j;
|
||||
|
||||
j = (m_count[0] >> 3) & 63;
|
||||
|
||||
if((m_count[0] += len << 3) < (len << 3)) m_count[1]++;
|
||||
|
||||
m_count[1] += (len >> 29);
|
||||
|
||||
if((j + len) > 63)
|
||||
{
|
||||
i = 64 - j;
|
||||
memcpy(&m_buffer[j], data, i);
|
||||
Transform(m_state, m_buffer);
|
||||
|
||||
for(; i + 63 < len; i += 64) Transform(m_state, &data[i]);
|
||||
|
||||
j = 0;
|
||||
}
|
||||
else i = 0;
|
||||
|
||||
memcpy(&m_buffer[j], &data[i], len - i);
|
||||
}
|
||||
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
// Hash in file contents
|
||||
bool CSHA1::HashFile(char *szFileName)
|
||||
{
|
||||
unsigned long ulFileSize, ulRest, ulBlocks;
|
||||
unsigned long i;
|
||||
UINT_8 uData[SHA1_MAX_FILE_BUFFER];
|
||||
FILE *fIn;
|
||||
|
||||
if(szFileName == NULL) return false;
|
||||
|
||||
fIn = fopen(szFileName, "rb");
|
||||
if(fIn == NULL) return false;
|
||||
|
||||
fseek(fIn, 0, SEEK_END);
|
||||
ulFileSize = (unsigned long)ftell(fIn);
|
||||
fseek(fIn, 0, SEEK_SET);
|
||||
|
||||
if(ulFileSize != 0)
|
||||
{
|
||||
ulBlocks = ulFileSize / SHA1_MAX_FILE_BUFFER;
|
||||
ulRest = ulFileSize % SHA1_MAX_FILE_BUFFER;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulBlocks = 0;
|
||||
ulRest = 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < ulBlocks; i++)
|
||||
{
|
||||
size_t nread = fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
|
||||
assert(nread == SHA1_MAX_FILE_BUFFER);
|
||||
Update((UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
|
||||
}
|
||||
|
||||
if(ulRest != 0)
|
||||
{
|
||||
size_t nread = fread(uData, 1, ulRest, fIn);
|
||||
assert(nread == ulRest);
|
||||
Update((UINT_8 *)uData, ulRest);
|
||||
}
|
||||
|
||||
fclose(fIn); fIn = NULL;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CSHA1::Final()
|
||||
{
|
||||
UINT_32 i;
|
||||
UINT_8 finalcount[8];
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
finalcount[i] = (UINT_8)((m_count[((i >= 4) ? 0 : 1)]
|
||||
>> ((3 - (i & 3)) * 8) ) & 255); // Endian independent
|
||||
|
||||
Update((UINT_8 *)"\200", 1);
|
||||
|
||||
while ((m_count[0] & 504) != 448)
|
||||
Update((UINT_8 *)"\0", 1);
|
||||
|
||||
Update(finalcount, 8); // Cause a SHA1Transform()
|
||||
|
||||
for(i = 0; i < 20; i++)
|
||||
{
|
||||
m_digest[i] = (UINT_8)((m_state[i >> 2] >> ((3 - (i & 3)) * 8) ) & 255);
|
||||
}
|
||||
|
||||
// Wipe variables for security reasons
|
||||
#ifdef SHA1_WIPE_VARIABLES
|
||||
i = 0;
|
||||
memset(m_buffer, 0, 64);
|
||||
memset(m_state, 0, 20);
|
||||
memset(m_count, 0, 8);
|
||||
memset(finalcount, 0, 8);
|
||||
Transform(m_state, m_buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
// Get the final hash as a pre-formatted string
|
||||
void CSHA1::ReportHash(char *szReport, unsigned char uReportType)
|
||||
{
|
||||
unsigned char i;
|
||||
char szTemp[16];
|
||||
|
||||
if(szReport == NULL) return;
|
||||
|
||||
if(uReportType == REPORT_HEX)
|
||||
{
|
||||
snprintf(szTemp, sizeof(szTemp), "%02X", m_digest[0]);
|
||||
strcat(szReport, szTemp);
|
||||
|
||||
for(i = 1; i < 20; i++)
|
||||
{
|
||||
snprintf(szTemp, sizeof(szTemp), " %02X", m_digest[i]);
|
||||
strcat(szReport, szTemp);
|
||||
}
|
||||
}
|
||||
else if(uReportType == REPORT_DIGIT)
|
||||
{
|
||||
snprintf(szTemp, sizeof(szTemp), "%u", m_digest[0]);
|
||||
strcat(szReport, szTemp);
|
||||
|
||||
for(i = 1; i < 20; i++)
|
||||
{
|
||||
snprintf(szTemp, sizeof(szTemp), " %u", m_digest[i]);
|
||||
strcat(szReport, szTemp);
|
||||
}
|
||||
}
|
||||
else strcpy(szReport, "Error: Unknown report type!");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the raw message digest
|
||||
void CSHA1::GetHash(UINT_8 *puDest)
|
||||
{
|
||||
memcpy(puDest, m_digest, 20);
|
||||
}
|
148
3party/liboauthcpp/src/SHA1.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
100% free public domain implementation of the SHA-1 algorithm
|
||||
by Dominik Reichl <dominik.reichl@t-online.de>
|
||||
Web: http://www.dominik-reichl.de/
|
||||
|
||||
Version 1.6 - 2005-02-07 (thanks to Howard Kapustein for patches)
|
||||
- You can set the endianness in your files, no need to modify the
|
||||
header file of the CSHA1 class any more
|
||||
- Aligned data support
|
||||
- Made support/compilation of the utility functions (ReportHash
|
||||
and HashFile) optional (useful, if bytes count, for example in
|
||||
embedded environments)
|
||||
|
||||
Version 1.5 - 2005-01-01
|
||||
- 64-bit compiler compatibility added
|
||||
- Made variable wiping optional (define SHA1_WIPE_VARIABLES)
|
||||
- Removed unnecessary variable initializations
|
||||
- ROL32 improvement for the Microsoft compiler (using _rotl)
|
||||
|
||||
======== Test Vectors (from FIPS PUB 180-1) ========
|
||||
|
||||
SHA1("abc") =
|
||||
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
|
||||
|
||||
SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") =
|
||||
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
|
||||
|
||||
SHA1(A million repetitions of "a") =
|
||||
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
||||
*/
|
||||
|
||||
#ifndef ___SHA1_HDR___
|
||||
#define ___SHA1_HDR___
|
||||
|
||||
#if !defined(SHA1_UTILITY_FUNCTIONS) && !defined(SHA1_NO_UTILITY_FUNCTIONS)
|
||||
#define SHA1_UTILITY_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#include <memory.h> // Needed for memset and memcpy
|
||||
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
#include <stdio.h> // Needed for file access and sprintf
|
||||
#include <string.h> // Needed for strcat and strcpy
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
// You can define the endian mode in your files, without modifying the SHA1
|
||||
// source files. Just #define SHA1_LITTLE_ENDIAN or #define SHA1_BIG_ENDIAN
|
||||
// in your files, before including the SHA1.h header file. If you don't
|
||||
// define anything, the class defaults to little endian.
|
||||
|
||||
#if !defined(SHA1_LITTLE_ENDIAN) && !defined(SHA1_BIG_ENDIAN)
|
||||
#define SHA1_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
// Same here. If you want variable wiping, #define SHA1_WIPE_VARIABLES, if
|
||||
// not, #define SHA1_NO_WIPE_VARIABLES. If you don't define anything, it
|
||||
// defaults to wiping.
|
||||
|
||||
#if !defined(SHA1_WIPE_VARIABLES) && !defined(SHA1_NO_WIPE_VARIABLES)
|
||||
#define SHA1_WIPE_VARIABLES
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Define 8- and 32-bit variables
|
||||
|
||||
#ifndef UINT_32
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#define UINT_8 unsigned __int8
|
||||
#define UINT_32 unsigned __int32
|
||||
|
||||
#else
|
||||
|
||||
#define UINT_8 unsigned char
|
||||
|
||||
#if (ULONG_MAX == 0xFFFFFFFF && UINT_MAX < ULONG_MAX)
|
||||
#define UINT_32 unsigned long
|
||||
#else
|
||||
#define UINT_32 unsigned int
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Declare SHA1 workspace
|
||||
|
||||
typedef union
|
||||
{
|
||||
UINT_8 c[64];
|
||||
UINT_32 l[16];
|
||||
} SHA1_WORKSPACE_BLOCK;
|
||||
|
||||
class CSHA1
|
||||
{
|
||||
public:
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
// Two different formats for ReportHash(...)
|
||||
enum
|
||||
{
|
||||
REPORT_HEX = 0,
|
||||
REPORT_DIGIT = 1
|
||||
};
|
||||
#endif
|
||||
|
||||
// Constructor and Destructor
|
||||
CSHA1();
|
||||
~CSHA1();
|
||||
|
||||
UINT_32 m_state[5];
|
||||
UINT_32 m_count[2];
|
||||
UINT_32 __reserved1[1];
|
||||
UINT_8 m_buffer[64];
|
||||
UINT_8 m_digest[20];
|
||||
UINT_32 __reserved2[3];
|
||||
|
||||
void Reset();
|
||||
|
||||
// Update the hash value
|
||||
void Update(UINT_8 *data, UINT_32 len);
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
bool HashFile(char *szFileName);
|
||||
#endif
|
||||
|
||||
// Finalize hash and report
|
||||
void Final();
|
||||
|
||||
// Report functions: as pre-formatted and raw data
|
||||
#ifdef SHA1_UTILITY_FUNCTIONS
|
||||
void ReportHash(char *szReport, unsigned char uReportType = REPORT_HEX);
|
||||
#endif
|
||||
void GetHash(UINT_8 *puDest);
|
||||
|
||||
private:
|
||||
// Private SHA-1 transformation
|
||||
void Transform(UINT_32 *state, UINT_8 *buffer);
|
||||
|
||||
// Member variables
|
||||
UINT_8 m_workspace[64];
|
||||
SHA1_WORKSPACE_BLOCK *m_block; // SHA1 pointer to the byte array above
|
||||
};
|
||||
|
||||
#endif
|
123
3party/liboauthcpp/src/base64.cpp
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
base64.cpp and base64.h
|
||||
|
||||
Copyright (C) 2004-2008 René Nyffenegger
|
||||
|
||||
This source code is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented; you must not
|
||||
claim that you wrote the original source code. If you use this source code
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original source code.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
||||
|
||||
*/
|
||||
|
||||
#include "base64.h"
|
||||
#include <iostream>
|
||||
|
||||
static const std::string base64_chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/";
|
||||
|
||||
|
||||
static inline bool is_base64(unsigned char c) {
|
||||
return (isalnum(c) || (c == '+') || (c == '/'));
|
||||
}
|
||||
|
||||
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
|
||||
std::string ret;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
unsigned char char_array_3[3];
|
||||
unsigned char char_array_4[4];
|
||||
|
||||
while (in_len--) {
|
||||
char_array_3[i++] = *(bytes_to_encode++);
|
||||
if (i == 3) {
|
||||
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
|
||||
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
|
||||
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
|
||||
char_array_4[3] = char_array_3[2] & 0x3f;
|
||||
|
||||
for(i = 0; (i <4) ; i++)
|
||||
ret += base64_chars[char_array_4[i]];
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (i)
|
||||
{
|
||||
for(j = i; j < 3; j++)
|
||||
char_array_3[j] = '\0';
|
||||
|
||||
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
|
||||
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
|
||||
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
|
||||
char_array_4[3] = char_array_3[2] & 0x3f;
|
||||
|
||||
for (j = 0; (j < i + 1); j++)
|
||||
ret += base64_chars[char_array_4[j]];
|
||||
|
||||
while((i++ < 3))
|
||||
ret += '=';
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
std::string base64_decode(std::string const& encoded_string) {
|
||||
int in_len = encoded_string.size();
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int in_ = 0;
|
||||
unsigned char char_array_4[4], char_array_3[3];
|
||||
std::string ret;
|
||||
|
||||
while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
|
||||
char_array_4[i++] = encoded_string[in_]; in_++;
|
||||
if (i ==4) {
|
||||
for (i = 0; i <4; i++)
|
||||
char_array_4[i] = base64_chars.find(char_array_4[i]);
|
||||
|
||||
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
|
||||
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
|
||||
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
|
||||
|
||||
for (i = 0; (i < 3); i++)
|
||||
ret += char_array_3[i];
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (i) {
|
||||
for (j = i; j <4; j++)
|
||||
char_array_4[j] = 0;
|
||||
|
||||
for (j = 0; j <4; j++)
|
||||
char_array_4[j] = base64_chars.find(char_array_4[j]);
|
||||
|
||||
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
|
||||
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
|
||||
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
|
||||
|
||||
for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
4
3party/liboauthcpp/src/base64.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include <string>
|
||||
|
||||
std::string base64_encode(unsigned char const* , unsigned int len);
|
||||
std::string base64_decode(std::string const& s);
|
621
3party/liboauthcpp/src/liboauthcpp.cpp
Normal file
|
@ -0,0 +1,621 @@
|
|||
#include <liboauthcpp/liboauthcpp.h>
|
||||
#include "HMAC_SHA1.h"
|
||||
#include "base64.h"
|
||||
#include "urlencode.h"
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
namespace OAuth {
|
||||
|
||||
namespace Defaults
|
||||
{
|
||||
/* Constants */
|
||||
const int BUFFSIZE = 1024;
|
||||
const int BUFFSIZE_LARGE = 1024;
|
||||
const std::string CONSUMERKEY_KEY = "oauth_consumer_key";
|
||||
const std::string CALLBACK_KEY = "oauth_callback";
|
||||
const std::string VERSION_KEY = "oauth_version";
|
||||
const std::string SIGNATUREMETHOD_KEY = "oauth_signature_method";
|
||||
const std::string SIGNATURE_KEY = "oauth_signature";
|
||||
const std::string TIMESTAMP_KEY = "oauth_timestamp";
|
||||
const std::string NONCE_KEY = "oauth_nonce";
|
||||
const std::string TOKEN_KEY = "oauth_token";
|
||||
const std::string TOKENSECRET_KEY = "oauth_token_secret";
|
||||
const std::string VERIFIER_KEY = "oauth_verifier";
|
||||
|
||||
const std::string AUTHHEADER_FIELD = "Authorization: ";
|
||||
const std::string AUTHHEADER_PREFIX = "OAuth ";
|
||||
};
|
||||
|
||||
/** std::string -> std::string conversion function */
|
||||
typedef std::string(*StringConvertFunction)(const std::string&);
|
||||
|
||||
LogLevel gLogLevel = LogLevelNone;
|
||||
|
||||
void SetLogLevel(LogLevel lvl) {
|
||||
gLogLevel = lvl;
|
||||
}
|
||||
#define LOG(lvl, msg) \
|
||||
do { \
|
||||
if (lvl <= gLogLevel) std::cerr << "OAUTH: " << msg << std::endl; \
|
||||
} while(0)
|
||||
|
||||
std::string PercentEncode(const std::string& decoded) {
|
||||
return urlencode(decoded, URLEncode_Everything);
|
||||
}
|
||||
|
||||
std::string URLEncode(const std::string& decoded) {
|
||||
return PercentEncode(decoded);
|
||||
}
|
||||
|
||||
std::string HttpEncodePath(const std::string& decoded) {
|
||||
return urlencode(decoded, URLEncode_Path);
|
||||
}
|
||||
|
||||
std::string HttpEncodeQueryKey(const std::string& decoded) {
|
||||
return urlencode(decoded, URLEncode_QueryKey);
|
||||
}
|
||||
|
||||
std::string HttpEncodeQueryValue(const std::string& decoded) {
|
||||
return urlencode(decoded, URLEncode_QueryValue);
|
||||
}
|
||||
|
||||
namespace {
|
||||
std::string PassThrough(const std::string& decoded) {
|
||||
return decoded;
|
||||
}
|
||||
|
||||
std::string RequestTypeString(const Http::RequestType rt) {
|
||||
switch(rt) {
|
||||
case Http::Invalid: return "Invalid Request Type"; break;
|
||||
case Http::Head: return "HEAD"; break;
|
||||
case Http::Get: return "GET"; break;
|
||||
case Http::Post: return "POST"; break;
|
||||
case Http::Delete: return "DELETE"; break;
|
||||
case Http::Put: return "PUT"; break;
|
||||
default: return "Unknown Request Type"; break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// Parse a single key-value pair
|
||||
static std::pair<std::string, std::string> ParseKeyValuePair(const std::string& encoded) {
|
||||
std::size_t eq_pos = encoded.find("=");
|
||||
if (eq_pos == std::string::npos)
|
||||
throw ParseError("Failed to find '=' in key-value pair.");
|
||||
return std::pair<std::string, std::string>(
|
||||
encoded.substr(0, eq_pos),
|
||||
encoded.substr(eq_pos+1)
|
||||
);
|
||||
}
|
||||
|
||||
KeyValuePairs ParseKeyValuePairs(const std::string& encoded) {
|
||||
KeyValuePairs result;
|
||||
|
||||
if (encoded.length() == 0) return result;
|
||||
|
||||
// Split by &
|
||||
std::size_t last_amp = 0;
|
||||
// We can bail when the last one "found" was the end of the string
|
||||
while(true) {
|
||||
std::size_t next_amp = encoded.find('&', last_amp+1);
|
||||
std::string keyval =
|
||||
(next_amp == std::string::npos) ?
|
||||
encoded.substr(last_amp) :
|
||||
encoded.substr(last_amp, next_amp-last_amp);
|
||||
result.insert(ParseKeyValuePair(keyval));
|
||||
// Track spot after the & so the first iteration works without dealing
|
||||
// with -1 index
|
||||
last_amp = next_amp+1;
|
||||
|
||||
// Exit condition
|
||||
if (next_amp == std::string::npos) break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Helper for parameters in key-value pair lists that should only appear
|
||||
// once. Either replaces an existing entry or adds a new entry.
|
||||
static void ReplaceOrInsertKeyValuePair(KeyValuePairs& kvp, const std::string& key, const std::string& value) {
|
||||
assert(kvp.count(key) <= 1);
|
||||
KeyValuePairs::iterator it = kvp.find(key);
|
||||
if (it != kvp.end())
|
||||
it->second = value;
|
||||
else
|
||||
kvp.insert(KeyValuePairs::value_type(key, value));
|
||||
}
|
||||
|
||||
Consumer::Consumer(const std::string& key, const std::string& secret)
|
||||
: mKey(key), mSecret(secret)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
Token::Token(const std::string& key, const std::string& secret)
|
||||
: mKey(key), mSecret(secret)
|
||||
{
|
||||
}
|
||||
|
||||
Token::Token(const std::string& key, const std::string& secret, const std::string& pin)
|
||||
: mKey(key), mSecret(secret), mPin(pin)
|
||||
{
|
||||
}
|
||||
|
||||
Token Token::extract(const std::string& response) {
|
||||
return Token::extract(ParseKeyValuePairs(response));
|
||||
}
|
||||
|
||||
Token Token::extract(const KeyValuePairs& response) {
|
||||
std::string token_key, token_secret;
|
||||
|
||||
KeyValuePairs::const_iterator it = response.find(Defaults::TOKEN_KEY);
|
||||
if (it == response.end())
|
||||
throw MissingKeyError("Couldn't find oauth_token in response");
|
||||
token_key = it->second;
|
||||
|
||||
it = response.find(Defaults::TOKENSECRET_KEY);
|
||||
if (it == response.end())
|
||||
throw MissingKeyError("Couldn't find oauth_token_secret in response");
|
||||
token_secret = it->second;
|
||||
|
||||
return Token(token_key, token_secret);
|
||||
}
|
||||
|
||||
|
||||
bool Client::initialized = false;
|
||||
int Client::testingNonce = 0;
|
||||
time_t Client::testingTimestamp = 0;
|
||||
|
||||
void Client::initialize() {
|
||||
if(!initialized) {
|
||||
srand( time( NULL ) );
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Client::initialize(int nonce, time_t timestamp) {
|
||||
if(!initialized) {
|
||||
testingNonce = nonce;
|
||||
testingTimestamp = timestamp;
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Client::__resetInitialize() {
|
||||
testingNonce = 0;
|
||||
testingTimestamp = 0;
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
Client::Client(const Consumer* consumer)
|
||||
: mConsumer(consumer),
|
||||
mToken(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
Client::Client(const Consumer* consumer, const Token* token)
|
||||
: mConsumer(consumer),
|
||||
mToken(token)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Client::~Client()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*++
|
||||
* @method: Client::generateNonceTimeStamp
|
||||
*
|
||||
* @description: this method generates nonce and timestamp for OAuth header
|
||||
*
|
||||
* @input: none
|
||||
*
|
||||
* @output: none
|
||||
*
|
||||
* @remarks: internal method
|
||||
*
|
||||
*--*/
|
||||
void Client::generateNonceTimeStamp()
|
||||
{
|
||||
// Make sure the random seed has been initialized
|
||||
Client::initialize();
|
||||
|
||||
char szTime[Defaults::BUFFSIZE];
|
||||
char szRand[Defaults::BUFFSIZE];
|
||||
memset( szTime, 0, Defaults::BUFFSIZE );
|
||||
memset( szRand, 0, Defaults::BUFFSIZE );
|
||||
|
||||
// Any non-zero timestamp triggers testing mode with fixed values. Fixing
|
||||
// both values makes life easier because generating a signature is
|
||||
// idempotent -- otherwise using macros can cause double evaluation and
|
||||
// incorrect results because of repeated calls to rand().
|
||||
snprintf( szRand, sizeof(szRand), "%x", ((testingTimestamp != 0) ? testingNonce : rand()) );
|
||||
snprintf( szTime, sizeof(szTime), "%ld", ((testingTimestamp != 0) ? testingTimestamp : time( NULL )) );
|
||||
|
||||
m_nonce.assign( szTime );
|
||||
m_nonce.append( szRand );
|
||||
|
||||
m_timeStamp.assign( szTime );
|
||||
}
|
||||
|
||||
/*++
|
||||
* @method: Client::buildOAuthTokenKeyValuePairs
|
||||
*
|
||||
* @description: this method prepares key-value pairs required for OAuth header
|
||||
* and signature generation.
|
||||
*
|
||||
* @input: includeOAuthVerifierPin - flag to indicate whether oauth_verifer key-value
|
||||
* pair needs to be included. oauth_verifer is only
|
||||
* used during exchanging request token with access token.
|
||||
* rawData - url encoded data. this is used during signature generation.
|
||||
* oauthSignature - base64 and url encoded OAuth signature.
|
||||
* generateTimestamp - If true, then generate new timestamp for nonce.
|
||||
*
|
||||
* @input: urlEncodeValues - if true, URLEncode the values inserted into the
|
||||
* output keyValueMap
|
||||
* @output: keyValueMap - map in which key-value pairs are populated
|
||||
*
|
||||
* @remarks: internal method
|
||||
*
|
||||
*--*/
|
||||
bool Client::buildOAuthTokenKeyValuePairs( const bool includeOAuthVerifierPin,
|
||||
const std::string& rawData,
|
||||
const std::string& oauthSignature,
|
||||
KeyValuePairs& keyValueMap,
|
||||
const bool urlEncodeValues,
|
||||
const bool generateTimestamp )
|
||||
{
|
||||
// Encodes value part of key-value pairs depending on type of output (query
|
||||
// string vs. HTTP headers.
|
||||
StringConvertFunction value_encoder = (urlEncodeValues ? HttpEncodeQueryValue : PassThrough);
|
||||
|
||||
/* Generate nonce and timestamp if required */
|
||||
if( generateTimestamp )
|
||||
{
|
||||
generateNonceTimeStamp();
|
||||
}
|
||||
|
||||
/* Consumer key and its value */
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::CONSUMERKEY_KEY, value_encoder(mConsumer->key()));
|
||||
|
||||
/* Nonce key and its value */
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::NONCE_KEY, value_encoder(m_nonce));
|
||||
|
||||
/* Signature if supplied */
|
||||
if( oauthSignature.length() )
|
||||
{
|
||||
// Signature is exempt from encoding. The procedure for
|
||||
// computing it already percent-encodes it as required by the
|
||||
// spec for both query string and Auth header
|
||||
// methods. Therefore, it's pass-through in both cases.
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::SIGNATURE_KEY, oauthSignature);
|
||||
}
|
||||
|
||||
/* Signature method, only HMAC-SHA1 as of now */
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::SIGNATUREMETHOD_KEY, std::string( "HMAC-SHA1" ));
|
||||
|
||||
/* Timestamp */
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::TIMESTAMP_KEY, value_encoder(m_timeStamp));
|
||||
|
||||
/* Token */
|
||||
if( mToken && mToken->key().length() )
|
||||
{
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::TOKEN_KEY, value_encoder(mToken->key()));
|
||||
}
|
||||
|
||||
/* Verifier */
|
||||
if( includeOAuthVerifierPin && mToken && mToken->pin().length() )
|
||||
{
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::VERIFIER_KEY, value_encoder(mToken->pin()));
|
||||
}
|
||||
|
||||
/* Version */
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, Defaults::VERSION_KEY, std::string( "1.0" ));
|
||||
|
||||
/* Data if it's present */
|
||||
if( rawData.length() )
|
||||
{
|
||||
/* Data should already be urlencoded once */
|
||||
std::string dummyStrKey;
|
||||
std::string dummyStrValue;
|
||||
size_t nPos = rawData.find_first_of( "=" );
|
||||
if( std::string::npos != nPos )
|
||||
{
|
||||
dummyStrKey = rawData.substr( 0, nPos );
|
||||
dummyStrValue = rawData.substr( nPos + 1 );
|
||||
ReplaceOrInsertKeyValuePair(keyValueMap, dummyStrKey, dummyStrValue);
|
||||
}
|
||||
}
|
||||
|
||||
return ( keyValueMap.size() ) ? true : false;
|
||||
}
|
||||
|
||||
/*++
|
||||
* @method: Client::getSignature
|
||||
*
|
||||
* @description: this method calculates HMAC-SHA1 signature of OAuth header
|
||||
*
|
||||
* @input: eType - HTTP request type
|
||||
* rawUrl - raw url of the HTTP request
|
||||
* rawKeyValuePairs - key-value pairs containing OAuth headers and HTTP data
|
||||
*
|
||||
* @output: oAuthSignature - base64 and url encoded signature
|
||||
*
|
||||
* @remarks: internal method
|
||||
*
|
||||
*--*/
|
||||
bool Client::getSignature( const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const KeyValuePairs& rawKeyValuePairs,
|
||||
std::string& oAuthSignature )
|
||||
{
|
||||
std::string rawParams;
|
||||
std::string paramsSeperator;
|
||||
std::string sigBase;
|
||||
|
||||
/* Initially empty signature */
|
||||
oAuthSignature.assign( "" );
|
||||
|
||||
/* Build a string using key-value pairs */
|
||||
paramsSeperator = "&";
|
||||
getStringFromOAuthKeyValuePairs( rawKeyValuePairs, rawParams, paramsSeperator );
|
||||
LOG(LogLevelDebug, "Normalized parameters: " << rawParams);
|
||||
|
||||
/* Start constructing base signature string. Refer http://dev.twitter.com/auth#intro */
|
||||
switch( eType )
|
||||
{
|
||||
case Http::Head:
|
||||
{
|
||||
sigBase.assign( "HEAD&" );
|
||||
}
|
||||
break;
|
||||
|
||||
case Http::Get:
|
||||
{
|
||||
sigBase.assign( "GET&" );
|
||||
}
|
||||
break;
|
||||
|
||||
case Http::Post:
|
||||
{
|
||||
sigBase.assign( "POST&" );
|
||||
}
|
||||
break;
|
||||
|
||||
case Http::Delete:
|
||||
{
|
||||
sigBase.assign( "DELETE&" );
|
||||
}
|
||||
break;
|
||||
|
||||
case Http::Put:
|
||||
{
|
||||
sigBase.assign( "PUT&" );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
sigBase.append( PercentEncode( rawUrl ) );
|
||||
sigBase.append( "&" );
|
||||
sigBase.append( PercentEncode( rawParams ) );
|
||||
LOG(LogLevelDebug, "Signature base string: " << sigBase);
|
||||
|
||||
/* Now, hash the signature base string using HMAC_SHA1 class */
|
||||
CHMAC_SHA1 objHMACSHA1;
|
||||
std::string secretSigningKey;
|
||||
unsigned char strDigest[Defaults::BUFFSIZE_LARGE];
|
||||
|
||||
memset( strDigest, 0, Defaults::BUFFSIZE_LARGE );
|
||||
|
||||
/* Signing key is composed of consumer_secret&token_secret */
|
||||
secretSigningKey.assign( PercentEncode(mConsumer->secret()) );
|
||||
secretSigningKey.append( "&" );
|
||||
if( mToken && mToken->secret().length() )
|
||||
{
|
||||
secretSigningKey.append( PercentEncode(mToken->secret()) );
|
||||
}
|
||||
|
||||
objHMACSHA1.HMAC_SHA1( (unsigned char*)sigBase.c_str(),
|
||||
sigBase.length(),
|
||||
(unsigned char*)secretSigningKey.c_str(),
|
||||
secretSigningKey.length(),
|
||||
strDigest );
|
||||
|
||||
/* Do a base64 encode of signature */
|
||||
std::string base64Str = base64_encode( strDigest, 20 /* SHA 1 digest is 160 bits */ );
|
||||
LOG(LogLevelDebug, "Signature: " << base64Str);
|
||||
|
||||
/* Do an url encode */
|
||||
oAuthSignature = PercentEncode( base64Str );
|
||||
LOG(LogLevelDebug, "Percent-encoded Signature: " << oAuthSignature);
|
||||
|
||||
return ( oAuthSignature.length() ) ? true : false;
|
||||
}
|
||||
|
||||
std::string Client::getHttpHeader(const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData,
|
||||
const bool includeOAuthVerifierPin)
|
||||
{
|
||||
return Defaults::AUTHHEADER_PREFIX + buildOAuthParameterString(AuthorizationHeaderString, eType, rawUrl, rawData, includeOAuthVerifierPin);
|
||||
}
|
||||
|
||||
std::string Client::getFormattedHttpHeader(const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData,
|
||||
const bool includeOAuthVerifierPin)
|
||||
{
|
||||
return Defaults::AUTHHEADER_FIELD + Defaults::AUTHHEADER_PREFIX + buildOAuthParameterString(AuthorizationHeaderString, eType, rawUrl, rawData, includeOAuthVerifierPin);
|
||||
}
|
||||
|
||||
std::string Client::getURLQueryString(const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData,
|
||||
const bool includeOAuthVerifierPin)
|
||||
{
|
||||
return buildOAuthParameterString(QueryStringString, eType, rawUrl, rawData, includeOAuthVerifierPin);
|
||||
}
|
||||
|
||||
std::string Client::buildOAuthParameterString(
|
||||
ParameterStringType string_type,
|
||||
const Http::RequestType eType,
|
||||
const std::string& rawUrl,
|
||||
const std::string& rawData,
|
||||
const bool includeOAuthVerifierPin)
|
||||
{
|
||||
KeyValuePairs rawKeyValuePairs;
|
||||
std::string rawParams;
|
||||
std::string oauthSignature;
|
||||
std::string paramsSeperator;
|
||||
std::string pureUrl( rawUrl );
|
||||
|
||||
LOG(LogLevelDebug, "Signing request " << RequestTypeString(eType) << " " << rawUrl << " " << rawData);
|
||||
|
||||
std::string separator;
|
||||
bool do_urlencode;
|
||||
if (string_type == AuthorizationHeaderString) {
|
||||
separator = ",";
|
||||
do_urlencode = false;
|
||||
}
|
||||
else { // QueryStringString
|
||||
separator = "&";
|
||||
do_urlencode = true;
|
||||
}
|
||||
|
||||
/* Clear header string initially */
|
||||
rawKeyValuePairs.clear();
|
||||
|
||||
/* If URL itself contains ?key=value, then extract and put them in map */
|
||||
size_t nPos = rawUrl.find_first_of( "?" );
|
||||
if( std::string::npos != nPos )
|
||||
{
|
||||
/* Get only URL */
|
||||
pureUrl = rawUrl.substr( 0, nPos );
|
||||
|
||||
/* Get only key=value data part */
|
||||
std::string dataPart = rawUrl.substr( nPos + 1 );
|
||||
rawKeyValuePairs = ParseKeyValuePairs(dataPart);
|
||||
}
|
||||
|
||||
// NOTE: We always request URL encoding on the first pass so that the
|
||||
// signature generation works properly. This *relies* on
|
||||
// buildOAuthTokenKeyValuePairs overwriting values when we do the second
|
||||
// pass to get the values in the form we actually want. The signature and
|
||||
// rawdata are the only things that change, but the signature is only used
|
||||
// in the second pass and the rawdata is already encoded, regardless of
|
||||
// request type.
|
||||
|
||||
/* Build key-value pairs needed for OAuth request token, without signature */
|
||||
buildOAuthTokenKeyValuePairs( includeOAuthVerifierPin, rawData, std::string( "" ), rawKeyValuePairs, true, true );
|
||||
|
||||
/* Get url encoded base64 signature using request type, url and parameters */
|
||||
getSignature( eType, pureUrl, rawKeyValuePairs, oauthSignature );
|
||||
|
||||
/* Now, again build key-value pairs with signature this time */
|
||||
buildOAuthTokenKeyValuePairs( includeOAuthVerifierPin, std::string( "" ), oauthSignature, rawKeyValuePairs, do_urlencode, false );
|
||||
|
||||
/* Get OAuth header in string format. If we're getting the Authorization
|
||||
* header, we need to filter out other parameters.
|
||||
*/
|
||||
if (string_type == AuthorizationHeaderString) {
|
||||
KeyValuePairs oauthKeyValuePairs;
|
||||
std::vector<std::string> oauth_keys;
|
||||
oauth_keys.push_back(Defaults::CONSUMERKEY_KEY);
|
||||
oauth_keys.push_back(Defaults::NONCE_KEY);
|
||||
oauth_keys.push_back(Defaults::SIGNATURE_KEY);
|
||||
oauth_keys.push_back(Defaults::SIGNATUREMETHOD_KEY);
|
||||
oauth_keys.push_back(Defaults::TIMESTAMP_KEY);
|
||||
oauth_keys.push_back(Defaults::TOKEN_KEY);
|
||||
oauth_keys.push_back(Defaults::VERIFIER_KEY);
|
||||
oauth_keys.push_back(Defaults::VERSION_KEY);
|
||||
|
||||
for(size_t i = 0; i < oauth_keys.size(); i++) {
|
||||
assert(rawKeyValuePairs.count(oauth_keys[i]) <= 1);
|
||||
KeyValuePairs::iterator oauth_key_it = rawKeyValuePairs.find(oauth_keys[i]);
|
||||
if (oauth_key_it != rawKeyValuePairs.end())
|
||||
ReplaceOrInsertKeyValuePair(oauthKeyValuePairs, oauth_keys[i], oauth_key_it->second);
|
||||
}
|
||||
getStringFromOAuthKeyValuePairs( oauthKeyValuePairs, rawParams, separator );
|
||||
}
|
||||
else if (string_type == QueryStringString) {
|
||||
getStringFromOAuthKeyValuePairs( rawKeyValuePairs, rawParams, separator );
|
||||
}
|
||||
|
||||
/* Build authorization header */
|
||||
return rawParams;
|
||||
}
|
||||
|
||||
/*++
|
||||
* @method: Client::getStringFromOAuthKeyValuePairs
|
||||
*
|
||||
* @description: this method builds a sorted string from key-value pairs
|
||||
*
|
||||
* @input: rawParamMap - key-value pairs map
|
||||
* paramsSeperator - sepearator, either & or ,
|
||||
*
|
||||
* @output: rawParams - sorted string of OAuth parameters
|
||||
*
|
||||
* @remarks: internal method
|
||||
*
|
||||
*--*/
|
||||
bool Client::getStringFromOAuthKeyValuePairs( const KeyValuePairs& rawParamMap,
|
||||
std::string& rawParams,
|
||||
const std::string& paramsSeperator )
|
||||
{
|
||||
rawParams.assign( "" );
|
||||
if( rawParamMap.size() )
|
||||
{
|
||||
KeyValueList keyValueList;
|
||||
std::string dummyStr;
|
||||
|
||||
/* Push key-value pairs to a list of strings */
|
||||
keyValueList.clear();
|
||||
KeyValuePairs::const_iterator itMap = rawParamMap.begin();
|
||||
for( ; itMap != rawParamMap.end(); itMap++ )
|
||||
{
|
||||
dummyStr.assign( itMap->first );
|
||||
dummyStr.append( "=" );
|
||||
if( paramsSeperator == "," )
|
||||
{
|
||||
dummyStr.append( "\"" );
|
||||
}
|
||||
dummyStr.append( itMap->second );
|
||||
if( paramsSeperator == "," )
|
||||
{
|
||||
dummyStr.append( "\"" );
|
||||
}
|
||||
keyValueList.push_back( dummyStr );
|
||||
}
|
||||
|
||||
/* Sort key-value pairs based on key name */
|
||||
keyValueList.sort();
|
||||
|
||||
/* Now, form a string */
|
||||
dummyStr.assign( "" );
|
||||
KeyValueList::iterator itKeyValue = keyValueList.begin();
|
||||
for( ; itKeyValue != keyValueList.end(); itKeyValue++ )
|
||||
{
|
||||
if( dummyStr.length() )
|
||||
{
|
||||
dummyStr.append( paramsSeperator );
|
||||
}
|
||||
dummyStr.append( itKeyValue->c_str() );
|
||||
}
|
||||
rawParams.assign( dummyStr );
|
||||
}
|
||||
return ( rawParams.length() ) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
} // namespace OAuth
|
102
3party/liboauthcpp/src/urlencode.cpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
#include "urlencode.h"
|
||||
#include <cassert>
|
||||
|
||||
std::string char2hex( char dec )
|
||||
{
|
||||
char dig1 = (dec&0xF0)>>4;
|
||||
char dig2 = (dec&0x0F);
|
||||
if ( 0<= dig1 && dig1<= 9) dig1+=48; //0,48 in ascii
|
||||
if (10<= dig1 && dig1<=15) dig1+=65-10; //A,65 in ascii
|
||||
if ( 0<= dig2 && dig2<= 9) dig2+=48;
|
||||
if (10<= dig2 && dig2<=15) dig2+=65-10;
|
||||
|
||||
std::string r;
|
||||
r.append( &dig1, 1);
|
||||
r.append( &dig2, 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
std::string urlencode( const std::string &c, URLEncodeType enctype)
|
||||
{
|
||||
|
||||
std::string escaped;
|
||||
int max = c.length();
|
||||
for(int i=0; i<max; i++)
|
||||
{
|
||||
// Unreserved chars
|
||||
if ( (48 <= c[i] && c[i] <= 57) ||//0-9
|
||||
(65 <= c[i] && c[i] <= 90) ||//ABC...XYZ
|
||||
(97 <= c[i] && c[i] <= 122) || //abc...xyz
|
||||
(c[i]=='~' || c[i]=='-' || c[i]=='_' || c[i]=='.')
|
||||
)
|
||||
{
|
||||
escaped.append( &c[i], 1);
|
||||
}
|
||||
else if (c[i] != ':' && c[i] != '/' && c[i] != '?' && c[i] != '#' &&
|
||||
c[i] != '[' && c[i] != ']' && c[i] != '@' && c[i] != '%' &&
|
||||
|
||||
c[i] != '!' && c[i] != '$' && c[i] != '&' && c[i] != '\'' &&
|
||||
c[i] != '(' && c[i] != ')' && c[i] != '*' && c[i] != '+' &&
|
||||
c[i] != ',' && c[i] != ';' && c[i] != '=')
|
||||
{
|
||||
// Characters not in unreserved (first if block) and not in
|
||||
// the reserved set are always encoded.
|
||||
escaped.append("%");
|
||||
escaped.append( char2hex(c[i]) );//converts char 255 to string "FF"
|
||||
}
|
||||
else
|
||||
{
|
||||
// Finally, the reserved set. Encoding here depends on the
|
||||
// context (where in the URI we are, what type of URI, and
|
||||
// which character).
|
||||
|
||||
bool enc = false;
|
||||
|
||||
// Always encode reserved gen-delims + '%' (which always
|
||||
// needs encoding
|
||||
if (c[i] == ':' || c[i] == '/' || c[i] == '?' || c[i] == '#' ||
|
||||
c[i] == '[' || c[i] == ']' || c[i] == '@' || c[i] == '%')
|
||||
{
|
||||
enc = true;
|
||||
}
|
||||
else {
|
||||
switch (enctype) {
|
||||
case URLEncode_Everything:
|
||||
enc = true;
|
||||
break;
|
||||
case URLEncode_Path:
|
||||
// Only reserved sub-delim that needs encoding is %,
|
||||
// taken care of above. Otherwise, leave unencoded
|
||||
enc = false;
|
||||
break;
|
||||
case URLEncode_QueryKey:
|
||||
if (c[i] == '&' ||
|
||||
c[i] == '+' ||
|
||||
c[i] == '=')
|
||||
enc = true;
|
||||
else
|
||||
enc = false;
|
||||
break;
|
||||
case URLEncode_QueryValue:
|
||||
if (c[i] == '&' ||
|
||||
c[i] == '+')
|
||||
enc = true;
|
||||
else
|
||||
enc = false;
|
||||
break;
|
||||
default:
|
||||
assert(false && "Unknown urlencode type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (enc) {
|
||||
escaped.append("%");
|
||||
escaped.append( char2hex(c[i]) );//converts char 255 to string "FF"
|
||||
} else {
|
||||
escaped.append( &c[i], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return escaped;
|
||||
}
|
16
3party/liboauthcpp/src/urlencode.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef __URLENCODE_H__
|
||||
#define __URLENCODE_H__
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
std::string char2hex( char dec );
|
||||
enum URLEncodeType {
|
||||
URLEncode_Everything,
|
||||
URLEncode_Path,
|
||||
URLEncode_QueryKey,
|
||||
URLEncode_QueryValue,
|
||||
};
|
||||
std::string urlencode( const std::string &c, URLEncodeType enctype );
|
||||
|
||||
#endif // __URLENCODE_H__
|
|
@ -22,5 +22,3 @@ target_compile_definitions(${PROJECT_NAME}
|
|||
)
|
||||
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang,GNU>:-Wno-unused-value>)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ZLIB::ZLIB)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 30cc354fe37114ec7a0a4ed2192951690357c2ed
|
||||
Subproject commit a0e064336317c9347a91224112af9933598714e9
|
12
3party/sdf_image/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
project(sdf_image)
|
||||
|
||||
set(SRC
|
||||
sdf_image.cpp
|
||||
sdf_image.h
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} ${SRC})
|
||||
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
PRIVATE $<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-shorten-64-to-32>
|
||||
)
|
510
3party/sdf_image/sdf_image.cpp
Normal file
|
@ -0,0 +1,510 @@
|
|||
/*
|
||||
Copyright (C) 2009 by Stefan Gustavson
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "3party/sdf_image/sdf_image.h"
|
||||
|
||||
#include "base/math.hpp"
|
||||
#include "base/scope_guard.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace sdf_image
|
||||
{
|
||||
namespace
|
||||
{
|
||||
float const SQRT2 = 1.4142136f;
|
||||
|
||||
float ComputeXGradient(float ul, float /*u*/, float ur, float l, float r, float dl, float /*d*/, float dr)
|
||||
{
|
||||
return (ur + SQRT2 * r + dr) - (ul + SQRT2 * l + dl);
|
||||
}
|
||||
|
||||
float ComputeYGradient(float ul, float u, float ur, float /*l*/, float /*r*/, float dl, float d, float dr)
|
||||
{
|
||||
return (ur + SQRT2 * d + dr) - (ul + SQRT2 * u + dl);
|
||||
}
|
||||
|
||||
}
|
||||
#define BIND_GRADIENT(f) std::bind(&f, _1, _2, _3, _4, _5, _6, _7, _8)
|
||||
#define TRANSFORM(offset, dx, dy) \
|
||||
if (Transform(i, offset, dx, dy, xDist, yDist, oldDist)) \
|
||||
{ \
|
||||
dist.m_data[i] = oldDist; \
|
||||
changed = true; \
|
||||
}
|
||||
|
||||
|
||||
SdfImage::SdfImage(uint32_t h, uint32_t w)
|
||||
: m_height(h)
|
||||
, m_width(w)
|
||||
{
|
||||
m_data.resize(m_width * m_height, 0);
|
||||
}
|
||||
|
||||
SdfImage::SdfImage(uint32_t h, uint32_t w, uint8_t * imageData, uint8_t border)
|
||||
{
|
||||
int8_t doubleBorder = 2 * border;
|
||||
m_width = w + doubleBorder;
|
||||
m_height = h + doubleBorder;
|
||||
|
||||
uint32_t floatCount = m_width * m_height;
|
||||
m_data.resize(floatCount, 0.0f);
|
||||
for (size_t row = border; row < h + border; ++row)
|
||||
{
|
||||
size_t dstBaseIndex = row * m_width;
|
||||
size_t srcBaseIndex = (row - border) * w;
|
||||
for (size_t column = border; column < w + border; ++column)
|
||||
m_data[dstBaseIndex + column] = (float)imageData[srcBaseIndex + column - border] / 255.0f;
|
||||
}
|
||||
}
|
||||
|
||||
SdfImage::SdfImage(SdfImage const & copy)
|
||||
{
|
||||
m_height = copy.m_height;
|
||||
m_width = copy.m_width;
|
||||
m_data = copy.m_data;
|
||||
}
|
||||
|
||||
uint32_t SdfImage::GetWidth() const
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
|
||||
uint32_t SdfImage::GetHeight() const
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
|
||||
void SdfImage::GetData(std::vector<uint8_t> & dst)
|
||||
{
|
||||
ASSERT_LESS_OR_EQUAL(m_data.size(), dst.size(), ());
|
||||
std::transform(m_data.begin(), m_data.end(), dst.begin(), [](float const & node)
|
||||
{
|
||||
return static_cast<uint8_t>(node * 255.0f);
|
||||
});
|
||||
}
|
||||
|
||||
void SdfImage::Scale()
|
||||
{
|
||||
float maxi = std::numeric_limits<float>::min();
|
||||
float mini = std::numeric_limits<float>::max();
|
||||
|
||||
std::for_each(m_data.begin(), m_data.end(), [&maxi, &mini](float const & node)
|
||||
{
|
||||
maxi = std::max(maxi, node);
|
||||
mini = std::min(mini, node);
|
||||
});
|
||||
|
||||
maxi -= mini;
|
||||
std::for_each(m_data.begin(), m_data.end(), [&maxi, &mini](float & node)
|
||||
{
|
||||
node = (node - mini) / maxi;
|
||||
});
|
||||
}
|
||||
|
||||
void SdfImage::Invert()
|
||||
{
|
||||
std::for_each(m_data.begin(), m_data.end(), [](float & node)
|
||||
{
|
||||
node = 1.0f - node;
|
||||
});
|
||||
}
|
||||
|
||||
void SdfImage::Minus(SdfImage & im)
|
||||
{
|
||||
ASSERT(m_data.size() == im.m_data.size(), ());
|
||||
std::transform(m_data.begin(), m_data.end(), im.m_data.begin(), m_data.begin(), [](float const & n1, float const & n2)
|
||||
{
|
||||
return n1 - n2;
|
||||
});
|
||||
}
|
||||
|
||||
void SdfImage::Distquant()
|
||||
{
|
||||
std::for_each(m_data.begin(), m_data.end(), [](float & node)
|
||||
{
|
||||
node = base::Clamp(0.5f + node * 0.0325f, 0.0f, 1.0f);
|
||||
});
|
||||
}
|
||||
|
||||
void SdfImage::GenerateSDF(float sc)
|
||||
{
|
||||
Scale();
|
||||
|
||||
SdfImage outside(m_height, m_width);
|
||||
SdfImage inside(m_height, m_width);
|
||||
|
||||
size_t shortCount = m_width * m_height;
|
||||
std::vector<short> xDist;
|
||||
std::vector<short> yDist;
|
||||
xDist.resize(shortCount, 0);
|
||||
yDist.resize(shortCount, 0);
|
||||
|
||||
MexFunction(*this, xDist, yDist, outside);
|
||||
|
||||
fill(xDist.begin(), xDist.end(), 0);
|
||||
fill(yDist.begin(), yDist.end(), 0);
|
||||
|
||||
Invert();
|
||||
MexFunction(*this, xDist, yDist, inside);
|
||||
|
||||
outside.Minus(inside);
|
||||
outside.Distquant();
|
||||
outside.Invert();
|
||||
*this = outside.Bilinear(sc);
|
||||
}
|
||||
|
||||
SdfImage SdfImage::Bilinear(float scale)
|
||||
{
|
||||
uint32_t srcWidth = GetWidth();
|
||||
uint32_t srcHeight = GetHeight();
|
||||
uint32_t dstWidth = std::round(srcWidth * scale);
|
||||
uint32_t dstHeight = std::round(srcHeight * scale);
|
||||
|
||||
SdfImage result(dstHeight, dstWidth);
|
||||
|
||||
float xRatio = static_cast<float>(srcWidth) / dstWidth;
|
||||
float yRatio = static_cast<float>(srcHeight) / dstHeight;
|
||||
for (uint32_t i = 0; i < dstHeight; i++)
|
||||
{
|
||||
uint32_t baseIndex = i * dstWidth;
|
||||
for (uint32_t j = 0; j < dstWidth; j++)
|
||||
{
|
||||
float fx = xRatio * j;
|
||||
float fy = yRatio * i;
|
||||
uint32_t x = static_cast<uint32_t>(fx);
|
||||
uint32_t y = static_cast<uint32_t>(fy);
|
||||
uint32_t index = y * srcWidth + x;
|
||||
ASSERT_LESS(index, m_data.size(), ());
|
||||
|
||||
// range is 0 to 255 thus bitwise AND with 0xff
|
||||
float A = m_data[index];
|
||||
float B = m_data[index + 1];
|
||||
float C = m_data[index + srcWidth];
|
||||
float D = m_data[index + srcWidth + 1];
|
||||
|
||||
float xDiff = fx - x;
|
||||
float yDiff = fy - y;
|
||||
float xInvertDiff = 1.0f - xDiff;
|
||||
float yInvertDiff = 1.0f - yDiff;
|
||||
|
||||
float gray = A * xInvertDiff * yInvertDiff + B * xDiff * yInvertDiff +
|
||||
C * xInvertDiff * yDiff + D * xDiff * yDiff;
|
||||
|
||||
result.m_data[baseIndex + j] = gray;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
float SdfImage::ComputeGradient(uint32_t x, uint32_t y, SdfImage::TComputeFn const & fn) const
|
||||
{
|
||||
if (x < 1 || x > m_width - 1 ||
|
||||
y < 1 || y > m_height - 1)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
size_t k = y * m_width + x;
|
||||
|
||||
uint32_t l = k - 1;
|
||||
uint32_t r = k + 1;
|
||||
uint32_t u = k - m_width;
|
||||
uint32_t d = k + m_width;
|
||||
uint32_t ul = u - 1;
|
||||
uint32_t dl = d -1;
|
||||
uint32_t ur = u + 1;
|
||||
uint32_t dr = d + 1;
|
||||
|
||||
if (m_data[k] > 0.0 && m_data[k] < 1.0)
|
||||
{
|
||||
return fn(m_data[ul], m_data[u], m_data[ur],
|
||||
m_data[l], m_data[r],
|
||||
m_data[dl], m_data[d], m_data[dr]);
|
||||
}
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void SdfImage::MexFunction(SdfImage const & img, std::vector<short> & xDist, std::vector<short> & yDist, SdfImage & out)
|
||||
{
|
||||
ASSERT_EQUAL(img.GetWidth(), out.GetWidth(), ());
|
||||
ASSERT_EQUAL(img.GetHeight(), out.GetHeight(), ());
|
||||
|
||||
img.EdtaA3(xDist, yDist, out);
|
||||
// Pixels with grayscale>0.5 will have a negative distance.
|
||||
// This is correct, but we don't want values <0 returned here.
|
||||
std::for_each(out.m_data.begin(), out.m_data.end(), [](float & n)
|
||||
{
|
||||
n = std::max(0.0f, n);
|
||||
});
|
||||
}
|
||||
|
||||
float SdfImage::DistaA3(int c, int xc, int yc, int xi, int yi) const
|
||||
{
|
||||
int closest = c - xc - yc * m_width; // Index to the edge pixel pointed to from c
|
||||
//if (closest < 0 || closest > m_data.size())
|
||||
// return 1000000.0;
|
||||
ASSERT_GREATER_OR_EQUAL(closest, 0, ());
|
||||
ASSERT_LESS(closest, m_data.size(), ());
|
||||
|
||||
float a = base::Clamp(m_data[closest], 0.0f, 1.0f); // Grayscale value at the edge pixel
|
||||
|
||||
if(a == 0.0)
|
||||
return 1000000.0; // Not an object pixel, return "very far" ("don't know yet")
|
||||
|
||||
double dx = static_cast<double>(xi);
|
||||
double dy = static_cast<double>(yi);
|
||||
double di = sqrt(dx * dx + dy * dy); // Length of integer vector, like a traditional EDT
|
||||
double df = 0.0;
|
||||
if(di == 0.0)
|
||||
{
|
||||
int y = closest / m_width;
|
||||
int x = closest % m_width;
|
||||
// Use local gradient only at edges
|
||||
// Estimate based on local gradient only
|
||||
df = EdgeDf(ComputeGradient(x, y, BIND_GRADIENT(ComputeXGradient)),
|
||||
ComputeGradient(x, y, BIND_GRADIENT(ComputeYGradient)), a);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Estimate gradient based on direction to edge (accurate for large di)
|
||||
df = EdgeDf(dx, dy, a);
|
||||
}
|
||||
return static_cast<float>(di + df); // Same metric as edtaa2, except at edges (where di=0)
|
||||
}
|
||||
|
||||
double SdfImage::EdgeDf(double gx, double gy, double a) const
|
||||
{
|
||||
double df = 0.0;
|
||||
|
||||
if ((gx == 0) || (gy == 0))
|
||||
{
|
||||
// Either A) gu or gv are zero
|
||||
// B) both
|
||||
df = 0.5 - a; // Linear approximation is A) correct or B) a fair guess
|
||||
}
|
||||
else
|
||||
{
|
||||
double glength = sqrt(gx * gx + gy * gy);
|
||||
if(glength > 0)
|
||||
{
|
||||
gx = gx / glength;
|
||||
gy = gy / glength;
|
||||
}
|
||||
|
||||
// Everything is symmetric wrt sign and transposition,
|
||||
// so move to first octant (gx>=0, gy>=0, gx>=gy) to
|
||||
// avoid handling all possible edge directions.
|
||||
|
||||
gx = fabs(gx);
|
||||
gy = fabs(gy);
|
||||
if (gx < gy)
|
||||
std::swap(gx, gy);
|
||||
|
||||
double a1 = 0.5 * gy / gx;
|
||||
if (a < a1)
|
||||
df = 0.5 * (gx + gy) - sqrt(2.0 * gx * gy * a);
|
||||
else if (a < (1.0 - a1))
|
||||
df = (0.5 - a) * gx;
|
||||
else
|
||||
df = -0.5 * (gx + gy) + sqrt(2.0 * gx * gy * (1.0 - a));
|
||||
}
|
||||
|
||||
return df;
|
||||
}
|
||||
|
||||
void SdfImage::EdtaA3(std::vector<short> & xDist, std::vector<short> & yDist, SdfImage & dist) const
|
||||
{
|
||||
ASSERT_EQUAL(dist.GetHeight(), GetHeight(), ());
|
||||
ASSERT_EQUAL(dist.GetWidth(), GetWidth(), ());
|
||||
ASSERT_EQUAL(dist.m_data.size(), m_data.size(), ());
|
||||
|
||||
int w = GetWidth();
|
||||
int h = GetHeight();
|
||||
|
||||
/* Initialize the distance SdfImages */
|
||||
for (size_t y = 0; y < h; ++y)
|
||||
{
|
||||
size_t baseIndex = y * w;
|
||||
for (size_t x = 0; x < w; ++x)
|
||||
{
|
||||
size_t index = baseIndex + x;
|
||||
if (m_data[index] <= 0.0)
|
||||
dist.m_data[index]= 1000000.0; // Big value, means "not set yet"
|
||||
else if (m_data[index] < 1.0)
|
||||
{
|
||||
dist.m_data[index] = EdgeDf(ComputeGradient(x, y, BIND_GRADIENT(ComputeXGradient)),
|
||||
ComputeGradient(x, y, BIND_GRADIENT(ComputeYGradient)),
|
||||
m_data[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize index offsets for the current SdfImage width */
|
||||
int offsetU = -w;
|
||||
int offsetD = w;
|
||||
int offsetR = 1;
|
||||
int offsetL = -1;
|
||||
int offsetRu = -w + 1;
|
||||
int offsetRd = w + 1;
|
||||
int offsetLd = w - 1;
|
||||
int offsetLu = -w - 1;
|
||||
|
||||
/* Perform the transformation */
|
||||
bool changed;
|
||||
do
|
||||
{
|
||||
changed = false;
|
||||
for(int y = 1; y < h; ++y)
|
||||
{
|
||||
int i = y * w;
|
||||
|
||||
/* scan right, propagate distances from above & left */
|
||||
/* Leftmost pixel is special, has no left neighbors */
|
||||
float oldDist = dist.m_data[i];
|
||||
if(oldDist > 0) // If non-zero distance or not set yet
|
||||
{
|
||||
TRANSFORM(offsetU, 0, 1);
|
||||
TRANSFORM(offsetRu, -1, 1);
|
||||
}
|
||||
|
||||
++i;
|
||||
|
||||
/* Middle pixels have all neighbors */
|
||||
for(int x = 1; x < w - 1; ++x, ++i)
|
||||
{
|
||||
oldDist = dist.m_data[i];
|
||||
if(oldDist > 0.0)
|
||||
{
|
||||
TRANSFORM(offsetL, 1, 0);
|
||||
TRANSFORM(offsetLu, 1, 1);
|
||||
TRANSFORM(offsetU, 0, 1);
|
||||
TRANSFORM(offsetRu, -1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Rightmost pixel of row is special, has no right neighbors */
|
||||
oldDist = dist.m_data[i];
|
||||
if(oldDist > 0)
|
||||
{
|
||||
TRANSFORM(offsetL, 1, 0);
|
||||
TRANSFORM(offsetLu, 1, 1);
|
||||
TRANSFORM(offsetU, 0, 1);
|
||||
}
|
||||
|
||||
/* Move index to second rightmost pixel of current row. */
|
||||
/* Rightmost pixel is skipped, it has no right neighbor. */
|
||||
i = y * w + w - 2;
|
||||
|
||||
/* scan left, propagate distance from right */
|
||||
for(int x = w - 2; x >= 0; --x, --i)
|
||||
{
|
||||
oldDist = dist.m_data[i];
|
||||
if(oldDist > 0.0)
|
||||
TRANSFORM(offsetR, -1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan rows in reverse order, except last row */
|
||||
for(int y = h - 2; y >= 0; --y)
|
||||
{
|
||||
/* move index to rightmost pixel of current row */
|
||||
int i = y * w + w - 1;
|
||||
|
||||
/* Scan left, propagate distances from below & right */
|
||||
|
||||
/* Rightmost pixel is special, has no right neighbors */
|
||||
float oldDist = dist.m_data[i];
|
||||
if(oldDist > 0) // If not already zero distance
|
||||
{
|
||||
TRANSFORM(offsetD, 0, -1);
|
||||
TRANSFORM(offsetLd, 1, -1);
|
||||
}
|
||||
|
||||
--i;
|
||||
|
||||
/* Middle pixels have all neighbors */
|
||||
for(int x = w - 2; x > 0; --x, --i)
|
||||
{
|
||||
oldDist = dist.m_data[i];
|
||||
if(oldDist > 0.0)
|
||||
{
|
||||
TRANSFORM(offsetR, -1, 0);
|
||||
TRANSFORM(offsetRd, -1, -1);
|
||||
TRANSFORM(offsetD, 0, -1);
|
||||
TRANSFORM(offsetLd, 1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Leftmost pixel is special, has no left neighbors */
|
||||
oldDist = dist.m_data[i];
|
||||
if(oldDist > 0)
|
||||
{
|
||||
TRANSFORM(offsetR, -1, 0);
|
||||
TRANSFORM(offsetRd, -1, -1);
|
||||
TRANSFORM(offsetD, 0, -1);
|
||||
}
|
||||
|
||||
/* Move index to second leftmost pixel of current row. */
|
||||
/* Leftmost pixel is skipped, it has no left neighbor. */
|
||||
i = y * w + 1;
|
||||
for(int x = 1; x < w; ++x, ++i)
|
||||
{
|
||||
/* scan right, propagate distance from left */
|
||||
oldDist = dist.m_data[i];
|
||||
if(oldDist > 0.0)
|
||||
TRANSFORM(offsetL, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(changed);
|
||||
}
|
||||
|
||||
bool SdfImage::Transform(int baseIndex, int offset, int dx, int dy, std::vector<short> & xDist, std::vector<short> & yDist, float & oldDist) const
|
||||
{
|
||||
double const epsilon = 1e-3;
|
||||
ASSERT_EQUAL(xDist.size(), yDist.size(), ());
|
||||
ASSERT_GREATER_OR_EQUAL(baseIndex, 0, ());
|
||||
ASSERT_LESS(baseIndex, xDist.size(), ());
|
||||
|
||||
int candidate = baseIndex + offset;
|
||||
ASSERT_GREATER_OR_EQUAL(candidate, 0, ());
|
||||
ASSERT_LESS(candidate, xDist.size(), ());
|
||||
|
||||
int cDistX = xDist[candidate];
|
||||
int cDistY = yDist[candidate];
|
||||
int newDistX = cDistX + dx;
|
||||
int newDistY = cDistY + dy;
|
||||
float newDist = DistaA3(candidate, cDistX, cDistY, newDistX, newDistY);
|
||||
if(newDist < oldDist - epsilon)
|
||||
{
|
||||
xDist[baseIndex] = newDistX;
|
||||
yDist[baseIndex] = newDistY;
|
||||
oldDist = newDist;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace sdf_image
|
81
3party/sdf_image/sdf_image.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
#pragma once
|
||||
|
||||
// +----------------------------------------+
|
||||
// | |
|
||||
// | http://contourtextures.wikidot.com |
|
||||
// | |
|
||||
// +----------------------------------------+
|
||||
|
||||
/*
|
||||
Copyright (C) 2009 by Stefan Gustavson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "base/buffer_vector.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace sdf_image
|
||||
{
|
||||
class SdfImage
|
||||
{
|
||||
public:
|
||||
SdfImage() = default;
|
||||
SdfImage(uint32_t h, uint32_t w);
|
||||
SdfImage(uint32_t h, uint32_t w, uint8_t * imageData, uint8_t border);
|
||||
SdfImage(SdfImage const & copy);
|
||||
|
||||
uint32_t GetWidth() const;
|
||||
uint32_t GetHeight() const;
|
||||
void GetData(std::vector<uint8_t> & dst);
|
||||
void GenerateSDF(float sc);
|
||||
|
||||
private:
|
||||
void Scale();
|
||||
void Invert();
|
||||
void Minus(SdfImage &im);
|
||||
void Distquant();
|
||||
SdfImage Bilinear(float Scale);
|
||||
|
||||
private:
|
||||
/// ul = up left
|
||||
/// u = up
|
||||
/// ...
|
||||
/// d = down
|
||||
/// dr = down right
|
||||
/// ul u ur l r dl d dr
|
||||
using TComputeFn = std::function<float (float, float, float, float, float, float, float, float)>;
|
||||
float ComputeGradient(uint32_t x, uint32_t y, TComputeFn const & fn) const;
|
||||
void MexFunction(SdfImage const & img, std::vector<short> & xDist, std::vector<short> & yDist,
|
||||
SdfImage & out);
|
||||
float DistaA3(int c, int xc, int yc, int xi, int yi) const;
|
||||
double EdgeDf(double gx, double gy, double a) const;
|
||||
void EdtaA3(std::vector<short> & xDist, std::vector<short> & yDist, SdfImage & dist) const;
|
||||
bool Transform(int baseIndex, int offset, int dx, int dy, std::vector<short> & xDist,
|
||||
std::vector<short> & yDist, float & oldDist) const;
|
||||
|
||||
private:
|
||||
uint32_t m_height = 0;
|
||||
uint32_t m_width = 0;
|
||||
buffer_vector<float, 512> m_data;
|
||||
};
|
||||
} // namespace sdf_image
|
|
@ -511,7 +511,7 @@ static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, c
|
|||
|
||||
STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
stbi__start_write_callbacks(&s, func, context);
|
||||
return stbi_write_bmp_core(&s, x, y, comp, data);
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x,
|
|||
#ifndef STBI_WRITE_NO_STDIO
|
||||
STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
if (stbi__start_write_file(&s,filename)) {
|
||||
int r = stbi_write_bmp_core(&s, x, y, comp, data);
|
||||
stbi__end_write_file(&s);
|
||||
|
@ -610,7 +610,7 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v
|
|||
|
||||
STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
stbi__start_write_callbacks(&s, func, context);
|
||||
return stbi_write_tga_core(&s, x, y, comp, (void *) data);
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x,
|
|||
#ifndef STBI_WRITE_NO_STDIO
|
||||
STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
if (stbi__start_write_file(&s,filename)) {
|
||||
int r = stbi_write_tga_core(&s, x, y, comp, (void *) data);
|
||||
stbi__end_write_file(&s);
|
||||
|
@ -786,14 +786,14 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
|
|||
|
||||
STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
stbi__start_write_callbacks(&s, func, context);
|
||||
return stbi_write_hdr_core(&s, x, y, comp, (float *) data);
|
||||
}
|
||||
|
||||
STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
if (stbi__start_write_file(&s,filename)) {
|
||||
int r = stbi_write_hdr_core(&s, x, y, comp, (float *) data);
|
||||
stbi__end_write_file(&s);
|
||||
|
@ -1606,7 +1606,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in
|
|||
|
||||
STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
stbi__start_write_callbacks(&s, func, context);
|
||||
return stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality);
|
||||
}
|
||||
|
@ -1615,7 +1615,7 @@ STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x,
|
|||
#ifndef STBI_WRITE_NO_STDIO
|
||||
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality)
|
||||
{
|
||||
stbi__write_context s = {};
|
||||
stbi__write_context s = { 0 };
|
||||
if (stbi__start_write_file(&s,filename)) {
|
||||
int r = stbi_write_jpg_core(&s, x, y, comp, data, quality);
|
||||
stbi__end_write_file(&s);
|
||||
|
|
|
@ -17,9 +17,6 @@ endif()
|
|||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC .)
|
||||
|
||||
if (PLATFORM_LINUX)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE VK_USE_PLATFORM_XLIB_KHR)
|
||||
endif()
|
||||
|
||||
# dlopen
|
||||
target_link_libraries(${PROJECT_NAME} $<$<BOOL:CMAKE_DL_LIBS>:${CMAKE_DL_LIBS}>)
|
||||
|
|
|
@ -22,20 +22,7 @@ extern "C" {
|
|||
#include <dlfcn.h>
|
||||
|
||||
int InitVulkan(void) {
|
||||
#if defined(__APPLE__)
|
||||
void* libvulkan = dlopen("libvulkan.dylib", RTLD_NOW | RTLD_LOCAL);
|
||||
if (!libvulkan) {
|
||||
libvulkan = dlopen("libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL);
|
||||
}
|
||||
if (!libvulkan) {
|
||||
libvulkan = dlopen("libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL);
|
||||
}
|
||||
#else
|
||||
void* libvulkan = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL);
|
||||
if (!libvulkan) {
|
||||
libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
|
||||
}
|
||||
#endif
|
||||
void* libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
|
||||
if (!libvulkan) return 0;
|
||||
|
||||
// Vulkan supported, set function addresses
|
||||
|
@ -558,10 +545,6 @@ int InitVulkan(void) {
|
|||
vkDestroyDebugReportCallbackEXT = reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(dlsym(libvulkan, "vkDestroyDebugReportCallbackEXT"));
|
||||
vkDebugReportMessageEXT = reinterpret_cast<PFN_vkDebugReportMessageEXT>(dlsym(libvulkan, "vkDebugReportMessageEXT"));
|
||||
|
||||
#if defined(__APPLE__)
|
||||
vkCreateMacOSSurfaceMVK = reinterpret_cast<PFN_vkCreateMacOSSurfaceMVK>(dlsym(libvulkan, "vkCreateMacOSSurfaceMVK"));
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1154,10 +1137,6 @@ PFN_vkCmdDecodeVideoKHR vkCmdDecodeVideoKHR;
|
|||
PFN_vkCmdEncodeVideoKHR vkCmdEncodeVideoKHR;
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -25,10 +25,6 @@ extern "C" {
|
|||
#define VK_USE_PLATFORM_ANDROID_KHR 1
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <vulkan/vulkan_macos.h>
|
||||
#endif
|
||||
|
||||
/* Initialize the Vulkan function pointer variables declared in this header.
|
||||
* Returns 0 if vulkan is not available, non-zero if it is available.
|
||||
*/
|
||||
|
@ -504,10 +500,6 @@ extern PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT;
|
|||
extern PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
|
||||
extern PFN_vkDebugReportMessageEXT vkDebugReportMessageEXT;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
extern PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
cmake_minimum_required(VERSION 3.22.1)
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
project(omim C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
# Our code does not rely on gnu extensions.
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
|
@ -26,7 +26,7 @@ if (APPLE AND NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android))
|
|||
set(CMAKE_OBJC_VISIBILITY_PRESET hidden)
|
||||
enable_language(OBJCXX)
|
||||
set(CMAKE_OBJCXX_EXTENSIONS OFF)
|
||||
set(CMAKE_OBJCXX_STANDARD 20)
|
||||
set(CMAKE_OBJCXX_STANDARD 17)
|
||||
set(CMAKE_OBJCXX_FLAGS -fobjc-arc)
|
||||
set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
|
@ -90,19 +90,6 @@ else()
|
|||
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
|
||||
endif()
|
||||
|
||||
if(${PLATFORM_MAC})
|
||||
set(XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
|
||||
|
||||
# Metal language support
|
||||
list(APPEND CMAKE_MODULE_PATH ${OMIM_ROOT}/3party/CMake-MetalShaderSupport/cmake)
|
||||
include(CheckLanguage)
|
||||
include(MetalShaderSupport)
|
||||
check_language(Metal)
|
||||
if(CMAKE_Metal_COMPILER)
|
||||
enable_language(Metal)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Sanitizer
|
||||
if (PLATFORM_DESKTOP)
|
||||
# https://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
|
||||
|
@ -162,12 +149,6 @@ if (BUILD_DESIGNER)
|
|||
add_definitions(-DBUILD_DESIGNER)
|
||||
endif()
|
||||
|
||||
option(BUILD_STANDALONE "Build standalone application" OFF)
|
||||
if (BUILD_STANDALONE)
|
||||
message(STATUS "Standalone building is enabled")
|
||||
add_definitions(-DBUILD_STANDALONE)
|
||||
endif()
|
||||
|
||||
option(USE_ASAN "Enable Address Sanitizer" OFF)
|
||||
option(USE_TSAN "Enable Thread Sanitizer" OFF)
|
||||
option(USE_LIBFUZZER "Enable LibFuzzer" OFF)
|
||||
|
@ -176,7 +157,6 @@ option(SKIP_QT_GUI "Skip building of Qt GUI" OFF)
|
|||
option(USE_PCH "Use precompiled headers" OFF)
|
||||
option(NJOBS "Number of parallel processes" OFF)
|
||||
option(ENABLE_VULKAN_DIAGNOSTICS "Enable Vulkan diagnostics" OFF)
|
||||
option(ENABLE_TRACE "Enable Tracing" OFF)
|
||||
|
||||
if (NJOBS)
|
||||
message(STATUS "Number of parallel processes: ${NJOBS}")
|
||||
|
@ -186,9 +166,9 @@ if (NJOBS)
|
|||
set(CMAKE_JOB_POOL_PRECOMPILE_HEADER custom)
|
||||
endif()
|
||||
|
||||
# GCC 10.0 is required to support <charconv> header inclusion in base/string_utils.hpp
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
message(FATAL_ERROR "Minimum supported g++ version is 10.0, yours is ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
# GCC 8.1 is required to support <charconv> header inclusion in base/string_utils.hpp, otherwise 7.0 is sufficient
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.1)
|
||||
message(FATAL_ERROR "Minimum supported g++ version is 8.1 yours is ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
@ -233,11 +213,6 @@ if (ENABLE_VULKAN_DIAGNOSTICS)
|
|||
add_definitions(-DENABLE_VULKAN_DIAGNOSTICS)
|
||||
endif()
|
||||
|
||||
if (ENABLE_TRACE)
|
||||
message(STATUS "Tracing is enabled")
|
||||
add_definitions(-DENABLE_TRACE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# Set environment variables
|
||||
|
@ -278,6 +253,16 @@ find_package(Threads REQUIRED)
|
|||
|
||||
# Scripts
|
||||
|
||||
if (NOT CMAKE_HOST_WIN32)
|
||||
execute_process(
|
||||
COMMAND "${OMIM_ROOT}/tools/unix/check_cert.sh"
|
||||
RESULT_VARIABLE CheckCertResult
|
||||
)
|
||||
if (CheckCertResult)
|
||||
message(FATAL_ERROR "Certificate check failed")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID)
|
||||
list(APPEND qt_components Core Network)
|
||||
if (NOT SKIP_QT_GUI OR NOT SKIP_TESTS OR PYBINDINGS)
|
||||
|
@ -288,13 +273,6 @@ if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID)
|
|||
endif()
|
||||
# PATHS are hard-coded hints where to look for qt6 in addition to other places.
|
||||
find_package(Qt6 COMPONENTS REQUIRED ${qt_components} PATHS $ENV{QT_PATH} /opt/homebrew/opt/qt@6 /usr/local/opt/qt@6 /usr/lib/x86_64-linux-gnu/qt6)
|
||||
|
||||
set(MINIMUM_REQUIRED_QT_VERSION 6.4.0)
|
||||
if (Qt6Widgets_VERSION VERSION_LESS ${MINIMUM_REQUIRED_QT_VERSION})
|
||||
message(FATAL_ERROR "Unsupported Qt version: ${Qt6Widgets_VERSION}, the minimum required is ${MINIMUM_REQUIRED_QT_VERSION}")
|
||||
else()
|
||||
message(STATUS "Found Qt version: ${Qt6Widgets_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# To allow #include "base/file_name.hpp" in all sources.
|
||||
|
@ -359,8 +337,12 @@ if (PLATFORM_DESKTOP AND NOT WITH_SYSTEM_PROVIDED_3PARTY)
|
|||
include_directories("${PROJECT_BINARY_DIR}/3party/gflags/include")
|
||||
endif()
|
||||
|
||||
# Used in qt/ and shaders/
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
if (Python3_Interpreter_FOUND)
|
||||
message(STATUS "Found python to use in qt/, shaders/ and 3party/: ${Python3_EXECUTABLE}")
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find python3 to use in qt/, shaders/ and 3party/.")
|
||||
endif()
|
||||
|
||||
add_subdirectory(base)
|
||||
add_subdirectory(coding)
|
||||
|
@ -397,7 +379,6 @@ if (PLATFORM_DESKTOP)
|
|||
add_subdirectory(qt)
|
||||
omim_add_tool_subdirectory(skin_generator)
|
||||
endif()
|
||||
add_subdirectory(dev_sandbox)
|
||||
endif()
|
||||
|
||||
omim_add_test_subdirectory(qt_tstfrm)
|
||||
|
|
94
CONTRIBUTORS
|
@ -1,72 +1,11 @@
|
|||
This file contains a list of people who have contributed to this project.
|
||||
Its not neccesarily comprehensive.
|
||||
Feel free to add yourself here along with your first contribution!
|
||||
This file contains a list of people who have contributed to the
|
||||
public version of MAPS.ME and Organic Maps.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Organic Maps (formerly OMaps) contributors:
|
||||
(in alphabetic order)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Alexander Borsuk <me@alex.bio>
|
||||
Alexey Krasilnikov
|
||||
Andrew Shkrob
|
||||
Anton Makouski
|
||||
Arnaud Vergnet
|
||||
Arthur-GYT
|
||||
Atemu
|
||||
Caspar Nuël <casparnuel@yandex.com>
|
||||
cyber-toad
|
||||
David Martinez
|
||||
dbf
|
||||
Dzmitry Strekha
|
||||
Dzmitry Yarmolenka
|
||||
Fabian Wüthrich
|
||||
Ferenc Géczi
|
||||
Filip Czaplicki
|
||||
FinixFighter
|
||||
fparri
|
||||
Francesco Gazzetta
|
||||
gallegonovato
|
||||
Gonzalo Pesquero
|
||||
Harry Bond <me@hbond.xyz>
|
||||
Jaime Marquinez Ferrandiz
|
||||
Jean-Baptiste Charron
|
||||
Jenny Em
|
||||
Joan Montané
|
||||
Karina Kordon
|
||||
Kavi Khalique
|
||||
Kiryl Kaveryn
|
||||
Kiryl Razhdzestvenski
|
||||
Konstantin Pastbin
|
||||
Loïc Hernaut
|
||||
Lukas Hamm
|
||||
Lukas Kronberger
|
||||
Luna Rose
|
||||
map-per
|
||||
Markku Huotari
|
||||
Mateusz Konieczny
|
||||
Matheus Gomes
|
||||
MbTy1
|
||||
Meenbeese
|
||||
Metehan Özyürek
|
||||
Michał Brzozowski
|
||||
Nishant Bhandari <nishantbhandari0019@gmail.com>
|
||||
Ognjen Blagojevic
|
||||
Osyotr
|
||||
renderexpert
|
||||
Roman Kuznetsov
|
||||
Roman Tsisyk <roman@tsisyk.com>
|
||||
Rudo Kemper
|
||||
Sebastiao Sousa <sebastiao.sousa@tecnico.ulisboa.pt>
|
||||
Sergiy Kozyr
|
||||
Tobias G. <tobi.goergens@gmail.com>
|
||||
Veniamin Gvozdikov <g.veniamin@googlemail.com>
|
||||
Viktor Govako <viktor.govako@gmail.com>
|
||||
Will Bradley
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
MAPS.ME at Mail.Ru Group (prior to the Organic Maps (OMaps) fork in 2020/2021):
|
||||
--------------------------------------------------------------------------------
|
||||
Original MAPS.ME (MapsWithMe) design and implementation:
|
||||
Yury Melnichek <yury@melnichek.com>
|
||||
Alexander Borsuk <me@alex.bio>
|
||||
Viktor Govako <viktor.govako@gmail.com>
|
||||
Siarhei Rachytski <siarhei.rachytski@gmail.com>
|
||||
|
||||
Code contributions:
|
||||
Dmitry Yunitski
|
||||
|
@ -96,6 +35,10 @@ Code contributions:
|
|||
Alex Gontmakher <gsasha@gmail.com>
|
||||
Dima Korolev <dmitry.korolev@gmail.com>
|
||||
Max Grigorev <forwidur@gmail.com>
|
||||
Roman Tsisyk <roman@tsisyk.com>
|
||||
Caspar Nuël <casparnuel@yandex.com>
|
||||
Konstantin Pastbin
|
||||
Nishant Bhandari <nishantbhandari0019@gmail.com>
|
||||
|
||||
Porting to Tizen platform:
|
||||
Sergey Pisarchik
|
||||
|
@ -119,6 +62,11 @@ Strings and translations:
|
|||
Vasily Korotkevich
|
||||
Mark N. Kuramochi
|
||||
Lidia Vasiljeva
|
||||
Karina Kordon
|
||||
Konstantin Pastbin
|
||||
Metehan Özyürek
|
||||
Joan Montané
|
||||
Luna Rose
|
||||
|
||||
Project management:
|
||||
Alexander Matveenko
|
||||
|
@ -138,13 +86,3 @@ Special thanks to:
|
|||
Yuri Gurski
|
||||
Dmitry Matveev
|
||||
Anna Yakovleva
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
MAPS.ME (originally MapsWithMe) design and implementation at MapsWithMe GmbH
|
||||
(from 2010 till the acquisition by Mail.ru Group in 2014):
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Yury Melnichek <yury@melnichek.com>
|
||||
Alexander Borsuk <me@alex.bio>
|
||||
Viktor Govako <viktor.govako@gmail.com>
|
||||
Siarhei Rachytski <siarhei.rachytski@gmail.com>
|
||||
|
|
9
LEGAL
|
@ -1,9 +0,0 @@
|
|||
Certain project resources, including but not limited to domain names, trademarks, hosting accounts, payment accounts, and others, are overseen and managed by Organic Maps OÜ. The governance of these digital assets is subject to policies established by Organic Maps OÜ, in compliance with applicable statutory laws.
|
||||
|
||||
Organic Maps OÜ is a legal entity established on 2021-05-01 under the laws of the Republic of Estonia and the European Union, with registration number 16225385. The primary purpose of the entity is to shield the project's members from personal liability and to ensure the legal protection of the project's assets. Official up-to-date information about the entity can be found in the Estonian Business Register:
|
||||
|
||||
https://ariregister.rik.ee/eng/company/16225385/Organic-Maps-O%C3%9C
|
||||
|
||||
Organic Maps OÜ does not require contributors to transfer copyright ownership and does not retain any copyright over the code contributed to the repository. See the NOTICE file and docs/DCO.md for additional information.
|
||||
|
||||
For any legal inquiries, feel free to contact legal@organicmaps.app.
|
2
NOTICE
|
@ -1,5 +1,5 @@
|
|||
Copyright 2020 My.com B.V. (Mail.Ru Group)
|
||||
Copyright 2024 Organic Maps Contributors
|
||||
Copyright 2021 Organic Maps Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
41
README.md
|
@ -1,17 +1,25 @@
|
|||
<div align="center">
|
||||
<img src="qt/res/logo.png" height="100"/>
|
||||
</div>
|
||||
<h1 align="center"">Organic Maps</h1>
|
||||
# Organic Maps
|
||||
|
||||
<a name="install"/>
|
||||
|
||||
[Organic Maps](https://organicmaps.app) is a free Android & iOS offline maps app for travellers, tourists, drivers, hikers, and cyclists.
|
||||
It uses crowd-sourced [OpenStreetMap](https://www.openstreetmap.org) data and is developed with love by the creators of **MapsWithMe** (later renamed to **Maps.Me**) and by our community.
|
||||
No ads, no tracking, no data collection, no crapware. Your [donations](https://organicmaps.app/donate/) and positive reviews motivate and inspire us, thanks ❤️!
|
||||
|
||||
[<img src="docs/badges/apple-appstore.png" alt="App Store" width="160">](https://apps.apple.com/app/organic-maps/id1567437057)
|
||||
[<img src="docs/badges/google-play.png" alt="Google Play" width="160">](https://play.google.com/store/apps/details?id=app.organicmaps)
|
||||
[<img src="docs/badges/huawei-appgallery.png" alt="AppGallery" width="160">](https://appgallery.huawei.com/#/app/C104325611)
|
||||
[<img src="docs/badges/obtainium.png" alt="Obtainium" width="160">](https://github.com/organicmaps/organicmaps/wiki/Installing-Organic-Maps-from-GitHub-using-Obtainium)
|
||||
[<img src="docs/badges/fdroid.png" alt="F-Droid" width="160">](https://f-droid.org/en/packages/app.organicmaps/)
|
||||
<p float="left">
|
||||
<a href="https://apps.apple.com/app/organic-maps/id1567437057">
|
||||
<img alt="Download on the App Store" src="docs/badges/apple-appstore.png" width="180">
|
||||
</a>
|
||||
<a href="https://play.google.com/store/apps/details?id=app.organicmaps">
|
||||
<img alt="Get it on Google Play" src="docs/badges/google-play.png" width="180">
|
||||
</a>
|
||||
<a href="https://appgallery.huawei.com/#/app/C104325611">
|
||||
<img alt="Explore it on AppGallery" src="docs/badges/huawei-appgallery.png" width="180">
|
||||
</a>
|
||||
<a href="https://f-droid.org/en/packages/app.organicmaps/">
|
||||
<img alt="Get it on F-Droid" src="docs/badges/fdroid.png" width="180">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p float="left">
|
||||
<img src="android/app/src/fdroid/play/listings/en-US/graphics/phone-screenshots/1.jpg" width="400" />
|
||||
|
@ -115,14 +123,6 @@ Beloved institutional sponsors below have provided targeted grants to cover some
|
|||
<a href="https://www.mythic-beasts.com/">Mythic Beasts</a> ISP <a href="https://www.mythic-beasts.com/blog/2021/10/06/improving-the-world-bit-by-expensive-bit/">provides us</a> two virtual servers with 400 TB/month of free bandwidth to host and serve maps downloads and updates.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://44plus.vn"><img src="docs/sponsors/44plus.svg" alt="44+ Technologies" width="200px"></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://44plus.vn">44+ Technologies</a> is <a href="https://44plus.vn/organicmaps">providing us </a>with a free dedicated server worth around $12,000/year to serve maps across Vietnam & Southeast Asia.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="https://futo.org"><img src="docs/sponsors/futo.svg" alt="FUTO" width="200px"></a>
|
||||
|
@ -167,8 +167,9 @@ Please join our beta program, suggest your features, and report bugs:
|
|||
|
||||
- **Rate us on the [App Store](https://apps.apple.com/app/organic-maps/id1567437057)
|
||||
and [Google Play](https://play.google.com/store/apps/details?id=app.organicmaps)**.
|
||||
- **Star us on Forgejo**.
|
||||
- Report bugs or issues to [the issue tracker](https://git.omaps.dev/organicmaps/organicmaps/issues).
|
||||
- **Star us on GitHub**.
|
||||
- Report bugs or issues to [the issue tracker](https://github.com/organicmaps/organicmaps/issues).
|
||||
- [Discuss](https://github.com/organicmaps/organicmaps/discussions/categories/ideas) ideas or propose feature requests.
|
||||
- Subscribe to our [Telegram Channel](https://t.me/OrganicMapsApp) or to the [[matrix] space](https://matrix.to/#/#organicmaps:matrix.org) for updates.
|
||||
- Join our [Telegram Group](https://t.me/OrganicMaps) to discuss with other users.
|
||||
- Присоединяйтесь к нашей [русскоязычной группе в Telegram](https://t.me/OrganicMapsRu) для обратной связи и помощи.
|
||||
|
@ -178,7 +179,7 @@ and [Google Play](https://play.google.com/store/apps/details?id=app.organicmaps)
|
|||
- Follow our updates in
|
||||
[Mastodon](https://fosstodon.org/@organicmaps),
|
||||
[Facebook](https://facebook.com/OrganicMaps),
|
||||
[X (Twitter)](https://x.com/OrganicMapsApp),
|
||||
[Twitter](https://twitter.com/OrganicMapsApp),
|
||||
[Instagram](https://instagram.com/organicmaps.app/).
|
||||
- Güncellemelerimizi [Instagram](https://instagram.com/organicmapstr/) üzerinden takip edin.
|
||||
|
||||
|
|
2
android/.gitignore
vendored
|
@ -22,5 +22,3 @@ local.properties
|
|||
lint.xml
|
||||
.gradletasknamecache
|
||||
|
||||
# Generated by Eclipse and JDTLS
|
||||
.settings/
|
||||
|
|
|
@ -22,18 +22,18 @@ buildscript {
|
|||
googleFirebaseServicesDefault
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.7.3'
|
||||
classpath 'com.android.tools.build:gradle:8.3.2'
|
||||
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
println('Building with Google Firebase Services')
|
||||
classpath 'com.google.gms:google-services:4.4.2'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
|
||||
classpath 'com.google.firebase:firebase-appdistribution-gradle:5.0.0'
|
||||
classpath 'com.google.gms:google-services:4.4.1'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
|
||||
classpath 'com.google.firebase:firebase-appdistribution-gradle:4.2.0'
|
||||
} else {
|
||||
println('Building without Google Firebase Services')
|
||||
}
|
||||
|
||||
classpath('com.github.triplet.gradle:play-publisher:3.10.1')
|
||||
classpath('com.github.triplet.gradle:play-publisher:3.9.1')
|
||||
classpath('ru.cian:huawei-publish-gradle-plugin:1.4.2')
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ repositories {
|
|||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: 'secure.properties'
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
|
@ -83,12 +84,11 @@ def osName = System.properties['os.name'].toLowerCase()
|
|||
project.ext.appId = 'app.organicmaps'
|
||||
project.ext.appName = 'Organic Maps'
|
||||
|
||||
// I have Java 21 installed, but this doesn't work on MacOS.
|
||||
//java {
|
||||
// toolchain {
|
||||
// languageVersion.set(JavaLanguageVersion.of(17))
|
||||
// }
|
||||
//}
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'app.organicmaps'
|
||||
|
@ -100,7 +100,7 @@ android {
|
|||
// All properties are read from gradle.properties file
|
||||
compileSdk propCompileSdkVersion.toInteger()
|
||||
|
||||
ndkVersion '27.2.12479018'
|
||||
ndkVersion '26.2.11394342'
|
||||
|
||||
defaultConfig {
|
||||
// Default package name is taken from the manifest and should be app.organicmaps
|
||||
|
@ -129,11 +129,6 @@ android {
|
|||
enableVulkanDiagnostics = project.getProperty('enableVulkanDiagnostics')
|
||||
}
|
||||
|
||||
def enableTrace = 'OFF'
|
||||
if (project.hasProperty('enableTrace')) {
|
||||
enableTrace = project.getProperty('enableTrace')
|
||||
}
|
||||
|
||||
cmake {
|
||||
cppFlags '-fexceptions', '-frtti'
|
||||
// There is no sense to enable sections without gcc's --gc-sections flag.
|
||||
|
@ -141,8 +136,7 @@ android {
|
|||
'-Wno-extern-c-compat'
|
||||
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static',
|
||||
"-DOS=$osName", '-DSKIP_TESTS=ON', '-DSKIP_TOOLS=ON', "-DUSE_PCH=$pchFlag",
|
||||
"-DNJOBS=$njobs", "-DENABLE_VULKAN_DIAGNOSTICS=$enableVulkanDiagnostics",
|
||||
"-DENABLE_TRACE=$enableTrace"
|
||||
"-DNJOBS=$njobs", "-DENABLE_VULKAN_DIAGNOSTICS=$enableVulkanDiagnostics"
|
||||
targets 'organicmaps'
|
||||
}
|
||||
}
|
||||
|
@ -246,11 +240,6 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
def securityPropertiesFileExists = file('secure.properties').exists()
|
||||
if (securityPropertiesFileExists) {
|
||||
apply from: 'secure.properties'
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('debug.keystore')
|
||||
|
@ -260,15 +249,10 @@ android {
|
|||
}
|
||||
|
||||
release {
|
||||
if (securityPropertiesFileExists) {
|
||||
println('The release signing keys are available')
|
||||
storeFile file(spropStoreFile)
|
||||
storePassword spropStorePassword
|
||||
keyAlias spropKeyAlias
|
||||
keyPassword spropKeyPassword
|
||||
} else {
|
||||
println('The release signing keys are unavailable')
|
||||
}
|
||||
storeFile file(spropStoreFile)
|
||||
storePassword spropStorePassword
|
||||
keyAlias spropKeyAlias
|
||||
keyPassword spropKeyPassword
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,7 +347,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
|
||||
|
||||
// Google Play Location Services
|
||||
//
|
||||
|
@ -374,17 +358,14 @@ dependencies {
|
|||
// ls -la src/$flavor/java/app/organicmaps/location/GoogleFusedLocationProvider.java
|
||||
// ```
|
||||
//
|
||||
webImplementation 'com.google.android.gms:play-services-location:21.3.0'
|
||||
googleImplementation 'com.google.android.gms:play-services-location:21.3.0'
|
||||
huaweiImplementation 'com.google.android.gms:play-services-location:21.3.0'
|
||||
// This is the microG project's re-implementation which is permissible on
|
||||
// F-droid because it's Apache-2.0.
|
||||
fdroidImplementation 'org.microg.gms:play-services-location:0.3.6.244735'
|
||||
webImplementation 'com.google.android.gms:play-services-location:21.2.0'
|
||||
googleImplementation 'com.google.android.gms:play-services-location:21.2.0'
|
||||
huaweiImplementation 'com.google.android.gms:play-services-location:21.2.0'
|
||||
|
||||
// Google Firebase Services
|
||||
if (googleFirebaseServicesEnabled) {
|
||||
// Import the BoM for the Firebase platform
|
||||
implementation platform('com.google.firebase:firebase-bom:33.5.1')
|
||||
implementation platform('com.google.firebase:firebase-bom:32.8.0')
|
||||
// Add the dependencies for the Crashlytics and Analytics libraries
|
||||
// When using the BoM, you don't specify versions in Firebase library dependencies
|
||||
implementation 'com.google.firebase:firebase-crashlytics'
|
||||
|
@ -395,29 +376,28 @@ dependencies {
|
|||
// > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
|
||||
// We don't use Kotlin, but some dependencies are actively using it.
|
||||
// See https://stackoverflow.com/a/75719642
|
||||
implementation 'androidx.core:core:1.15.0'
|
||||
implementation(platform('org.jetbrains.kotlin:kotlin-bom:2.1.10'))
|
||||
implementation 'androidx.annotation:annotation:1.9.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.car.app:app:1.7.0-rc01'
|
||||
implementation 'androidx.car.app:app-projected:1.7.0-rc01'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||
implementation 'androidx.fragment:fragment:1.8.5'
|
||||
implementation 'androidx.core:core:1.12.0'
|
||||
implementation(platform('org.jetbrains.kotlin:kotlin-bom:1.9.23'))
|
||||
implementation 'androidx.annotation:annotation:1.7.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.car.app:app:1.4.0-rc02'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.fragment:fragment:1.6.2'
|
||||
implementation 'androidx.preference:preference:1.2.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
||||
implementation 'androidx.work:work-runtime:2.10.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-process:2.8.7'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.work:work-runtime:2.9.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-process:2.7.0'
|
||||
implementation 'com.google.android.material:material:1.11.0'
|
||||
// Fix for app/organicmaps/util/FileUploadWorker.java:14: error: cannot access ListenableFuture
|
||||
// https://github.com/organicmaps/organicmaps/issues/6106
|
||||
implementation 'com.google.guava:guava:33.3.0-android'
|
||||
implementation 'com.google.guava:guava:33.1.0-android'
|
||||
implementation 'com.github.devnullorthrow:MPAndroidChart:3.2.0-alpha'
|
||||
implementation 'net.jcip:jcip-annotations:1.0'
|
||||
|
||||
// Test Dependencies
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.mockito:mockito-core:5.15.2'
|
||||
testImplementation 'org.mockito:mockito-core:5.11.0'
|
||||
testImplementation 'org.mockito:mockito-inline:5.2.0'
|
||||
}
|
||||
|
||||
|
@ -462,7 +442,7 @@ task prepareGoogleReleaseListing {
|
|||
|
||||
play {
|
||||
enabled.set(false)
|
||||
track.set('production')
|
||||
track.set('alpha')
|
||||
defaultToAppBundles.set(true)
|
||||
releaseStatus.set(ReleaseStatus.IN_PROGRESS)
|
||||
serviceAccountCredentials.set(file('google-play.json'))
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package app.organicmaps;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest
|
||||
{
|
||||
@Test
|
||||
public void useAppContext()
|
||||
{
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("app.organicmaps", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../../../google/java/app/organicmaps/location
|
|
@ -0,0 +1,18 @@
|
|||
package app.organicmaps.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class LocationProviderFactory
|
||||
{
|
||||
public static boolean isGoogleLocationAvailable(@NonNull @SuppressWarnings("unused") Context context)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static BaseLocationProvider getProvider(@NonNull Context context, @NonNull BaseLocationProvider.Listener listener)
|
||||
{
|
||||
return new AndroidNativeProvider(context, listener);
|
||||
}
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• Новыя дадзеныя OpenStreetMap ад 27 лютага
|
||||
• Магчымасць уручную расстаўляць прамежкавыя кропкі маршруту
|
||||
• Экспарт аднаго абранага трэка са спісу
|
||||
• Палепшаная маршрутызацыя для веласіпедыстаў
|
||||
• Дададзена сістэмнае апавяшчэнне пры загрузцы карт, фонавыя загрузкі больш не перарываюцца
|
||||
• Дададзены мігатлівы віджэт запісу трэка
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…і шматлікае іншае на omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• Neue OpenStreetMap-Daten vom 27. Februar
|
||||
• Möglichkeit, Zwischenroutenpunkte manuell zu arrangieren
|
||||
• Einen einzelnen ausgewählten Track aus der Liste teilen
|
||||
• Verbesserte Routenführung für Fahrräder
|
||||
• Beim Herunterladen von Karten eine Systembenachrichtigung anzeigen und Hintergrunddownloads nicht unterbrechen
|
||||
• Ein blinkendes Trackaufzeichnungs-Widget hinzugefügt
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…weitere Details unter omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
Before Width: | Height: | Size: 747 KiB After Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 749 KiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 730 KiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 590 KiB After Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 970 KiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 1.4 MiB |
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a Track Recording indicator on the main screen
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
• New OpenStreetMap data as of February 27
|
||||
• Ability to manually arrange intermediate route points
|
||||
• Share a single selected track from the list
|
||||
• Improved routing for bicycles
|
||||
• Display a system notification when downloading maps and don't interrupt background downloads
|
||||
• Added a flashing Track Recording widget
|
||||
• OpenStreetMap login works again!
|
||||
• Better isolines elevation data for European countries
|
||||
• OpenStreetMap data as of March 26
|
||||
• Bookmark lists are sorted by modification time (recent at the top)
|
||||
• Eye icons for visible/hidden bookmark lists
|
||||
• Fixed crash when importing GPX, KML, KMZ from the Files app
|
||||
• Bigger "View search results on the map" button
|
||||
• FreeDrive mode and faster bookmarks in Android Auto
|
||||
|
||||
…more details at omaps.org/news
|
||||
…read more details at omaps.org/news
|
||||
|
|
Before Width: | Height: | Size: 737 KiB |
Before Width: | Height: | Size: 765 KiB |
Before Width: | Height: | Size: 735 KiB |