mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-07-12 00:16:26 +02:00
LastenradBayern text
This commit is contained in:
parent
d1badd0dca
commit
98e098caae
6 changed files with 18 additions and 289 deletions
|
@ -1,273 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
||||
#
|
||||
use lib "/var/www/copri-bike/shareeapp-primary/src";
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use CGI ':standard';
|
||||
use CGI::Carp qw(fatalsToBrowser);
|
||||
use CGI::Cookie ();
|
||||
use DBI;
|
||||
use Lib::Config;
|
||||
use Mod::DBtank;
|
||||
|
||||
my $q = new CGI();
|
||||
$q->import_names('R');
|
||||
my $cf = new Config;
|
||||
my $dbt = new DBtank;
|
||||
my %varenv = $cf->envonline();
|
||||
|
||||
my $coo = $q->cookie('domcookie') || $q->param('sessionid') || "";
|
||||
|
||||
if($q->param('sessionid') && $q->param('sessionid') ne $q->cookie('domcookie')){
|
||||
$coo = $q->param('sessionid');
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"utf-8", -cookie=>$cookie);
|
||||
}else{
|
||||
my $cookie = CGI::Cookie->new(-name => 'domcookie',-value => $coo);
|
||||
print $q->header(-charset=>"utf-8", -cookie=>$cookie);
|
||||
}
|
||||
die "no configuration available" if(!$varenv{wwwhost});
|
||||
|
||||
my $operator_key = $q->param('api_test');
|
||||
my $bike = $q->param('bike');
|
||||
#$bike = "FR4781";
|
||||
#$bike = "FR1002";
|
||||
|
||||
my $lang = "de";
|
||||
my $dyn_js = "";
|
||||
#my $dyn_js = "
|
||||
#function onLoad() {
|
||||
# console.log('hallo');
|
||||
#
|
||||
# if ('geolocation' in navigator) {
|
||||
# console.log('geon');
|
||||
# /* geolocation funktioniert */
|
||||
# } else {
|
||||
# console.log('geoff');
|
||||
# /* geolocation funktioniert NICHT */
|
||||
# }
|
||||
# \$( '#no_javascript' ).hide();
|
||||
# }
|
||||
# \n";
|
||||
|
||||
my $dyn_css = "";
|
||||
my $local_style = "$varenv{metahost}/$dbt->{shareeapp_conf}->{local_style}";
|
||||
my $jquery = "$varenv{metahost}/$dbt->{shareeapp_conf}->{jquery}";
|
||||
my $js_bootstrap = "$varenv{metahost}/$dbt->{shareeapp_conf}->{js_bootstrap}";
|
||||
my $style_bootstrap = "$varenv{metahost}/$dbt->{shareeapp_conf}->{style_bootstrap}";
|
||||
if($varenv{wwwhost} =~ /shareedms/){
|
||||
$local_style = "$varenv{metahost}/$dbt->{shareedms_conf}->{local_style}";
|
||||
$jquery = "$varenv{metahost}/$dbt->{shareedms_conf}->{jquery}";
|
||||
$js_bootstrap = "$varenv{metahost}/$dbt->{shareedms_conf}->{js_bootstrap}";
|
||||
$style_bootstrap = "$varenv{metahost}/$dbt->{shareedms_conf}->{style_bootstrap}";
|
||||
}
|
||||
|
||||
|
||||
my $html5 = $q->start_html(
|
||||
-title => "shareetest",
|
||||
-lang => '',
|
||||
#-onload => "onLoad();",
|
||||
-encoding => "utf-8",
|
||||
-base => 'true',
|
||||
-head => Link(
|
||||
{
|
||||
-rel => 'shortcut icon',
|
||||
-type => 'image/x-icon',
|
||||
-href => "/css/favicon.ico"
|
||||
}
|
||||
),
|
||||
-meta => {
|
||||
'viewport'=>"width=device-width,initial-scale=1,user-scalable=yes",
|
||||
'author' => "rainer guempelein",
|
||||
'publisher' => "",
|
||||
'copyright' => "",
|
||||
},
|
||||
-script=>[
|
||||
#{-language=>'JAVASCRIPT',
|
||||
#-src=>"$jquery"},
|
||||
#{-language=>'JAVASCRIPT',
|
||||
#-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_ui}"},
|
||||
#{-language=>'JAVASCRIPT',
|
||||
#-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jquery_resize}"},
|
||||
#{-language=>'JAVASCRIPT',
|
||||
#-src=>"$varenv{metahost}/$dbt->{copri_conf}->{jsscript}"},
|
||||
#{-language=>'JAVASCRIPT',
|
||||
#-src=>"https://unpkg.com/leaflet\@1.8.0/dist/leaflet.js"},
|
||||
{-language=>'JAVASCRIPT',
|
||||
-code=>"$dyn_js"}
|
||||
],
|
||||
-STYLE=>{
|
||||
-code=>"$dyn_css",
|
||||
#-src=>[
|
||||
#"$local_style",
|
||||
#"$style_bootstrap",
|
||||
#"$varenv{metahost}/$dbt->{copri_conf}->{style_bootstrap_icons}",
|
||||
#"$varenv{metahost}/$dbt->{copri_conf}->{style_jquery_ui}"
|
||||
#"https://unpkg.com/leaflet\@1.8.0/dist/leaflet.css"
|
||||
#],
|
||||
-verbatim=>"\@import url(\"$local_style\");",
|
||||
-media=>'screen'
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
$html5 =~ s{<!DOCTYPE.*?>}{<!DOCTYPE html>}s;
|
||||
$html5 =~ s{<html.*?>}{<html lang='de'>}s;
|
||||
print $html5;
|
||||
|
||||
##
|
||||
my $uri = "$dbt->{primary}->{sharee_primary}->{primaryApp}/APIjsonserver";
|
||||
#print $q->div({-style=>'margin:15px;'},$q->a({-href=>"/src/scripts/tests/index.pl"},"[ index ]")),"\n";
|
||||
print $q->div({-style=>'margin:15px;'},"sharee API tests", $q->b("operator_key: $operator_key | bike: $bike")),"\n";
|
||||
|
||||
print<<EOF
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet\@1.8.0/dist/leaflet.css"
|
||||
integrity="sha512-hoalWLoI8r4UszCkZ5kL8vayOGVae1oxXe/2A4AO6J9+580uKHDO3JdHb7NzwwzK5xr/Fs0W40kiNHxM9vyTtQ=="
|
||||
crossorigin=""/>
|
||||
|
||||
<script src="https://unpkg.com/leaflet\@1.8.0/dist/leaflet.js"
|
||||
integrity="sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ=="
|
||||
crossorigin=""></script>
|
||||
|
||||
<style>
|
||||
#map {
|
||||
height: 500px;
|
||||
width: 750px;
|
||||
}
|
||||
</style>
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
print "<div id='map'></div>\n";
|
||||
|
||||
print<<EOF
|
||||
|
||||
<script>
|
||||
var map = L.map('map').setView([47.976634, 7.825490], 13);
|
||||
|
||||
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoic2hhcmVlYmlrZSIsImEiOiJjbDM3bXdreHIwMnZxM2NtbjVkc2pwNWp4In0.QAwnPXx4yZsbPSm2DvP62w', {
|
||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
||||
maxZoom: 18,
|
||||
id: 'mapbox/streets-v11',
|
||||
tileSize: 512,
|
||||
zoomOffset: -1,
|
||||
accessToken: 'your.mapbox.access.token'
|
||||
}).addTo(map);
|
||||
|
||||
</script>
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
print $q->div({-style=>'margin:15px;'},"-------------- $uri --------------------"),"\n";
|
||||
my $authorization = "$uri?request=authorization&user_id=ragu\@sharee.bike&user_pw=xxxxxx&merchant_id=oiF2kahH&hw_id=g89g8o7goguzuzug";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$authorization"},"[ authorization ]---> $authorization")),"\n";
|
||||
|
||||
my $authout = "$uri?request=authout&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$authout"},"[ authout ]---> $authout")),"\n";
|
||||
|
||||
my $bikes_all = "$uri?request=bikes_all&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$bikes_all"},"[ bikes_all ]---> $bikes_all")),"\n";
|
||||
|
||||
my $bikes_available = "$uri?request=bikes_available&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$bikes_available"},"[ bikes_available ]---> $bikes_available")),"\n";
|
||||
|
||||
my $stations_all = "$uri?request=stations_all&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$stations_all"},"[ stations_all ]---> $stations_all")),"\n";
|
||||
|
||||
my $stations_available = "$uri?request=stations_available&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$stations_available"},"[ stations_available ]---> $stations_available")),"\n";
|
||||
|
||||
my $user_bikes_occupied = "$uri?request=user_bikes_occupied&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_bikes_occupied"},"[ user_bikes_occupied ]---> $user_bikes_occupied")),"\n";
|
||||
|
||||
my $user_minianswer = "$uri?request=user_minianswer&q1=opt5&q2=opt4&q3=iuwehfiolbev&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_minianswer"},"[ user_minianswer ]---> $user_minianswer")),"\n";
|
||||
|
||||
|
||||
###
|
||||
print $q->div({-style=>'margin:15px;'}," "),"\n";
|
||||
#config
|
||||
my $uriop = "$dbt->{operator}->{$operator_key}->{operatorApp}/APIjsonserver";
|
||||
|
||||
#my $bike = "FR1003";
|
||||
my $latitude = "47.927738";
|
||||
my $longitude = "7.973855";
|
||||
#not used
|
||||
my $and_station_state_locking = "";
|
||||
my $and_station_state_locked = "";
|
||||
my $and_station_state_unlocked = "";
|
||||
|
||||
#system=sigo
|
||||
if($operator_key eq "sharee_sx"){
|
||||
$latitude = "";
|
||||
$longitude = "";
|
||||
#$and_station_state_locking = "&station_state=locking";
|
||||
#$and_station_state_locked = "&station_state=locked";
|
||||
#$and_station_state_unlocked = "&station_state=unlocked";
|
||||
}
|
||||
|
||||
if($operator_key eq "sharee_kn"){
|
||||
$latitude = "47.66267";
|
||||
$longitude = "9.17262";
|
||||
}
|
||||
if($operator_key eq "sharee_wue"){
|
||||
$latitude = "47.997930";
|
||||
$longitude = "7.785428";
|
||||
}
|
||||
if($operator_key eq "sharee_ren"){
|
||||
$latitude = "48.8975726";
|
||||
$longitude = "11.170959";
|
||||
}
|
||||
|
||||
print $q->div({-style=>'margin:15px;'},"-------------- $uriop --------------------"),"\n";
|
||||
my $booking_request = "$uriop?request=booking_request&bike=$bike&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request"},"[ booking_request ]---> $booking_request")),"\n";
|
||||
|
||||
my $booking_update_cancel = "$uriop?request=booking_update&bike=$bike&state=canceled&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_cancel"},"[ booking_update_cancel ]---> $booking_update_cancel")),"\n";
|
||||
|
||||
my $booking_update_locking = "$uriop?request=booking_update&bike=$bike&lock_state=locking$and_station_state_locking&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locking"},"[ booking_update_locking ]---> $booking_update_locking")),"\n";
|
||||
|
||||
my $booking_update_locked = "$uriop?request=booking_update&bike=$bike&lock_state=locked$and_station_state_locked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_locked"},"[ booking_update_locked ]---> $booking_update_locked")),"\n";
|
||||
|
||||
my $booking_update_occupied_unlocking = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocking$and_station_state_unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_occupied_unlocking"},"[ booking_update_occupied_unlocking ]---> $booking_update_occupied_unlocking")),"\n";
|
||||
|
||||
my $booking_update_unlocked = "$uriop?request=booking_update&bike=$bike&lock_state=unlocked$and_station_state_unlocked&voltage=39&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_unlocked"},"[ booking_update_unlocked ]---> $booking_update_unlocked")),"\n";
|
||||
|
||||
my $booking_update_occupied_unlocked = "$uriop?request=booking_update&bike=$bike&state=occupied&lock_state=unlocked$and_station_state_unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_occupied_unlocked"},"[ booking_update_occupied_unlocked ]---> $booking_update_occupied_unlocked")),"\n";
|
||||
|
||||
my $booking_request_oc_uling = "$uriop?request=booking_request&bike=$bike&state=occupied&lock_state=unlocking$and_station_state_unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request_oc_uling"},"[ booking_request_oc_unlocking ]---> $booking_request_oc_uling")),"\n";
|
||||
|
||||
my $booking_request_oc_ul = "$uriop?request=booking_request&bike=$bike&state=occupied&lock_state=unlocked$and_station_state_unlocked&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_request_oc_ul"},"[ booking_request_oc_unlocked ]---> $booking_request_oc_ul")),"\n";
|
||||
|
||||
my $booking_update_av_lo = "$uriop?request=booking_update&bike=$bike&state=available&lock_state=locked$and_station_state_locked&latitude=$latitude&longitude=$longitude&gps_age=300&user_device_manufaturer=samsung)&user_device_model=SM-G398FN&user_device_platform=Android&user_device_version=10&user_device_id=90af86831c10374d&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_av_lo"},"[ booking_update_av_lo ]---> $booking_update_av_lo")),"\n";
|
||||
|
||||
my $booking_update_av_lo_nogps = "$uriop?request=booking_update&bike=$bike&state=available&lock_state=locked$and_station_state_locked&user_device_manufaturer=samsung)&user_device_model=SM-G398FN&user_device_platform=Android&user_device_version=10&user_device_id=90af86831c10374d&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$booking_update_av_lo_nogps"},"[ booking_update_av_lo_nogps ]---> $booking_update_av_lo_nogps")),"\n";
|
||||
|
||||
my $user_feedback = "$uriop?request=user_feedback&bike=$bike&bike_broken=1&message=testnachricht äöü&authcookie=$coo";
|
||||
print $q->div({-style=>'margin:15px;'},$q->a({-target=>'_blank', -href=>"$user_feedback"},"[ user_feedback ]---> $user_feedback")),"\n";
|
||||
|
||||
#print "<div style='text-align:center;'>";
|
||||
#print "<iframe width='750' height='500' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://www.openstreetmap.org/export/embed.html?bbox=7.604942321777345%2C47.923934784536236%2C7.979164123535157%2C48.07005002188767&layer=mapnik' style='border: 1px solid black'></iframe><br/><small><a href='https://www.openstreetmap.org/#map=12/47.9970/7.7921'>Größere Karte anzeigen</a></small>\n";
|
||||
#print "</div>\n";
|
||||
|
||||
print $q->end_html;
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue