Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize LoginWidget #11

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .appveyor.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120

# C# Files
[*.cs]
csharp_align_multiline_parameter = true
csharp_align_multiline_extends_list = true
csharp_align_linq_query = true
csharp_place_attribute_on_same_line = false
csharp_empty_block_style = together

# Solution Files
[*.sln]
Expand All @@ -27,3 +36,4 @@ indent_size = 2
# Markdown Files
[*.md]
trim_trailing_whitespace = false
indent_size = 2
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: "develop"

- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
target-branch: "develop"
ignore:
- dependency-name: "Microsoft.*"
update-types: ["version-update:semver-major"]
112 changes: 112 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Run CI

on:
push:
branches-ignore: [ "master" ]
pull_request:
branches-ignore: [ "master" ]

env:
versionPrefix: 2.0.0
versionSuffix: 'preview.1'
buildConfiguration: Release
netSdkVersion: 7.0.x
ciVersionSuffix: ci.$GITHUB_RUN_ID+git.commit.$GITHUB_SHA
projectPath: src/Telegram.Bot.Extensions.LoginWidget/Telegram.Bot.Extensions.LoginWidget.csproj
testsProject: test/Telegram.Bot.Extensions.LoginWidget.Tests.Unit/Telegram.Bot.Extensions.LoginWidget.Tests.Unit.csproj

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Set env
run: |
echo "isPreRelease=${{ env.versionSuffix != '' }}" >> $GITHUB_ENV
if [ isPreRelease ]; then
echo "releaseVersion='${{ env.versionPrefix }}-${{ env.versionSuffix }}'" >> $GITHUB_ENV
else
echo "releaseVersion='${{ env.versionPrefix }}'" >> $GITHUB_ENV
fi
if [ isPreRelease ]; then
echo "ciVersion='${{ env.versionPrefix }}-${{ env.versionSuffix }}.${{ env.ciVersionSuffix }}'" >> $GITHUB_ENV
else
echo "ciVersion='${{ env.versionPrefix }}-${{ env.ciVersionSuffix }}'" >> $GITHUB_ENV
fi

- name: Test env
run: |
echo "versionPrefix: ${{ env.versionPrefix }}"
echo "versionSuffix: ${{ env.versionSuffix }}"
echo "ciVersionSuffix: ${{ env.ciVersionSuffix }}"
echo "isPreRelease: ${{ env.isPreRelease }}"
echo "releaseVersion: ${{ env.releaseVersion }}"
echo "ciVersion: ${{ env.ciVersion }}"
echo "buildConfiguration: ${{ env.buildConfiguration }}"
echo "projectPath: ${{ env.projectPath }}"
echo "testsProject: ${{ env.testsProject }}"

- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.netSdkVersion }}

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget

- name: Restore dependencies
run: dotnet restore

- name: Build
run: |
dotnet build \
--no-restore \
--configuration ${{ env.buildConfiguration }} \
-p:Version=${{ env.ciVersion }} \
-p:CI_EMBED_SYMBOLS=true \
${{ env.projectPath }}

- name: Test
run: |
dotnet test \
--no-restore \
--verbosity normal \
--configuration ${{ env.buildConfiguration }} \
--logger "trx;LogFileName=testresults.trx" \
${{ env.testsProject }}

- name: Add GitHub Repo
run: |
dotnet nuget add source \
--username USERNAME \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--name github "https://nuget.pkg.github.com/karb0f0s/index.json"

- name: Pack nuget
run: |
dotnet pack \
--no-build \
--output "packages/" \
--configuration ${{ env.buildConfiguration }} \
-p:Version=${{ env.ciVersion }} \
-p:CI_EMBED_SYMBOLS=true \
${{ env.projectPath }}

- name: Pack nuget
run: |
dotnet nuget push \
packages/*.nupkg \
--api-key ${{ secrets.PUBLISH_TOKEN }} \
--source "github"
70 changes: 12 additions & 58 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# MSTest test Results
[Tt]est[Rr]esult*/
Expand All @@ -42,7 +40,6 @@ dlldata.c

# DNX
project.lock.json
project.fragment.lock.json
artifacts/

*_i.c
Expand Down Expand Up @@ -77,18 +74,14 @@ _Chutzpah*
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap

# TFS 2012 Local Workspace
$tf/
Expand All @@ -113,7 +106,6 @@ _TeamCity*
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

# MightyMoose
*.mm.*
Expand Down Expand Up @@ -143,14 +135,9 @@ publish/
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.pubxml
*.publishproj

# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
Expand All @@ -159,23 +146,13 @@ PublishScripts/
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets

# Microsoft Azure Build Output
# Windows Azure Build Output
csx/
*.build.csdef

# Microsoft Azure Emulator
ecf/
rcf/

# Windows Store app package directories and files
# Windows Store app package directory
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt

# Visual Studio cache files
# files ending in .cache can be ignored
Expand All @@ -185,19 +162,16 @@ _pkginfo.txt

# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
.DS_Store

# RIA/Silverlight projects
Generated_Code/
Expand All @@ -222,9 +196,6 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/

# GhostDoc plugin setting file
*.GhostDoc.xml

# Node.js Tools for Visual Studio
.ntvs_analysis.dat

Expand All @@ -234,28 +205,11 @@ FakesAssemblies/
# Visual Studio 6 workspace options file
*.opt

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml
# Settings for different environments
appsettings.*.json

# CodeRush
.cr/
# Documentation project
src/Telegram.Bot.Documentation/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Rider IDE
.idea
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Telegram bots Login Widget

[![Build Status](https://travis-ci.org/MihaZupan/Telegram.Bot.Extensions.LoginWidget.svg?branch=master)](https://travis-ci.org/MihaZupan/Telegram.Bot.Extensions.LoginWidget)
[![Build status](https://ci.appveyor.com/api/projects/status/720b19vgdhro14o5/branch/master?svg=true)](https://ci.appveyor.com/project/MihaZupan/telegram-bot-extensions-loginwidget/branch/master)
![Build Status](https://github.com/karb0f0s/Telegram.Bot.Extensions.LoginWidget/actions/workflows/ci.yml/badge.svg)


Makes it simple to validate login widget authorization hashes

Built according to specifications published on [Telegram's website](https://core.telegram.org/widgets/login)

## Usage

```c#
// Parsed from the query string / from the callback object
Dictionary<string, string> fields = QueryStringFields;
Expand Down
6 changes: 2 additions & 4 deletions Telegram.Bot.Extensions.LoginWidget.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2043
# Visual Studio Version 17
VisualStudioVersion = 17.5.33209.295
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Telegram.Bot.Extensions.LoginWidget", "src\Telegram.Bot.Extensions.LoginWidget\Telegram.Bot.Extensions.LoginWidget.csproj", "{8B0BB536-17B1-43F1-A8B6-123100B8835E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{81E021D2-D465-454A-AA5A-DA4023606926}"
ProjectSection(SolutionItems) = preProject
.appveyor.yml = .appveyor.yml
.editorconfig = .editorconfig
.travis.yml = .travis.yml
CHANGELOG.md = CHANGELOG.md
README.md = README.md
EndProjectSection
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"rollForward": "latestFeature"
}
}
Binary file added package-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading