npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-telegram-login

v1.1.0

Published

Base on [vue-telegram-login](https://github.com/vchaptsev/vue-telegram-login), thanks [@vchaptsev](https://github.com/vchaptsev)

Downloads

1,341

Readme

Vue3 Telegram Login

Base on vue-telegram-login, thanks @vchaptsev

Installation

Install with pnpm:

$ pnpm add vue3-telegram-login

Install with npm:

$ npm i vue3-telegram-login --save

Usage

Import telegram-login-temp, pass it to the components and use in your template

<template>
  <!-- Callback mode -->
  <span v-if="!isLoaded">Loading...</span>
  <telegram-login-temp
    mode="callback"
    telegram-login="YourTelegramBot"
    @loaded='telegramLoadedCallbackFunc'
    @callback="yourCallbackFunction"
  />

  <!-- Redirect mode -->
  <telegram-login-temp
    mode="redirect"
    telegram-login="YourTelegramBot"
    @loaded='telegramLoadedCallbackFunc'
    redirect-url="https://your-website.io"
  />
</template>

<script setup>
import { telegramLoginTemp } from 'vue3-telegram-login'
import { ref } from 'vue'

const isLoaded = ref(false)

function telegramLoadedCallbackFunc () {
  console.log('script is loaded')
  isLoaded.value = true
}

function yourCallbackFunction (user) {
  // gets user as an input
  // id, first_name, last_name, username,
  // photo_url, auth_date and hash
  console.log(user)
}
</script>

Props

You can play around with options on the official widget page

| Name | Description | Required | Default | | ------------- | ----------------------------------------------------------------------------- | -------- | ----------- | | mode | 'callback' or 'redirect' | True | null | | telegramLogin | Your telegram bot name | True | null | | @callback | Your callback function, it will be called after success if mode is 'callback' | False | true | | @loaded | Telegram script loaded callback function | False | null | | redirectUrl | Your redirect URL, user will be redirected if mode is 'redirect' | False | null | | requestAccess | 'write' if you want to get access to send messages from your bot | False | 'read' | | size | 'large', 'medium' or 'small' | False | 'large' | | userpic | Show user photo, true or false | False | true | | radius | Button corner radius (default depends on chosen size) | False | 20\14\10 |

Notes

  1. You need to set domain to your bot if you want to user Telagram Login (/setdomain command to @BotFather)
  2. You need to verify the authentication and the integrity of the data received by comparing the received hash parameter with the hexadecimal representation of the HMAC-SHA-256 signature of the data-check-string with the SHA256 hash of the bot's token used as a secret key (source). You can find some code samples on this page.
  3. Don't disable third party cookies if you want to use Telegram Login as a User (thanks @robverhoef)