Restructuring
Import flask app as well as new makefile and entirely new directory structure.
This commit is contained in:
1
web/.gitignore
vendored
1
web/.gitignore
vendored
@ -1 +0,0 @@
|
||||
upload.sh
|
@ -1,27 +0,0 @@
|
||||
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/json
|
||||
|
||||
<FilesMatch "\.(jpg|otf|ico)$">
|
||||
Header set Cache-Control "max-age=29030400, public"
|
||||
</FilesMatch>
|
||||
<FilesMatch "\.(css|js)$">
|
||||
Header set Cache-Control "max-age=5184000, public"
|
||||
</FilesMatch>
|
||||
<FilesMatch "index.html">
|
||||
Header set Cache-Control "max-age=2678400, public"
|
||||
</FilesMatch>
|
||||
<FilesMatch "\.json$">
|
||||
Header set Cache-Control "max-age=3600, public"
|
||||
</FilesMatch>
|
||||
|
||||
<FilesMatch "Makefile">
|
||||
deny from all
|
||||
</FilesMatch>
|
||||
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteRule ^redirect\.php$ - [L]
|
||||
RewriteCond %{QUERY_STRING} _escaped_fragment_=
|
||||
RewriteRule . staticrender.php [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /redirect.php [L]
|
57
web/Makefile
57
web/Makefile
@ -7,36 +7,63 @@ CSS_MIN = $(CSS_DIR)/styles.min.css
|
||||
JS_MIN_FILES := $(sort $(patsubst %.js, %.min.js, $(filter-out %.min.js, $(wildcard $(JS_DIR)/*.js))))
|
||||
CSS_MIN_FILES := $(sort $(patsubst %.css, %.min.css, $(filter-out %.min.css, $(wildcard $(CSS_DIR)/*.css))))
|
||||
|
||||
JS_COMPILER = utils/google-compiler --warning_level QUIET
|
||||
CSS_COMPILER = utils/yuicompressor --type css
|
||||
JS_COMPILER := java -jar bin/closure-compiler.jar --warning_level QUIET
|
||||
CSS_COMPILER := java -jar bin/yui-compressor.jar --type css
|
||||
|
||||
.PHONY: all clean
|
||||
DEBUG ?= 0
|
||||
|
||||
all: $(JS_MIN) $(CSS_MIN) utils/ServerExecute.class
|
||||
.PHONY: all deploy clean
|
||||
|
||||
all: $(JS_MIN) $(CSS_MIN)
|
||||
|
||||
ifeq ($(DEBUG),0)
|
||||
%.min.js: %.js
|
||||
@echo "Compiling javascript" $<
|
||||
@echo " JS " $@
|
||||
@$(JS_COMPILER) --js $< --js_output_file $@
|
||||
else
|
||||
%.min.js: %.js
|
||||
@echo " JS " $@
|
||||
@cat $< > $@
|
||||
endif
|
||||
|
||||
%.min.css: %.css
|
||||
@echo "Compiling stylesheet" $<
|
||||
@echo " CSS " $@
|
||||
@$(CSS_COMPILER) -o $@ $<
|
||||
|
||||
$(JS_MIN): $(JS_MIN_FILES)
|
||||
@echo "Assembling compiled javascripts"
|
||||
@echo " CAT " $@
|
||||
@cat $^ > $@
|
||||
|
||||
$(CSS_MIN): $(CSS_MIN_FILES)
|
||||
@echo "Assembling compiled stylesheets"
|
||||
@echo " CAT " $@
|
||||
@cat $^ > $@
|
||||
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
classpath := $(subst $(space),:,$(wildcard utils/htmlunit-2.8/*.jar))
|
||||
utils/ServerExecute.class: utils/ServerExecute.java
|
||||
@echo "Building HtmlUnit wrapper."
|
||||
@javac -classpath $(classpath) -d utils $^
|
||||
|
||||
clean:
|
||||
@echo " RM " $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES)
|
||||
@rm -fv $(JS_MIN) $(JS_MIN_FILES) $(CSS_MIN) $(CSS_MIN_FILES)
|
||||
|
||||
include ../deployment-config.mk
|
||||
|
||||
SSH_OPTS := -q -o ControlMaster=auto -o ControlPath=.ssh-deployment.sock
|
||||
|
||||
deploy: all
|
||||
@echo " SSH $(WEB_SERVER)"
|
||||
@ssh $(SSH_OPTS) -Nf $(WEB_SERVER)
|
||||
|
||||
@echo " RSYNC . $(WEB_SERVER):$(HTDOCS_PATH)"
|
||||
@ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo -u $(HTDOCS_USER) -v"
|
||||
@rsync -aizm --delete-excluded --exclude=.ssh-deployment.sock --exclude=Makefile --exclude=*.swp \
|
||||
--exclude=bin/ --include=scripts.min.js --include=styles.min.css \
|
||||
--exclude=*.js --exclude=*.css --rsh="ssh $(SSH_OPTS)" \
|
||||
--rsync-path="sudo -n -u $(HTDOCS_USER) rsync" \
|
||||
. "$(WEB_SERVER):$(HTDOCS_PATH)"
|
||||
|
||||
@echo " CHOWN $(HTDOCS_USER):$(HTDOCS_USER) $(WEB_SERVER):$(HTDOCS_PATH)"
|
||||
@ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo chown -R $(HTDOCS_USER):$(HTDOCS_USER) '$(HTDOCS_PATH)'"
|
||||
|
||||
@echo " CHMOD 750/640 $(WEB_SERVER):$(HTDOCS_PATH)"
|
||||
@ssh -t $(SSH_OPTS) $(WEB_SERVER) "sudo find '$(HTDOCS_PATH)' -type f -exec chmod 640 {} \;; \
|
||||
sudo find '$(HTDOCS_PATH)' -type d -exec chmod 750 {} \;;"
|
||||
|
||||
@echo " SSH $(WEB_SERVER)"
|
||||
@ssh -O exit $(SSH_OPTS) $(WEB_SERVER)
|
||||
|
BIN
web/bin/closure-compiler.jar
Normal file
BIN
web/bin/closure-compiler.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
<FilesMatch "(?<!min)\.css">
|
||||
deny from all
|
||||
</FilesMatch>
|
@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="fragment" content="!" />
|
||||
<meta name="medium" content="image" />
|
||||
<title>PhotoFloat</title>
|
||||
<title>Photos</title>
|
||||
<link href="css/styles.min.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="js/scripts.min.js"></script>
|
||||
</head>
|
||||
|
@ -1,3 +0,0 @@
|
||||
<FilesMatch "(?<!min)\.js">
|
||||
deny from all
|
||||
</FilesMatch>
|
File diff suppressed because it is too large
Load Diff
9597
web/js/000-jquery-1.9.1.js
Normal file
9597
web/js/000-jquery-1.9.1.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -297,7 +297,7 @@
|
||||
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
|
||||
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||
$.browser.msie && !supports_onhashchange && (function(){
|
||||
(navigator.appName == 'Microsoft Internet Explorer') && !supports_onhashchange && (function(){
|
||||
// Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
|
||||
// when running in "IE7 compatibility" mode.
|
||||
|
||||
|
@ -92,7 +92,7 @@
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "text",
|
||||
url: "auth?password=" + password,
|
||||
url: "auth?username=photos&password=" + password,
|
||||
success: function() {
|
||||
result(true);
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
$(window).load(function () {
|
||||
window._gaq = window._gaq || [];
|
||||
window._gaq.push(['_setAccount', 'UA-XXXXXX-X']);
|
||||
window._gaq.push(['_setAccount', 'UA-XXXXXX-XXX']);
|
||||
var ga = document.createElement('script');
|
||||
ga.type = 'text/javascript';
|
||||
ga.async = true;
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
function cachePath($path) {
|
||||
if ($path[0] == '/')
|
||||
$path = substr($path, 1);
|
||||
if ($path[strlen($path) - 1] == '/')
|
||||
$path = substr($path, 0, strlen($path) - 1);
|
||||
$path = str_replace('_-_', '-', str_replace('/', '-', str_replace(' ', '_', str_replace('(', '', str_replace(')', '', str_replace('#', '', str_replace('[', '', str_replace(']', '', str_replace('&', '', str_replace(',', '', str_replace('"', '', str_replace("'", '', strtolower($path)))))))))))));
|
||||
while (strpos($path, "--") !== false)
|
||||
$path = str_replace("--", "-", $path);
|
||||
while (strpos($path, "__") !== false)
|
||||
$path = str_replace("__", "_", $path);
|
||||
if (strlen(path) == 0)
|
||||
$path = "root";
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
$url = str_replace("\b", "", str_replace("\r", "", str_replace("\n", "", $_SERVER["SCRIPT_URL"])));
|
||||
if ($url[strlen($url) - 1] == '/')
|
||||
$url = substr($url, 0, strlen($url) - 1);
|
||||
|
||||
if (strpos(strtolower($url), ".php") == strlen($url) - 4) {
|
||||
$url = substr($url, 0, strlen($url) - 4);
|
||||
$index = strrpos($url, "/");
|
||||
$redirect = "/#!/".cachePath(substr($url, 0, $index))."/".cachePath(substr($url, $index));
|
||||
} else if (strpos(strtolower($url), ".jpg") == strlen($url) - 4) {
|
||||
$index = strrpos($url, "/");
|
||||
$redirect = "/#!/".cachePath(substr($url, 0, $index))."/".cachePath(substr($url, $index));
|
||||
} else if (strpos($url, "/cache/") === 0 || strpos($url, "/albums/") === 0 || strpos($url, "/img/") === 0 || strpos($url, "/img/") === 0 || strpos($url, "/js/") === 0 || strpos($url, "/css/") === 0) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
exit();
|
||||
} else
|
||||
$redirect = "/#!/".cachePath($url);
|
||||
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location: $redirect");
|
||||
|
||||
?>
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
if ($_ENV["SCRIPT_URL"] == $_ENV["SCRIPT_NAME"])
|
||||
die("Infinite loop.");
|
||||
putenv('LANG=en_US.UTF-8');
|
||||
passthru("utils/serverexecute ".escapeshellarg($_ENV["SCRIPT_URI"]."#!".$_GET["_escaped_fragment_"]));
|
||||
?>
|
1
web/utils/.gitignore
vendored
1
web/utils/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*.class
|
@ -1 +0,0 @@
|
||||
deny from all
|
@ -1,19 +0,0 @@
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
|
||||
public class ServerExecute {
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("You must give a url as an argument.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final WebClient webClient = new WebClient();
|
||||
HtmlPage page = webClient.getPage(args[0]);
|
||||
webClient.waitForBackgroundJavaScript(2000);
|
||||
System.out.println(page.asXml());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
me=$(dirname "$0")
|
||||
java -jar "$me/google-compiler.jar" $@
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd $(dirname $0)
|
||||
java -Xmx128m -classpath $(for i in htmlunit-2.8/*; do echo $i; done|tr '\n' ':') ServerExecute $@
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
me=$(dirname "$0")
|
||||
java -jar "$me/yuicompressor-2.4.6.jar" $@
|
Reference in New Issue
Block a user