Permalink
Browse files

Initial import

  • Loading branch information...
0 parents commit e0eeb8957c20c650cd3aef4b565fd338a4b6dd80 @marcusramberg committed Jan 19, 2009
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>app</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>App</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>fold</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <true/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>Binary</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeName</key>
+ <string>File</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>file</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>Binary</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>iusethis Profile Maker</string>
+ <key>CFBundleIconFile</key>
+ <string>Icon.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.iusethis.profilemaker</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>iusethis Profile Maker</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0 (v5M)</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
@@ -0,0 +1 @@
+pp -M PerlIO -M DateTime::Locale::en_US -o "iusethis Profile Maker" "iusethis Profile Maker.pl"
Binary file not shown.
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use XML::TreePP;
+use MIME::Base64;
+use Data::Plist::BinaryReader;
+my $reader=Data::Plist::BinaryReader->new();
+my $backupdir=$ENV{HOME}."/Library/Application Support/MobileSync/Backup/";
+opendir(DIR,$backupdir)|| terminate( "Could not open Backup dir: ".$@);
+my $ts=0;
+my $newest;
+foreach (readdir(DIR)) {
+ next if m/^\./;
+ if((stat($backupdir.$_))[9]>$ts) {
+ $newest=$_;
+ $ts=(stat($backupdir.$_))[9];
+ }
+}
+terminate( "Could not find any backups in ~/Library/Application Support/MobileSync")
+ unless $newest;
+
+use XML::TreePP;
+my $tpp = XML::TreePP->new();
+my $doc=$tpp->parsefile($backupdir.$newest.'/Manifest.plist');
+my $blob=$doc->{plist}->{dict}->{data}->[2] || die('Could not parse manifest. Invalid XML data?');
+my $plist_data=$reader->open_string(decode_base64($blob))->data;
+
+my @apps;
+foreach my $app (keys %{$plist_data->{Applications}}) {
+ push @apps, make_short( $plist_data->{Applications}->{$app}->{AppInfo}->{CFBundleDisplayName}||
+ $plist_data->{Applications}->{$app}->{AppInfo}->{CFBundleExecutable});
+}
+my $data='-F apps='.join(' -F apps=',@apps);
+my $res=`curl -s -H \"Expect:\" $data http://iphone.iusethis.com/profile/send`;
+
+if ($res =~ m/^\d+$/) {
+ system('open','http://iphone.iusethis.com/profile/view/'.$res.'?match=1');
+ terminate("Profile uploaded. Please check your browser");
+} else
+{
+ terminate('Unable to send profile to server '.$res);
+}
+
+sub terminate {
+ my $message=shift;
+# osascript -l AppleScript -e 'tell Application "Finder" to display alert "Call Frank" '
+ system('osascript -l AppleScript -e \'tell Application "Finder" to display alert "'.$message.'" \'');
+ exit
+}
+
+sub make_short {
+ my ($name)=@_;
+ $name =~ s/[^\w\@\-]//g;
+ return lc $name;
+}
+
+sub simple_escape {
+ my $text=shift;
+ #FIXME: this sucks
+ $text =~ s/\&/\&amp;/g;
+ $text =~ s/\s/\%20/g;
+ return $text;
+}
@@ -0,0 +1 @@
+APPL????
Binary file not shown.
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>app</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>App</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>fold</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <true/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>Binary</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeName</key>
+ <string>File</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>file</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>Binary</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>iusethis Profile Maker</string>
+ <key>CFBundleIconFile</key>
+ <string>Icon.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.iusethis.profilemaker</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>iusethis Profile Maker</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0 (v5M)</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+opendir(APPS,'/Applications') || terminate('Could not find /Applications');
+opendir(PREF,'~/Library/PreferencePanes') ;
+opendir(WIDGETS,'~/Library/Widgets') ;
+
+
+my @apps =
+ map { s/\.app$//; make_short($_) }
+ grep { !/^\./ && /\.app$/ && -d '/Applications/'.$_ } readdir(APPS),
+ map { s/\.prefPanes$//; make_short($_) }
+ grep { !/^\./ && /\.prefPanes$/ && -d '~/Library/PreferencePanes/'.$_ } readdir(PREF),
+ map { s/\.wdgt$//; make_short($_) }
+ grep { !/^\./ && /\.wdgt$/ && -d '~/Library/Widgets/'.$_ } readdir(WIDGETS);
+
+
+
+my $data='-F apps='.join(' -F apps=',@apps);
+my $res=`curl -s -H \"Expect:\" $data http://osx.iusethis.com/profile/send`;
+
+if ($res =~ m/^\d+$/) {
+ print "Profile uploaded...\n";
+ system('open','http://osx.iusethis.com/profile/view/'.$res.'?match=1');
+} else
+{
+ terminate('Unable to send profile to server '.$res);
+}
+
+sub terminate {
+ system('open','http://osx.iusethis.com/profile/error?message='.simple_escape(shift));
+}
+
+sub make_short {
+ my ($name)=@_;
+ $name =~ s/[^\w\@\-]//g;
+ return lc $name;
+}
+
+sub simple_escape {
+ my $text=shift;
+ #FIXME: this sucks
+ $text =~ s/\&/\&amp;/g;
+ $text =~ s/\s/\%20/g;
+ return $text;
+}
@@ -0,0 +1 @@
+APPL????
Binary file not shown.

0 comments on commit e0eeb89

Please sign in to comment.