Skip to content
This repository has been archived by the owner on Jun 24, 2018. It is now read-only.

Commit

Permalink
deployment
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.osteele.com/home/osteele/svn/projects/cloud@24 e7b8d44c-8308-0410-acfb-b763ae30a170
  • Loading branch information
osteele committed Dec 31, 2005
1 parent 6c9bae2 commit a565dd3
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 41 deletions.
25 changes: 18 additions & 7 deletions Rakefile
@@ -1,15 +1,26 @@
require 'rake/clean'
require 'ows_tasks'
require 'laszlo'
#require 'laszlo_tasks'

file 'cloud.lzx.swf' => ['cloud.lzx', 'analyzer.js'] do |t|
task :default => :upload
CLEAN.include '*.lzx.swf'
CLEAN.include 'index.html'
UPLOADS = %w{cloud.swf index.html proxy.php}

file 'cloud.swf' => ['cloud.lzx', 'analyzer.js'] do |t|
puts "Compiling #{t.prerequisites.first} => #{t.name}"
Laszlo::compile t.prerequisites.first, :output => t.name
end

file 'index.html' => 'cloud.lzx' do |t|
Laszlo::make_html t.prerequisites.first, :output => t.name
task :proxy do
sync 'proxy.php', File.expand_path('~/Sites/proxy.php')
end

task :upload => ['cloud.lzx.swf', 'index.html'] do
`scp cloud.lzx.swf index.html osteele@osteele.com:osteele.com/projects/cloud-visualizer`
task :deploy do
onserver = "osteele@osteele.com:expialidocio.us"
UPLOADS.each do |f|
puts "Uploading #{f}"
`rsync -avz -e ssh "#{f}" "#{onserver}"`
end
end

task :default => :upload
24 changes: 12 additions & 12 deletions cloud.lzx
@@ -1,7 +1,4 @@
<!--
Must:
- test with live feed

Publish:
- http://weblog.infoworld.com/udell/2005/12/20.html#a1357
- wiki page
Expand Down Expand Up @@ -42,19 +39,19 @@ Visuals:

<script>
function requestPosts() {
if (source == 'local')
ds.setSrc('http://localhost/proxy.php');
else if (source == 'server') {
ds.setSrc('http://expialidocio.us/proxy.php');
ds.setSrc('http://osteele.com/cloud/proxy.php');
if (source == 'staging')
url = 'http://localhost/proxy.php';
else if (source == 'proxy') {
url = 'http:proxy.php';
} else if (source) {
ds.setSrc('http:tests/' + source + '.xml');
url = 'http:tests/' + source + '.xml';
}
Debug.write(url);
ds.setSrc(url);
//credits.setAttribute('state', 'retrieving');
ds.doRequest();
}
//var account = 'osteele';
//var password = 'passwd';
//ds.setHeader('authorization', 'Basic ' + base64(account + ':' + password));
//ds.setHeader('authorization', 'Basic ' + base64(account+':'+password));
if (_root['source'] == undefined) source = 'posts';
requestPosts(source);
</script>
Expand Down Expand Up @@ -260,8 +257,11 @@ Visuals:
</view>

<view x="25%" width="50%" y="${credits.height}" fontsize="24">

<text visible="${credits.state=='initial'}" width="100%" align="center" valign="middle" multiline="true">This page will display an interactive summary of your <a href="http://del.icio.us" target="_blank"><u><font color="#0000ff">de.licio.us activity</font></u></a>. In order to retrieve this information, your browser will ask you for your de.licio.us name and password. This information is only stored in your browser.</text>

<text visible="${credits.state=='retrieving'}" width="100%" align="center" valign="middle" multiline="true">Retrieving data...</text>

<text visible="${credits.state=='empty'}" width="100%" align="center" valign="middle" multiline="true"><a href="http://del.icio.us"><u><font color="#0000ff">de.licio.us</font></u></a> doesn't show any posts tagged with your account. This could be because you haven't tagged any pages, in which case you should tag some and then come back here. Or it could be because the del.icio.us server is responding null.</text>
</view>

Expand Down
27 changes: 27 additions & 0 deletions index.html
@@ -0,0 +1,27 @@

<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<link rel="SHORTCUT ICON" href="http://www.laszlosystems.com/favicon.ico">
<title>expialidocio.us</title><style type="text/css">
html, body { margin: 0; padding: 0; height: 100%; }
body { background-color: #ffffff; }
</style></head>
<body><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0"
data="cloud.swf?source=proxy&amp;lzproxied=false" width="100%" height="100%">
<param name="movie" value="cloud.swf?source=proxy&amp;lzproxied=false">
<param name="quality" value="high">
<param name="scale" value="noscale">
<param name="salign" value="LT">
<param name="menu" value="false">
<param name="bgcolor" value="#ffffff">
<embed src="cloud.swf?source=proxy&amp;lzproxied=false" quality="high"
scale="noscale" salign="lt" width="100%" height="100%" bgcolor="#ffffff"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object></body>
</html>
66 changes: 44 additions & 22 deletions proxy.php
@@ -1,30 +1,52 @@
<?php
//die('user='.$_SERVER['PHP_AUTH_USER']);
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
header('WWW-Authenticate: Basic realm="del.iciou.us account info"');
header('HTTP/1.0 401 Unauthorized');
echo '<cancel/>';
exit;
} else {
$timefile='time.txt';
$lockfile='lock.txt';
clearstatcache();

$fp=fopen($lockfile,'w');
flock($fp, LOCK_EX);
$fm = filemtime($timefile);
$next_access_time = $fm + 1;
$delay = $next_access_time - time();
//if ($delay > 0) sleep($delay);

$fp2 = fopen($timefile, 'w');
fwrite($fp2, "$next_access_time\n");
fclose($fp2);

flock($fp, LOCK_UN);
fclose($fp);

$user = $_SERVER['PHP_AUTH_USER'];
$passwd = $_SERVER['PHP_AUTH_PW'];
if ($user == 'ows') $user = 'osteele';
$user = 'osteele';
$passwd = 'pa55wdde';
//if ($passwd == 'passwd') $passwd = 'pa55wdde';
$url = "http://".$user.":".$passwd."@del.icio.us/api/posts/all";
$file = @fopen($url, "r");
//$file = fsockopen("www.example.com", 80, $errno, $errstr, 30);
//die('err '.$errno.', '.$errstr);
//$url = "http://".$user.":".$passwd."@del.icio.us/api/posts/all";
$url = "http://del.icio.us/api/posts/all";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, 'expialidocio.us');
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$passwd);
curl_exec($ch);
curl_close($ch);
exit;
//curl_errno and curl_error
// int: CURLOPT_CONNECTTIMEOUT CURLOPT_HTTPAUTH=CURLAUTH_BASIC CURLOPT_MAXREDIRS
// bool: CURLOPT_FAILONERROR CURLOPT_FOLLOWLOCATION CURLOPT_HEADER CURLOPT_RETURNTRANSFER
// string: CURLOPT_REFERER
// array: CURLOPT_HTTPHEADER
//_error
//_setopt

if (!$file) {
die('no file');
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo "del.icio.us didn't like that username and password.";
}
//die($http_response_header);
header("Content-type: application/xml");
while (!feof($file)) {
$line = fgets($file, 1024);
echo $line;
}
fclose($file);
}
// $http_response_header or stream_get_meta_data()
?>
?>

0 comments on commit a565dd3

Please sign in to comment.