This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liff.getProfile().then(function (profile) { | |
liff.sendMessages([ | |
{ | |
type: 'image', | |
originalContentUrl: 'https://' + document.domain + '/imgs/' + res + '.jpg', | |
previewImageUrl: 'https://' + document.domain + '/imgs/' + res + '_240.jpg' | |
}, | |
{ | |
type: 'text', | |
text: 'From:' + profile.displayName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://d.line-scdn.net/liff/1.0/sdk.js" /></script> | |
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.min.js"></script> | |
<script> | |
const canvas = document.querySelector('#canvas'); | |
const signaturePad = new SignaturePad(canvas, { | |
backgroundColor: 'rgb(238,238,238)', | |
}); | |
$(window).on('load', function(){ | |
canvas.setAttribute('width', $('.container').width()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, render_template, make_response | |
from flask_bootstrap import Bootstrap | |
import os | |
import uuid | |
import base64 | |
from PIL import Image | |
import warnings | |
warnings.simplefilter('error', Image.DecompressionBombWarning) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "b1fd7946.f6a0c8", | |
"type": "http in", | |
"z": "9295d104.785ef", | |
"name": "", | |
"url": "/playground/api", | |
"method": "post", | |
"upload": false, | |
"swaggerDoc": "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>My LIFF App</title> | |
</head> | |
<body> | |
<p id="scanCode"></p> | |
<p> | |
<button id="btnScanCode" onclick="scanCode();">Scan Code</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.LineWebhook = functions.region(REGION).runWith(runtimeOpts).https.onRequest(async (req, res) => { | |
let event = req.body.events[0]; | |
if (event.message.type === 'text') { | |
let input = event.message.text; | |
await admin.firestore().collection('translations').doc('inputText').set({ | |
input: input | |
}).then(function () { | |
console.log("Document successfully written!"); | |
}).catch(function (error) { | |
console.error("Error writing document: ", error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.LineBotPush = functions.region(REGION).runWith(runtimeOpts).firestore.document('translations/inputText').onWrite(async (change, context) => { | |
let latest = change.after.data(); | |
let input = latest.input; | |
let containsJapanese = input.match(/[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]/); | |
if (containsJapanese) { | |
push(GROUP_ID, latest.translated.th); | |
} else { | |
push(GROUP_ID, latest.translated.ja); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require("firebase-functions"); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
const request = require("request-promise"); | |
const crypto = require('crypto'); | |
const runtimeOpts = { timeoutSeconds: 4, memory: "2GB" }; | |
const REGION = "asia-northeast1"; | |
const LINE_MESSAGING_API = "https://api.line.me/v2/bot/message"; | |
const LINE_CHANNEL_SECRET = "Your-Channel-Secret"; | |
const GROUP_ID = "Caf6..."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -X POST https://api.line.me/v2/bot/audienceGroup/upload \ | |
-H 'Authorization: Bearer {channel access token}' \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"description": "regularCustomerGroup", | |
"isIfaAudience": "false", | |
"audiences":[ | |
{ | |
"id":"Uc0a294155281..." | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -X POST https://api.line.me/v2/bot/audienceGroup/click \ | |
-H 'Authorization: Bearer {channel access token}' \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"description": "podcastEP1click", | |
"requestId": "eec21aab-5747-41fe-95bc-ff7...", | |
"clickUrl": "https://open.spotify.com/episode/1NIfGNFe2DvymxTx5nofnA" | |
}' |
OlderNewer